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