tailwind-styled-v4 5.0.36 → 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.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- 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.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- 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.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- 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.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- 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.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- 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 +180 -127
- package/dist/index.d.ts +180 -127
- 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.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- 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 +103 -62
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +53 -35
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +115 -50
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +44 -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.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- 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.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- 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.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- 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.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- 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.d.mts +2 -1
- package/dist/svelte.d.ts +2 -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.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- 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.d.mts +4 -1
- package/dist/vue.d.ts +4 -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/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
- package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
import * as fs11 from 'fs';
|
|
3
|
-
import fs11__default, { readFileSync, readdirSync } from 'fs';
|
|
4
|
-
import * as path6 from 'path';
|
|
5
|
-
import path6__default, { join, extname } from 'path';
|
|
6
|
-
import 'crypto';
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
8
|
-
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
|
|
9
|
-
import { availableParallelism } from 'os';
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
import fs7 from 'fs/promises';
|
|
12
|
-
import { isTTY, spinner, note, outro, intro, text, isCancel, select, confirm } from '@clack/prompts';
|
|
13
|
-
import { parseArgs } from 'util';
|
|
14
|
-
import { spawn } from 'child_process';
|
|
15
|
-
|
|
16
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
17
2
|
var __create = Object.create;
|
|
18
3
|
var __defProp = Object.defineProperty;
|
|
@@ -49,14 +34,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
34
|
// file that has been converted to a CommonJS file using a Babel-
|
|
50
35
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
36
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
52
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
38
|
mod
|
|
54
39
|
));
|
|
55
40
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
56
41
|
|
|
57
42
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
58
43
|
var require_error = __commonJS({
|
|
59
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports
|
|
44
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports) {
|
|
45
|
+
"use strict";
|
|
60
46
|
var CommanderError2 = class extends Error {
|
|
61
47
|
/**
|
|
62
48
|
* Constructs the CommanderError class
|
|
@@ -84,14 +70,15 @@ var require_error = __commonJS({
|
|
|
84
70
|
this.name = this.constructor.name;
|
|
85
71
|
}
|
|
86
72
|
};
|
|
87
|
-
exports
|
|
88
|
-
exports
|
|
73
|
+
exports.CommanderError = CommanderError2;
|
|
74
|
+
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
89
75
|
}
|
|
90
76
|
});
|
|
91
77
|
|
|
92
78
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
93
79
|
var require_argument = __commonJS({
|
|
94
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports
|
|
80
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports) {
|
|
81
|
+
"use strict";
|
|
95
82
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
96
83
|
var Argument2 = class {
|
|
97
84
|
/**
|
|
@@ -211,14 +198,15 @@ var require_argument = __commonJS({
|
|
|
211
198
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
212
199
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
213
200
|
}
|
|
214
|
-
exports
|
|
215
|
-
exports
|
|
201
|
+
exports.Argument = Argument2;
|
|
202
|
+
exports.humanReadableArgName = humanReadableArgName;
|
|
216
203
|
}
|
|
217
204
|
});
|
|
218
205
|
|
|
219
206
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
220
207
|
var require_help = __commonJS({
|
|
221
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports
|
|
208
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports) {
|
|
209
|
+
"use strict";
|
|
222
210
|
var { humanReadableArgName } = require_argument();
|
|
223
211
|
var Help2 = class {
|
|
224
212
|
constructor() {
|
|
@@ -626,13 +614,14 @@ var require_help = __commonJS({
|
|
|
626
614
|
}).join("\n");
|
|
627
615
|
}
|
|
628
616
|
};
|
|
629
|
-
exports
|
|
617
|
+
exports.Help = Help2;
|
|
630
618
|
}
|
|
631
619
|
});
|
|
632
620
|
|
|
633
621
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
634
622
|
var require_option = __commonJS({
|
|
635
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports
|
|
623
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports) {
|
|
624
|
+
"use strict";
|
|
636
625
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
637
626
|
var Option2 = class {
|
|
638
627
|
/**
|
|
@@ -897,14 +886,15 @@ var require_option = __commonJS({
|
|
|
897
886
|
}
|
|
898
887
|
return { shortFlag, longFlag };
|
|
899
888
|
}
|
|
900
|
-
exports
|
|
901
|
-
exports
|
|
889
|
+
exports.Option = Option2;
|
|
890
|
+
exports.DualOptions = DualOptions;
|
|
902
891
|
}
|
|
903
892
|
});
|
|
904
893
|
|
|
905
894
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
906
895
|
var require_suggestSimilar = __commonJS({
|
|
907
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports
|
|
896
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports) {
|
|
897
|
+
"use strict";
|
|
908
898
|
var maxDistance = 3;
|
|
909
899
|
function editDistance(a, b) {
|
|
910
900
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -978,13 +968,14 @@ var require_suggestSimilar = __commonJS({
|
|
|
978
968
|
}
|
|
979
969
|
return "";
|
|
980
970
|
}
|
|
981
|
-
exports
|
|
971
|
+
exports.suggestSimilar = suggestSimilar;
|
|
982
972
|
}
|
|
983
973
|
});
|
|
984
974
|
|
|
985
975
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
986
976
|
var require_command = __commonJS({
|
|
987
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports
|
|
977
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports) {
|
|
978
|
+
"use strict";
|
|
988
979
|
var EventEmitter = __require("events").EventEmitter;
|
|
989
980
|
var childProcess = __require("child_process");
|
|
990
981
|
var path30 = __require("path");
|
|
@@ -1398,6 +1389,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1398
1389
|
this._exitCallback = (err) => {
|
|
1399
1390
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1400
1391
|
throw err;
|
|
1392
|
+
} else {
|
|
1401
1393
|
}
|
|
1402
1394
|
};
|
|
1403
1395
|
}
|
|
@@ -3020,29 +3012,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3020
3012
|
return arg;
|
|
3021
3013
|
});
|
|
3022
3014
|
}
|
|
3023
|
-
exports
|
|
3015
|
+
exports.Command = Command2;
|
|
3024
3016
|
}
|
|
3025
3017
|
});
|
|
3026
3018
|
|
|
3027
3019
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3028
3020
|
var require_commander = __commonJS({
|
|
3029
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(exports
|
|
3021
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports) {
|
|
3022
|
+
"use strict";
|
|
3030
3023
|
var { Argument: Argument2 } = require_argument();
|
|
3031
3024
|
var { Command: Command2 } = require_command();
|
|
3032
3025
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3033
3026
|
var { Help: Help2 } = require_help();
|
|
3034
3027
|
var { Option: Option2 } = require_option();
|
|
3035
|
-
exports
|
|
3036
|
-
exports
|
|
3037
|
-
exports
|
|
3038
|
-
exports
|
|
3039
|
-
exports
|
|
3040
|
-
exports
|
|
3041
|
-
exports
|
|
3042
|
-
exports
|
|
3043
|
-
exports
|
|
3044
|
-
exports
|
|
3045
|
-
exports
|
|
3028
|
+
exports.program = new Command2();
|
|
3029
|
+
exports.createCommand = (name) => new Command2(name);
|
|
3030
|
+
exports.createOption = (flags, description) => new Option2(flags, description);
|
|
3031
|
+
exports.createArgument = (name, description) => new Argument2(name, description);
|
|
3032
|
+
exports.Command = Command2;
|
|
3033
|
+
exports.Option = Option2;
|
|
3034
|
+
exports.Argument = Argument2;
|
|
3035
|
+
exports.Help = Help2;
|
|
3036
|
+
exports.CommanderError = CommanderError2;
|
|
3037
|
+
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
3038
|
+
exports.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3046
3039
|
}
|
|
3047
3040
|
});
|
|
3048
3041
|
|
|
@@ -3050,7 +3043,8 @@ var require_commander = __commonJS({
|
|
|
3050
3043
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3051
3044
|
var init_esm = __esm({
|
|
3052
3045
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3053
|
-
|
|
3046
|
+
"use strict";
|
|
3047
|
+
import_index = __toESM(require_commander(), 1);
|
|
3054
3048
|
({
|
|
3055
3049
|
program,
|
|
3056
3050
|
createCommand,
|
|
@@ -3095,6 +3089,7 @@ function errorExitCode(error) {
|
|
|
3095
3089
|
var CliError, CliUsageError;
|
|
3096
3090
|
var init_errors = __esm({
|
|
3097
3091
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3092
|
+
"use strict";
|
|
3098
3093
|
CliError = class extends Error {
|
|
3099
3094
|
exitCode;
|
|
3100
3095
|
code;
|
|
@@ -3150,12 +3145,18 @@ function getDirname(importMetaUrl) {
|
|
|
3150
3145
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3151
3146
|
var init_esmHelpers = __esm({
|
|
3152
3147
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3148
|
+
"use strict";
|
|
3153
3149
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3154
3150
|
nodeModuleRef = null;
|
|
3155
3151
|
_nodePath = null;
|
|
3156
3152
|
_nodeUrl = null;
|
|
3157
3153
|
}
|
|
3158
3154
|
});
|
|
3155
|
+
|
|
3156
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3157
|
+
import { createRequire } from "module";
|
|
3158
|
+
import * as fs from "fs";
|
|
3159
|
+
import * as path from "path";
|
|
3159
3160
|
function platformKey() {
|
|
3160
3161
|
if (isBrowser2) return "browser";
|
|
3161
3162
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3171,7 +3172,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3171
3172
|
}
|
|
3172
3173
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3173
3174
|
if (envPath) {
|
|
3174
|
-
if (
|
|
3175
|
+
if (fs.existsSync(envPath)) {
|
|
3175
3176
|
return { path: envPath, source: "env", platform, tried };
|
|
3176
3177
|
}
|
|
3177
3178
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3180,7 +3181,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3180
3181
|
for (const pkg of prebuiltPkgs) {
|
|
3181
3182
|
try {
|
|
3182
3183
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3183
|
-
if (
|
|
3184
|
+
if (fs.existsSync(candidate)) {
|
|
3184
3185
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3185
3186
|
}
|
|
3186
3187
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3191,13 +3192,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3191
3192
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3192
3193
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3193
3194
|
if (runtimeDir) {
|
|
3194
|
-
for (const depth of ["..",
|
|
3195
|
-
const pkgRoot =
|
|
3195
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3196
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3196
3197
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3197
3198
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3198
|
-
const candidate =
|
|
3199
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3199
3200
|
tried.push(`self-bundled:${candidate}`);
|
|
3200
|
-
if (
|
|
3201
|
+
if (fs.existsSync(candidate)) {
|
|
3201
3202
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3202
3203
|
}
|
|
3203
3204
|
}
|
|
@@ -3209,29 +3210,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3209
3210
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3210
3211
|
const localCandidates = [];
|
|
3211
3212
|
for (const bin of BINARY_NAMES) {
|
|
3212
|
-
localCandidates.push(
|
|
3213
|
-
localCandidates.push(
|
|
3214
|
-
localCandidates.push(
|
|
3215
|
-
localCandidates.push(
|
|
3213
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3214
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3215
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3216
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3216
3217
|
}
|
|
3217
3218
|
for (const startDir of [cwd2, base]) {
|
|
3218
3219
|
let dir = startDir;
|
|
3219
3220
|
for (let i = 0; i < 6; i++) {
|
|
3220
|
-
const nativeDir =
|
|
3221
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3221
3222
|
for (const bin of BINARY_NAMES) {
|
|
3222
|
-
localCandidates.push(
|
|
3223
|
-
localCandidates.push(
|
|
3224
|
-
localCandidates.push(
|
|
3225
|
-
localCandidates.push(
|
|
3223
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3224
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3225
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3226
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3226
3227
|
}
|
|
3227
|
-
const parent =
|
|
3228
|
+
const parent = path.resolve(dir, "..");
|
|
3228
3229
|
if (parent === dir) break;
|
|
3229
3230
|
dir = parent;
|
|
3230
3231
|
}
|
|
3231
3232
|
}
|
|
3232
3233
|
for (const candidate of localCandidates) {
|
|
3233
3234
|
tried.push(`local:${candidate}`);
|
|
3234
|
-
if (
|
|
3235
|
+
if (fs.existsSync(candidate)) {
|
|
3235
3236
|
return { path: candidate, source: "local", platform, tried };
|
|
3236
3237
|
}
|
|
3237
3238
|
}
|
|
@@ -3240,6 +3241,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3240
3241
|
var isBrowser2, _require, PLATFORM_MAP;
|
|
3241
3242
|
var init_native_resolution = __esm({
|
|
3242
3243
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3244
|
+
"use strict";
|
|
3243
3245
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3244
3246
|
_require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
|
|
3245
3247
|
PLATFORM_MAP = {
|
|
@@ -3252,6 +3254,13 @@ var init_native_resolution = __esm({
|
|
|
3252
3254
|
};
|
|
3253
3255
|
}
|
|
3254
3256
|
});
|
|
3257
|
+
|
|
3258
|
+
// packages/domain/shared/src/index.ts
|
|
3259
|
+
import { createHash } from "crypto";
|
|
3260
|
+
import fs2 from "fs";
|
|
3261
|
+
import path2 from "path";
|
|
3262
|
+
import { fileURLToPath } from "url";
|
|
3263
|
+
import { createRequire as createRequire2 } from "module";
|
|
3255
3264
|
function createLogger(namespace) {
|
|
3256
3265
|
const prefix = `[${namespace}]`;
|
|
3257
3266
|
return {
|
|
@@ -3294,9 +3303,9 @@ function loadNativeBinding(options) {
|
|
|
3294
3303
|
const { runtimeDir, candidates, isValid } = options;
|
|
3295
3304
|
const loadErrors = [];
|
|
3296
3305
|
for (const candidate of candidates) {
|
|
3297
|
-
const candidatePath =
|
|
3306
|
+
const candidatePath = path2.resolve(runtimeDir, candidate);
|
|
3298
3307
|
try {
|
|
3299
|
-
if (!
|
|
3308
|
+
if (!fs2.existsSync(candidatePath) && !fs2.existsSync(candidatePath + ".node")) {
|
|
3300
3309
|
continue;
|
|
3301
3310
|
}
|
|
3302
3311
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3328,9 +3337,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3328
3337
|
}
|
|
3329
3338
|
}
|
|
3330
3339
|
if (!includeDefaultCandidates) return candidates;
|
|
3331
|
-
if (
|
|
3340
|
+
if (fs2.existsSync(runtimeDir)) {
|
|
3332
3341
|
try {
|
|
3333
|
-
for (const entry of
|
|
3342
|
+
for (const entry of fs2.readdirSync(runtimeDir)) {
|
|
3334
3343
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3335
3344
|
}
|
|
3336
3345
|
} catch {
|
|
@@ -3339,22 +3348,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3339
3348
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3340
3349
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3341
3350
|
for (const bin of BINARY_NAMES) {
|
|
3342
|
-
candidates.push(
|
|
3343
|
-
candidates.push(
|
|
3344
|
-
candidates.push(
|
|
3345
|
-
candidates.push(
|
|
3346
|
-
candidates.push(
|
|
3347
|
-
candidates.push(
|
|
3348
|
-
candidates.push(
|
|
3349
|
-
candidates.push(
|
|
3350
|
-
candidates.push(
|
|
3351
|
+
candidates.push(path2.resolve(runtimeDir, `${bin}.node`));
|
|
3352
|
+
candidates.push(path2.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3353
|
+
candidates.push(path2.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3354
|
+
candidates.push(path2.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3355
|
+
candidates.push(path2.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3356
|
+
candidates.push(path2.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3357
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3358
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3359
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3351
3360
|
}
|
|
3352
3361
|
return Array.from(new Set(candidates));
|
|
3353
3362
|
}
|
|
3354
3363
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3355
|
-
if (dir) return
|
|
3364
|
+
if (dir) return path2.resolve(dir);
|
|
3356
3365
|
try {
|
|
3357
|
-
return
|
|
3366
|
+
return path2.dirname(fileURLToPath(importMetaUrl));
|
|
3358
3367
|
} catch {
|
|
3359
3368
|
return process.cwd();
|
|
3360
3369
|
}
|
|
@@ -3362,6 +3371,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
3362
3371
|
var TwError, _require2;
|
|
3363
3372
|
var init_src = __esm({
|
|
3364
3373
|
"packages/domain/shared/src/index.ts"() {
|
|
3374
|
+
"use strict";
|
|
3365
3375
|
init_esmHelpers();
|
|
3366
3376
|
init_native_resolution();
|
|
3367
3377
|
TwError = class _TwError extends Error {
|
|
@@ -3416,7 +3426,7 @@ var init_src = __esm({
|
|
|
3416
3426
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3417
3427
|
}
|
|
3418
3428
|
};
|
|
3419
|
-
_require2 =
|
|
3429
|
+
_require2 = createRequire2(import.meta.url);
|
|
3420
3430
|
}
|
|
3421
3431
|
});
|
|
3422
3432
|
|
|
@@ -3449,12 +3459,14 @@ __export(native_bridge_exports, {
|
|
|
3449
3459
|
startWatchNative: () => startWatchNative,
|
|
3450
3460
|
stopWatchNative: () => stopWatchNative
|
|
3451
3461
|
});
|
|
3462
|
+
import path3 from "path";
|
|
3463
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3452
3464
|
function getDirname2() {
|
|
3453
3465
|
if (typeof __dirname !== "undefined") {
|
|
3454
3466
|
return __dirname;
|
|
3455
3467
|
}
|
|
3456
3468
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3457
|
-
return
|
|
3469
|
+
return path3.dirname(fileURLToPath2(import.meta.url));
|
|
3458
3470
|
}
|
|
3459
3471
|
return process.cwd();
|
|
3460
3472
|
}
|
|
@@ -3662,6 +3674,7 @@ function hasNativeWatchBinding() {
|
|
|
3662
3674
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3663
3675
|
var init_native_bridge = __esm({
|
|
3664
3676
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3677
|
+
"use strict";
|
|
3665
3678
|
init_src();
|
|
3666
3679
|
log = createDebugLogger("scanner:native");
|
|
3667
3680
|
isValidScannerBinding = (module) => {
|
|
@@ -3742,13 +3755,17 @@ var init_native_bridge = __esm({
|
|
|
3742
3755
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3743
3756
|
}
|
|
3744
3757
|
});
|
|
3758
|
+
|
|
3759
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3760
|
+
import fs3 from "fs";
|
|
3761
|
+
import path4 from "path";
|
|
3745
3762
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3746
|
-
const dir = cacheDir ?
|
|
3747
|
-
return
|
|
3763
|
+
const dir = cacheDir ? path4.resolve(rootDir, cacheDir) : path4.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3764
|
+
return path4.join(dir, "scanner-cache.json");
|
|
3748
3765
|
}
|
|
3749
3766
|
function readCache(rootDir, cacheDir) {
|
|
3750
3767
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3751
|
-
|
|
3768
|
+
fs3.mkdirSync(path4.dirname(cachePath), { recursive: true });
|
|
3752
3769
|
const result = cacheReadNative(cachePath);
|
|
3753
3770
|
if (!result) return [];
|
|
3754
3771
|
return result.entries.map((e) => ({
|
|
@@ -3763,7 +3780,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3763
3780
|
}
|
|
3764
3781
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3765
3782
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3766
|
-
|
|
3783
|
+
fs3.mkdirSync(path4.dirname(cachePath), { recursive: true });
|
|
3767
3784
|
const success = cacheWriteNative(cachePath, entries);
|
|
3768
3785
|
if (!success) {
|
|
3769
3786
|
throw new Error(
|
|
@@ -3782,11 +3799,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3782
3799
|
nowMs
|
|
3783
3800
|
);
|
|
3784
3801
|
}
|
|
3802
|
+
var STALE_THRESHOLD_MS;
|
|
3785
3803
|
var init_cache_native = __esm({
|
|
3786
3804
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3805
|
+
"use strict";
|
|
3787
3806
|
init_native_bridge();
|
|
3807
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3788
3808
|
}
|
|
3789
3809
|
});
|
|
3810
|
+
|
|
3811
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3812
|
+
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
3813
|
+
import path5 from "path";
|
|
3814
|
+
import { availableParallelism } from "os";
|
|
3815
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3790
3816
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3791
3817
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3792
3818
|
if (native !== null) return native;
|
|
@@ -3827,7 +3853,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3827
3853
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
3828
3854
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3829
3855
|
} = options;
|
|
3830
|
-
const files = collectFiles(
|
|
3856
|
+
const files = collectFiles(path5.resolve(rootDir), extensions, ignoreDirs);
|
|
3831
3857
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3832
3858
|
return mergeResults(batchExtractClassesNative(files));
|
|
3833
3859
|
}
|
|
@@ -3846,6 +3872,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3846
3872
|
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3847
3873
|
var init_parallel_scanner = __esm({
|
|
3848
3874
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3875
|
+
"use strict";
|
|
3849
3876
|
init_src2();
|
|
3850
3877
|
init_native_bridge();
|
|
3851
3878
|
PARALLEL_THRESHOLD = 50;
|
|
@@ -3864,12 +3891,16 @@ var init_parallel_scanner = __esm({
|
|
|
3864
3891
|
parentPort.postMessage(msg);
|
|
3865
3892
|
}
|
|
3866
3893
|
}
|
|
3867
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3894
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
|
|
3868
3895
|
}
|
|
3869
3896
|
});
|
|
3870
|
-
|
|
3897
|
+
|
|
3898
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3899
|
+
import { z } from "zod";
|
|
3900
|
+
var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3871
3901
|
var init_schemas = __esm({
|
|
3872
3902
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3903
|
+
"use strict";
|
|
3873
3904
|
init_src();
|
|
3874
3905
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3875
3906
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3910,7 +3941,7 @@ var init_schemas = __esm({
|
|
|
3910
3941
|
message: "scan result totalFiles must match files.length",
|
|
3911
3942
|
path: ["totalFiles"]
|
|
3912
3943
|
});
|
|
3913
|
-
z.object({
|
|
3944
|
+
ScannerWorkerRequestSchema = z.object({
|
|
3914
3945
|
rootDir: z.string().min(1),
|
|
3915
3946
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3916
3947
|
});
|
|
@@ -3948,12 +3979,17 @@ __export(src_exports, {
|
|
|
3948
3979
|
scanWorkspace: () => scanWorkspace,
|
|
3949
3980
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
3950
3981
|
});
|
|
3982
|
+
import fs4 from "fs";
|
|
3983
|
+
import { createRequire as createRequire3 } from "module";
|
|
3984
|
+
import path6 from "path";
|
|
3985
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
3986
|
+
import { Worker as Worker2 } from "worker_threads";
|
|
3951
3987
|
function getRuntimeDir() {
|
|
3952
3988
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3953
3989
|
return __dirname;
|
|
3954
3990
|
}
|
|
3955
3991
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3956
|
-
return
|
|
3992
|
+
return path6.dirname(fileURLToPath4(import.meta.url));
|
|
3957
3993
|
}
|
|
3958
3994
|
return process.cwd();
|
|
3959
3995
|
}
|
|
@@ -3963,17 +3999,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
3963
3999
|
return __dirname;
|
|
3964
4000
|
}
|
|
3965
4001
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3966
|
-
return
|
|
4002
|
+
return path6.dirname(fileURLToPath4(import.meta.url));
|
|
3967
4003
|
}
|
|
3968
4004
|
return process.cwd();
|
|
3969
4005
|
})();
|
|
3970
4006
|
const candidates = [
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
4007
|
+
path6.resolve(runtimeDir, "worker.cjs"),
|
|
4008
|
+
path6.resolve(runtimeDir, "worker.js"),
|
|
4009
|
+
path6.resolve(runtimeDir, "worker.ts")
|
|
3974
4010
|
];
|
|
3975
4011
|
for (const candidate of candidates) {
|
|
3976
|
-
if (
|
|
4012
|
+
if (fs4.existsSync(candidate)) return candidate;
|
|
3977
4013
|
}
|
|
3978
4014
|
return null;
|
|
3979
4015
|
}
|
|
@@ -3985,7 +4021,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
3985
4021
|
}
|
|
3986
4022
|
return new Promise((resolve2, reject) => {
|
|
3987
4023
|
const settleState = { settled: false };
|
|
3988
|
-
const worker = new
|
|
4024
|
+
const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
3989
4025
|
const timeout = setTimeout(() => {
|
|
3990
4026
|
if (!settleState.settled) {
|
|
3991
4027
|
settleState.settled = true;
|
|
@@ -4030,19 +4066,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4030
4066
|
if (!currentDir) continue;
|
|
4031
4067
|
const entries = (() => {
|
|
4032
4068
|
try {
|
|
4033
|
-
return
|
|
4069
|
+
return fs4.readdirSync(currentDir, { withFileTypes: true });
|
|
4034
4070
|
} catch {
|
|
4035
4071
|
return [];
|
|
4036
4072
|
}
|
|
4037
4073
|
})();
|
|
4038
4074
|
for (const entry of entries) {
|
|
4039
|
-
const fullPath =
|
|
4075
|
+
const fullPath = path6.join(currentDir, entry.name);
|
|
4040
4076
|
if (entry.isDirectory()) {
|
|
4041
4077
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4042
4078
|
continue;
|
|
4043
4079
|
}
|
|
4044
4080
|
if (!entry.isFile()) continue;
|
|
4045
|
-
if (!extensionSet.has(
|
|
4081
|
+
if (!extensionSet.has(path6.extname(entry.name))) continue;
|
|
4046
4082
|
candidates.push(fullPath);
|
|
4047
4083
|
}
|
|
4048
4084
|
}
|
|
@@ -4069,7 +4105,7 @@ function scanSource(source) {
|
|
|
4069
4105
|
);
|
|
4070
4106
|
}
|
|
4071
4107
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4072
|
-
return includeExtensions.includes(
|
|
4108
|
+
return includeExtensions.includes(path6.extname(filePath));
|
|
4073
4109
|
}
|
|
4074
4110
|
function scanFile(filePath) {
|
|
4075
4111
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4089,7 +4125,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4089
4125
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4090
4126
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4091
4127
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4092
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4128
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4093
4129
|
const files = [];
|
|
4094
4130
|
const unique = /* @__PURE__ */ new Set();
|
|
4095
4131
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4129,7 +4165,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4129
4165
|
for (const filePath of candidates) {
|
|
4130
4166
|
const stat = (() => {
|
|
4131
4167
|
try {
|
|
4132
|
-
return
|
|
4168
|
+
return fs4.statSync(filePath);
|
|
4133
4169
|
} catch {
|
|
4134
4170
|
return null;
|
|
4135
4171
|
}
|
|
@@ -4155,7 +4191,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4155
4191
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4156
4192
|
const content = (() => {
|
|
4157
4193
|
try {
|
|
4158
|
-
return
|
|
4194
|
+
return fs4.readFileSync(filePath, "utf8");
|
|
4159
4195
|
} catch {
|
|
4160
4196
|
return null;
|
|
4161
4197
|
}
|
|
@@ -4239,6 +4275,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4239
4275
|
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4240
4276
|
var init_src2 = __esm({
|
|
4241
4277
|
"packages/domain/scanner/src/index.ts"() {
|
|
4278
|
+
"use strict";
|
|
4242
4279
|
init_src();
|
|
4243
4280
|
init_cache_native();
|
|
4244
4281
|
init_native_bridge();
|
|
@@ -4259,7 +4296,7 @@ var init_src2 = __esm({
|
|
|
4259
4296
|
const loadNativeParserBinding = () => {
|
|
4260
4297
|
if (_state.binding !== void 0) return _state.binding;
|
|
4261
4298
|
const runtimeDir = getRuntimeDir();
|
|
4262
|
-
const req =
|
|
4299
|
+
const req = createRequire3(path6.join(runtimeDir, "noop.cjs"));
|
|
4263
4300
|
const _platform = process.platform;
|
|
4264
4301
|
const _arch = process.arch;
|
|
4265
4302
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4267,27 +4304,27 @@ var init_src2 = __esm({
|
|
|
4267
4304
|
const candidates = [
|
|
4268
4305
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4269
4306
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4307
|
+
path6.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4308
|
+
path6.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4309
|
+
path6.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4273
4310
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4274
4311
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4312
|
+
path6.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4313
|
+
path6.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4314
|
+
path6.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4278
4315
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4279
|
-
|
|
4280
|
-
|
|
4316
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4317
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4281
4318
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4282
|
-
|
|
4283
|
-
|
|
4319
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4320
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4284
4321
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4322
|
+
path6.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4323
|
+
path6.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4324
|
+
path6.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4325
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4326
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4327
|
+
path6.resolve(
|
|
4291
4328
|
runtimeDir,
|
|
4292
4329
|
"..",
|
|
4293
4330
|
"..",
|
|
@@ -4299,7 +4336,7 @@ var init_src2 = __esm({
|
|
|
4299
4336
|
)
|
|
4300
4337
|
];
|
|
4301
4338
|
for (const fullPath of candidates) {
|
|
4302
|
-
if (!
|
|
4339
|
+
if (!fs4.existsSync(fullPath)) continue;
|
|
4303
4340
|
try {
|
|
4304
4341
|
const required = req(fullPath);
|
|
4305
4342
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4331,6 +4368,9 @@ var init_src2 = __esm({
|
|
|
4331
4368
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4332
4369
|
}
|
|
4333
4370
|
});
|
|
4371
|
+
|
|
4372
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4373
|
+
import fs5 from "fs";
|
|
4334
4374
|
function formatErrorMessage(error) {
|
|
4335
4375
|
return error instanceof Error ? error.message : String(error);
|
|
4336
4376
|
}
|
|
@@ -4341,7 +4381,7 @@ function isRecord(value) {
|
|
|
4341
4381
|
}
|
|
4342
4382
|
async function pathExists(filePath) {
|
|
4343
4383
|
try {
|
|
4344
|
-
await
|
|
4384
|
+
await fs5.promises.access(filePath, fs5.constants.F_OK);
|
|
4345
4385
|
return true;
|
|
4346
4386
|
} catch {
|
|
4347
4387
|
return false;
|
|
@@ -4358,6 +4398,7 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4358
4398
|
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4359
4399
|
var init_utils = __esm({
|
|
4360
4400
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4401
|
+
"use strict";
|
|
4361
4402
|
init_src();
|
|
4362
4403
|
DEFAULT_TOP_LIMIT = 10;
|
|
4363
4404
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4408,6 +4449,7 @@ async function requireNativeCssCompiler() {
|
|
|
4408
4449
|
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4409
4450
|
var init_binding = __esm({
|
|
4410
4451
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4452
|
+
"use strict";
|
|
4411
4453
|
init_src();
|
|
4412
4454
|
init_utils();
|
|
4413
4455
|
isAnalyzerModule = (module) => {
|
|
@@ -4458,9 +4500,13 @@ var init_binding = __esm({
|
|
|
4458
4500
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4459
4501
|
}
|
|
4460
4502
|
});
|
|
4461
|
-
|
|
4503
|
+
|
|
4504
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4505
|
+
import { z as z2 } from "zod";
|
|
4506
|
+
var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4462
4507
|
var init_schemas2 = __esm({
|
|
4463
4508
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4509
|
+
"use strict";
|
|
4464
4510
|
init_src();
|
|
4465
4511
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4466
4512
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -4485,76 +4531,76 @@ var init_schemas2 = __esm({
|
|
|
4485
4531
|
parsed.error
|
|
4486
4532
|
);
|
|
4487
4533
|
};
|
|
4488
|
-
CountSchema =
|
|
4489
|
-
|
|
4490
|
-
name:
|
|
4534
|
+
CountSchema = z2.number().int().min(0);
|
|
4535
|
+
ClassUsageSchema = z2.object({
|
|
4536
|
+
name: z2.string(),
|
|
4491
4537
|
count: CountSchema,
|
|
4492
|
-
isUnused:
|
|
4493
|
-
isConflict:
|
|
4538
|
+
isUnused: z2.boolean().optional(),
|
|
4539
|
+
isConflict: z2.boolean().optional()
|
|
4494
4540
|
});
|
|
4495
|
-
|
|
4496
|
-
className:
|
|
4497
|
-
variants:
|
|
4498
|
-
classes:
|
|
4499
|
-
message:
|
|
4541
|
+
ClassConflictSchema = z2.object({
|
|
4542
|
+
className: z2.string(),
|
|
4543
|
+
variants: z2.array(z2.string()),
|
|
4544
|
+
classes: z2.array(z2.string()),
|
|
4545
|
+
message: z2.string()
|
|
4500
4546
|
});
|
|
4501
|
-
ClassCountSchema =
|
|
4502
|
-
name:
|
|
4547
|
+
ClassCountSchema = z2.object({
|
|
4548
|
+
name: z2.string(),
|
|
4503
4549
|
count: CountSchema
|
|
4504
4550
|
});
|
|
4505
|
-
NativeReportSchema =
|
|
4506
|
-
root:
|
|
4551
|
+
NativeReportSchema = z2.object({
|
|
4552
|
+
root: z2.string(),
|
|
4507
4553
|
totalFiles: CountSchema,
|
|
4508
4554
|
uniqueClassCount: CountSchema,
|
|
4509
4555
|
totalClassOccurrences: CountSchema,
|
|
4510
|
-
topClasses:
|
|
4511
|
-
duplicateCandidates:
|
|
4512
|
-
safelist:
|
|
4556
|
+
topClasses: z2.array(ClassCountSchema),
|
|
4557
|
+
duplicateCandidates: z2.array(ClassCountSchema),
|
|
4558
|
+
safelist: z2.array(z2.string())
|
|
4513
4559
|
});
|
|
4514
|
-
NativeCssCompileResultSchema =
|
|
4515
|
-
css:
|
|
4516
|
-
resolvedClasses:
|
|
4517
|
-
unknownClasses:
|
|
4560
|
+
NativeCssCompileResultSchema = z2.object({
|
|
4561
|
+
css: z2.string(),
|
|
4562
|
+
resolvedClasses: z2.array(z2.string()),
|
|
4563
|
+
unknownClasses: z2.array(z2.string()),
|
|
4518
4564
|
sizeBytes: CountSchema
|
|
4519
4565
|
});
|
|
4520
|
-
AnalyzerClassStatsSchema =
|
|
4521
|
-
top:
|
|
4566
|
+
AnalyzerClassStatsSchema = z2.object({
|
|
4567
|
+
top: z2.number({
|
|
4522
4568
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4523
4569
|
}).finite().optional(),
|
|
4524
|
-
frequentThreshold:
|
|
4570
|
+
frequentThreshold: z2.number({
|
|
4525
4571
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4526
4572
|
}).finite().optional()
|
|
4527
4573
|
});
|
|
4528
|
-
AnalyzerSemanticOptionsSchema =
|
|
4529
|
-
tailwindConfigPath:
|
|
4574
|
+
AnalyzerSemanticOptionsSchema = z2.object({
|
|
4575
|
+
tailwindConfigPath: z2.string({
|
|
4530
4576
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4531
4577
|
}).min(
|
|
4532
4578
|
1,
|
|
4533
4579
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4534
4580
|
).optional()
|
|
4535
4581
|
});
|
|
4536
|
-
AnalyzerOptionsSchema =
|
|
4537
|
-
scanner:
|
|
4582
|
+
AnalyzerOptionsSchema = z2.object({
|
|
4583
|
+
scanner: z2.custom(
|
|
4538
4584
|
(value) => isPlainObject(value),
|
|
4539
4585
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4540
4586
|
).optional(),
|
|
4541
4587
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4542
|
-
semantic:
|
|
4543
|
-
|
|
4588
|
+
semantic: z2.union([
|
|
4589
|
+
z2.boolean({
|
|
4544
4590
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4545
4591
|
}),
|
|
4546
4592
|
AnalyzerSemanticOptionsSchema
|
|
4547
4593
|
]).optional(),
|
|
4548
|
-
includeClass:
|
|
4594
|
+
includeClass: z2.custom(
|
|
4549
4595
|
(value) => typeof value === "function",
|
|
4550
4596
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4551
4597
|
).optional()
|
|
4552
4598
|
});
|
|
4553
|
-
ClassToCssOptionsSchema =
|
|
4554
|
-
prefix:
|
|
4599
|
+
ClassToCssOptionsSchema = z2.object({
|
|
4600
|
+
prefix: z2.union([z2.string(), z2.null()], {
|
|
4555
4601
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4556
4602
|
}).optional(),
|
|
4557
|
-
strict:
|
|
4603
|
+
strict: z2.boolean({
|
|
4558
4604
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4559
4605
|
}).optional()
|
|
4560
4606
|
});
|
|
@@ -4568,9 +4614,15 @@ var init_schemas2 = __esm({
|
|
|
4568
4614
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4569
4615
|
}
|
|
4570
4616
|
});
|
|
4617
|
+
|
|
4618
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4619
|
+
import fs6 from "fs";
|
|
4620
|
+
import path7 from "path";
|
|
4621
|
+
import { pathToFileURL } from "url";
|
|
4571
4622
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
|
|
4572
4623
|
var init_semantic = __esm({
|
|
4573
4624
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4625
|
+
"use strict";
|
|
4574
4626
|
init_binding();
|
|
4575
4627
|
init_utils();
|
|
4576
4628
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4606,11 +4658,11 @@ var init_semantic = __esm({
|
|
|
4606
4658
|
};
|
|
4607
4659
|
};
|
|
4608
4660
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4609
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4661
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path7.extname(configPath).toLowerCase());
|
|
4610
4662
|
};
|
|
4611
4663
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4612
4664
|
if (explicitPath) {
|
|
4613
|
-
const resolved =
|
|
4665
|
+
const resolved = path7.resolve(root, explicitPath);
|
|
4614
4666
|
if (!await pathExists(resolved)) return null;
|
|
4615
4667
|
return resolved;
|
|
4616
4668
|
}
|
|
@@ -4621,7 +4673,7 @@ var init_semantic = __esm({
|
|
|
4621
4673
|
"tailwind.config.mjs"
|
|
4622
4674
|
];
|
|
4623
4675
|
for (const candidate of candidates) {
|
|
4624
|
-
const fullPath =
|
|
4676
|
+
const fullPath = path7.resolve(root, candidate);
|
|
4625
4677
|
if (await pathExists(fullPath)) return fullPath;
|
|
4626
4678
|
}
|
|
4627
4679
|
return null;
|
|
@@ -4675,7 +4727,7 @@ var init_semantic = __esm({
|
|
|
4675
4727
|
return out;
|
|
4676
4728
|
};
|
|
4677
4729
|
collectSafelistFromSource = async (configPath) => {
|
|
4678
|
-
const source = await
|
|
4730
|
+
const source = await fs6.promises.readFile(configPath, "utf8");
|
|
4679
4731
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4680
4732
|
const allTokens = extractClassesNative2(source);
|
|
4681
4733
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4702,7 +4754,7 @@ var init_semantic = __esm({
|
|
|
4702
4754
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4703
4755
|
};
|
|
4704
4756
|
}
|
|
4705
|
-
const configStat = await
|
|
4757
|
+
const configStat = await fs6.promises.stat(configPath).catch(() => null);
|
|
4706
4758
|
if (configStat) {
|
|
4707
4759
|
const cached = tailwindConfigCache.get(configPath);
|
|
4708
4760
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4826,6 +4878,9 @@ var init_semantic = __esm({
|
|
|
4826
4878
|
};
|
|
4827
4879
|
}
|
|
4828
4880
|
});
|
|
4881
|
+
|
|
4882
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4883
|
+
import path8 from "path";
|
|
4829
4884
|
function normalizeScan(scan, includeClass) {
|
|
4830
4885
|
if (!includeClass) return scan;
|
|
4831
4886
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4880,7 +4935,7 @@ async function buildDistribution(usages, native) {
|
|
|
4880
4935
|
}
|
|
4881
4936
|
async function analyzeWorkspace(root, options = {}) {
|
|
4882
4937
|
const startedAtMs = Date.now();
|
|
4883
|
-
const resolvedRoot =
|
|
4938
|
+
const resolvedRoot = path8.resolve(root);
|
|
4884
4939
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4885
4940
|
const scan = await (async () => {
|
|
4886
4941
|
const scanStartedAtMs = Date.now();
|
|
@@ -4984,6 +5039,7 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
4984
5039
|
}
|
|
4985
5040
|
var init_analyzeWorkspace = __esm({
|
|
4986
5041
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5042
|
+
"use strict";
|
|
4987
5043
|
init_src2();
|
|
4988
5044
|
init_binding();
|
|
4989
5045
|
init_schemas2();
|
|
@@ -4996,6 +5052,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
4996
5052
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
4997
5053
|
var init_classToCss = __esm({
|
|
4998
5054
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5055
|
+
"use strict";
|
|
4999
5056
|
init_binding();
|
|
5000
5057
|
init_schemas2();
|
|
5001
5058
|
init_utils();
|
|
@@ -5116,6 +5173,7 @@ __export(src_exports2, {
|
|
|
5116
5173
|
var __internal;
|
|
5117
5174
|
var init_src3 = __esm({
|
|
5118
5175
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5176
|
+
"use strict";
|
|
5119
5177
|
init_analyzeWorkspace();
|
|
5120
5178
|
init_classToCss();
|
|
5121
5179
|
init_schemas2();
|
|
@@ -5134,6 +5192,10 @@ var init_src3 = __esm({
|
|
|
5134
5192
|
};
|
|
5135
5193
|
}
|
|
5136
5194
|
});
|
|
5195
|
+
|
|
5196
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5197
|
+
import fs7 from "fs/promises";
|
|
5198
|
+
import path9 from "path";
|
|
5137
5199
|
async function pathExists2(filePath) {
|
|
5138
5200
|
try {
|
|
5139
5201
|
await fs7.access(filePath);
|
|
@@ -5163,7 +5225,7 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5163
5225
|
options.onDryRun?.(`write ${filePath}`);
|
|
5164
5226
|
return;
|
|
5165
5227
|
}
|
|
5166
|
-
await fs7.mkdir(
|
|
5228
|
+
await fs7.mkdir(path9.dirname(filePath), { recursive: true });
|
|
5167
5229
|
await fs7.writeFile(filePath, content, "utf8");
|
|
5168
5230
|
}
|
|
5169
5231
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
@@ -5173,12 +5235,14 @@ async function ensureFileSafe(filePath, content, options = {}) {
|
|
|
5173
5235
|
}
|
|
5174
5236
|
var init_fs = __esm({
|
|
5175
5237
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5238
|
+
"use strict";
|
|
5176
5239
|
}
|
|
5177
5240
|
});
|
|
5178
5241
|
|
|
5179
5242
|
// node_modules/picocolors/picocolors.js
|
|
5180
5243
|
var require_picocolors = __commonJS({
|
|
5181
|
-
"node_modules/picocolors/picocolors.js"(exports
|
|
5244
|
+
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
5245
|
+
"use strict";
|
|
5182
5246
|
var p = process || {};
|
|
5183
5247
|
var argv = p.argv || [];
|
|
5184
5248
|
var env = p.env || {};
|
|
@@ -5265,8 +5329,18 @@ function writeJsonSuccess(command, data) {
|
|
|
5265
5329
|
}
|
|
5266
5330
|
var init_json = __esm({
|
|
5267
5331
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5332
|
+
"use strict";
|
|
5268
5333
|
}
|
|
5269
5334
|
});
|
|
5335
|
+
|
|
5336
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5337
|
+
import {
|
|
5338
|
+
intro as clackIntro,
|
|
5339
|
+
isTTY as clackIsTTY,
|
|
5340
|
+
note as clackNote,
|
|
5341
|
+
outro as clackOutro,
|
|
5342
|
+
spinner as clackSpinner
|
|
5343
|
+
} from "@clack/prompts";
|
|
5270
5344
|
function writeLine(stream, message = "") {
|
|
5271
5345
|
stream.write(`${message}
|
|
5272
5346
|
`);
|
|
@@ -5296,7 +5370,7 @@ function createCliOutput(options = {}) {
|
|
|
5296
5370
|
const json = Boolean(options.json);
|
|
5297
5371
|
const debug = Boolean(options.debug);
|
|
5298
5372
|
const verboseEnabled = Boolean(options.verbose);
|
|
5299
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5373
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && clackIsTTY(stdout);
|
|
5300
5374
|
function writeText(message = "", writeOptions = {}) {
|
|
5301
5375
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5302
5376
|
}
|
|
@@ -5330,7 +5404,7 @@ function createCliOutput(options = {}) {
|
|
|
5330
5404
|
},
|
|
5331
5405
|
note(message, title) {
|
|
5332
5406
|
if (interactive) {
|
|
5333
|
-
|
|
5407
|
+
clackNote(message, title);
|
|
5334
5408
|
return;
|
|
5335
5409
|
}
|
|
5336
5410
|
if (title) {
|
|
@@ -5341,17 +5415,17 @@ ${message}`);
|
|
|
5341
5415
|
writeText(message);
|
|
5342
5416
|
},
|
|
5343
5417
|
intro(message) {
|
|
5344
|
-
showClackMessage(
|
|
5418
|
+
showClackMessage(clackIntro, message);
|
|
5345
5419
|
},
|
|
5346
5420
|
outro(message) {
|
|
5347
|
-
showClackMessage(
|
|
5421
|
+
showClackMessage(clackOutro, message);
|
|
5348
5422
|
},
|
|
5349
5423
|
table(rows) {
|
|
5350
5424
|
writeText(JSON.stringify(rows, null, 2));
|
|
5351
5425
|
},
|
|
5352
5426
|
spinner() {
|
|
5353
5427
|
if (!interactive) return createNoopSpinner();
|
|
5354
|
-
const instance =
|
|
5428
|
+
const instance = clackSpinner({ output: stdout });
|
|
5355
5429
|
return {
|
|
5356
5430
|
start(message) {
|
|
5357
5431
|
instance.start(message);
|
|
@@ -5404,11 +5478,15 @@ ${import_picocolors.default.dim(message)}
|
|
|
5404
5478
|
var import_picocolors;
|
|
5405
5479
|
var init_output = __esm({
|
|
5406
5480
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5407
|
-
|
|
5481
|
+
"use strict";
|
|
5482
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5408
5483
|
init_errors();
|
|
5409
5484
|
init_json();
|
|
5410
5485
|
}
|
|
5411
5486
|
});
|
|
5487
|
+
|
|
5488
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5489
|
+
import { parseArgs as parseNodeArgs3 } from "util";
|
|
5412
5490
|
function hasFlag(name, argv) {
|
|
5413
5491
|
return argv.includes(`--${name}`);
|
|
5414
5492
|
}
|
|
@@ -5419,7 +5497,7 @@ function firstPositional(argv) {
|
|
|
5419
5497
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5420
5498
|
}
|
|
5421
5499
|
function parseCliInput(argv) {
|
|
5422
|
-
const parsed =
|
|
5500
|
+
const parsed = parseNodeArgs3({
|
|
5423
5501
|
args: argv,
|
|
5424
5502
|
allowPositionals: true,
|
|
5425
5503
|
strict: false,
|
|
@@ -5448,15 +5526,20 @@ function parseCliInput(argv) {
|
|
|
5448
5526
|
}
|
|
5449
5527
|
var init_args = __esm({
|
|
5450
5528
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5529
|
+
"use strict";
|
|
5451
5530
|
}
|
|
5452
5531
|
});
|
|
5532
|
+
|
|
5533
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5534
|
+
import path18 from "path";
|
|
5535
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
5453
5536
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5454
|
-
const filename =
|
|
5455
|
-
return
|
|
5537
|
+
const filename = fileURLToPath5(importMetaUrl);
|
|
5538
|
+
return path18.dirname(filename);
|
|
5456
5539
|
}
|
|
5457
5540
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5458
|
-
const fromRuntime =
|
|
5459
|
-
const fromCwd =
|
|
5541
|
+
const fromRuntime = path18.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5542
|
+
const fromCwd = path18.resolve(process.cwd(), relativeToRepoRoot);
|
|
5460
5543
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5461
5544
|
}
|
|
5462
5545
|
async function firstExistingPath(paths) {
|
|
@@ -5467,6 +5550,7 @@ async function firstExistingPath(paths) {
|
|
|
5467
5550
|
}
|
|
5468
5551
|
var init_paths = __esm({
|
|
5469
5552
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5553
|
+
"use strict";
|
|
5470
5554
|
init_errors();
|
|
5471
5555
|
init_fs();
|
|
5472
5556
|
}
|
|
@@ -5551,6 +5635,7 @@ async function runCliMain(options) {
|
|
|
5551
5635
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5552
5636
|
var init_runtime = __esm({
|
|
5553
5637
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5638
|
+
"use strict";
|
|
5554
5639
|
init_args();
|
|
5555
5640
|
init_errors();
|
|
5556
5641
|
init_output();
|
|
@@ -5608,6 +5693,8 @@ __export(createApp_exports, {
|
|
|
5608
5693
|
buildCreateProgram: () => buildCreateProgram,
|
|
5609
5694
|
main: () => main
|
|
5610
5695
|
});
|
|
5696
|
+
import path19 from "path";
|
|
5697
|
+
import { isCancel as isCancel3, select as select2, text } from "@clack/prompts";
|
|
5611
5698
|
function isTemplateName(value) {
|
|
5612
5699
|
return TEMPLATE_NAMES.includes(value);
|
|
5613
5700
|
}
|
|
@@ -5621,10 +5708,10 @@ async function resolveCreateInput(options) {
|
|
|
5621
5708
|
defaultValue: "my-app",
|
|
5622
5709
|
placeholder: "my-app"
|
|
5623
5710
|
});
|
|
5624
|
-
if (
|
|
5711
|
+
if (isCancel3(resolvedName)) {
|
|
5625
5712
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5626
5713
|
}
|
|
5627
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5714
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await select2({
|
|
5628
5715
|
message: "Template",
|
|
5629
5716
|
initialValue: "next-app",
|
|
5630
5717
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5632,7 +5719,7 @@ async function resolveCreateInput(options) {
|
|
|
5632
5719
|
label: template
|
|
5633
5720
|
}))
|
|
5634
5721
|
});
|
|
5635
|
-
if (
|
|
5722
|
+
if (isCancel3(pickedTemplate)) {
|
|
5636
5723
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5637
5724
|
}
|
|
5638
5725
|
const templateValue = pickedTemplate;
|
|
@@ -5644,7 +5731,7 @@ async function resolveCreateInput(options) {
|
|
|
5644
5731
|
return { name: resolvedName, template: templateValue };
|
|
5645
5732
|
}
|
|
5646
5733
|
async function writeProjectFile(context, relativePath, content) {
|
|
5647
|
-
const filePath =
|
|
5734
|
+
const filePath = path19.join(context.projectDir, relativePath);
|
|
5648
5735
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5649
5736
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5650
5737
|
}
|
|
@@ -5960,7 +6047,7 @@ async function createSimpleApp(context) {
|
|
|
5960
6047
|
}
|
|
5961
6048
|
async function createProject(options, output) {
|
|
5962
6049
|
const { name, template } = await resolveCreateInput(options);
|
|
5963
|
-
const projectDir =
|
|
6050
|
+
const projectDir = path19.resolve(process.cwd(), name);
|
|
5964
6051
|
if (await pathExists2(projectDir)) {
|
|
5965
6052
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5966
6053
|
}
|
|
@@ -6017,6 +6104,7 @@ async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6017
6104
|
var TEMPLATE_NAMES, TEMPLATES;
|
|
6018
6105
|
var init_createApp = __esm({
|
|
6019
6106
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6107
|
+
"use strict";
|
|
6020
6108
|
init_esm();
|
|
6021
6109
|
init_errors();
|
|
6022
6110
|
init_fs();
|
|
@@ -6036,6 +6124,7 @@ var init_createApp = __esm({
|
|
|
6036
6124
|
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6037
6125
|
var init_nativeBridge = __esm({
|
|
6038
6126
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6127
|
+
"use strict";
|
|
6039
6128
|
init_src();
|
|
6040
6129
|
_loadNative = (path30) => __require(path30);
|
|
6041
6130
|
log3 = (...args) => {
|
|
@@ -6134,41 +6223,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6134
6223
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6135
6224
|
var init_compiler = __esm({
|
|
6136
6225
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6226
|
+
"use strict";
|
|
6137
6227
|
}
|
|
6138
6228
|
});
|
|
6139
6229
|
|
|
6140
6230
|
// packages/domain/compiler/src/parser/index.ts
|
|
6141
6231
|
var init_parser = __esm({
|
|
6142
6232
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6233
|
+
"use strict";
|
|
6143
6234
|
}
|
|
6144
6235
|
});
|
|
6145
6236
|
|
|
6146
6237
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6147
6238
|
var init_analyzer = __esm({
|
|
6148
6239
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6240
|
+
"use strict";
|
|
6149
6241
|
}
|
|
6150
6242
|
});
|
|
6151
6243
|
|
|
6152
6244
|
// packages/domain/compiler/src/cache/index.ts
|
|
6153
6245
|
var init_cache = __esm({
|
|
6154
6246
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6247
|
+
"use strict";
|
|
6155
6248
|
}
|
|
6156
6249
|
});
|
|
6157
6250
|
|
|
6158
6251
|
// packages/domain/compiler/src/redis/index.ts
|
|
6159
6252
|
var init_redis = __esm({
|
|
6160
6253
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6254
|
+
"use strict";
|
|
6161
6255
|
}
|
|
6162
6256
|
});
|
|
6163
6257
|
|
|
6164
6258
|
// packages/domain/compiler/src/watch/index.ts
|
|
6165
6259
|
var init_watch = __esm({
|
|
6166
6260
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6261
|
+
"use strict";
|
|
6167
6262
|
}
|
|
6168
6263
|
});
|
|
6169
|
-
|
|
6264
|
+
|
|
6265
|
+
// packages/domain/compiler/src/index.ts
|
|
6266
|
+
import fs12 from "fs";
|
|
6267
|
+
import path24 from "path";
|
|
6268
|
+
import { createRequire as createRequire4 } from "module";
|
|
6269
|
+
var _require3, compileCssFromClasses;
|
|
6170
6270
|
var init_src4 = __esm({
|
|
6171
6271
|
"packages/domain/compiler/src/index.ts"() {
|
|
6272
|
+
"use strict";
|
|
6172
6273
|
init_nativeBridge();
|
|
6173
6274
|
init_compiler();
|
|
6174
6275
|
init_parser();
|
|
@@ -6176,7 +6277,7 @@ var init_src4 = __esm({
|
|
|
6176
6277
|
init_cache();
|
|
6177
6278
|
init_redis();
|
|
6178
6279
|
init_watch();
|
|
6179
|
-
|
|
6280
|
+
_require3 = createRequire4(import.meta.url);
|
|
6180
6281
|
compileCssFromClasses = (classes, prefix) => {
|
|
6181
6282
|
const native = getNativeBridge();
|
|
6182
6283
|
if (!native?.transformSource) {
|
|
@@ -6194,6 +6295,7 @@ var init_src4 = __esm({
|
|
|
6194
6295
|
// packages/domain/compiler/src/internal.ts
|
|
6195
6296
|
var init_internal = __esm({
|
|
6196
6297
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6298
|
+
"use strict";
|
|
6197
6299
|
init_src4();
|
|
6198
6300
|
init_compiler();
|
|
6199
6301
|
init_parser();
|
|
@@ -6204,9 +6306,16 @@ var init_internal = __esm({
|
|
|
6204
6306
|
}
|
|
6205
6307
|
});
|
|
6206
6308
|
|
|
6309
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6310
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
6311
|
+
|
|
6207
6312
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6208
6313
|
init_esm();
|
|
6209
6314
|
|
|
6315
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6316
|
+
import path10 from "path";
|
|
6317
|
+
import { parseArgs as parseNodeArgs } from "util";
|
|
6318
|
+
|
|
6210
6319
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6211
6320
|
init_errors();
|
|
6212
6321
|
async function loadAnalyzerModule() {
|
|
@@ -6263,7 +6372,7 @@ function printAnalysisReport(report, output) {
|
|
|
6263
6372
|
output.writeText("");
|
|
6264
6373
|
}
|
|
6265
6374
|
async function runAnalyzeCli(args) {
|
|
6266
|
-
const parsed =
|
|
6375
|
+
const parsed = parseNodeArgs({
|
|
6267
6376
|
args,
|
|
6268
6377
|
allowPositionals: true,
|
|
6269
6378
|
strict: false,
|
|
@@ -6278,7 +6387,7 @@ async function runAnalyzeCli(args) {
|
|
|
6278
6387
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6279
6388
|
});
|
|
6280
6389
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6281
|
-
const dir =
|
|
6390
|
+
const dir = path10.resolve(process.cwd(), dirArg);
|
|
6282
6391
|
if (!await pathExists2(dir)) {
|
|
6283
6392
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6284
6393
|
}
|
|
@@ -6295,6 +6404,10 @@ async function runAnalyzeCli(args) {
|
|
|
6295
6404
|
}
|
|
6296
6405
|
printAnalysisReport(report, output);
|
|
6297
6406
|
}
|
|
6407
|
+
|
|
6408
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6409
|
+
import path11 from "path";
|
|
6410
|
+
import { parseArgs as parseNodeArgs2 } from "util";
|
|
6298
6411
|
init_errors();
|
|
6299
6412
|
init_fs();
|
|
6300
6413
|
init_output();
|
|
@@ -6315,7 +6428,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6315
6428
|
return "div";
|
|
6316
6429
|
}
|
|
6317
6430
|
async function runExtractCli(args) {
|
|
6318
|
-
const parsed =
|
|
6431
|
+
const parsed = parseNodeArgs2({
|
|
6319
6432
|
args,
|
|
6320
6433
|
allowPositionals: true,
|
|
6321
6434
|
strict: false,
|
|
@@ -6334,7 +6447,7 @@ async function runExtractCli(args) {
|
|
|
6334
6447
|
const parsedMin = parseInt(minRaw, 10);
|
|
6335
6448
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6336
6449
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6337
|
-
const dir =
|
|
6450
|
+
const dir = path11.resolve(process.cwd(), dirArg);
|
|
6338
6451
|
if (!await pathExists2(dir)) {
|
|
6339
6452
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6340
6453
|
}
|
|
@@ -6391,6 +6504,7 @@ async function runExtractCli(args) {
|
|
|
6391
6504
|
// packages/infrastructure/cli/src/init.ts
|
|
6392
6505
|
init_fs();
|
|
6393
6506
|
init_output();
|
|
6507
|
+
import path12 from "path";
|
|
6394
6508
|
async function ensureFile(filePath, content, report) {
|
|
6395
6509
|
const status = await ensureFileSafe(filePath, content);
|
|
6396
6510
|
if (status === "created") {
|
|
@@ -6407,15 +6521,15 @@ async function runInitCli(rawArgs) {
|
|
|
6407
6521
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6408
6522
|
});
|
|
6409
6523
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6410
|
-
const root =
|
|
6524
|
+
const root = path12.resolve(process.cwd(), target);
|
|
6411
6525
|
const report = { created: [], skipped: [] };
|
|
6412
6526
|
await ensureFile(
|
|
6413
|
-
|
|
6527
|
+
path12.join(root, "src", "tailwind.css"),
|
|
6414
6528
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6415
6529
|
report
|
|
6416
6530
|
);
|
|
6417
6531
|
await ensureFile(
|
|
6418
|
-
|
|
6532
|
+
path12.join(root, "tailwind-styled.config.json"),
|
|
6419
6533
|
`${JSON.stringify(
|
|
6420
6534
|
{
|
|
6421
6535
|
version: 1,
|
|
@@ -6435,18 +6549,23 @@ async function runInitCli(rawArgs) {
|
|
|
6435
6549
|
output.writeText("\nInit complete");
|
|
6436
6550
|
output.writeText(`Created: ${report.created.length}`);
|
|
6437
6551
|
for (const filePath of report.created) {
|
|
6438
|
-
output.writeText(` + ${
|
|
6552
|
+
output.writeText(` + ${path12.relative(root, filePath)}`);
|
|
6439
6553
|
}
|
|
6440
6554
|
if (report.skipped.length > 0) {
|
|
6441
6555
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6442
6556
|
for (const filePath of report.skipped) {
|
|
6443
|
-
output.writeText(` - ${
|
|
6557
|
+
output.writeText(` - ${path12.relative(root, filePath)} (exists)`);
|
|
6444
6558
|
}
|
|
6445
6559
|
}
|
|
6446
6560
|
}
|
|
6447
6561
|
|
|
6562
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6563
|
+
import fs8 from "fs/promises";
|
|
6564
|
+
import path13 from "path";
|
|
6565
|
+
|
|
6448
6566
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6449
6567
|
init_errors();
|
|
6568
|
+
import { confirm, intro, isCancel } from "@clack/prompts";
|
|
6450
6569
|
async function runMigrationWizard() {
|
|
6451
6570
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
6452
6571
|
return {
|
|
@@ -6501,15 +6620,15 @@ async function findSourceFiles(dir) {
|
|
|
6501
6620
|
const out = [];
|
|
6502
6621
|
async function walk(currentDir) {
|
|
6503
6622
|
if (!await pathExists2(currentDir)) return;
|
|
6504
|
-
const entries = await
|
|
6623
|
+
const entries = await fs8.readdir(currentDir, { withFileTypes: true });
|
|
6505
6624
|
for (const entry of entries) {
|
|
6506
|
-
const fullPath =
|
|
6625
|
+
const fullPath = path13.join(currentDir, entry.name);
|
|
6507
6626
|
if (entry.isDirectory()) {
|
|
6508
6627
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6509
6628
|
await walk(fullPath);
|
|
6510
6629
|
continue;
|
|
6511
6630
|
}
|
|
6512
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6631
|
+
if (SOURCE_EXTENSIONS.has(path13.extname(entry.name))) {
|
|
6513
6632
|
out.push(fullPath);
|
|
6514
6633
|
}
|
|
6515
6634
|
}
|
|
@@ -6530,7 +6649,7 @@ function migrateSource(source, options) {
|
|
|
6530
6649
|
return { output, classRenames: 0, importRenames };
|
|
6531
6650
|
}
|
|
6532
6651
|
async function migrateConfig(root, dryRun) {
|
|
6533
|
-
const cssPath =
|
|
6652
|
+
const cssPath = path13.join(root, "src", "tailwind.css");
|
|
6534
6653
|
if (await pathExists2(cssPath)) return 0;
|
|
6535
6654
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6536
6655
|
return 1;
|
|
@@ -6543,7 +6662,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6543
6662
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6544
6663
|
});
|
|
6545
6664
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6546
|
-
const root =
|
|
6665
|
+
const root = path13.resolve(process.cwd(), target);
|
|
6547
6666
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6548
6667
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6549
6668
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6567,12 +6686,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6567
6686
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6568
6687
|
}
|
|
6569
6688
|
for (const filePath of files) {
|
|
6570
|
-
const source = await
|
|
6689
|
+
const source = await fs8.readFile(filePath, "utf8");
|
|
6571
6690
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6572
6691
|
if (migrated.output !== source) {
|
|
6573
6692
|
report.updatedFiles++;
|
|
6574
6693
|
if (!dryRun) {
|
|
6575
|
-
await
|
|
6694
|
+
await fs8.writeFile(filePath, migrated.output, "utf8");
|
|
6576
6695
|
}
|
|
6577
6696
|
}
|
|
6578
6697
|
report.classRenames += migrated.classRenames;
|
|
@@ -6594,6 +6713,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6594
6713
|
// packages/infrastructure/cli/src/scan.ts
|
|
6595
6714
|
init_src2();
|
|
6596
6715
|
init_output();
|
|
6716
|
+
import fs9 from "fs";
|
|
6717
|
+
import path14 from "path";
|
|
6597
6718
|
function buildTopClasses(files) {
|
|
6598
6719
|
const counts = /* @__PURE__ */ new Map();
|
|
6599
6720
|
for (const file of files) {
|
|
@@ -6636,10 +6757,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6636
6757
|
});
|
|
6637
6758
|
}
|
|
6638
6759
|
function writeScanCache(root, cacheData) {
|
|
6639
|
-
const cacheDir =
|
|
6640
|
-
const cachePath =
|
|
6641
|
-
|
|
6642
|
-
|
|
6760
|
+
const cacheDir = path14.join(root, ".tailwind-styled");
|
|
6761
|
+
const cachePath = path14.join(cacheDir, "scan-cache.json");
|
|
6762
|
+
fs9.mkdirSync(cacheDir, { recursive: true });
|
|
6763
|
+
fs9.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6643
6764
|
return cachePath;
|
|
6644
6765
|
}
|
|
6645
6766
|
async function runScanCli(rawArgs) {
|
|
@@ -6651,7 +6772,7 @@ async function runScanCli(rawArgs) {
|
|
|
6651
6772
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6652
6773
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6653
6774
|
});
|
|
6654
|
-
const root =
|
|
6775
|
+
const root = path14.resolve(process.cwd(), target);
|
|
6655
6776
|
const spinner = output.spinner();
|
|
6656
6777
|
spinner.start(`Scanning ${root}`);
|
|
6657
6778
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6701,7 +6822,8 @@ Scan root : ${result.root}`);
|
|
|
6701
6822
|
}
|
|
6702
6823
|
|
|
6703
6824
|
// packages/infrastructure/cli/src/setup.ts
|
|
6704
|
-
var import_picocolors3 = __toESM(require_picocolors());
|
|
6825
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6826
|
+
import path16 from "path";
|
|
6705
6827
|
|
|
6706
6828
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6707
6829
|
function patchNextConfigImpl(src) {
|
|
@@ -6897,6 +7019,7 @@ function patchTsConfigImpl(src) {
|
|
|
6897
7019
|
|
|
6898
7020
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
6899
7021
|
init_errors();
|
|
7022
|
+
import { isCancel as isCancel2, select } from "@clack/prompts";
|
|
6900
7023
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6901
7024
|
const log5 = options.log ?? console.log;
|
|
6902
7025
|
if (flags.explicitProjectType) {
|
|
@@ -6935,7 +7058,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6935
7058
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6936
7059
|
}))
|
|
6937
7060
|
});
|
|
6938
|
-
if (
|
|
7061
|
+
if (isCancel2(selected)) {
|
|
6939
7062
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6940
7063
|
}
|
|
6941
7064
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6947,10 +7070,12 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6947
7070
|
|
|
6948
7071
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
6949
7072
|
init_fs();
|
|
7073
|
+
import path15 from "path";
|
|
6950
7074
|
|
|
6951
7075
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
6952
7076
|
init_errors();
|
|
6953
7077
|
init_json();
|
|
7078
|
+
import { spawn } from "child_process";
|
|
6954
7079
|
var npmCommandName = () => {
|
|
6955
7080
|
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
6956
7081
|
};
|
|
@@ -7114,12 +7239,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7114
7239
|
};
|
|
7115
7240
|
}
|
|
7116
7241
|
async function readPackageJson(cwd2) {
|
|
7117
|
-
return readJsonSafe(
|
|
7242
|
+
return readJsonSafe(path15.join(cwd2, "package.json"));
|
|
7118
7243
|
}
|
|
7119
7244
|
async function detectPm(cwd2) {
|
|
7120
|
-
if (await pathExists2(
|
|
7121
|
-
if (await pathExists2(
|
|
7122
|
-
if (await pathExists2(
|
|
7245
|
+
if (await pathExists2(path15.join(cwd2, "bun.lockb"))) return "bun";
|
|
7246
|
+
if (await pathExists2(path15.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7247
|
+
if (await pathExists2(path15.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7123
7248
|
return "npm";
|
|
7124
7249
|
}
|
|
7125
7250
|
async function detectBundler(cwd2) {
|
|
@@ -7140,7 +7265,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7140
7265
|
}
|
|
7141
7266
|
async function findExisting(cwd2, names) {
|
|
7142
7267
|
for (const name of names) {
|
|
7143
|
-
const resolved =
|
|
7268
|
+
const resolved = path15.join(cwd2, name);
|
|
7144
7269
|
if (await pathExists2(resolved)) return resolved;
|
|
7145
7270
|
}
|
|
7146
7271
|
return null;
|
|
@@ -7151,7 +7276,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7151
7276
|
return;
|
|
7152
7277
|
}
|
|
7153
7278
|
await writeFileSafe(filePath, content);
|
|
7154
|
-
logger.ok(
|
|
7279
|
+
logger.ok(path15.relative(cwd2, filePath) || label);
|
|
7155
7280
|
}
|
|
7156
7281
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7157
7282
|
const source = await readFileSafe(filePath);
|
|
@@ -7178,7 +7303,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7178
7303
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7179
7304
|
return;
|
|
7180
7305
|
}
|
|
7181
|
-
const flag = "--save";
|
|
7306
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7182
7307
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7183
7308
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7184
7309
|
try {
|
|
@@ -7196,7 +7321,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7196
7321
|
}
|
|
7197
7322
|
|
|
7198
7323
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7199
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7324
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7200
7325
|
function createCliLogger(options = {}) {
|
|
7201
7326
|
function emit(level, icon, colorize, message) {
|
|
7202
7327
|
options.onEvent?.({ level, message });
|
|
@@ -7314,7 +7439,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7314
7439
|
if (bundlerConfig) {
|
|
7315
7440
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7316
7441
|
if (cfg)
|
|
7317
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7442
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, path16.basename(cfg), setupFlags, logger);
|
|
7318
7443
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7319
7444
|
} else {
|
|
7320
7445
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7333,13 +7458,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7333
7458
|
if (cssFile) {
|
|
7334
7459
|
await patchFileWithDryRun(
|
|
7335
7460
|
cssFile,
|
|
7336
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7337
|
-
|
|
7461
|
+
(src) => patchTailwindCss(src, bundler, path16.relative(cwd, cssFile), cwd),
|
|
7462
|
+
path16.relative(cwd, cssFile),
|
|
7338
7463
|
setupFlags,
|
|
7339
7464
|
logger
|
|
7340
7465
|
);
|
|
7341
|
-
const detectedCssEntry =
|
|
7342
|
-
const twConfigPath =
|
|
7466
|
+
const detectedCssEntry = path16.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7467
|
+
const twConfigPath = path16.join(cwd, "tailwind-styled.config.json");
|
|
7343
7468
|
const twConfig = {
|
|
7344
7469
|
version: 1,
|
|
7345
7470
|
compiler: { engine: "rust" },
|
|
@@ -7357,7 +7482,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7357
7482
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7358
7483
|
}
|
|
7359
7484
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7360
|
-
const tsCfg =
|
|
7485
|
+
const tsCfg = path16.join(cwd, "tsconfig.json");
|
|
7361
7486
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7362
7487
|
if (hasTsConfig) {
|
|
7363
7488
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7402,6 +7527,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7402
7527
|
output.jsonSuccess("setup", report);
|
|
7403
7528
|
}
|
|
7404
7529
|
};
|
|
7530
|
+
|
|
7531
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7532
|
+
import path17 from "path";
|
|
7533
|
+
import { parseArgs as parseNodeArgs4 } from "util";
|
|
7405
7534
|
init_errors();
|
|
7406
7535
|
init_fs();
|
|
7407
7536
|
init_output();
|
|
@@ -7423,7 +7552,7 @@ function estimateClassBytes(className) {
|
|
|
7423
7552
|
return base + 15;
|
|
7424
7553
|
}
|
|
7425
7554
|
async function runStatsCli(args) {
|
|
7426
|
-
const parsed =
|
|
7555
|
+
const parsed = parseNodeArgs4({
|
|
7427
7556
|
args,
|
|
7428
7557
|
allowPositionals: true,
|
|
7429
7558
|
strict: false,
|
|
@@ -7438,7 +7567,7 @@ async function runStatsCli(args) {
|
|
|
7438
7567
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7439
7568
|
});
|
|
7440
7569
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7441
|
-
const dir =
|
|
7570
|
+
const dir = path17.resolve(process.cwd(), dirArg);
|
|
7442
7571
|
if (!await pathExists2(dir)) {
|
|
7443
7572
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7444
7573
|
}
|
|
@@ -7490,11 +7619,16 @@ async function runStatsCli(args) {
|
|
|
7490
7619
|
|
|
7491
7620
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7492
7621
|
init_runtime();
|
|
7622
|
+
|
|
7623
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7624
|
+
import { readFileSync, readdirSync } from "fs";
|
|
7625
|
+
import { join as join2, extname } from "path";
|
|
7626
|
+
import { parseArgs as parseNodeArgs5 } from "util";
|
|
7493
7627
|
function collectTsFiles(dir, extensions) {
|
|
7494
7628
|
const files = [];
|
|
7495
7629
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
7496
7630
|
for (const entry of entries) {
|
|
7497
|
-
const full =
|
|
7631
|
+
const full = join2(dir, entry.name);
|
|
7498
7632
|
if (entry.isDirectory()) {
|
|
7499
7633
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7500
7634
|
files.push(...collectTsFiles(full, extensions));
|
|
@@ -7557,7 +7691,7 @@ function printBoundaryReport(report, output) {
|
|
|
7557
7691
|
}
|
|
7558
7692
|
}
|
|
7559
7693
|
async function runBoundaryCli(args, context) {
|
|
7560
|
-
const parsed =
|
|
7694
|
+
const parsed = parseNodeArgs5({
|
|
7561
7695
|
args,
|
|
7562
7696
|
allowPositionals: true,
|
|
7563
7697
|
strict: false,
|
|
@@ -7625,10 +7759,13 @@ var createCommand2 = {
|
|
|
7625
7759
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7626
7760
|
init_errors();
|
|
7627
7761
|
init_fs();
|
|
7762
|
+
import { parseArgs as parseNodeArgs6 } from "util";
|
|
7628
7763
|
|
|
7629
7764
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7630
7765
|
init_errors();
|
|
7631
7766
|
init_paths();
|
|
7767
|
+
import fs10 from "fs/promises";
|
|
7768
|
+
import path20 from "path";
|
|
7632
7769
|
function enumerateVariantProps(matrix) {
|
|
7633
7770
|
const keys = Object.keys(matrix);
|
|
7634
7771
|
if (keys.length === 0) return [{}];
|
|
@@ -7650,7 +7787,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7650
7787
|
}
|
|
7651
7788
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7652
7789
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7653
|
-
const fromCwd =
|
|
7790
|
+
const fromCwd = path20.resolve(process.cwd(), relativeToRepoRoot);
|
|
7654
7791
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7655
7792
|
if (!resolved) {
|
|
7656
7793
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7664,13 +7801,13 @@ async function loadRegistry(context) {
|
|
|
7664
7801
|
);
|
|
7665
7802
|
const candidates = [
|
|
7666
7803
|
runtimeRegistryPath,
|
|
7667
|
-
|
|
7804
|
+
path20.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7668
7805
|
];
|
|
7669
7806
|
const registryPath = await firstExistingPath(candidates);
|
|
7670
7807
|
if (!registryPath) {
|
|
7671
7808
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7672
7809
|
}
|
|
7673
|
-
const raw = await
|
|
7810
|
+
const raw = await fs10.readFile(registryPath, "utf8");
|
|
7674
7811
|
const data = JSON.parse(raw);
|
|
7675
7812
|
return [
|
|
7676
7813
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7690,7 +7827,7 @@ var dashboardCommand = {
|
|
|
7690
7827
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7691
7828
|
);
|
|
7692
7829
|
}
|
|
7693
|
-
const parsed =
|
|
7830
|
+
const parsed = parseNodeArgs6({
|
|
7694
7831
|
args,
|
|
7695
7832
|
allowPositionals: true,
|
|
7696
7833
|
strict: false,
|
|
@@ -7717,9 +7854,12 @@ var dashboardCommand = {
|
|
|
7717
7854
|
init_errors();
|
|
7718
7855
|
init_fs();
|
|
7719
7856
|
init_json();
|
|
7857
|
+
import fsp from "fs/promises";
|
|
7858
|
+
import path21 from "path";
|
|
7859
|
+
import { parseArgs as parseNodeArgs7 } from "util";
|
|
7720
7860
|
var postJson = async (url, body, token) => {
|
|
7721
|
-
const { default: https } = await import(
|
|
7722
|
-
const { default: http } = await import(
|
|
7861
|
+
const { default: https } = await import("https");
|
|
7862
|
+
const { default: http } = await import("http");
|
|
7723
7863
|
return new Promise((resolve2, reject) => {
|
|
7724
7864
|
const client = url.protocol === "https:" ? https : http;
|
|
7725
7865
|
const req = client.request(
|
|
@@ -7753,7 +7893,7 @@ var postJson = async (url, body, token) => {
|
|
|
7753
7893
|
var deployCommand = {
|
|
7754
7894
|
name: "deploy",
|
|
7755
7895
|
async run(args, context) {
|
|
7756
|
-
const parsed =
|
|
7896
|
+
const parsed = parseNodeArgs7({
|
|
7757
7897
|
args,
|
|
7758
7898
|
allowPositionals: true,
|
|
7759
7899
|
strict: false,
|
|
@@ -7769,7 +7909,7 @@ var deployCommand = {
|
|
|
7769
7909
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7770
7910
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7771
7911
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7772
|
-
const pkgPath =
|
|
7912
|
+
const pkgPath = path21.join(process.cwd(), "package.json");
|
|
7773
7913
|
if (!await pathExists2(pkgPath)) {
|
|
7774
7914
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7775
7915
|
}
|
|
@@ -7804,10 +7944,10 @@ var deployCommand = {
|
|
|
7804
7944
|
}
|
|
7805
7945
|
return;
|
|
7806
7946
|
}
|
|
7807
|
-
const cacheDir =
|
|
7808
|
-
await
|
|
7809
|
-
await
|
|
7810
|
-
|
|
7947
|
+
const cacheDir = path21.join(process.cwd(), ".tw-cache");
|
|
7948
|
+
await fsp.mkdir(cacheDir, { recursive: true });
|
|
7949
|
+
await fsp.writeFile(
|
|
7950
|
+
path21.join(cacheDir, "deploy-manifest.json"),
|
|
7811
7951
|
JSON.stringify(manifest, null, 2)
|
|
7812
7952
|
);
|
|
7813
7953
|
if (!registryUrl) {
|
|
@@ -7870,11 +8010,14 @@ var deployCommand = {
|
|
|
7870
8010
|
};
|
|
7871
8011
|
|
|
7872
8012
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7873
|
-
var import_picocolors4 = __toESM(require_picocolors());
|
|
8013
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
8014
|
+
import { parseArgs as parseNodeArgs8 } from "util";
|
|
7874
8015
|
|
|
7875
8016
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
7876
8017
|
init_src3();
|
|
7877
8018
|
init_src2();
|
|
8019
|
+
import fs11 from "fs";
|
|
8020
|
+
import path22 from "path";
|
|
7878
8021
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
7879
8022
|
"workspace",
|
|
7880
8023
|
"tailwind",
|
|
@@ -7907,9 +8050,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7907
8050
|
issues.push({ severity, type, message, suggestion, location });
|
|
7908
8051
|
}
|
|
7909
8052
|
function readJsonFile(filePath) {
|
|
7910
|
-
if (!
|
|
8053
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
7911
8054
|
try {
|
|
7912
|
-
return JSON.parse(
|
|
8055
|
+
return JSON.parse(fs11.readFileSync(filePath, "utf8"));
|
|
7913
8056
|
} catch (parseErr) {
|
|
7914
8057
|
if (process.env.TWS_DEBUG === "1") {
|
|
7915
8058
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7920,16 +8063,16 @@ function readJsonFile(filePath) {
|
|
|
7920
8063
|
}
|
|
7921
8064
|
}
|
|
7922
8065
|
function findWorkspacePackageJsonFiles(root) {
|
|
7923
|
-
const packagesDir =
|
|
7924
|
-
if (!
|
|
7925
|
-
return
|
|
8066
|
+
const packagesDir = path22.join(root, "packages");
|
|
8067
|
+
if (!fs11.existsSync(packagesDir)) return [];
|
|
8068
|
+
return fs11.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path22.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11.existsSync(filePath));
|
|
7926
8069
|
}
|
|
7927
8070
|
function findFiles(dir, ext) {
|
|
7928
8071
|
const files = [];
|
|
7929
8072
|
try {
|
|
7930
|
-
const entries =
|
|
8073
|
+
const entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
7931
8074
|
for (const entry of entries) {
|
|
7932
|
-
const fullPath =
|
|
8075
|
+
const fullPath = path22.join(dir, entry.name);
|
|
7933
8076
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7934
8077
|
files.push(...findFiles(fullPath, ext));
|
|
7935
8078
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7947,7 +8090,7 @@ function findFiles(dir, ext) {
|
|
|
7947
8090
|
return files;
|
|
7948
8091
|
}
|
|
7949
8092
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7950
|
-
const rootPackageJsonPath =
|
|
8093
|
+
const rootPackageJsonPath = path22.join(root, "package.json");
|
|
7951
8094
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7952
8095
|
if (!rootPackageJson) {
|
|
7953
8096
|
addCheck(
|
|
@@ -8000,7 +8143,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8000
8143
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8001
8144
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8002
8145
|
if (missing.length === 0) return [];
|
|
8003
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8146
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : path22.basename(path22.dirname(filePath));
|
|
8004
8147
|
return [{ packageName, missing }];
|
|
8005
8148
|
});
|
|
8006
8149
|
if (missingScripts.length === 0) {
|
|
@@ -8035,7 +8178,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8035
8178
|
);
|
|
8036
8179
|
}
|
|
8037
8180
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8038
|
-
const packageJsonPath =
|
|
8181
|
+
const packageJsonPath = path22.join(root, "package.json");
|
|
8039
8182
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8040
8183
|
if (!packageJson) {
|
|
8041
8184
|
addCheck(
|
|
@@ -8094,7 +8237,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8094
8237
|
const cssFiles = findFiles(root, ".css");
|
|
8095
8238
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8096
8239
|
try {
|
|
8097
|
-
const content =
|
|
8240
|
+
const content = fs11.readFileSync(filePath, "utf8");
|
|
8098
8241
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8099
8242
|
} catch {
|
|
8100
8243
|
return false;
|
|
@@ -8118,7 +8261,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8118
8261
|
);
|
|
8119
8262
|
}
|
|
8120
8263
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8121
|
-
const hasConfig = configFiles.some((name) =>
|
|
8264
|
+
const hasConfig = configFiles.some((name) => fs11.existsSync(path22.join(root, name)));
|
|
8122
8265
|
addCheck(
|
|
8123
8266
|
checks,
|
|
8124
8267
|
"tailwind",
|
|
@@ -8127,7 +8270,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8127
8270
|
"info",
|
|
8128
8271
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8129
8272
|
);
|
|
8130
|
-
const tsconfig = readJsonFile(
|
|
8273
|
+
const tsconfig = readJsonFile(path22.join(root, "tsconfig.json"));
|
|
8131
8274
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8132
8275
|
addCheck(
|
|
8133
8276
|
checks,
|
|
@@ -8293,7 +8436,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8293
8436
|
}
|
|
8294
8437
|
}
|
|
8295
8438
|
var runDiagnostics = async (options = {}) => {
|
|
8296
|
-
const root =
|
|
8439
|
+
const root = path22.resolve(options.root ?? process.cwd());
|
|
8297
8440
|
const includes = parseIncludes(options.include);
|
|
8298
8441
|
const issues = [];
|
|
8299
8442
|
const checks = [];
|
|
@@ -8339,7 +8482,7 @@ function parseIncludeOption(value) {
|
|
|
8339
8482
|
return includes;
|
|
8340
8483
|
}
|
|
8341
8484
|
async function runDoctorCli(args, context) {
|
|
8342
|
-
const parsed =
|
|
8485
|
+
const parsed = parseNodeArgs8({
|
|
8343
8486
|
args,
|
|
8344
8487
|
allowPositionals: true,
|
|
8345
8488
|
strict: false,
|
|
@@ -8415,10 +8558,12 @@ function printDoctorOutput(result, output) {
|
|
|
8415
8558
|
init_errors();
|
|
8416
8559
|
init_fs();
|
|
8417
8560
|
init_json();
|
|
8561
|
+
import path23 from "path";
|
|
8562
|
+
import { parseArgs as parseNodeArgs9 } from "util";
|
|
8418
8563
|
var testCommand = {
|
|
8419
8564
|
name: "test",
|
|
8420
8565
|
async run(args) {
|
|
8421
|
-
const parsed =
|
|
8566
|
+
const parsed = parseNodeArgs9({
|
|
8422
8567
|
args,
|
|
8423
8568
|
allowPositionals: true,
|
|
8424
8569
|
strict: false,
|
|
@@ -8443,7 +8588,7 @@ var shareCommand = {
|
|
|
8443
8588
|
name: "share",
|
|
8444
8589
|
async run(args, context) {
|
|
8445
8590
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8446
|
-
const manifestPath =
|
|
8591
|
+
const manifestPath = path23.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8447
8592
|
const defaultManifest = {
|
|
8448
8593
|
name,
|
|
8449
8594
|
version: "0.1.0"
|
|
@@ -8480,7 +8625,7 @@ var codeCommand = {
|
|
|
8480
8625
|
async run(args, context) {
|
|
8481
8626
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8482
8627
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8483
|
-
const parsed =
|
|
8628
|
+
const parsed = parseNodeArgs9({
|
|
8484
8629
|
args,
|
|
8485
8630
|
allowPositionals: true,
|
|
8486
8631
|
strict: false,
|
|
@@ -8529,14 +8674,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8529
8674
|
};
|
|
8530
8675
|
var resolveCurrentCliVersion = async (context) => {
|
|
8531
8676
|
const candidates = [
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8677
|
+
path23.resolve(context.runtimeDir, "..", "package.json"),
|
|
8678
|
+
path23.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8679
|
+
path23.resolve(process.cwd(), "package.json")
|
|
8535
8680
|
];
|
|
8536
8681
|
for (const candidate of candidates) {
|
|
8537
8682
|
if (!await pathExists2(candidate)) continue;
|
|
8538
8683
|
const pkg = await readJsonSafe(candidate);
|
|
8539
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8684
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${path23.sep}packages${path23.sep}cli${path23.sep}`));
|
|
8540
8685
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8541
8686
|
}
|
|
8542
8687
|
return "0.0.0";
|
|
@@ -8586,7 +8731,7 @@ var versionCommand = {
|
|
|
8586
8731
|
name: "version",
|
|
8587
8732
|
aliases: ["v"],
|
|
8588
8733
|
async run(args, context) {
|
|
8589
|
-
const parsed =
|
|
8734
|
+
const parsed = parseNodeArgs9({
|
|
8590
8735
|
args,
|
|
8591
8736
|
allowPositionals: true,
|
|
8592
8737
|
strict: false,
|
|
@@ -8620,7 +8765,7 @@ var upgradeCommand = {
|
|
|
8620
8765
|
name: "upgrade",
|
|
8621
8766
|
aliases: ["update"],
|
|
8622
8767
|
async run(args, context) {
|
|
8623
|
-
const parsed =
|
|
8768
|
+
const parsed = parseNodeArgs9({
|
|
8624
8769
|
args,
|
|
8625
8770
|
allowPositionals: true,
|
|
8626
8771
|
strict: false,
|
|
@@ -8779,6 +8924,8 @@ init_errors();
|
|
|
8779
8924
|
init_fs();
|
|
8780
8925
|
init_json();
|
|
8781
8926
|
init_src4();
|
|
8927
|
+
import path25 from "path";
|
|
8928
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
8782
8929
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8783
8930
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8784
8931
|
{
|
|
@@ -8804,8 +8951,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8804
8951
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8805
8952
|
let configPath = null;
|
|
8806
8953
|
for (const file of twConfigFiles) {
|
|
8807
|
-
if (await pathExists2(
|
|
8808
|
-
configPath =
|
|
8954
|
+
if (await pathExists2(path25.join(cwd2, file))) {
|
|
8955
|
+
configPath = path25.join(cwd2, file);
|
|
8809
8956
|
break;
|
|
8810
8957
|
}
|
|
8811
8958
|
}
|
|
@@ -8814,7 +8961,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8814
8961
|
return results;
|
|
8815
8962
|
}
|
|
8816
8963
|
try {
|
|
8817
|
-
const configUrl =
|
|
8964
|
+
const configUrl = pathToFileURL2(configPath);
|
|
8818
8965
|
const configModule = await import(configUrl.href);
|
|
8819
8966
|
const config = configModule.default || configModule;
|
|
8820
8967
|
const theme = config.theme || {};
|
|
@@ -8896,7 +9043,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8896
9043
|
async function hasTailwindCssImport(cwd2) {
|
|
8897
9044
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8898
9045
|
for (const file of cssFiles) {
|
|
8899
|
-
const raw = await readFileSafe(
|
|
9046
|
+
const raw = await readFileSafe(path25.join(cwd2, file));
|
|
8900
9047
|
if (raw?.includes("tailwindcss")) return true;
|
|
8901
9048
|
}
|
|
8902
9049
|
return false;
|
|
@@ -8912,7 +9059,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8912
9059
|
"app/globals.css"
|
|
8913
9060
|
];
|
|
8914
9061
|
for (const file of cssFiles) {
|
|
8915
|
-
const raw = await readFileSafe(
|
|
9062
|
+
const raw = await readFileSafe(path25.join(cwd2, file));
|
|
8916
9063
|
if (raw === null) continue;
|
|
8917
9064
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8918
9065
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8920,8 +9067,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8920
9067
|
return { found: false, cssFile: null };
|
|
8921
9068
|
}
|
|
8922
9069
|
async function applyTailwindInit(cwd2) {
|
|
8923
|
-
await ensureFileSafe(
|
|
8924
|
-
await ensureFileSafe(
|
|
9070
|
+
await ensureFileSafe(path25.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9071
|
+
await ensureFileSafe(path25.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8925
9072
|
}
|
|
8926
9073
|
function check(results, id, label, pass, message, fix) {
|
|
8927
9074
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8943,7 +9090,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8943
9090
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8944
9091
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8945
9092
|
);
|
|
8946
|
-
const pkg = await readJsonSafe(
|
|
9093
|
+
const pkg = await readJsonSafe(path25.join(cwd2, "package.json"));
|
|
8947
9094
|
check(
|
|
8948
9095
|
results,
|
|
8949
9096
|
"package-json",
|
|
@@ -8977,7 +9124,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8977
9124
|
}
|
|
8978
9125
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8979
9126
|
const twConfigChecks = await Promise.all(
|
|
8980
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9127
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(path25.join(cwd2, file)) }))
|
|
8981
9128
|
);
|
|
8982
9129
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
8983
9130
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -8989,7 +9136,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8989
9136
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
8990
9137
|
"tw init"
|
|
8991
9138
|
);
|
|
8992
|
-
const oldConfig = await readJsonSafe(
|
|
9139
|
+
const oldConfig = await readJsonSafe(path25.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(path25.join(cwd2, "tailwind.config.ts"));
|
|
8993
9140
|
if (oldConfig) {
|
|
8994
9141
|
const hasOldJit = oldConfig.mode === "jit";
|
|
8995
9142
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9013,7 +9160,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9013
9160
|
validation.message
|
|
9014
9161
|
);
|
|
9015
9162
|
}
|
|
9016
|
-
const hasTsConfig = await pathExists2(
|
|
9163
|
+
const hasTsConfig = await pathExists2(path25.join(cwd2, "tsconfig.json"));
|
|
9017
9164
|
check(
|
|
9018
9165
|
results,
|
|
9019
9166
|
"typescript",
|
|
@@ -9089,7 +9236,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9089
9236
|
function isDirectExecution() {
|
|
9090
9237
|
const scriptPath = process.argv[1];
|
|
9091
9238
|
if (!scriptPath) return false;
|
|
9092
|
-
return import.meta.url ===
|
|
9239
|
+
return import.meta.url === pathToFileURL2(scriptPath).href;
|
|
9093
9240
|
}
|
|
9094
9241
|
if (isDirectExecution()) {
|
|
9095
9242
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9158,6 +9305,7 @@ var installRegistryCommand = {
|
|
|
9158
9305
|
|
|
9159
9306
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9160
9307
|
init_errors();
|
|
9308
|
+
import { parseArgs as parseNodeArgs10 } from "util";
|
|
9161
9309
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9162
9310
|
if (context.json && options.jsonUnsupported) {
|
|
9163
9311
|
throw new CliUsageError(
|
|
@@ -9186,7 +9334,7 @@ var parseCommand = {
|
|
|
9186
9334
|
var transformCommand = {
|
|
9187
9335
|
name: "transform",
|
|
9188
9336
|
async run(args, context) {
|
|
9189
|
-
const parsed =
|
|
9337
|
+
const parsed = parseNodeArgs10({
|
|
9190
9338
|
args,
|
|
9191
9339
|
allowPositionals: true,
|
|
9192
9340
|
strict: false,
|
|
@@ -9229,7 +9377,7 @@ var lintCommand = {
|
|
|
9229
9377
|
var formatCommand2 = {
|
|
9230
9378
|
name: "format",
|
|
9231
9379
|
async run(args, context) {
|
|
9232
|
-
const parsed =
|
|
9380
|
+
const parsed = parseNodeArgs10({
|
|
9233
9381
|
args,
|
|
9234
9382
|
allowPositionals: true,
|
|
9235
9383
|
strict: false,
|
|
@@ -9271,7 +9419,7 @@ var optimizeCommand = {
|
|
|
9271
9419
|
var splitCommand = {
|
|
9272
9420
|
name: "split",
|
|
9273
9421
|
async run(args, context) {
|
|
9274
|
-
const parsed =
|
|
9422
|
+
const parsed = parseNodeArgs10({
|
|
9275
9423
|
args,
|
|
9276
9424
|
allowPositionals: true,
|
|
9277
9425
|
strict: false,
|
|
@@ -9370,10 +9518,12 @@ var scriptCommands = [
|
|
|
9370
9518
|
init_errors();
|
|
9371
9519
|
init_fs();
|
|
9372
9520
|
init_json();
|
|
9521
|
+
import path26 from "path";
|
|
9522
|
+
import { parseArgs as parseNodeArgs11 } from "util";
|
|
9373
9523
|
var storybookCommand = {
|
|
9374
9524
|
name: "storybook",
|
|
9375
9525
|
async run(args, context) {
|
|
9376
|
-
const parsed =
|
|
9526
|
+
const parsed = parseNodeArgs11({
|
|
9377
9527
|
args,
|
|
9378
9528
|
allowPositionals: true,
|
|
9379
9529
|
strict: false,
|
|
@@ -9407,7 +9557,7 @@ var storybookCommand = {
|
|
|
9407
9557
|
context.output.writeText(
|
|
9408
9558
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9409
9559
|
);
|
|
9410
|
-
const localBin =
|
|
9560
|
+
const localBin = path26.join(
|
|
9411
9561
|
process.cwd(),
|
|
9412
9562
|
"node_modules",
|
|
9413
9563
|
".bin",
|
|
@@ -9425,13 +9575,14 @@ var storybookCommand = {
|
|
|
9425
9575
|
|
|
9426
9576
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9427
9577
|
init_errors();
|
|
9578
|
+
import { parseArgs as parseNodeArgs12 } from "util";
|
|
9428
9579
|
var studioCommand = {
|
|
9429
9580
|
name: "studio",
|
|
9430
9581
|
async run(args, context) {
|
|
9431
9582
|
if (context.json) {
|
|
9432
9583
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9433
9584
|
}
|
|
9434
|
-
const parsed =
|
|
9585
|
+
const parsed = parseNodeArgs12({
|
|
9435
9586
|
args,
|
|
9436
9587
|
allowPositionals: true,
|
|
9437
9588
|
strict: false,
|
|
@@ -9497,8 +9648,9 @@ var syncCommand = {
|
|
|
9497
9648
|
};
|
|
9498
9649
|
|
|
9499
9650
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9500
|
-
var import_picocolors5 = __toESM(require_picocolors());
|
|
9651
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9501
9652
|
init_errors();
|
|
9653
|
+
import { parseArgs as parseNodeArgs13 } from "util";
|
|
9502
9654
|
|
|
9503
9655
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
9504
9656
|
init_internal();
|
|
@@ -10322,7 +10474,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10322
10474
|
const parsed = native.parseCssRules(css);
|
|
10323
10475
|
for (const r of parsed) {
|
|
10324
10476
|
const className = prefix + r.className;
|
|
10325
|
-
r.variants.length > 0;
|
|
10477
|
+
const hasVariants = r.variants.length > 0;
|
|
10326
10478
|
const layerName = detectLayerFromClassName(className);
|
|
10327
10479
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10328
10480
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10574,8 +10726,10 @@ async function traceClass(className, options) {
|
|
|
10574
10726
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10575
10727
|
init_internal();
|
|
10576
10728
|
init_src2();
|
|
10729
|
+
import fs13 from "fs";
|
|
10730
|
+
import path27 from "path";
|
|
10577
10731
|
function toRelativePath(root, value) {
|
|
10578
|
-
const relative =
|
|
10732
|
+
const relative = path27.relative(root, value);
|
|
10579
10733
|
return relative.length > 0 ? relative : ".";
|
|
10580
10734
|
}
|
|
10581
10735
|
function uniqueSorted(values) {
|
|
@@ -10644,7 +10798,7 @@ function tryCompileClasses(classes) {
|
|
|
10644
10798
|
}
|
|
10645
10799
|
}
|
|
10646
10800
|
function traceSingleFile(filePath, root) {
|
|
10647
|
-
const source =
|
|
10801
|
+
const source = fs13.readFileSync(filePath, "utf8");
|
|
10648
10802
|
const classes = uniqueSorted(scanSource(source));
|
|
10649
10803
|
const imports = extractImports(source);
|
|
10650
10804
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10675,7 +10829,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10675
10829
|
const imports = [];
|
|
10676
10830
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10677
10831
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10678
|
-
const source =
|
|
10832
|
+
const source = fs13.readFileSync(entry.file, "utf8");
|
|
10679
10833
|
const fileImports = extractImports(source);
|
|
10680
10834
|
for (const fileImport of fileImports) {
|
|
10681
10835
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10706,12 +10860,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10706
10860
|
};
|
|
10707
10861
|
}
|
|
10708
10862
|
async function traceTarget(target, options = {}) {
|
|
10709
|
-
const root =
|
|
10710
|
-
const resolvedTarget =
|
|
10711
|
-
if (!
|
|
10863
|
+
const root = path27.resolve(options.root ?? process.cwd());
|
|
10864
|
+
const resolvedTarget = path27.resolve(root, target);
|
|
10865
|
+
if (!fs13.existsSync(resolvedTarget)) {
|
|
10712
10866
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10713
10867
|
}
|
|
10714
|
-
const stat =
|
|
10868
|
+
const stat = fs13.statSync(resolvedTarget);
|
|
10715
10869
|
if (stat.isDirectory()) {
|
|
10716
10870
|
return traceDirectory(resolvedTarget, root);
|
|
10717
10871
|
}
|
|
@@ -10729,7 +10883,7 @@ function parseTraceFormat(value, context) {
|
|
|
10729
10883
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10730
10884
|
}
|
|
10731
10885
|
async function runTraceCli(args, context) {
|
|
10732
|
-
const parsed =
|
|
10886
|
+
const parsed = parseNodeArgs13({
|
|
10733
10887
|
args,
|
|
10734
10888
|
allowPositionals: true,
|
|
10735
10889
|
strict: false,
|
|
@@ -10873,14 +11027,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10873
11027
|
}
|
|
10874
11028
|
|
|
10875
11029
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10876
|
-
var import_picocolors6 = __toESM(require_picocolors());
|
|
11030
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10877
11031
|
init_output();
|
|
11032
|
+
import fs14 from "fs";
|
|
11033
|
+
import path28 from "path";
|
|
10878
11034
|
async function runGenerateTypesCli(rawArgs) {
|
|
10879
11035
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10880
11036
|
const logger = createCliLogger({ output });
|
|
10881
11037
|
const cwd2 = process.cwd();
|
|
10882
11038
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10883
|
-
const outPath =
|
|
11039
|
+
const outPath = path28.resolve(cwd2, outFile);
|
|
10884
11040
|
output.writeText("");
|
|
10885
11041
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10886
11042
|
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"));
|
|
@@ -10916,12 +11072,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10916
11072
|
}
|
|
10917
11073
|
output.writeText("");
|
|
10918
11074
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10919
|
-
const outDir =
|
|
10920
|
-
if (!
|
|
10921
|
-
|
|
11075
|
+
const outDir = path28.dirname(outPath);
|
|
11076
|
+
if (!fs14.existsSync(outDir)) {
|
|
11077
|
+
fs14.mkdirSync(outDir, { recursive: true });
|
|
10922
11078
|
}
|
|
10923
|
-
|
|
10924
|
-
logger.ok(
|
|
11079
|
+
fs14.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11080
|
+
logger.ok(path28.relative(cwd2, outPath));
|
|
10925
11081
|
output.writeText("");
|
|
10926
11082
|
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"));
|
|
10927
11083
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10932,11 +11088,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10932
11088
|
}
|
|
10933
11089
|
async function loadNativeBinding2(cwd2) {
|
|
10934
11090
|
const candidates = [
|
|
10935
|
-
|
|
10936
|
-
|
|
11091
|
+
path28.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11092
|
+
path28.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10937
11093
|
];
|
|
10938
11094
|
for (const candidate of candidates) {
|
|
10939
|
-
if (
|
|
11095
|
+
if (fs14.existsSync(candidate)) {
|
|
10940
11096
|
try {
|
|
10941
11097
|
return __require(candidate);
|
|
10942
11098
|
} catch {
|
|
@@ -10948,9 +11104,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10948
11104
|
|
|
10949
11105
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
10950
11106
|
init_errors();
|
|
11107
|
+
import { parseArgs as parseNodeArgs14 } from "util";
|
|
10951
11108
|
|
|
10952
11109
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
10953
11110
|
init_internal();
|
|
11111
|
+
import fs15 from "fs";
|
|
11112
|
+
import path29 from "path";
|
|
10954
11113
|
init_src2();
|
|
10955
11114
|
function extractVariantChain(usage) {
|
|
10956
11115
|
const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
|
|
@@ -10998,7 +11157,7 @@ async function whyClass(className, options) {
|
|
|
10998
11157
|
for (const file of scanResult.files) {
|
|
10999
11158
|
const source = (() => {
|
|
11000
11159
|
try {
|
|
11001
|
-
return
|
|
11160
|
+
return fs15.readFileSync(file.file, "utf8");
|
|
11002
11161
|
} catch {
|
|
11003
11162
|
return "";
|
|
11004
11163
|
}
|
|
@@ -11012,7 +11171,7 @@ async function whyClass(className, options) {
|
|
|
11012
11171
|
className
|
|
11013
11172
|
]);
|
|
11014
11173
|
usedIn.push({
|
|
11015
|
-
file:
|
|
11174
|
+
file: path29.relative(root, file.file) || path29.basename(file.file),
|
|
11016
11175
|
line: location.line,
|
|
11017
11176
|
column: location.column,
|
|
11018
11177
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11133,7 +11292,7 @@ function printWhyOutput(result, output) {
|
|
|
11133
11292
|
output.writeText("");
|
|
11134
11293
|
}
|
|
11135
11294
|
async function runWhyCli(args, context) {
|
|
11136
|
-
const parsed =
|
|
11295
|
+
const parsed = parseNodeArgs14({
|
|
11137
11296
|
args,
|
|
11138
11297
|
allowPositionals: true,
|
|
11139
11298
|
strict: false,
|
|
@@ -11175,7 +11334,7 @@ function toVariadic(value) {
|
|
|
11175
11334
|
return Array.isArray(value) ? value : [value];
|
|
11176
11335
|
}
|
|
11177
11336
|
function buildMainProgram(context) {
|
|
11178
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11337
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11179
11338
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11180
11339
|
const program2 = new Command("tw");
|
|
11181
11340
|
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");
|
|
@@ -11476,11 +11635,14 @@ async function main2() {
|
|
|
11476
11635
|
buildProgram: buildMainProgram
|
|
11477
11636
|
});
|
|
11478
11637
|
}
|
|
11479
|
-
var __filename2 =
|
|
11638
|
+
var __filename2 = fileURLToPath6(import.meta.url);
|
|
11480
11639
|
if (process.argv[1] === __filename2) {
|
|
11481
11640
|
main2();
|
|
11482
11641
|
}
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11642
|
+
export {
|
|
11643
|
+
createCliOutput,
|
|
11644
|
+
ensureFlag,
|
|
11645
|
+
parseCliInput as parseCliArgs,
|
|
11646
|
+
runScanCli
|
|
11647
|
+
};
|
|
11486
11648
|
//# sourceMappingURL=cli.mjs.map
|