tailwind-styled-v4 5.0.37 → 5.0.38
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 +118 -82
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +28 -14
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +105 -68
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +40 -13
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +577 -426
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +466 -304
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +826 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +287 -29
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +71 -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 +333 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +26 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +679 -502
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +467 -307
- 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 +1329 -7441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1266 -7385
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +318 -243
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +256 -181
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +93 -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 +67 -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 +101 -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 +47 -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 +82 -50
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +20 -12
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +62 -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 +97 -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 +163 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +67 -39
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.js +441 -295
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +253 -122
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +39 -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 +88 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -13
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +68 -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 +55 -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 +131 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +42 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +150 -116
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +124 -81
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +560 -421
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +460 -302
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +561 -446
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +433 -321
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +95 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +30 -14
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +110 -78
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -17
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +3 -1
package/dist/cli.js
CHANGED
|
@@ -1,60 +1,15 @@
|
|
|
1
|
-
'use strict';
|
|
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
|
-
|
|
41
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
2
|
+
"use strict";
|
|
42
3
|
var __create = Object.create;
|
|
43
4
|
var __defProp = Object.defineProperty;
|
|
44
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
45
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
46
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
47
8
|
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
9
|
var __esm = (fn, res) => function __init() {
|
|
55
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
56
11
|
};
|
|
57
|
-
var __commonJS = (cb, mod) => function
|
|
12
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
58
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
59
14
|
};
|
|
60
15
|
var __export = (target, all) => {
|
|
@@ -74,14 +29,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
74
29
|
// file that has been converted to a CommonJS file using a Babel-
|
|
75
30
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
76
31
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
77
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
32
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
78
33
|
mod
|
|
79
34
|
));
|
|
80
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
81
36
|
|
|
82
37
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
83
38
|
var require_error = __commonJS({
|
|
84
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(
|
|
39
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports2) {
|
|
40
|
+
"use strict";
|
|
85
41
|
var CommanderError2 = class extends Error {
|
|
86
42
|
/**
|
|
87
43
|
* Constructs the CommanderError class
|
|
@@ -109,14 +65,15 @@ var require_error = __commonJS({
|
|
|
109
65
|
this.name = this.constructor.name;
|
|
110
66
|
}
|
|
111
67
|
};
|
|
112
|
-
|
|
113
|
-
|
|
68
|
+
exports2.CommanderError = CommanderError2;
|
|
69
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
114
70
|
}
|
|
115
71
|
});
|
|
116
72
|
|
|
117
73
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
118
74
|
var require_argument = __commonJS({
|
|
119
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(
|
|
75
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports2) {
|
|
76
|
+
"use strict";
|
|
120
77
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
121
78
|
var Argument2 = class {
|
|
122
79
|
/**
|
|
@@ -236,14 +193,15 @@ var require_argument = __commonJS({
|
|
|
236
193
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
237
194
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
238
195
|
}
|
|
239
|
-
|
|
240
|
-
|
|
196
|
+
exports2.Argument = Argument2;
|
|
197
|
+
exports2.humanReadableArgName = humanReadableArgName;
|
|
241
198
|
}
|
|
242
199
|
});
|
|
243
200
|
|
|
244
201
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
245
202
|
var require_help = __commonJS({
|
|
246
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(
|
|
203
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports2) {
|
|
204
|
+
"use strict";
|
|
247
205
|
var { humanReadableArgName } = require_argument();
|
|
248
206
|
var Help2 = class {
|
|
249
207
|
constructor() {
|
|
@@ -651,13 +609,14 @@ var require_help = __commonJS({
|
|
|
651
609
|
}).join("\n");
|
|
652
610
|
}
|
|
653
611
|
};
|
|
654
|
-
|
|
612
|
+
exports2.Help = Help2;
|
|
655
613
|
}
|
|
656
614
|
});
|
|
657
615
|
|
|
658
616
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
659
617
|
var require_option = __commonJS({
|
|
660
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(
|
|
618
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports2) {
|
|
619
|
+
"use strict";
|
|
661
620
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
662
621
|
var Option2 = class {
|
|
663
622
|
/**
|
|
@@ -922,14 +881,15 @@ var require_option = __commonJS({
|
|
|
922
881
|
}
|
|
923
882
|
return { shortFlag, longFlag };
|
|
924
883
|
}
|
|
925
|
-
|
|
926
|
-
|
|
884
|
+
exports2.Option = Option2;
|
|
885
|
+
exports2.DualOptions = DualOptions;
|
|
927
886
|
}
|
|
928
887
|
});
|
|
929
888
|
|
|
930
889
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
931
890
|
var require_suggestSimilar = __commonJS({
|
|
932
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(
|
|
891
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
892
|
+
"use strict";
|
|
933
893
|
var maxDistance = 3;
|
|
934
894
|
function editDistance(a, b) {
|
|
935
895
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -1003,18 +963,19 @@ var require_suggestSimilar = __commonJS({
|
|
|
1003
963
|
}
|
|
1004
964
|
return "";
|
|
1005
965
|
}
|
|
1006
|
-
|
|
966
|
+
exports2.suggestSimilar = suggestSimilar;
|
|
1007
967
|
}
|
|
1008
968
|
});
|
|
1009
969
|
|
|
1010
970
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
1011
971
|
var require_command = __commonJS({
|
|
1012
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(
|
|
1013
|
-
|
|
1014
|
-
var
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
972
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports2) {
|
|
973
|
+
"use strict";
|
|
974
|
+
var EventEmitter = require("events").EventEmitter;
|
|
975
|
+
var childProcess = require("child_process");
|
|
976
|
+
var path30 = require("path");
|
|
977
|
+
var fs16 = require("fs");
|
|
978
|
+
var process2 = require("process");
|
|
1018
979
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1019
980
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1020
981
|
var { Help: Help2 } = require_help();
|
|
@@ -1423,6 +1384,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1423
1384
|
this._exitCallback = (err) => {
|
|
1424
1385
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1425
1386
|
throw err;
|
|
1387
|
+
} else {
|
|
1426
1388
|
}
|
|
1427
1389
|
};
|
|
1428
1390
|
}
|
|
@@ -3045,29 +3007,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3045
3007
|
return arg;
|
|
3046
3008
|
});
|
|
3047
3009
|
}
|
|
3048
|
-
|
|
3010
|
+
exports2.Command = Command2;
|
|
3049
3011
|
}
|
|
3050
3012
|
});
|
|
3051
3013
|
|
|
3052
3014
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3053
3015
|
var require_commander = __commonJS({
|
|
3054
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(
|
|
3016
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports2) {
|
|
3017
|
+
"use strict";
|
|
3055
3018
|
var { Argument: Argument2 } = require_argument();
|
|
3056
3019
|
var { Command: Command2 } = require_command();
|
|
3057
3020
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3058
3021
|
var { Help: Help2 } = require_help();
|
|
3059
3022
|
var { Option: Option2 } = require_option();
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3023
|
+
exports2.program = new Command2();
|
|
3024
|
+
exports2.createCommand = (name) => new Command2(name);
|
|
3025
|
+
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3026
|
+
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3027
|
+
exports2.Command = Command2;
|
|
3028
|
+
exports2.Option = Option2;
|
|
3029
|
+
exports2.Argument = Argument2;
|
|
3030
|
+
exports2.Help = Help2;
|
|
3031
|
+
exports2.CommanderError = CommanderError2;
|
|
3032
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
3033
|
+
exports2.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3071
3034
|
}
|
|
3072
3035
|
});
|
|
3073
3036
|
|
|
@@ -3075,7 +3038,8 @@ var require_commander = __commonJS({
|
|
|
3075
3038
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3076
3039
|
var init_esm = __esm({
|
|
3077
3040
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3078
|
-
|
|
3041
|
+
"use strict";
|
|
3042
|
+
import_index = __toESM(require_commander(), 1);
|
|
3079
3043
|
({
|
|
3080
3044
|
program,
|
|
3081
3045
|
createCommand,
|
|
@@ -3120,6 +3084,7 @@ function errorExitCode(error) {
|
|
|
3120
3084
|
var CliError, CliUsageError;
|
|
3121
3085
|
var init_errors = __esm({
|
|
3122
3086
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3087
|
+
"use strict";
|
|
3123
3088
|
CliError = class extends Error {
|
|
3124
3089
|
exitCode;
|
|
3125
3090
|
code;
|
|
@@ -3144,7 +3109,7 @@ function getNodeModuleRef() {
|
|
|
3144
3109
|
if (isBrowser) return null;
|
|
3145
3110
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
3146
3111
|
try {
|
|
3147
|
-
const test = typeof
|
|
3112
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
3148
3113
|
nodeModuleRef = test;
|
|
3149
3114
|
return test;
|
|
3150
3115
|
} catch {
|
|
@@ -3156,14 +3121,14 @@ function getNodePath() {
|
|
|
3156
3121
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
3157
3122
|
const nodeRequire = getNodeModuleRef();
|
|
3158
3123
|
if (!nodeRequire) throw new Error("require not available");
|
|
3159
|
-
if (!_nodePath) _nodePath = nodeRequire.createRequire(
|
|
3124
|
+
if (!_nodePath) _nodePath = nodeRequire.createRequire(import_meta.url)("node:path");
|
|
3160
3125
|
return _nodePath;
|
|
3161
3126
|
}
|
|
3162
3127
|
function getNodeUrl() {
|
|
3163
3128
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
3164
3129
|
const nodeRequire = getNodeModuleRef();
|
|
3165
3130
|
if (!nodeRequire) throw new Error("require not available");
|
|
3166
|
-
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(
|
|
3131
|
+
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import_meta.url)("node:url");
|
|
3167
3132
|
return _nodeUrl;
|
|
3168
3133
|
}
|
|
3169
3134
|
function getDirname(importMetaUrl) {
|
|
@@ -3172,15 +3137,19 @@ function getDirname(importMetaUrl) {
|
|
|
3172
3137
|
const nodeUrl = getNodeUrl();
|
|
3173
3138
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
3174
3139
|
}
|
|
3175
|
-
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3140
|
+
var import_meta, isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3176
3141
|
var init_esmHelpers = __esm({
|
|
3177
3142
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3143
|
+
"use strict";
|
|
3144
|
+
import_meta = {};
|
|
3178
3145
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3179
3146
|
nodeModuleRef = null;
|
|
3180
3147
|
_nodePath = null;
|
|
3181
3148
|
_nodeUrl = null;
|
|
3182
3149
|
}
|
|
3183
3150
|
});
|
|
3151
|
+
|
|
3152
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3184
3153
|
function platformKey() {
|
|
3185
3154
|
if (isBrowser2) return "browser";
|
|
3186
3155
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3196,7 +3165,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3196
3165
|
}
|
|
3197
3166
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3198
3167
|
if (envPath) {
|
|
3199
|
-
if (
|
|
3168
|
+
if (fs.existsSync(envPath)) {
|
|
3200
3169
|
return { path: envPath, source: "env", platform, tried };
|
|
3201
3170
|
}
|
|
3202
3171
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3205,7 +3174,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3205
3174
|
for (const pkg of prebuiltPkgs) {
|
|
3206
3175
|
try {
|
|
3207
3176
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3208
|
-
if (
|
|
3177
|
+
if (fs.existsSync(candidate)) {
|
|
3209
3178
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3210
3179
|
}
|
|
3211
3180
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3216,13 +3185,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3216
3185
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3217
3186
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3218
3187
|
if (runtimeDir) {
|
|
3219
|
-
for (const depth of ["..",
|
|
3220
|
-
const pkgRoot =
|
|
3188
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3189
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3221
3190
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3222
3191
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3223
|
-
const candidate =
|
|
3192
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3224
3193
|
tried.push(`self-bundled:${candidate}`);
|
|
3225
|
-
if (
|
|
3194
|
+
if (fs.existsSync(candidate)) {
|
|
3226
3195
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3227
3196
|
}
|
|
3228
3197
|
}
|
|
@@ -3234,39 +3203,44 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3234
3203
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3235
3204
|
const localCandidates = [];
|
|
3236
3205
|
for (const bin of BINARY_NAMES) {
|
|
3237
|
-
localCandidates.push(
|
|
3238
|
-
localCandidates.push(
|
|
3239
|
-
localCandidates.push(
|
|
3240
|
-
localCandidates.push(
|
|
3206
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3207
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3208
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3209
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3241
3210
|
}
|
|
3242
3211
|
for (const startDir of [cwd2, base]) {
|
|
3243
3212
|
let dir = startDir;
|
|
3244
3213
|
for (let i = 0; i < 6; i++) {
|
|
3245
|
-
const nativeDir =
|
|
3214
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3246
3215
|
for (const bin of BINARY_NAMES) {
|
|
3247
|
-
localCandidates.push(
|
|
3248
|
-
localCandidates.push(
|
|
3249
|
-
localCandidates.push(
|
|
3250
|
-
localCandidates.push(
|
|
3216
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3217
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3218
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3219
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3251
3220
|
}
|
|
3252
|
-
const parent =
|
|
3221
|
+
const parent = path.resolve(dir, "..");
|
|
3253
3222
|
if (parent === dir) break;
|
|
3254
3223
|
dir = parent;
|
|
3255
3224
|
}
|
|
3256
3225
|
}
|
|
3257
3226
|
for (const candidate of localCandidates) {
|
|
3258
3227
|
tried.push(`local:${candidate}`);
|
|
3259
|
-
if (
|
|
3228
|
+
if (fs.existsSync(candidate)) {
|
|
3260
3229
|
return { path: candidate, source: "local", platform, tried };
|
|
3261
3230
|
}
|
|
3262
3231
|
}
|
|
3263
3232
|
return { path: null, source: "not-found", platform, tried };
|
|
3264
3233
|
}
|
|
3265
|
-
var isBrowser2, _require, PLATFORM_MAP;
|
|
3234
|
+
var import_node_module, fs, path, import_meta2, isBrowser2, _require, PLATFORM_MAP;
|
|
3266
3235
|
var init_native_resolution = __esm({
|
|
3267
3236
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3237
|
+
"use strict";
|
|
3238
|
+
import_node_module = require("module");
|
|
3239
|
+
fs = __toESM(require("fs"));
|
|
3240
|
+
path = __toESM(require("path"));
|
|
3241
|
+
import_meta2 = {};
|
|
3268
3242
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3269
|
-
_require = typeof
|
|
3243
|
+
_require = typeof require !== "undefined" ? require : (0, import_node_module.createRequire)(import_meta2.url);
|
|
3270
3244
|
PLATFORM_MAP = {
|
|
3271
3245
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
3272
3246
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -3277,6 +3251,8 @@ var init_native_resolution = __esm({
|
|
|
3277
3251
|
};
|
|
3278
3252
|
}
|
|
3279
3253
|
});
|
|
3254
|
+
|
|
3255
|
+
// packages/domain/shared/src/index.ts
|
|
3280
3256
|
function createLogger(namespace) {
|
|
3281
3257
|
const prefix = `[${namespace}]`;
|
|
3282
3258
|
return {
|
|
@@ -3319,9 +3295,9 @@ function loadNativeBinding(options) {
|
|
|
3319
3295
|
const { runtimeDir, candidates, isValid } = options;
|
|
3320
3296
|
const loadErrors = [];
|
|
3321
3297
|
for (const candidate of candidates) {
|
|
3322
|
-
const candidatePath =
|
|
3298
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
3323
3299
|
try {
|
|
3324
|
-
if (!
|
|
3300
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
3325
3301
|
continue;
|
|
3326
3302
|
}
|
|
3327
3303
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3353,9 +3329,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3353
3329
|
}
|
|
3354
3330
|
}
|
|
3355
3331
|
if (!includeDefaultCandidates) return candidates;
|
|
3356
|
-
if (
|
|
3332
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
3357
3333
|
try {
|
|
3358
|
-
for (const entry of
|
|
3334
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
3359
3335
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3360
3336
|
}
|
|
3361
3337
|
} catch {
|
|
@@ -3364,31 +3340,38 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3364
3340
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3365
3341
|
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
3342
|
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(
|
|
3343
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
3344
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3345
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3346
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3347
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3348
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3349
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3350
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3351
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3376
3352
|
}
|
|
3377
3353
|
return Array.from(new Set(candidates));
|
|
3378
3354
|
}
|
|
3379
3355
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3380
|
-
if (dir) return
|
|
3356
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
3381
3357
|
try {
|
|
3382
|
-
return
|
|
3358
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3383
3359
|
} catch {
|
|
3384
3360
|
return process.cwd();
|
|
3385
3361
|
}
|
|
3386
3362
|
}
|
|
3387
|
-
var TwError, _require2;
|
|
3363
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module2, import_meta3, TwError, _require2;
|
|
3388
3364
|
var init_src = __esm({
|
|
3389
3365
|
"packages/domain/shared/src/index.ts"() {
|
|
3366
|
+
"use strict";
|
|
3367
|
+
import_node_crypto = require("crypto");
|
|
3368
|
+
import_node_fs = __toESM(require("fs"));
|
|
3369
|
+
import_node_path = __toESM(require("path"));
|
|
3370
|
+
import_node_url = require("url");
|
|
3371
|
+
import_node_module2 = require("module");
|
|
3390
3372
|
init_esmHelpers();
|
|
3391
3373
|
init_native_resolution();
|
|
3374
|
+
import_meta3 = {};
|
|
3392
3375
|
TwError = class _TwError extends Error {
|
|
3393
3376
|
/** @deprecated Gunakan source */
|
|
3394
3377
|
domain;
|
|
@@ -3441,7 +3424,7 @@ var init_src = __esm({
|
|
|
3441
3424
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3442
3425
|
}
|
|
3443
3426
|
};
|
|
3444
|
-
_require2 =
|
|
3427
|
+
_require2 = (0, import_node_module2.createRequire)(import_meta3.url);
|
|
3445
3428
|
}
|
|
3446
3429
|
});
|
|
3447
3430
|
|
|
@@ -3478,8 +3461,8 @@ function getDirname2() {
|
|
|
3478
3461
|
if (typeof __dirname !== "undefined") {
|
|
3479
3462
|
return __dirname;
|
|
3480
3463
|
}
|
|
3481
|
-
if (typeof
|
|
3482
|
-
return
|
|
3464
|
+
if (typeof import_meta4 !== "undefined" && import_meta4.url) {
|
|
3465
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(import_meta4.url));
|
|
3483
3466
|
}
|
|
3484
3467
|
return process.cwd();
|
|
3485
3468
|
}
|
|
@@ -3684,13 +3667,17 @@ function hasNativeWatchBinding() {
|
|
|
3684
3667
|
return false;
|
|
3685
3668
|
}
|
|
3686
3669
|
}
|
|
3687
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3670
|
+
var import_node_path2, import_node_url2, import_meta4, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3688
3671
|
var init_native_bridge = __esm({
|
|
3689
3672
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3673
|
+
"use strict";
|
|
3674
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
3675
|
+
import_node_url2 = require("url");
|
|
3690
3676
|
init_src();
|
|
3677
|
+
import_meta4 = {};
|
|
3691
3678
|
log = createDebugLogger("scanner:native");
|
|
3692
|
-
isValidScannerBinding = (
|
|
3693
|
-
const candidate =
|
|
3679
|
+
isValidScannerBinding = (module2) => {
|
|
3680
|
+
const candidate = module2;
|
|
3694
3681
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
3695
3682
|
};
|
|
3696
3683
|
createScannerBridgeLoader = () => {
|
|
@@ -3767,13 +3754,15 @@ var init_native_bridge = __esm({
|
|
|
3767
3754
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3768
3755
|
}
|
|
3769
3756
|
});
|
|
3757
|
+
|
|
3758
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3770
3759
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3771
|
-
const dir = cacheDir ?
|
|
3772
|
-
return
|
|
3760
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3761
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
3773
3762
|
}
|
|
3774
3763
|
function readCache(rootDir, cacheDir) {
|
|
3775
3764
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3776
|
-
|
|
3765
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3777
3766
|
const result = cacheReadNative(cachePath);
|
|
3778
3767
|
if (!result) return [];
|
|
3779
3768
|
return result.entries.map((e) => ({
|
|
@@ -3788,7 +3777,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3788
3777
|
}
|
|
3789
3778
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3790
3779
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3791
|
-
|
|
3780
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3792
3781
|
const success = cacheWriteNative(cachePath, entries);
|
|
3793
3782
|
if (!success) {
|
|
3794
3783
|
throw new Error(
|
|
@@ -3807,11 +3796,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3807
3796
|
nowMs
|
|
3808
3797
|
);
|
|
3809
3798
|
}
|
|
3799
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
3810
3800
|
var init_cache_native = __esm({
|
|
3811
3801
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3802
|
+
"use strict";
|
|
3803
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
3804
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
3812
3805
|
init_native_bridge();
|
|
3806
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3813
3807
|
}
|
|
3814
3808
|
});
|
|
3809
|
+
|
|
3810
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3815
3811
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3816
3812
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3817
3813
|
if (native !== null) return native;
|
|
@@ -3829,7 +3825,7 @@ function mergeResults(batchResults) {
|
|
|
3829
3825
|
}
|
|
3830
3826
|
function runChunkInWorker(filePaths) {
|
|
3831
3827
|
return new Promise((resolve2, reject) => {
|
|
3832
|
-
const worker = new
|
|
3828
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
3833
3829
|
workerData: { filePaths }
|
|
3834
3830
|
});
|
|
3835
3831
|
worker.once("message", (payload) => {
|
|
@@ -3849,10 +3845,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3849
3845
|
const {
|
|
3850
3846
|
extensions = DEFAULT_EXTENSIONS,
|
|
3851
3847
|
ignoreDirs = DEFAULT_IGNORES,
|
|
3852
|
-
maxWorkers = Math.max(1,
|
|
3848
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
3853
3849
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3854
3850
|
} = options;
|
|
3855
|
-
const files = collectFiles(
|
|
3851
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
3856
3852
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3857
3853
|
return mergeResults(batchExtractClassesNative(files));
|
|
3858
3854
|
}
|
|
@@ -3868,33 +3864,43 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3868
3864
|
}
|
|
3869
3865
|
return mergeResults(allResults);
|
|
3870
3866
|
}
|
|
3871
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3867
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, import_meta5, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3872
3868
|
var init_parallel_scanner = __esm({
|
|
3873
3869
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3870
|
+
"use strict";
|
|
3871
|
+
import_node_worker_threads = require("worker_threads");
|
|
3872
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3873
|
+
import_node_os = require("os");
|
|
3874
|
+
import_node_url3 = require("url");
|
|
3874
3875
|
init_src2();
|
|
3875
3876
|
init_native_bridge();
|
|
3877
|
+
import_meta5 = {};
|
|
3876
3878
|
PARALLEL_THRESHOLD = 50;
|
|
3877
3879
|
DEFAULT_CHUNK_SIZE = 150;
|
|
3878
|
-
if (!
|
|
3879
|
-
const { filePaths } =
|
|
3880
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
3881
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
3880
3882
|
try {
|
|
3881
3883
|
const results = batchExtractClassesNative(filePaths);
|
|
3882
3884
|
const msg = { ok: true, results };
|
|
3883
|
-
|
|
3885
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3884
3886
|
} catch (error) {
|
|
3885
3887
|
const msg = {
|
|
3886
3888
|
ok: false,
|
|
3887
3889
|
error: error instanceof Error ? error.message : String(error)
|
|
3888
3890
|
};
|
|
3889
|
-
|
|
3891
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3890
3892
|
}
|
|
3891
3893
|
}
|
|
3892
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3894
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(import_meta5.url);
|
|
3893
3895
|
}
|
|
3894
3896
|
});
|
|
3895
|
-
|
|
3897
|
+
|
|
3898
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3899
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3896
3900
|
var init_schemas = __esm({
|
|
3897
3901
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3902
|
+
"use strict";
|
|
3903
|
+
import_zod = require("zod");
|
|
3898
3904
|
init_src();
|
|
3899
3905
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3900
3906
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3914,40 +3920,40 @@ var init_schemas = __esm({
|
|
|
3914
3920
|
parsed.error
|
|
3915
3921
|
);
|
|
3916
3922
|
};
|
|
3917
|
-
NonNegativeIntegerSchema =
|
|
3918
|
-
ScanWorkspaceOptionsSchema =
|
|
3919
|
-
includeExtensions:
|
|
3920
|
-
ignoreDirectories:
|
|
3921
|
-
useCache:
|
|
3922
|
-
cacheDir:
|
|
3923
|
-
smartInvalidation:
|
|
3923
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
3924
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
3925
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3926
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3927
|
+
useCache: import_zod.z.boolean().optional(),
|
|
3928
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
3929
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
3924
3930
|
});
|
|
3925
|
-
ScanFileResultSchema =
|
|
3926
|
-
file:
|
|
3927
|
-
classes:
|
|
3928
|
-
hash:
|
|
3931
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
3932
|
+
file: import_zod.z.string(),
|
|
3933
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
3934
|
+
hash: import_zod.z.string().optional()
|
|
3929
3935
|
});
|
|
3930
|
-
ScanWorkspaceResultSchema =
|
|
3931
|
-
files:
|
|
3936
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
3937
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
3932
3938
|
totalFiles: NonNegativeIntegerSchema,
|
|
3933
|
-
uniqueClasses:
|
|
3939
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
3934
3940
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3935
3941
|
message: "scan result totalFiles must match files.length",
|
|
3936
3942
|
path: ["totalFiles"]
|
|
3937
3943
|
});
|
|
3938
|
-
|
|
3939
|
-
rootDir:
|
|
3944
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
3945
|
+
rootDir: import_zod.z.string().min(1),
|
|
3940
3946
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3941
3947
|
});
|
|
3942
|
-
ScannerWorkerSuccessMessageSchema =
|
|
3943
|
-
ok:
|
|
3948
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
3949
|
+
ok: import_zod.z.literal(true),
|
|
3944
3950
|
result: ScanWorkspaceResultSchema
|
|
3945
3951
|
});
|
|
3946
|
-
ScannerWorkerErrorMessageSchema =
|
|
3947
|
-
ok:
|
|
3948
|
-
error:
|
|
3952
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
3953
|
+
ok: import_zod.z.literal(false),
|
|
3954
|
+
error: import_zod.z.string().optional()
|
|
3949
3955
|
});
|
|
3950
|
-
ScannerWorkerMessageSchema =
|
|
3956
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
3951
3957
|
ScannerWorkerSuccessMessageSchema,
|
|
3952
3958
|
ScannerWorkerErrorMessageSchema
|
|
3953
3959
|
]);
|
|
@@ -3977,8 +3983,8 @@ function getRuntimeDir() {
|
|
|
3977
3983
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3978
3984
|
return __dirname;
|
|
3979
3985
|
}
|
|
3980
|
-
if (typeof
|
|
3981
|
-
return
|
|
3986
|
+
if (typeof import_meta6 !== "undefined" && import_meta6.url) {
|
|
3987
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
|
|
3982
3988
|
}
|
|
3983
3989
|
return process.cwd();
|
|
3984
3990
|
}
|
|
@@ -3987,18 +3993,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
3987
3993
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3988
3994
|
return __dirname;
|
|
3989
3995
|
}
|
|
3990
|
-
if (typeof
|
|
3991
|
-
return
|
|
3996
|
+
if (typeof import_meta6 !== "undefined" && import_meta6.url) {
|
|
3997
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
|
|
3992
3998
|
}
|
|
3993
3999
|
return process.cwd();
|
|
3994
4000
|
})();
|
|
3995
4001
|
const candidates = [
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
4002
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
4003
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
4004
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
3999
4005
|
];
|
|
4000
4006
|
for (const candidate of candidates) {
|
|
4001
|
-
if (
|
|
4007
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
4002
4008
|
}
|
|
4003
4009
|
return null;
|
|
4004
4010
|
}
|
|
@@ -4010,7 +4016,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4010
4016
|
}
|
|
4011
4017
|
return new Promise((resolve2, reject) => {
|
|
4012
4018
|
const settleState = { settled: false };
|
|
4013
|
-
const worker = new
|
|
4019
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4014
4020
|
const timeout = setTimeout(() => {
|
|
4015
4021
|
if (!settleState.settled) {
|
|
4016
4022
|
settleState.settled = true;
|
|
@@ -4055,19 +4061,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4055
4061
|
if (!currentDir) continue;
|
|
4056
4062
|
const entries = (() => {
|
|
4057
4063
|
try {
|
|
4058
|
-
return
|
|
4064
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4059
4065
|
} catch {
|
|
4060
4066
|
return [];
|
|
4061
4067
|
}
|
|
4062
4068
|
})();
|
|
4063
4069
|
for (const entry of entries) {
|
|
4064
|
-
const fullPath =
|
|
4070
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
4065
4071
|
if (entry.isDirectory()) {
|
|
4066
4072
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4067
4073
|
continue;
|
|
4068
4074
|
}
|
|
4069
4075
|
if (!entry.isFile()) continue;
|
|
4070
|
-
if (!extensionSet.has(
|
|
4076
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
4071
4077
|
candidates.push(fullPath);
|
|
4072
4078
|
}
|
|
4073
4079
|
}
|
|
@@ -4094,7 +4100,7 @@ function scanSource(source) {
|
|
|
4094
4100
|
);
|
|
4095
4101
|
}
|
|
4096
4102
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4097
|
-
return includeExtensions.includes(
|
|
4103
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
4098
4104
|
}
|
|
4099
4105
|
function scanFile(filePath) {
|
|
4100
4106
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4114,7 +4120,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4114
4120
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4115
4121
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4116
4122
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4117
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4123
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4118
4124
|
const files = [];
|
|
4119
4125
|
const unique = /* @__PURE__ */ new Set();
|
|
4120
4126
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4154,7 +4160,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4154
4160
|
for (const filePath of candidates) {
|
|
4155
4161
|
const stat = (() => {
|
|
4156
4162
|
try {
|
|
4157
|
-
return
|
|
4163
|
+
return import_node_fs3.default.statSync(filePath);
|
|
4158
4164
|
} catch {
|
|
4159
4165
|
return null;
|
|
4160
4166
|
}
|
|
@@ -4180,7 +4186,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4180
4186
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4181
4187
|
const content = (() => {
|
|
4182
4188
|
try {
|
|
4183
|
-
return
|
|
4189
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
4184
4190
|
} catch {
|
|
4185
4191
|
return null;
|
|
4186
4192
|
}
|
|
@@ -4261,9 +4267,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4261
4267
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
4262
4268
|
}
|
|
4263
4269
|
}
|
|
4264
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4270
|
+
var import_node_fs3, import_node_module3, import_node_path5, import_node_url4, import_node_worker_threads2, import_meta6, log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4265
4271
|
var init_src2 = __esm({
|
|
4266
4272
|
"packages/domain/scanner/src/index.ts"() {
|
|
4273
|
+
"use strict";
|
|
4274
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
4275
|
+
import_node_module3 = require("module");
|
|
4276
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4277
|
+
import_node_url4 = require("url");
|
|
4278
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4267
4279
|
init_src();
|
|
4268
4280
|
init_cache_native();
|
|
4269
4281
|
init_native_bridge();
|
|
@@ -4271,6 +4283,7 @@ var init_src2 = __esm({
|
|
|
4271
4283
|
init_schemas();
|
|
4272
4284
|
init_schemas();
|
|
4273
4285
|
init_native_bridge();
|
|
4286
|
+
import_meta6 = {};
|
|
4274
4287
|
log2 = createLogger("scanner");
|
|
4275
4288
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4276
4289
|
createNativeParserLoader = () => {
|
|
@@ -4284,7 +4297,7 @@ var init_src2 = __esm({
|
|
|
4284
4297
|
const loadNativeParserBinding = () => {
|
|
4285
4298
|
if (_state.binding !== void 0) return _state.binding;
|
|
4286
4299
|
const runtimeDir = getRuntimeDir();
|
|
4287
|
-
const req =
|
|
4300
|
+
const req = (0, import_node_module3.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
4288
4301
|
const _platform = process.platform;
|
|
4289
4302
|
const _arch = process.arch;
|
|
4290
4303
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4292,27 +4305,27 @@ var init_src2 = __esm({
|
|
|
4292
4305
|
const candidates = [
|
|
4293
4306
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4294
4307
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4308
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4309
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4310
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4298
4311
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4299
4312
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4313
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4314
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4315
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4303
4316
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4304
|
-
|
|
4305
|
-
|
|
4317
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4318
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4306
4319
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4307
|
-
|
|
4308
|
-
|
|
4320
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4321
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4309
4322
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4323
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4324
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4325
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4326
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4327
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4328
|
+
import_node_path5.default.resolve(
|
|
4316
4329
|
runtimeDir,
|
|
4317
4330
|
"..",
|
|
4318
4331
|
"..",
|
|
@@ -4324,7 +4337,7 @@ var init_src2 = __esm({
|
|
|
4324
4337
|
)
|
|
4325
4338
|
];
|
|
4326
4339
|
for (const fullPath of candidates) {
|
|
4327
|
-
if (!
|
|
4340
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
4328
4341
|
try {
|
|
4329
4342
|
const required = req(fullPath);
|
|
4330
4343
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4356,6 +4369,8 @@ var init_src2 = __esm({
|
|
|
4356
4369
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4357
4370
|
}
|
|
4358
4371
|
});
|
|
4372
|
+
|
|
4373
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4359
4374
|
function formatErrorMessage(error) {
|
|
4360
4375
|
return error instanceof Error ? error.message : String(error);
|
|
4361
4376
|
}
|
|
@@ -4366,7 +4381,7 @@ function isRecord(value) {
|
|
|
4366
4381
|
}
|
|
4367
4382
|
async function pathExists(filePath) {
|
|
4368
4383
|
try {
|
|
4369
|
-
await
|
|
4384
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
4370
4385
|
return true;
|
|
4371
4386
|
} catch {
|
|
4372
4387
|
return false;
|
|
@@ -4380,9 +4395,11 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4380
4395
|
if (!Number.isFinite(value)) return DEFAULT_FREQUENT_THRESHOLD;
|
|
4381
4396
|
return Math.max(1, Math.trunc(value));
|
|
4382
4397
|
}
|
|
4383
|
-
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4398
|
+
var import_node_fs4, DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4384
4399
|
var init_utils = __esm({
|
|
4385
4400
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4401
|
+
"use strict";
|
|
4402
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
4386
4403
|
init_src();
|
|
4387
4404
|
DEFAULT_TOP_LIMIT = 10;
|
|
4388
4405
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4400,7 +4417,7 @@ async function requireNativeBinding() {
|
|
|
4400
4417
|
if (binding?.analyzeClasses) return binding;
|
|
4401
4418
|
const runtimeDir = resolveRuntimeDir(
|
|
4402
4419
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4403
|
-
|
|
4420
|
+
import_meta7.url
|
|
4404
4421
|
);
|
|
4405
4422
|
const candidates = resolveNativeBindingCandidates({
|
|
4406
4423
|
runtimeDir,
|
|
@@ -4430,13 +4447,15 @@ async function requireNativeCssCompiler() {
|
|
|
4430
4447
|
if (typeof binding.compileCss === "function") return binding;
|
|
4431
4448
|
throw new Error(`Native analyzer compileCss binding is missing.`);
|
|
4432
4449
|
}
|
|
4433
|
-
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4450
|
+
var import_meta7, isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4434
4451
|
var init_binding = __esm({
|
|
4435
4452
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4453
|
+
"use strict";
|
|
4436
4454
|
init_src();
|
|
4437
4455
|
init_utils();
|
|
4438
|
-
|
|
4439
|
-
|
|
4456
|
+
import_meta7 = {};
|
|
4457
|
+
isAnalyzerModule = (module2) => {
|
|
4458
|
+
const candidate = module2;
|
|
4440
4459
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
4441
4460
|
};
|
|
4442
4461
|
createAnalyzerBindingLoader = () => {
|
|
@@ -4446,7 +4465,7 @@ var init_binding = __esm({
|
|
|
4446
4465
|
_state.bindingPromise = (async () => {
|
|
4447
4466
|
const runtimeDir = resolveRuntimeDir(
|
|
4448
4467
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4449
|
-
|
|
4468
|
+
import_meta7.url
|
|
4450
4469
|
);
|
|
4451
4470
|
const candidates = resolveNativeBindingCandidates({
|
|
4452
4471
|
runtimeDir,
|
|
@@ -4483,10 +4502,14 @@ var init_binding = __esm({
|
|
|
4483
4502
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4484
4503
|
}
|
|
4485
4504
|
});
|
|
4486
|
-
|
|
4505
|
+
|
|
4506
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4507
|
+
var import_zod2, formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4487
4508
|
var init_schemas2 = __esm({
|
|
4488
4509
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4510
|
+
"use strict";
|
|
4489
4511
|
init_src();
|
|
4512
|
+
import_zod2 = require("zod");
|
|
4490
4513
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4491
4514
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4492
4515
|
).join(".") : "<root>";
|
|
@@ -4510,76 +4533,76 @@ var init_schemas2 = __esm({
|
|
|
4510
4533
|
parsed.error
|
|
4511
4534
|
);
|
|
4512
4535
|
};
|
|
4513
|
-
CountSchema =
|
|
4514
|
-
|
|
4515
|
-
name:
|
|
4536
|
+
CountSchema = import_zod2.z.number().int().min(0);
|
|
4537
|
+
ClassUsageSchema = import_zod2.z.object({
|
|
4538
|
+
name: import_zod2.z.string(),
|
|
4516
4539
|
count: CountSchema,
|
|
4517
|
-
isUnused:
|
|
4518
|
-
isConflict:
|
|
4540
|
+
isUnused: import_zod2.z.boolean().optional(),
|
|
4541
|
+
isConflict: import_zod2.z.boolean().optional()
|
|
4519
4542
|
});
|
|
4520
|
-
|
|
4521
|
-
className:
|
|
4522
|
-
variants:
|
|
4523
|
-
classes:
|
|
4524
|
-
message:
|
|
4543
|
+
ClassConflictSchema = import_zod2.z.object({
|
|
4544
|
+
className: import_zod2.z.string(),
|
|
4545
|
+
variants: import_zod2.z.array(import_zod2.z.string()),
|
|
4546
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
4547
|
+
message: import_zod2.z.string()
|
|
4525
4548
|
});
|
|
4526
|
-
ClassCountSchema =
|
|
4527
|
-
name:
|
|
4549
|
+
ClassCountSchema = import_zod2.z.object({
|
|
4550
|
+
name: import_zod2.z.string(),
|
|
4528
4551
|
count: CountSchema
|
|
4529
4552
|
});
|
|
4530
|
-
NativeReportSchema =
|
|
4531
|
-
root:
|
|
4553
|
+
NativeReportSchema = import_zod2.z.object({
|
|
4554
|
+
root: import_zod2.z.string(),
|
|
4532
4555
|
totalFiles: CountSchema,
|
|
4533
4556
|
uniqueClassCount: CountSchema,
|
|
4534
4557
|
totalClassOccurrences: CountSchema,
|
|
4535
|
-
topClasses:
|
|
4536
|
-
duplicateCandidates:
|
|
4537
|
-
safelist:
|
|
4558
|
+
topClasses: import_zod2.z.array(ClassCountSchema),
|
|
4559
|
+
duplicateCandidates: import_zod2.z.array(ClassCountSchema),
|
|
4560
|
+
safelist: import_zod2.z.array(import_zod2.z.string())
|
|
4538
4561
|
});
|
|
4539
|
-
NativeCssCompileResultSchema =
|
|
4540
|
-
css:
|
|
4541
|
-
resolvedClasses:
|
|
4542
|
-
unknownClasses:
|
|
4562
|
+
NativeCssCompileResultSchema = import_zod2.z.object({
|
|
4563
|
+
css: import_zod2.z.string(),
|
|
4564
|
+
resolvedClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4565
|
+
unknownClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4543
4566
|
sizeBytes: CountSchema
|
|
4544
4567
|
});
|
|
4545
|
-
AnalyzerClassStatsSchema =
|
|
4546
|
-
top:
|
|
4568
|
+
AnalyzerClassStatsSchema = import_zod2.z.object({
|
|
4569
|
+
top: import_zod2.z.number({
|
|
4547
4570
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4548
4571
|
}).finite().optional(),
|
|
4549
|
-
frequentThreshold:
|
|
4572
|
+
frequentThreshold: import_zod2.z.number({
|
|
4550
4573
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4551
4574
|
}).finite().optional()
|
|
4552
4575
|
});
|
|
4553
|
-
AnalyzerSemanticOptionsSchema =
|
|
4554
|
-
tailwindConfigPath:
|
|
4576
|
+
AnalyzerSemanticOptionsSchema = import_zod2.z.object({
|
|
4577
|
+
tailwindConfigPath: import_zod2.z.string({
|
|
4555
4578
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4556
4579
|
}).min(
|
|
4557
4580
|
1,
|
|
4558
4581
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4559
4582
|
).optional()
|
|
4560
4583
|
});
|
|
4561
|
-
AnalyzerOptionsSchema =
|
|
4562
|
-
scanner:
|
|
4584
|
+
AnalyzerOptionsSchema = import_zod2.z.object({
|
|
4585
|
+
scanner: import_zod2.z.custom(
|
|
4563
4586
|
(value) => isPlainObject(value),
|
|
4564
4587
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4565
4588
|
).optional(),
|
|
4566
4589
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4567
|
-
semantic:
|
|
4568
|
-
|
|
4590
|
+
semantic: import_zod2.z.union([
|
|
4591
|
+
import_zod2.z.boolean({
|
|
4569
4592
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4570
4593
|
}),
|
|
4571
4594
|
AnalyzerSemanticOptionsSchema
|
|
4572
4595
|
]).optional(),
|
|
4573
|
-
includeClass:
|
|
4596
|
+
includeClass: import_zod2.z.custom(
|
|
4574
4597
|
(value) => typeof value === "function",
|
|
4575
4598
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4576
4599
|
).optional()
|
|
4577
4600
|
});
|
|
4578
|
-
ClassToCssOptionsSchema =
|
|
4579
|
-
prefix:
|
|
4601
|
+
ClassToCssOptionsSchema = import_zod2.z.object({
|
|
4602
|
+
prefix: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.null()], {
|
|
4580
4603
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4581
4604
|
}).optional(),
|
|
4582
|
-
strict:
|
|
4605
|
+
strict: import_zod2.z.boolean({
|
|
4583
4606
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4584
4607
|
}).optional()
|
|
4585
4608
|
});
|
|
@@ -4593,9 +4616,15 @@ var init_schemas2 = __esm({
|
|
|
4593
4616
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4594
4617
|
}
|
|
4595
4618
|
});
|
|
4596
|
-
|
|
4619
|
+
|
|
4620
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4621
|
+
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
4622
|
var init_semantic = __esm({
|
|
4598
4623
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4624
|
+
"use strict";
|
|
4625
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4626
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4627
|
+
import_node_url5 = require("url");
|
|
4599
4628
|
init_binding();
|
|
4600
4629
|
init_utils();
|
|
4601
4630
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4631,11 +4660,11 @@ var init_semantic = __esm({
|
|
|
4631
4660
|
};
|
|
4632
4661
|
};
|
|
4633
4662
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4634
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4663
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path6.default.extname(configPath).toLowerCase());
|
|
4635
4664
|
};
|
|
4636
4665
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4637
4666
|
if (explicitPath) {
|
|
4638
|
-
const resolved =
|
|
4667
|
+
const resolved = import_node_path6.default.resolve(root, explicitPath);
|
|
4639
4668
|
if (!await pathExists(resolved)) return null;
|
|
4640
4669
|
return resolved;
|
|
4641
4670
|
}
|
|
@@ -4646,7 +4675,7 @@ var init_semantic = __esm({
|
|
|
4646
4675
|
"tailwind.config.mjs"
|
|
4647
4676
|
];
|
|
4648
4677
|
for (const candidate of candidates) {
|
|
4649
|
-
const fullPath =
|
|
4678
|
+
const fullPath = import_node_path6.default.resolve(root, candidate);
|
|
4650
4679
|
if (await pathExists(fullPath)) return fullPath;
|
|
4651
4680
|
}
|
|
4652
4681
|
return null;
|
|
@@ -4700,7 +4729,7 @@ var init_semantic = __esm({
|
|
|
4700
4729
|
return out;
|
|
4701
4730
|
};
|
|
4702
4731
|
collectSafelistFromSource = async (configPath) => {
|
|
4703
|
-
const source = await
|
|
4732
|
+
const source = await import_node_fs5.default.promises.readFile(configPath, "utf8");
|
|
4704
4733
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4705
4734
|
const allTokens = extractClassesNative2(source);
|
|
4706
4735
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4727,7 +4756,7 @@ var init_semantic = __esm({
|
|
|
4727
4756
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4728
4757
|
};
|
|
4729
4758
|
}
|
|
4730
|
-
const configStat = await
|
|
4759
|
+
const configStat = await import_node_fs5.default.promises.stat(configPath).catch(() => null);
|
|
4731
4760
|
if (configStat) {
|
|
4732
4761
|
const cached = tailwindConfigCache.get(configPath);
|
|
4733
4762
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4740,7 +4769,7 @@ var init_semantic = __esm({
|
|
|
4740
4769
|
const result = await (async () => {
|
|
4741
4770
|
try {
|
|
4742
4771
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
4743
|
-
const imported = await import(`${
|
|
4772
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
4744
4773
|
const candidate = imported.default ?? imported;
|
|
4745
4774
|
if (isRecord(candidate)) {
|
|
4746
4775
|
return { config: candidate, warning: void 0 };
|
|
@@ -4851,6 +4880,8 @@ var init_semantic = __esm({
|
|
|
4851
4880
|
};
|
|
4852
4881
|
}
|
|
4853
4882
|
});
|
|
4883
|
+
|
|
4884
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4854
4885
|
function normalizeScan(scan, includeClass) {
|
|
4855
4886
|
if (!includeClass) return scan;
|
|
4856
4887
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4905,7 +4936,7 @@ async function buildDistribution(usages, native) {
|
|
|
4905
4936
|
}
|
|
4906
4937
|
async function analyzeWorkspace(root, options = {}) {
|
|
4907
4938
|
const startedAtMs = Date.now();
|
|
4908
|
-
const resolvedRoot =
|
|
4939
|
+
const resolvedRoot = import_node_path7.default.resolve(root);
|
|
4909
4940
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4910
4941
|
const scan = await (async () => {
|
|
4911
4942
|
const scanStartedAtMs = Date.now();
|
|
@@ -5007,8 +5038,11 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
5007
5038
|
...semanticReport ? { semantic: semanticReport } : {}
|
|
5008
5039
|
};
|
|
5009
5040
|
}
|
|
5041
|
+
var import_node_path7;
|
|
5010
5042
|
var init_analyzeWorkspace = __esm({
|
|
5011
5043
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5044
|
+
"use strict";
|
|
5045
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
5012
5046
|
init_src2();
|
|
5013
5047
|
init_binding();
|
|
5014
5048
|
init_schemas2();
|
|
@@ -5021,6 +5055,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
5021
5055
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
5022
5056
|
var init_classToCss = __esm({
|
|
5023
5057
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5058
|
+
"use strict";
|
|
5024
5059
|
init_binding();
|
|
5025
5060
|
init_schemas2();
|
|
5026
5061
|
init_utils();
|
|
@@ -5141,6 +5176,7 @@ __export(src_exports2, {
|
|
|
5141
5176
|
var __internal;
|
|
5142
5177
|
var init_src3 = __esm({
|
|
5143
5178
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5179
|
+
"use strict";
|
|
5144
5180
|
init_analyzeWorkspace();
|
|
5145
5181
|
init_classToCss();
|
|
5146
5182
|
init_schemas2();
|
|
@@ -5159,9 +5195,11 @@ var init_src3 = __esm({
|
|
|
5159
5195
|
};
|
|
5160
5196
|
}
|
|
5161
5197
|
});
|
|
5198
|
+
|
|
5199
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5162
5200
|
async function pathExists2(filePath) {
|
|
5163
5201
|
try {
|
|
5164
|
-
await
|
|
5202
|
+
await import_promises.default.access(filePath);
|
|
5165
5203
|
return true;
|
|
5166
5204
|
} catch {
|
|
5167
5205
|
return false;
|
|
@@ -5169,7 +5207,7 @@ async function pathExists2(filePath) {
|
|
|
5169
5207
|
}
|
|
5170
5208
|
async function readFileSafe(filePath) {
|
|
5171
5209
|
try {
|
|
5172
|
-
return await
|
|
5210
|
+
return await import_promises.default.readFile(filePath, "utf8");
|
|
5173
5211
|
} catch {
|
|
5174
5212
|
return null;
|
|
5175
5213
|
}
|
|
@@ -5188,22 +5226,27 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5188
5226
|
options.onDryRun?.(`write ${filePath}`);
|
|
5189
5227
|
return;
|
|
5190
5228
|
}
|
|
5191
|
-
await
|
|
5192
|
-
await
|
|
5229
|
+
await import_promises.default.mkdir(import_node_path8.default.dirname(filePath), { recursive: true });
|
|
5230
|
+
await import_promises.default.writeFile(filePath, content, "utf8");
|
|
5193
5231
|
}
|
|
5194
5232
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
5195
5233
|
if (await pathExists2(filePath)) return "skipped";
|
|
5196
5234
|
await writeFileSafe(filePath, content, options);
|
|
5197
5235
|
return "created";
|
|
5198
5236
|
}
|
|
5237
|
+
var import_promises, import_node_path8;
|
|
5199
5238
|
var init_fs = __esm({
|
|
5200
5239
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5240
|
+
"use strict";
|
|
5241
|
+
import_promises = __toESM(require("fs/promises"), 1);
|
|
5242
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
5201
5243
|
}
|
|
5202
5244
|
});
|
|
5203
5245
|
|
|
5204
5246
|
// node_modules/picocolors/picocolors.js
|
|
5205
5247
|
var require_picocolors = __commonJS({
|
|
5206
|
-
"node_modules/picocolors/picocolors.js"(
|
|
5248
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
5249
|
+
"use strict";
|
|
5207
5250
|
var p = process || {};
|
|
5208
5251
|
var argv = p.argv || [];
|
|
5209
5252
|
var env = p.env || {};
|
|
@@ -5268,8 +5311,8 @@ var require_picocolors = __commonJS({
|
|
|
5268
5311
|
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
5269
5312
|
};
|
|
5270
5313
|
};
|
|
5271
|
-
|
|
5272
|
-
|
|
5314
|
+
module2.exports = createColors();
|
|
5315
|
+
module2.exports.createColors = createColors;
|
|
5273
5316
|
}
|
|
5274
5317
|
});
|
|
5275
5318
|
|
|
@@ -5290,8 +5333,11 @@ function writeJsonSuccess(command, data) {
|
|
|
5290
5333
|
}
|
|
5291
5334
|
var init_json = __esm({
|
|
5292
5335
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5336
|
+
"use strict";
|
|
5293
5337
|
}
|
|
5294
5338
|
});
|
|
5339
|
+
|
|
5340
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5295
5341
|
function writeLine(stream, message = "") {
|
|
5296
5342
|
stream.write(`${message}
|
|
5297
5343
|
`);
|
|
@@ -5321,7 +5367,7 @@ function createCliOutput(options = {}) {
|
|
|
5321
5367
|
const json = Boolean(options.json);
|
|
5322
5368
|
const debug = Boolean(options.debug);
|
|
5323
5369
|
const verboseEnabled = Boolean(options.verbose);
|
|
5324
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5370
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && (0, import_prompts.isTTY)(stdout);
|
|
5325
5371
|
function writeText(message = "", writeOptions = {}) {
|
|
5326
5372
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5327
5373
|
}
|
|
@@ -5355,7 +5401,7 @@ function createCliOutput(options = {}) {
|
|
|
5355
5401
|
},
|
|
5356
5402
|
note(message, title) {
|
|
5357
5403
|
if (interactive) {
|
|
5358
|
-
|
|
5404
|
+
(0, import_prompts.note)(message, title);
|
|
5359
5405
|
return;
|
|
5360
5406
|
}
|
|
5361
5407
|
if (title) {
|
|
@@ -5366,17 +5412,17 @@ ${message}`);
|
|
|
5366
5412
|
writeText(message);
|
|
5367
5413
|
},
|
|
5368
5414
|
intro(message) {
|
|
5369
|
-
showClackMessage(
|
|
5415
|
+
showClackMessage(import_prompts.intro, message);
|
|
5370
5416
|
},
|
|
5371
5417
|
outro(message) {
|
|
5372
|
-
showClackMessage(
|
|
5418
|
+
showClackMessage(import_prompts.outro, message);
|
|
5373
5419
|
},
|
|
5374
5420
|
table(rows) {
|
|
5375
5421
|
writeText(JSON.stringify(rows, null, 2));
|
|
5376
5422
|
},
|
|
5377
5423
|
spinner() {
|
|
5378
5424
|
if (!interactive) return createNoopSpinner();
|
|
5379
|
-
const instance =
|
|
5425
|
+
const instance = (0, import_prompts.spinner)({ output: stdout });
|
|
5380
5426
|
return {
|
|
5381
5427
|
start(message) {
|
|
5382
5428
|
instance.start(message);
|
|
@@ -5426,14 +5472,18 @@ ${import_picocolors.default.dim(message)}
|
|
|
5426
5472
|
}
|
|
5427
5473
|
};
|
|
5428
5474
|
}
|
|
5429
|
-
var import_picocolors;
|
|
5475
|
+
var import_prompts, import_picocolors;
|
|
5430
5476
|
var init_output = __esm({
|
|
5431
5477
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5432
|
-
|
|
5478
|
+
"use strict";
|
|
5479
|
+
import_prompts = require("@clack/prompts");
|
|
5480
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5433
5481
|
init_errors();
|
|
5434
5482
|
init_json();
|
|
5435
5483
|
}
|
|
5436
5484
|
});
|
|
5485
|
+
|
|
5486
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5437
5487
|
function hasFlag(name, argv) {
|
|
5438
5488
|
return argv.includes(`--${name}`);
|
|
5439
5489
|
}
|
|
@@ -5444,7 +5494,7 @@ function firstPositional(argv) {
|
|
|
5444
5494
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5445
5495
|
}
|
|
5446
5496
|
function parseCliInput(argv) {
|
|
5447
|
-
const parsed =
|
|
5497
|
+
const parsed = (0, import_node_util3.parseArgs)({
|
|
5448
5498
|
args: argv,
|
|
5449
5499
|
allowPositionals: true,
|
|
5450
5500
|
strict: false,
|
|
@@ -5471,17 +5521,22 @@ function parseCliInput(argv) {
|
|
|
5471
5521
|
helpCommand
|
|
5472
5522
|
};
|
|
5473
5523
|
}
|
|
5524
|
+
var import_node_util3;
|
|
5474
5525
|
var init_args = __esm({
|
|
5475
5526
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5527
|
+
"use strict";
|
|
5528
|
+
import_node_util3 = require("util");
|
|
5476
5529
|
}
|
|
5477
5530
|
});
|
|
5531
|
+
|
|
5532
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5478
5533
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5479
|
-
const filename =
|
|
5480
|
-
return
|
|
5534
|
+
const filename = (0, import_node_url6.fileURLToPath)(importMetaUrl);
|
|
5535
|
+
return import_node_path17.default.dirname(filename);
|
|
5481
5536
|
}
|
|
5482
5537
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5483
|
-
const fromRuntime =
|
|
5484
|
-
const fromCwd =
|
|
5538
|
+
const fromRuntime = import_node_path17.default.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5539
|
+
const fromCwd = import_node_path17.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
5485
5540
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5486
5541
|
}
|
|
5487
5542
|
async function firstExistingPath(paths) {
|
|
@@ -5490,8 +5545,12 @@ async function firstExistingPath(paths) {
|
|
|
5490
5545
|
}
|
|
5491
5546
|
return null;
|
|
5492
5547
|
}
|
|
5548
|
+
var import_node_path17, import_node_url6;
|
|
5493
5549
|
var init_paths = __esm({
|
|
5494
5550
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5551
|
+
"use strict";
|
|
5552
|
+
import_node_path17 = __toESM(require("path"), 1);
|
|
5553
|
+
import_node_url6 = require("url");
|
|
5495
5554
|
init_errors();
|
|
5496
5555
|
init_fs();
|
|
5497
5556
|
}
|
|
@@ -5576,6 +5635,7 @@ async function runCliMain(options) {
|
|
|
5576
5635
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5577
5636
|
var init_runtime = __esm({
|
|
5578
5637
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5638
|
+
"use strict";
|
|
5579
5639
|
init_args();
|
|
5580
5640
|
init_errors();
|
|
5581
5641
|
init_output();
|
|
@@ -5641,15 +5701,15 @@ function isInteractiveSession() {
|
|
|
5641
5701
|
}
|
|
5642
5702
|
async function resolveCreateInput(options) {
|
|
5643
5703
|
const interactive = isInteractiveSession();
|
|
5644
|
-
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await
|
|
5704
|
+
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await (0, import_prompts4.text)({
|
|
5645
5705
|
message: "Project name",
|
|
5646
5706
|
defaultValue: "my-app",
|
|
5647
5707
|
placeholder: "my-app"
|
|
5648
5708
|
});
|
|
5649
|
-
if (
|
|
5709
|
+
if ((0, import_prompts4.isCancel)(resolvedName)) {
|
|
5650
5710
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5651
5711
|
}
|
|
5652
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5712
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await (0, import_prompts4.select)({
|
|
5653
5713
|
message: "Template",
|
|
5654
5714
|
initialValue: "next-app",
|
|
5655
5715
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5657,7 +5717,7 @@ async function resolveCreateInput(options) {
|
|
|
5657
5717
|
label: template
|
|
5658
5718
|
}))
|
|
5659
5719
|
});
|
|
5660
|
-
if (
|
|
5720
|
+
if ((0, import_prompts4.isCancel)(pickedTemplate)) {
|
|
5661
5721
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5662
5722
|
}
|
|
5663
5723
|
const templateValue = pickedTemplate;
|
|
@@ -5669,7 +5729,7 @@ async function resolveCreateInput(options) {
|
|
|
5669
5729
|
return { name: resolvedName, template: templateValue };
|
|
5670
5730
|
}
|
|
5671
5731
|
async function writeProjectFile(context, relativePath, content) {
|
|
5672
|
-
const filePath =
|
|
5732
|
+
const filePath = import_node_path19.default.join(context.projectDir, relativePath);
|
|
5673
5733
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5674
5734
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5675
5735
|
}
|
|
@@ -5985,7 +6045,7 @@ async function createSimpleApp(context) {
|
|
|
5985
6045
|
}
|
|
5986
6046
|
async function createProject(options, output) {
|
|
5987
6047
|
const { name, template } = await resolveCreateInput(options);
|
|
5988
|
-
const projectDir =
|
|
6048
|
+
const projectDir = import_node_path19.default.resolve(process.cwd(), name);
|
|
5989
6049
|
if (await pathExists2(projectDir)) {
|
|
5990
6050
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5991
6051
|
}
|
|
@@ -6034,18 +6094,22 @@ function buildCreateProgram(context) {
|
|
|
6034
6094
|
async function main(rawArgs = process.argv.slice(2)) {
|
|
6035
6095
|
await runCliMain({
|
|
6036
6096
|
argv: [process.execPath, "create-tailwind-styled", ...rawArgs],
|
|
6037
|
-
importMetaUrl:
|
|
6097
|
+
importMetaUrl: import_meta8.url,
|
|
6038
6098
|
commandHint: "create",
|
|
6039
6099
|
buildProgram: buildCreateProgram
|
|
6040
6100
|
});
|
|
6041
6101
|
}
|
|
6042
|
-
var TEMPLATE_NAMES, TEMPLATES;
|
|
6102
|
+
var import_node_path19, import_prompts4, import_meta8, TEMPLATE_NAMES, TEMPLATES;
|
|
6043
6103
|
var init_createApp = __esm({
|
|
6044
6104
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6105
|
+
"use strict";
|
|
6106
|
+
import_node_path19 = __toESM(require("path"), 1);
|
|
6107
|
+
import_prompts4 = require("@clack/prompts");
|
|
6045
6108
|
init_esm();
|
|
6046
6109
|
init_errors();
|
|
6047
6110
|
init_fs();
|
|
6048
6111
|
init_runtime();
|
|
6112
|
+
import_meta8 = {};
|
|
6049
6113
|
TEMPLATE_NAMES = ["next-app", "vite-react", "vite-vue", "vite-svelte", "simple"];
|
|
6050
6114
|
TEMPLATES = {
|
|
6051
6115
|
"next-app": createNextApp,
|
|
@@ -6058,11 +6122,13 @@ var init_createApp = __esm({
|
|
|
6058
6122
|
});
|
|
6059
6123
|
|
|
6060
6124
|
// packages/domain/compiler/src/nativeBridge.ts
|
|
6061
|
-
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6125
|
+
var import_meta9, _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6062
6126
|
var init_nativeBridge = __esm({
|
|
6063
6127
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6128
|
+
"use strict";
|
|
6064
6129
|
init_src();
|
|
6065
|
-
|
|
6130
|
+
import_meta9 = {};
|
|
6131
|
+
_loadNative = (path30) => require(path30);
|
|
6066
6132
|
log3 = (...args) => {
|
|
6067
6133
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6068
6134
|
console.log("[compiler:native]", ...args);
|
|
@@ -6088,7 +6154,7 @@ var init_nativeBridge = __esm({
|
|
|
6088
6154
|
}
|
|
6089
6155
|
bridgeLoadAttempted = true;
|
|
6090
6156
|
try {
|
|
6091
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
6157
|
+
const runtimeDir = resolveRuntimeDir(void 0, import_meta9.url);
|
|
6092
6158
|
const result = resolveNativeBinary(runtimeDir);
|
|
6093
6159
|
if (result.path && result.path.endsWith(".node")) {
|
|
6094
6160
|
try {
|
|
@@ -6159,41 +6225,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6159
6225
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6160
6226
|
var init_compiler = __esm({
|
|
6161
6227
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6228
|
+
"use strict";
|
|
6162
6229
|
}
|
|
6163
6230
|
});
|
|
6164
6231
|
|
|
6165
6232
|
// packages/domain/compiler/src/parser/index.ts
|
|
6166
6233
|
var init_parser = __esm({
|
|
6167
6234
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6235
|
+
"use strict";
|
|
6168
6236
|
}
|
|
6169
6237
|
});
|
|
6170
6238
|
|
|
6171
6239
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6172
6240
|
var init_analyzer = __esm({
|
|
6173
6241
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6242
|
+
"use strict";
|
|
6174
6243
|
}
|
|
6175
6244
|
});
|
|
6176
6245
|
|
|
6177
6246
|
// packages/domain/compiler/src/cache/index.ts
|
|
6178
6247
|
var init_cache = __esm({
|
|
6179
6248
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6249
|
+
"use strict";
|
|
6180
6250
|
}
|
|
6181
6251
|
});
|
|
6182
6252
|
|
|
6183
6253
|
// packages/domain/compiler/src/redis/index.ts
|
|
6184
6254
|
var init_redis = __esm({
|
|
6185
6255
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6256
|
+
"use strict";
|
|
6186
6257
|
}
|
|
6187
6258
|
});
|
|
6188
6259
|
|
|
6189
6260
|
// packages/domain/compiler/src/watch/index.ts
|
|
6190
6261
|
var init_watch = __esm({
|
|
6191
6262
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6263
|
+
"use strict";
|
|
6192
6264
|
}
|
|
6193
6265
|
});
|
|
6194
|
-
|
|
6266
|
+
|
|
6267
|
+
// packages/domain/compiler/src/index.ts
|
|
6268
|
+
var import_node_fs9, import_node_path24, import_node_module4, import_meta10, _require3, compileCssFromClasses;
|
|
6195
6269
|
var init_src4 = __esm({
|
|
6196
6270
|
"packages/domain/compiler/src/index.ts"() {
|
|
6271
|
+
"use strict";
|
|
6272
|
+
import_node_fs9 = __toESM(require("fs"), 1);
|
|
6273
|
+
import_node_path24 = __toESM(require("path"), 1);
|
|
6274
|
+
import_node_module4 = require("module");
|
|
6197
6275
|
init_nativeBridge();
|
|
6198
6276
|
init_compiler();
|
|
6199
6277
|
init_parser();
|
|
@@ -6201,7 +6279,8 @@ var init_src4 = __esm({
|
|
|
6201
6279
|
init_cache();
|
|
6202
6280
|
init_redis();
|
|
6203
6281
|
init_watch();
|
|
6204
|
-
|
|
6282
|
+
import_meta10 = {};
|
|
6283
|
+
_require3 = (0, import_node_module4.createRequire)(import_meta10.url);
|
|
6205
6284
|
compileCssFromClasses = (classes, prefix) => {
|
|
6206
6285
|
const native = getNativeBridge();
|
|
6207
6286
|
if (!native?.transformSource) {
|
|
@@ -6219,6 +6298,7 @@ var init_src4 = __esm({
|
|
|
6219
6298
|
// packages/domain/compiler/src/internal.ts
|
|
6220
6299
|
var init_internal = __esm({
|
|
6221
6300
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6301
|
+
"use strict";
|
|
6222
6302
|
init_src4();
|
|
6223
6303
|
init_compiler();
|
|
6224
6304
|
init_parser();
|
|
@@ -6229,9 +6309,26 @@ var init_internal = __esm({
|
|
|
6229
6309
|
}
|
|
6230
6310
|
});
|
|
6231
6311
|
|
|
6312
|
+
// src/umbrella/cli.ts
|
|
6313
|
+
var cli_exports = {};
|
|
6314
|
+
__export(cli_exports, {
|
|
6315
|
+
createCliOutput: () => createCliOutput,
|
|
6316
|
+
ensureFlag: () => ensureFlag,
|
|
6317
|
+
parseCliArgs: () => parseCliInput,
|
|
6318
|
+
runScanCli: () => runScanCli
|
|
6319
|
+
});
|
|
6320
|
+
module.exports = __toCommonJS(cli_exports);
|
|
6321
|
+
|
|
6322
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6323
|
+
var import_node_url8 = require("url");
|
|
6324
|
+
|
|
6232
6325
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6233
6326
|
init_esm();
|
|
6234
6327
|
|
|
6328
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6329
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
6330
|
+
var import_node_util = require("util");
|
|
6331
|
+
|
|
6235
6332
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6236
6333
|
init_errors();
|
|
6237
6334
|
async function loadAnalyzerModule() {
|
|
@@ -6288,7 +6385,7 @@ function printAnalysisReport(report, output) {
|
|
|
6288
6385
|
output.writeText("");
|
|
6289
6386
|
}
|
|
6290
6387
|
async function runAnalyzeCli(args) {
|
|
6291
|
-
const parsed =
|
|
6388
|
+
const parsed = (0, import_node_util.parseArgs)({
|
|
6292
6389
|
args,
|
|
6293
6390
|
allowPositionals: true,
|
|
6294
6391
|
strict: false,
|
|
@@ -6303,7 +6400,7 @@ async function runAnalyzeCli(args) {
|
|
|
6303
6400
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6304
6401
|
});
|
|
6305
6402
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6306
|
-
const dir =
|
|
6403
|
+
const dir = import_node_path9.default.resolve(process.cwd(), dirArg);
|
|
6307
6404
|
if (!await pathExists2(dir)) {
|
|
6308
6405
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6309
6406
|
}
|
|
@@ -6320,6 +6417,10 @@ async function runAnalyzeCli(args) {
|
|
|
6320
6417
|
}
|
|
6321
6418
|
printAnalysisReport(report, output);
|
|
6322
6419
|
}
|
|
6420
|
+
|
|
6421
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6422
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
6423
|
+
var import_node_util2 = require("util");
|
|
6323
6424
|
init_errors();
|
|
6324
6425
|
init_fs();
|
|
6325
6426
|
init_output();
|
|
@@ -6340,7 +6441,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6340
6441
|
return "div";
|
|
6341
6442
|
}
|
|
6342
6443
|
async function runExtractCli(args) {
|
|
6343
|
-
const parsed =
|
|
6444
|
+
const parsed = (0, import_node_util2.parseArgs)({
|
|
6344
6445
|
args,
|
|
6345
6446
|
allowPositionals: true,
|
|
6346
6447
|
strict: false,
|
|
@@ -6359,7 +6460,7 @@ async function runExtractCli(args) {
|
|
|
6359
6460
|
const parsedMin = parseInt(minRaw, 10);
|
|
6360
6461
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6361
6462
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6362
|
-
const dir =
|
|
6463
|
+
const dir = import_node_path10.default.resolve(process.cwd(), dirArg);
|
|
6363
6464
|
if (!await pathExists2(dir)) {
|
|
6364
6465
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6365
6466
|
}
|
|
@@ -6414,6 +6515,7 @@ async function runExtractCli(args) {
|
|
|
6414
6515
|
}
|
|
6415
6516
|
|
|
6416
6517
|
// packages/infrastructure/cli/src/init.ts
|
|
6518
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
6417
6519
|
init_fs();
|
|
6418
6520
|
init_output();
|
|
6419
6521
|
async function ensureFile(filePath, content, report) {
|
|
@@ -6432,15 +6534,15 @@ async function runInitCli(rawArgs) {
|
|
|
6432
6534
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6433
6535
|
});
|
|
6434
6536
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6435
|
-
const root =
|
|
6537
|
+
const root = import_node_path11.default.resolve(process.cwd(), target);
|
|
6436
6538
|
const report = { created: [], skipped: [] };
|
|
6437
6539
|
await ensureFile(
|
|
6438
|
-
|
|
6540
|
+
import_node_path11.default.join(root, "src", "tailwind.css"),
|
|
6439
6541
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6440
6542
|
report
|
|
6441
6543
|
);
|
|
6442
6544
|
await ensureFile(
|
|
6443
|
-
|
|
6545
|
+
import_node_path11.default.join(root, "tailwind-styled.config.json"),
|
|
6444
6546
|
`${JSON.stringify(
|
|
6445
6547
|
{
|
|
6446
6548
|
version: 1,
|
|
@@ -6460,17 +6562,22 @@ async function runInitCli(rawArgs) {
|
|
|
6460
6562
|
output.writeText("\nInit complete");
|
|
6461
6563
|
output.writeText(`Created: ${report.created.length}`);
|
|
6462
6564
|
for (const filePath of report.created) {
|
|
6463
|
-
output.writeText(` + ${
|
|
6565
|
+
output.writeText(` + ${import_node_path11.default.relative(root, filePath)}`);
|
|
6464
6566
|
}
|
|
6465
6567
|
if (report.skipped.length > 0) {
|
|
6466
6568
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6467
6569
|
for (const filePath of report.skipped) {
|
|
6468
|
-
output.writeText(` - ${
|
|
6570
|
+
output.writeText(` - ${import_node_path11.default.relative(root, filePath)} (exists)`);
|
|
6469
6571
|
}
|
|
6470
6572
|
}
|
|
6471
6573
|
}
|
|
6472
6574
|
|
|
6575
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6576
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
6577
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
6578
|
+
|
|
6473
6579
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6580
|
+
var import_prompts2 = require("@clack/prompts");
|
|
6474
6581
|
init_errors();
|
|
6475
6582
|
async function runMigrationWizard() {
|
|
6476
6583
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -6481,24 +6588,24 @@ async function runMigrationWizard() {
|
|
|
6481
6588
|
includeImports: true
|
|
6482
6589
|
};
|
|
6483
6590
|
}
|
|
6484
|
-
|
|
6485
|
-
const dryRun = await
|
|
6591
|
+
(0, import_prompts2.intro)("Tailwind Styled v4 Migration Wizard");
|
|
6592
|
+
const dryRun = await (0, import_prompts2.confirm)({
|
|
6486
6593
|
message: "Gunakan dry-run?",
|
|
6487
6594
|
initialValue: true
|
|
6488
6595
|
});
|
|
6489
|
-
const includeConfig = await
|
|
6596
|
+
const includeConfig = await (0, import_prompts2.confirm)({
|
|
6490
6597
|
message: "Migrasi file config dasar?",
|
|
6491
6598
|
initialValue: true
|
|
6492
6599
|
});
|
|
6493
|
-
const includeClasses = await
|
|
6600
|
+
const includeClasses = await (0, import_prompts2.confirm)({
|
|
6494
6601
|
message: "Migrasi class lama (flex-grow/shrink)?",
|
|
6495
6602
|
initialValue: true
|
|
6496
6603
|
});
|
|
6497
|
-
const includeImports = await
|
|
6604
|
+
const includeImports = await (0, import_prompts2.confirm)({
|
|
6498
6605
|
message: "Migrasi import tailwind-styled-components -> tailwind-styled-v4?",
|
|
6499
6606
|
initialValue: true
|
|
6500
6607
|
});
|
|
6501
|
-
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) =>
|
|
6608
|
+
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) => (0, import_prompts2.isCancel)(value))) {
|
|
6502
6609
|
throw new CliUsageError("Migration wizard dibatalkan oleh pengguna");
|
|
6503
6610
|
}
|
|
6504
6611
|
return {
|
|
@@ -6526,15 +6633,15 @@ async function findSourceFiles(dir) {
|
|
|
6526
6633
|
const out = [];
|
|
6527
6634
|
async function walk(currentDir) {
|
|
6528
6635
|
if (!await pathExists2(currentDir)) return;
|
|
6529
|
-
const entries = await
|
|
6636
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
6530
6637
|
for (const entry of entries) {
|
|
6531
|
-
const fullPath =
|
|
6638
|
+
const fullPath = import_node_path12.default.join(currentDir, entry.name);
|
|
6532
6639
|
if (entry.isDirectory()) {
|
|
6533
6640
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6534
6641
|
await walk(fullPath);
|
|
6535
6642
|
continue;
|
|
6536
6643
|
}
|
|
6537
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6644
|
+
if (SOURCE_EXTENSIONS.has(import_node_path12.default.extname(entry.name))) {
|
|
6538
6645
|
out.push(fullPath);
|
|
6539
6646
|
}
|
|
6540
6647
|
}
|
|
@@ -6555,7 +6662,7 @@ function migrateSource(source, options) {
|
|
|
6555
6662
|
return { output, classRenames: 0, importRenames };
|
|
6556
6663
|
}
|
|
6557
6664
|
async function migrateConfig(root, dryRun) {
|
|
6558
|
-
const cssPath =
|
|
6665
|
+
const cssPath = import_node_path12.default.join(root, "src", "tailwind.css");
|
|
6559
6666
|
if (await pathExists2(cssPath)) return 0;
|
|
6560
6667
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6561
6668
|
return 1;
|
|
@@ -6568,7 +6675,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6568
6675
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6569
6676
|
});
|
|
6570
6677
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6571
|
-
const root =
|
|
6678
|
+
const root = import_node_path12.default.resolve(process.cwd(), target);
|
|
6572
6679
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6573
6680
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6574
6681
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6592,12 +6699,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6592
6699
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6593
6700
|
}
|
|
6594
6701
|
for (const filePath of files) {
|
|
6595
|
-
const source = await
|
|
6702
|
+
const source = await import_promises2.default.readFile(filePath, "utf8");
|
|
6596
6703
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6597
6704
|
if (migrated.output !== source) {
|
|
6598
6705
|
report.updatedFiles++;
|
|
6599
6706
|
if (!dryRun) {
|
|
6600
|
-
await
|
|
6707
|
+
await import_promises2.default.writeFile(filePath, migrated.output, "utf8");
|
|
6601
6708
|
}
|
|
6602
6709
|
}
|
|
6603
6710
|
report.classRenames += migrated.classRenames;
|
|
@@ -6617,6 +6724,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6617
6724
|
}
|
|
6618
6725
|
|
|
6619
6726
|
// packages/infrastructure/cli/src/scan.ts
|
|
6727
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
6728
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6620
6729
|
init_src2();
|
|
6621
6730
|
init_output();
|
|
6622
6731
|
function buildTopClasses(files) {
|
|
@@ -6661,10 +6770,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6661
6770
|
});
|
|
6662
6771
|
}
|
|
6663
6772
|
function writeScanCache(root, cacheData) {
|
|
6664
|
-
const cacheDir =
|
|
6665
|
-
const cachePath =
|
|
6666
|
-
|
|
6667
|
-
|
|
6773
|
+
const cacheDir = import_node_path13.default.join(root, ".tailwind-styled");
|
|
6774
|
+
const cachePath = import_node_path13.default.join(cacheDir, "scan-cache.json");
|
|
6775
|
+
import_node_fs6.default.mkdirSync(cacheDir, { recursive: true });
|
|
6776
|
+
import_node_fs6.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6668
6777
|
return cachePath;
|
|
6669
6778
|
}
|
|
6670
6779
|
async function runScanCli(rawArgs) {
|
|
@@ -6676,7 +6785,7 @@ async function runScanCli(rawArgs) {
|
|
|
6676
6785
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6677
6786
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6678
6787
|
});
|
|
6679
|
-
const root =
|
|
6788
|
+
const root = import_node_path13.default.resolve(process.cwd(), target);
|
|
6680
6789
|
const spinner = output.spinner();
|
|
6681
6790
|
spinner.start(`Scanning ${root}`);
|
|
6682
6791
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6726,7 +6835,8 @@ Scan root : ${result.root}`);
|
|
|
6726
6835
|
}
|
|
6727
6836
|
|
|
6728
6837
|
// packages/infrastructure/cli/src/setup.ts
|
|
6729
|
-
var
|
|
6838
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
6839
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6730
6840
|
|
|
6731
6841
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6732
6842
|
function patchNextConfigImpl(src) {
|
|
@@ -6825,7 +6935,7 @@ ${close}`
|
|
|
6825
6935
|
}
|
|
6826
6936
|
function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
6827
6937
|
try {
|
|
6828
|
-
const nodePath =
|
|
6938
|
+
const nodePath = require("path");
|
|
6829
6939
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6830
6940
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6831
6941
|
const safelistAbs = nodePath.resolve(cwd2, ".next", "tw-classes");
|
|
@@ -6840,7 +6950,7 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
|
6840
6950
|
}
|
|
6841
6951
|
function computeStateStaticImportPath(cssFilePath, cwd2) {
|
|
6842
6952
|
try {
|
|
6843
|
-
const nodePath =
|
|
6953
|
+
const nodePath = require("path");
|
|
6844
6954
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6845
6955
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6846
6956
|
const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
|
|
@@ -6921,6 +7031,7 @@ function patchTsConfigImpl(src) {
|
|
|
6921
7031
|
}
|
|
6922
7032
|
|
|
6923
7033
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
7034
|
+
var import_prompts3 = require("@clack/prompts");
|
|
6924
7035
|
init_errors();
|
|
6925
7036
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6926
7037
|
const log5 = options.log ?? console.log;
|
|
@@ -6951,7 +7062,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6951
7062
|
});
|
|
6952
7063
|
log5("");
|
|
6953
7064
|
const defaultIdx = detected ? projectOptions.findIndex((option) => option.value === detected) : 0;
|
|
6954
|
-
const selected = await
|
|
7065
|
+
const selected = await (0, import_prompts3.select)({
|
|
6955
7066
|
message: "Project type",
|
|
6956
7067
|
initialValue: projectOptions[defaultIdx].value,
|
|
6957
7068
|
options: projectOptions.map((option) => ({
|
|
@@ -6960,7 +7071,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6960
7071
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6961
7072
|
}))
|
|
6962
7073
|
});
|
|
6963
|
-
if (
|
|
7074
|
+
if ((0, import_prompts3.isCancel)(selected)) {
|
|
6964
7075
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6965
7076
|
}
|
|
6966
7077
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6971,9 +7082,11 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6971
7082
|
}
|
|
6972
7083
|
|
|
6973
7084
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
7085
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
6974
7086
|
init_fs();
|
|
6975
7087
|
|
|
6976
7088
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
7089
|
+
var import_node_child_process = require("child_process");
|
|
6977
7090
|
init_errors();
|
|
6978
7091
|
init_json();
|
|
6979
7092
|
var npmCommandName = () => {
|
|
@@ -7006,7 +7119,7 @@ var runCommand = async (binary, args, options = {}) => {
|
|
|
7006
7119
|
if (isVerboseEnabled(options)) {
|
|
7007
7120
|
writeVerboseLine(binary, args);
|
|
7008
7121
|
}
|
|
7009
|
-
const child =
|
|
7122
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7010
7123
|
stdio: options.stdio ?? "inherit",
|
|
7011
7124
|
cwd: options.cwd ?? process.cwd(),
|
|
7012
7125
|
env: options.env ?? process.env
|
|
@@ -7062,7 +7175,7 @@ var runCommandCapture = async (binary, args, options = {}) => {
|
|
|
7062
7175
|
if (isVerboseEnabled(options)) {
|
|
7063
7176
|
writeVerboseLine(binary, args);
|
|
7064
7177
|
}
|
|
7065
|
-
const child =
|
|
7178
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7066
7179
|
stdio: "pipe",
|
|
7067
7180
|
cwd: options.cwd ?? process.cwd(),
|
|
7068
7181
|
env: options.env ?? process.env
|
|
@@ -7139,12 +7252,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7139
7252
|
};
|
|
7140
7253
|
}
|
|
7141
7254
|
async function readPackageJson(cwd2) {
|
|
7142
|
-
return readJsonSafe(
|
|
7255
|
+
return readJsonSafe(import_node_path14.default.join(cwd2, "package.json"));
|
|
7143
7256
|
}
|
|
7144
7257
|
async function detectPm(cwd2) {
|
|
7145
|
-
if (await pathExists2(
|
|
7146
|
-
if (await pathExists2(
|
|
7147
|
-
if (await pathExists2(
|
|
7258
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "bun.lockb"))) return "bun";
|
|
7259
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7260
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7148
7261
|
return "npm";
|
|
7149
7262
|
}
|
|
7150
7263
|
async function detectBundler(cwd2) {
|
|
@@ -7165,7 +7278,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7165
7278
|
}
|
|
7166
7279
|
async function findExisting(cwd2, names) {
|
|
7167
7280
|
for (const name of names) {
|
|
7168
|
-
const resolved =
|
|
7281
|
+
const resolved = import_node_path14.default.join(cwd2, name);
|
|
7169
7282
|
if (await pathExists2(resolved)) return resolved;
|
|
7170
7283
|
}
|
|
7171
7284
|
return null;
|
|
@@ -7176,7 +7289,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7176
7289
|
return;
|
|
7177
7290
|
}
|
|
7178
7291
|
await writeFileSafe(filePath, content);
|
|
7179
|
-
logger.ok(
|
|
7292
|
+
logger.ok(import_node_path14.default.relative(cwd2, filePath) || label);
|
|
7180
7293
|
}
|
|
7181
7294
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7182
7295
|
const source = await readFileSafe(filePath);
|
|
@@ -7203,7 +7316,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7203
7316
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7204
7317
|
return;
|
|
7205
7318
|
}
|
|
7206
|
-
const flag = "--save";
|
|
7319
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7207
7320
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7208
7321
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7209
7322
|
try {
|
|
@@ -7221,7 +7334,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7221
7334
|
}
|
|
7222
7335
|
|
|
7223
7336
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7224
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7337
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7225
7338
|
function createCliLogger(options = {}) {
|
|
7226
7339
|
function emit(level, icon, colorize, message) {
|
|
7227
7340
|
options.onEvent?.({ level, message });
|
|
@@ -7339,7 +7452,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7339
7452
|
if (bundlerConfig) {
|
|
7340
7453
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7341
7454
|
if (cfg)
|
|
7342
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7455
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, import_node_path15.default.basename(cfg), setupFlags, logger);
|
|
7343
7456
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7344
7457
|
} else {
|
|
7345
7458
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7358,13 +7471,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7358
7471
|
if (cssFile) {
|
|
7359
7472
|
await patchFileWithDryRun(
|
|
7360
7473
|
cssFile,
|
|
7361
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7362
|
-
|
|
7474
|
+
(src) => patchTailwindCss(src, bundler, import_node_path15.default.relative(cwd, cssFile), cwd),
|
|
7475
|
+
import_node_path15.default.relative(cwd, cssFile),
|
|
7363
7476
|
setupFlags,
|
|
7364
7477
|
logger
|
|
7365
7478
|
);
|
|
7366
|
-
const detectedCssEntry =
|
|
7367
|
-
const twConfigPath =
|
|
7479
|
+
const detectedCssEntry = import_node_path15.default.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7480
|
+
const twConfigPath = import_node_path15.default.join(cwd, "tailwind-styled.config.json");
|
|
7368
7481
|
const twConfig = {
|
|
7369
7482
|
version: 1,
|
|
7370
7483
|
compiler: { engine: "rust" },
|
|
@@ -7382,7 +7495,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7382
7495
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7383
7496
|
}
|
|
7384
7497
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7385
|
-
const tsCfg =
|
|
7498
|
+
const tsCfg = import_node_path15.default.join(cwd, "tsconfig.json");
|
|
7386
7499
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7387
7500
|
if (hasTsConfig) {
|
|
7388
7501
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7427,6 +7540,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7427
7540
|
output.jsonSuccess("setup", report);
|
|
7428
7541
|
}
|
|
7429
7542
|
};
|
|
7543
|
+
|
|
7544
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7545
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
7546
|
+
var import_node_util4 = require("util");
|
|
7430
7547
|
init_errors();
|
|
7431
7548
|
init_fs();
|
|
7432
7549
|
init_output();
|
|
@@ -7448,7 +7565,7 @@ function estimateClassBytes(className) {
|
|
|
7448
7565
|
return base + 15;
|
|
7449
7566
|
}
|
|
7450
7567
|
async function runStatsCli(args) {
|
|
7451
|
-
const parsed =
|
|
7568
|
+
const parsed = (0, import_node_util4.parseArgs)({
|
|
7452
7569
|
args,
|
|
7453
7570
|
allowPositionals: true,
|
|
7454
7571
|
strict: false,
|
|
@@ -7463,7 +7580,7 @@ async function runStatsCli(args) {
|
|
|
7463
7580
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7464
7581
|
});
|
|
7465
7582
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7466
|
-
const dir =
|
|
7583
|
+
const dir = import_node_path16.default.resolve(process.cwd(), dirArg);
|
|
7467
7584
|
if (!await pathExists2(dir)) {
|
|
7468
7585
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7469
7586
|
}
|
|
@@ -7515,15 +7632,20 @@ async function runStatsCli(args) {
|
|
|
7515
7632
|
|
|
7516
7633
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7517
7634
|
init_runtime();
|
|
7635
|
+
|
|
7636
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7637
|
+
var import_node_fs7 = require("fs");
|
|
7638
|
+
var import_node_path18 = require("path");
|
|
7639
|
+
var import_node_util5 = require("util");
|
|
7518
7640
|
function collectTsFiles(dir, extensions) {
|
|
7519
7641
|
const files = [];
|
|
7520
|
-
const entries =
|
|
7642
|
+
const entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
7521
7643
|
for (const entry of entries) {
|
|
7522
|
-
const full =
|
|
7644
|
+
const full = (0, import_node_path18.join)(dir, entry.name);
|
|
7523
7645
|
if (entry.isDirectory()) {
|
|
7524
7646
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7525
7647
|
files.push(...collectTsFiles(full, extensions));
|
|
7526
|
-
} else if (extensions.has(
|
|
7648
|
+
} else if (extensions.has((0, import_node_path18.extname)(entry.name))) {
|
|
7527
7649
|
files.push(full);
|
|
7528
7650
|
}
|
|
7529
7651
|
}
|
|
@@ -7582,7 +7704,7 @@ function printBoundaryReport(report, output) {
|
|
|
7582
7704
|
}
|
|
7583
7705
|
}
|
|
7584
7706
|
async function runBoundaryCli(args, context) {
|
|
7585
|
-
const parsed =
|
|
7707
|
+
const parsed = (0, import_node_util5.parseArgs)({
|
|
7586
7708
|
args,
|
|
7587
7709
|
allowPositionals: true,
|
|
7588
7710
|
strict: false,
|
|
@@ -7600,7 +7722,7 @@ async function runBoundaryCli(args, context) {
|
|
|
7600
7722
|
for (const file of files) {
|
|
7601
7723
|
let source;
|
|
7602
7724
|
try {
|
|
7603
|
-
source =
|
|
7725
|
+
source = (0, import_node_fs7.readFileSync)(file, "utf8");
|
|
7604
7726
|
} catch {
|
|
7605
7727
|
continue;
|
|
7606
7728
|
}
|
|
@@ -7648,10 +7770,13 @@ var createCommand2 = {
|
|
|
7648
7770
|
};
|
|
7649
7771
|
|
|
7650
7772
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7773
|
+
var import_node_util6 = require("util");
|
|
7651
7774
|
init_errors();
|
|
7652
7775
|
init_fs();
|
|
7653
7776
|
|
|
7654
7777
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7778
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
7779
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
7655
7780
|
init_errors();
|
|
7656
7781
|
init_paths();
|
|
7657
7782
|
function enumerateVariantProps(matrix) {
|
|
@@ -7675,7 +7800,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7675
7800
|
}
|
|
7676
7801
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7677
7802
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7678
|
-
const fromCwd =
|
|
7803
|
+
const fromCwd = import_node_path20.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
7679
7804
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7680
7805
|
if (!resolved) {
|
|
7681
7806
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7689,13 +7814,13 @@ async function loadRegistry(context) {
|
|
|
7689
7814
|
);
|
|
7690
7815
|
const candidates = [
|
|
7691
7816
|
runtimeRegistryPath,
|
|
7692
|
-
|
|
7817
|
+
import_node_path20.default.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7693
7818
|
];
|
|
7694
7819
|
const registryPath = await firstExistingPath(candidates);
|
|
7695
7820
|
if (!registryPath) {
|
|
7696
7821
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7697
7822
|
}
|
|
7698
|
-
const raw = await
|
|
7823
|
+
const raw = await import_promises3.default.readFile(registryPath, "utf8");
|
|
7699
7824
|
const data = JSON.parse(raw);
|
|
7700
7825
|
return [
|
|
7701
7826
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7715,7 +7840,7 @@ var dashboardCommand = {
|
|
|
7715
7840
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7716
7841
|
);
|
|
7717
7842
|
}
|
|
7718
|
-
const parsed =
|
|
7843
|
+
const parsed = (0, import_node_util6.parseArgs)({
|
|
7719
7844
|
args,
|
|
7720
7845
|
allowPositionals: true,
|
|
7721
7846
|
strict: false,
|
|
@@ -7739,12 +7864,15 @@ var dashboardCommand = {
|
|
|
7739
7864
|
};
|
|
7740
7865
|
|
|
7741
7866
|
// packages/infrastructure/cli/src/commands/deploy.ts
|
|
7867
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
7868
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
7869
|
+
var import_node_util7 = require("util");
|
|
7742
7870
|
init_errors();
|
|
7743
7871
|
init_fs();
|
|
7744
7872
|
init_json();
|
|
7745
7873
|
var postJson = async (url, body, token) => {
|
|
7746
|
-
const { default: https } = await import(
|
|
7747
|
-
const { default: http } = await import(
|
|
7874
|
+
const { default: https } = await import("https");
|
|
7875
|
+
const { default: http } = await import("http");
|
|
7748
7876
|
return new Promise((resolve2, reject) => {
|
|
7749
7877
|
const client = url.protocol === "https:" ? https : http;
|
|
7750
7878
|
const req = client.request(
|
|
@@ -7778,7 +7906,7 @@ var postJson = async (url, body, token) => {
|
|
|
7778
7906
|
var deployCommand = {
|
|
7779
7907
|
name: "deploy",
|
|
7780
7908
|
async run(args, context) {
|
|
7781
|
-
const parsed =
|
|
7909
|
+
const parsed = (0, import_node_util7.parseArgs)({
|
|
7782
7910
|
args,
|
|
7783
7911
|
allowPositionals: true,
|
|
7784
7912
|
strict: false,
|
|
@@ -7794,7 +7922,7 @@ var deployCommand = {
|
|
|
7794
7922
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7795
7923
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7796
7924
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7797
|
-
const pkgPath =
|
|
7925
|
+
const pkgPath = import_node_path21.default.join(process.cwd(), "package.json");
|
|
7798
7926
|
if (!await pathExists2(pkgPath)) {
|
|
7799
7927
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7800
7928
|
}
|
|
@@ -7829,10 +7957,10 @@ var deployCommand = {
|
|
|
7829
7957
|
}
|
|
7830
7958
|
return;
|
|
7831
7959
|
}
|
|
7832
|
-
const cacheDir =
|
|
7833
|
-
await
|
|
7834
|
-
await
|
|
7835
|
-
|
|
7960
|
+
const cacheDir = import_node_path21.default.join(process.cwd(), ".tw-cache");
|
|
7961
|
+
await import_promises4.default.mkdir(cacheDir, { recursive: true });
|
|
7962
|
+
await import_promises4.default.writeFile(
|
|
7963
|
+
import_node_path21.default.join(cacheDir, "deploy-manifest.json"),
|
|
7836
7964
|
JSON.stringify(manifest, null, 2)
|
|
7837
7965
|
);
|
|
7838
7966
|
if (!registryUrl) {
|
|
@@ -7895,9 +8023,12 @@ var deployCommand = {
|
|
|
7895
8023
|
};
|
|
7896
8024
|
|
|
7897
8025
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7898
|
-
var
|
|
8026
|
+
var import_node_util8 = require("util");
|
|
8027
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
7899
8028
|
|
|
7900
8029
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
8030
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
8031
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
7901
8032
|
init_src3();
|
|
7902
8033
|
init_src2();
|
|
7903
8034
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
@@ -7932,9 +8063,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7932
8063
|
issues.push({ severity, type, message, suggestion, location });
|
|
7933
8064
|
}
|
|
7934
8065
|
function readJsonFile(filePath) {
|
|
7935
|
-
if (!
|
|
8066
|
+
if (!import_node_fs8.default.existsSync(filePath)) return null;
|
|
7936
8067
|
try {
|
|
7937
|
-
return JSON.parse(
|
|
8068
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
7938
8069
|
} catch (parseErr) {
|
|
7939
8070
|
if (process.env.TWS_DEBUG === "1") {
|
|
7940
8071
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7945,16 +8076,16 @@ function readJsonFile(filePath) {
|
|
|
7945
8076
|
}
|
|
7946
8077
|
}
|
|
7947
8078
|
function findWorkspacePackageJsonFiles(root) {
|
|
7948
|
-
const packagesDir =
|
|
7949
|
-
if (!
|
|
7950
|
-
return
|
|
8079
|
+
const packagesDir = import_node_path22.default.join(root, "packages");
|
|
8080
|
+
if (!import_node_fs8.default.existsSync(packagesDir)) return [];
|
|
8081
|
+
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
8082
|
}
|
|
7952
8083
|
function findFiles(dir, ext) {
|
|
7953
8084
|
const files = [];
|
|
7954
8085
|
try {
|
|
7955
|
-
const entries =
|
|
8086
|
+
const entries = import_node_fs8.default.readdirSync(dir, { withFileTypes: true });
|
|
7956
8087
|
for (const entry of entries) {
|
|
7957
|
-
const fullPath =
|
|
8088
|
+
const fullPath = import_node_path22.default.join(dir, entry.name);
|
|
7958
8089
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7959
8090
|
files.push(...findFiles(fullPath, ext));
|
|
7960
8091
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7972,7 +8103,7 @@ function findFiles(dir, ext) {
|
|
|
7972
8103
|
return files;
|
|
7973
8104
|
}
|
|
7974
8105
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7975
|
-
const rootPackageJsonPath =
|
|
8106
|
+
const rootPackageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
7976
8107
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7977
8108
|
if (!rootPackageJson) {
|
|
7978
8109
|
addCheck(
|
|
@@ -8025,7 +8156,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8025
8156
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8026
8157
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8027
8158
|
if (missing.length === 0) return [];
|
|
8028
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8159
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : import_node_path22.default.basename(import_node_path22.default.dirname(filePath));
|
|
8029
8160
|
return [{ packageName, missing }];
|
|
8030
8161
|
});
|
|
8031
8162
|
if (missingScripts.length === 0) {
|
|
@@ -8060,7 +8191,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8060
8191
|
);
|
|
8061
8192
|
}
|
|
8062
8193
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8063
|
-
const packageJsonPath =
|
|
8194
|
+
const packageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
8064
8195
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8065
8196
|
if (!packageJson) {
|
|
8066
8197
|
addCheck(
|
|
@@ -8119,7 +8250,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8119
8250
|
const cssFiles = findFiles(root, ".css");
|
|
8120
8251
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8121
8252
|
try {
|
|
8122
|
-
const content =
|
|
8253
|
+
const content = import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
8123
8254
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8124
8255
|
} catch {
|
|
8125
8256
|
return false;
|
|
@@ -8143,7 +8274,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8143
8274
|
);
|
|
8144
8275
|
}
|
|
8145
8276
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8146
|
-
const hasConfig = configFiles.some((name) =>
|
|
8277
|
+
const hasConfig = configFiles.some((name) => import_node_fs8.default.existsSync(import_node_path22.default.join(root, name)));
|
|
8147
8278
|
addCheck(
|
|
8148
8279
|
checks,
|
|
8149
8280
|
"tailwind",
|
|
@@ -8152,7 +8283,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8152
8283
|
"info",
|
|
8153
8284
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8154
8285
|
);
|
|
8155
|
-
const tsconfig = readJsonFile(
|
|
8286
|
+
const tsconfig = readJsonFile(import_node_path22.default.join(root, "tsconfig.json"));
|
|
8156
8287
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8157
8288
|
addCheck(
|
|
8158
8289
|
checks,
|
|
@@ -8318,7 +8449,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8318
8449
|
}
|
|
8319
8450
|
}
|
|
8320
8451
|
var runDiagnostics = async (options = {}) => {
|
|
8321
|
-
const root =
|
|
8452
|
+
const root = import_node_path22.default.resolve(options.root ?? process.cwd());
|
|
8322
8453
|
const includes = parseIncludes(options.include);
|
|
8323
8454
|
const issues = [];
|
|
8324
8455
|
const checks = [];
|
|
@@ -8364,7 +8495,7 @@ function parseIncludeOption(value) {
|
|
|
8364
8495
|
return includes;
|
|
8365
8496
|
}
|
|
8366
8497
|
async function runDoctorCli(args, context) {
|
|
8367
|
-
const parsed =
|
|
8498
|
+
const parsed = (0, import_node_util8.parseArgs)({
|
|
8368
8499
|
args,
|
|
8369
8500
|
allowPositionals: true,
|
|
8370
8501
|
strict: false,
|
|
@@ -8437,13 +8568,15 @@ function printDoctorOutput(result, output) {
|
|
|
8437
8568
|
}
|
|
8438
8569
|
|
|
8439
8570
|
// packages/infrastructure/cli/src/commands/misc.ts
|
|
8571
|
+
var import_node_path23 = __toESM(require("path"), 1);
|
|
8572
|
+
var import_node_util9 = require("util");
|
|
8440
8573
|
init_errors();
|
|
8441
8574
|
init_fs();
|
|
8442
8575
|
init_json();
|
|
8443
8576
|
var testCommand = {
|
|
8444
8577
|
name: "test",
|
|
8445
8578
|
async run(args) {
|
|
8446
|
-
const parsed =
|
|
8579
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8447
8580
|
args,
|
|
8448
8581
|
allowPositionals: true,
|
|
8449
8582
|
strict: false,
|
|
@@ -8468,7 +8601,7 @@ var shareCommand = {
|
|
|
8468
8601
|
name: "share",
|
|
8469
8602
|
async run(args, context) {
|
|
8470
8603
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8471
|
-
const manifestPath =
|
|
8604
|
+
const manifestPath = import_node_path23.default.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8472
8605
|
const defaultManifest = {
|
|
8473
8606
|
name,
|
|
8474
8607
|
version: "0.1.0"
|
|
@@ -8505,7 +8638,7 @@ var codeCommand = {
|
|
|
8505
8638
|
async run(args, context) {
|
|
8506
8639
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8507
8640
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8508
|
-
const parsed =
|
|
8641
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8509
8642
|
args,
|
|
8510
8643
|
allowPositionals: true,
|
|
8511
8644
|
strict: false,
|
|
@@ -8554,14 +8687,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8554
8687
|
};
|
|
8555
8688
|
var resolveCurrentCliVersion = async (context) => {
|
|
8556
8689
|
const candidates = [
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8690
|
+
import_node_path23.default.resolve(context.runtimeDir, "..", "package.json"),
|
|
8691
|
+
import_node_path23.default.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8692
|
+
import_node_path23.default.resolve(process.cwd(), "package.json")
|
|
8560
8693
|
];
|
|
8561
8694
|
for (const candidate of candidates) {
|
|
8562
8695
|
if (!await pathExists2(candidate)) continue;
|
|
8563
8696
|
const pkg = await readJsonSafe(candidate);
|
|
8564
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8697
|
+
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
8698
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8566
8699
|
}
|
|
8567
8700
|
return "0.0.0";
|
|
@@ -8611,7 +8744,7 @@ var versionCommand = {
|
|
|
8611
8744
|
name: "version",
|
|
8612
8745
|
aliases: ["v"],
|
|
8613
8746
|
async run(args, context) {
|
|
8614
|
-
const parsed =
|
|
8747
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8615
8748
|
args,
|
|
8616
8749
|
allowPositionals: true,
|
|
8617
8750
|
strict: false,
|
|
@@ -8645,7 +8778,7 @@ var upgradeCommand = {
|
|
|
8645
8778
|
name: "upgrade",
|
|
8646
8779
|
aliases: ["update"],
|
|
8647
8780
|
async run(args, context) {
|
|
8648
|
-
const parsed =
|
|
8781
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8649
8782
|
args,
|
|
8650
8783
|
allowPositionals: true,
|
|
8651
8784
|
strict: false,
|
|
@@ -8799,11 +8932,14 @@ var pluginCommand = {
|
|
|
8799
8932
|
};
|
|
8800
8933
|
|
|
8801
8934
|
// packages/infrastructure/cli/src/preflight.ts
|
|
8935
|
+
var import_node_path25 = __toESM(require("path"), 1);
|
|
8936
|
+
var import_node_url7 = require("url");
|
|
8802
8937
|
init_args();
|
|
8803
8938
|
init_errors();
|
|
8804
8939
|
init_fs();
|
|
8805
8940
|
init_json();
|
|
8806
8941
|
init_src4();
|
|
8942
|
+
var import_meta11 = {};
|
|
8807
8943
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8808
8944
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8809
8945
|
{
|
|
@@ -8829,8 +8965,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8829
8965
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8830
8966
|
let configPath = null;
|
|
8831
8967
|
for (const file of twConfigFiles) {
|
|
8832
|
-
if (await pathExists2(
|
|
8833
|
-
configPath =
|
|
8968
|
+
if (await pathExists2(import_node_path25.default.join(cwd2, file))) {
|
|
8969
|
+
configPath = import_node_path25.default.join(cwd2, file);
|
|
8834
8970
|
break;
|
|
8835
8971
|
}
|
|
8836
8972
|
}
|
|
@@ -8839,7 +8975,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8839
8975
|
return results;
|
|
8840
8976
|
}
|
|
8841
8977
|
try {
|
|
8842
|
-
const configUrl =
|
|
8978
|
+
const configUrl = (0, import_node_url7.pathToFileURL)(configPath);
|
|
8843
8979
|
const configModule = await import(configUrl.href);
|
|
8844
8980
|
const config = configModule.default || configModule;
|
|
8845
8981
|
const theme = config.theme || {};
|
|
@@ -8921,7 +9057,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8921
9057
|
async function hasTailwindCssImport(cwd2) {
|
|
8922
9058
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8923
9059
|
for (const file of cssFiles) {
|
|
8924
|
-
const raw = await readFileSafe(
|
|
9060
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8925
9061
|
if (raw?.includes("tailwindcss")) return true;
|
|
8926
9062
|
}
|
|
8927
9063
|
return false;
|
|
@@ -8937,7 +9073,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8937
9073
|
"app/globals.css"
|
|
8938
9074
|
];
|
|
8939
9075
|
for (const file of cssFiles) {
|
|
8940
|
-
const raw = await readFileSafe(
|
|
9076
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8941
9077
|
if (raw === null) continue;
|
|
8942
9078
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8943
9079
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8945,8 +9081,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8945
9081
|
return { found: false, cssFile: null };
|
|
8946
9082
|
}
|
|
8947
9083
|
async function applyTailwindInit(cwd2) {
|
|
8948
|
-
await ensureFileSafe(
|
|
8949
|
-
await ensureFileSafe(
|
|
9084
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9085
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8950
9086
|
}
|
|
8951
9087
|
function check(results, id, label, pass, message, fix) {
|
|
8952
9088
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8968,7 +9104,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8968
9104
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8969
9105
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8970
9106
|
);
|
|
8971
|
-
const pkg = await readJsonSafe(
|
|
9107
|
+
const pkg = await readJsonSafe(import_node_path25.default.join(cwd2, "package.json"));
|
|
8972
9108
|
check(
|
|
8973
9109
|
results,
|
|
8974
9110
|
"package-json",
|
|
@@ -9002,7 +9138,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9002
9138
|
}
|
|
9003
9139
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9004
9140
|
const twConfigChecks = await Promise.all(
|
|
9005
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9141
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path25.default.join(cwd2, file)) }))
|
|
9006
9142
|
);
|
|
9007
9143
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9008
9144
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9014,7 +9150,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9014
9150
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9015
9151
|
"tw init"
|
|
9016
9152
|
);
|
|
9017
|
-
const oldConfig = await readJsonSafe(
|
|
9153
|
+
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
9154
|
if (oldConfig) {
|
|
9019
9155
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9020
9156
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9038,7 +9174,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9038
9174
|
validation.message
|
|
9039
9175
|
);
|
|
9040
9176
|
}
|
|
9041
|
-
const hasTsConfig = await pathExists2(
|
|
9177
|
+
const hasTsConfig = await pathExists2(import_node_path25.default.join(cwd2, "tsconfig.json"));
|
|
9042
9178
|
check(
|
|
9043
9179
|
results,
|
|
9044
9180
|
"typescript",
|
|
@@ -9114,7 +9250,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9114
9250
|
function isDirectExecution() {
|
|
9115
9251
|
const scriptPath = process.argv[1];
|
|
9116
9252
|
if (!scriptPath) return false;
|
|
9117
|
-
return
|
|
9253
|
+
return import_meta11.url === (0, import_node_url7.pathToFileURL)(scriptPath).href;
|
|
9118
9254
|
}
|
|
9119
9255
|
if (isDirectExecution()) {
|
|
9120
9256
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9182,6 +9318,7 @@ var installRegistryCommand = {
|
|
|
9182
9318
|
};
|
|
9183
9319
|
|
|
9184
9320
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9321
|
+
var import_node_util10 = require("util");
|
|
9185
9322
|
init_errors();
|
|
9186
9323
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9187
9324
|
if (context.json && options.jsonUnsupported) {
|
|
@@ -9211,7 +9348,7 @@ var parseCommand = {
|
|
|
9211
9348
|
var transformCommand = {
|
|
9212
9349
|
name: "transform",
|
|
9213
9350
|
async run(args, context) {
|
|
9214
|
-
const parsed =
|
|
9351
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9215
9352
|
args,
|
|
9216
9353
|
allowPositionals: true,
|
|
9217
9354
|
strict: false,
|
|
@@ -9254,7 +9391,7 @@ var lintCommand = {
|
|
|
9254
9391
|
var formatCommand2 = {
|
|
9255
9392
|
name: "format",
|
|
9256
9393
|
async run(args, context) {
|
|
9257
|
-
const parsed =
|
|
9394
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9258
9395
|
args,
|
|
9259
9396
|
allowPositionals: true,
|
|
9260
9397
|
strict: false,
|
|
@@ -9296,7 +9433,7 @@ var optimizeCommand = {
|
|
|
9296
9433
|
var splitCommand = {
|
|
9297
9434
|
name: "split",
|
|
9298
9435
|
async run(args, context) {
|
|
9299
|
-
const parsed =
|
|
9436
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9300
9437
|
args,
|
|
9301
9438
|
allowPositionals: true,
|
|
9302
9439
|
strict: false,
|
|
@@ -9392,13 +9529,15 @@ var scriptCommands = [
|
|
|
9392
9529
|
];
|
|
9393
9530
|
|
|
9394
9531
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9532
|
+
var import_node_path26 = __toESM(require("path"), 1);
|
|
9533
|
+
var import_node_util11 = require("util");
|
|
9395
9534
|
init_errors();
|
|
9396
9535
|
init_fs();
|
|
9397
9536
|
init_json();
|
|
9398
9537
|
var storybookCommand = {
|
|
9399
9538
|
name: "storybook",
|
|
9400
9539
|
async run(args, context) {
|
|
9401
|
-
const parsed =
|
|
9540
|
+
const parsed = (0, import_node_util11.parseArgs)({
|
|
9402
9541
|
args,
|
|
9403
9542
|
allowPositionals: true,
|
|
9404
9543
|
strict: false,
|
|
@@ -9432,7 +9571,7 @@ var storybookCommand = {
|
|
|
9432
9571
|
context.output.writeText(
|
|
9433
9572
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9434
9573
|
);
|
|
9435
|
-
const localBin =
|
|
9574
|
+
const localBin = import_node_path26.default.join(
|
|
9436
9575
|
process.cwd(),
|
|
9437
9576
|
"node_modules",
|
|
9438
9577
|
".bin",
|
|
@@ -9449,6 +9588,7 @@ var storybookCommand = {
|
|
|
9449
9588
|
};
|
|
9450
9589
|
|
|
9451
9590
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9591
|
+
var import_node_util12 = require("util");
|
|
9452
9592
|
init_errors();
|
|
9453
9593
|
var studioCommand = {
|
|
9454
9594
|
name: "studio",
|
|
@@ -9456,7 +9596,7 @@ var studioCommand = {
|
|
|
9456
9596
|
if (context.json) {
|
|
9457
9597
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9458
9598
|
}
|
|
9459
|
-
const parsed =
|
|
9599
|
+
const parsed = (0, import_node_util12.parseArgs)({
|
|
9460
9600
|
args,
|
|
9461
9601
|
allowPositionals: true,
|
|
9462
9602
|
strict: false,
|
|
@@ -9522,7 +9662,8 @@ var syncCommand = {
|
|
|
9522
9662
|
};
|
|
9523
9663
|
|
|
9524
9664
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9525
|
-
var
|
|
9665
|
+
var import_node_util13 = require("util");
|
|
9666
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9526
9667
|
init_errors();
|
|
9527
9668
|
|
|
9528
9669
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
@@ -9530,16 +9671,17 @@ init_internal();
|
|
|
9530
9671
|
|
|
9531
9672
|
// packages/domain/engine/src/native-bridge.ts
|
|
9532
9673
|
init_src();
|
|
9674
|
+
var import_meta12 = {};
|
|
9533
9675
|
var log4 = createDebugLogger("engine:native");
|
|
9534
9676
|
function getDirname3() {
|
|
9535
9677
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
9536
|
-
if (typeof
|
|
9537
|
-
return getDirname(
|
|
9678
|
+
if (typeof import_meta12 !== "undefined" && import_meta12.url) {
|
|
9679
|
+
return getDirname(import_meta12.url);
|
|
9538
9680
|
}
|
|
9539
9681
|
return process.cwd();
|
|
9540
9682
|
}
|
|
9541
|
-
var isValidEngineBinding = (
|
|
9542
|
-
const candidate =
|
|
9683
|
+
var isValidEngineBinding = (module2) => {
|
|
9684
|
+
const candidate = module2;
|
|
9543
9685
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
9544
9686
|
};
|
|
9545
9687
|
var createEngineBindingLoader = () => {
|
|
@@ -10347,7 +10489,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10347
10489
|
const parsed = native.parseCssRules(css);
|
|
10348
10490
|
for (const r of parsed) {
|
|
10349
10491
|
const className = prefix + r.className;
|
|
10350
|
-
r.variants.length > 0;
|
|
10492
|
+
const hasVariants = r.variants.length > 0;
|
|
10351
10493
|
const layerName = detectLayerFromClassName(className);
|
|
10352
10494
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10353
10495
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10597,10 +10739,12 @@ async function traceClass(className, options) {
|
|
|
10597
10739
|
}
|
|
10598
10740
|
|
|
10599
10741
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10742
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
10743
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
|
10600
10744
|
init_internal();
|
|
10601
10745
|
init_src2();
|
|
10602
10746
|
function toRelativePath(root, value) {
|
|
10603
|
-
const relative =
|
|
10747
|
+
const relative = import_node_path27.default.relative(root, value);
|
|
10604
10748
|
return relative.length > 0 ? relative : ".";
|
|
10605
10749
|
}
|
|
10606
10750
|
function uniqueSorted(values) {
|
|
@@ -10669,7 +10813,7 @@ function tryCompileClasses(classes) {
|
|
|
10669
10813
|
}
|
|
10670
10814
|
}
|
|
10671
10815
|
function traceSingleFile(filePath, root) {
|
|
10672
|
-
const source =
|
|
10816
|
+
const source = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
10673
10817
|
const classes = uniqueSorted(scanSource(source));
|
|
10674
10818
|
const imports = extractImports(source);
|
|
10675
10819
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10700,7 +10844,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10700
10844
|
const imports = [];
|
|
10701
10845
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10702
10846
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10703
|
-
const source =
|
|
10847
|
+
const source = import_node_fs10.default.readFileSync(entry.file, "utf8");
|
|
10704
10848
|
const fileImports = extractImports(source);
|
|
10705
10849
|
for (const fileImport of fileImports) {
|
|
10706
10850
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10731,12 +10875,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10731
10875
|
};
|
|
10732
10876
|
}
|
|
10733
10877
|
async function traceTarget(target, options = {}) {
|
|
10734
|
-
const root =
|
|
10735
|
-
const resolvedTarget =
|
|
10736
|
-
if (!
|
|
10878
|
+
const root = import_node_path27.default.resolve(options.root ?? process.cwd());
|
|
10879
|
+
const resolvedTarget = import_node_path27.default.resolve(root, target);
|
|
10880
|
+
if (!import_node_fs10.default.existsSync(resolvedTarget)) {
|
|
10737
10881
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10738
10882
|
}
|
|
10739
|
-
const stat =
|
|
10883
|
+
const stat = import_node_fs10.default.statSync(resolvedTarget);
|
|
10740
10884
|
if (stat.isDirectory()) {
|
|
10741
10885
|
return traceDirectory(resolvedTarget, root);
|
|
10742
10886
|
}
|
|
@@ -10754,7 +10898,7 @@ function parseTraceFormat(value, context) {
|
|
|
10754
10898
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10755
10899
|
}
|
|
10756
10900
|
async function runTraceCli(args, context) {
|
|
10757
|
-
const parsed =
|
|
10901
|
+
const parsed = (0, import_node_util13.parseArgs)({
|
|
10758
10902
|
args,
|
|
10759
10903
|
allowPositionals: true,
|
|
10760
10904
|
strict: false,
|
|
@@ -10898,14 +11042,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10898
11042
|
}
|
|
10899
11043
|
|
|
10900
11044
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10901
|
-
var
|
|
11045
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
11046
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
11047
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10902
11048
|
init_output();
|
|
10903
11049
|
async function runGenerateTypesCli(rawArgs) {
|
|
10904
11050
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10905
11051
|
const logger = createCliLogger({ output });
|
|
10906
11052
|
const cwd2 = process.cwd();
|
|
10907
11053
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10908
|
-
const outPath =
|
|
11054
|
+
const outPath = import_node_path28.default.resolve(cwd2, outFile);
|
|
10909
11055
|
output.writeText("");
|
|
10910
11056
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10911
11057
|
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 +11087,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10941
11087
|
}
|
|
10942
11088
|
output.writeText("");
|
|
10943
11089
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10944
|
-
const outDir =
|
|
10945
|
-
if (!
|
|
10946
|
-
|
|
11090
|
+
const outDir = import_node_path28.default.dirname(outPath);
|
|
11091
|
+
if (!import_node_fs11.default.existsSync(outDir)) {
|
|
11092
|
+
import_node_fs11.default.mkdirSync(outDir, { recursive: true });
|
|
10947
11093
|
}
|
|
10948
|
-
|
|
10949
|
-
logger.ok(
|
|
11094
|
+
import_node_fs11.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11095
|
+
logger.ok(import_node_path28.default.relative(cwd2, outPath));
|
|
10950
11096
|
output.writeText("");
|
|
10951
11097
|
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
11098
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10957,13 +11103,13 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10957
11103
|
}
|
|
10958
11104
|
async function loadNativeBinding2(cwd2) {
|
|
10959
11105
|
const candidates = [
|
|
10960
|
-
|
|
10961
|
-
|
|
11106
|
+
import_node_path28.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11107
|
+
import_node_path28.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10962
11108
|
];
|
|
10963
11109
|
for (const candidate of candidates) {
|
|
10964
|
-
if (
|
|
11110
|
+
if (import_node_fs11.default.existsSync(candidate)) {
|
|
10965
11111
|
try {
|
|
10966
|
-
return
|
|
11112
|
+
return require(candidate);
|
|
10967
11113
|
} catch {
|
|
10968
11114
|
}
|
|
10969
11115
|
}
|
|
@@ -10972,9 +11118,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10972
11118
|
}
|
|
10973
11119
|
|
|
10974
11120
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
11121
|
+
var import_node_util14 = require("util");
|
|
10975
11122
|
init_errors();
|
|
10976
11123
|
|
|
10977
11124
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11125
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
11126
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
10978
11127
|
init_internal();
|
|
10979
11128
|
init_src2();
|
|
10980
11129
|
function extractVariantChain(usage) {
|
|
@@ -11023,7 +11172,7 @@ async function whyClass(className, options) {
|
|
|
11023
11172
|
for (const file of scanResult.files) {
|
|
11024
11173
|
const source = (() => {
|
|
11025
11174
|
try {
|
|
11026
|
-
return
|
|
11175
|
+
return import_node_fs12.default.readFileSync(file.file, "utf8");
|
|
11027
11176
|
} catch {
|
|
11028
11177
|
return "";
|
|
11029
11178
|
}
|
|
@@ -11037,7 +11186,7 @@ async function whyClass(className, options) {
|
|
|
11037
11186
|
className
|
|
11038
11187
|
]);
|
|
11039
11188
|
usedIn.push({
|
|
11040
|
-
file:
|
|
11189
|
+
file: import_node_path29.default.relative(root, file.file) || import_node_path29.default.basename(file.file),
|
|
11041
11190
|
line: location.line,
|
|
11042
11191
|
column: location.column,
|
|
11043
11192
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11158,7 +11307,7 @@ function printWhyOutput(result, output) {
|
|
|
11158
11307
|
output.writeText("");
|
|
11159
11308
|
}
|
|
11160
11309
|
async function runWhyCli(args, context) {
|
|
11161
|
-
const parsed =
|
|
11310
|
+
const parsed = (0, import_node_util14.parseArgs)({
|
|
11162
11311
|
args,
|
|
11163
11312
|
allowPositionals: true,
|
|
11164
11313
|
strict: false,
|
|
@@ -11200,7 +11349,7 @@ function toVariadic(value) {
|
|
|
11200
11349
|
return Array.isArray(value) ? value : [value];
|
|
11201
11350
|
}
|
|
11202
11351
|
function buildMainProgram(context) {
|
|
11203
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11352
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11204
11353
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11205
11354
|
const program2 = new Command("tw");
|
|
11206
11355
|
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");
|
|
@@ -11495,20 +11644,22 @@ init_runtime();
|
|
|
11495
11644
|
init_args();
|
|
11496
11645
|
init_args();
|
|
11497
11646
|
init_output();
|
|
11647
|
+
var import_meta13 = {};
|
|
11498
11648
|
async function main2() {
|
|
11499
11649
|
await runCliMain({
|
|
11500
|
-
importMetaUrl:
|
|
11650
|
+
importMetaUrl: import_meta13.url,
|
|
11501
11651
|
buildProgram: buildMainProgram
|
|
11502
11652
|
});
|
|
11503
11653
|
}
|
|
11504
|
-
var __filename2 =
|
|
11654
|
+
var __filename2 = (0, import_node_url8.fileURLToPath)(import_meta13.url);
|
|
11505
11655
|
if (process.argv[1] === __filename2) {
|
|
11506
11656
|
main2();
|
|
11507
11657
|
}
|
|
11508
|
-
|
|
11509
|
-
exports
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11658
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
11659
|
+
0 && (module.exports = {
|
|
11660
|
+
createCliOutput,
|
|
11661
|
+
ensureFlag,
|
|
11662
|
+
parseCliArgs,
|
|
11663
|
+
runScanCli
|
|
11664
|
+
});
|
|
11514
11665
|
//# sourceMappingURL=cli.js.map
|