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/cli.js
CHANGED
|
@@ -1,60 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var module$1 = require('module');
|
|
4
|
-
var fs11 = require('fs');
|
|
5
|
-
var path6 = require('path');
|
|
6
|
-
require('crypto');
|
|
7
|
-
var url = require('url');
|
|
8
|
-
var worker_threads = require('worker_threads');
|
|
9
|
-
var os = require('os');
|
|
10
|
-
var zod = require('zod');
|
|
11
|
-
var fs7 = require('fs/promises');
|
|
12
|
-
var prompts = require('@clack/prompts');
|
|
13
|
-
var util = require('util');
|
|
14
|
-
var child_process = require('child_process');
|
|
15
|
-
|
|
16
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
17
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
|
|
19
|
-
function _interopNamespace(e) {
|
|
20
|
-
if (e && e.__esModule) return e;
|
|
21
|
-
var n = Object.create(null);
|
|
22
|
-
if (e) {
|
|
23
|
-
Object.keys(e).forEach(function (k) {
|
|
24
|
-
if (k !== 'default') {
|
|
25
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
26
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () { return e[k]; }
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
n.default = e;
|
|
34
|
-
return Object.freeze(n);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
|
|
38
|
-
var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
|
|
39
|
-
var fs7__default = /*#__PURE__*/_interopDefault(fs7);
|
|
40
|
-
|
|
1
|
+
const __importMetaUrl = typeof __filename !== "undefined" ? require("node:url").pathToFileURL(__filename).href : "file://unknown";
|
|
41
2
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
3
|
+
"use strict";
|
|
42
4
|
var __create = Object.create;
|
|
43
5
|
var __defProp = Object.defineProperty;
|
|
44
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
45
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
46
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
47
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
48
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
49
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
50
|
-
}) : x)(function(x) {
|
|
51
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
52
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
53
|
-
});
|
|
54
10
|
var __esm = (fn, res) => function __init() {
|
|
55
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
56
12
|
};
|
|
57
|
-
var __commonJS = (cb, mod) => function
|
|
13
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
58
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
59
15
|
};
|
|
60
16
|
var __export = (target, all) => {
|
|
@@ -74,14 +30,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
74
30
|
// file that has been converted to a CommonJS file using a Babel-
|
|
75
31
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
76
32
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
77
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
78
34
|
mod
|
|
79
35
|
));
|
|
80
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
81
37
|
|
|
82
38
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
83
39
|
var require_error = __commonJS({
|
|
84
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(
|
|
40
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports2) {
|
|
41
|
+
"use strict";
|
|
85
42
|
var CommanderError2 = class extends Error {
|
|
86
43
|
/**
|
|
87
44
|
* Constructs the CommanderError class
|
|
@@ -109,14 +66,15 @@ var require_error = __commonJS({
|
|
|
109
66
|
this.name = this.constructor.name;
|
|
110
67
|
}
|
|
111
68
|
};
|
|
112
|
-
|
|
113
|
-
|
|
69
|
+
exports2.CommanderError = CommanderError2;
|
|
70
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
114
71
|
}
|
|
115
72
|
});
|
|
116
73
|
|
|
117
74
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
118
75
|
var require_argument = __commonJS({
|
|
119
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(
|
|
76
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports2) {
|
|
77
|
+
"use strict";
|
|
120
78
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
121
79
|
var Argument2 = class {
|
|
122
80
|
/**
|
|
@@ -236,14 +194,15 @@ var require_argument = __commonJS({
|
|
|
236
194
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
237
195
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
238
196
|
}
|
|
239
|
-
|
|
240
|
-
|
|
197
|
+
exports2.Argument = Argument2;
|
|
198
|
+
exports2.humanReadableArgName = humanReadableArgName;
|
|
241
199
|
}
|
|
242
200
|
});
|
|
243
201
|
|
|
244
202
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
245
203
|
var require_help = __commonJS({
|
|
246
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(
|
|
204
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports2) {
|
|
205
|
+
"use strict";
|
|
247
206
|
var { humanReadableArgName } = require_argument();
|
|
248
207
|
var Help2 = class {
|
|
249
208
|
constructor() {
|
|
@@ -651,13 +610,14 @@ var require_help = __commonJS({
|
|
|
651
610
|
}).join("\n");
|
|
652
611
|
}
|
|
653
612
|
};
|
|
654
|
-
|
|
613
|
+
exports2.Help = Help2;
|
|
655
614
|
}
|
|
656
615
|
});
|
|
657
616
|
|
|
658
617
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
659
618
|
var require_option = __commonJS({
|
|
660
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(
|
|
619
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports2) {
|
|
620
|
+
"use strict";
|
|
661
621
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
662
622
|
var Option2 = class {
|
|
663
623
|
/**
|
|
@@ -922,14 +882,15 @@ var require_option = __commonJS({
|
|
|
922
882
|
}
|
|
923
883
|
return { shortFlag, longFlag };
|
|
924
884
|
}
|
|
925
|
-
|
|
926
|
-
|
|
885
|
+
exports2.Option = Option2;
|
|
886
|
+
exports2.DualOptions = DualOptions;
|
|
927
887
|
}
|
|
928
888
|
});
|
|
929
889
|
|
|
930
890
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
931
891
|
var require_suggestSimilar = __commonJS({
|
|
932
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(
|
|
892
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
893
|
+
"use strict";
|
|
933
894
|
var maxDistance = 3;
|
|
934
895
|
function editDistance(a, b) {
|
|
935
896
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -1003,18 +964,19 @@ var require_suggestSimilar = __commonJS({
|
|
|
1003
964
|
}
|
|
1004
965
|
return "";
|
|
1005
966
|
}
|
|
1006
|
-
|
|
967
|
+
exports2.suggestSimilar = suggestSimilar;
|
|
1007
968
|
}
|
|
1008
969
|
});
|
|
1009
970
|
|
|
1010
971
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
1011
972
|
var require_command = __commonJS({
|
|
1012
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(
|
|
1013
|
-
|
|
1014
|
-
var
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
973
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports2) {
|
|
974
|
+
"use strict";
|
|
975
|
+
var EventEmitter = require("events").EventEmitter;
|
|
976
|
+
var childProcess = require("child_process");
|
|
977
|
+
var path30 = require("path");
|
|
978
|
+
var fs16 = require("fs");
|
|
979
|
+
var process2 = require("process");
|
|
1018
980
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1019
981
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1020
982
|
var { Help: Help2 } = require_help();
|
|
@@ -1423,6 +1385,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1423
1385
|
this._exitCallback = (err) => {
|
|
1424
1386
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1425
1387
|
throw err;
|
|
1388
|
+
} else {
|
|
1426
1389
|
}
|
|
1427
1390
|
};
|
|
1428
1391
|
}
|
|
@@ -3045,29 +3008,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3045
3008
|
return arg;
|
|
3046
3009
|
});
|
|
3047
3010
|
}
|
|
3048
|
-
|
|
3011
|
+
exports2.Command = Command2;
|
|
3049
3012
|
}
|
|
3050
3013
|
});
|
|
3051
3014
|
|
|
3052
3015
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3053
3016
|
var require_commander = __commonJS({
|
|
3054
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(
|
|
3017
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports2) {
|
|
3018
|
+
"use strict";
|
|
3055
3019
|
var { Argument: Argument2 } = require_argument();
|
|
3056
3020
|
var { Command: Command2 } = require_command();
|
|
3057
3021
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3058
3022
|
var { Help: Help2 } = require_help();
|
|
3059
3023
|
var { Option: Option2 } = require_option();
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3024
|
+
exports2.program = new Command2();
|
|
3025
|
+
exports2.createCommand = (name) => new Command2(name);
|
|
3026
|
+
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3027
|
+
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3028
|
+
exports2.Command = Command2;
|
|
3029
|
+
exports2.Option = Option2;
|
|
3030
|
+
exports2.Argument = Argument2;
|
|
3031
|
+
exports2.Help = Help2;
|
|
3032
|
+
exports2.CommanderError = CommanderError2;
|
|
3033
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
3034
|
+
exports2.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3071
3035
|
}
|
|
3072
3036
|
});
|
|
3073
3037
|
|
|
@@ -3075,7 +3039,8 @@ var require_commander = __commonJS({
|
|
|
3075
3039
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3076
3040
|
var init_esm = __esm({
|
|
3077
3041
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3078
|
-
|
|
3042
|
+
"use strict";
|
|
3043
|
+
import_index = __toESM(require_commander(), 1);
|
|
3079
3044
|
({
|
|
3080
3045
|
program,
|
|
3081
3046
|
createCommand,
|
|
@@ -3120,6 +3085,7 @@ function errorExitCode(error) {
|
|
|
3120
3085
|
var CliError, CliUsageError;
|
|
3121
3086
|
var init_errors = __esm({
|
|
3122
3087
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3088
|
+
"use strict";
|
|
3123
3089
|
CliError = class extends Error {
|
|
3124
3090
|
exitCode;
|
|
3125
3091
|
code;
|
|
@@ -3144,7 +3110,7 @@ function getNodeModuleRef() {
|
|
|
3144
3110
|
if (isBrowser) return null;
|
|
3145
3111
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
3146
3112
|
try {
|
|
3147
|
-
const test = typeof
|
|
3113
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
3148
3114
|
nodeModuleRef = test;
|
|
3149
3115
|
return test;
|
|
3150
3116
|
} catch {
|
|
@@ -3152,22 +3118,44 @@ function getNodeModuleRef() {
|
|
|
3152
3118
|
return null;
|
|
3153
3119
|
}
|
|
3154
3120
|
}
|
|
3121
|
+
function getCurrentFileUrl() {
|
|
3122
|
+
if (__importMetaUrl) {
|
|
3123
|
+
return __importMetaUrl;
|
|
3124
|
+
}
|
|
3125
|
+
if (typeof __filename !== "undefined") {
|
|
3126
|
+
return `file://${__filename.replace(/\\/g, "/")}`;
|
|
3127
|
+
}
|
|
3128
|
+
return "file://unknown";
|
|
3129
|
+
}
|
|
3155
3130
|
function getNodePath() {
|
|
3156
3131
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3132
|
+
if (!_nodePath) {
|
|
3133
|
+
if (typeof require === "function") {
|
|
3134
|
+
_nodePath = require("path");
|
|
3135
|
+
} else {
|
|
3136
|
+
const nodeRequire = getNodeModuleRef();
|
|
3137
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3138
|
+
_nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3160
3141
|
return _nodePath;
|
|
3161
3142
|
}
|
|
3162
3143
|
function getNodeUrl() {
|
|
3163
3144
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3145
|
+
if (!_nodeUrl) {
|
|
3146
|
+
if (typeof require === "function") {
|
|
3147
|
+
_nodeUrl = require("url");
|
|
3148
|
+
} else {
|
|
3149
|
+
const nodeRequire = getNodeModuleRef();
|
|
3150
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3151
|
+
_nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
|
|
3152
|
+
}
|
|
3153
|
+
}
|
|
3167
3154
|
return _nodeUrl;
|
|
3168
3155
|
}
|
|
3169
3156
|
function getDirname(importMetaUrl) {
|
|
3170
3157
|
if (isBrowser) return "";
|
|
3158
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
3171
3159
|
const nodePath = getNodePath();
|
|
3172
3160
|
const nodeUrl = getNodeUrl();
|
|
3173
3161
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
@@ -3175,12 +3163,15 @@ function getDirname(importMetaUrl) {
|
|
|
3175
3163
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3176
3164
|
var init_esmHelpers = __esm({
|
|
3177
3165
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3166
|
+
"use strict";
|
|
3178
3167
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3179
3168
|
nodeModuleRef = null;
|
|
3180
3169
|
_nodePath = null;
|
|
3181
3170
|
_nodeUrl = null;
|
|
3182
3171
|
}
|
|
3183
3172
|
});
|
|
3173
|
+
|
|
3174
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3184
3175
|
function platformKey() {
|
|
3185
3176
|
if (isBrowser2) return "browser";
|
|
3186
3177
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3196,7 +3187,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3196
3187
|
}
|
|
3197
3188
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3198
3189
|
if (envPath) {
|
|
3199
|
-
if (
|
|
3190
|
+
if (fs.existsSync(envPath)) {
|
|
3200
3191
|
return { path: envPath, source: "env", platform, tried };
|
|
3201
3192
|
}
|
|
3202
3193
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3205,7 +3196,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3205
3196
|
for (const pkg of prebuiltPkgs) {
|
|
3206
3197
|
try {
|
|
3207
3198
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3208
|
-
if (
|
|
3199
|
+
if (fs.existsSync(candidate)) {
|
|
3209
3200
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3210
3201
|
}
|
|
3211
3202
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3216,13 +3207,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3216
3207
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3217
3208
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3218
3209
|
if (runtimeDir) {
|
|
3219
|
-
for (const depth of ["..",
|
|
3220
|
-
const pkgRoot =
|
|
3210
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3211
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3221
3212
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3222
3213
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3223
|
-
const candidate =
|
|
3214
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3224
3215
|
tried.push(`self-bundled:${candidate}`);
|
|
3225
|
-
if (
|
|
3216
|
+
if (fs.existsSync(candidate)) {
|
|
3226
3217
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3227
3218
|
}
|
|
3228
3219
|
}
|
|
@@ -3234,39 +3225,45 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3234
3225
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3235
3226
|
const localCandidates = [];
|
|
3236
3227
|
for (const bin of BINARY_NAMES) {
|
|
3237
|
-
localCandidates.push(
|
|
3238
|
-
localCandidates.push(
|
|
3239
|
-
localCandidates.push(
|
|
3240
|
-
localCandidates.push(
|
|
3228
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3229
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3230
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3231
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3241
3232
|
}
|
|
3242
3233
|
for (const startDir of [cwd2, base]) {
|
|
3243
3234
|
let dir = startDir;
|
|
3244
3235
|
for (let i = 0; i < 6; i++) {
|
|
3245
|
-
const nativeDir =
|
|
3236
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3246
3237
|
for (const bin of BINARY_NAMES) {
|
|
3247
|
-
localCandidates.push(
|
|
3248
|
-
localCandidates.push(
|
|
3249
|
-
localCandidates.push(
|
|
3250
|
-
localCandidates.push(
|
|
3238
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3239
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3240
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3241
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3251
3242
|
}
|
|
3252
|
-
const parent =
|
|
3243
|
+
const parent = path.resolve(dir, "..");
|
|
3253
3244
|
if (parent === dir) break;
|
|
3254
3245
|
dir = parent;
|
|
3255
3246
|
}
|
|
3256
3247
|
}
|
|
3257
3248
|
for (const candidate of localCandidates) {
|
|
3258
3249
|
tried.push(`local:${candidate}`);
|
|
3259
|
-
if (
|
|
3250
|
+
if (fs.existsSync(candidate)) {
|
|
3260
3251
|
return { path: candidate, source: "local", platform, tried };
|
|
3261
3252
|
}
|
|
3262
3253
|
}
|
|
3263
3254
|
return { path: null, source: "not-found", platform, tried };
|
|
3264
3255
|
}
|
|
3265
|
-
var isBrowser2, _require, PLATFORM_MAP;
|
|
3256
|
+
var import_node_module, fs, path, isBrowser2, _require, PLATFORM_MAP;
|
|
3266
3257
|
var init_native_resolution = __esm({
|
|
3267
3258
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3259
|
+
"use strict";
|
|
3260
|
+
import_node_module = require("module");
|
|
3261
|
+
fs = __toESM(require("fs"));
|
|
3262
|
+
path = __toESM(require("path"));
|
|
3268
3263
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3269
|
-
_require =
|
|
3264
|
+
_require = (0, import_node_module.createRequire)(
|
|
3265
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
3266
|
+
);
|
|
3270
3267
|
PLATFORM_MAP = {
|
|
3271
3268
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
3272
3269
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -3277,6 +3274,8 @@ var init_native_resolution = __esm({
|
|
|
3277
3274
|
};
|
|
3278
3275
|
}
|
|
3279
3276
|
});
|
|
3277
|
+
|
|
3278
|
+
// packages/domain/shared/src/index.ts
|
|
3280
3279
|
function createLogger(namespace) {
|
|
3281
3280
|
const prefix = `[${namespace}]`;
|
|
3282
3281
|
return {
|
|
@@ -3319,9 +3318,9 @@ function loadNativeBinding(options) {
|
|
|
3319
3318
|
const { runtimeDir, candidates, isValid } = options;
|
|
3320
3319
|
const loadErrors = [];
|
|
3321
3320
|
for (const candidate of candidates) {
|
|
3322
|
-
const candidatePath =
|
|
3321
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
3323
3322
|
try {
|
|
3324
|
-
if (!
|
|
3323
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
3325
3324
|
continue;
|
|
3326
3325
|
}
|
|
3327
3326
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3353,9 +3352,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3353
3352
|
}
|
|
3354
3353
|
}
|
|
3355
3354
|
if (!includeDefaultCandidates) return candidates;
|
|
3356
|
-
if (
|
|
3355
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
3357
3356
|
try {
|
|
3358
|
-
for (const entry of
|
|
3357
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
3359
3358
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3360
3359
|
}
|
|
3361
3360
|
} catch {
|
|
@@ -3364,29 +3363,35 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3364
3363
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3365
3364
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3366
3365
|
for (const bin of BINARY_NAMES) {
|
|
3367
|
-
candidates.push(
|
|
3368
|
-
candidates.push(
|
|
3369
|
-
candidates.push(
|
|
3370
|
-
candidates.push(
|
|
3371
|
-
candidates.push(
|
|
3372
|
-
candidates.push(
|
|
3373
|
-
candidates.push(
|
|
3374
|
-
candidates.push(
|
|
3375
|
-
candidates.push(
|
|
3366
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
3367
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3368
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3369
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3370
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3371
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3372
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3373
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3374
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3376
3375
|
}
|
|
3377
3376
|
return Array.from(new Set(candidates));
|
|
3378
3377
|
}
|
|
3379
3378
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3380
|
-
if (dir) return
|
|
3379
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
3381
3380
|
try {
|
|
3382
|
-
return
|
|
3381
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3383
3382
|
} catch {
|
|
3384
3383
|
return process.cwd();
|
|
3385
3384
|
}
|
|
3386
3385
|
}
|
|
3387
|
-
var TwError, _require2;
|
|
3386
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module2, TwError, _require2;
|
|
3388
3387
|
var init_src = __esm({
|
|
3389
3388
|
"packages/domain/shared/src/index.ts"() {
|
|
3389
|
+
"use strict";
|
|
3390
|
+
import_node_crypto = require("crypto");
|
|
3391
|
+
import_node_fs = __toESM(require("fs"));
|
|
3392
|
+
import_node_path = __toESM(require("path"));
|
|
3393
|
+
import_node_url = require("url");
|
|
3394
|
+
import_node_module2 = require("module");
|
|
3390
3395
|
init_esmHelpers();
|
|
3391
3396
|
init_native_resolution();
|
|
3392
3397
|
TwError = class _TwError extends Error {
|
|
@@ -3441,7 +3446,9 @@ var init_src = __esm({
|
|
|
3441
3446
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3442
3447
|
}
|
|
3443
3448
|
};
|
|
3444
|
-
_require2 =
|
|
3449
|
+
_require2 = (0, import_node_module2.createRequire)(
|
|
3450
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : __importMetaUrl ?? "file://unknown"
|
|
3451
|
+
);
|
|
3445
3452
|
}
|
|
3446
3453
|
});
|
|
3447
3454
|
|
|
@@ -3478,8 +3485,8 @@ function getDirname2() {
|
|
|
3478
3485
|
if (typeof __dirname !== "undefined") {
|
|
3479
3486
|
return __dirname;
|
|
3480
3487
|
}
|
|
3481
|
-
if (typeof
|
|
3482
|
-
return
|
|
3488
|
+
if (typeof import_meta !== "undefined" && __importMetaUrl) {
|
|
3489
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
|
|
3483
3490
|
}
|
|
3484
3491
|
return process.cwd();
|
|
3485
3492
|
}
|
|
@@ -3684,13 +3691,17 @@ function hasNativeWatchBinding() {
|
|
|
3684
3691
|
return false;
|
|
3685
3692
|
}
|
|
3686
3693
|
}
|
|
3687
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3694
|
+
var import_node_path2, import_node_url2, import_meta, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3688
3695
|
var init_native_bridge = __esm({
|
|
3689
3696
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3697
|
+
"use strict";
|
|
3698
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
3699
|
+
import_node_url2 = require("url");
|
|
3690
3700
|
init_src();
|
|
3701
|
+
import_meta = {};
|
|
3691
3702
|
log = createDebugLogger("scanner:native");
|
|
3692
|
-
isValidScannerBinding = (
|
|
3693
|
-
const candidate =
|
|
3703
|
+
isValidScannerBinding = (module2) => {
|
|
3704
|
+
const candidate = module2;
|
|
3694
3705
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
3695
3706
|
};
|
|
3696
3707
|
createScannerBridgeLoader = () => {
|
|
@@ -3767,13 +3778,15 @@ var init_native_bridge = __esm({
|
|
|
3767
3778
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3768
3779
|
}
|
|
3769
3780
|
});
|
|
3781
|
+
|
|
3782
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3770
3783
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3771
|
-
const dir = cacheDir ?
|
|
3772
|
-
return
|
|
3784
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3785
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
3773
3786
|
}
|
|
3774
3787
|
function readCache(rootDir, cacheDir) {
|
|
3775
3788
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3776
|
-
|
|
3789
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3777
3790
|
const result = cacheReadNative(cachePath);
|
|
3778
3791
|
if (!result) return [];
|
|
3779
3792
|
return result.entries.map((e) => ({
|
|
@@ -3788,7 +3801,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3788
3801
|
}
|
|
3789
3802
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3790
3803
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3791
|
-
|
|
3804
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3792
3805
|
const success = cacheWriteNative(cachePath, entries);
|
|
3793
3806
|
if (!success) {
|
|
3794
3807
|
throw new Error(
|
|
@@ -3807,11 +3820,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3807
3820
|
nowMs
|
|
3808
3821
|
);
|
|
3809
3822
|
}
|
|
3823
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
3810
3824
|
var init_cache_native = __esm({
|
|
3811
3825
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3826
|
+
"use strict";
|
|
3827
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
3828
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
3812
3829
|
init_native_bridge();
|
|
3830
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3813
3831
|
}
|
|
3814
3832
|
});
|
|
3833
|
+
|
|
3834
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3815
3835
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3816
3836
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3817
3837
|
if (native !== null) return native;
|
|
@@ -3829,7 +3849,7 @@ function mergeResults(batchResults) {
|
|
|
3829
3849
|
}
|
|
3830
3850
|
function runChunkInWorker(filePaths) {
|
|
3831
3851
|
return new Promise((resolve2, reject) => {
|
|
3832
|
-
const worker = new
|
|
3852
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
3833
3853
|
workerData: { filePaths }
|
|
3834
3854
|
});
|
|
3835
3855
|
worker.once("message", (payload) => {
|
|
@@ -3849,10 +3869,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3849
3869
|
const {
|
|
3850
3870
|
extensions = DEFAULT_EXTENSIONS,
|
|
3851
3871
|
ignoreDirs = DEFAULT_IGNORES,
|
|
3852
|
-
maxWorkers = Math.max(1,
|
|
3872
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
3853
3873
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3854
3874
|
} = options;
|
|
3855
|
-
const files = collectFiles(
|
|
3875
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
3856
3876
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3857
3877
|
return mergeResults(batchExtractClassesNative(files));
|
|
3858
3878
|
}
|
|
@@ -3868,33 +3888,42 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3868
3888
|
}
|
|
3869
3889
|
return mergeResults(allResults);
|
|
3870
3890
|
}
|
|
3871
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3891
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3872
3892
|
var init_parallel_scanner = __esm({
|
|
3873
3893
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3894
|
+
"use strict";
|
|
3895
|
+
import_node_worker_threads = require("worker_threads");
|
|
3896
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3897
|
+
import_node_os = require("os");
|
|
3898
|
+
import_node_url3 = require("url");
|
|
3874
3899
|
init_src2();
|
|
3875
3900
|
init_native_bridge();
|
|
3876
3901
|
PARALLEL_THRESHOLD = 50;
|
|
3877
3902
|
DEFAULT_CHUNK_SIZE = 150;
|
|
3878
|
-
if (!
|
|
3879
|
-
const { filePaths } =
|
|
3903
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
3904
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
3880
3905
|
try {
|
|
3881
3906
|
const results = batchExtractClassesNative(filePaths);
|
|
3882
3907
|
const msg = { ok: true, results };
|
|
3883
|
-
|
|
3908
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3884
3909
|
} catch (error) {
|
|
3885
3910
|
const msg = {
|
|
3886
3911
|
ok: false,
|
|
3887
3912
|
error: error instanceof Error ? error.message : String(error)
|
|
3888
3913
|
};
|
|
3889
|
-
|
|
3914
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3890
3915
|
}
|
|
3891
3916
|
}
|
|
3892
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3917
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(__importMetaUrl);
|
|
3893
3918
|
}
|
|
3894
3919
|
});
|
|
3895
|
-
|
|
3920
|
+
|
|
3921
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3922
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3896
3923
|
var init_schemas = __esm({
|
|
3897
3924
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3925
|
+
"use strict";
|
|
3926
|
+
import_zod = require("zod");
|
|
3898
3927
|
init_src();
|
|
3899
3928
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3900
3929
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3914,40 +3943,40 @@ var init_schemas = __esm({
|
|
|
3914
3943
|
parsed.error
|
|
3915
3944
|
);
|
|
3916
3945
|
};
|
|
3917
|
-
NonNegativeIntegerSchema =
|
|
3918
|
-
ScanWorkspaceOptionsSchema =
|
|
3919
|
-
includeExtensions:
|
|
3920
|
-
ignoreDirectories:
|
|
3921
|
-
useCache:
|
|
3922
|
-
cacheDir:
|
|
3923
|
-
smartInvalidation:
|
|
3946
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
3947
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
3948
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3949
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3950
|
+
useCache: import_zod.z.boolean().optional(),
|
|
3951
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
3952
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
3924
3953
|
});
|
|
3925
|
-
ScanFileResultSchema =
|
|
3926
|
-
file:
|
|
3927
|
-
classes:
|
|
3928
|
-
hash:
|
|
3954
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
3955
|
+
file: import_zod.z.string(),
|
|
3956
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
3957
|
+
hash: import_zod.z.string().optional()
|
|
3929
3958
|
});
|
|
3930
|
-
ScanWorkspaceResultSchema =
|
|
3931
|
-
files:
|
|
3959
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
3960
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
3932
3961
|
totalFiles: NonNegativeIntegerSchema,
|
|
3933
|
-
uniqueClasses:
|
|
3962
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
3934
3963
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3935
3964
|
message: "scan result totalFiles must match files.length",
|
|
3936
3965
|
path: ["totalFiles"]
|
|
3937
3966
|
});
|
|
3938
|
-
|
|
3939
|
-
rootDir:
|
|
3967
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
3968
|
+
rootDir: import_zod.z.string().min(1),
|
|
3940
3969
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3941
3970
|
});
|
|
3942
|
-
ScannerWorkerSuccessMessageSchema =
|
|
3943
|
-
ok:
|
|
3971
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
3972
|
+
ok: import_zod.z.literal(true),
|
|
3944
3973
|
result: ScanWorkspaceResultSchema
|
|
3945
3974
|
});
|
|
3946
|
-
ScannerWorkerErrorMessageSchema =
|
|
3947
|
-
ok:
|
|
3948
|
-
error:
|
|
3975
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
3976
|
+
ok: import_zod.z.literal(false),
|
|
3977
|
+
error: import_zod.z.string().optional()
|
|
3949
3978
|
});
|
|
3950
|
-
ScannerWorkerMessageSchema =
|
|
3979
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
3951
3980
|
ScannerWorkerSuccessMessageSchema,
|
|
3952
3981
|
ScannerWorkerErrorMessageSchema
|
|
3953
3982
|
]);
|
|
@@ -3977,8 +4006,8 @@ function getRuntimeDir() {
|
|
|
3977
4006
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3978
4007
|
return __dirname;
|
|
3979
4008
|
}
|
|
3980
|
-
if (typeof
|
|
3981
|
-
return
|
|
4009
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
4010
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
3982
4011
|
}
|
|
3983
4012
|
return process.cwd();
|
|
3984
4013
|
}
|
|
@@ -3987,18 +4016,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
3987
4016
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3988
4017
|
return __dirname;
|
|
3989
4018
|
}
|
|
3990
|
-
if (typeof
|
|
3991
|
-
return
|
|
4019
|
+
if (typeof import_meta2 !== "undefined" && __importMetaUrl) {
|
|
4020
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
3992
4021
|
}
|
|
3993
4022
|
return process.cwd();
|
|
3994
4023
|
})();
|
|
3995
4024
|
const candidates = [
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4025
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
4026
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
4027
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
3999
4028
|
];
|
|
4000
4029
|
for (const candidate of candidates) {
|
|
4001
|
-
if (
|
|
4030
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
4002
4031
|
}
|
|
4003
4032
|
return null;
|
|
4004
4033
|
}
|
|
@@ -4010,7 +4039,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4010
4039
|
}
|
|
4011
4040
|
return new Promise((resolve2, reject) => {
|
|
4012
4041
|
const settleState = { settled: false };
|
|
4013
|
-
const worker = new
|
|
4042
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4014
4043
|
const timeout = setTimeout(() => {
|
|
4015
4044
|
if (!settleState.settled) {
|
|
4016
4045
|
settleState.settled = true;
|
|
@@ -4055,19 +4084,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4055
4084
|
if (!currentDir) continue;
|
|
4056
4085
|
const entries = (() => {
|
|
4057
4086
|
try {
|
|
4058
|
-
return
|
|
4087
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4059
4088
|
} catch {
|
|
4060
4089
|
return [];
|
|
4061
4090
|
}
|
|
4062
4091
|
})();
|
|
4063
4092
|
for (const entry of entries) {
|
|
4064
|
-
const fullPath =
|
|
4093
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
4065
4094
|
if (entry.isDirectory()) {
|
|
4066
4095
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4067
4096
|
continue;
|
|
4068
4097
|
}
|
|
4069
4098
|
if (!entry.isFile()) continue;
|
|
4070
|
-
if (!extensionSet.has(
|
|
4099
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
4071
4100
|
candidates.push(fullPath);
|
|
4072
4101
|
}
|
|
4073
4102
|
}
|
|
@@ -4094,7 +4123,7 @@ function scanSource(source) {
|
|
|
4094
4123
|
);
|
|
4095
4124
|
}
|
|
4096
4125
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4097
|
-
return includeExtensions.includes(
|
|
4126
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
4098
4127
|
}
|
|
4099
4128
|
function scanFile(filePath) {
|
|
4100
4129
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4114,7 +4143,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4114
4143
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4115
4144
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4116
4145
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4117
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4146
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4118
4147
|
const files = [];
|
|
4119
4148
|
const unique = /* @__PURE__ */ new Set();
|
|
4120
4149
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4154,7 +4183,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4154
4183
|
for (const filePath of candidates) {
|
|
4155
4184
|
const stat = (() => {
|
|
4156
4185
|
try {
|
|
4157
|
-
return
|
|
4186
|
+
return import_node_fs3.default.statSync(filePath);
|
|
4158
4187
|
} catch {
|
|
4159
4188
|
return null;
|
|
4160
4189
|
}
|
|
@@ -4180,7 +4209,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4180
4209
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4181
4210
|
const content = (() => {
|
|
4182
4211
|
try {
|
|
4183
|
-
return
|
|
4212
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
4184
4213
|
} catch {
|
|
4185
4214
|
return null;
|
|
4186
4215
|
}
|
|
@@ -4261,9 +4290,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4261
4290
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
4262
4291
|
}
|
|
4263
4292
|
}
|
|
4264
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4293
|
+
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;
|
|
4265
4294
|
var init_src2 = __esm({
|
|
4266
4295
|
"packages/domain/scanner/src/index.ts"() {
|
|
4296
|
+
"use strict";
|
|
4297
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
4298
|
+
import_node_module3 = require("module");
|
|
4299
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4300
|
+
import_node_url4 = require("url");
|
|
4301
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4267
4302
|
init_src();
|
|
4268
4303
|
init_cache_native();
|
|
4269
4304
|
init_native_bridge();
|
|
@@ -4271,6 +4306,7 @@ var init_src2 = __esm({
|
|
|
4271
4306
|
init_schemas();
|
|
4272
4307
|
init_schemas();
|
|
4273
4308
|
init_native_bridge();
|
|
4309
|
+
import_meta2 = {};
|
|
4274
4310
|
log2 = createLogger("scanner");
|
|
4275
4311
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4276
4312
|
createNativeParserLoader = () => {
|
|
@@ -4284,7 +4320,7 @@ var init_src2 = __esm({
|
|
|
4284
4320
|
const loadNativeParserBinding = () => {
|
|
4285
4321
|
if (_state.binding !== void 0) return _state.binding;
|
|
4286
4322
|
const runtimeDir = getRuntimeDir();
|
|
4287
|
-
const req =
|
|
4323
|
+
const req = (0, import_node_module3.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
4288
4324
|
const _platform = process.platform;
|
|
4289
4325
|
const _arch = process.arch;
|
|
4290
4326
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4292,27 +4328,27 @@ var init_src2 = __esm({
|
|
|
4292
4328
|
const candidates = [
|
|
4293
4329
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4294
4330
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4331
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4332
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4333
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4298
4334
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4299
4335
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4336
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4337
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4338
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4303
4339
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4304
|
-
|
|
4305
|
-
|
|
4340
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4341
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4306
4342
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4307
|
-
|
|
4308
|
-
|
|
4343
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4344
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4309
4345
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4346
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4347
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4348
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "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(
|
|
4316
4352
|
runtimeDir,
|
|
4317
4353
|
"..",
|
|
4318
4354
|
"..",
|
|
@@ -4324,7 +4360,7 @@ var init_src2 = __esm({
|
|
|
4324
4360
|
)
|
|
4325
4361
|
];
|
|
4326
4362
|
for (const fullPath of candidates) {
|
|
4327
|
-
if (!
|
|
4363
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
4328
4364
|
try {
|
|
4329
4365
|
const required = req(fullPath);
|
|
4330
4366
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4356,6 +4392,8 @@ var init_src2 = __esm({
|
|
|
4356
4392
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4357
4393
|
}
|
|
4358
4394
|
});
|
|
4395
|
+
|
|
4396
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4359
4397
|
function formatErrorMessage(error) {
|
|
4360
4398
|
return error instanceof Error ? error.message : String(error);
|
|
4361
4399
|
}
|
|
@@ -4366,7 +4404,7 @@ function isRecord(value) {
|
|
|
4366
4404
|
}
|
|
4367
4405
|
async function pathExists(filePath) {
|
|
4368
4406
|
try {
|
|
4369
|
-
await
|
|
4407
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
4370
4408
|
return true;
|
|
4371
4409
|
} catch {
|
|
4372
4410
|
return false;
|
|
@@ -4380,9 +4418,11 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4380
4418
|
if (!Number.isFinite(value)) return DEFAULT_FREQUENT_THRESHOLD;
|
|
4381
4419
|
return Math.max(1, Math.trunc(value));
|
|
4382
4420
|
}
|
|
4383
|
-
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4421
|
+
var import_node_fs4, DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4384
4422
|
var init_utils = __esm({
|
|
4385
4423
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4424
|
+
"use strict";
|
|
4425
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
4386
4426
|
init_src();
|
|
4387
4427
|
DEFAULT_TOP_LIMIT = 10;
|
|
4388
4428
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4400,7 +4440,7 @@ async function requireNativeBinding() {
|
|
|
4400
4440
|
if (binding?.analyzeClasses) return binding;
|
|
4401
4441
|
const runtimeDir = resolveRuntimeDir(
|
|
4402
4442
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4403
|
-
|
|
4443
|
+
__importMetaUrl
|
|
4404
4444
|
);
|
|
4405
4445
|
const candidates = resolveNativeBindingCandidates({
|
|
4406
4446
|
runtimeDir,
|
|
@@ -4433,10 +4473,11 @@ async function requireNativeCssCompiler() {
|
|
|
4433
4473
|
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4434
4474
|
var init_binding = __esm({
|
|
4435
4475
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4476
|
+
"use strict";
|
|
4436
4477
|
init_src();
|
|
4437
4478
|
init_utils();
|
|
4438
|
-
isAnalyzerModule = (
|
|
4439
|
-
const candidate =
|
|
4479
|
+
isAnalyzerModule = (module2) => {
|
|
4480
|
+
const candidate = module2;
|
|
4440
4481
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
4441
4482
|
};
|
|
4442
4483
|
createAnalyzerBindingLoader = () => {
|
|
@@ -4446,7 +4487,7 @@ var init_binding = __esm({
|
|
|
4446
4487
|
_state.bindingPromise = (async () => {
|
|
4447
4488
|
const runtimeDir = resolveRuntimeDir(
|
|
4448
4489
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4449
|
-
|
|
4490
|
+
__importMetaUrl
|
|
4450
4491
|
);
|
|
4451
4492
|
const candidates = resolveNativeBindingCandidates({
|
|
4452
4493
|
runtimeDir,
|
|
@@ -4483,10 +4524,14 @@ var init_binding = __esm({
|
|
|
4483
4524
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4484
4525
|
}
|
|
4485
4526
|
});
|
|
4486
|
-
|
|
4527
|
+
|
|
4528
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4529
|
+
var import_zod2, formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4487
4530
|
var init_schemas2 = __esm({
|
|
4488
4531
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4532
|
+
"use strict";
|
|
4489
4533
|
init_src();
|
|
4534
|
+
import_zod2 = require("zod");
|
|
4490
4535
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4491
4536
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4492
4537
|
).join(".") : "<root>";
|
|
@@ -4510,76 +4555,76 @@ var init_schemas2 = __esm({
|
|
|
4510
4555
|
parsed.error
|
|
4511
4556
|
);
|
|
4512
4557
|
};
|
|
4513
|
-
CountSchema =
|
|
4514
|
-
|
|
4515
|
-
name:
|
|
4558
|
+
CountSchema = import_zod2.z.number().int().min(0);
|
|
4559
|
+
ClassUsageSchema = import_zod2.z.object({
|
|
4560
|
+
name: import_zod2.z.string(),
|
|
4516
4561
|
count: CountSchema,
|
|
4517
|
-
isUnused:
|
|
4518
|
-
isConflict:
|
|
4562
|
+
isUnused: import_zod2.z.boolean().optional(),
|
|
4563
|
+
isConflict: import_zod2.z.boolean().optional()
|
|
4519
4564
|
});
|
|
4520
|
-
|
|
4521
|
-
className:
|
|
4522
|
-
variants:
|
|
4523
|
-
classes:
|
|
4524
|
-
message:
|
|
4565
|
+
ClassConflictSchema = import_zod2.z.object({
|
|
4566
|
+
className: import_zod2.z.string(),
|
|
4567
|
+
variants: import_zod2.z.array(import_zod2.z.string()),
|
|
4568
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
4569
|
+
message: import_zod2.z.string()
|
|
4525
4570
|
});
|
|
4526
|
-
ClassCountSchema =
|
|
4527
|
-
name:
|
|
4571
|
+
ClassCountSchema = import_zod2.z.object({
|
|
4572
|
+
name: import_zod2.z.string(),
|
|
4528
4573
|
count: CountSchema
|
|
4529
4574
|
});
|
|
4530
|
-
NativeReportSchema =
|
|
4531
|
-
root:
|
|
4575
|
+
NativeReportSchema = import_zod2.z.object({
|
|
4576
|
+
root: import_zod2.z.string(),
|
|
4532
4577
|
totalFiles: CountSchema,
|
|
4533
4578
|
uniqueClassCount: CountSchema,
|
|
4534
4579
|
totalClassOccurrences: CountSchema,
|
|
4535
|
-
topClasses:
|
|
4536
|
-
duplicateCandidates:
|
|
4537
|
-
safelist:
|
|
4580
|
+
topClasses: import_zod2.z.array(ClassCountSchema),
|
|
4581
|
+
duplicateCandidates: import_zod2.z.array(ClassCountSchema),
|
|
4582
|
+
safelist: import_zod2.z.array(import_zod2.z.string())
|
|
4538
4583
|
});
|
|
4539
|
-
NativeCssCompileResultSchema =
|
|
4540
|
-
css:
|
|
4541
|
-
resolvedClasses:
|
|
4542
|
-
unknownClasses:
|
|
4584
|
+
NativeCssCompileResultSchema = import_zod2.z.object({
|
|
4585
|
+
css: import_zod2.z.string(),
|
|
4586
|
+
resolvedClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4587
|
+
unknownClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4543
4588
|
sizeBytes: CountSchema
|
|
4544
4589
|
});
|
|
4545
|
-
AnalyzerClassStatsSchema =
|
|
4546
|
-
top:
|
|
4590
|
+
AnalyzerClassStatsSchema = import_zod2.z.object({
|
|
4591
|
+
top: import_zod2.z.number({
|
|
4547
4592
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4548
4593
|
}).finite().optional(),
|
|
4549
|
-
frequentThreshold:
|
|
4594
|
+
frequentThreshold: import_zod2.z.number({
|
|
4550
4595
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4551
4596
|
}).finite().optional()
|
|
4552
4597
|
});
|
|
4553
|
-
AnalyzerSemanticOptionsSchema =
|
|
4554
|
-
tailwindConfigPath:
|
|
4598
|
+
AnalyzerSemanticOptionsSchema = import_zod2.z.object({
|
|
4599
|
+
tailwindConfigPath: import_zod2.z.string({
|
|
4555
4600
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4556
4601
|
}).min(
|
|
4557
4602
|
1,
|
|
4558
4603
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4559
4604
|
).optional()
|
|
4560
4605
|
});
|
|
4561
|
-
AnalyzerOptionsSchema =
|
|
4562
|
-
scanner:
|
|
4606
|
+
AnalyzerOptionsSchema = import_zod2.z.object({
|
|
4607
|
+
scanner: import_zod2.z.custom(
|
|
4563
4608
|
(value) => isPlainObject(value),
|
|
4564
4609
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4565
4610
|
).optional(),
|
|
4566
4611
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4567
|
-
semantic:
|
|
4568
|
-
|
|
4612
|
+
semantic: import_zod2.z.union([
|
|
4613
|
+
import_zod2.z.boolean({
|
|
4569
4614
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4570
4615
|
}),
|
|
4571
4616
|
AnalyzerSemanticOptionsSchema
|
|
4572
4617
|
]).optional(),
|
|
4573
|
-
includeClass:
|
|
4618
|
+
includeClass: import_zod2.z.custom(
|
|
4574
4619
|
(value) => typeof value === "function",
|
|
4575
4620
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4576
4621
|
).optional()
|
|
4577
4622
|
});
|
|
4578
|
-
ClassToCssOptionsSchema =
|
|
4579
|
-
prefix:
|
|
4623
|
+
ClassToCssOptionsSchema = import_zod2.z.object({
|
|
4624
|
+
prefix: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.null()], {
|
|
4580
4625
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4581
4626
|
}).optional(),
|
|
4582
|
-
strict:
|
|
4627
|
+
strict: import_zod2.z.boolean({
|
|
4583
4628
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4584
4629
|
}).optional()
|
|
4585
4630
|
});
|
|
@@ -4593,9 +4638,15 @@ var init_schemas2 = __esm({
|
|
|
4593
4638
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4594
4639
|
}
|
|
4595
4640
|
});
|
|
4596
|
-
|
|
4641
|
+
|
|
4642
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4643
|
+
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;
|
|
4597
4644
|
var init_semantic = __esm({
|
|
4598
4645
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4646
|
+
"use strict";
|
|
4647
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4648
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4649
|
+
import_node_url5 = require("url");
|
|
4599
4650
|
init_binding();
|
|
4600
4651
|
init_utils();
|
|
4601
4652
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4631,11 +4682,11 @@ var init_semantic = __esm({
|
|
|
4631
4682
|
};
|
|
4632
4683
|
};
|
|
4633
4684
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4634
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4685
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path6.default.extname(configPath).toLowerCase());
|
|
4635
4686
|
};
|
|
4636
4687
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4637
4688
|
if (explicitPath) {
|
|
4638
|
-
const resolved =
|
|
4689
|
+
const resolved = import_node_path6.default.resolve(root, explicitPath);
|
|
4639
4690
|
if (!await pathExists(resolved)) return null;
|
|
4640
4691
|
return resolved;
|
|
4641
4692
|
}
|
|
@@ -4646,7 +4697,7 @@ var init_semantic = __esm({
|
|
|
4646
4697
|
"tailwind.config.mjs"
|
|
4647
4698
|
];
|
|
4648
4699
|
for (const candidate of candidates) {
|
|
4649
|
-
const fullPath =
|
|
4700
|
+
const fullPath = import_node_path6.default.resolve(root, candidate);
|
|
4650
4701
|
if (await pathExists(fullPath)) return fullPath;
|
|
4651
4702
|
}
|
|
4652
4703
|
return null;
|
|
@@ -4700,7 +4751,7 @@ var init_semantic = __esm({
|
|
|
4700
4751
|
return out;
|
|
4701
4752
|
};
|
|
4702
4753
|
collectSafelistFromSource = async (configPath) => {
|
|
4703
|
-
const source = await
|
|
4754
|
+
const source = await import_node_fs5.default.promises.readFile(configPath, "utf8");
|
|
4704
4755
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4705
4756
|
const allTokens = extractClassesNative2(source);
|
|
4706
4757
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4727,7 +4778,7 @@ var init_semantic = __esm({
|
|
|
4727
4778
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4728
4779
|
};
|
|
4729
4780
|
}
|
|
4730
|
-
const configStat = await
|
|
4781
|
+
const configStat = await import_node_fs5.default.promises.stat(configPath).catch(() => null);
|
|
4731
4782
|
if (configStat) {
|
|
4732
4783
|
const cached = tailwindConfigCache.get(configPath);
|
|
4733
4784
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4740,7 +4791,7 @@ var init_semantic = __esm({
|
|
|
4740
4791
|
const result = await (async () => {
|
|
4741
4792
|
try {
|
|
4742
4793
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
4743
|
-
const imported = await import(`${
|
|
4794
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
4744
4795
|
const candidate = imported.default ?? imported;
|
|
4745
4796
|
if (isRecord(candidate)) {
|
|
4746
4797
|
return { config: candidate, warning: void 0 };
|
|
@@ -4851,6 +4902,8 @@ var init_semantic = __esm({
|
|
|
4851
4902
|
};
|
|
4852
4903
|
}
|
|
4853
4904
|
});
|
|
4905
|
+
|
|
4906
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4854
4907
|
function normalizeScan(scan, includeClass) {
|
|
4855
4908
|
if (!includeClass) return scan;
|
|
4856
4909
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4905,7 +4958,7 @@ async function buildDistribution(usages, native) {
|
|
|
4905
4958
|
}
|
|
4906
4959
|
async function analyzeWorkspace(root, options = {}) {
|
|
4907
4960
|
const startedAtMs = Date.now();
|
|
4908
|
-
const resolvedRoot =
|
|
4961
|
+
const resolvedRoot = import_node_path7.default.resolve(root);
|
|
4909
4962
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4910
4963
|
const scan = await (async () => {
|
|
4911
4964
|
const scanStartedAtMs = Date.now();
|
|
@@ -5007,8 +5060,11 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
5007
5060
|
...semanticReport ? { semantic: semanticReport } : {}
|
|
5008
5061
|
};
|
|
5009
5062
|
}
|
|
5063
|
+
var import_node_path7;
|
|
5010
5064
|
var init_analyzeWorkspace = __esm({
|
|
5011
5065
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5066
|
+
"use strict";
|
|
5067
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
5012
5068
|
init_src2();
|
|
5013
5069
|
init_binding();
|
|
5014
5070
|
init_schemas2();
|
|
@@ -5021,6 +5077,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
5021
5077
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
5022
5078
|
var init_classToCss = __esm({
|
|
5023
5079
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5080
|
+
"use strict";
|
|
5024
5081
|
init_binding();
|
|
5025
5082
|
init_schemas2();
|
|
5026
5083
|
init_utils();
|
|
@@ -5141,6 +5198,7 @@ __export(src_exports2, {
|
|
|
5141
5198
|
var __internal;
|
|
5142
5199
|
var init_src3 = __esm({
|
|
5143
5200
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5201
|
+
"use strict";
|
|
5144
5202
|
init_analyzeWorkspace();
|
|
5145
5203
|
init_classToCss();
|
|
5146
5204
|
init_schemas2();
|
|
@@ -5159,9 +5217,11 @@ var init_src3 = __esm({
|
|
|
5159
5217
|
};
|
|
5160
5218
|
}
|
|
5161
5219
|
});
|
|
5220
|
+
|
|
5221
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5162
5222
|
async function pathExists2(filePath) {
|
|
5163
5223
|
try {
|
|
5164
|
-
await
|
|
5224
|
+
await import_promises.default.access(filePath);
|
|
5165
5225
|
return true;
|
|
5166
5226
|
} catch {
|
|
5167
5227
|
return false;
|
|
@@ -5169,7 +5229,7 @@ async function pathExists2(filePath) {
|
|
|
5169
5229
|
}
|
|
5170
5230
|
async function readFileSafe(filePath) {
|
|
5171
5231
|
try {
|
|
5172
|
-
return await
|
|
5232
|
+
return await import_promises.default.readFile(filePath, "utf8");
|
|
5173
5233
|
} catch {
|
|
5174
5234
|
return null;
|
|
5175
5235
|
}
|
|
@@ -5188,22 +5248,27 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5188
5248
|
options.onDryRun?.(`write ${filePath}`);
|
|
5189
5249
|
return;
|
|
5190
5250
|
}
|
|
5191
|
-
await
|
|
5192
|
-
await
|
|
5251
|
+
await import_promises.default.mkdir(import_node_path8.default.dirname(filePath), { recursive: true });
|
|
5252
|
+
await import_promises.default.writeFile(filePath, content, "utf8");
|
|
5193
5253
|
}
|
|
5194
5254
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
5195
5255
|
if (await pathExists2(filePath)) return "skipped";
|
|
5196
5256
|
await writeFileSafe(filePath, content, options);
|
|
5197
5257
|
return "created";
|
|
5198
5258
|
}
|
|
5259
|
+
var import_promises, import_node_path8;
|
|
5199
5260
|
var init_fs = __esm({
|
|
5200
5261
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5262
|
+
"use strict";
|
|
5263
|
+
import_promises = __toESM(require("fs/promises"), 1);
|
|
5264
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
5201
5265
|
}
|
|
5202
5266
|
});
|
|
5203
5267
|
|
|
5204
5268
|
// node_modules/picocolors/picocolors.js
|
|
5205
5269
|
var require_picocolors = __commonJS({
|
|
5206
|
-
"node_modules/picocolors/picocolors.js"(
|
|
5270
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
5271
|
+
"use strict";
|
|
5207
5272
|
var p = process || {};
|
|
5208
5273
|
var argv = p.argv || [];
|
|
5209
5274
|
var env = p.env || {};
|
|
@@ -5268,8 +5333,8 @@ var require_picocolors = __commonJS({
|
|
|
5268
5333
|
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
5269
5334
|
};
|
|
5270
5335
|
};
|
|
5271
|
-
|
|
5272
|
-
|
|
5336
|
+
module2.exports = createColors();
|
|
5337
|
+
module2.exports.createColors = createColors;
|
|
5273
5338
|
}
|
|
5274
5339
|
});
|
|
5275
5340
|
|
|
@@ -5290,8 +5355,11 @@ function writeJsonSuccess(command, data) {
|
|
|
5290
5355
|
}
|
|
5291
5356
|
var init_json = __esm({
|
|
5292
5357
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5358
|
+
"use strict";
|
|
5293
5359
|
}
|
|
5294
5360
|
});
|
|
5361
|
+
|
|
5362
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5295
5363
|
function writeLine(stream, message = "") {
|
|
5296
5364
|
stream.write(`${message}
|
|
5297
5365
|
`);
|
|
@@ -5321,7 +5389,7 @@ function createCliOutput(options = {}) {
|
|
|
5321
5389
|
const json = Boolean(options.json);
|
|
5322
5390
|
const debug = Boolean(options.debug);
|
|
5323
5391
|
const verboseEnabled = Boolean(options.verbose);
|
|
5324
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5392
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && (0, import_prompts.isTTY)(stdout);
|
|
5325
5393
|
function writeText(message = "", writeOptions = {}) {
|
|
5326
5394
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5327
5395
|
}
|
|
@@ -5355,7 +5423,7 @@ function createCliOutput(options = {}) {
|
|
|
5355
5423
|
},
|
|
5356
5424
|
note(message, title) {
|
|
5357
5425
|
if (interactive) {
|
|
5358
|
-
|
|
5426
|
+
(0, import_prompts.note)(message, title);
|
|
5359
5427
|
return;
|
|
5360
5428
|
}
|
|
5361
5429
|
if (title) {
|
|
@@ -5366,17 +5434,17 @@ ${message}`);
|
|
|
5366
5434
|
writeText(message);
|
|
5367
5435
|
},
|
|
5368
5436
|
intro(message) {
|
|
5369
|
-
showClackMessage(
|
|
5437
|
+
showClackMessage(import_prompts.intro, message);
|
|
5370
5438
|
},
|
|
5371
5439
|
outro(message) {
|
|
5372
|
-
showClackMessage(
|
|
5440
|
+
showClackMessage(import_prompts.outro, message);
|
|
5373
5441
|
},
|
|
5374
5442
|
table(rows) {
|
|
5375
5443
|
writeText(JSON.stringify(rows, null, 2));
|
|
5376
5444
|
},
|
|
5377
5445
|
spinner() {
|
|
5378
5446
|
if (!interactive) return createNoopSpinner();
|
|
5379
|
-
const instance =
|
|
5447
|
+
const instance = (0, import_prompts.spinner)({ output: stdout });
|
|
5380
5448
|
return {
|
|
5381
5449
|
start(message) {
|
|
5382
5450
|
instance.start(message);
|
|
@@ -5426,14 +5494,18 @@ ${import_picocolors.default.dim(message)}
|
|
|
5426
5494
|
}
|
|
5427
5495
|
};
|
|
5428
5496
|
}
|
|
5429
|
-
var import_picocolors;
|
|
5497
|
+
var import_prompts, import_picocolors;
|
|
5430
5498
|
var init_output = __esm({
|
|
5431
5499
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5432
|
-
|
|
5500
|
+
"use strict";
|
|
5501
|
+
import_prompts = require("@clack/prompts");
|
|
5502
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5433
5503
|
init_errors();
|
|
5434
5504
|
init_json();
|
|
5435
5505
|
}
|
|
5436
5506
|
});
|
|
5507
|
+
|
|
5508
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5437
5509
|
function hasFlag(name, argv) {
|
|
5438
5510
|
return argv.includes(`--${name}`);
|
|
5439
5511
|
}
|
|
@@ -5444,7 +5516,7 @@ function firstPositional(argv) {
|
|
|
5444
5516
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5445
5517
|
}
|
|
5446
5518
|
function parseCliInput(argv) {
|
|
5447
|
-
const parsed =
|
|
5519
|
+
const parsed = (0, import_node_util3.parseArgs)({
|
|
5448
5520
|
args: argv,
|
|
5449
5521
|
allowPositionals: true,
|
|
5450
5522
|
strict: false,
|
|
@@ -5471,17 +5543,22 @@ function parseCliInput(argv) {
|
|
|
5471
5543
|
helpCommand
|
|
5472
5544
|
};
|
|
5473
5545
|
}
|
|
5546
|
+
var import_node_util3;
|
|
5474
5547
|
var init_args = __esm({
|
|
5475
5548
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5549
|
+
"use strict";
|
|
5550
|
+
import_node_util3 = require("util");
|
|
5476
5551
|
}
|
|
5477
5552
|
});
|
|
5553
|
+
|
|
5554
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5478
5555
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5479
|
-
const filename =
|
|
5480
|
-
return
|
|
5556
|
+
const filename = (0, import_node_url6.fileURLToPath)(importMetaUrl);
|
|
5557
|
+
return import_node_path17.default.dirname(filename);
|
|
5481
5558
|
}
|
|
5482
5559
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5483
|
-
const fromRuntime =
|
|
5484
|
-
const fromCwd =
|
|
5560
|
+
const fromRuntime = import_node_path17.default.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5561
|
+
const fromCwd = import_node_path17.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
5485
5562
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5486
5563
|
}
|
|
5487
5564
|
async function firstExistingPath(paths) {
|
|
@@ -5490,8 +5567,12 @@ async function firstExistingPath(paths) {
|
|
|
5490
5567
|
}
|
|
5491
5568
|
return null;
|
|
5492
5569
|
}
|
|
5570
|
+
var import_node_path17, import_node_url6;
|
|
5493
5571
|
var init_paths = __esm({
|
|
5494
5572
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5573
|
+
"use strict";
|
|
5574
|
+
import_node_path17 = __toESM(require("path"), 1);
|
|
5575
|
+
import_node_url6 = require("url");
|
|
5495
5576
|
init_errors();
|
|
5496
5577
|
init_fs();
|
|
5497
5578
|
}
|
|
@@ -5576,6 +5657,7 @@ async function runCliMain(options) {
|
|
|
5576
5657
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5577
5658
|
var init_runtime = __esm({
|
|
5578
5659
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5660
|
+
"use strict";
|
|
5579
5661
|
init_args();
|
|
5580
5662
|
init_errors();
|
|
5581
5663
|
init_output();
|
|
@@ -5641,15 +5723,15 @@ function isInteractiveSession() {
|
|
|
5641
5723
|
}
|
|
5642
5724
|
async function resolveCreateInput(options) {
|
|
5643
5725
|
const interactive = isInteractiveSession();
|
|
5644
|
-
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await
|
|
5726
|
+
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await (0, import_prompts4.text)({
|
|
5645
5727
|
message: "Project name",
|
|
5646
5728
|
defaultValue: "my-app",
|
|
5647
5729
|
placeholder: "my-app"
|
|
5648
5730
|
});
|
|
5649
|
-
if (
|
|
5731
|
+
if ((0, import_prompts4.isCancel)(resolvedName)) {
|
|
5650
5732
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5651
5733
|
}
|
|
5652
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5734
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await (0, import_prompts4.select)({
|
|
5653
5735
|
message: "Template",
|
|
5654
5736
|
initialValue: "next-app",
|
|
5655
5737
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5657,7 +5739,7 @@ async function resolveCreateInput(options) {
|
|
|
5657
5739
|
label: template
|
|
5658
5740
|
}))
|
|
5659
5741
|
});
|
|
5660
|
-
if (
|
|
5742
|
+
if ((0, import_prompts4.isCancel)(pickedTemplate)) {
|
|
5661
5743
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5662
5744
|
}
|
|
5663
5745
|
const templateValue = pickedTemplate;
|
|
@@ -5669,7 +5751,7 @@ async function resolveCreateInput(options) {
|
|
|
5669
5751
|
return { name: resolvedName, template: templateValue };
|
|
5670
5752
|
}
|
|
5671
5753
|
async function writeProjectFile(context, relativePath, content) {
|
|
5672
|
-
const filePath =
|
|
5754
|
+
const filePath = import_node_path19.default.join(context.projectDir, relativePath);
|
|
5673
5755
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5674
5756
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5675
5757
|
}
|
|
@@ -5985,7 +6067,7 @@ async function createSimpleApp(context) {
|
|
|
5985
6067
|
}
|
|
5986
6068
|
async function createProject(options, output) {
|
|
5987
6069
|
const { name, template } = await resolveCreateInput(options);
|
|
5988
|
-
const projectDir =
|
|
6070
|
+
const projectDir = import_node_path19.default.resolve(process.cwd(), name);
|
|
5989
6071
|
if (await pathExists2(projectDir)) {
|
|
5990
6072
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5991
6073
|
}
|
|
@@ -6034,18 +6116,22 @@ function buildCreateProgram(context) {
|
|
|
6034
6116
|
async function main(rawArgs = process.argv.slice(2)) {
|
|
6035
6117
|
await runCliMain({
|
|
6036
6118
|
argv: [process.execPath, "create-tailwind-styled", ...rawArgs],
|
|
6037
|
-
importMetaUrl:
|
|
6119
|
+
importMetaUrl: typeof import_meta3 !== "undefined" && __importMetaUrl ? __importMetaUrl : `file://${process.argv[1] ?? "unknown"}`,
|
|
6038
6120
|
commandHint: "create",
|
|
6039
6121
|
buildProgram: buildCreateProgram
|
|
6040
6122
|
});
|
|
6041
6123
|
}
|
|
6042
|
-
var TEMPLATE_NAMES, TEMPLATES;
|
|
6124
|
+
var import_node_path19, import_prompts4, import_meta3, TEMPLATE_NAMES, TEMPLATES;
|
|
6043
6125
|
var init_createApp = __esm({
|
|
6044
6126
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6127
|
+
"use strict";
|
|
6128
|
+
import_node_path19 = __toESM(require("path"), 1);
|
|
6129
|
+
import_prompts4 = require("@clack/prompts");
|
|
6045
6130
|
init_esm();
|
|
6046
6131
|
init_errors();
|
|
6047
6132
|
init_fs();
|
|
6048
6133
|
init_runtime();
|
|
6134
|
+
import_meta3 = {};
|
|
6049
6135
|
TEMPLATE_NAMES = ["next-app", "vite-react", "vite-vue", "vite-svelte", "simple"];
|
|
6050
6136
|
TEMPLATES = {
|
|
6051
6137
|
"next-app": createNextApp,
|
|
@@ -6061,8 +6147,9 @@ var init_createApp = __esm({
|
|
|
6061
6147
|
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6062
6148
|
var init_nativeBridge = __esm({
|
|
6063
6149
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6150
|
+
"use strict";
|
|
6064
6151
|
init_src();
|
|
6065
|
-
_loadNative = (path30) =>
|
|
6152
|
+
_loadNative = (path30) => require(path30);
|
|
6066
6153
|
log3 = (...args) => {
|
|
6067
6154
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6068
6155
|
console.log("[compiler:native]", ...args);
|
|
@@ -6088,7 +6175,7 @@ var init_nativeBridge = __esm({
|
|
|
6088
6175
|
}
|
|
6089
6176
|
bridgeLoadAttempted = true;
|
|
6090
6177
|
try {
|
|
6091
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
6178
|
+
const runtimeDir = resolveRuntimeDir(void 0, __importMetaUrl);
|
|
6092
6179
|
const result = resolveNativeBinary(runtimeDir);
|
|
6093
6180
|
if (result.path && result.path.endsWith(".node")) {
|
|
6094
6181
|
try {
|
|
@@ -6159,41 +6246,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6159
6246
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6160
6247
|
var init_compiler = __esm({
|
|
6161
6248
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6249
|
+
"use strict";
|
|
6162
6250
|
}
|
|
6163
6251
|
});
|
|
6164
6252
|
|
|
6165
6253
|
// packages/domain/compiler/src/parser/index.ts
|
|
6166
6254
|
var init_parser = __esm({
|
|
6167
6255
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6256
|
+
"use strict";
|
|
6168
6257
|
}
|
|
6169
6258
|
});
|
|
6170
6259
|
|
|
6171
6260
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6172
6261
|
var init_analyzer = __esm({
|
|
6173
6262
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6263
|
+
"use strict";
|
|
6174
6264
|
}
|
|
6175
6265
|
});
|
|
6176
6266
|
|
|
6177
6267
|
// packages/domain/compiler/src/cache/index.ts
|
|
6178
6268
|
var init_cache = __esm({
|
|
6179
6269
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6270
|
+
"use strict";
|
|
6180
6271
|
}
|
|
6181
6272
|
});
|
|
6182
6273
|
|
|
6183
6274
|
// packages/domain/compiler/src/redis/index.ts
|
|
6184
6275
|
var init_redis = __esm({
|
|
6185
6276
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6277
|
+
"use strict";
|
|
6186
6278
|
}
|
|
6187
6279
|
});
|
|
6188
6280
|
|
|
6189
6281
|
// packages/domain/compiler/src/watch/index.ts
|
|
6190
6282
|
var init_watch = __esm({
|
|
6191
6283
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6284
|
+
"use strict";
|
|
6192
6285
|
}
|
|
6193
6286
|
});
|
|
6194
|
-
|
|
6287
|
+
|
|
6288
|
+
// packages/domain/compiler/src/index.ts
|
|
6289
|
+
var import_node_fs9, import_node_path24, import_node_module4, _require3, compileCssFromClasses;
|
|
6195
6290
|
var init_src4 = __esm({
|
|
6196
6291
|
"packages/domain/compiler/src/index.ts"() {
|
|
6292
|
+
"use strict";
|
|
6293
|
+
import_node_fs9 = __toESM(require("fs"), 1);
|
|
6294
|
+
import_node_path24 = __toESM(require("path"), 1);
|
|
6295
|
+
import_node_module4 = require("module");
|
|
6197
6296
|
init_nativeBridge();
|
|
6198
6297
|
init_compiler();
|
|
6199
6298
|
init_parser();
|
|
@@ -6201,7 +6300,9 @@ var init_src4 = __esm({
|
|
|
6201
6300
|
init_cache();
|
|
6202
6301
|
init_redis();
|
|
6203
6302
|
init_watch();
|
|
6204
|
-
|
|
6303
|
+
_require3 = (0, import_node_module4.createRequire)(
|
|
6304
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
6305
|
+
);
|
|
6205
6306
|
compileCssFromClasses = (classes, prefix) => {
|
|
6206
6307
|
const native = getNativeBridge();
|
|
6207
6308
|
if (!native?.transformSource) {
|
|
@@ -6219,6 +6320,7 @@ var init_src4 = __esm({
|
|
|
6219
6320
|
// packages/domain/compiler/src/internal.ts
|
|
6220
6321
|
var init_internal = __esm({
|
|
6221
6322
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6323
|
+
"use strict";
|
|
6222
6324
|
init_src4();
|
|
6223
6325
|
init_compiler();
|
|
6224
6326
|
init_parser();
|
|
@@ -6229,9 +6331,26 @@ var init_internal = __esm({
|
|
|
6229
6331
|
}
|
|
6230
6332
|
});
|
|
6231
6333
|
|
|
6334
|
+
// src/umbrella/cli.ts
|
|
6335
|
+
var cli_exports = {};
|
|
6336
|
+
__export(cli_exports, {
|
|
6337
|
+
createCliOutput: () => createCliOutput,
|
|
6338
|
+
ensureFlag: () => ensureFlag,
|
|
6339
|
+
parseCliArgs: () => parseCliInput,
|
|
6340
|
+
runScanCli: () => runScanCli
|
|
6341
|
+
});
|
|
6342
|
+
module.exports = __toCommonJS(cli_exports);
|
|
6343
|
+
|
|
6344
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6345
|
+
var import_node_url8 = require("url");
|
|
6346
|
+
|
|
6232
6347
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6233
6348
|
init_esm();
|
|
6234
6349
|
|
|
6350
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6351
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
6352
|
+
var import_node_util = require("util");
|
|
6353
|
+
|
|
6235
6354
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6236
6355
|
init_errors();
|
|
6237
6356
|
async function loadAnalyzerModule() {
|
|
@@ -6288,7 +6407,7 @@ function printAnalysisReport(report, output) {
|
|
|
6288
6407
|
output.writeText("");
|
|
6289
6408
|
}
|
|
6290
6409
|
async function runAnalyzeCli(args) {
|
|
6291
|
-
const parsed =
|
|
6410
|
+
const parsed = (0, import_node_util.parseArgs)({
|
|
6292
6411
|
args,
|
|
6293
6412
|
allowPositionals: true,
|
|
6294
6413
|
strict: false,
|
|
@@ -6303,7 +6422,7 @@ async function runAnalyzeCli(args) {
|
|
|
6303
6422
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6304
6423
|
});
|
|
6305
6424
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6306
|
-
const dir =
|
|
6425
|
+
const dir = import_node_path9.default.resolve(process.cwd(), dirArg);
|
|
6307
6426
|
if (!await pathExists2(dir)) {
|
|
6308
6427
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6309
6428
|
}
|
|
@@ -6320,6 +6439,10 @@ async function runAnalyzeCli(args) {
|
|
|
6320
6439
|
}
|
|
6321
6440
|
printAnalysisReport(report, output);
|
|
6322
6441
|
}
|
|
6442
|
+
|
|
6443
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6444
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
6445
|
+
var import_node_util2 = require("util");
|
|
6323
6446
|
init_errors();
|
|
6324
6447
|
init_fs();
|
|
6325
6448
|
init_output();
|
|
@@ -6340,7 +6463,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6340
6463
|
return "div";
|
|
6341
6464
|
}
|
|
6342
6465
|
async function runExtractCli(args) {
|
|
6343
|
-
const parsed =
|
|
6466
|
+
const parsed = (0, import_node_util2.parseArgs)({
|
|
6344
6467
|
args,
|
|
6345
6468
|
allowPositionals: true,
|
|
6346
6469
|
strict: false,
|
|
@@ -6359,7 +6482,7 @@ async function runExtractCli(args) {
|
|
|
6359
6482
|
const parsedMin = parseInt(minRaw, 10);
|
|
6360
6483
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6361
6484
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6362
|
-
const dir =
|
|
6485
|
+
const dir = import_node_path10.default.resolve(process.cwd(), dirArg);
|
|
6363
6486
|
if (!await pathExists2(dir)) {
|
|
6364
6487
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6365
6488
|
}
|
|
@@ -6414,6 +6537,7 @@ async function runExtractCli(args) {
|
|
|
6414
6537
|
}
|
|
6415
6538
|
|
|
6416
6539
|
// packages/infrastructure/cli/src/init.ts
|
|
6540
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
6417
6541
|
init_fs();
|
|
6418
6542
|
init_output();
|
|
6419
6543
|
async function ensureFile(filePath, content, report) {
|
|
@@ -6432,15 +6556,15 @@ async function runInitCli(rawArgs) {
|
|
|
6432
6556
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6433
6557
|
});
|
|
6434
6558
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6435
|
-
const root =
|
|
6559
|
+
const root = import_node_path11.default.resolve(process.cwd(), target);
|
|
6436
6560
|
const report = { created: [], skipped: [] };
|
|
6437
6561
|
await ensureFile(
|
|
6438
|
-
|
|
6562
|
+
import_node_path11.default.join(root, "src", "tailwind.css"),
|
|
6439
6563
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6440
6564
|
report
|
|
6441
6565
|
);
|
|
6442
6566
|
await ensureFile(
|
|
6443
|
-
|
|
6567
|
+
import_node_path11.default.join(root, "tailwind-styled.config.json"),
|
|
6444
6568
|
`${JSON.stringify(
|
|
6445
6569
|
{
|
|
6446
6570
|
version: 1,
|
|
@@ -6460,17 +6584,22 @@ async function runInitCli(rawArgs) {
|
|
|
6460
6584
|
output.writeText("\nInit complete");
|
|
6461
6585
|
output.writeText(`Created: ${report.created.length}`);
|
|
6462
6586
|
for (const filePath of report.created) {
|
|
6463
|
-
output.writeText(` + ${
|
|
6587
|
+
output.writeText(` + ${import_node_path11.default.relative(root, filePath)}`);
|
|
6464
6588
|
}
|
|
6465
6589
|
if (report.skipped.length > 0) {
|
|
6466
6590
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6467
6591
|
for (const filePath of report.skipped) {
|
|
6468
|
-
output.writeText(` - ${
|
|
6592
|
+
output.writeText(` - ${import_node_path11.default.relative(root, filePath)} (exists)`);
|
|
6469
6593
|
}
|
|
6470
6594
|
}
|
|
6471
6595
|
}
|
|
6472
6596
|
|
|
6597
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6598
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
6599
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
6600
|
+
|
|
6473
6601
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6602
|
+
var import_prompts2 = require("@clack/prompts");
|
|
6474
6603
|
init_errors();
|
|
6475
6604
|
async function runMigrationWizard() {
|
|
6476
6605
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -6481,24 +6610,24 @@ async function runMigrationWizard() {
|
|
|
6481
6610
|
includeImports: true
|
|
6482
6611
|
};
|
|
6483
6612
|
}
|
|
6484
|
-
|
|
6485
|
-
const dryRun = await
|
|
6613
|
+
(0, import_prompts2.intro)("Tailwind Styled v4 Migration Wizard");
|
|
6614
|
+
const dryRun = await (0, import_prompts2.confirm)({
|
|
6486
6615
|
message: "Gunakan dry-run?",
|
|
6487
6616
|
initialValue: true
|
|
6488
6617
|
});
|
|
6489
|
-
const includeConfig = await
|
|
6618
|
+
const includeConfig = await (0, import_prompts2.confirm)({
|
|
6490
6619
|
message: "Migrasi file config dasar?",
|
|
6491
6620
|
initialValue: true
|
|
6492
6621
|
});
|
|
6493
|
-
const includeClasses = await
|
|
6622
|
+
const includeClasses = await (0, import_prompts2.confirm)({
|
|
6494
6623
|
message: "Migrasi class lama (flex-grow/shrink)?",
|
|
6495
6624
|
initialValue: true
|
|
6496
6625
|
});
|
|
6497
|
-
const includeImports = await
|
|
6626
|
+
const includeImports = await (0, import_prompts2.confirm)({
|
|
6498
6627
|
message: "Migrasi import tailwind-styled-components -> tailwind-styled-v4?",
|
|
6499
6628
|
initialValue: true
|
|
6500
6629
|
});
|
|
6501
|
-
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) =>
|
|
6630
|
+
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) => (0, import_prompts2.isCancel)(value))) {
|
|
6502
6631
|
throw new CliUsageError("Migration wizard dibatalkan oleh pengguna");
|
|
6503
6632
|
}
|
|
6504
6633
|
return {
|
|
@@ -6526,15 +6655,15 @@ async function findSourceFiles(dir) {
|
|
|
6526
6655
|
const out = [];
|
|
6527
6656
|
async function walk(currentDir) {
|
|
6528
6657
|
if (!await pathExists2(currentDir)) return;
|
|
6529
|
-
const entries = await
|
|
6658
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
6530
6659
|
for (const entry of entries) {
|
|
6531
|
-
const fullPath =
|
|
6660
|
+
const fullPath = import_node_path12.default.join(currentDir, entry.name);
|
|
6532
6661
|
if (entry.isDirectory()) {
|
|
6533
6662
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6534
6663
|
await walk(fullPath);
|
|
6535
6664
|
continue;
|
|
6536
6665
|
}
|
|
6537
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6666
|
+
if (SOURCE_EXTENSIONS.has(import_node_path12.default.extname(entry.name))) {
|
|
6538
6667
|
out.push(fullPath);
|
|
6539
6668
|
}
|
|
6540
6669
|
}
|
|
@@ -6555,7 +6684,7 @@ function migrateSource(source, options) {
|
|
|
6555
6684
|
return { output, classRenames: 0, importRenames };
|
|
6556
6685
|
}
|
|
6557
6686
|
async function migrateConfig(root, dryRun) {
|
|
6558
|
-
const cssPath =
|
|
6687
|
+
const cssPath = import_node_path12.default.join(root, "src", "tailwind.css");
|
|
6559
6688
|
if (await pathExists2(cssPath)) return 0;
|
|
6560
6689
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6561
6690
|
return 1;
|
|
@@ -6568,7 +6697,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6568
6697
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6569
6698
|
});
|
|
6570
6699
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6571
|
-
const root =
|
|
6700
|
+
const root = import_node_path12.default.resolve(process.cwd(), target);
|
|
6572
6701
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6573
6702
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6574
6703
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6592,12 +6721,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6592
6721
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6593
6722
|
}
|
|
6594
6723
|
for (const filePath of files) {
|
|
6595
|
-
const source = await
|
|
6724
|
+
const source = await import_promises2.default.readFile(filePath, "utf8");
|
|
6596
6725
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6597
6726
|
if (migrated.output !== source) {
|
|
6598
6727
|
report.updatedFiles++;
|
|
6599
6728
|
if (!dryRun) {
|
|
6600
|
-
await
|
|
6729
|
+
await import_promises2.default.writeFile(filePath, migrated.output, "utf8");
|
|
6601
6730
|
}
|
|
6602
6731
|
}
|
|
6603
6732
|
report.classRenames += migrated.classRenames;
|
|
@@ -6617,6 +6746,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6617
6746
|
}
|
|
6618
6747
|
|
|
6619
6748
|
// packages/infrastructure/cli/src/scan.ts
|
|
6749
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
6750
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6620
6751
|
init_src2();
|
|
6621
6752
|
init_output();
|
|
6622
6753
|
function buildTopClasses(files) {
|
|
@@ -6661,10 +6792,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6661
6792
|
});
|
|
6662
6793
|
}
|
|
6663
6794
|
function writeScanCache(root, cacheData) {
|
|
6664
|
-
const cacheDir =
|
|
6665
|
-
const cachePath =
|
|
6666
|
-
|
|
6667
|
-
|
|
6795
|
+
const cacheDir = import_node_path13.default.join(root, ".tailwind-styled");
|
|
6796
|
+
const cachePath = import_node_path13.default.join(cacheDir, "scan-cache.json");
|
|
6797
|
+
import_node_fs6.default.mkdirSync(cacheDir, { recursive: true });
|
|
6798
|
+
import_node_fs6.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6668
6799
|
return cachePath;
|
|
6669
6800
|
}
|
|
6670
6801
|
async function runScanCli(rawArgs) {
|
|
@@ -6676,7 +6807,7 @@ async function runScanCli(rawArgs) {
|
|
|
6676
6807
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6677
6808
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6678
6809
|
});
|
|
6679
|
-
const root =
|
|
6810
|
+
const root = import_node_path13.default.resolve(process.cwd(), target);
|
|
6680
6811
|
const spinner = output.spinner();
|
|
6681
6812
|
spinner.start(`Scanning ${root}`);
|
|
6682
6813
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6726,7 +6857,8 @@ Scan root : ${result.root}`);
|
|
|
6726
6857
|
}
|
|
6727
6858
|
|
|
6728
6859
|
// packages/infrastructure/cli/src/setup.ts
|
|
6729
|
-
var
|
|
6860
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
6861
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6730
6862
|
|
|
6731
6863
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6732
6864
|
function patchNextConfigImpl(src) {
|
|
@@ -6825,7 +6957,7 @@ ${close}`
|
|
|
6825
6957
|
}
|
|
6826
6958
|
function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
6827
6959
|
try {
|
|
6828
|
-
const nodePath =
|
|
6960
|
+
const nodePath = require("path");
|
|
6829
6961
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6830
6962
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6831
6963
|
const safelistAbs = nodePath.resolve(cwd2, ".next", "tw-classes");
|
|
@@ -6840,7 +6972,7 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
|
6840
6972
|
}
|
|
6841
6973
|
function computeStateStaticImportPath(cssFilePath, cwd2) {
|
|
6842
6974
|
try {
|
|
6843
|
-
const nodePath =
|
|
6975
|
+
const nodePath = require("path");
|
|
6844
6976
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6845
6977
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6846
6978
|
const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
|
|
@@ -6921,6 +7053,7 @@ function patchTsConfigImpl(src) {
|
|
|
6921
7053
|
}
|
|
6922
7054
|
|
|
6923
7055
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
7056
|
+
var import_prompts3 = require("@clack/prompts");
|
|
6924
7057
|
init_errors();
|
|
6925
7058
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6926
7059
|
const log5 = options.log ?? console.log;
|
|
@@ -6951,7 +7084,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6951
7084
|
});
|
|
6952
7085
|
log5("");
|
|
6953
7086
|
const defaultIdx = detected ? projectOptions.findIndex((option) => option.value === detected) : 0;
|
|
6954
|
-
const selected = await
|
|
7087
|
+
const selected = await (0, import_prompts3.select)({
|
|
6955
7088
|
message: "Project type",
|
|
6956
7089
|
initialValue: projectOptions[defaultIdx].value,
|
|
6957
7090
|
options: projectOptions.map((option) => ({
|
|
@@ -6960,7 +7093,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6960
7093
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6961
7094
|
}))
|
|
6962
7095
|
});
|
|
6963
|
-
if (
|
|
7096
|
+
if ((0, import_prompts3.isCancel)(selected)) {
|
|
6964
7097
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6965
7098
|
}
|
|
6966
7099
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6971,9 +7104,11 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6971
7104
|
}
|
|
6972
7105
|
|
|
6973
7106
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
7107
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
6974
7108
|
init_fs();
|
|
6975
7109
|
|
|
6976
7110
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
7111
|
+
var import_node_child_process = require("child_process");
|
|
6977
7112
|
init_errors();
|
|
6978
7113
|
init_json();
|
|
6979
7114
|
var npmCommandName = () => {
|
|
@@ -7006,7 +7141,7 @@ var runCommand = async (binary, args, options = {}) => {
|
|
|
7006
7141
|
if (isVerboseEnabled(options)) {
|
|
7007
7142
|
writeVerboseLine(binary, args);
|
|
7008
7143
|
}
|
|
7009
|
-
const child =
|
|
7144
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7010
7145
|
stdio: options.stdio ?? "inherit",
|
|
7011
7146
|
cwd: options.cwd ?? process.cwd(),
|
|
7012
7147
|
env: options.env ?? process.env
|
|
@@ -7062,7 +7197,7 @@ var runCommandCapture = async (binary, args, options = {}) => {
|
|
|
7062
7197
|
if (isVerboseEnabled(options)) {
|
|
7063
7198
|
writeVerboseLine(binary, args);
|
|
7064
7199
|
}
|
|
7065
|
-
const child =
|
|
7200
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7066
7201
|
stdio: "pipe",
|
|
7067
7202
|
cwd: options.cwd ?? process.cwd(),
|
|
7068
7203
|
env: options.env ?? process.env
|
|
@@ -7139,12 +7274,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7139
7274
|
};
|
|
7140
7275
|
}
|
|
7141
7276
|
async function readPackageJson(cwd2) {
|
|
7142
|
-
return readJsonSafe(
|
|
7277
|
+
return readJsonSafe(import_node_path14.default.join(cwd2, "package.json"));
|
|
7143
7278
|
}
|
|
7144
7279
|
async function detectPm(cwd2) {
|
|
7145
|
-
if (await pathExists2(
|
|
7146
|
-
if (await pathExists2(
|
|
7147
|
-
if (await pathExists2(
|
|
7280
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "bun.lockb"))) return "bun";
|
|
7281
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7282
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7148
7283
|
return "npm";
|
|
7149
7284
|
}
|
|
7150
7285
|
async function detectBundler(cwd2) {
|
|
@@ -7165,7 +7300,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7165
7300
|
}
|
|
7166
7301
|
async function findExisting(cwd2, names) {
|
|
7167
7302
|
for (const name of names) {
|
|
7168
|
-
const resolved =
|
|
7303
|
+
const resolved = import_node_path14.default.join(cwd2, name);
|
|
7169
7304
|
if (await pathExists2(resolved)) return resolved;
|
|
7170
7305
|
}
|
|
7171
7306
|
return null;
|
|
@@ -7176,7 +7311,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7176
7311
|
return;
|
|
7177
7312
|
}
|
|
7178
7313
|
await writeFileSafe(filePath, content);
|
|
7179
|
-
logger.ok(
|
|
7314
|
+
logger.ok(import_node_path14.default.relative(cwd2, filePath) || label);
|
|
7180
7315
|
}
|
|
7181
7316
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7182
7317
|
const source = await readFileSafe(filePath);
|
|
@@ -7203,7 +7338,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7203
7338
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7204
7339
|
return;
|
|
7205
7340
|
}
|
|
7206
|
-
const flag = "--save";
|
|
7341
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7207
7342
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7208
7343
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7209
7344
|
try {
|
|
@@ -7221,7 +7356,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7221
7356
|
}
|
|
7222
7357
|
|
|
7223
7358
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7224
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7359
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7225
7360
|
function createCliLogger(options = {}) {
|
|
7226
7361
|
function emit(level, icon, colorize, message) {
|
|
7227
7362
|
options.onEvent?.({ level, message });
|
|
@@ -7339,7 +7474,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7339
7474
|
if (bundlerConfig) {
|
|
7340
7475
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7341
7476
|
if (cfg)
|
|
7342
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7477
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, import_node_path15.default.basename(cfg), setupFlags, logger);
|
|
7343
7478
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7344
7479
|
} else {
|
|
7345
7480
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7358,13 +7493,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7358
7493
|
if (cssFile) {
|
|
7359
7494
|
await patchFileWithDryRun(
|
|
7360
7495
|
cssFile,
|
|
7361
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7362
|
-
|
|
7496
|
+
(src) => patchTailwindCss(src, bundler, import_node_path15.default.relative(cwd, cssFile), cwd),
|
|
7497
|
+
import_node_path15.default.relative(cwd, cssFile),
|
|
7363
7498
|
setupFlags,
|
|
7364
7499
|
logger
|
|
7365
7500
|
);
|
|
7366
|
-
const detectedCssEntry =
|
|
7367
|
-
const twConfigPath =
|
|
7501
|
+
const detectedCssEntry = import_node_path15.default.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7502
|
+
const twConfigPath = import_node_path15.default.join(cwd, "tailwind-styled.config.json");
|
|
7368
7503
|
const twConfig = {
|
|
7369
7504
|
version: 1,
|
|
7370
7505
|
compiler: { engine: "rust" },
|
|
@@ -7382,7 +7517,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7382
7517
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7383
7518
|
}
|
|
7384
7519
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7385
|
-
const tsCfg =
|
|
7520
|
+
const tsCfg = import_node_path15.default.join(cwd, "tsconfig.json");
|
|
7386
7521
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7387
7522
|
if (hasTsConfig) {
|
|
7388
7523
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7427,6 +7562,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7427
7562
|
output.jsonSuccess("setup", report);
|
|
7428
7563
|
}
|
|
7429
7564
|
};
|
|
7565
|
+
|
|
7566
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7567
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
7568
|
+
var import_node_util4 = require("util");
|
|
7430
7569
|
init_errors();
|
|
7431
7570
|
init_fs();
|
|
7432
7571
|
init_output();
|
|
@@ -7448,7 +7587,7 @@ function estimateClassBytes(className) {
|
|
|
7448
7587
|
return base + 15;
|
|
7449
7588
|
}
|
|
7450
7589
|
async function runStatsCli(args) {
|
|
7451
|
-
const parsed =
|
|
7590
|
+
const parsed = (0, import_node_util4.parseArgs)({
|
|
7452
7591
|
args,
|
|
7453
7592
|
allowPositionals: true,
|
|
7454
7593
|
strict: false,
|
|
@@ -7463,7 +7602,7 @@ async function runStatsCli(args) {
|
|
|
7463
7602
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7464
7603
|
});
|
|
7465
7604
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7466
|
-
const dir =
|
|
7605
|
+
const dir = import_node_path16.default.resolve(process.cwd(), dirArg);
|
|
7467
7606
|
if (!await pathExists2(dir)) {
|
|
7468
7607
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7469
7608
|
}
|
|
@@ -7515,15 +7654,20 @@ async function runStatsCli(args) {
|
|
|
7515
7654
|
|
|
7516
7655
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7517
7656
|
init_runtime();
|
|
7657
|
+
|
|
7658
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7659
|
+
var import_node_fs7 = require("fs");
|
|
7660
|
+
var import_node_path18 = require("path");
|
|
7661
|
+
var import_node_util5 = require("util");
|
|
7518
7662
|
function collectTsFiles(dir, extensions) {
|
|
7519
7663
|
const files = [];
|
|
7520
|
-
const entries =
|
|
7664
|
+
const entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
7521
7665
|
for (const entry of entries) {
|
|
7522
|
-
const full =
|
|
7666
|
+
const full = (0, import_node_path18.join)(dir, entry.name);
|
|
7523
7667
|
if (entry.isDirectory()) {
|
|
7524
7668
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7525
7669
|
files.push(...collectTsFiles(full, extensions));
|
|
7526
|
-
} else if (extensions.has(
|
|
7670
|
+
} else if (extensions.has((0, import_node_path18.extname)(entry.name))) {
|
|
7527
7671
|
files.push(full);
|
|
7528
7672
|
}
|
|
7529
7673
|
}
|
|
@@ -7582,7 +7726,7 @@ function printBoundaryReport(report, output) {
|
|
|
7582
7726
|
}
|
|
7583
7727
|
}
|
|
7584
7728
|
async function runBoundaryCli(args, context) {
|
|
7585
|
-
const parsed =
|
|
7729
|
+
const parsed = (0, import_node_util5.parseArgs)({
|
|
7586
7730
|
args,
|
|
7587
7731
|
allowPositionals: true,
|
|
7588
7732
|
strict: false,
|
|
@@ -7600,7 +7744,7 @@ async function runBoundaryCli(args, context) {
|
|
|
7600
7744
|
for (const file of files) {
|
|
7601
7745
|
let source;
|
|
7602
7746
|
try {
|
|
7603
|
-
source =
|
|
7747
|
+
source = (0, import_node_fs7.readFileSync)(file, "utf8");
|
|
7604
7748
|
} catch {
|
|
7605
7749
|
continue;
|
|
7606
7750
|
}
|
|
@@ -7648,10 +7792,13 @@ var createCommand2 = {
|
|
|
7648
7792
|
};
|
|
7649
7793
|
|
|
7650
7794
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7795
|
+
var import_node_util6 = require("util");
|
|
7651
7796
|
init_errors();
|
|
7652
7797
|
init_fs();
|
|
7653
7798
|
|
|
7654
7799
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7800
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
7801
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
7655
7802
|
init_errors();
|
|
7656
7803
|
init_paths();
|
|
7657
7804
|
function enumerateVariantProps(matrix) {
|
|
@@ -7675,7 +7822,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7675
7822
|
}
|
|
7676
7823
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7677
7824
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7678
|
-
const fromCwd =
|
|
7825
|
+
const fromCwd = import_node_path20.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
7679
7826
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7680
7827
|
if (!resolved) {
|
|
7681
7828
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7689,13 +7836,13 @@ async function loadRegistry(context) {
|
|
|
7689
7836
|
);
|
|
7690
7837
|
const candidates = [
|
|
7691
7838
|
runtimeRegistryPath,
|
|
7692
|
-
|
|
7839
|
+
import_node_path20.default.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7693
7840
|
];
|
|
7694
7841
|
const registryPath = await firstExistingPath(candidates);
|
|
7695
7842
|
if (!registryPath) {
|
|
7696
7843
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7697
7844
|
}
|
|
7698
|
-
const raw = await
|
|
7845
|
+
const raw = await import_promises3.default.readFile(registryPath, "utf8");
|
|
7699
7846
|
const data = JSON.parse(raw);
|
|
7700
7847
|
return [
|
|
7701
7848
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7715,7 +7862,7 @@ var dashboardCommand = {
|
|
|
7715
7862
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7716
7863
|
);
|
|
7717
7864
|
}
|
|
7718
|
-
const parsed =
|
|
7865
|
+
const parsed = (0, import_node_util6.parseArgs)({
|
|
7719
7866
|
args,
|
|
7720
7867
|
allowPositionals: true,
|
|
7721
7868
|
strict: false,
|
|
@@ -7739,12 +7886,15 @@ var dashboardCommand = {
|
|
|
7739
7886
|
};
|
|
7740
7887
|
|
|
7741
7888
|
// packages/infrastructure/cli/src/commands/deploy.ts
|
|
7889
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
7890
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
7891
|
+
var import_node_util7 = require("util");
|
|
7742
7892
|
init_errors();
|
|
7743
7893
|
init_fs();
|
|
7744
7894
|
init_json();
|
|
7745
7895
|
var postJson = async (url, body, token) => {
|
|
7746
|
-
const { default: https } = await import(
|
|
7747
|
-
const { default: http } = await import(
|
|
7896
|
+
const { default: https } = await import("https");
|
|
7897
|
+
const { default: http } = await import("http");
|
|
7748
7898
|
return new Promise((resolve2, reject) => {
|
|
7749
7899
|
const client = url.protocol === "https:" ? https : http;
|
|
7750
7900
|
const req = client.request(
|
|
@@ -7778,7 +7928,7 @@ var postJson = async (url, body, token) => {
|
|
|
7778
7928
|
var deployCommand = {
|
|
7779
7929
|
name: "deploy",
|
|
7780
7930
|
async run(args, context) {
|
|
7781
|
-
const parsed =
|
|
7931
|
+
const parsed = (0, import_node_util7.parseArgs)({
|
|
7782
7932
|
args,
|
|
7783
7933
|
allowPositionals: true,
|
|
7784
7934
|
strict: false,
|
|
@@ -7794,7 +7944,7 @@ var deployCommand = {
|
|
|
7794
7944
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7795
7945
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7796
7946
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7797
|
-
const pkgPath =
|
|
7947
|
+
const pkgPath = import_node_path21.default.join(process.cwd(), "package.json");
|
|
7798
7948
|
if (!await pathExists2(pkgPath)) {
|
|
7799
7949
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7800
7950
|
}
|
|
@@ -7829,10 +7979,10 @@ var deployCommand = {
|
|
|
7829
7979
|
}
|
|
7830
7980
|
return;
|
|
7831
7981
|
}
|
|
7832
|
-
const cacheDir =
|
|
7833
|
-
await
|
|
7834
|
-
await
|
|
7835
|
-
|
|
7982
|
+
const cacheDir = import_node_path21.default.join(process.cwd(), ".tw-cache");
|
|
7983
|
+
await import_promises4.default.mkdir(cacheDir, { recursive: true });
|
|
7984
|
+
await import_promises4.default.writeFile(
|
|
7985
|
+
import_node_path21.default.join(cacheDir, "deploy-manifest.json"),
|
|
7836
7986
|
JSON.stringify(manifest, null, 2)
|
|
7837
7987
|
);
|
|
7838
7988
|
if (!registryUrl) {
|
|
@@ -7895,9 +8045,12 @@ var deployCommand = {
|
|
|
7895
8045
|
};
|
|
7896
8046
|
|
|
7897
8047
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7898
|
-
var
|
|
8048
|
+
var import_node_util8 = require("util");
|
|
8049
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
7899
8050
|
|
|
7900
8051
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
8052
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
8053
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
7901
8054
|
init_src3();
|
|
7902
8055
|
init_src2();
|
|
7903
8056
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
@@ -7932,9 +8085,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7932
8085
|
issues.push({ severity, type, message, suggestion, location });
|
|
7933
8086
|
}
|
|
7934
8087
|
function readJsonFile(filePath) {
|
|
7935
|
-
if (!
|
|
8088
|
+
if (!import_node_fs8.default.existsSync(filePath)) return null;
|
|
7936
8089
|
try {
|
|
7937
|
-
return JSON.parse(
|
|
8090
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
7938
8091
|
} catch (parseErr) {
|
|
7939
8092
|
if (process.env.TWS_DEBUG === "1") {
|
|
7940
8093
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7945,16 +8098,16 @@ function readJsonFile(filePath) {
|
|
|
7945
8098
|
}
|
|
7946
8099
|
}
|
|
7947
8100
|
function findWorkspacePackageJsonFiles(root) {
|
|
7948
|
-
const packagesDir =
|
|
7949
|
-
if (!
|
|
7950
|
-
return
|
|
8101
|
+
const packagesDir = import_node_path22.default.join(root, "packages");
|
|
8102
|
+
if (!import_node_fs8.default.existsSync(packagesDir)) return [];
|
|
8103
|
+
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));
|
|
7951
8104
|
}
|
|
7952
8105
|
function findFiles(dir, ext) {
|
|
7953
8106
|
const files = [];
|
|
7954
8107
|
try {
|
|
7955
|
-
const entries =
|
|
8108
|
+
const entries = import_node_fs8.default.readdirSync(dir, { withFileTypes: true });
|
|
7956
8109
|
for (const entry of entries) {
|
|
7957
|
-
const fullPath =
|
|
8110
|
+
const fullPath = import_node_path22.default.join(dir, entry.name);
|
|
7958
8111
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7959
8112
|
files.push(...findFiles(fullPath, ext));
|
|
7960
8113
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7972,7 +8125,7 @@ function findFiles(dir, ext) {
|
|
|
7972
8125
|
return files;
|
|
7973
8126
|
}
|
|
7974
8127
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7975
|
-
const rootPackageJsonPath =
|
|
8128
|
+
const rootPackageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
7976
8129
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7977
8130
|
if (!rootPackageJson) {
|
|
7978
8131
|
addCheck(
|
|
@@ -8025,7 +8178,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8025
8178
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8026
8179
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8027
8180
|
if (missing.length === 0) return [];
|
|
8028
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8181
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : import_node_path22.default.basename(import_node_path22.default.dirname(filePath));
|
|
8029
8182
|
return [{ packageName, missing }];
|
|
8030
8183
|
});
|
|
8031
8184
|
if (missingScripts.length === 0) {
|
|
@@ -8060,7 +8213,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8060
8213
|
);
|
|
8061
8214
|
}
|
|
8062
8215
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8063
|
-
const packageJsonPath =
|
|
8216
|
+
const packageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
8064
8217
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8065
8218
|
if (!packageJson) {
|
|
8066
8219
|
addCheck(
|
|
@@ -8119,7 +8272,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8119
8272
|
const cssFiles = findFiles(root, ".css");
|
|
8120
8273
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8121
8274
|
try {
|
|
8122
|
-
const content =
|
|
8275
|
+
const content = import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
8123
8276
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8124
8277
|
} catch {
|
|
8125
8278
|
return false;
|
|
@@ -8143,7 +8296,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8143
8296
|
);
|
|
8144
8297
|
}
|
|
8145
8298
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8146
|
-
const hasConfig = configFiles.some((name) =>
|
|
8299
|
+
const hasConfig = configFiles.some((name) => import_node_fs8.default.existsSync(import_node_path22.default.join(root, name)));
|
|
8147
8300
|
addCheck(
|
|
8148
8301
|
checks,
|
|
8149
8302
|
"tailwind",
|
|
@@ -8152,7 +8305,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8152
8305
|
"info",
|
|
8153
8306
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8154
8307
|
);
|
|
8155
|
-
const tsconfig = readJsonFile(
|
|
8308
|
+
const tsconfig = readJsonFile(import_node_path22.default.join(root, "tsconfig.json"));
|
|
8156
8309
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8157
8310
|
addCheck(
|
|
8158
8311
|
checks,
|
|
@@ -8318,7 +8471,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8318
8471
|
}
|
|
8319
8472
|
}
|
|
8320
8473
|
var runDiagnostics = async (options = {}) => {
|
|
8321
|
-
const root =
|
|
8474
|
+
const root = import_node_path22.default.resolve(options.root ?? process.cwd());
|
|
8322
8475
|
const includes = parseIncludes(options.include);
|
|
8323
8476
|
const issues = [];
|
|
8324
8477
|
const checks = [];
|
|
@@ -8364,7 +8517,7 @@ function parseIncludeOption(value) {
|
|
|
8364
8517
|
return includes;
|
|
8365
8518
|
}
|
|
8366
8519
|
async function runDoctorCli(args, context) {
|
|
8367
|
-
const parsed =
|
|
8520
|
+
const parsed = (0, import_node_util8.parseArgs)({
|
|
8368
8521
|
args,
|
|
8369
8522
|
allowPositionals: true,
|
|
8370
8523
|
strict: false,
|
|
@@ -8437,13 +8590,15 @@ function printDoctorOutput(result, output) {
|
|
|
8437
8590
|
}
|
|
8438
8591
|
|
|
8439
8592
|
// packages/infrastructure/cli/src/commands/misc.ts
|
|
8593
|
+
var import_node_path23 = __toESM(require("path"), 1);
|
|
8594
|
+
var import_node_util9 = require("util");
|
|
8440
8595
|
init_errors();
|
|
8441
8596
|
init_fs();
|
|
8442
8597
|
init_json();
|
|
8443
8598
|
var testCommand = {
|
|
8444
8599
|
name: "test",
|
|
8445
8600
|
async run(args) {
|
|
8446
|
-
const parsed =
|
|
8601
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8447
8602
|
args,
|
|
8448
8603
|
allowPositionals: true,
|
|
8449
8604
|
strict: false,
|
|
@@ -8468,7 +8623,7 @@ var shareCommand = {
|
|
|
8468
8623
|
name: "share",
|
|
8469
8624
|
async run(args, context) {
|
|
8470
8625
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8471
|
-
const manifestPath =
|
|
8626
|
+
const manifestPath = import_node_path23.default.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8472
8627
|
const defaultManifest = {
|
|
8473
8628
|
name,
|
|
8474
8629
|
version: "0.1.0"
|
|
@@ -8505,7 +8660,7 @@ var codeCommand = {
|
|
|
8505
8660
|
async run(args, context) {
|
|
8506
8661
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8507
8662
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8508
|
-
const parsed =
|
|
8663
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8509
8664
|
args,
|
|
8510
8665
|
allowPositionals: true,
|
|
8511
8666
|
strict: false,
|
|
@@ -8554,14 +8709,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8554
8709
|
};
|
|
8555
8710
|
var resolveCurrentCliVersion = async (context) => {
|
|
8556
8711
|
const candidates = [
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8712
|
+
import_node_path23.default.resolve(context.runtimeDir, "..", "package.json"),
|
|
8713
|
+
import_node_path23.default.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8714
|
+
import_node_path23.default.resolve(process.cwd(), "package.json")
|
|
8560
8715
|
];
|
|
8561
8716
|
for (const candidate of candidates) {
|
|
8562
8717
|
if (!await pathExists2(candidate)) continue;
|
|
8563
8718
|
const pkg = await readJsonSafe(candidate);
|
|
8564
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8719
|
+
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}`));
|
|
8565
8720
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8566
8721
|
}
|
|
8567
8722
|
return "0.0.0";
|
|
@@ -8611,7 +8766,7 @@ var versionCommand = {
|
|
|
8611
8766
|
name: "version",
|
|
8612
8767
|
aliases: ["v"],
|
|
8613
8768
|
async run(args, context) {
|
|
8614
|
-
const parsed =
|
|
8769
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8615
8770
|
args,
|
|
8616
8771
|
allowPositionals: true,
|
|
8617
8772
|
strict: false,
|
|
@@ -8645,7 +8800,7 @@ var upgradeCommand = {
|
|
|
8645
8800
|
name: "upgrade",
|
|
8646
8801
|
aliases: ["update"],
|
|
8647
8802
|
async run(args, context) {
|
|
8648
|
-
const parsed =
|
|
8803
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8649
8804
|
args,
|
|
8650
8805
|
allowPositionals: true,
|
|
8651
8806
|
strict: false,
|
|
@@ -8799,11 +8954,14 @@ var pluginCommand = {
|
|
|
8799
8954
|
};
|
|
8800
8955
|
|
|
8801
8956
|
// packages/infrastructure/cli/src/preflight.ts
|
|
8957
|
+
var import_node_path25 = __toESM(require("path"), 1);
|
|
8958
|
+
var import_node_url7 = require("url");
|
|
8802
8959
|
init_args();
|
|
8803
8960
|
init_errors();
|
|
8804
8961
|
init_fs();
|
|
8805
8962
|
init_json();
|
|
8806
8963
|
init_src4();
|
|
8964
|
+
var import_meta4 = {};
|
|
8807
8965
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8808
8966
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8809
8967
|
{
|
|
@@ -8829,8 +8987,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8829
8987
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8830
8988
|
let configPath = null;
|
|
8831
8989
|
for (const file of twConfigFiles) {
|
|
8832
|
-
if (await pathExists2(
|
|
8833
|
-
configPath =
|
|
8990
|
+
if (await pathExists2(import_node_path25.default.join(cwd2, file))) {
|
|
8991
|
+
configPath = import_node_path25.default.join(cwd2, file);
|
|
8834
8992
|
break;
|
|
8835
8993
|
}
|
|
8836
8994
|
}
|
|
@@ -8839,7 +8997,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8839
8997
|
return results;
|
|
8840
8998
|
}
|
|
8841
8999
|
try {
|
|
8842
|
-
const configUrl =
|
|
9000
|
+
const configUrl = (0, import_node_url7.pathToFileURL)(configPath);
|
|
8843
9001
|
const configModule = await import(configUrl.href);
|
|
8844
9002
|
const config = configModule.default || configModule;
|
|
8845
9003
|
const theme = config.theme || {};
|
|
@@ -8921,7 +9079,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8921
9079
|
async function hasTailwindCssImport(cwd2) {
|
|
8922
9080
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8923
9081
|
for (const file of cssFiles) {
|
|
8924
|
-
const raw = await readFileSafe(
|
|
9082
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8925
9083
|
if (raw?.includes("tailwindcss")) return true;
|
|
8926
9084
|
}
|
|
8927
9085
|
return false;
|
|
@@ -8937,7 +9095,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8937
9095
|
"app/globals.css"
|
|
8938
9096
|
];
|
|
8939
9097
|
for (const file of cssFiles) {
|
|
8940
|
-
const raw = await readFileSafe(
|
|
9098
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8941
9099
|
if (raw === null) continue;
|
|
8942
9100
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8943
9101
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8945,8 +9103,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8945
9103
|
return { found: false, cssFile: null };
|
|
8946
9104
|
}
|
|
8947
9105
|
async function applyTailwindInit(cwd2) {
|
|
8948
|
-
await ensureFileSafe(
|
|
8949
|
-
await ensureFileSafe(
|
|
9106
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9107
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8950
9108
|
}
|
|
8951
9109
|
function check(results, id, label, pass, message, fix) {
|
|
8952
9110
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8968,7 +9126,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8968
9126
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8969
9127
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8970
9128
|
);
|
|
8971
|
-
const pkg = await readJsonSafe(
|
|
9129
|
+
const pkg = await readJsonSafe(import_node_path25.default.join(cwd2, "package.json"));
|
|
8972
9130
|
check(
|
|
8973
9131
|
results,
|
|
8974
9132
|
"package-json",
|
|
@@ -9002,7 +9160,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9002
9160
|
}
|
|
9003
9161
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9004
9162
|
const twConfigChecks = await Promise.all(
|
|
9005
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9163
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path25.default.join(cwd2, file)) }))
|
|
9006
9164
|
);
|
|
9007
9165
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9008
9166
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9014,7 +9172,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9014
9172
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9015
9173
|
"tw init"
|
|
9016
9174
|
);
|
|
9017
|
-
const oldConfig = await readJsonSafe(
|
|
9175
|
+
const oldConfig = await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.ts"));
|
|
9018
9176
|
if (oldConfig) {
|
|
9019
9177
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9020
9178
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9038,7 +9196,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9038
9196
|
validation.message
|
|
9039
9197
|
);
|
|
9040
9198
|
}
|
|
9041
|
-
const hasTsConfig = await pathExists2(
|
|
9199
|
+
const hasTsConfig = await pathExists2(import_node_path25.default.join(cwd2, "tsconfig.json"));
|
|
9042
9200
|
check(
|
|
9043
9201
|
results,
|
|
9044
9202
|
"typescript",
|
|
@@ -9114,7 +9272,8 @@ async function runPreflightCli(rawArgs) {
|
|
|
9114
9272
|
function isDirectExecution() {
|
|
9115
9273
|
const scriptPath = process.argv[1];
|
|
9116
9274
|
if (!scriptPath) return false;
|
|
9117
|
-
|
|
9275
|
+
const currentUrl = typeof import_meta4 !== "undefined" && __importMetaUrl ? __importMetaUrl : `file://${scriptPath}`;
|
|
9276
|
+
return currentUrl === (0, import_node_url7.pathToFileURL)(scriptPath).href;
|
|
9118
9277
|
}
|
|
9119
9278
|
if (isDirectExecution()) {
|
|
9120
9279
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9182,6 +9341,7 @@ var installRegistryCommand = {
|
|
|
9182
9341
|
};
|
|
9183
9342
|
|
|
9184
9343
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9344
|
+
var import_node_util10 = require("util");
|
|
9185
9345
|
init_errors();
|
|
9186
9346
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9187
9347
|
if (context.json && options.jsonUnsupported) {
|
|
@@ -9211,7 +9371,7 @@ var parseCommand = {
|
|
|
9211
9371
|
var transformCommand = {
|
|
9212
9372
|
name: "transform",
|
|
9213
9373
|
async run(args, context) {
|
|
9214
|
-
const parsed =
|
|
9374
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9215
9375
|
args,
|
|
9216
9376
|
allowPositionals: true,
|
|
9217
9377
|
strict: false,
|
|
@@ -9254,7 +9414,7 @@ var lintCommand = {
|
|
|
9254
9414
|
var formatCommand2 = {
|
|
9255
9415
|
name: "format",
|
|
9256
9416
|
async run(args, context) {
|
|
9257
|
-
const parsed =
|
|
9417
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9258
9418
|
args,
|
|
9259
9419
|
allowPositionals: true,
|
|
9260
9420
|
strict: false,
|
|
@@ -9296,7 +9456,7 @@ var optimizeCommand = {
|
|
|
9296
9456
|
var splitCommand = {
|
|
9297
9457
|
name: "split",
|
|
9298
9458
|
async run(args, context) {
|
|
9299
|
-
const parsed =
|
|
9459
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9300
9460
|
args,
|
|
9301
9461
|
allowPositionals: true,
|
|
9302
9462
|
strict: false,
|
|
@@ -9392,13 +9552,15 @@ var scriptCommands = [
|
|
|
9392
9552
|
];
|
|
9393
9553
|
|
|
9394
9554
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9555
|
+
var import_node_path26 = __toESM(require("path"), 1);
|
|
9556
|
+
var import_node_util11 = require("util");
|
|
9395
9557
|
init_errors();
|
|
9396
9558
|
init_fs();
|
|
9397
9559
|
init_json();
|
|
9398
9560
|
var storybookCommand = {
|
|
9399
9561
|
name: "storybook",
|
|
9400
9562
|
async run(args, context) {
|
|
9401
|
-
const parsed =
|
|
9563
|
+
const parsed = (0, import_node_util11.parseArgs)({
|
|
9402
9564
|
args,
|
|
9403
9565
|
allowPositionals: true,
|
|
9404
9566
|
strict: false,
|
|
@@ -9432,7 +9594,7 @@ var storybookCommand = {
|
|
|
9432
9594
|
context.output.writeText(
|
|
9433
9595
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9434
9596
|
);
|
|
9435
|
-
const localBin =
|
|
9597
|
+
const localBin = import_node_path26.default.join(
|
|
9436
9598
|
process.cwd(),
|
|
9437
9599
|
"node_modules",
|
|
9438
9600
|
".bin",
|
|
@@ -9449,6 +9611,7 @@ var storybookCommand = {
|
|
|
9449
9611
|
};
|
|
9450
9612
|
|
|
9451
9613
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9614
|
+
var import_node_util12 = require("util");
|
|
9452
9615
|
init_errors();
|
|
9453
9616
|
var studioCommand = {
|
|
9454
9617
|
name: "studio",
|
|
@@ -9456,7 +9619,7 @@ var studioCommand = {
|
|
|
9456
9619
|
if (context.json) {
|
|
9457
9620
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9458
9621
|
}
|
|
9459
|
-
const parsed =
|
|
9622
|
+
const parsed = (0, import_node_util12.parseArgs)({
|
|
9460
9623
|
args,
|
|
9461
9624
|
allowPositionals: true,
|
|
9462
9625
|
strict: false,
|
|
@@ -9522,7 +9685,8 @@ var syncCommand = {
|
|
|
9522
9685
|
};
|
|
9523
9686
|
|
|
9524
9687
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9525
|
-
var
|
|
9688
|
+
var import_node_util13 = require("util");
|
|
9689
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9526
9690
|
init_errors();
|
|
9527
9691
|
|
|
9528
9692
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
@@ -9530,16 +9694,17 @@ init_internal();
|
|
|
9530
9694
|
|
|
9531
9695
|
// packages/domain/engine/src/native-bridge.ts
|
|
9532
9696
|
init_src();
|
|
9697
|
+
var import_meta5 = {};
|
|
9533
9698
|
var log4 = createDebugLogger("engine:native");
|
|
9534
9699
|
function getDirname3() {
|
|
9535
9700
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
9536
|
-
if (typeof
|
|
9537
|
-
return getDirname(
|
|
9701
|
+
if (typeof import_meta5 !== "undefined" && __importMetaUrl) {
|
|
9702
|
+
return getDirname(__importMetaUrl);
|
|
9538
9703
|
}
|
|
9539
9704
|
return process.cwd();
|
|
9540
9705
|
}
|
|
9541
|
-
var isValidEngineBinding = (
|
|
9542
|
-
const candidate =
|
|
9706
|
+
var isValidEngineBinding = (module2) => {
|
|
9707
|
+
const candidate = module2;
|
|
9543
9708
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
9544
9709
|
};
|
|
9545
9710
|
var createEngineBindingLoader = () => {
|
|
@@ -10347,7 +10512,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10347
10512
|
const parsed = native.parseCssRules(css);
|
|
10348
10513
|
for (const r of parsed) {
|
|
10349
10514
|
const className = prefix + r.className;
|
|
10350
|
-
r.variants.length > 0;
|
|
10515
|
+
const hasVariants = r.variants.length > 0;
|
|
10351
10516
|
const layerName = detectLayerFromClassName(className);
|
|
10352
10517
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10353
10518
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10597,10 +10762,12 @@ async function traceClass(className, options) {
|
|
|
10597
10762
|
}
|
|
10598
10763
|
|
|
10599
10764
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10765
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
10766
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
|
10600
10767
|
init_internal();
|
|
10601
10768
|
init_src2();
|
|
10602
10769
|
function toRelativePath(root, value) {
|
|
10603
|
-
const relative =
|
|
10770
|
+
const relative = import_node_path27.default.relative(root, value);
|
|
10604
10771
|
return relative.length > 0 ? relative : ".";
|
|
10605
10772
|
}
|
|
10606
10773
|
function uniqueSorted(values) {
|
|
@@ -10669,7 +10836,7 @@ function tryCompileClasses(classes) {
|
|
|
10669
10836
|
}
|
|
10670
10837
|
}
|
|
10671
10838
|
function traceSingleFile(filePath, root) {
|
|
10672
|
-
const source =
|
|
10839
|
+
const source = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
10673
10840
|
const classes = uniqueSorted(scanSource(source));
|
|
10674
10841
|
const imports = extractImports(source);
|
|
10675
10842
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10700,7 +10867,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10700
10867
|
const imports = [];
|
|
10701
10868
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10702
10869
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10703
|
-
const source =
|
|
10870
|
+
const source = import_node_fs10.default.readFileSync(entry.file, "utf8");
|
|
10704
10871
|
const fileImports = extractImports(source);
|
|
10705
10872
|
for (const fileImport of fileImports) {
|
|
10706
10873
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10731,12 +10898,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10731
10898
|
};
|
|
10732
10899
|
}
|
|
10733
10900
|
async function traceTarget(target, options = {}) {
|
|
10734
|
-
const root =
|
|
10735
|
-
const resolvedTarget =
|
|
10736
|
-
if (!
|
|
10901
|
+
const root = import_node_path27.default.resolve(options.root ?? process.cwd());
|
|
10902
|
+
const resolvedTarget = import_node_path27.default.resolve(root, target);
|
|
10903
|
+
if (!import_node_fs10.default.existsSync(resolvedTarget)) {
|
|
10737
10904
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10738
10905
|
}
|
|
10739
|
-
const stat =
|
|
10906
|
+
const stat = import_node_fs10.default.statSync(resolvedTarget);
|
|
10740
10907
|
if (stat.isDirectory()) {
|
|
10741
10908
|
return traceDirectory(resolvedTarget, root);
|
|
10742
10909
|
}
|
|
@@ -10754,7 +10921,7 @@ function parseTraceFormat(value, context) {
|
|
|
10754
10921
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10755
10922
|
}
|
|
10756
10923
|
async function runTraceCli(args, context) {
|
|
10757
|
-
const parsed =
|
|
10924
|
+
const parsed = (0, import_node_util13.parseArgs)({
|
|
10758
10925
|
args,
|
|
10759
10926
|
allowPositionals: true,
|
|
10760
10927
|
strict: false,
|
|
@@ -10898,14 +11065,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10898
11065
|
}
|
|
10899
11066
|
|
|
10900
11067
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10901
|
-
var
|
|
11068
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
11069
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
11070
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10902
11071
|
init_output();
|
|
10903
11072
|
async function runGenerateTypesCli(rawArgs) {
|
|
10904
11073
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10905
11074
|
const logger = createCliLogger({ output });
|
|
10906
11075
|
const cwd2 = process.cwd();
|
|
10907
11076
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10908
|
-
const outPath =
|
|
11077
|
+
const outPath = import_node_path28.default.resolve(cwd2, outFile);
|
|
10909
11078
|
output.writeText("");
|
|
10910
11079
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10911
11080
|
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"));
|
|
@@ -10941,12 +11110,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10941
11110
|
}
|
|
10942
11111
|
output.writeText("");
|
|
10943
11112
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10944
|
-
const outDir =
|
|
10945
|
-
if (!
|
|
10946
|
-
|
|
11113
|
+
const outDir = import_node_path28.default.dirname(outPath);
|
|
11114
|
+
if (!import_node_fs11.default.existsSync(outDir)) {
|
|
11115
|
+
import_node_fs11.default.mkdirSync(outDir, { recursive: true });
|
|
10947
11116
|
}
|
|
10948
|
-
|
|
10949
|
-
logger.ok(
|
|
11117
|
+
import_node_fs11.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11118
|
+
logger.ok(import_node_path28.default.relative(cwd2, outPath));
|
|
10950
11119
|
output.writeText("");
|
|
10951
11120
|
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"));
|
|
10952
11121
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10957,13 +11126,13 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10957
11126
|
}
|
|
10958
11127
|
async function loadNativeBinding2(cwd2) {
|
|
10959
11128
|
const candidates = [
|
|
10960
|
-
|
|
10961
|
-
|
|
11129
|
+
import_node_path28.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11130
|
+
import_node_path28.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10962
11131
|
];
|
|
10963
11132
|
for (const candidate of candidates) {
|
|
10964
|
-
if (
|
|
11133
|
+
if (import_node_fs11.default.existsSync(candidate)) {
|
|
10965
11134
|
try {
|
|
10966
|
-
return
|
|
11135
|
+
return require(candidate);
|
|
10967
11136
|
} catch {
|
|
10968
11137
|
}
|
|
10969
11138
|
}
|
|
@@ -10972,9 +11141,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10972
11141
|
}
|
|
10973
11142
|
|
|
10974
11143
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
11144
|
+
var import_node_util14 = require("util");
|
|
10975
11145
|
init_errors();
|
|
10976
11146
|
|
|
10977
11147
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11148
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
11149
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
10978
11150
|
init_internal();
|
|
10979
11151
|
init_src2();
|
|
10980
11152
|
function extractVariantChain(usage) {
|
|
@@ -11023,7 +11195,7 @@ async function whyClass(className, options) {
|
|
|
11023
11195
|
for (const file of scanResult.files) {
|
|
11024
11196
|
const source = (() => {
|
|
11025
11197
|
try {
|
|
11026
|
-
return
|
|
11198
|
+
return import_node_fs12.default.readFileSync(file.file, "utf8");
|
|
11027
11199
|
} catch {
|
|
11028
11200
|
return "";
|
|
11029
11201
|
}
|
|
@@ -11037,7 +11209,7 @@ async function whyClass(className, options) {
|
|
|
11037
11209
|
className
|
|
11038
11210
|
]);
|
|
11039
11211
|
usedIn.push({
|
|
11040
|
-
file:
|
|
11212
|
+
file: import_node_path29.default.relative(root, file.file) || import_node_path29.default.basename(file.file),
|
|
11041
11213
|
line: location.line,
|
|
11042
11214
|
column: location.column,
|
|
11043
11215
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11158,7 +11330,7 @@ function printWhyOutput(result, output) {
|
|
|
11158
11330
|
output.writeText("");
|
|
11159
11331
|
}
|
|
11160
11332
|
async function runWhyCli(args, context) {
|
|
11161
|
-
const parsed =
|
|
11333
|
+
const parsed = (0, import_node_util14.parseArgs)({
|
|
11162
11334
|
args,
|
|
11163
11335
|
allowPositionals: true,
|
|
11164
11336
|
strict: false,
|
|
@@ -11200,7 +11372,7 @@ function toVariadic(value) {
|
|
|
11200
11372
|
return Array.isArray(value) ? value : [value];
|
|
11201
11373
|
}
|
|
11202
11374
|
function buildMainProgram(context) {
|
|
11203
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11375
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11204
11376
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11205
11377
|
const program2 = new Command("tw");
|
|
11206
11378
|
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");
|
|
@@ -11497,18 +11669,19 @@ init_args();
|
|
|
11497
11669
|
init_output();
|
|
11498
11670
|
async function main2() {
|
|
11499
11671
|
await runCliMain({
|
|
11500
|
-
importMetaUrl:
|
|
11672
|
+
importMetaUrl: __importMetaUrl,
|
|
11501
11673
|
buildProgram: buildMainProgram
|
|
11502
11674
|
});
|
|
11503
11675
|
}
|
|
11504
|
-
var
|
|
11505
|
-
if (process.argv[1] ===
|
|
11676
|
+
var __currentFile = (0, import_node_url8.fileURLToPath)(__importMetaUrl);
|
|
11677
|
+
if (process.argv[1] === __currentFile) {
|
|
11506
11678
|
main2();
|
|
11507
11679
|
}
|
|
11508
|
-
|
|
11509
|
-
exports
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11680
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
11681
|
+
0 && (module.exports = {
|
|
11682
|
+
createCliOutput,
|
|
11683
|
+
ensureFlag,
|
|
11684
|
+
parseCliArgs,
|
|
11685
|
+
runScanCli
|
|
11686
|
+
});
|
|
11514
11687
|
//# sourceMappingURL=cli.js.map
|