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/tw.js
CHANGED
|
@@ -1,61 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
var module$1 = require('module');
|
|
5
|
-
var fs11 = require('fs');
|
|
6
|
-
var path6 = require('path');
|
|
7
|
-
require('crypto');
|
|
8
|
-
var url = require('url');
|
|
9
|
-
var worker_threads = require('worker_threads');
|
|
10
|
-
var os = require('os');
|
|
11
|
-
var zod = require('zod');
|
|
12
|
-
var fs7 = require('fs/promises');
|
|
13
|
-
var prompts = require('@clack/prompts');
|
|
14
|
-
var util = require('util');
|
|
15
|
-
var child_process = require('child_process');
|
|
16
|
-
|
|
17
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
18
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
22
|
-
var n = Object.create(null);
|
|
23
|
-
if (e) {
|
|
24
|
-
Object.keys(e).forEach(function (k) {
|
|
25
|
-
if (k !== 'default') {
|
|
26
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
27
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () { return e[k]; }
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
n.default = e;
|
|
35
|
-
return Object.freeze(n);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var fs11__namespace = /*#__PURE__*/_interopNamespace(fs11);
|
|
39
|
-
var path6__namespace = /*#__PURE__*/_interopNamespace(path6);
|
|
40
|
-
var fs7__default = /*#__PURE__*/_interopDefault(fs7);
|
|
41
|
-
|
|
42
2
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
3
|
+
"use strict";
|
|
43
4
|
var __create = Object.create;
|
|
44
5
|
var __defProp = Object.defineProperty;
|
|
45
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
46
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
47
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
48
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
49
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
50
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
51
|
-
}) : x)(function(x) {
|
|
52
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
53
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
54
|
-
});
|
|
55
10
|
var __esm = (fn, res) => function __init() {
|
|
56
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
57
12
|
};
|
|
58
|
-
var __commonJS = (cb, mod) => function
|
|
13
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
59
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
60
15
|
};
|
|
61
16
|
var __export = (target, all) => {
|
|
@@ -75,14 +30,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
75
30
|
// file that has been converted to a CommonJS file using a Babel-
|
|
76
31
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
77
32
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
78
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
79
34
|
mod
|
|
80
35
|
));
|
|
81
36
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
82
37
|
|
|
83
38
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
84
39
|
var require_error = __commonJS({
|
|
85
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(
|
|
40
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports2) {
|
|
41
|
+
"use strict";
|
|
86
42
|
var CommanderError2 = class extends Error {
|
|
87
43
|
/**
|
|
88
44
|
* Constructs the CommanderError class
|
|
@@ -110,14 +66,15 @@ var require_error = __commonJS({
|
|
|
110
66
|
this.name = this.constructor.name;
|
|
111
67
|
}
|
|
112
68
|
};
|
|
113
|
-
|
|
114
|
-
|
|
69
|
+
exports2.CommanderError = CommanderError2;
|
|
70
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
115
71
|
}
|
|
116
72
|
});
|
|
117
73
|
|
|
118
74
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
119
75
|
var require_argument = __commonJS({
|
|
120
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(
|
|
76
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports2) {
|
|
77
|
+
"use strict";
|
|
121
78
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
122
79
|
var Argument2 = class {
|
|
123
80
|
/**
|
|
@@ -237,14 +194,15 @@ var require_argument = __commonJS({
|
|
|
237
194
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
238
195
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
239
196
|
}
|
|
240
|
-
|
|
241
|
-
|
|
197
|
+
exports2.Argument = Argument2;
|
|
198
|
+
exports2.humanReadableArgName = humanReadableArgName;
|
|
242
199
|
}
|
|
243
200
|
});
|
|
244
201
|
|
|
245
202
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
246
203
|
var require_help = __commonJS({
|
|
247
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(
|
|
204
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports2) {
|
|
205
|
+
"use strict";
|
|
248
206
|
var { humanReadableArgName } = require_argument();
|
|
249
207
|
var Help2 = class {
|
|
250
208
|
constructor() {
|
|
@@ -652,13 +610,14 @@ var require_help = __commonJS({
|
|
|
652
610
|
}).join("\n");
|
|
653
611
|
}
|
|
654
612
|
};
|
|
655
|
-
|
|
613
|
+
exports2.Help = Help2;
|
|
656
614
|
}
|
|
657
615
|
});
|
|
658
616
|
|
|
659
617
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
660
618
|
var require_option = __commonJS({
|
|
661
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(
|
|
619
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports2) {
|
|
620
|
+
"use strict";
|
|
662
621
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
663
622
|
var Option2 = class {
|
|
664
623
|
/**
|
|
@@ -923,14 +882,15 @@ var require_option = __commonJS({
|
|
|
923
882
|
}
|
|
924
883
|
return { shortFlag, longFlag };
|
|
925
884
|
}
|
|
926
|
-
|
|
927
|
-
|
|
885
|
+
exports2.Option = Option2;
|
|
886
|
+
exports2.DualOptions = DualOptions;
|
|
928
887
|
}
|
|
929
888
|
});
|
|
930
889
|
|
|
931
890
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
932
891
|
var require_suggestSimilar = __commonJS({
|
|
933
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(
|
|
892
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports2) {
|
|
893
|
+
"use strict";
|
|
934
894
|
var maxDistance = 3;
|
|
935
895
|
function editDistance(a, b) {
|
|
936
896
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -1004,18 +964,19 @@ var require_suggestSimilar = __commonJS({
|
|
|
1004
964
|
}
|
|
1005
965
|
return "";
|
|
1006
966
|
}
|
|
1007
|
-
|
|
967
|
+
exports2.suggestSimilar = suggestSimilar;
|
|
1008
968
|
}
|
|
1009
969
|
});
|
|
1010
970
|
|
|
1011
971
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
1012
972
|
var require_command = __commonJS({
|
|
1013
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(
|
|
1014
|
-
|
|
1015
|
-
var
|
|
1016
|
-
var
|
|
1017
|
-
var
|
|
1018
|
-
var
|
|
973
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports2) {
|
|
974
|
+
"use strict";
|
|
975
|
+
var EventEmitter = require("events").EventEmitter;
|
|
976
|
+
var childProcess = require("child_process");
|
|
977
|
+
var path30 = require("path");
|
|
978
|
+
var fs16 = require("fs");
|
|
979
|
+
var process2 = require("process");
|
|
1019
980
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1020
981
|
var { CommanderError: CommanderError2 } = require_error();
|
|
1021
982
|
var { Help: Help2 } = require_help();
|
|
@@ -1424,6 +1385,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1424
1385
|
this._exitCallback = (err) => {
|
|
1425
1386
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1426
1387
|
throw err;
|
|
1388
|
+
} else {
|
|
1427
1389
|
}
|
|
1428
1390
|
};
|
|
1429
1391
|
}
|
|
@@ -3046,29 +3008,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3046
3008
|
return arg;
|
|
3047
3009
|
});
|
|
3048
3010
|
}
|
|
3049
|
-
|
|
3011
|
+
exports2.Command = Command2;
|
|
3050
3012
|
}
|
|
3051
3013
|
});
|
|
3052
3014
|
|
|
3053
3015
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3054
3016
|
var require_commander = __commonJS({
|
|
3055
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(
|
|
3017
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports2) {
|
|
3018
|
+
"use strict";
|
|
3056
3019
|
var { Argument: Argument2 } = require_argument();
|
|
3057
3020
|
var { Command: Command2 } = require_command();
|
|
3058
3021
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3059
3022
|
var { Help: Help2 } = require_help();
|
|
3060
3023
|
var { Option: Option2 } = require_option();
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3024
|
+
exports2.program = new Command2();
|
|
3025
|
+
exports2.createCommand = (name) => new Command2(name);
|
|
3026
|
+
exports2.createOption = (flags, description) => new Option2(flags, description);
|
|
3027
|
+
exports2.createArgument = (name, description) => new Argument2(name, description);
|
|
3028
|
+
exports2.Command = Command2;
|
|
3029
|
+
exports2.Option = Option2;
|
|
3030
|
+
exports2.Argument = Argument2;
|
|
3031
|
+
exports2.Help = Help2;
|
|
3032
|
+
exports2.CommanderError = CommanderError2;
|
|
3033
|
+
exports2.InvalidArgumentError = InvalidArgumentError2;
|
|
3034
|
+
exports2.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3072
3035
|
}
|
|
3073
3036
|
});
|
|
3074
3037
|
|
|
@@ -3076,7 +3039,8 @@ var require_commander = __commonJS({
|
|
|
3076
3039
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3077
3040
|
var init_esm = __esm({
|
|
3078
3041
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3079
|
-
|
|
3042
|
+
"use strict";
|
|
3043
|
+
import_index = __toESM(require_commander(), 1);
|
|
3080
3044
|
({
|
|
3081
3045
|
program,
|
|
3082
3046
|
createCommand,
|
|
@@ -3121,6 +3085,7 @@ function errorExitCode(error) {
|
|
|
3121
3085
|
var CliError, CliUsageError;
|
|
3122
3086
|
var init_errors = __esm({
|
|
3123
3087
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3088
|
+
"use strict";
|
|
3124
3089
|
CliError = class extends Error {
|
|
3125
3090
|
exitCode;
|
|
3126
3091
|
code;
|
|
@@ -3145,7 +3110,7 @@ function getNodeModuleRef() {
|
|
|
3145
3110
|
if (isBrowser) return null;
|
|
3146
3111
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
3147
3112
|
try {
|
|
3148
|
-
const test = typeof
|
|
3113
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
3149
3114
|
nodeModuleRef = test;
|
|
3150
3115
|
return test;
|
|
3151
3116
|
} catch {
|
|
@@ -3157,14 +3122,14 @@ function getNodePath() {
|
|
|
3157
3122
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
3158
3123
|
const nodeRequire = getNodeModuleRef();
|
|
3159
3124
|
if (!nodeRequire) throw new Error("require not available");
|
|
3160
|
-
if (!_nodePath) _nodePath = nodeRequire.createRequire(
|
|
3125
|
+
if (!_nodePath) _nodePath = nodeRequire.createRequire(import_meta.url)("node:path");
|
|
3161
3126
|
return _nodePath;
|
|
3162
3127
|
}
|
|
3163
3128
|
function getNodeUrl() {
|
|
3164
3129
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
3165
3130
|
const nodeRequire = getNodeModuleRef();
|
|
3166
3131
|
if (!nodeRequire) throw new Error("require not available");
|
|
3167
|
-
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(
|
|
3132
|
+
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import_meta.url)("node:url");
|
|
3168
3133
|
return _nodeUrl;
|
|
3169
3134
|
}
|
|
3170
3135
|
function getDirname(importMetaUrl) {
|
|
@@ -3173,15 +3138,19 @@ function getDirname(importMetaUrl) {
|
|
|
3173
3138
|
const nodeUrl = getNodeUrl();
|
|
3174
3139
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
3175
3140
|
}
|
|
3176
|
-
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3141
|
+
var import_meta, isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3177
3142
|
var init_esmHelpers = __esm({
|
|
3178
3143
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3144
|
+
"use strict";
|
|
3145
|
+
import_meta = {};
|
|
3179
3146
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3180
3147
|
nodeModuleRef = null;
|
|
3181
3148
|
_nodePath = null;
|
|
3182
3149
|
_nodeUrl = null;
|
|
3183
3150
|
}
|
|
3184
3151
|
});
|
|
3152
|
+
|
|
3153
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3185
3154
|
function platformKey() {
|
|
3186
3155
|
if (isBrowser2) return "browser";
|
|
3187
3156
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3197,7 +3166,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3197
3166
|
}
|
|
3198
3167
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3199
3168
|
if (envPath) {
|
|
3200
|
-
if (
|
|
3169
|
+
if (fs.existsSync(envPath)) {
|
|
3201
3170
|
return { path: envPath, source: "env", platform, tried };
|
|
3202
3171
|
}
|
|
3203
3172
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3206,7 +3175,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3206
3175
|
for (const pkg of prebuiltPkgs) {
|
|
3207
3176
|
try {
|
|
3208
3177
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3209
|
-
if (
|
|
3178
|
+
if (fs.existsSync(candidate)) {
|
|
3210
3179
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3211
3180
|
}
|
|
3212
3181
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3217,13 +3186,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3217
3186
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3218
3187
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3219
3188
|
if (runtimeDir) {
|
|
3220
|
-
for (const depth of ["..",
|
|
3221
|
-
const pkgRoot =
|
|
3189
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3190
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3222
3191
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3223
3192
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3224
|
-
const candidate =
|
|
3193
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3225
3194
|
tried.push(`self-bundled:${candidate}`);
|
|
3226
|
-
if (
|
|
3195
|
+
if (fs.existsSync(candidate)) {
|
|
3227
3196
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3228
3197
|
}
|
|
3229
3198
|
}
|
|
@@ -3235,39 +3204,44 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3235
3204
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3236
3205
|
const localCandidates = [];
|
|
3237
3206
|
for (const bin of BINARY_NAMES) {
|
|
3238
|
-
localCandidates.push(
|
|
3239
|
-
localCandidates.push(
|
|
3240
|
-
localCandidates.push(
|
|
3241
|
-
localCandidates.push(
|
|
3207
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3208
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3209
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3210
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3242
3211
|
}
|
|
3243
3212
|
for (const startDir of [cwd2, base]) {
|
|
3244
3213
|
let dir = startDir;
|
|
3245
3214
|
for (let i = 0; i < 6; i++) {
|
|
3246
|
-
const nativeDir =
|
|
3215
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3247
3216
|
for (const bin of BINARY_NAMES) {
|
|
3248
|
-
localCandidates.push(
|
|
3249
|
-
localCandidates.push(
|
|
3250
|
-
localCandidates.push(
|
|
3251
|
-
localCandidates.push(
|
|
3217
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3218
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3219
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3220
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3252
3221
|
}
|
|
3253
|
-
const parent =
|
|
3222
|
+
const parent = path.resolve(dir, "..");
|
|
3254
3223
|
if (parent === dir) break;
|
|
3255
3224
|
dir = parent;
|
|
3256
3225
|
}
|
|
3257
3226
|
}
|
|
3258
3227
|
for (const candidate of localCandidates) {
|
|
3259
3228
|
tried.push(`local:${candidate}`);
|
|
3260
|
-
if (
|
|
3229
|
+
if (fs.existsSync(candidate)) {
|
|
3261
3230
|
return { path: candidate, source: "local", platform, tried };
|
|
3262
3231
|
}
|
|
3263
3232
|
}
|
|
3264
3233
|
return { path: null, source: "not-found", platform, tried };
|
|
3265
3234
|
}
|
|
3266
|
-
var isBrowser2, _require, PLATFORM_MAP;
|
|
3235
|
+
var import_node_module, fs, path, import_meta2, isBrowser2, _require, PLATFORM_MAP;
|
|
3267
3236
|
var init_native_resolution = __esm({
|
|
3268
3237
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3238
|
+
"use strict";
|
|
3239
|
+
import_node_module = require("module");
|
|
3240
|
+
fs = __toESM(require("fs"));
|
|
3241
|
+
path = __toESM(require("path"));
|
|
3242
|
+
import_meta2 = {};
|
|
3269
3243
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3270
|
-
_require = typeof
|
|
3244
|
+
_require = typeof require !== "undefined" ? require : (0, import_node_module.createRequire)(import_meta2.url);
|
|
3271
3245
|
PLATFORM_MAP = {
|
|
3272
3246
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
3273
3247
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -3278,6 +3252,8 @@ var init_native_resolution = __esm({
|
|
|
3278
3252
|
};
|
|
3279
3253
|
}
|
|
3280
3254
|
});
|
|
3255
|
+
|
|
3256
|
+
// packages/domain/shared/src/index.ts
|
|
3281
3257
|
function createLogger(namespace) {
|
|
3282
3258
|
const prefix = `[${namespace}]`;
|
|
3283
3259
|
return {
|
|
@@ -3320,9 +3296,9 @@ function loadNativeBinding(options) {
|
|
|
3320
3296
|
const { runtimeDir, candidates, isValid } = options;
|
|
3321
3297
|
const loadErrors = [];
|
|
3322
3298
|
for (const candidate of candidates) {
|
|
3323
|
-
const candidatePath =
|
|
3299
|
+
const candidatePath = import_node_path.default.resolve(runtimeDir, candidate);
|
|
3324
3300
|
try {
|
|
3325
|
-
if (!
|
|
3301
|
+
if (!import_node_fs.default.existsSync(candidatePath) && !import_node_fs.default.existsSync(candidatePath + ".node")) {
|
|
3326
3302
|
continue;
|
|
3327
3303
|
}
|
|
3328
3304
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3354,9 +3330,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3354
3330
|
}
|
|
3355
3331
|
}
|
|
3356
3332
|
if (!includeDefaultCandidates) return candidates;
|
|
3357
|
-
if (
|
|
3333
|
+
if (import_node_fs.default.existsSync(runtimeDir)) {
|
|
3358
3334
|
try {
|
|
3359
|
-
for (const entry of
|
|
3335
|
+
for (const entry of import_node_fs.default.readdirSync(runtimeDir)) {
|
|
3360
3336
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3361
3337
|
}
|
|
3362
3338
|
} catch {
|
|
@@ -3365,31 +3341,38 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3365
3341
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3366
3342
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3367
3343
|
for (const bin of BINARY_NAMES) {
|
|
3368
|
-
candidates.push(
|
|
3369
|
-
candidates.push(
|
|
3370
|
-
candidates.push(
|
|
3371
|
-
candidates.push(
|
|
3372
|
-
candidates.push(
|
|
3373
|
-
candidates.push(
|
|
3374
|
-
candidates.push(
|
|
3375
|
-
candidates.push(
|
|
3376
|
-
candidates.push(
|
|
3344
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.node`));
|
|
3345
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3346
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3347
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3348
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3349
|
+
candidates.push(import_node_path.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3350
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3351
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3352
|
+
candidates.push(import_node_path.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3377
3353
|
}
|
|
3378
3354
|
return Array.from(new Set(candidates));
|
|
3379
3355
|
}
|
|
3380
3356
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3381
|
-
if (dir) return
|
|
3357
|
+
if (dir) return import_node_path.default.resolve(dir);
|
|
3382
3358
|
try {
|
|
3383
|
-
return
|
|
3359
|
+
return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3384
3360
|
} catch {
|
|
3385
3361
|
return process.cwd();
|
|
3386
3362
|
}
|
|
3387
3363
|
}
|
|
3388
|
-
var TwError, _require2;
|
|
3364
|
+
var import_node_crypto, import_node_fs, import_node_path, import_node_url, import_node_module2, import_meta3, TwError, _require2;
|
|
3389
3365
|
var init_src = __esm({
|
|
3390
3366
|
"packages/domain/shared/src/index.ts"() {
|
|
3367
|
+
"use strict";
|
|
3368
|
+
import_node_crypto = require("crypto");
|
|
3369
|
+
import_node_fs = __toESM(require("fs"));
|
|
3370
|
+
import_node_path = __toESM(require("path"));
|
|
3371
|
+
import_node_url = require("url");
|
|
3372
|
+
import_node_module2 = require("module");
|
|
3391
3373
|
init_esmHelpers();
|
|
3392
3374
|
init_native_resolution();
|
|
3375
|
+
import_meta3 = {};
|
|
3393
3376
|
TwError = class _TwError extends Error {
|
|
3394
3377
|
/** @deprecated Gunakan source */
|
|
3395
3378
|
domain;
|
|
@@ -3442,7 +3425,7 @@ var init_src = __esm({
|
|
|
3442
3425
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3443
3426
|
}
|
|
3444
3427
|
};
|
|
3445
|
-
_require2 =
|
|
3428
|
+
_require2 = (0, import_node_module2.createRequire)(import_meta3.url);
|
|
3446
3429
|
}
|
|
3447
3430
|
});
|
|
3448
3431
|
|
|
@@ -3479,8 +3462,8 @@ function getDirname2() {
|
|
|
3479
3462
|
if (typeof __dirname !== "undefined") {
|
|
3480
3463
|
return __dirname;
|
|
3481
3464
|
}
|
|
3482
|
-
if (typeof
|
|
3483
|
-
return
|
|
3465
|
+
if (typeof import_meta4 !== "undefined" && import_meta4.url) {
|
|
3466
|
+
return import_node_path2.default.dirname((0, import_node_url2.fileURLToPath)(import_meta4.url));
|
|
3484
3467
|
}
|
|
3485
3468
|
return process.cwd();
|
|
3486
3469
|
}
|
|
@@ -3685,13 +3668,17 @@ function hasNativeWatchBinding() {
|
|
|
3685
3668
|
return false;
|
|
3686
3669
|
}
|
|
3687
3670
|
}
|
|
3688
|
-
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3671
|
+
var import_node_path2, import_node_url2, import_meta4, log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3689
3672
|
var init_native_bridge = __esm({
|
|
3690
3673
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3674
|
+
"use strict";
|
|
3675
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
3676
|
+
import_node_url2 = require("url");
|
|
3691
3677
|
init_src();
|
|
3678
|
+
import_meta4 = {};
|
|
3692
3679
|
log = createDebugLogger("scanner:native");
|
|
3693
|
-
isValidScannerBinding = (
|
|
3694
|
-
const candidate =
|
|
3680
|
+
isValidScannerBinding = (module2) => {
|
|
3681
|
+
const candidate = module2;
|
|
3695
3682
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
3696
3683
|
};
|
|
3697
3684
|
createScannerBridgeLoader = () => {
|
|
@@ -3768,13 +3755,15 @@ var init_native_bridge = __esm({
|
|
|
3768
3755
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3769
3756
|
}
|
|
3770
3757
|
});
|
|
3758
|
+
|
|
3759
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3771
3760
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3772
|
-
const dir = cacheDir ?
|
|
3773
|
-
return
|
|
3761
|
+
const dir = cacheDir ? import_node_path3.default.resolve(rootDir, cacheDir) : import_node_path3.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3762
|
+
return import_node_path3.default.join(dir, "scanner-cache.json");
|
|
3774
3763
|
}
|
|
3775
3764
|
function readCache(rootDir, cacheDir) {
|
|
3776
3765
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3777
|
-
|
|
3766
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3778
3767
|
const result = cacheReadNative(cachePath);
|
|
3779
3768
|
if (!result) return [];
|
|
3780
3769
|
return result.entries.map((e) => ({
|
|
@@ -3789,7 +3778,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3789
3778
|
}
|
|
3790
3779
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3791
3780
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3792
|
-
|
|
3781
|
+
import_node_fs2.default.mkdirSync(import_node_path3.default.dirname(cachePath), { recursive: true });
|
|
3793
3782
|
const success = cacheWriteNative(cachePath, entries);
|
|
3794
3783
|
if (!success) {
|
|
3795
3784
|
throw new Error(
|
|
@@ -3808,11 +3797,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3808
3797
|
nowMs
|
|
3809
3798
|
);
|
|
3810
3799
|
}
|
|
3800
|
+
var import_node_fs2, import_node_path3, STALE_THRESHOLD_MS;
|
|
3811
3801
|
var init_cache_native = __esm({
|
|
3812
3802
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3803
|
+
"use strict";
|
|
3804
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
3805
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
3813
3806
|
init_native_bridge();
|
|
3807
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3814
3808
|
}
|
|
3815
3809
|
});
|
|
3810
|
+
|
|
3811
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3816
3812
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3817
3813
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3818
3814
|
if (native !== null) return native;
|
|
@@ -3830,7 +3826,7 @@ function mergeResults(batchResults) {
|
|
|
3830
3826
|
}
|
|
3831
3827
|
function runChunkInWorker(filePaths) {
|
|
3832
3828
|
return new Promise((resolve2, reject) => {
|
|
3833
|
-
const worker = new
|
|
3829
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
3834
3830
|
workerData: { filePaths }
|
|
3835
3831
|
});
|
|
3836
3832
|
worker.once("message", (payload) => {
|
|
@@ -3850,10 +3846,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3850
3846
|
const {
|
|
3851
3847
|
extensions = DEFAULT_EXTENSIONS,
|
|
3852
3848
|
ignoreDirs = DEFAULT_IGNORES,
|
|
3853
|
-
maxWorkers = Math.max(1,
|
|
3849
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
3854
3850
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3855
3851
|
} = options;
|
|
3856
|
-
const files = collectFiles(
|
|
3852
|
+
const files = collectFiles(import_node_path4.default.resolve(rootDir), extensions, ignoreDirs);
|
|
3857
3853
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3858
3854
|
return mergeResults(batchExtractClassesNative(files));
|
|
3859
3855
|
}
|
|
@@ -3869,33 +3865,43 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3869
3865
|
}
|
|
3870
3866
|
return mergeResults(allResults);
|
|
3871
3867
|
}
|
|
3872
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3868
|
+
var import_node_worker_threads, import_node_path4, import_node_os, import_node_url3, import_meta5, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3873
3869
|
var init_parallel_scanner = __esm({
|
|
3874
3870
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3871
|
+
"use strict";
|
|
3872
|
+
import_node_worker_threads = require("worker_threads");
|
|
3873
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3874
|
+
import_node_os = require("os");
|
|
3875
|
+
import_node_url3 = require("url");
|
|
3875
3876
|
init_src2();
|
|
3876
3877
|
init_native_bridge();
|
|
3878
|
+
import_meta5 = {};
|
|
3877
3879
|
PARALLEL_THRESHOLD = 50;
|
|
3878
3880
|
DEFAULT_CHUNK_SIZE = 150;
|
|
3879
|
-
if (!
|
|
3880
|
-
const { filePaths } =
|
|
3881
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
3882
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
3881
3883
|
try {
|
|
3882
3884
|
const results = batchExtractClassesNative(filePaths);
|
|
3883
3885
|
const msg = { ok: true, results };
|
|
3884
|
-
|
|
3886
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3885
3887
|
} catch (error) {
|
|
3886
3888
|
const msg = {
|
|
3887
3889
|
ok: false,
|
|
3888
3890
|
error: error instanceof Error ? error.message : String(error)
|
|
3889
3891
|
};
|
|
3890
|
-
|
|
3892
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
3891
3893
|
}
|
|
3892
3894
|
}
|
|
3893
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3895
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(import_meta5.url);
|
|
3894
3896
|
}
|
|
3895
3897
|
});
|
|
3896
|
-
|
|
3898
|
+
|
|
3899
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3900
|
+
var import_zod, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3897
3901
|
var init_schemas = __esm({
|
|
3898
3902
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3903
|
+
"use strict";
|
|
3904
|
+
import_zod = require("zod");
|
|
3899
3905
|
init_src();
|
|
3900
3906
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3901
3907
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3915,40 +3921,40 @@ var init_schemas = __esm({
|
|
|
3915
3921
|
parsed.error
|
|
3916
3922
|
);
|
|
3917
3923
|
};
|
|
3918
|
-
NonNegativeIntegerSchema =
|
|
3919
|
-
ScanWorkspaceOptionsSchema =
|
|
3920
|
-
includeExtensions:
|
|
3921
|
-
ignoreDirectories:
|
|
3922
|
-
useCache:
|
|
3923
|
-
cacheDir:
|
|
3924
|
-
smartInvalidation:
|
|
3924
|
+
NonNegativeIntegerSchema = import_zod.z.number().int().min(0);
|
|
3925
|
+
ScanWorkspaceOptionsSchema = import_zod.z.object({
|
|
3926
|
+
includeExtensions: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3927
|
+
ignoreDirectories: import_zod.z.array(import_zod.z.string()).optional(),
|
|
3928
|
+
useCache: import_zod.z.boolean().optional(),
|
|
3929
|
+
cacheDir: import_zod.z.string().min(1).optional(),
|
|
3930
|
+
smartInvalidation: import_zod.z.boolean().optional()
|
|
3925
3931
|
});
|
|
3926
|
-
ScanFileResultSchema =
|
|
3927
|
-
file:
|
|
3928
|
-
classes:
|
|
3929
|
-
hash:
|
|
3932
|
+
ScanFileResultSchema = import_zod.z.object({
|
|
3933
|
+
file: import_zod.z.string(),
|
|
3934
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
3935
|
+
hash: import_zod.z.string().optional()
|
|
3930
3936
|
});
|
|
3931
|
-
ScanWorkspaceResultSchema =
|
|
3932
|
-
files:
|
|
3937
|
+
ScanWorkspaceResultSchema = import_zod.z.object({
|
|
3938
|
+
files: import_zod.z.array(ScanFileResultSchema),
|
|
3933
3939
|
totalFiles: NonNegativeIntegerSchema,
|
|
3934
|
-
uniqueClasses:
|
|
3940
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
3935
3941
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3936
3942
|
message: "scan result totalFiles must match files.length",
|
|
3937
3943
|
path: ["totalFiles"]
|
|
3938
3944
|
});
|
|
3939
|
-
|
|
3940
|
-
rootDir:
|
|
3945
|
+
ScannerWorkerRequestSchema = import_zod.z.object({
|
|
3946
|
+
rootDir: import_zod.z.string().min(1),
|
|
3941
3947
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3942
3948
|
});
|
|
3943
|
-
ScannerWorkerSuccessMessageSchema =
|
|
3944
|
-
ok:
|
|
3949
|
+
ScannerWorkerSuccessMessageSchema = import_zod.z.object({
|
|
3950
|
+
ok: import_zod.z.literal(true),
|
|
3945
3951
|
result: ScanWorkspaceResultSchema
|
|
3946
3952
|
});
|
|
3947
|
-
ScannerWorkerErrorMessageSchema =
|
|
3948
|
-
ok:
|
|
3949
|
-
error:
|
|
3953
|
+
ScannerWorkerErrorMessageSchema = import_zod.z.object({
|
|
3954
|
+
ok: import_zod.z.literal(false),
|
|
3955
|
+
error: import_zod.z.string().optional()
|
|
3950
3956
|
});
|
|
3951
|
-
ScannerWorkerMessageSchema =
|
|
3957
|
+
ScannerWorkerMessageSchema = import_zod.z.union([
|
|
3952
3958
|
ScannerWorkerSuccessMessageSchema,
|
|
3953
3959
|
ScannerWorkerErrorMessageSchema
|
|
3954
3960
|
]);
|
|
@@ -3978,8 +3984,8 @@ function getRuntimeDir() {
|
|
|
3978
3984
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3979
3985
|
return __dirname;
|
|
3980
3986
|
}
|
|
3981
|
-
if (typeof
|
|
3982
|
-
return
|
|
3987
|
+
if (typeof import_meta6 !== "undefined" && import_meta6.url) {
|
|
3988
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
|
|
3983
3989
|
}
|
|
3984
3990
|
return process.cwd();
|
|
3985
3991
|
}
|
|
@@ -3988,18 +3994,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
3988
3994
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3989
3995
|
return __dirname;
|
|
3990
3996
|
}
|
|
3991
|
-
if (typeof
|
|
3992
|
-
return
|
|
3997
|
+
if (typeof import_meta6 !== "undefined" && import_meta6.url) {
|
|
3998
|
+
return import_node_path5.default.dirname((0, import_node_url4.fileURLToPath)(import_meta6.url));
|
|
3993
3999
|
}
|
|
3994
4000
|
return process.cwd();
|
|
3995
4001
|
})();
|
|
3996
4002
|
const candidates = [
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4003
|
+
import_node_path5.default.resolve(runtimeDir, "worker.cjs"),
|
|
4004
|
+
import_node_path5.default.resolve(runtimeDir, "worker.js"),
|
|
4005
|
+
import_node_path5.default.resolve(runtimeDir, "worker.ts")
|
|
4000
4006
|
];
|
|
4001
4007
|
for (const candidate of candidates) {
|
|
4002
|
-
if (
|
|
4008
|
+
if (import_node_fs3.default.existsSync(candidate)) return candidate;
|
|
4003
4009
|
}
|
|
4004
4010
|
return null;
|
|
4005
4011
|
}
|
|
@@ -4011,7 +4017,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4011
4017
|
}
|
|
4012
4018
|
return new Promise((resolve2, reject) => {
|
|
4013
4019
|
const settleState = { settled: false };
|
|
4014
|
-
const worker = new
|
|
4020
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4015
4021
|
const timeout = setTimeout(() => {
|
|
4016
4022
|
if (!settleState.settled) {
|
|
4017
4023
|
settleState.settled = true;
|
|
@@ -4056,19 +4062,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4056
4062
|
if (!currentDir) continue;
|
|
4057
4063
|
const entries = (() => {
|
|
4058
4064
|
try {
|
|
4059
|
-
return
|
|
4065
|
+
return import_node_fs3.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4060
4066
|
} catch {
|
|
4061
4067
|
return [];
|
|
4062
4068
|
}
|
|
4063
4069
|
})();
|
|
4064
4070
|
for (const entry of entries) {
|
|
4065
|
-
const fullPath =
|
|
4071
|
+
const fullPath = import_node_path5.default.join(currentDir, entry.name);
|
|
4066
4072
|
if (entry.isDirectory()) {
|
|
4067
4073
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4068
4074
|
continue;
|
|
4069
4075
|
}
|
|
4070
4076
|
if (!entry.isFile()) continue;
|
|
4071
|
-
if (!extensionSet.has(
|
|
4077
|
+
if (!extensionSet.has(import_node_path5.default.extname(entry.name))) continue;
|
|
4072
4078
|
candidates.push(fullPath);
|
|
4073
4079
|
}
|
|
4074
4080
|
}
|
|
@@ -4095,7 +4101,7 @@ function scanSource(source) {
|
|
|
4095
4101
|
);
|
|
4096
4102
|
}
|
|
4097
4103
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4098
|
-
return includeExtensions.includes(
|
|
4104
|
+
return includeExtensions.includes(import_node_path5.default.extname(filePath));
|
|
4099
4105
|
}
|
|
4100
4106
|
function scanFile(filePath) {
|
|
4101
4107
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4115,7 +4121,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4115
4121
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4116
4122
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4117
4123
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4118
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4124
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4119
4125
|
const files = [];
|
|
4120
4126
|
const unique = /* @__PURE__ */ new Set();
|
|
4121
4127
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4155,7 +4161,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4155
4161
|
for (const filePath of candidates) {
|
|
4156
4162
|
const stat = (() => {
|
|
4157
4163
|
try {
|
|
4158
|
-
return
|
|
4164
|
+
return import_node_fs3.default.statSync(filePath);
|
|
4159
4165
|
} catch {
|
|
4160
4166
|
return null;
|
|
4161
4167
|
}
|
|
@@ -4181,7 +4187,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4181
4187
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4182
4188
|
const content = (() => {
|
|
4183
4189
|
try {
|
|
4184
|
-
return
|
|
4190
|
+
return import_node_fs3.default.readFileSync(filePath, "utf8");
|
|
4185
4191
|
} catch {
|
|
4186
4192
|
return null;
|
|
4187
4193
|
}
|
|
@@ -4262,9 +4268,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4262
4268
|
return scanWorkspace(rootDir, normalizedOptions);
|
|
4263
4269
|
}
|
|
4264
4270
|
}
|
|
4265
|
-
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4271
|
+
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;
|
|
4266
4272
|
var init_src2 = __esm({
|
|
4267
4273
|
"packages/domain/scanner/src/index.ts"() {
|
|
4274
|
+
"use strict";
|
|
4275
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
4276
|
+
import_node_module3 = require("module");
|
|
4277
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4278
|
+
import_node_url4 = require("url");
|
|
4279
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4268
4280
|
init_src();
|
|
4269
4281
|
init_cache_native();
|
|
4270
4282
|
init_native_bridge();
|
|
@@ -4272,6 +4284,7 @@ var init_src2 = __esm({
|
|
|
4272
4284
|
init_schemas();
|
|
4273
4285
|
init_schemas();
|
|
4274
4286
|
init_native_bridge();
|
|
4287
|
+
import_meta6 = {};
|
|
4275
4288
|
log2 = createLogger("scanner");
|
|
4276
4289
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4277
4290
|
createNativeParserLoader = () => {
|
|
@@ -4285,7 +4298,7 @@ var init_src2 = __esm({
|
|
|
4285
4298
|
const loadNativeParserBinding = () => {
|
|
4286
4299
|
if (_state.binding !== void 0) return _state.binding;
|
|
4287
4300
|
const runtimeDir = getRuntimeDir();
|
|
4288
|
-
const req =
|
|
4301
|
+
const req = (0, import_node_module3.createRequire)(import_node_path5.default.join(runtimeDir, "noop.cjs"));
|
|
4289
4302
|
const _platform = process.platform;
|
|
4290
4303
|
const _arch = process.arch;
|
|
4291
4304
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4293,27 +4306,27 @@ var init_src2 = __esm({
|
|
|
4293
4306
|
const candidates = [
|
|
4294
4307
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4295
4308
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4309
|
+
import_node_path5.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4310
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4311
|
+
import_node_path5.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4299
4312
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4300
4313
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4314
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4315
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4316
|
+
import_node_path5.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4304
4317
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4305
|
-
|
|
4306
|
-
|
|
4318
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4319
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4307
4320
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4308
|
-
|
|
4309
|
-
|
|
4321
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4322
|
+
import_node_path5.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4310
4323
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4324
|
+
import_node_path5.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4325
|
+
import_node_path5.default.resolve(process.cwd(), "native/build/Release/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(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4329
|
+
import_node_path5.default.resolve(
|
|
4317
4330
|
runtimeDir,
|
|
4318
4331
|
"..",
|
|
4319
4332
|
"..",
|
|
@@ -4325,7 +4338,7 @@ var init_src2 = __esm({
|
|
|
4325
4338
|
)
|
|
4326
4339
|
];
|
|
4327
4340
|
for (const fullPath of candidates) {
|
|
4328
|
-
if (!
|
|
4341
|
+
if (!import_node_fs3.default.existsSync(fullPath)) continue;
|
|
4329
4342
|
try {
|
|
4330
4343
|
const required = req(fullPath);
|
|
4331
4344
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4357,6 +4370,8 @@ var init_src2 = __esm({
|
|
|
4357
4370
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4358
4371
|
}
|
|
4359
4372
|
});
|
|
4373
|
+
|
|
4374
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4360
4375
|
function formatErrorMessage(error) {
|
|
4361
4376
|
return error instanceof Error ? error.message : String(error);
|
|
4362
4377
|
}
|
|
@@ -4367,7 +4382,7 @@ function isRecord(value) {
|
|
|
4367
4382
|
}
|
|
4368
4383
|
async function pathExists(filePath) {
|
|
4369
4384
|
try {
|
|
4370
|
-
await
|
|
4385
|
+
await import_node_fs4.default.promises.access(filePath, import_node_fs4.default.constants.F_OK);
|
|
4371
4386
|
return true;
|
|
4372
4387
|
} catch {
|
|
4373
4388
|
return false;
|
|
@@ -4381,9 +4396,11 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4381
4396
|
if (!Number.isFinite(value)) return DEFAULT_FREQUENT_THRESHOLD;
|
|
4382
4397
|
return Math.max(1, Math.trunc(value));
|
|
4383
4398
|
}
|
|
4384
|
-
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4399
|
+
var import_node_fs4, DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4385
4400
|
var init_utils = __esm({
|
|
4386
4401
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4402
|
+
"use strict";
|
|
4403
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
4387
4404
|
init_src();
|
|
4388
4405
|
DEFAULT_TOP_LIMIT = 10;
|
|
4389
4406
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4401,7 +4418,7 @@ async function requireNativeBinding() {
|
|
|
4401
4418
|
if (binding?.analyzeClasses) return binding;
|
|
4402
4419
|
const runtimeDir = resolveRuntimeDir(
|
|
4403
4420
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4404
|
-
|
|
4421
|
+
import_meta7.url
|
|
4405
4422
|
);
|
|
4406
4423
|
const candidates = resolveNativeBindingCandidates({
|
|
4407
4424
|
runtimeDir,
|
|
@@ -4431,13 +4448,15 @@ async function requireNativeCssCompiler() {
|
|
|
4431
4448
|
if (typeof binding.compileCss === "function") return binding;
|
|
4432
4449
|
throw new Error(`Native analyzer compileCss binding is missing.`);
|
|
4433
4450
|
}
|
|
4434
|
-
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4451
|
+
var import_meta7, isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4435
4452
|
var init_binding = __esm({
|
|
4436
4453
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4454
|
+
"use strict";
|
|
4437
4455
|
init_src();
|
|
4438
4456
|
init_utils();
|
|
4439
|
-
|
|
4440
|
-
|
|
4457
|
+
import_meta7 = {};
|
|
4458
|
+
isAnalyzerModule = (module2) => {
|
|
4459
|
+
const candidate = module2;
|
|
4441
4460
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
4442
4461
|
};
|
|
4443
4462
|
createAnalyzerBindingLoader = () => {
|
|
@@ -4447,7 +4466,7 @@ var init_binding = __esm({
|
|
|
4447
4466
|
_state.bindingPromise = (async () => {
|
|
4448
4467
|
const runtimeDir = resolveRuntimeDir(
|
|
4449
4468
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
4450
|
-
|
|
4469
|
+
import_meta7.url
|
|
4451
4470
|
);
|
|
4452
4471
|
const candidates = resolveNativeBindingCandidates({
|
|
4453
4472
|
runtimeDir,
|
|
@@ -4484,10 +4503,14 @@ var init_binding = __esm({
|
|
|
4484
4503
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4485
4504
|
}
|
|
4486
4505
|
});
|
|
4487
|
-
|
|
4506
|
+
|
|
4507
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4508
|
+
var import_zod2, formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4488
4509
|
var init_schemas2 = __esm({
|
|
4489
4510
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4511
|
+
"use strict";
|
|
4490
4512
|
init_src();
|
|
4513
|
+
import_zod2 = require("zod");
|
|
4491
4514
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4492
4515
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4493
4516
|
).join(".") : "<root>";
|
|
@@ -4511,76 +4534,76 @@ var init_schemas2 = __esm({
|
|
|
4511
4534
|
parsed.error
|
|
4512
4535
|
);
|
|
4513
4536
|
};
|
|
4514
|
-
CountSchema =
|
|
4515
|
-
|
|
4516
|
-
name:
|
|
4537
|
+
CountSchema = import_zod2.z.number().int().min(0);
|
|
4538
|
+
ClassUsageSchema = import_zod2.z.object({
|
|
4539
|
+
name: import_zod2.z.string(),
|
|
4517
4540
|
count: CountSchema,
|
|
4518
|
-
isUnused:
|
|
4519
|
-
isConflict:
|
|
4541
|
+
isUnused: import_zod2.z.boolean().optional(),
|
|
4542
|
+
isConflict: import_zod2.z.boolean().optional()
|
|
4520
4543
|
});
|
|
4521
|
-
|
|
4522
|
-
className:
|
|
4523
|
-
variants:
|
|
4524
|
-
classes:
|
|
4525
|
-
message:
|
|
4544
|
+
ClassConflictSchema = import_zod2.z.object({
|
|
4545
|
+
className: import_zod2.z.string(),
|
|
4546
|
+
variants: import_zod2.z.array(import_zod2.z.string()),
|
|
4547
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
4548
|
+
message: import_zod2.z.string()
|
|
4526
4549
|
});
|
|
4527
|
-
ClassCountSchema =
|
|
4528
|
-
name:
|
|
4550
|
+
ClassCountSchema = import_zod2.z.object({
|
|
4551
|
+
name: import_zod2.z.string(),
|
|
4529
4552
|
count: CountSchema
|
|
4530
4553
|
});
|
|
4531
|
-
NativeReportSchema =
|
|
4532
|
-
root:
|
|
4554
|
+
NativeReportSchema = import_zod2.z.object({
|
|
4555
|
+
root: import_zod2.z.string(),
|
|
4533
4556
|
totalFiles: CountSchema,
|
|
4534
4557
|
uniqueClassCount: CountSchema,
|
|
4535
4558
|
totalClassOccurrences: CountSchema,
|
|
4536
|
-
topClasses:
|
|
4537
|
-
duplicateCandidates:
|
|
4538
|
-
safelist:
|
|
4559
|
+
topClasses: import_zod2.z.array(ClassCountSchema),
|
|
4560
|
+
duplicateCandidates: import_zod2.z.array(ClassCountSchema),
|
|
4561
|
+
safelist: import_zod2.z.array(import_zod2.z.string())
|
|
4539
4562
|
});
|
|
4540
|
-
NativeCssCompileResultSchema =
|
|
4541
|
-
css:
|
|
4542
|
-
resolvedClasses:
|
|
4543
|
-
unknownClasses:
|
|
4563
|
+
NativeCssCompileResultSchema = import_zod2.z.object({
|
|
4564
|
+
css: import_zod2.z.string(),
|
|
4565
|
+
resolvedClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4566
|
+
unknownClasses: import_zod2.z.array(import_zod2.z.string()),
|
|
4544
4567
|
sizeBytes: CountSchema
|
|
4545
4568
|
});
|
|
4546
|
-
AnalyzerClassStatsSchema =
|
|
4547
|
-
top:
|
|
4569
|
+
AnalyzerClassStatsSchema = import_zod2.z.object({
|
|
4570
|
+
top: import_zod2.z.number({
|
|
4548
4571
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4549
4572
|
}).finite().optional(),
|
|
4550
|
-
frequentThreshold:
|
|
4573
|
+
frequentThreshold: import_zod2.z.number({
|
|
4551
4574
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4552
4575
|
}).finite().optional()
|
|
4553
4576
|
});
|
|
4554
|
-
AnalyzerSemanticOptionsSchema =
|
|
4555
|
-
tailwindConfigPath:
|
|
4577
|
+
AnalyzerSemanticOptionsSchema = import_zod2.z.object({
|
|
4578
|
+
tailwindConfigPath: import_zod2.z.string({
|
|
4556
4579
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4557
4580
|
}).min(
|
|
4558
4581
|
1,
|
|
4559
4582
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4560
4583
|
).optional()
|
|
4561
4584
|
});
|
|
4562
|
-
AnalyzerOptionsSchema =
|
|
4563
|
-
scanner:
|
|
4585
|
+
AnalyzerOptionsSchema = import_zod2.z.object({
|
|
4586
|
+
scanner: import_zod2.z.custom(
|
|
4564
4587
|
(value) => isPlainObject(value),
|
|
4565
4588
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4566
4589
|
).optional(),
|
|
4567
4590
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4568
|
-
semantic:
|
|
4569
|
-
|
|
4591
|
+
semantic: import_zod2.z.union([
|
|
4592
|
+
import_zod2.z.boolean({
|
|
4570
4593
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4571
4594
|
}),
|
|
4572
4595
|
AnalyzerSemanticOptionsSchema
|
|
4573
4596
|
]).optional(),
|
|
4574
|
-
includeClass:
|
|
4597
|
+
includeClass: import_zod2.z.custom(
|
|
4575
4598
|
(value) => typeof value === "function",
|
|
4576
4599
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4577
4600
|
).optional()
|
|
4578
4601
|
});
|
|
4579
|
-
ClassToCssOptionsSchema =
|
|
4580
|
-
prefix:
|
|
4602
|
+
ClassToCssOptionsSchema = import_zod2.z.object({
|
|
4603
|
+
prefix: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.null()], {
|
|
4581
4604
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4582
4605
|
}).optional(),
|
|
4583
|
-
strict:
|
|
4606
|
+
strict: import_zod2.z.boolean({
|
|
4584
4607
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4585
4608
|
}).optional()
|
|
4586
4609
|
});
|
|
@@ -4594,9 +4617,15 @@ var init_schemas2 = __esm({
|
|
|
4594
4617
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4595
4618
|
}
|
|
4596
4619
|
});
|
|
4597
|
-
|
|
4620
|
+
|
|
4621
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4622
|
+
var import_node_fs5, import_node_path6, import_node_url5, SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
|
|
4598
4623
|
var init_semantic = __esm({
|
|
4599
4624
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4625
|
+
"use strict";
|
|
4626
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4627
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4628
|
+
import_node_url5 = require("url");
|
|
4600
4629
|
init_binding();
|
|
4601
4630
|
init_utils();
|
|
4602
4631
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4632,11 +4661,11 @@ var init_semantic = __esm({
|
|
|
4632
4661
|
};
|
|
4633
4662
|
};
|
|
4634
4663
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4635
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4664
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path6.default.extname(configPath).toLowerCase());
|
|
4636
4665
|
};
|
|
4637
4666
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4638
4667
|
if (explicitPath) {
|
|
4639
|
-
const resolved =
|
|
4668
|
+
const resolved = import_node_path6.default.resolve(root, explicitPath);
|
|
4640
4669
|
if (!await pathExists(resolved)) return null;
|
|
4641
4670
|
return resolved;
|
|
4642
4671
|
}
|
|
@@ -4647,7 +4676,7 @@ var init_semantic = __esm({
|
|
|
4647
4676
|
"tailwind.config.mjs"
|
|
4648
4677
|
];
|
|
4649
4678
|
for (const candidate of candidates) {
|
|
4650
|
-
const fullPath =
|
|
4679
|
+
const fullPath = import_node_path6.default.resolve(root, candidate);
|
|
4651
4680
|
if (await pathExists(fullPath)) return fullPath;
|
|
4652
4681
|
}
|
|
4653
4682
|
return null;
|
|
@@ -4701,7 +4730,7 @@ var init_semantic = __esm({
|
|
|
4701
4730
|
return out;
|
|
4702
4731
|
};
|
|
4703
4732
|
collectSafelistFromSource = async (configPath) => {
|
|
4704
|
-
const source = await
|
|
4733
|
+
const source = await import_node_fs5.default.promises.readFile(configPath, "utf8");
|
|
4705
4734
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4706
4735
|
const allTokens = extractClassesNative2(source);
|
|
4707
4736
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4728,7 +4757,7 @@ var init_semantic = __esm({
|
|
|
4728
4757
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4729
4758
|
};
|
|
4730
4759
|
}
|
|
4731
|
-
const configStat = await
|
|
4760
|
+
const configStat = await import_node_fs5.default.promises.stat(configPath).catch(() => null);
|
|
4732
4761
|
if (configStat) {
|
|
4733
4762
|
const cached = tailwindConfigCache.get(configPath);
|
|
4734
4763
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4741,7 +4770,7 @@ var init_semantic = __esm({
|
|
|
4741
4770
|
const result = await (async () => {
|
|
4742
4771
|
try {
|
|
4743
4772
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
4744
|
-
const imported = await import(`${
|
|
4773
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
4745
4774
|
const candidate = imported.default ?? imported;
|
|
4746
4775
|
if (isRecord(candidate)) {
|
|
4747
4776
|
return { config: candidate, warning: void 0 };
|
|
@@ -4852,6 +4881,8 @@ var init_semantic = __esm({
|
|
|
4852
4881
|
};
|
|
4853
4882
|
}
|
|
4854
4883
|
});
|
|
4884
|
+
|
|
4885
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4855
4886
|
function normalizeScan(scan, includeClass) {
|
|
4856
4887
|
if (!includeClass) return scan;
|
|
4857
4888
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4906,7 +4937,7 @@ async function buildDistribution(usages, native) {
|
|
|
4906
4937
|
}
|
|
4907
4938
|
async function analyzeWorkspace(root, options = {}) {
|
|
4908
4939
|
const startedAtMs = Date.now();
|
|
4909
|
-
const resolvedRoot =
|
|
4940
|
+
const resolvedRoot = import_node_path7.default.resolve(root);
|
|
4910
4941
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4911
4942
|
const scan = await (async () => {
|
|
4912
4943
|
const scanStartedAtMs = Date.now();
|
|
@@ -5008,8 +5039,11 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
5008
5039
|
...semanticReport ? { semantic: semanticReport } : {}
|
|
5009
5040
|
};
|
|
5010
5041
|
}
|
|
5042
|
+
var import_node_path7;
|
|
5011
5043
|
var init_analyzeWorkspace = __esm({
|
|
5012
5044
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5045
|
+
"use strict";
|
|
5046
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
5013
5047
|
init_src2();
|
|
5014
5048
|
init_binding();
|
|
5015
5049
|
init_schemas2();
|
|
@@ -5022,6 +5056,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
5022
5056
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
5023
5057
|
var init_classToCss = __esm({
|
|
5024
5058
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5059
|
+
"use strict";
|
|
5025
5060
|
init_binding();
|
|
5026
5061
|
init_schemas2();
|
|
5027
5062
|
init_utils();
|
|
@@ -5142,6 +5177,7 @@ __export(src_exports2, {
|
|
|
5142
5177
|
var __internal;
|
|
5143
5178
|
var init_src3 = __esm({
|
|
5144
5179
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5180
|
+
"use strict";
|
|
5145
5181
|
init_analyzeWorkspace();
|
|
5146
5182
|
init_classToCss();
|
|
5147
5183
|
init_schemas2();
|
|
@@ -5160,9 +5196,11 @@ var init_src3 = __esm({
|
|
|
5160
5196
|
};
|
|
5161
5197
|
}
|
|
5162
5198
|
});
|
|
5199
|
+
|
|
5200
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5163
5201
|
async function pathExists2(filePath) {
|
|
5164
5202
|
try {
|
|
5165
|
-
await
|
|
5203
|
+
await import_promises.default.access(filePath);
|
|
5166
5204
|
return true;
|
|
5167
5205
|
} catch {
|
|
5168
5206
|
return false;
|
|
@@ -5170,7 +5208,7 @@ async function pathExists2(filePath) {
|
|
|
5170
5208
|
}
|
|
5171
5209
|
async function readFileSafe(filePath) {
|
|
5172
5210
|
try {
|
|
5173
|
-
return await
|
|
5211
|
+
return await import_promises.default.readFile(filePath, "utf8");
|
|
5174
5212
|
} catch {
|
|
5175
5213
|
return null;
|
|
5176
5214
|
}
|
|
@@ -5189,22 +5227,27 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5189
5227
|
options.onDryRun?.(`write ${filePath}`);
|
|
5190
5228
|
return;
|
|
5191
5229
|
}
|
|
5192
|
-
await
|
|
5193
|
-
await
|
|
5230
|
+
await import_promises.default.mkdir(import_node_path8.default.dirname(filePath), { recursive: true });
|
|
5231
|
+
await import_promises.default.writeFile(filePath, content, "utf8");
|
|
5194
5232
|
}
|
|
5195
5233
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
5196
5234
|
if (await pathExists2(filePath)) return "skipped";
|
|
5197
5235
|
await writeFileSafe(filePath, content, options);
|
|
5198
5236
|
return "created";
|
|
5199
5237
|
}
|
|
5238
|
+
var import_promises, import_node_path8;
|
|
5200
5239
|
var init_fs = __esm({
|
|
5201
5240
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5241
|
+
"use strict";
|
|
5242
|
+
import_promises = __toESM(require("fs/promises"), 1);
|
|
5243
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
5202
5244
|
}
|
|
5203
5245
|
});
|
|
5204
5246
|
|
|
5205
5247
|
// node_modules/picocolors/picocolors.js
|
|
5206
5248
|
var require_picocolors = __commonJS({
|
|
5207
|
-
"node_modules/picocolors/picocolors.js"(
|
|
5249
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
5250
|
+
"use strict";
|
|
5208
5251
|
var p = process || {};
|
|
5209
5252
|
var argv = p.argv || [];
|
|
5210
5253
|
var env = p.env || {};
|
|
@@ -5269,8 +5312,8 @@ var require_picocolors = __commonJS({
|
|
|
5269
5312
|
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
5270
5313
|
};
|
|
5271
5314
|
};
|
|
5272
|
-
|
|
5273
|
-
|
|
5315
|
+
module2.exports = createColors();
|
|
5316
|
+
module2.exports.createColors = createColors;
|
|
5274
5317
|
}
|
|
5275
5318
|
});
|
|
5276
5319
|
|
|
@@ -5291,8 +5334,11 @@ function writeJsonSuccess(command, data) {
|
|
|
5291
5334
|
}
|
|
5292
5335
|
var init_json = __esm({
|
|
5293
5336
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5337
|
+
"use strict";
|
|
5294
5338
|
}
|
|
5295
5339
|
});
|
|
5340
|
+
|
|
5341
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5296
5342
|
function writeLine(stream, message = "") {
|
|
5297
5343
|
stream.write(`${message}
|
|
5298
5344
|
`);
|
|
@@ -5322,7 +5368,7 @@ function createCliOutput(options = {}) {
|
|
|
5322
5368
|
const json = Boolean(options.json);
|
|
5323
5369
|
const debug = Boolean(options.debug);
|
|
5324
5370
|
const verboseEnabled = Boolean(options.verbose);
|
|
5325
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5371
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && (0, import_prompts.isTTY)(stdout);
|
|
5326
5372
|
function writeText(message = "", writeOptions = {}) {
|
|
5327
5373
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5328
5374
|
}
|
|
@@ -5356,7 +5402,7 @@ function createCliOutput(options = {}) {
|
|
|
5356
5402
|
},
|
|
5357
5403
|
note(message, title) {
|
|
5358
5404
|
if (interactive) {
|
|
5359
|
-
|
|
5405
|
+
(0, import_prompts.note)(message, title);
|
|
5360
5406
|
return;
|
|
5361
5407
|
}
|
|
5362
5408
|
if (title) {
|
|
@@ -5367,17 +5413,17 @@ ${message}`);
|
|
|
5367
5413
|
writeText(message);
|
|
5368
5414
|
},
|
|
5369
5415
|
intro(message) {
|
|
5370
|
-
showClackMessage(
|
|
5416
|
+
showClackMessage(import_prompts.intro, message);
|
|
5371
5417
|
},
|
|
5372
5418
|
outro(message) {
|
|
5373
|
-
showClackMessage(
|
|
5419
|
+
showClackMessage(import_prompts.outro, message);
|
|
5374
5420
|
},
|
|
5375
5421
|
table(rows) {
|
|
5376
5422
|
writeText(JSON.stringify(rows, null, 2));
|
|
5377
5423
|
},
|
|
5378
5424
|
spinner() {
|
|
5379
5425
|
if (!interactive) return createNoopSpinner();
|
|
5380
|
-
const instance =
|
|
5426
|
+
const instance = (0, import_prompts.spinner)({ output: stdout });
|
|
5381
5427
|
return {
|
|
5382
5428
|
start(message) {
|
|
5383
5429
|
instance.start(message);
|
|
@@ -5427,14 +5473,18 @@ ${import_picocolors.default.dim(message)}
|
|
|
5427
5473
|
}
|
|
5428
5474
|
};
|
|
5429
5475
|
}
|
|
5430
|
-
var import_picocolors;
|
|
5476
|
+
var import_prompts, import_picocolors;
|
|
5431
5477
|
var init_output = __esm({
|
|
5432
5478
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5433
|
-
|
|
5479
|
+
"use strict";
|
|
5480
|
+
import_prompts = require("@clack/prompts");
|
|
5481
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5434
5482
|
init_errors();
|
|
5435
5483
|
init_json();
|
|
5436
5484
|
}
|
|
5437
5485
|
});
|
|
5486
|
+
|
|
5487
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5438
5488
|
function hasFlag(name, argv) {
|
|
5439
5489
|
return argv.includes(`--${name}`);
|
|
5440
5490
|
}
|
|
@@ -5445,7 +5495,7 @@ function firstPositional(argv) {
|
|
|
5445
5495
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5446
5496
|
}
|
|
5447
5497
|
function parseCliInput(argv) {
|
|
5448
|
-
const parsed =
|
|
5498
|
+
const parsed = (0, import_node_util3.parseArgs)({
|
|
5449
5499
|
args: argv,
|
|
5450
5500
|
allowPositionals: true,
|
|
5451
5501
|
strict: false,
|
|
@@ -5472,17 +5522,22 @@ function parseCliInput(argv) {
|
|
|
5472
5522
|
helpCommand
|
|
5473
5523
|
};
|
|
5474
5524
|
}
|
|
5525
|
+
var import_node_util3;
|
|
5475
5526
|
var init_args = __esm({
|
|
5476
5527
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5528
|
+
"use strict";
|
|
5529
|
+
import_node_util3 = require("util");
|
|
5477
5530
|
}
|
|
5478
5531
|
});
|
|
5532
|
+
|
|
5533
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5479
5534
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5480
|
-
const filename =
|
|
5481
|
-
return
|
|
5535
|
+
const filename = (0, import_node_url6.fileURLToPath)(importMetaUrl);
|
|
5536
|
+
return import_node_path17.default.dirname(filename);
|
|
5482
5537
|
}
|
|
5483
5538
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5484
|
-
const fromRuntime =
|
|
5485
|
-
const fromCwd =
|
|
5539
|
+
const fromRuntime = import_node_path17.default.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5540
|
+
const fromCwd = import_node_path17.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
5486
5541
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5487
5542
|
}
|
|
5488
5543
|
async function firstExistingPath(paths) {
|
|
@@ -5491,8 +5546,12 @@ async function firstExistingPath(paths) {
|
|
|
5491
5546
|
}
|
|
5492
5547
|
return null;
|
|
5493
5548
|
}
|
|
5549
|
+
var import_node_path17, import_node_url6;
|
|
5494
5550
|
var init_paths = __esm({
|
|
5495
5551
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5552
|
+
"use strict";
|
|
5553
|
+
import_node_path17 = __toESM(require("path"), 1);
|
|
5554
|
+
import_node_url6 = require("url");
|
|
5496
5555
|
init_errors();
|
|
5497
5556
|
init_fs();
|
|
5498
5557
|
}
|
|
@@ -5577,6 +5636,7 @@ async function runCliMain(options) {
|
|
|
5577
5636
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5578
5637
|
var init_runtime = __esm({
|
|
5579
5638
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5639
|
+
"use strict";
|
|
5580
5640
|
init_args();
|
|
5581
5641
|
init_errors();
|
|
5582
5642
|
init_output();
|
|
@@ -5642,15 +5702,15 @@ function isInteractiveSession() {
|
|
|
5642
5702
|
}
|
|
5643
5703
|
async function resolveCreateInput(options) {
|
|
5644
5704
|
const interactive = isInteractiveSession();
|
|
5645
|
-
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await
|
|
5705
|
+
const resolvedName = options.name ? options.name : options.yes || !interactive ? "my-app" : await (0, import_prompts4.text)({
|
|
5646
5706
|
message: "Project name",
|
|
5647
5707
|
defaultValue: "my-app",
|
|
5648
5708
|
placeholder: "my-app"
|
|
5649
5709
|
});
|
|
5650
|
-
if (
|
|
5710
|
+
if ((0, import_prompts4.isCancel)(resolvedName)) {
|
|
5651
5711
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5652
5712
|
}
|
|
5653
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5713
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await (0, import_prompts4.select)({
|
|
5654
5714
|
message: "Template",
|
|
5655
5715
|
initialValue: "next-app",
|
|
5656
5716
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5658,7 +5718,7 @@ async function resolveCreateInput(options) {
|
|
|
5658
5718
|
label: template
|
|
5659
5719
|
}))
|
|
5660
5720
|
});
|
|
5661
|
-
if (
|
|
5721
|
+
if ((0, import_prompts4.isCancel)(pickedTemplate)) {
|
|
5662
5722
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5663
5723
|
}
|
|
5664
5724
|
const templateValue = pickedTemplate;
|
|
@@ -5670,7 +5730,7 @@ async function resolveCreateInput(options) {
|
|
|
5670
5730
|
return { name: resolvedName, template: templateValue };
|
|
5671
5731
|
}
|
|
5672
5732
|
async function writeProjectFile(context, relativePath, content) {
|
|
5673
|
-
const filePath =
|
|
5733
|
+
const filePath = import_node_path19.default.join(context.projectDir, relativePath);
|
|
5674
5734
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5675
5735
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5676
5736
|
}
|
|
@@ -5986,7 +6046,7 @@ async function createSimpleApp(context) {
|
|
|
5986
6046
|
}
|
|
5987
6047
|
async function createProject(options, output) {
|
|
5988
6048
|
const { name, template } = await resolveCreateInput(options);
|
|
5989
|
-
const projectDir =
|
|
6049
|
+
const projectDir = import_node_path19.default.resolve(process.cwd(), name);
|
|
5990
6050
|
if (await pathExists2(projectDir)) {
|
|
5991
6051
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5992
6052
|
}
|
|
@@ -6035,18 +6095,22 @@ function buildCreateProgram(context) {
|
|
|
6035
6095
|
async function main(rawArgs = process.argv.slice(2)) {
|
|
6036
6096
|
await runCliMain({
|
|
6037
6097
|
argv: [process.execPath, "create-tailwind-styled", ...rawArgs],
|
|
6038
|
-
importMetaUrl:
|
|
6098
|
+
importMetaUrl: import_meta8.url,
|
|
6039
6099
|
commandHint: "create",
|
|
6040
6100
|
buildProgram: buildCreateProgram
|
|
6041
6101
|
});
|
|
6042
6102
|
}
|
|
6043
|
-
var TEMPLATE_NAMES, TEMPLATES;
|
|
6103
|
+
var import_node_path19, import_prompts4, import_meta8, TEMPLATE_NAMES, TEMPLATES;
|
|
6044
6104
|
var init_createApp = __esm({
|
|
6045
6105
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6106
|
+
"use strict";
|
|
6107
|
+
import_node_path19 = __toESM(require("path"), 1);
|
|
6108
|
+
import_prompts4 = require("@clack/prompts");
|
|
6046
6109
|
init_esm();
|
|
6047
6110
|
init_errors();
|
|
6048
6111
|
init_fs();
|
|
6049
6112
|
init_runtime();
|
|
6113
|
+
import_meta8 = {};
|
|
6050
6114
|
TEMPLATE_NAMES = ["next-app", "vite-react", "vite-vue", "vite-svelte", "simple"];
|
|
6051
6115
|
TEMPLATES = {
|
|
6052
6116
|
"next-app": createNextApp,
|
|
@@ -6059,11 +6123,13 @@ var init_createApp = __esm({
|
|
|
6059
6123
|
});
|
|
6060
6124
|
|
|
6061
6125
|
// packages/domain/compiler/src/nativeBridge.ts
|
|
6062
|
-
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6126
|
+
var import_meta9, _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6063
6127
|
var init_nativeBridge = __esm({
|
|
6064
6128
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6129
|
+
"use strict";
|
|
6065
6130
|
init_src();
|
|
6066
|
-
|
|
6131
|
+
import_meta9 = {};
|
|
6132
|
+
_loadNative = (path30) => require(path30);
|
|
6067
6133
|
log3 = (...args) => {
|
|
6068
6134
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6069
6135
|
console.log("[compiler:native]", ...args);
|
|
@@ -6089,7 +6155,7 @@ var init_nativeBridge = __esm({
|
|
|
6089
6155
|
}
|
|
6090
6156
|
bridgeLoadAttempted = true;
|
|
6091
6157
|
try {
|
|
6092
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
6158
|
+
const runtimeDir = resolveRuntimeDir(void 0, import_meta9.url);
|
|
6093
6159
|
const result = resolveNativeBinary(runtimeDir);
|
|
6094
6160
|
if (result.path && result.path.endsWith(".node")) {
|
|
6095
6161
|
try {
|
|
@@ -6160,41 +6226,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6160
6226
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6161
6227
|
var init_compiler = __esm({
|
|
6162
6228
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6229
|
+
"use strict";
|
|
6163
6230
|
}
|
|
6164
6231
|
});
|
|
6165
6232
|
|
|
6166
6233
|
// packages/domain/compiler/src/parser/index.ts
|
|
6167
6234
|
var init_parser = __esm({
|
|
6168
6235
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6236
|
+
"use strict";
|
|
6169
6237
|
}
|
|
6170
6238
|
});
|
|
6171
6239
|
|
|
6172
6240
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6173
6241
|
var init_analyzer = __esm({
|
|
6174
6242
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6243
|
+
"use strict";
|
|
6175
6244
|
}
|
|
6176
6245
|
});
|
|
6177
6246
|
|
|
6178
6247
|
// packages/domain/compiler/src/cache/index.ts
|
|
6179
6248
|
var init_cache = __esm({
|
|
6180
6249
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6250
|
+
"use strict";
|
|
6181
6251
|
}
|
|
6182
6252
|
});
|
|
6183
6253
|
|
|
6184
6254
|
// packages/domain/compiler/src/redis/index.ts
|
|
6185
6255
|
var init_redis = __esm({
|
|
6186
6256
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6257
|
+
"use strict";
|
|
6187
6258
|
}
|
|
6188
6259
|
});
|
|
6189
6260
|
|
|
6190
6261
|
// packages/domain/compiler/src/watch/index.ts
|
|
6191
6262
|
var init_watch = __esm({
|
|
6192
6263
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6264
|
+
"use strict";
|
|
6193
6265
|
}
|
|
6194
6266
|
});
|
|
6195
|
-
|
|
6267
|
+
|
|
6268
|
+
// packages/domain/compiler/src/index.ts
|
|
6269
|
+
var import_node_fs9, import_node_path24, import_node_module4, import_meta10, _require3, compileCssFromClasses;
|
|
6196
6270
|
var init_src4 = __esm({
|
|
6197
6271
|
"packages/domain/compiler/src/index.ts"() {
|
|
6272
|
+
"use strict";
|
|
6273
|
+
import_node_fs9 = __toESM(require("fs"), 1);
|
|
6274
|
+
import_node_path24 = __toESM(require("path"), 1);
|
|
6275
|
+
import_node_module4 = require("module");
|
|
6198
6276
|
init_nativeBridge();
|
|
6199
6277
|
init_compiler();
|
|
6200
6278
|
init_parser();
|
|
@@ -6202,7 +6280,8 @@ var init_src4 = __esm({
|
|
|
6202
6280
|
init_cache();
|
|
6203
6281
|
init_redis();
|
|
6204
6282
|
init_watch();
|
|
6205
|
-
|
|
6283
|
+
import_meta10 = {};
|
|
6284
|
+
_require3 = (0, import_node_module4.createRequire)(import_meta10.url);
|
|
6206
6285
|
compileCssFromClasses = (classes, prefix) => {
|
|
6207
6286
|
const native = getNativeBridge();
|
|
6208
6287
|
if (!native?.transformSource) {
|
|
@@ -6220,6 +6299,7 @@ var init_src4 = __esm({
|
|
|
6220
6299
|
// packages/domain/compiler/src/internal.ts
|
|
6221
6300
|
var init_internal = __esm({
|
|
6222
6301
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6302
|
+
"use strict";
|
|
6223
6303
|
init_src4();
|
|
6224
6304
|
init_compiler();
|
|
6225
6305
|
init_parser();
|
|
@@ -6230,9 +6310,16 @@ var init_internal = __esm({
|
|
|
6230
6310
|
}
|
|
6231
6311
|
});
|
|
6232
6312
|
|
|
6313
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6314
|
+
var import_node_url8 = require("url");
|
|
6315
|
+
|
|
6233
6316
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6234
6317
|
init_esm();
|
|
6235
6318
|
|
|
6319
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6320
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
6321
|
+
var import_node_util = require("util");
|
|
6322
|
+
|
|
6236
6323
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6237
6324
|
init_errors();
|
|
6238
6325
|
async function loadAnalyzerModule() {
|
|
@@ -6289,7 +6376,7 @@ function printAnalysisReport(report, output) {
|
|
|
6289
6376
|
output.writeText("");
|
|
6290
6377
|
}
|
|
6291
6378
|
async function runAnalyzeCli(args) {
|
|
6292
|
-
const parsed =
|
|
6379
|
+
const parsed = (0, import_node_util.parseArgs)({
|
|
6293
6380
|
args,
|
|
6294
6381
|
allowPositionals: true,
|
|
6295
6382
|
strict: false,
|
|
@@ -6304,7 +6391,7 @@ async function runAnalyzeCli(args) {
|
|
|
6304
6391
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6305
6392
|
});
|
|
6306
6393
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6307
|
-
const dir =
|
|
6394
|
+
const dir = import_node_path9.default.resolve(process.cwd(), dirArg);
|
|
6308
6395
|
if (!await pathExists2(dir)) {
|
|
6309
6396
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6310
6397
|
}
|
|
@@ -6321,6 +6408,10 @@ async function runAnalyzeCli(args) {
|
|
|
6321
6408
|
}
|
|
6322
6409
|
printAnalysisReport(report, output);
|
|
6323
6410
|
}
|
|
6411
|
+
|
|
6412
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6413
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
6414
|
+
var import_node_util2 = require("util");
|
|
6324
6415
|
init_errors();
|
|
6325
6416
|
init_fs();
|
|
6326
6417
|
init_output();
|
|
@@ -6341,7 +6432,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6341
6432
|
return "div";
|
|
6342
6433
|
}
|
|
6343
6434
|
async function runExtractCli(args) {
|
|
6344
|
-
const parsed =
|
|
6435
|
+
const parsed = (0, import_node_util2.parseArgs)({
|
|
6345
6436
|
args,
|
|
6346
6437
|
allowPositionals: true,
|
|
6347
6438
|
strict: false,
|
|
@@ -6360,7 +6451,7 @@ async function runExtractCli(args) {
|
|
|
6360
6451
|
const parsedMin = parseInt(minRaw, 10);
|
|
6361
6452
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6362
6453
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6363
|
-
const dir =
|
|
6454
|
+
const dir = import_node_path10.default.resolve(process.cwd(), dirArg);
|
|
6364
6455
|
if (!await pathExists2(dir)) {
|
|
6365
6456
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6366
6457
|
}
|
|
@@ -6415,6 +6506,7 @@ async function runExtractCli(args) {
|
|
|
6415
6506
|
}
|
|
6416
6507
|
|
|
6417
6508
|
// packages/infrastructure/cli/src/init.ts
|
|
6509
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
6418
6510
|
init_fs();
|
|
6419
6511
|
init_output();
|
|
6420
6512
|
async function ensureFile(filePath, content, report) {
|
|
@@ -6433,15 +6525,15 @@ async function runInitCli(rawArgs) {
|
|
|
6433
6525
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6434
6526
|
});
|
|
6435
6527
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6436
|
-
const root =
|
|
6528
|
+
const root = import_node_path11.default.resolve(process.cwd(), target);
|
|
6437
6529
|
const report = { created: [], skipped: [] };
|
|
6438
6530
|
await ensureFile(
|
|
6439
|
-
|
|
6531
|
+
import_node_path11.default.join(root, "src", "tailwind.css"),
|
|
6440
6532
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6441
6533
|
report
|
|
6442
6534
|
);
|
|
6443
6535
|
await ensureFile(
|
|
6444
|
-
|
|
6536
|
+
import_node_path11.default.join(root, "tailwind-styled.config.json"),
|
|
6445
6537
|
`${JSON.stringify(
|
|
6446
6538
|
{
|
|
6447
6539
|
version: 1,
|
|
@@ -6461,17 +6553,22 @@ async function runInitCli(rawArgs) {
|
|
|
6461
6553
|
output.writeText("\nInit complete");
|
|
6462
6554
|
output.writeText(`Created: ${report.created.length}`);
|
|
6463
6555
|
for (const filePath of report.created) {
|
|
6464
|
-
output.writeText(` + ${
|
|
6556
|
+
output.writeText(` + ${import_node_path11.default.relative(root, filePath)}`);
|
|
6465
6557
|
}
|
|
6466
6558
|
if (report.skipped.length > 0) {
|
|
6467
6559
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6468
6560
|
for (const filePath of report.skipped) {
|
|
6469
|
-
output.writeText(` - ${
|
|
6561
|
+
output.writeText(` - ${import_node_path11.default.relative(root, filePath)} (exists)`);
|
|
6470
6562
|
}
|
|
6471
6563
|
}
|
|
6472
6564
|
}
|
|
6473
6565
|
|
|
6566
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6567
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
6568
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
6569
|
+
|
|
6474
6570
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6571
|
+
var import_prompts2 = require("@clack/prompts");
|
|
6475
6572
|
init_errors();
|
|
6476
6573
|
async function runMigrationWizard() {
|
|
6477
6574
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
@@ -6482,24 +6579,24 @@ async function runMigrationWizard() {
|
|
|
6482
6579
|
includeImports: true
|
|
6483
6580
|
};
|
|
6484
6581
|
}
|
|
6485
|
-
|
|
6486
|
-
const dryRun = await
|
|
6582
|
+
(0, import_prompts2.intro)("Tailwind Styled v4 Migration Wizard");
|
|
6583
|
+
const dryRun = await (0, import_prompts2.confirm)({
|
|
6487
6584
|
message: "Gunakan dry-run?",
|
|
6488
6585
|
initialValue: true
|
|
6489
6586
|
});
|
|
6490
|
-
const includeConfig = await
|
|
6587
|
+
const includeConfig = await (0, import_prompts2.confirm)({
|
|
6491
6588
|
message: "Migrasi file config dasar?",
|
|
6492
6589
|
initialValue: true
|
|
6493
6590
|
});
|
|
6494
|
-
const includeClasses = await
|
|
6591
|
+
const includeClasses = await (0, import_prompts2.confirm)({
|
|
6495
6592
|
message: "Migrasi class lama (flex-grow/shrink)?",
|
|
6496
6593
|
initialValue: true
|
|
6497
6594
|
});
|
|
6498
|
-
const includeImports = await
|
|
6595
|
+
const includeImports = await (0, import_prompts2.confirm)({
|
|
6499
6596
|
message: "Migrasi import tailwind-styled-components -> tailwind-styled-v4?",
|
|
6500
6597
|
initialValue: true
|
|
6501
6598
|
});
|
|
6502
|
-
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) =>
|
|
6599
|
+
if ([dryRun, includeConfig, includeClasses, includeImports].some((value) => (0, import_prompts2.isCancel)(value))) {
|
|
6503
6600
|
throw new CliUsageError("Migration wizard dibatalkan oleh pengguna");
|
|
6504
6601
|
}
|
|
6505
6602
|
return {
|
|
@@ -6527,15 +6624,15 @@ async function findSourceFiles(dir) {
|
|
|
6527
6624
|
const out = [];
|
|
6528
6625
|
async function walk(currentDir) {
|
|
6529
6626
|
if (!await pathExists2(currentDir)) return;
|
|
6530
|
-
const entries = await
|
|
6627
|
+
const entries = await import_promises2.default.readdir(currentDir, { withFileTypes: true });
|
|
6531
6628
|
for (const entry of entries) {
|
|
6532
|
-
const fullPath =
|
|
6629
|
+
const fullPath = import_node_path12.default.join(currentDir, entry.name);
|
|
6533
6630
|
if (entry.isDirectory()) {
|
|
6534
6631
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6535
6632
|
await walk(fullPath);
|
|
6536
6633
|
continue;
|
|
6537
6634
|
}
|
|
6538
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6635
|
+
if (SOURCE_EXTENSIONS.has(import_node_path12.default.extname(entry.name))) {
|
|
6539
6636
|
out.push(fullPath);
|
|
6540
6637
|
}
|
|
6541
6638
|
}
|
|
@@ -6556,7 +6653,7 @@ function migrateSource(source, options) {
|
|
|
6556
6653
|
return { output, classRenames: 0, importRenames };
|
|
6557
6654
|
}
|
|
6558
6655
|
async function migrateConfig(root, dryRun) {
|
|
6559
|
-
const cssPath =
|
|
6656
|
+
const cssPath = import_node_path12.default.join(root, "src", "tailwind.css");
|
|
6560
6657
|
if (await pathExists2(cssPath)) return 0;
|
|
6561
6658
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6562
6659
|
return 1;
|
|
@@ -6569,7 +6666,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6569
6666
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6570
6667
|
});
|
|
6571
6668
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6572
|
-
const root =
|
|
6669
|
+
const root = import_node_path12.default.resolve(process.cwd(), target);
|
|
6573
6670
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6574
6671
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6575
6672
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6593,12 +6690,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6593
6690
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6594
6691
|
}
|
|
6595
6692
|
for (const filePath of files) {
|
|
6596
|
-
const source = await
|
|
6693
|
+
const source = await import_promises2.default.readFile(filePath, "utf8");
|
|
6597
6694
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6598
6695
|
if (migrated.output !== source) {
|
|
6599
6696
|
report.updatedFiles++;
|
|
6600
6697
|
if (!dryRun) {
|
|
6601
|
-
await
|
|
6698
|
+
await import_promises2.default.writeFile(filePath, migrated.output, "utf8");
|
|
6602
6699
|
}
|
|
6603
6700
|
}
|
|
6604
6701
|
report.classRenames += migrated.classRenames;
|
|
@@ -6618,6 +6715,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6618
6715
|
}
|
|
6619
6716
|
|
|
6620
6717
|
// packages/infrastructure/cli/src/scan.ts
|
|
6718
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
6719
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
6621
6720
|
init_src2();
|
|
6622
6721
|
init_output();
|
|
6623
6722
|
function buildTopClasses(files) {
|
|
@@ -6662,10 +6761,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6662
6761
|
});
|
|
6663
6762
|
}
|
|
6664
6763
|
function writeScanCache(root, cacheData) {
|
|
6665
|
-
const cacheDir =
|
|
6666
|
-
const cachePath =
|
|
6667
|
-
|
|
6668
|
-
|
|
6764
|
+
const cacheDir = import_node_path13.default.join(root, ".tailwind-styled");
|
|
6765
|
+
const cachePath = import_node_path13.default.join(cacheDir, "scan-cache.json");
|
|
6766
|
+
import_node_fs6.default.mkdirSync(cacheDir, { recursive: true });
|
|
6767
|
+
import_node_fs6.default.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6669
6768
|
return cachePath;
|
|
6670
6769
|
}
|
|
6671
6770
|
async function runScanCli(rawArgs) {
|
|
@@ -6677,7 +6776,7 @@ async function runScanCli(rawArgs) {
|
|
|
6677
6776
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6678
6777
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6679
6778
|
});
|
|
6680
|
-
const root =
|
|
6779
|
+
const root = import_node_path13.default.resolve(process.cwd(), target);
|
|
6681
6780
|
const spinner = output.spinner();
|
|
6682
6781
|
spinner.start(`Scanning ${root}`);
|
|
6683
6782
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6727,7 +6826,8 @@ Scan root : ${result.root}`);
|
|
|
6727
6826
|
}
|
|
6728
6827
|
|
|
6729
6828
|
// packages/infrastructure/cli/src/setup.ts
|
|
6730
|
-
var
|
|
6829
|
+
var import_node_path15 = __toESM(require("path"), 1);
|
|
6830
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6731
6831
|
|
|
6732
6832
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6733
6833
|
function patchNextConfigImpl(src) {
|
|
@@ -6826,7 +6926,7 @@ ${close}`
|
|
|
6826
6926
|
}
|
|
6827
6927
|
function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
6828
6928
|
try {
|
|
6829
|
-
const nodePath =
|
|
6929
|
+
const nodePath = require("path");
|
|
6830
6930
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6831
6931
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6832
6932
|
const safelistAbs = nodePath.resolve(cwd2, ".next", "tw-classes");
|
|
@@ -6841,7 +6941,7 @@ function computeSafelistSourcePath(cssFilePath, cwd2) {
|
|
|
6841
6941
|
}
|
|
6842
6942
|
function computeStateStaticImportPath(cssFilePath, cwd2) {
|
|
6843
6943
|
try {
|
|
6844
|
-
const nodePath =
|
|
6944
|
+
const nodePath = require("path");
|
|
6845
6945
|
const cssAbs = nodePath.resolve(cwd2, cssFilePath);
|
|
6846
6946
|
const cssDir = nodePath.dirname(cssAbs);
|
|
6847
6947
|
const stateStaticAbs = nodePath.resolve(cwd2, ".next", "_tw-state-static.css");
|
|
@@ -6922,6 +7022,7 @@ function patchTsConfigImpl(src) {
|
|
|
6922
7022
|
}
|
|
6923
7023
|
|
|
6924
7024
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
7025
|
+
var import_prompts3 = require("@clack/prompts");
|
|
6925
7026
|
init_errors();
|
|
6926
7027
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6927
7028
|
const log5 = options.log ?? console.log;
|
|
@@ -6952,7 +7053,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6952
7053
|
});
|
|
6953
7054
|
log5("");
|
|
6954
7055
|
const defaultIdx = detected ? projectOptions.findIndex((option) => option.value === detected) : 0;
|
|
6955
|
-
const selected = await
|
|
7056
|
+
const selected = await (0, import_prompts3.select)({
|
|
6956
7057
|
message: "Project type",
|
|
6957
7058
|
initialValue: projectOptions[defaultIdx].value,
|
|
6958
7059
|
options: projectOptions.map((option) => ({
|
|
@@ -6961,7 +7062,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6961
7062
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6962
7063
|
}))
|
|
6963
7064
|
});
|
|
6964
|
-
if (
|
|
7065
|
+
if ((0, import_prompts3.isCancel)(selected)) {
|
|
6965
7066
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6966
7067
|
}
|
|
6967
7068
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6972,9 +7073,11 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6972
7073
|
}
|
|
6973
7074
|
|
|
6974
7075
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
7076
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
6975
7077
|
init_fs();
|
|
6976
7078
|
|
|
6977
7079
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
7080
|
+
var import_node_child_process = require("child_process");
|
|
6978
7081
|
init_errors();
|
|
6979
7082
|
init_json();
|
|
6980
7083
|
var npmCommandName = () => {
|
|
@@ -7007,7 +7110,7 @@ var runCommand = async (binary, args, options = {}) => {
|
|
|
7007
7110
|
if (isVerboseEnabled(options)) {
|
|
7008
7111
|
writeVerboseLine(binary, args);
|
|
7009
7112
|
}
|
|
7010
|
-
const child =
|
|
7113
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7011
7114
|
stdio: options.stdio ?? "inherit",
|
|
7012
7115
|
cwd: options.cwd ?? process.cwd(),
|
|
7013
7116
|
env: options.env ?? process.env
|
|
@@ -7063,7 +7166,7 @@ var runCommandCapture = async (binary, args, options = {}) => {
|
|
|
7063
7166
|
if (isVerboseEnabled(options)) {
|
|
7064
7167
|
writeVerboseLine(binary, args);
|
|
7065
7168
|
}
|
|
7066
|
-
const child =
|
|
7169
|
+
const child = (0, import_node_child_process.spawn)(binary, args, {
|
|
7067
7170
|
stdio: "pipe",
|
|
7068
7171
|
cwd: options.cwd ?? process.cwd(),
|
|
7069
7172
|
env: options.env ?? process.env
|
|
@@ -7140,12 +7243,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7140
7243
|
};
|
|
7141
7244
|
}
|
|
7142
7245
|
async function readPackageJson(cwd2) {
|
|
7143
|
-
return readJsonSafe(
|
|
7246
|
+
return readJsonSafe(import_node_path14.default.join(cwd2, "package.json"));
|
|
7144
7247
|
}
|
|
7145
7248
|
async function detectPm(cwd2) {
|
|
7146
|
-
if (await pathExists2(
|
|
7147
|
-
if (await pathExists2(
|
|
7148
|
-
if (await pathExists2(
|
|
7249
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "bun.lockb"))) return "bun";
|
|
7250
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7251
|
+
if (await pathExists2(import_node_path14.default.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7149
7252
|
return "npm";
|
|
7150
7253
|
}
|
|
7151
7254
|
async function detectBundler(cwd2) {
|
|
@@ -7166,7 +7269,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7166
7269
|
}
|
|
7167
7270
|
async function findExisting(cwd2, names) {
|
|
7168
7271
|
for (const name of names) {
|
|
7169
|
-
const resolved =
|
|
7272
|
+
const resolved = import_node_path14.default.join(cwd2, name);
|
|
7170
7273
|
if (await pathExists2(resolved)) return resolved;
|
|
7171
7274
|
}
|
|
7172
7275
|
return null;
|
|
@@ -7177,7 +7280,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7177
7280
|
return;
|
|
7178
7281
|
}
|
|
7179
7282
|
await writeFileSafe(filePath, content);
|
|
7180
|
-
logger.ok(
|
|
7283
|
+
logger.ok(import_node_path14.default.relative(cwd2, filePath) || label);
|
|
7181
7284
|
}
|
|
7182
7285
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7183
7286
|
const source = await readFileSafe(filePath);
|
|
@@ -7204,7 +7307,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7204
7307
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7205
7308
|
return;
|
|
7206
7309
|
}
|
|
7207
|
-
const flag = "--save";
|
|
7310
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7208
7311
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7209
7312
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7210
7313
|
try {
|
|
@@ -7222,7 +7325,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7222
7325
|
}
|
|
7223
7326
|
|
|
7224
7327
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7225
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7328
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7226
7329
|
function createCliLogger(options = {}) {
|
|
7227
7330
|
function emit(level, icon, colorize, message) {
|
|
7228
7331
|
options.onEvent?.({ level, message });
|
|
@@ -7340,7 +7443,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7340
7443
|
if (bundlerConfig) {
|
|
7341
7444
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7342
7445
|
if (cfg)
|
|
7343
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7446
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, import_node_path15.default.basename(cfg), setupFlags, logger);
|
|
7344
7447
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7345
7448
|
} else {
|
|
7346
7449
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7359,13 +7462,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7359
7462
|
if (cssFile) {
|
|
7360
7463
|
await patchFileWithDryRun(
|
|
7361
7464
|
cssFile,
|
|
7362
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7363
|
-
|
|
7465
|
+
(src) => patchTailwindCss(src, bundler, import_node_path15.default.relative(cwd, cssFile), cwd),
|
|
7466
|
+
import_node_path15.default.relative(cwd, cssFile),
|
|
7364
7467
|
setupFlags,
|
|
7365
7468
|
logger
|
|
7366
7469
|
);
|
|
7367
|
-
const detectedCssEntry =
|
|
7368
|
-
const twConfigPath =
|
|
7470
|
+
const detectedCssEntry = import_node_path15.default.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7471
|
+
const twConfigPath = import_node_path15.default.join(cwd, "tailwind-styled.config.json");
|
|
7369
7472
|
const twConfig = {
|
|
7370
7473
|
version: 1,
|
|
7371
7474
|
compiler: { engine: "rust" },
|
|
@@ -7383,7 +7486,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7383
7486
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7384
7487
|
}
|
|
7385
7488
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7386
|
-
const tsCfg =
|
|
7489
|
+
const tsCfg = import_node_path15.default.join(cwd, "tsconfig.json");
|
|
7387
7490
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7388
7491
|
if (hasTsConfig) {
|
|
7389
7492
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7428,6 +7531,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7428
7531
|
output.jsonSuccess("setup", report);
|
|
7429
7532
|
}
|
|
7430
7533
|
};
|
|
7534
|
+
|
|
7535
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7536
|
+
var import_node_path16 = __toESM(require("path"), 1);
|
|
7537
|
+
var import_node_util4 = require("util");
|
|
7431
7538
|
init_errors();
|
|
7432
7539
|
init_fs();
|
|
7433
7540
|
init_output();
|
|
@@ -7449,7 +7556,7 @@ function estimateClassBytes(className) {
|
|
|
7449
7556
|
return base + 15;
|
|
7450
7557
|
}
|
|
7451
7558
|
async function runStatsCli(args) {
|
|
7452
|
-
const parsed =
|
|
7559
|
+
const parsed = (0, import_node_util4.parseArgs)({
|
|
7453
7560
|
args,
|
|
7454
7561
|
allowPositionals: true,
|
|
7455
7562
|
strict: false,
|
|
@@ -7464,7 +7571,7 @@ async function runStatsCli(args) {
|
|
|
7464
7571
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7465
7572
|
});
|
|
7466
7573
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7467
|
-
const dir =
|
|
7574
|
+
const dir = import_node_path16.default.resolve(process.cwd(), dirArg);
|
|
7468
7575
|
if (!await pathExists2(dir)) {
|
|
7469
7576
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7470
7577
|
}
|
|
@@ -7516,15 +7623,20 @@ async function runStatsCli(args) {
|
|
|
7516
7623
|
|
|
7517
7624
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7518
7625
|
init_runtime();
|
|
7626
|
+
|
|
7627
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7628
|
+
var import_node_fs7 = require("fs");
|
|
7629
|
+
var import_node_path18 = require("path");
|
|
7630
|
+
var import_node_util5 = require("util");
|
|
7519
7631
|
function collectTsFiles(dir, extensions) {
|
|
7520
7632
|
const files = [];
|
|
7521
|
-
const entries =
|
|
7633
|
+
const entries = (0, import_node_fs7.readdirSync)(dir, { withFileTypes: true });
|
|
7522
7634
|
for (const entry of entries) {
|
|
7523
|
-
const full =
|
|
7635
|
+
const full = (0, import_node_path18.join)(dir, entry.name);
|
|
7524
7636
|
if (entry.isDirectory()) {
|
|
7525
7637
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7526
7638
|
files.push(...collectTsFiles(full, extensions));
|
|
7527
|
-
} else if (extensions.has(
|
|
7639
|
+
} else if (extensions.has((0, import_node_path18.extname)(entry.name))) {
|
|
7528
7640
|
files.push(full);
|
|
7529
7641
|
}
|
|
7530
7642
|
}
|
|
@@ -7583,7 +7695,7 @@ function printBoundaryReport(report, output) {
|
|
|
7583
7695
|
}
|
|
7584
7696
|
}
|
|
7585
7697
|
async function runBoundaryCli(args, context) {
|
|
7586
|
-
const parsed =
|
|
7698
|
+
const parsed = (0, import_node_util5.parseArgs)({
|
|
7587
7699
|
args,
|
|
7588
7700
|
allowPositionals: true,
|
|
7589
7701
|
strict: false,
|
|
@@ -7601,7 +7713,7 @@ async function runBoundaryCli(args, context) {
|
|
|
7601
7713
|
for (const file of files) {
|
|
7602
7714
|
let source;
|
|
7603
7715
|
try {
|
|
7604
|
-
source =
|
|
7716
|
+
source = (0, import_node_fs7.readFileSync)(file, "utf8");
|
|
7605
7717
|
} catch {
|
|
7606
7718
|
continue;
|
|
7607
7719
|
}
|
|
@@ -7649,10 +7761,13 @@ var createCommand2 = {
|
|
|
7649
7761
|
};
|
|
7650
7762
|
|
|
7651
7763
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7764
|
+
var import_node_util6 = require("util");
|
|
7652
7765
|
init_errors();
|
|
7653
7766
|
init_fs();
|
|
7654
7767
|
|
|
7655
7768
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7769
|
+
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
7770
|
+
var import_node_path20 = __toESM(require("path"), 1);
|
|
7656
7771
|
init_errors();
|
|
7657
7772
|
init_paths();
|
|
7658
7773
|
function enumerateVariantProps(matrix) {
|
|
@@ -7676,7 +7791,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7676
7791
|
}
|
|
7677
7792
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7678
7793
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7679
|
-
const fromCwd =
|
|
7794
|
+
const fromCwd = import_node_path20.default.resolve(process.cwd(), relativeToRepoRoot);
|
|
7680
7795
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7681
7796
|
if (!resolved) {
|
|
7682
7797
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7690,13 +7805,13 @@ async function loadRegistry(context) {
|
|
|
7690
7805
|
);
|
|
7691
7806
|
const candidates = [
|
|
7692
7807
|
runtimeRegistryPath,
|
|
7693
|
-
|
|
7808
|
+
import_node_path20.default.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7694
7809
|
];
|
|
7695
7810
|
const registryPath = await firstExistingPath(candidates);
|
|
7696
7811
|
if (!registryPath) {
|
|
7697
7812
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7698
7813
|
}
|
|
7699
|
-
const raw = await
|
|
7814
|
+
const raw = await import_promises3.default.readFile(registryPath, "utf8");
|
|
7700
7815
|
const data = JSON.parse(raw);
|
|
7701
7816
|
return [
|
|
7702
7817
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7716,7 +7831,7 @@ var dashboardCommand = {
|
|
|
7716
7831
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7717
7832
|
);
|
|
7718
7833
|
}
|
|
7719
|
-
const parsed =
|
|
7834
|
+
const parsed = (0, import_node_util6.parseArgs)({
|
|
7720
7835
|
args,
|
|
7721
7836
|
allowPositionals: true,
|
|
7722
7837
|
strict: false,
|
|
@@ -7740,12 +7855,15 @@ var dashboardCommand = {
|
|
|
7740
7855
|
};
|
|
7741
7856
|
|
|
7742
7857
|
// packages/infrastructure/cli/src/commands/deploy.ts
|
|
7858
|
+
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
7859
|
+
var import_node_path21 = __toESM(require("path"), 1);
|
|
7860
|
+
var import_node_util7 = require("util");
|
|
7743
7861
|
init_errors();
|
|
7744
7862
|
init_fs();
|
|
7745
7863
|
init_json();
|
|
7746
7864
|
var postJson = async (url, body, token) => {
|
|
7747
|
-
const { default: https } = await import(
|
|
7748
|
-
const { default: http } = await import(
|
|
7865
|
+
const { default: https } = await import("https");
|
|
7866
|
+
const { default: http } = await import("http");
|
|
7749
7867
|
return new Promise((resolve2, reject) => {
|
|
7750
7868
|
const client = url.protocol === "https:" ? https : http;
|
|
7751
7869
|
const req = client.request(
|
|
@@ -7779,7 +7897,7 @@ var postJson = async (url, body, token) => {
|
|
|
7779
7897
|
var deployCommand = {
|
|
7780
7898
|
name: "deploy",
|
|
7781
7899
|
async run(args, context) {
|
|
7782
|
-
const parsed =
|
|
7900
|
+
const parsed = (0, import_node_util7.parseArgs)({
|
|
7783
7901
|
args,
|
|
7784
7902
|
allowPositionals: true,
|
|
7785
7903
|
strict: false,
|
|
@@ -7795,7 +7913,7 @@ var deployCommand = {
|
|
|
7795
7913
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7796
7914
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7797
7915
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7798
|
-
const pkgPath =
|
|
7916
|
+
const pkgPath = import_node_path21.default.join(process.cwd(), "package.json");
|
|
7799
7917
|
if (!await pathExists2(pkgPath)) {
|
|
7800
7918
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7801
7919
|
}
|
|
@@ -7830,10 +7948,10 @@ var deployCommand = {
|
|
|
7830
7948
|
}
|
|
7831
7949
|
return;
|
|
7832
7950
|
}
|
|
7833
|
-
const cacheDir =
|
|
7834
|
-
await
|
|
7835
|
-
await
|
|
7836
|
-
|
|
7951
|
+
const cacheDir = import_node_path21.default.join(process.cwd(), ".tw-cache");
|
|
7952
|
+
await import_promises4.default.mkdir(cacheDir, { recursive: true });
|
|
7953
|
+
await import_promises4.default.writeFile(
|
|
7954
|
+
import_node_path21.default.join(cacheDir, "deploy-manifest.json"),
|
|
7837
7955
|
JSON.stringify(manifest, null, 2)
|
|
7838
7956
|
);
|
|
7839
7957
|
if (!registryUrl) {
|
|
@@ -7896,9 +8014,12 @@ var deployCommand = {
|
|
|
7896
8014
|
};
|
|
7897
8015
|
|
|
7898
8016
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7899
|
-
var
|
|
8017
|
+
var import_node_util8 = require("util");
|
|
8018
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
7900
8019
|
|
|
7901
8020
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
8021
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
8022
|
+
var import_node_path22 = __toESM(require("path"), 1);
|
|
7902
8023
|
init_src3();
|
|
7903
8024
|
init_src2();
|
|
7904
8025
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
@@ -7933,9 +8054,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7933
8054
|
issues.push({ severity, type, message, suggestion, location });
|
|
7934
8055
|
}
|
|
7935
8056
|
function readJsonFile(filePath) {
|
|
7936
|
-
if (!
|
|
8057
|
+
if (!import_node_fs8.default.existsSync(filePath)) return null;
|
|
7937
8058
|
try {
|
|
7938
|
-
return JSON.parse(
|
|
8059
|
+
return JSON.parse(import_node_fs8.default.readFileSync(filePath, "utf8"));
|
|
7939
8060
|
} catch (parseErr) {
|
|
7940
8061
|
if (process.env.TWS_DEBUG === "1") {
|
|
7941
8062
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7946,16 +8067,16 @@ function readJsonFile(filePath) {
|
|
|
7946
8067
|
}
|
|
7947
8068
|
}
|
|
7948
8069
|
function findWorkspacePackageJsonFiles(root) {
|
|
7949
|
-
const packagesDir =
|
|
7950
|
-
if (!
|
|
7951
|
-
return
|
|
8070
|
+
const packagesDir = import_node_path22.default.join(root, "packages");
|
|
8071
|
+
if (!import_node_fs8.default.existsSync(packagesDir)) return [];
|
|
8072
|
+
return import_node_fs8.default.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => import_node_path22.default.join(packagesDir, entry.name, "package.json")).filter((filePath) => import_node_fs8.default.existsSync(filePath));
|
|
7952
8073
|
}
|
|
7953
8074
|
function findFiles(dir, ext) {
|
|
7954
8075
|
const files = [];
|
|
7955
8076
|
try {
|
|
7956
|
-
const entries =
|
|
8077
|
+
const entries = import_node_fs8.default.readdirSync(dir, { withFileTypes: true });
|
|
7957
8078
|
for (const entry of entries) {
|
|
7958
|
-
const fullPath =
|
|
8079
|
+
const fullPath = import_node_path22.default.join(dir, entry.name);
|
|
7959
8080
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7960
8081
|
files.push(...findFiles(fullPath, ext));
|
|
7961
8082
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7973,7 +8094,7 @@ function findFiles(dir, ext) {
|
|
|
7973
8094
|
return files;
|
|
7974
8095
|
}
|
|
7975
8096
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7976
|
-
const rootPackageJsonPath =
|
|
8097
|
+
const rootPackageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
7977
8098
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7978
8099
|
if (!rootPackageJson) {
|
|
7979
8100
|
addCheck(
|
|
@@ -8026,7 +8147,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8026
8147
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8027
8148
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8028
8149
|
if (missing.length === 0) return [];
|
|
8029
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8150
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : import_node_path22.default.basename(import_node_path22.default.dirname(filePath));
|
|
8030
8151
|
return [{ packageName, missing }];
|
|
8031
8152
|
});
|
|
8032
8153
|
if (missingScripts.length === 0) {
|
|
@@ -8061,7 +8182,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8061
8182
|
);
|
|
8062
8183
|
}
|
|
8063
8184
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8064
|
-
const packageJsonPath =
|
|
8185
|
+
const packageJsonPath = import_node_path22.default.join(root, "package.json");
|
|
8065
8186
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8066
8187
|
if (!packageJson) {
|
|
8067
8188
|
addCheck(
|
|
@@ -8120,7 +8241,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8120
8241
|
const cssFiles = findFiles(root, ".css");
|
|
8121
8242
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8122
8243
|
try {
|
|
8123
|
-
const content =
|
|
8244
|
+
const content = import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
8124
8245
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8125
8246
|
} catch {
|
|
8126
8247
|
return false;
|
|
@@ -8144,7 +8265,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8144
8265
|
);
|
|
8145
8266
|
}
|
|
8146
8267
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8147
|
-
const hasConfig = configFiles.some((name) =>
|
|
8268
|
+
const hasConfig = configFiles.some((name) => import_node_fs8.default.existsSync(import_node_path22.default.join(root, name)));
|
|
8148
8269
|
addCheck(
|
|
8149
8270
|
checks,
|
|
8150
8271
|
"tailwind",
|
|
@@ -8153,7 +8274,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8153
8274
|
"info",
|
|
8154
8275
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8155
8276
|
);
|
|
8156
|
-
const tsconfig = readJsonFile(
|
|
8277
|
+
const tsconfig = readJsonFile(import_node_path22.default.join(root, "tsconfig.json"));
|
|
8157
8278
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8158
8279
|
addCheck(
|
|
8159
8280
|
checks,
|
|
@@ -8319,7 +8440,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8319
8440
|
}
|
|
8320
8441
|
}
|
|
8321
8442
|
var runDiagnostics = async (options = {}) => {
|
|
8322
|
-
const root =
|
|
8443
|
+
const root = import_node_path22.default.resolve(options.root ?? process.cwd());
|
|
8323
8444
|
const includes = parseIncludes(options.include);
|
|
8324
8445
|
const issues = [];
|
|
8325
8446
|
const checks = [];
|
|
@@ -8365,7 +8486,7 @@ function parseIncludeOption(value) {
|
|
|
8365
8486
|
return includes;
|
|
8366
8487
|
}
|
|
8367
8488
|
async function runDoctorCli(args, context) {
|
|
8368
|
-
const parsed =
|
|
8489
|
+
const parsed = (0, import_node_util8.parseArgs)({
|
|
8369
8490
|
args,
|
|
8370
8491
|
allowPositionals: true,
|
|
8371
8492
|
strict: false,
|
|
@@ -8438,13 +8559,15 @@ function printDoctorOutput(result, output) {
|
|
|
8438
8559
|
}
|
|
8439
8560
|
|
|
8440
8561
|
// packages/infrastructure/cli/src/commands/misc.ts
|
|
8562
|
+
var import_node_path23 = __toESM(require("path"), 1);
|
|
8563
|
+
var import_node_util9 = require("util");
|
|
8441
8564
|
init_errors();
|
|
8442
8565
|
init_fs();
|
|
8443
8566
|
init_json();
|
|
8444
8567
|
var testCommand = {
|
|
8445
8568
|
name: "test",
|
|
8446
8569
|
async run(args) {
|
|
8447
|
-
const parsed =
|
|
8570
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8448
8571
|
args,
|
|
8449
8572
|
allowPositionals: true,
|
|
8450
8573
|
strict: false,
|
|
@@ -8469,7 +8592,7 @@ var shareCommand = {
|
|
|
8469
8592
|
name: "share",
|
|
8470
8593
|
async run(args, context) {
|
|
8471
8594
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8472
|
-
const manifestPath =
|
|
8595
|
+
const manifestPath = import_node_path23.default.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8473
8596
|
const defaultManifest = {
|
|
8474
8597
|
name,
|
|
8475
8598
|
version: "0.1.0"
|
|
@@ -8506,7 +8629,7 @@ var codeCommand = {
|
|
|
8506
8629
|
async run(args, context) {
|
|
8507
8630
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8508
8631
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8509
|
-
const parsed =
|
|
8632
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8510
8633
|
args,
|
|
8511
8634
|
allowPositionals: true,
|
|
8512
8635
|
strict: false,
|
|
@@ -8555,14 +8678,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8555
8678
|
};
|
|
8556
8679
|
var resolveCurrentCliVersion = async (context) => {
|
|
8557
8680
|
const candidates = [
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8681
|
+
import_node_path23.default.resolve(context.runtimeDir, "..", "package.json"),
|
|
8682
|
+
import_node_path23.default.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8683
|
+
import_node_path23.default.resolve(process.cwd(), "package.json")
|
|
8561
8684
|
];
|
|
8562
8685
|
for (const candidate of candidates) {
|
|
8563
8686
|
if (!await pathExists2(candidate)) continue;
|
|
8564
8687
|
const pkg = await readJsonSafe(candidate);
|
|
8565
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8688
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${import_node_path23.default.sep}packages${import_node_path23.default.sep}cli${import_node_path23.default.sep}`));
|
|
8566
8689
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8567
8690
|
}
|
|
8568
8691
|
return "0.0.0";
|
|
@@ -8612,7 +8735,7 @@ var versionCommand = {
|
|
|
8612
8735
|
name: "version",
|
|
8613
8736
|
aliases: ["v"],
|
|
8614
8737
|
async run(args, context) {
|
|
8615
|
-
const parsed =
|
|
8738
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8616
8739
|
args,
|
|
8617
8740
|
allowPositionals: true,
|
|
8618
8741
|
strict: false,
|
|
@@ -8646,7 +8769,7 @@ var upgradeCommand = {
|
|
|
8646
8769
|
name: "upgrade",
|
|
8647
8770
|
aliases: ["update"],
|
|
8648
8771
|
async run(args, context) {
|
|
8649
|
-
const parsed =
|
|
8772
|
+
const parsed = (0, import_node_util9.parseArgs)({
|
|
8650
8773
|
args,
|
|
8651
8774
|
allowPositionals: true,
|
|
8652
8775
|
strict: false,
|
|
@@ -8800,11 +8923,14 @@ var pluginCommand = {
|
|
|
8800
8923
|
};
|
|
8801
8924
|
|
|
8802
8925
|
// packages/infrastructure/cli/src/preflight.ts
|
|
8926
|
+
var import_node_path25 = __toESM(require("path"), 1);
|
|
8927
|
+
var import_node_url7 = require("url");
|
|
8803
8928
|
init_args();
|
|
8804
8929
|
init_errors();
|
|
8805
8930
|
init_fs();
|
|
8806
8931
|
init_json();
|
|
8807
8932
|
init_src4();
|
|
8933
|
+
var import_meta11 = {};
|
|
8808
8934
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8809
8935
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8810
8936
|
{
|
|
@@ -8830,8 +8956,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8830
8956
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8831
8957
|
let configPath = null;
|
|
8832
8958
|
for (const file of twConfigFiles) {
|
|
8833
|
-
if (await pathExists2(
|
|
8834
|
-
configPath =
|
|
8959
|
+
if (await pathExists2(import_node_path25.default.join(cwd2, file))) {
|
|
8960
|
+
configPath = import_node_path25.default.join(cwd2, file);
|
|
8835
8961
|
break;
|
|
8836
8962
|
}
|
|
8837
8963
|
}
|
|
@@ -8840,7 +8966,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8840
8966
|
return results;
|
|
8841
8967
|
}
|
|
8842
8968
|
try {
|
|
8843
|
-
const configUrl =
|
|
8969
|
+
const configUrl = (0, import_node_url7.pathToFileURL)(configPath);
|
|
8844
8970
|
const configModule = await import(configUrl.href);
|
|
8845
8971
|
const config = configModule.default || configModule;
|
|
8846
8972
|
const theme = config.theme || {};
|
|
@@ -8922,7 +9048,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8922
9048
|
async function hasTailwindCssImport(cwd2) {
|
|
8923
9049
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8924
9050
|
for (const file of cssFiles) {
|
|
8925
|
-
const raw = await readFileSafe(
|
|
9051
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8926
9052
|
if (raw?.includes("tailwindcss")) return true;
|
|
8927
9053
|
}
|
|
8928
9054
|
return false;
|
|
@@ -8938,7 +9064,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8938
9064
|
"app/globals.css"
|
|
8939
9065
|
];
|
|
8940
9066
|
for (const file of cssFiles) {
|
|
8941
|
-
const raw = await readFileSafe(
|
|
9067
|
+
const raw = await readFileSafe(import_node_path25.default.join(cwd2, file));
|
|
8942
9068
|
if (raw === null) continue;
|
|
8943
9069
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8944
9070
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8946,8 +9072,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8946
9072
|
return { found: false, cssFile: null };
|
|
8947
9073
|
}
|
|
8948
9074
|
async function applyTailwindInit(cwd2) {
|
|
8949
|
-
await ensureFileSafe(
|
|
8950
|
-
await ensureFileSafe(
|
|
9075
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9076
|
+
await ensureFileSafe(import_node_path25.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8951
9077
|
}
|
|
8952
9078
|
function check(results, id, label, pass, message, fix) {
|
|
8953
9079
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8969,7 +9095,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8969
9095
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8970
9096
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8971
9097
|
);
|
|
8972
|
-
const pkg = await readJsonSafe(
|
|
9098
|
+
const pkg = await readJsonSafe(import_node_path25.default.join(cwd2, "package.json"));
|
|
8973
9099
|
check(
|
|
8974
9100
|
results,
|
|
8975
9101
|
"package-json",
|
|
@@ -9003,7 +9129,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9003
9129
|
}
|
|
9004
9130
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9005
9131
|
const twConfigChecks = await Promise.all(
|
|
9006
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9132
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path25.default.join(cwd2, file)) }))
|
|
9007
9133
|
);
|
|
9008
9134
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9009
9135
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9015,7 +9141,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9015
9141
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9016
9142
|
"tw init"
|
|
9017
9143
|
);
|
|
9018
|
-
const oldConfig = await readJsonSafe(
|
|
9144
|
+
const oldConfig = await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(import_node_path25.default.join(cwd2, "tailwind.config.ts"));
|
|
9019
9145
|
if (oldConfig) {
|
|
9020
9146
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9021
9147
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9039,7 +9165,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9039
9165
|
validation.message
|
|
9040
9166
|
);
|
|
9041
9167
|
}
|
|
9042
|
-
const hasTsConfig = await pathExists2(
|
|
9168
|
+
const hasTsConfig = await pathExists2(import_node_path25.default.join(cwd2, "tsconfig.json"));
|
|
9043
9169
|
check(
|
|
9044
9170
|
results,
|
|
9045
9171
|
"typescript",
|
|
@@ -9115,7 +9241,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9115
9241
|
function isDirectExecution() {
|
|
9116
9242
|
const scriptPath = process.argv[1];
|
|
9117
9243
|
if (!scriptPath) return false;
|
|
9118
|
-
return
|
|
9244
|
+
return import_meta11.url === (0, import_node_url7.pathToFileURL)(scriptPath).href;
|
|
9119
9245
|
}
|
|
9120
9246
|
if (isDirectExecution()) {
|
|
9121
9247
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9183,6 +9309,7 @@ var installRegistryCommand = {
|
|
|
9183
9309
|
};
|
|
9184
9310
|
|
|
9185
9311
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9312
|
+
var import_node_util10 = require("util");
|
|
9186
9313
|
init_errors();
|
|
9187
9314
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9188
9315
|
if (context.json && options.jsonUnsupported) {
|
|
@@ -9212,7 +9339,7 @@ var parseCommand = {
|
|
|
9212
9339
|
var transformCommand = {
|
|
9213
9340
|
name: "transform",
|
|
9214
9341
|
async run(args, context) {
|
|
9215
|
-
const parsed =
|
|
9342
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9216
9343
|
args,
|
|
9217
9344
|
allowPositionals: true,
|
|
9218
9345
|
strict: false,
|
|
@@ -9255,7 +9382,7 @@ var lintCommand = {
|
|
|
9255
9382
|
var formatCommand2 = {
|
|
9256
9383
|
name: "format",
|
|
9257
9384
|
async run(args, context) {
|
|
9258
|
-
const parsed =
|
|
9385
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9259
9386
|
args,
|
|
9260
9387
|
allowPositionals: true,
|
|
9261
9388
|
strict: false,
|
|
@@ -9297,7 +9424,7 @@ var optimizeCommand = {
|
|
|
9297
9424
|
var splitCommand = {
|
|
9298
9425
|
name: "split",
|
|
9299
9426
|
async run(args, context) {
|
|
9300
|
-
const parsed =
|
|
9427
|
+
const parsed = (0, import_node_util10.parseArgs)({
|
|
9301
9428
|
args,
|
|
9302
9429
|
allowPositionals: true,
|
|
9303
9430
|
strict: false,
|
|
@@ -9393,13 +9520,15 @@ var scriptCommands = [
|
|
|
9393
9520
|
];
|
|
9394
9521
|
|
|
9395
9522
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9523
|
+
var import_node_path26 = __toESM(require("path"), 1);
|
|
9524
|
+
var import_node_util11 = require("util");
|
|
9396
9525
|
init_errors();
|
|
9397
9526
|
init_fs();
|
|
9398
9527
|
init_json();
|
|
9399
9528
|
var storybookCommand = {
|
|
9400
9529
|
name: "storybook",
|
|
9401
9530
|
async run(args, context) {
|
|
9402
|
-
const parsed =
|
|
9531
|
+
const parsed = (0, import_node_util11.parseArgs)({
|
|
9403
9532
|
args,
|
|
9404
9533
|
allowPositionals: true,
|
|
9405
9534
|
strict: false,
|
|
@@ -9433,7 +9562,7 @@ var storybookCommand = {
|
|
|
9433
9562
|
context.output.writeText(
|
|
9434
9563
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9435
9564
|
);
|
|
9436
|
-
const localBin =
|
|
9565
|
+
const localBin = import_node_path26.default.join(
|
|
9437
9566
|
process.cwd(),
|
|
9438
9567
|
"node_modules",
|
|
9439
9568
|
".bin",
|
|
@@ -9450,6 +9579,7 @@ var storybookCommand = {
|
|
|
9450
9579
|
};
|
|
9451
9580
|
|
|
9452
9581
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9582
|
+
var import_node_util12 = require("util");
|
|
9453
9583
|
init_errors();
|
|
9454
9584
|
var studioCommand = {
|
|
9455
9585
|
name: "studio",
|
|
@@ -9457,7 +9587,7 @@ var studioCommand = {
|
|
|
9457
9587
|
if (context.json) {
|
|
9458
9588
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9459
9589
|
}
|
|
9460
|
-
const parsed =
|
|
9590
|
+
const parsed = (0, import_node_util12.parseArgs)({
|
|
9461
9591
|
args,
|
|
9462
9592
|
allowPositionals: true,
|
|
9463
9593
|
strict: false,
|
|
@@ -9523,7 +9653,8 @@ var syncCommand = {
|
|
|
9523
9653
|
};
|
|
9524
9654
|
|
|
9525
9655
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9526
|
-
var
|
|
9656
|
+
var import_node_util13 = require("util");
|
|
9657
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9527
9658
|
init_errors();
|
|
9528
9659
|
|
|
9529
9660
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
@@ -9531,16 +9662,17 @@ init_internal();
|
|
|
9531
9662
|
|
|
9532
9663
|
// packages/domain/engine/src/native-bridge.ts
|
|
9533
9664
|
init_src();
|
|
9665
|
+
var import_meta12 = {};
|
|
9534
9666
|
var log4 = createDebugLogger("engine:native");
|
|
9535
9667
|
function getDirname3() {
|
|
9536
9668
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
9537
|
-
if (typeof
|
|
9538
|
-
return getDirname(
|
|
9669
|
+
if (typeof import_meta12 !== "undefined" && import_meta12.url) {
|
|
9670
|
+
return getDirname(import_meta12.url);
|
|
9539
9671
|
}
|
|
9540
9672
|
return process.cwd();
|
|
9541
9673
|
}
|
|
9542
|
-
var isValidEngineBinding = (
|
|
9543
|
-
const candidate =
|
|
9674
|
+
var isValidEngineBinding = (module2) => {
|
|
9675
|
+
const candidate = module2;
|
|
9544
9676
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
9545
9677
|
};
|
|
9546
9678
|
var createEngineBindingLoader = () => {
|
|
@@ -10348,7 +10480,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10348
10480
|
const parsed = native.parseCssRules(css);
|
|
10349
10481
|
for (const r of parsed) {
|
|
10350
10482
|
const className = prefix + r.className;
|
|
10351
|
-
r.variants.length > 0;
|
|
10483
|
+
const hasVariants = r.variants.length > 0;
|
|
10352
10484
|
const layerName = detectLayerFromClassName(className);
|
|
10353
10485
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10354
10486
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10598,10 +10730,12 @@ async function traceClass(className, options) {
|
|
|
10598
10730
|
}
|
|
10599
10731
|
|
|
10600
10732
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10733
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
10734
|
+
var import_node_path27 = __toESM(require("path"), 1);
|
|
10601
10735
|
init_internal();
|
|
10602
10736
|
init_src2();
|
|
10603
10737
|
function toRelativePath(root, value) {
|
|
10604
|
-
const relative =
|
|
10738
|
+
const relative = import_node_path27.default.relative(root, value);
|
|
10605
10739
|
return relative.length > 0 ? relative : ".";
|
|
10606
10740
|
}
|
|
10607
10741
|
function uniqueSorted(values) {
|
|
@@ -10670,7 +10804,7 @@ function tryCompileClasses(classes) {
|
|
|
10670
10804
|
}
|
|
10671
10805
|
}
|
|
10672
10806
|
function traceSingleFile(filePath, root) {
|
|
10673
|
-
const source =
|
|
10807
|
+
const source = import_node_fs10.default.readFileSync(filePath, "utf8");
|
|
10674
10808
|
const classes = uniqueSorted(scanSource(source));
|
|
10675
10809
|
const imports = extractImports(source);
|
|
10676
10810
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10701,7 +10835,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10701
10835
|
const imports = [];
|
|
10702
10836
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10703
10837
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10704
|
-
const source =
|
|
10838
|
+
const source = import_node_fs10.default.readFileSync(entry.file, "utf8");
|
|
10705
10839
|
const fileImports = extractImports(source);
|
|
10706
10840
|
for (const fileImport of fileImports) {
|
|
10707
10841
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10732,12 +10866,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10732
10866
|
};
|
|
10733
10867
|
}
|
|
10734
10868
|
async function traceTarget(target, options = {}) {
|
|
10735
|
-
const root =
|
|
10736
|
-
const resolvedTarget =
|
|
10737
|
-
if (!
|
|
10869
|
+
const root = import_node_path27.default.resolve(options.root ?? process.cwd());
|
|
10870
|
+
const resolvedTarget = import_node_path27.default.resolve(root, target);
|
|
10871
|
+
if (!import_node_fs10.default.existsSync(resolvedTarget)) {
|
|
10738
10872
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10739
10873
|
}
|
|
10740
|
-
const stat =
|
|
10874
|
+
const stat = import_node_fs10.default.statSync(resolvedTarget);
|
|
10741
10875
|
if (stat.isDirectory()) {
|
|
10742
10876
|
return traceDirectory(resolvedTarget, root);
|
|
10743
10877
|
}
|
|
@@ -10755,7 +10889,7 @@ function parseTraceFormat(value, context) {
|
|
|
10755
10889
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10756
10890
|
}
|
|
10757
10891
|
async function runTraceCli(args, context) {
|
|
10758
|
-
const parsed =
|
|
10892
|
+
const parsed = (0, import_node_util13.parseArgs)({
|
|
10759
10893
|
args,
|
|
10760
10894
|
allowPositionals: true,
|
|
10761
10895
|
strict: false,
|
|
@@ -10899,14 +11033,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10899
11033
|
}
|
|
10900
11034
|
|
|
10901
11035
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10902
|
-
var
|
|
11036
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
11037
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
11038
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10903
11039
|
init_output();
|
|
10904
11040
|
async function runGenerateTypesCli(rawArgs) {
|
|
10905
11041
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10906
11042
|
const logger = createCliLogger({ output });
|
|
10907
11043
|
const cwd2 = process.cwd();
|
|
10908
11044
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10909
|
-
const outPath =
|
|
11045
|
+
const outPath = import_node_path28.default.resolve(cwd2, outFile);
|
|
10910
11046
|
output.writeText("");
|
|
10911
11047
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10912
11048
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -10942,12 +11078,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10942
11078
|
}
|
|
10943
11079
|
output.writeText("");
|
|
10944
11080
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10945
|
-
const outDir =
|
|
10946
|
-
if (!
|
|
10947
|
-
|
|
11081
|
+
const outDir = import_node_path28.default.dirname(outPath);
|
|
11082
|
+
if (!import_node_fs11.default.existsSync(outDir)) {
|
|
11083
|
+
import_node_fs11.default.mkdirSync(outDir, { recursive: true });
|
|
10948
11084
|
}
|
|
10949
|
-
|
|
10950
|
-
logger.ok(
|
|
11085
|
+
import_node_fs11.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11086
|
+
logger.ok(import_node_path28.default.relative(cwd2, outPath));
|
|
10951
11087
|
output.writeText("");
|
|
10952
11088
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
10953
11089
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10958,13 +11094,13 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10958
11094
|
}
|
|
10959
11095
|
async function loadNativeBinding2(cwd2) {
|
|
10960
11096
|
const candidates = [
|
|
10961
|
-
|
|
10962
|
-
|
|
11097
|
+
import_node_path28.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11098
|
+
import_node_path28.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10963
11099
|
];
|
|
10964
11100
|
for (const candidate of candidates) {
|
|
10965
|
-
if (
|
|
11101
|
+
if (import_node_fs11.default.existsSync(candidate)) {
|
|
10966
11102
|
try {
|
|
10967
|
-
return
|
|
11103
|
+
return require(candidate);
|
|
10968
11104
|
} catch {
|
|
10969
11105
|
}
|
|
10970
11106
|
}
|
|
@@ -10973,9 +11109,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10973
11109
|
}
|
|
10974
11110
|
|
|
10975
11111
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
11112
|
+
var import_node_util14 = require("util");
|
|
10976
11113
|
init_errors();
|
|
10977
11114
|
|
|
10978
11115
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11116
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
11117
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
10979
11118
|
init_internal();
|
|
10980
11119
|
init_src2();
|
|
10981
11120
|
function extractVariantChain(usage) {
|
|
@@ -11024,7 +11163,7 @@ async function whyClass(className, options) {
|
|
|
11024
11163
|
for (const file of scanResult.files) {
|
|
11025
11164
|
const source = (() => {
|
|
11026
11165
|
try {
|
|
11027
|
-
return
|
|
11166
|
+
return import_node_fs12.default.readFileSync(file.file, "utf8");
|
|
11028
11167
|
} catch {
|
|
11029
11168
|
return "";
|
|
11030
11169
|
}
|
|
@@ -11038,7 +11177,7 @@ async function whyClass(className, options) {
|
|
|
11038
11177
|
className
|
|
11039
11178
|
]);
|
|
11040
11179
|
usedIn.push({
|
|
11041
|
-
file:
|
|
11180
|
+
file: import_node_path29.default.relative(root, file.file) || import_node_path29.default.basename(file.file),
|
|
11042
11181
|
line: location.line,
|
|
11043
11182
|
column: location.column,
|
|
11044
11183
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11159,7 +11298,7 @@ function printWhyOutput(result, output) {
|
|
|
11159
11298
|
output.writeText("");
|
|
11160
11299
|
}
|
|
11161
11300
|
async function runWhyCli(args, context) {
|
|
11162
|
-
const parsed =
|
|
11301
|
+
const parsed = (0, import_node_util14.parseArgs)({
|
|
11163
11302
|
args,
|
|
11164
11303
|
allowPositionals: true,
|
|
11165
11304
|
strict: false,
|
|
@@ -11201,7 +11340,7 @@ function toVariadic(value) {
|
|
|
11201
11340
|
return Array.isArray(value) ? value : [value];
|
|
11202
11341
|
}
|
|
11203
11342
|
function buildMainProgram(context) {
|
|
11204
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11343
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11205
11344
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11206
11345
|
const program2 = new Command("tw");
|
|
11207
11346
|
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");
|
|
@@ -11496,15 +11635,15 @@ init_runtime();
|
|
|
11496
11635
|
init_args();
|
|
11497
11636
|
init_args();
|
|
11498
11637
|
init_output();
|
|
11638
|
+
var import_meta13 = {};
|
|
11499
11639
|
async function main2() {
|
|
11500
11640
|
await runCliMain({
|
|
11501
|
-
importMetaUrl:
|
|
11641
|
+
importMetaUrl: import_meta13.url,
|
|
11502
11642
|
buildProgram: buildMainProgram
|
|
11503
11643
|
});
|
|
11504
11644
|
}
|
|
11505
|
-
var __filename2 =
|
|
11645
|
+
var __filename2 = (0, import_node_url8.fileURLToPath)(import_meta13.url);
|
|
11506
11646
|
if (process.argv[1] === __filename2) {
|
|
11507
11647
|
main2();
|
|
11508
11648
|
}
|
|
11509
|
-
//# sourceMappingURL=tw.js.map
|
|
11510
11649
|
//# sourceMappingURL=tw.js.map
|