tailwind-styled-v4 5.0.37 → 5.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +121 -83
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +31 -15
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +107 -67
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +47 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +601 -428
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +504 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +833 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +298 -30
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +72 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.js +335 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +28 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +719 -506
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +520 -318
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +145 -319
- package/dist/index.d.ts +145 -319
- package/dist/index.js +1337 -7442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -7386
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +327 -242
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +272 -184
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +94 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +68 -40
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +14 -10
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js +102 -53
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +30 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +48 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +108 -53
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +50 -18
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +63 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +98 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.js +164 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +70 -40
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +0 -12
- package/dist/shared.d.ts +0 -12
- package/dist/shared.js +481 -299
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +304 -133
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +40 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.js +95 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +69 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +56 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.js +133 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +45 -14
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +156 -115
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +135 -82
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +584 -423
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +498 -311
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +599 -450
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +484 -332
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +102 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +39 -15
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +112 -77
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -18
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
import * as fs11 from 'fs';
|
|
3
|
-
import fs11__default, { readFileSync, readdirSync } from 'fs';
|
|
4
|
-
import * as path6 from 'path';
|
|
5
|
-
import path6__default, { join, extname } from 'path';
|
|
6
|
-
import 'crypto';
|
|
7
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
8
|
-
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
|
|
9
|
-
import { availableParallelism } from 'os';
|
|
10
|
-
import { z } from 'zod';
|
|
11
|
-
import fs7 from 'fs/promises';
|
|
12
|
-
import { isTTY, spinner, note, outro, intro, text, isCancel, select, confirm } from '@clack/prompts';
|
|
13
|
-
import { parseArgs } from 'util';
|
|
14
|
-
import { spawn } from 'child_process';
|
|
15
|
-
|
|
16
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
17
2
|
var __create = Object.create;
|
|
18
3
|
var __defProp = Object.defineProperty;
|
|
@@ -49,14 +34,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
49
34
|
// file that has been converted to a CommonJS file using a Babel-
|
|
50
35
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
36
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
52
|
-
__defProp(target, "default", { value: mod, enumerable: true }) ,
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
38
|
mod
|
|
54
39
|
));
|
|
55
40
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
56
41
|
|
|
57
42
|
// packages/infrastructure/cli/node_modules/commander/lib/error.js
|
|
58
43
|
var require_error = __commonJS({
|
|
59
|
-
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports
|
|
44
|
+
"packages/infrastructure/cli/node_modules/commander/lib/error.js"(exports) {
|
|
45
|
+
"use strict";
|
|
60
46
|
var CommanderError2 = class extends Error {
|
|
61
47
|
/**
|
|
62
48
|
* Constructs the CommanderError class
|
|
@@ -84,14 +70,15 @@ var require_error = __commonJS({
|
|
|
84
70
|
this.name = this.constructor.name;
|
|
85
71
|
}
|
|
86
72
|
};
|
|
87
|
-
exports
|
|
88
|
-
exports
|
|
73
|
+
exports.CommanderError = CommanderError2;
|
|
74
|
+
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
89
75
|
}
|
|
90
76
|
});
|
|
91
77
|
|
|
92
78
|
// packages/infrastructure/cli/node_modules/commander/lib/argument.js
|
|
93
79
|
var require_argument = __commonJS({
|
|
94
|
-
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports
|
|
80
|
+
"packages/infrastructure/cli/node_modules/commander/lib/argument.js"(exports) {
|
|
81
|
+
"use strict";
|
|
95
82
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
96
83
|
var Argument2 = class {
|
|
97
84
|
/**
|
|
@@ -211,14 +198,15 @@ var require_argument = __commonJS({
|
|
|
211
198
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
212
199
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
213
200
|
}
|
|
214
|
-
exports
|
|
215
|
-
exports
|
|
201
|
+
exports.Argument = Argument2;
|
|
202
|
+
exports.humanReadableArgName = humanReadableArgName;
|
|
216
203
|
}
|
|
217
204
|
});
|
|
218
205
|
|
|
219
206
|
// packages/infrastructure/cli/node_modules/commander/lib/help.js
|
|
220
207
|
var require_help = __commonJS({
|
|
221
|
-
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports
|
|
208
|
+
"packages/infrastructure/cli/node_modules/commander/lib/help.js"(exports) {
|
|
209
|
+
"use strict";
|
|
222
210
|
var { humanReadableArgName } = require_argument();
|
|
223
211
|
var Help2 = class {
|
|
224
212
|
constructor() {
|
|
@@ -626,13 +614,14 @@ var require_help = __commonJS({
|
|
|
626
614
|
}).join("\n");
|
|
627
615
|
}
|
|
628
616
|
};
|
|
629
|
-
exports
|
|
617
|
+
exports.Help = Help2;
|
|
630
618
|
}
|
|
631
619
|
});
|
|
632
620
|
|
|
633
621
|
// packages/infrastructure/cli/node_modules/commander/lib/option.js
|
|
634
622
|
var require_option = __commonJS({
|
|
635
|
-
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports
|
|
623
|
+
"packages/infrastructure/cli/node_modules/commander/lib/option.js"(exports) {
|
|
624
|
+
"use strict";
|
|
636
625
|
var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
637
626
|
var Option2 = class {
|
|
638
627
|
/**
|
|
@@ -897,14 +886,15 @@ var require_option = __commonJS({
|
|
|
897
886
|
}
|
|
898
887
|
return { shortFlag, longFlag };
|
|
899
888
|
}
|
|
900
|
-
exports
|
|
901
|
-
exports
|
|
889
|
+
exports.Option = Option2;
|
|
890
|
+
exports.DualOptions = DualOptions;
|
|
902
891
|
}
|
|
903
892
|
});
|
|
904
893
|
|
|
905
894
|
// packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js
|
|
906
895
|
var require_suggestSimilar = __commonJS({
|
|
907
|
-
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports
|
|
896
|
+
"packages/infrastructure/cli/node_modules/commander/lib/suggestSimilar.js"(exports) {
|
|
897
|
+
"use strict";
|
|
908
898
|
var maxDistance = 3;
|
|
909
899
|
function editDistance(a, b) {
|
|
910
900
|
if (Math.abs(a.length - b.length) > maxDistance)
|
|
@@ -978,13 +968,14 @@ var require_suggestSimilar = __commonJS({
|
|
|
978
968
|
}
|
|
979
969
|
return "";
|
|
980
970
|
}
|
|
981
|
-
exports
|
|
971
|
+
exports.suggestSimilar = suggestSimilar;
|
|
982
972
|
}
|
|
983
973
|
});
|
|
984
974
|
|
|
985
975
|
// packages/infrastructure/cli/node_modules/commander/lib/command.js
|
|
986
976
|
var require_command = __commonJS({
|
|
987
|
-
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports
|
|
977
|
+
"packages/infrastructure/cli/node_modules/commander/lib/command.js"(exports) {
|
|
978
|
+
"use strict";
|
|
988
979
|
var EventEmitter = __require("events").EventEmitter;
|
|
989
980
|
var childProcess = __require("child_process");
|
|
990
981
|
var path30 = __require("path");
|
|
@@ -1398,6 +1389,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1398
1389
|
this._exitCallback = (err) => {
|
|
1399
1390
|
if (err.code !== "commander.executeSubCommandAsync") {
|
|
1400
1391
|
throw err;
|
|
1392
|
+
} else {
|
|
1401
1393
|
}
|
|
1402
1394
|
};
|
|
1403
1395
|
}
|
|
@@ -3020,29 +3012,30 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3020
3012
|
return arg;
|
|
3021
3013
|
});
|
|
3022
3014
|
}
|
|
3023
|
-
exports
|
|
3015
|
+
exports.Command = Command2;
|
|
3024
3016
|
}
|
|
3025
3017
|
});
|
|
3026
3018
|
|
|
3027
3019
|
// packages/infrastructure/cli/node_modules/commander/index.js
|
|
3028
3020
|
var require_commander = __commonJS({
|
|
3029
|
-
"packages/infrastructure/cli/node_modules/commander/index.js"(exports
|
|
3021
|
+
"packages/infrastructure/cli/node_modules/commander/index.js"(exports) {
|
|
3022
|
+
"use strict";
|
|
3030
3023
|
var { Argument: Argument2 } = require_argument();
|
|
3031
3024
|
var { Command: Command2 } = require_command();
|
|
3032
3025
|
var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
|
|
3033
3026
|
var { Help: Help2 } = require_help();
|
|
3034
3027
|
var { Option: Option2 } = require_option();
|
|
3035
|
-
exports
|
|
3036
|
-
exports
|
|
3037
|
-
exports
|
|
3038
|
-
exports
|
|
3039
|
-
exports
|
|
3040
|
-
exports
|
|
3041
|
-
exports
|
|
3042
|
-
exports
|
|
3043
|
-
exports
|
|
3044
|
-
exports
|
|
3045
|
-
exports
|
|
3028
|
+
exports.program = new Command2();
|
|
3029
|
+
exports.createCommand = (name) => new Command2(name);
|
|
3030
|
+
exports.createOption = (flags, description) => new Option2(flags, description);
|
|
3031
|
+
exports.createArgument = (name, description) => new Argument2(name, description);
|
|
3032
|
+
exports.Command = Command2;
|
|
3033
|
+
exports.Option = Option2;
|
|
3034
|
+
exports.Argument = Argument2;
|
|
3035
|
+
exports.Help = Help2;
|
|
3036
|
+
exports.CommanderError = CommanderError2;
|
|
3037
|
+
exports.InvalidArgumentError = InvalidArgumentError2;
|
|
3038
|
+
exports.InvalidOptionArgumentError = InvalidArgumentError2;
|
|
3046
3039
|
}
|
|
3047
3040
|
});
|
|
3048
3041
|
|
|
@@ -3050,7 +3043,8 @@ var require_commander = __commonJS({
|
|
|
3050
3043
|
var import_index, program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help;
|
|
3051
3044
|
var init_esm = __esm({
|
|
3052
3045
|
"packages/infrastructure/cli/node_modules/commander/esm.mjs"() {
|
|
3053
|
-
|
|
3046
|
+
"use strict";
|
|
3047
|
+
import_index = __toESM(require_commander(), 1);
|
|
3054
3048
|
({
|
|
3055
3049
|
program,
|
|
3056
3050
|
createCommand,
|
|
@@ -3095,6 +3089,7 @@ function errorExitCode(error) {
|
|
|
3095
3089
|
var CliError, CliUsageError;
|
|
3096
3090
|
var init_errors = __esm({
|
|
3097
3091
|
"packages/infrastructure/cli/src/utils/errors.ts"() {
|
|
3092
|
+
"use strict";
|
|
3098
3093
|
CliError = class extends Error {
|
|
3099
3094
|
exitCode;
|
|
3100
3095
|
code;
|
|
@@ -3127,22 +3122,44 @@ function getNodeModuleRef() {
|
|
|
3127
3122
|
return null;
|
|
3128
3123
|
}
|
|
3129
3124
|
}
|
|
3125
|
+
function getCurrentFileUrl() {
|
|
3126
|
+
if (import.meta.url) {
|
|
3127
|
+
return import.meta.url;
|
|
3128
|
+
}
|
|
3129
|
+
if (typeof __filename !== "undefined") {
|
|
3130
|
+
return `file://${__filename.replace(/\\/g, "/")}`;
|
|
3131
|
+
}
|
|
3132
|
+
return "file://unknown";
|
|
3133
|
+
}
|
|
3130
3134
|
function getNodePath() {
|
|
3131
3135
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3136
|
+
if (!_nodePath) {
|
|
3137
|
+
if (typeof __require === "function") {
|
|
3138
|
+
_nodePath = __require("path");
|
|
3139
|
+
} else {
|
|
3140
|
+
const nodeRequire = getNodeModuleRef();
|
|
3141
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3142
|
+
_nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3135
3145
|
return _nodePath;
|
|
3136
3146
|
}
|
|
3137
3147
|
function getNodeUrl() {
|
|
3138
3148
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3149
|
+
if (!_nodeUrl) {
|
|
3150
|
+
if (typeof __require === "function") {
|
|
3151
|
+
_nodeUrl = __require("url");
|
|
3152
|
+
} else {
|
|
3153
|
+
const nodeRequire = getNodeModuleRef();
|
|
3154
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
3155
|
+
_nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3142
3158
|
return _nodeUrl;
|
|
3143
3159
|
}
|
|
3144
3160
|
function getDirname(importMetaUrl) {
|
|
3145
3161
|
if (isBrowser) return "";
|
|
3162
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
3146
3163
|
const nodePath = getNodePath();
|
|
3147
3164
|
const nodeUrl = getNodeUrl();
|
|
3148
3165
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
@@ -3150,12 +3167,18 @@ function getDirname(importMetaUrl) {
|
|
|
3150
3167
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl;
|
|
3151
3168
|
var init_esmHelpers = __esm({
|
|
3152
3169
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
3170
|
+
"use strict";
|
|
3153
3171
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3154
3172
|
nodeModuleRef = null;
|
|
3155
3173
|
_nodePath = null;
|
|
3156
3174
|
_nodeUrl = null;
|
|
3157
3175
|
}
|
|
3158
3176
|
});
|
|
3177
|
+
|
|
3178
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
3179
|
+
import { createRequire } from "module";
|
|
3180
|
+
import * as fs from "fs";
|
|
3181
|
+
import * as path from "path";
|
|
3159
3182
|
function platformKey() {
|
|
3160
3183
|
if (isBrowser2) return "browser";
|
|
3161
3184
|
return `${process.platform}-${process.arch}`;
|
|
@@ -3171,7 +3194,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3171
3194
|
}
|
|
3172
3195
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
3173
3196
|
if (envPath) {
|
|
3174
|
-
if (
|
|
3197
|
+
if (fs.existsSync(envPath)) {
|
|
3175
3198
|
return { path: envPath, source: "env", platform, tried };
|
|
3176
3199
|
}
|
|
3177
3200
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -3180,7 +3203,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3180
3203
|
for (const pkg of prebuiltPkgs) {
|
|
3181
3204
|
try {
|
|
3182
3205
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
3183
|
-
if (
|
|
3206
|
+
if (fs.existsSync(candidate)) {
|
|
3184
3207
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3185
3208
|
}
|
|
3186
3209
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -3191,13 +3214,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3191
3214
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
3192
3215
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3193
3216
|
if (runtimeDir) {
|
|
3194
|
-
for (const depth of ["..",
|
|
3195
|
-
const pkgRoot =
|
|
3217
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
3218
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
3196
3219
|
for (const bin of BINARY_NAMES_SELF) {
|
|
3197
3220
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
3198
|
-
const candidate =
|
|
3221
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
3199
3222
|
tried.push(`self-bundled:${candidate}`);
|
|
3200
|
-
if (
|
|
3223
|
+
if (fs.existsSync(candidate)) {
|
|
3201
3224
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
3202
3225
|
}
|
|
3203
3226
|
}
|
|
@@ -3209,29 +3232,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3209
3232
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3210
3233
|
const localCandidates = [];
|
|
3211
3234
|
for (const bin of BINARY_NAMES) {
|
|
3212
|
-
localCandidates.push(
|
|
3213
|
-
localCandidates.push(
|
|
3214
|
-
localCandidates.push(
|
|
3215
|
-
localCandidates.push(
|
|
3235
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
3236
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
3237
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
3238
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
3216
3239
|
}
|
|
3217
3240
|
for (const startDir of [cwd2, base]) {
|
|
3218
3241
|
let dir = startDir;
|
|
3219
3242
|
for (let i = 0; i < 6; i++) {
|
|
3220
|
-
const nativeDir =
|
|
3243
|
+
const nativeDir = path.resolve(dir, "native");
|
|
3221
3244
|
for (const bin of BINARY_NAMES) {
|
|
3222
|
-
localCandidates.push(
|
|
3223
|
-
localCandidates.push(
|
|
3224
|
-
localCandidates.push(
|
|
3225
|
-
localCandidates.push(
|
|
3245
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
3246
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
3247
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
3248
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
3226
3249
|
}
|
|
3227
|
-
const parent =
|
|
3250
|
+
const parent = path.resolve(dir, "..");
|
|
3228
3251
|
if (parent === dir) break;
|
|
3229
3252
|
dir = parent;
|
|
3230
3253
|
}
|
|
3231
3254
|
}
|
|
3232
3255
|
for (const candidate of localCandidates) {
|
|
3233
3256
|
tried.push(`local:${candidate}`);
|
|
3234
|
-
if (
|
|
3257
|
+
if (fs.existsSync(candidate)) {
|
|
3235
3258
|
return { path: candidate, source: "local", platform, tried };
|
|
3236
3259
|
}
|
|
3237
3260
|
}
|
|
@@ -3240,8 +3263,11 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
3240
3263
|
var isBrowser2, _require, PLATFORM_MAP;
|
|
3241
3264
|
var init_native_resolution = __esm({
|
|
3242
3265
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
3266
|
+
"use strict";
|
|
3243
3267
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
3244
|
-
_require =
|
|
3268
|
+
_require = createRequire(
|
|
3269
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
3270
|
+
);
|
|
3245
3271
|
PLATFORM_MAP = {
|
|
3246
3272
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
3247
3273
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -3252,6 +3278,13 @@ var init_native_resolution = __esm({
|
|
|
3252
3278
|
};
|
|
3253
3279
|
}
|
|
3254
3280
|
});
|
|
3281
|
+
|
|
3282
|
+
// packages/domain/shared/src/index.ts
|
|
3283
|
+
import { createHash } from "crypto";
|
|
3284
|
+
import fs2 from "fs";
|
|
3285
|
+
import path2 from "path";
|
|
3286
|
+
import { fileURLToPath } from "url";
|
|
3287
|
+
import { createRequire as createRequire2 } from "module";
|
|
3255
3288
|
function createLogger(namespace) {
|
|
3256
3289
|
const prefix = `[${namespace}]`;
|
|
3257
3290
|
return {
|
|
@@ -3294,9 +3327,9 @@ function loadNativeBinding(options) {
|
|
|
3294
3327
|
const { runtimeDir, candidates, isValid } = options;
|
|
3295
3328
|
const loadErrors = [];
|
|
3296
3329
|
for (const candidate of candidates) {
|
|
3297
|
-
const candidatePath =
|
|
3330
|
+
const candidatePath = path2.resolve(runtimeDir, candidate);
|
|
3298
3331
|
try {
|
|
3299
|
-
if (!
|
|
3332
|
+
if (!fs2.existsSync(candidatePath) && !fs2.existsSync(candidatePath + ".node")) {
|
|
3300
3333
|
continue;
|
|
3301
3334
|
}
|
|
3302
3335
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3328,9 +3361,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3328
3361
|
}
|
|
3329
3362
|
}
|
|
3330
3363
|
if (!includeDefaultCandidates) return candidates;
|
|
3331
|
-
if (
|
|
3364
|
+
if (fs2.existsSync(runtimeDir)) {
|
|
3332
3365
|
try {
|
|
3333
|
-
for (const entry of
|
|
3366
|
+
for (const entry of fs2.readdirSync(runtimeDir)) {
|
|
3334
3367
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3335
3368
|
}
|
|
3336
3369
|
} catch {
|
|
@@ -3339,22 +3372,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3339
3372
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3340
3373
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3341
3374
|
for (const bin of BINARY_NAMES) {
|
|
3342
|
-
candidates.push(
|
|
3343
|
-
candidates.push(
|
|
3344
|
-
candidates.push(
|
|
3345
|
-
candidates.push(
|
|
3346
|
-
candidates.push(
|
|
3347
|
-
candidates.push(
|
|
3348
|
-
candidates.push(
|
|
3349
|
-
candidates.push(
|
|
3350
|
-
candidates.push(
|
|
3375
|
+
candidates.push(path2.resolve(runtimeDir, `${bin}.node`));
|
|
3376
|
+
candidates.push(path2.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3377
|
+
candidates.push(path2.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3378
|
+
candidates.push(path2.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3379
|
+
candidates.push(path2.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3380
|
+
candidates.push(path2.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3381
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3382
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3383
|
+
candidates.push(path2.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3351
3384
|
}
|
|
3352
3385
|
return Array.from(new Set(candidates));
|
|
3353
3386
|
}
|
|
3354
3387
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3355
|
-
if (dir) return
|
|
3388
|
+
if (dir) return path2.resolve(dir);
|
|
3356
3389
|
try {
|
|
3357
|
-
return
|
|
3390
|
+
return path2.dirname(fileURLToPath(importMetaUrl));
|
|
3358
3391
|
} catch {
|
|
3359
3392
|
return process.cwd();
|
|
3360
3393
|
}
|
|
@@ -3362,6 +3395,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
3362
3395
|
var TwError, _require2;
|
|
3363
3396
|
var init_src = __esm({
|
|
3364
3397
|
"packages/domain/shared/src/index.ts"() {
|
|
3398
|
+
"use strict";
|
|
3365
3399
|
init_esmHelpers();
|
|
3366
3400
|
init_native_resolution();
|
|
3367
3401
|
TwError = class _TwError extends Error {
|
|
@@ -3416,7 +3450,9 @@ var init_src = __esm({
|
|
|
3416
3450
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3417
3451
|
}
|
|
3418
3452
|
};
|
|
3419
|
-
_require2 =
|
|
3453
|
+
_require2 = createRequire2(
|
|
3454
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
|
|
3455
|
+
);
|
|
3420
3456
|
}
|
|
3421
3457
|
});
|
|
3422
3458
|
|
|
@@ -3449,12 +3485,14 @@ __export(native_bridge_exports, {
|
|
|
3449
3485
|
startWatchNative: () => startWatchNative,
|
|
3450
3486
|
stopWatchNative: () => stopWatchNative
|
|
3451
3487
|
});
|
|
3488
|
+
import path3 from "path";
|
|
3489
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3452
3490
|
function getDirname2() {
|
|
3453
3491
|
if (typeof __dirname !== "undefined") {
|
|
3454
3492
|
return __dirname;
|
|
3455
3493
|
}
|
|
3456
3494
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3457
|
-
return
|
|
3495
|
+
return path3.dirname(fileURLToPath2(import.meta.url));
|
|
3458
3496
|
}
|
|
3459
3497
|
return process.cwd();
|
|
3460
3498
|
}
|
|
@@ -3662,6 +3700,7 @@ function hasNativeWatchBinding() {
|
|
|
3662
3700
|
var log, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3663
3701
|
var init_native_bridge = __esm({
|
|
3664
3702
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3703
|
+
"use strict";
|
|
3665
3704
|
init_src();
|
|
3666
3705
|
log = createDebugLogger("scanner:native");
|
|
3667
3706
|
isValidScannerBinding = (module) => {
|
|
@@ -3742,13 +3781,17 @@ var init_native_bridge = __esm({
|
|
|
3742
3781
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3743
3782
|
}
|
|
3744
3783
|
});
|
|
3784
|
+
|
|
3785
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
3786
|
+
import fs3 from "fs";
|
|
3787
|
+
import path4 from "path";
|
|
3745
3788
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3746
|
-
const dir = cacheDir ?
|
|
3747
|
-
return
|
|
3789
|
+
const dir = cacheDir ? path4.resolve(rootDir, cacheDir) : path4.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3790
|
+
return path4.join(dir, "scanner-cache.json");
|
|
3748
3791
|
}
|
|
3749
3792
|
function readCache(rootDir, cacheDir) {
|
|
3750
3793
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3751
|
-
|
|
3794
|
+
fs3.mkdirSync(path4.dirname(cachePath), { recursive: true });
|
|
3752
3795
|
const result = cacheReadNative(cachePath);
|
|
3753
3796
|
if (!result) return [];
|
|
3754
3797
|
return result.entries.map((e) => ({
|
|
@@ -3763,7 +3806,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3763
3806
|
}
|
|
3764
3807
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3765
3808
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3766
|
-
|
|
3809
|
+
fs3.mkdirSync(path4.dirname(cachePath), { recursive: true });
|
|
3767
3810
|
const success = cacheWriteNative(cachePath, entries);
|
|
3768
3811
|
if (!success) {
|
|
3769
3812
|
throw new Error(
|
|
@@ -3782,11 +3825,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3782
3825
|
nowMs
|
|
3783
3826
|
);
|
|
3784
3827
|
}
|
|
3828
|
+
var STALE_THRESHOLD_MS;
|
|
3785
3829
|
var init_cache_native = __esm({
|
|
3786
3830
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
3831
|
+
"use strict";
|
|
3787
3832
|
init_native_bridge();
|
|
3833
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3788
3834
|
}
|
|
3789
3835
|
});
|
|
3836
|
+
|
|
3837
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
3838
|
+
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
3839
|
+
import path5 from "path";
|
|
3840
|
+
import { availableParallelism } from "os";
|
|
3841
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3790
3842
|
function collectFiles(rootDir, extensions, ignoreDirs) {
|
|
3791
3843
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
3792
3844
|
if (native !== null) return native;
|
|
@@ -3827,7 +3879,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3827
3879
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
3828
3880
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
3829
3881
|
} = options;
|
|
3830
|
-
const files = collectFiles(
|
|
3882
|
+
const files = collectFiles(path5.resolve(rootDir), extensions, ignoreDirs);
|
|
3831
3883
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
3832
3884
|
return mergeResults(batchExtractClassesNative(files));
|
|
3833
3885
|
}
|
|
@@ -3846,6 +3898,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
3846
3898
|
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
3847
3899
|
var init_parallel_scanner = __esm({
|
|
3848
3900
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
3901
|
+
"use strict";
|
|
3849
3902
|
init_src2();
|
|
3850
3903
|
init_native_bridge();
|
|
3851
3904
|
PARALLEL_THRESHOLD = 50;
|
|
@@ -3864,12 +3917,16 @@ var init_parallel_scanner = __esm({
|
|
|
3864
3917
|
parentPort.postMessage(msg);
|
|
3865
3918
|
}
|
|
3866
3919
|
}
|
|
3867
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
3920
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
|
|
3868
3921
|
}
|
|
3869
3922
|
});
|
|
3870
|
-
|
|
3923
|
+
|
|
3924
|
+
// packages/domain/scanner/src/schemas.ts
|
|
3925
|
+
import { z } from "zod";
|
|
3926
|
+
var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
3871
3927
|
var init_schemas = __esm({
|
|
3872
3928
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
3929
|
+
"use strict";
|
|
3873
3930
|
init_src();
|
|
3874
3931
|
formatIssuePath2 = (path30) => path30.length > 0 ? path30.map(
|
|
3875
3932
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3910,7 +3967,7 @@ var init_schemas = __esm({
|
|
|
3910
3967
|
message: "scan result totalFiles must match files.length",
|
|
3911
3968
|
path: ["totalFiles"]
|
|
3912
3969
|
});
|
|
3913
|
-
z.object({
|
|
3970
|
+
ScannerWorkerRequestSchema = z.object({
|
|
3914
3971
|
rootDir: z.string().min(1),
|
|
3915
3972
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3916
3973
|
});
|
|
@@ -3948,12 +4005,17 @@ __export(src_exports, {
|
|
|
3948
4005
|
scanWorkspace: () => scanWorkspace,
|
|
3949
4006
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
3950
4007
|
});
|
|
4008
|
+
import fs4 from "fs";
|
|
4009
|
+
import { createRequire as createRequire3 } from "module";
|
|
4010
|
+
import path6 from "path";
|
|
4011
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4012
|
+
import { Worker as Worker2 } from "worker_threads";
|
|
3951
4013
|
function getRuntimeDir() {
|
|
3952
4014
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3953
4015
|
return __dirname;
|
|
3954
4016
|
}
|
|
3955
4017
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3956
|
-
return
|
|
4018
|
+
return path6.dirname(fileURLToPath4(import.meta.url));
|
|
3957
4019
|
}
|
|
3958
4020
|
return process.cwd();
|
|
3959
4021
|
}
|
|
@@ -3963,17 +4025,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
3963
4025
|
return __dirname;
|
|
3964
4026
|
}
|
|
3965
4027
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3966
|
-
return
|
|
4028
|
+
return path6.dirname(fileURLToPath4(import.meta.url));
|
|
3967
4029
|
}
|
|
3968
4030
|
return process.cwd();
|
|
3969
4031
|
})();
|
|
3970
4032
|
const candidates = [
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
4033
|
+
path6.resolve(runtimeDir, "worker.cjs"),
|
|
4034
|
+
path6.resolve(runtimeDir, "worker.js"),
|
|
4035
|
+
path6.resolve(runtimeDir, "worker.ts")
|
|
3974
4036
|
];
|
|
3975
4037
|
for (const candidate of candidates) {
|
|
3976
|
-
if (
|
|
4038
|
+
if (fs4.existsSync(candidate)) return candidate;
|
|
3977
4039
|
}
|
|
3978
4040
|
return null;
|
|
3979
4041
|
}
|
|
@@ -3985,7 +4047,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
3985
4047
|
}
|
|
3986
4048
|
return new Promise((resolve2, reject) => {
|
|
3987
4049
|
const settleState = { settled: false };
|
|
3988
|
-
const worker = new
|
|
4050
|
+
const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
3989
4051
|
const timeout = setTimeout(() => {
|
|
3990
4052
|
if (!settleState.settled) {
|
|
3991
4053
|
settleState.settled = true;
|
|
@@ -4030,19 +4092,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4030
4092
|
if (!currentDir) continue;
|
|
4031
4093
|
const entries = (() => {
|
|
4032
4094
|
try {
|
|
4033
|
-
return
|
|
4095
|
+
return fs4.readdirSync(currentDir, { withFileTypes: true });
|
|
4034
4096
|
} catch {
|
|
4035
4097
|
return [];
|
|
4036
4098
|
}
|
|
4037
4099
|
})();
|
|
4038
4100
|
for (const entry of entries) {
|
|
4039
|
-
const fullPath =
|
|
4101
|
+
const fullPath = path6.join(currentDir, entry.name);
|
|
4040
4102
|
if (entry.isDirectory()) {
|
|
4041
4103
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4042
4104
|
continue;
|
|
4043
4105
|
}
|
|
4044
4106
|
if (!entry.isFile()) continue;
|
|
4045
|
-
if (!extensionSet.has(
|
|
4107
|
+
if (!extensionSet.has(path6.extname(entry.name))) continue;
|
|
4046
4108
|
candidates.push(fullPath);
|
|
4047
4109
|
}
|
|
4048
4110
|
}
|
|
@@ -4069,7 +4131,7 @@ function scanSource(source) {
|
|
|
4069
4131
|
);
|
|
4070
4132
|
}
|
|
4071
4133
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4072
|
-
return includeExtensions.includes(
|
|
4134
|
+
return includeExtensions.includes(path6.extname(filePath));
|
|
4073
4135
|
}
|
|
4074
4136
|
function scanFile(filePath) {
|
|
4075
4137
|
const { scanFileNative: scanFileNative2 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4089,7 +4151,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4089
4151
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4090
4152
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4091
4153
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4092
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4154
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4093
4155
|
const files = [];
|
|
4094
4156
|
const unique = /* @__PURE__ */ new Set();
|
|
4095
4157
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4129,7 +4191,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4129
4191
|
for (const filePath of candidates) {
|
|
4130
4192
|
const stat = (() => {
|
|
4131
4193
|
try {
|
|
4132
|
-
return
|
|
4194
|
+
return fs4.statSync(filePath);
|
|
4133
4195
|
} catch {
|
|
4134
4196
|
return null;
|
|
4135
4197
|
}
|
|
@@ -4155,7 +4217,7 @@ function scanWorkspace(rootDir, options = {}) {
|
|
|
4155
4217
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4156
4218
|
const content = (() => {
|
|
4157
4219
|
try {
|
|
4158
|
-
return
|
|
4220
|
+
return fs4.readFileSync(filePath, "utf8");
|
|
4159
4221
|
} catch {
|
|
4160
4222
|
return null;
|
|
4161
4223
|
}
|
|
@@ -4239,6 +4301,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4239
4301
|
var log2, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4240
4302
|
var init_src2 = __esm({
|
|
4241
4303
|
"packages/domain/scanner/src/index.ts"() {
|
|
4304
|
+
"use strict";
|
|
4242
4305
|
init_src();
|
|
4243
4306
|
init_cache_native();
|
|
4244
4307
|
init_native_bridge();
|
|
@@ -4259,7 +4322,7 @@ var init_src2 = __esm({
|
|
|
4259
4322
|
const loadNativeParserBinding = () => {
|
|
4260
4323
|
if (_state.binding !== void 0) return _state.binding;
|
|
4261
4324
|
const runtimeDir = getRuntimeDir();
|
|
4262
|
-
const req =
|
|
4325
|
+
const req = createRequire3(path6.join(runtimeDir, "noop.cjs"));
|
|
4263
4326
|
const _platform = process.platform;
|
|
4264
4327
|
const _arch = process.arch;
|
|
4265
4328
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4267,27 +4330,27 @@ var init_src2 = __esm({
|
|
|
4267
4330
|
const candidates = [
|
|
4268
4331
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4269
4332
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4333
|
+
path6.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4334
|
+
path6.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4335
|
+
path6.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4273
4336
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4274
4337
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4338
|
+
path6.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4339
|
+
path6.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4340
|
+
path6.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4278
4341
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4279
|
-
|
|
4280
|
-
|
|
4342
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4343
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4281
4344
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4282
|
-
|
|
4283
|
-
|
|
4345
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4346
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4284
4347
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4348
|
+
path6.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4349
|
+
path6.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4350
|
+
path6.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4351
|
+
path6.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4352
|
+
path6.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4353
|
+
path6.resolve(
|
|
4291
4354
|
runtimeDir,
|
|
4292
4355
|
"..",
|
|
4293
4356
|
"..",
|
|
@@ -4299,7 +4362,7 @@ var init_src2 = __esm({
|
|
|
4299
4362
|
)
|
|
4300
4363
|
];
|
|
4301
4364
|
for (const fullPath of candidates) {
|
|
4302
|
-
if (!
|
|
4365
|
+
if (!fs4.existsSync(fullPath)) continue;
|
|
4303
4366
|
try {
|
|
4304
4367
|
const required = req(fullPath);
|
|
4305
4368
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4331,6 +4394,9 @@ var init_src2 = __esm({
|
|
|
4331
4394
|
DEFAULT_IGNORES = ["node_modules", ".git", ".next", "dist", "out", ".turbo", ".cache"];
|
|
4332
4395
|
}
|
|
4333
4396
|
});
|
|
4397
|
+
|
|
4398
|
+
// packages/domain/analyzer/src/utils.ts
|
|
4399
|
+
import fs5 from "fs";
|
|
4334
4400
|
function formatErrorMessage(error) {
|
|
4335
4401
|
return error instanceof Error ? error.message : String(error);
|
|
4336
4402
|
}
|
|
@@ -4341,7 +4407,7 @@ function isRecord(value) {
|
|
|
4341
4407
|
}
|
|
4342
4408
|
async function pathExists(filePath) {
|
|
4343
4409
|
try {
|
|
4344
|
-
await
|
|
4410
|
+
await fs5.promises.access(filePath, fs5.constants.F_OK);
|
|
4345
4411
|
return true;
|
|
4346
4412
|
} catch {
|
|
4347
4413
|
return false;
|
|
@@ -4358,6 +4424,7 @@ function sanitizeFrequentThreshold(value) {
|
|
|
4358
4424
|
var DEFAULT_TOP_LIMIT, DEFAULT_FREQUENT_THRESHOLD, DEBUG_NAMESPACE, debugLog;
|
|
4359
4425
|
var init_utils = __esm({
|
|
4360
4426
|
"packages/domain/analyzer/src/utils.ts"() {
|
|
4427
|
+
"use strict";
|
|
4361
4428
|
init_src();
|
|
4362
4429
|
DEFAULT_TOP_LIMIT = 10;
|
|
4363
4430
|
DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -4408,6 +4475,7 @@ async function requireNativeCssCompiler() {
|
|
|
4408
4475
|
var isAnalyzerModule, createAnalyzerBindingLoader, analyzerBindingLoader;
|
|
4409
4476
|
var init_binding = __esm({
|
|
4410
4477
|
"packages/domain/analyzer/src/binding.ts"() {
|
|
4478
|
+
"use strict";
|
|
4411
4479
|
init_src();
|
|
4412
4480
|
init_utils();
|
|
4413
4481
|
isAnalyzerModule = (module) => {
|
|
@@ -4458,9 +4526,13 @@ var init_binding = __esm({
|
|
|
4458
4526
|
analyzerBindingLoader = createAnalyzerBindingLoader();
|
|
4459
4527
|
}
|
|
4460
4528
|
});
|
|
4461
|
-
|
|
4529
|
+
|
|
4530
|
+
// packages/domain/analyzer/src/schemas.ts
|
|
4531
|
+
import { z as z2 } from "zod";
|
|
4532
|
+
var formatIssuePath3, isPlainObject, formatIssues2, parseWithSchema2, CountSchema, ClassUsageSchema, ClassConflictSchema, ClassCountSchema, NativeReportSchema, NativeCssCompileResultSchema, AnalyzerClassStatsSchema, AnalyzerSemanticOptionsSchema, AnalyzerOptionsSchema, ClassToCssOptionsSchema, parseAnalyzerOptions, parseNativeReport, parseNativeCssCompileResult, parseClassToCssOptions;
|
|
4462
4533
|
var init_schemas2 = __esm({
|
|
4463
4534
|
"packages/domain/analyzer/src/schemas.ts"() {
|
|
4535
|
+
"use strict";
|
|
4464
4536
|
init_src();
|
|
4465
4537
|
formatIssuePath3 = (path30) => path30.length > 0 ? path30.map(
|
|
4466
4538
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -4485,76 +4557,76 @@ var init_schemas2 = __esm({
|
|
|
4485
4557
|
parsed.error
|
|
4486
4558
|
);
|
|
4487
4559
|
};
|
|
4488
|
-
CountSchema =
|
|
4489
|
-
|
|
4490
|
-
name:
|
|
4560
|
+
CountSchema = z2.number().int().min(0);
|
|
4561
|
+
ClassUsageSchema = z2.object({
|
|
4562
|
+
name: z2.string(),
|
|
4491
4563
|
count: CountSchema,
|
|
4492
|
-
isUnused:
|
|
4493
|
-
isConflict:
|
|
4564
|
+
isUnused: z2.boolean().optional(),
|
|
4565
|
+
isConflict: z2.boolean().optional()
|
|
4494
4566
|
});
|
|
4495
|
-
|
|
4496
|
-
className:
|
|
4497
|
-
variants:
|
|
4498
|
-
classes:
|
|
4499
|
-
message:
|
|
4567
|
+
ClassConflictSchema = z2.object({
|
|
4568
|
+
className: z2.string(),
|
|
4569
|
+
variants: z2.array(z2.string()),
|
|
4570
|
+
classes: z2.array(z2.string()),
|
|
4571
|
+
message: z2.string()
|
|
4500
4572
|
});
|
|
4501
|
-
ClassCountSchema =
|
|
4502
|
-
name:
|
|
4573
|
+
ClassCountSchema = z2.object({
|
|
4574
|
+
name: z2.string(),
|
|
4503
4575
|
count: CountSchema
|
|
4504
4576
|
});
|
|
4505
|
-
NativeReportSchema =
|
|
4506
|
-
root:
|
|
4577
|
+
NativeReportSchema = z2.object({
|
|
4578
|
+
root: z2.string(),
|
|
4507
4579
|
totalFiles: CountSchema,
|
|
4508
4580
|
uniqueClassCount: CountSchema,
|
|
4509
4581
|
totalClassOccurrences: CountSchema,
|
|
4510
|
-
topClasses:
|
|
4511
|
-
duplicateCandidates:
|
|
4512
|
-
safelist:
|
|
4582
|
+
topClasses: z2.array(ClassCountSchema),
|
|
4583
|
+
duplicateCandidates: z2.array(ClassCountSchema),
|
|
4584
|
+
safelist: z2.array(z2.string())
|
|
4513
4585
|
});
|
|
4514
|
-
NativeCssCompileResultSchema =
|
|
4515
|
-
css:
|
|
4516
|
-
resolvedClasses:
|
|
4517
|
-
unknownClasses:
|
|
4586
|
+
NativeCssCompileResultSchema = z2.object({
|
|
4587
|
+
css: z2.string(),
|
|
4588
|
+
resolvedClasses: z2.array(z2.string()),
|
|
4589
|
+
unknownClasses: z2.array(z2.string()),
|
|
4518
4590
|
sizeBytes: CountSchema
|
|
4519
4591
|
});
|
|
4520
|
-
AnalyzerClassStatsSchema =
|
|
4521
|
-
top:
|
|
4592
|
+
AnalyzerClassStatsSchema = z2.object({
|
|
4593
|
+
top: z2.number({
|
|
4522
4594
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
4523
4595
|
}).finite().optional(),
|
|
4524
|
-
frequentThreshold:
|
|
4596
|
+
frequentThreshold: z2.number({
|
|
4525
4597
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
4526
4598
|
}).finite().optional()
|
|
4527
4599
|
});
|
|
4528
|
-
AnalyzerSemanticOptionsSchema =
|
|
4529
|
-
tailwindConfigPath:
|
|
4600
|
+
AnalyzerSemanticOptionsSchema = z2.object({
|
|
4601
|
+
tailwindConfigPath: z2.string({
|
|
4530
4602
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4531
4603
|
}).min(
|
|
4532
4604
|
1,
|
|
4533
4605
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
4534
4606
|
).optional()
|
|
4535
4607
|
});
|
|
4536
|
-
AnalyzerOptionsSchema =
|
|
4537
|
-
scanner:
|
|
4608
|
+
AnalyzerOptionsSchema = z2.object({
|
|
4609
|
+
scanner: z2.custom(
|
|
4538
4610
|
(value) => isPlainObject(value),
|
|
4539
4611
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
4540
4612
|
).optional(),
|
|
4541
4613
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
4542
|
-
semantic:
|
|
4543
|
-
|
|
4614
|
+
semantic: z2.union([
|
|
4615
|
+
z2.boolean({
|
|
4544
4616
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
4545
4617
|
}),
|
|
4546
4618
|
AnalyzerSemanticOptionsSchema
|
|
4547
4619
|
]).optional(),
|
|
4548
|
-
includeClass:
|
|
4620
|
+
includeClass: z2.custom(
|
|
4549
4621
|
(value) => typeof value === "function",
|
|
4550
4622
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
4551
4623
|
).optional()
|
|
4552
4624
|
});
|
|
4553
|
-
ClassToCssOptionsSchema =
|
|
4554
|
-
prefix:
|
|
4625
|
+
ClassToCssOptionsSchema = z2.object({
|
|
4626
|
+
prefix: z2.union([z2.string(), z2.null()], {
|
|
4555
4627
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
4556
4628
|
}).optional(),
|
|
4557
|
-
strict:
|
|
4629
|
+
strict: z2.boolean({
|
|
4558
4630
|
error: "classToCss options.strict must be a boolean when provided."
|
|
4559
4631
|
}).optional()
|
|
4560
4632
|
});
|
|
@@ -4568,9 +4640,15 @@ var init_schemas2 = __esm({
|
|
|
4568
4640
|
parseClassToCssOptions = (options) => parseWithSchema2(ClassToCssOptionsSchema, options ?? {}, "classToCss options are invalid");
|
|
4569
4641
|
}
|
|
4570
4642
|
});
|
|
4643
|
+
|
|
4644
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
4645
|
+
import fs6 from "fs";
|
|
4646
|
+
import path7 from "path";
|
|
4647
|
+
import { pathToFileURL } from "url";
|
|
4571
4648
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS, tailwindConfigCache, splitVariantAndBase, resolveConflictGroup, detectConflicts, isSupportedTailwindConfigPath, resolveTailwindConfigPath, collectSafelistFromConfig, collectCustomUtilities, collectSafelistFromSource, loadTailwindConfig, utilityPrefix, buildSemanticReport;
|
|
4572
4649
|
var init_semantic = __esm({
|
|
4573
4650
|
"packages/domain/analyzer/src/semantic.ts"() {
|
|
4651
|
+
"use strict";
|
|
4574
4652
|
init_binding();
|
|
4575
4653
|
init_utils();
|
|
4576
4654
|
SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
@@ -4606,11 +4684,11 @@ var init_semantic = __esm({
|
|
|
4606
4684
|
};
|
|
4607
4685
|
};
|
|
4608
4686
|
isSupportedTailwindConfigPath = (configPath) => {
|
|
4609
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
4687
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path7.extname(configPath).toLowerCase());
|
|
4610
4688
|
};
|
|
4611
4689
|
resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
4612
4690
|
if (explicitPath) {
|
|
4613
|
-
const resolved =
|
|
4691
|
+
const resolved = path7.resolve(root, explicitPath);
|
|
4614
4692
|
if (!await pathExists(resolved)) return null;
|
|
4615
4693
|
return resolved;
|
|
4616
4694
|
}
|
|
@@ -4621,7 +4699,7 @@ var init_semantic = __esm({
|
|
|
4621
4699
|
"tailwind.config.mjs"
|
|
4622
4700
|
];
|
|
4623
4701
|
for (const candidate of candidates) {
|
|
4624
|
-
const fullPath =
|
|
4702
|
+
const fullPath = path7.resolve(root, candidate);
|
|
4625
4703
|
if (await pathExists(fullPath)) return fullPath;
|
|
4626
4704
|
}
|
|
4627
4705
|
return null;
|
|
@@ -4675,7 +4753,7 @@ var init_semantic = __esm({
|
|
|
4675
4753
|
return out;
|
|
4676
4754
|
};
|
|
4677
4755
|
collectSafelistFromSource = async (configPath) => {
|
|
4678
|
-
const source = await
|
|
4756
|
+
const source = await fs6.promises.readFile(configPath, "utf8");
|
|
4679
4757
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src2(), src_exports));
|
|
4680
4758
|
const allTokens = extractClassesNative2(source);
|
|
4681
4759
|
const hasSafelist = source.includes("safelist");
|
|
@@ -4702,7 +4780,7 @@ var init_semantic = __esm({
|
|
|
4702
4780
|
customUtilities: /* @__PURE__ */ new Set()
|
|
4703
4781
|
};
|
|
4704
4782
|
}
|
|
4705
|
-
const configStat = await
|
|
4783
|
+
const configStat = await fs6.promises.stat(configPath).catch(() => null);
|
|
4706
4784
|
if (configStat) {
|
|
4707
4785
|
const cached = tailwindConfigCache.get(configPath);
|
|
4708
4786
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -4826,6 +4904,9 @@ var init_semantic = __esm({
|
|
|
4826
4904
|
};
|
|
4827
4905
|
}
|
|
4828
4906
|
});
|
|
4907
|
+
|
|
4908
|
+
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
4909
|
+
import path8 from "path";
|
|
4829
4910
|
function normalizeScan(scan, includeClass) {
|
|
4830
4911
|
if (!includeClass) return scan;
|
|
4831
4912
|
const filteredFiles = scan.files.map((file) => ({
|
|
@@ -4880,7 +4961,7 @@ async function buildDistribution(usages, native) {
|
|
|
4880
4961
|
}
|
|
4881
4962
|
async function analyzeWorkspace(root, options = {}) {
|
|
4882
4963
|
const startedAtMs = Date.now();
|
|
4883
|
-
const resolvedRoot =
|
|
4964
|
+
const resolvedRoot = path8.resolve(root);
|
|
4884
4965
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
4885
4966
|
const scan = await (async () => {
|
|
4886
4967
|
const scanStartedAtMs = Date.now();
|
|
@@ -4984,6 +5065,7 @@ async function analyzeWorkspace(root, options = {}) {
|
|
|
4984
5065
|
}
|
|
4985
5066
|
var init_analyzeWorkspace = __esm({
|
|
4986
5067
|
"packages/domain/analyzer/src/analyzeWorkspace.ts"() {
|
|
5068
|
+
"use strict";
|
|
4987
5069
|
init_src2();
|
|
4988
5070
|
init_binding();
|
|
4989
5071
|
init_schemas2();
|
|
@@ -4996,6 +5078,7 @@ var init_analyzeWorkspace = __esm({
|
|
|
4996
5078
|
var normalizeClassInput, normalizeClassToCssOptions, mergeDeclarationMap, declarationMapToString, classToCss;
|
|
4997
5079
|
var init_classToCss = __esm({
|
|
4998
5080
|
"packages/domain/analyzer/src/classToCss.ts"() {
|
|
5081
|
+
"use strict";
|
|
4999
5082
|
init_binding();
|
|
5000
5083
|
init_schemas2();
|
|
5001
5084
|
init_utils();
|
|
@@ -5116,6 +5199,7 @@ __export(src_exports2, {
|
|
|
5116
5199
|
var __internal;
|
|
5117
5200
|
var init_src3 = __esm({
|
|
5118
5201
|
"packages/domain/analyzer/src/index.ts"() {
|
|
5202
|
+
"use strict";
|
|
5119
5203
|
init_analyzeWorkspace();
|
|
5120
5204
|
init_classToCss();
|
|
5121
5205
|
init_schemas2();
|
|
@@ -5134,6 +5218,10 @@ var init_src3 = __esm({
|
|
|
5134
5218
|
};
|
|
5135
5219
|
}
|
|
5136
5220
|
});
|
|
5221
|
+
|
|
5222
|
+
// packages/infrastructure/cli/src/utils/fs.ts
|
|
5223
|
+
import fs7 from "fs/promises";
|
|
5224
|
+
import path9 from "path";
|
|
5137
5225
|
async function pathExists2(filePath) {
|
|
5138
5226
|
try {
|
|
5139
5227
|
await fs7.access(filePath);
|
|
@@ -5163,7 +5251,7 @@ async function writeFileSafe(filePath, content, options = {}) {
|
|
|
5163
5251
|
options.onDryRun?.(`write ${filePath}`);
|
|
5164
5252
|
return;
|
|
5165
5253
|
}
|
|
5166
|
-
await fs7.mkdir(
|
|
5254
|
+
await fs7.mkdir(path9.dirname(filePath), { recursive: true });
|
|
5167
5255
|
await fs7.writeFile(filePath, content, "utf8");
|
|
5168
5256
|
}
|
|
5169
5257
|
async function ensureFileSafe(filePath, content, options = {}) {
|
|
@@ -5173,12 +5261,14 @@ async function ensureFileSafe(filePath, content, options = {}) {
|
|
|
5173
5261
|
}
|
|
5174
5262
|
var init_fs = __esm({
|
|
5175
5263
|
"packages/infrastructure/cli/src/utils/fs.ts"() {
|
|
5264
|
+
"use strict";
|
|
5176
5265
|
}
|
|
5177
5266
|
});
|
|
5178
5267
|
|
|
5179
5268
|
// node_modules/picocolors/picocolors.js
|
|
5180
5269
|
var require_picocolors = __commonJS({
|
|
5181
|
-
"node_modules/picocolors/picocolors.js"(exports
|
|
5270
|
+
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
5271
|
+
"use strict";
|
|
5182
5272
|
var p = process || {};
|
|
5183
5273
|
var argv = p.argv || [];
|
|
5184
5274
|
var env = p.env || {};
|
|
@@ -5265,8 +5355,18 @@ function writeJsonSuccess(command, data) {
|
|
|
5265
5355
|
}
|
|
5266
5356
|
var init_json = __esm({
|
|
5267
5357
|
"packages/infrastructure/cli/src/utils/json.ts"() {
|
|
5358
|
+
"use strict";
|
|
5268
5359
|
}
|
|
5269
5360
|
});
|
|
5361
|
+
|
|
5362
|
+
// packages/infrastructure/cli/src/utils/output.ts
|
|
5363
|
+
import {
|
|
5364
|
+
intro as clackIntro,
|
|
5365
|
+
isTTY as clackIsTTY,
|
|
5366
|
+
note as clackNote,
|
|
5367
|
+
outro as clackOutro,
|
|
5368
|
+
spinner as clackSpinner
|
|
5369
|
+
} from "@clack/prompts";
|
|
5270
5370
|
function writeLine(stream, message = "") {
|
|
5271
5371
|
stream.write(`${message}
|
|
5272
5372
|
`);
|
|
@@ -5296,7 +5396,7 @@ function createCliOutput(options = {}) {
|
|
|
5296
5396
|
const json = Boolean(options.json);
|
|
5297
5397
|
const debug = Boolean(options.debug);
|
|
5298
5398
|
const verboseEnabled = Boolean(options.verbose);
|
|
5299
|
-
const interactive = !json && Boolean(process.stdin.isTTY) &&
|
|
5399
|
+
const interactive = !json && Boolean(process.stdin.isTTY) && clackIsTTY(stdout);
|
|
5300
5400
|
function writeText(message = "", writeOptions = {}) {
|
|
5301
5401
|
writeLine(writeOptions.stderr || json ? stderr : stdout, message);
|
|
5302
5402
|
}
|
|
@@ -5330,7 +5430,7 @@ function createCliOutput(options = {}) {
|
|
|
5330
5430
|
},
|
|
5331
5431
|
note(message, title) {
|
|
5332
5432
|
if (interactive) {
|
|
5333
|
-
|
|
5433
|
+
clackNote(message, title);
|
|
5334
5434
|
return;
|
|
5335
5435
|
}
|
|
5336
5436
|
if (title) {
|
|
@@ -5341,17 +5441,17 @@ ${message}`);
|
|
|
5341
5441
|
writeText(message);
|
|
5342
5442
|
},
|
|
5343
5443
|
intro(message) {
|
|
5344
|
-
showClackMessage(
|
|
5444
|
+
showClackMessage(clackIntro, message);
|
|
5345
5445
|
},
|
|
5346
5446
|
outro(message) {
|
|
5347
|
-
showClackMessage(
|
|
5447
|
+
showClackMessage(clackOutro, message);
|
|
5348
5448
|
},
|
|
5349
5449
|
table(rows) {
|
|
5350
5450
|
writeText(JSON.stringify(rows, null, 2));
|
|
5351
5451
|
},
|
|
5352
5452
|
spinner() {
|
|
5353
5453
|
if (!interactive) return createNoopSpinner();
|
|
5354
|
-
const instance =
|
|
5454
|
+
const instance = clackSpinner({ output: stdout });
|
|
5355
5455
|
return {
|
|
5356
5456
|
start(message) {
|
|
5357
5457
|
instance.start(message);
|
|
@@ -5404,11 +5504,15 @@ ${import_picocolors.default.dim(message)}
|
|
|
5404
5504
|
var import_picocolors;
|
|
5405
5505
|
var init_output = __esm({
|
|
5406
5506
|
"packages/infrastructure/cli/src/utils/output.ts"() {
|
|
5407
|
-
|
|
5507
|
+
"use strict";
|
|
5508
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
5408
5509
|
init_errors();
|
|
5409
5510
|
init_json();
|
|
5410
5511
|
}
|
|
5411
5512
|
});
|
|
5513
|
+
|
|
5514
|
+
// packages/infrastructure/cli/src/utils/args.ts
|
|
5515
|
+
import { parseArgs as parseNodeArgs3 } from "util";
|
|
5412
5516
|
function hasFlag(name, argv) {
|
|
5413
5517
|
return argv.includes(`--${name}`);
|
|
5414
5518
|
}
|
|
@@ -5419,7 +5523,7 @@ function firstPositional(argv) {
|
|
|
5419
5523
|
return argv.find((arg) => !arg.startsWith("-"));
|
|
5420
5524
|
}
|
|
5421
5525
|
function parseCliInput(argv) {
|
|
5422
|
-
const parsed =
|
|
5526
|
+
const parsed = parseNodeArgs3({
|
|
5423
5527
|
args: argv,
|
|
5424
5528
|
allowPositionals: true,
|
|
5425
5529
|
strict: false,
|
|
@@ -5448,15 +5552,20 @@ function parseCliInput(argv) {
|
|
|
5448
5552
|
}
|
|
5449
5553
|
var init_args = __esm({
|
|
5450
5554
|
"packages/infrastructure/cli/src/utils/args.ts"() {
|
|
5555
|
+
"use strict";
|
|
5451
5556
|
}
|
|
5452
5557
|
});
|
|
5558
|
+
|
|
5559
|
+
// packages/infrastructure/cli/src/utils/paths.ts
|
|
5560
|
+
import path18 from "path";
|
|
5561
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
5453
5562
|
function runtimeDirFromImportMeta(importMetaUrl) {
|
|
5454
|
-
const filename =
|
|
5455
|
-
return
|
|
5563
|
+
const filename = fileURLToPath5(importMetaUrl);
|
|
5564
|
+
return path18.dirname(filename);
|
|
5456
5565
|
}
|
|
5457
5566
|
async function resolveMonorepoPath(runtimeDir, relativeToRepoRoot) {
|
|
5458
|
-
const fromRuntime =
|
|
5459
|
-
const fromCwd =
|
|
5567
|
+
const fromRuntime = path18.resolve(runtimeDir, "..", "..", "..", relativeToRepoRoot);
|
|
5568
|
+
const fromCwd = path18.resolve(process.cwd(), relativeToRepoRoot);
|
|
5460
5569
|
return await pathExists2(fromRuntime) ? fromRuntime : fromCwd;
|
|
5461
5570
|
}
|
|
5462
5571
|
async function firstExistingPath(paths) {
|
|
@@ -5467,6 +5576,7 @@ async function firstExistingPath(paths) {
|
|
|
5467
5576
|
}
|
|
5468
5577
|
var init_paths = __esm({
|
|
5469
5578
|
"packages/infrastructure/cli/src/utils/paths.ts"() {
|
|
5579
|
+
"use strict";
|
|
5470
5580
|
init_errors();
|
|
5471
5581
|
init_fs();
|
|
5472
5582
|
}
|
|
@@ -5551,6 +5661,7 @@ async function runCliMain(options) {
|
|
|
5551
5661
|
var isCommanderLikeError, isHelpExit, isVersionExit, normalizeCliError, findCommandByPath, resolveCommandHelp, resolveHelpPath, walkCommands;
|
|
5552
5662
|
var init_runtime = __esm({
|
|
5553
5663
|
"packages/infrastructure/cli/src/utils/runtime.ts"() {
|
|
5664
|
+
"use strict";
|
|
5554
5665
|
init_args();
|
|
5555
5666
|
init_errors();
|
|
5556
5667
|
init_output();
|
|
@@ -5608,6 +5719,8 @@ __export(createApp_exports, {
|
|
|
5608
5719
|
buildCreateProgram: () => buildCreateProgram,
|
|
5609
5720
|
main: () => main
|
|
5610
5721
|
});
|
|
5722
|
+
import path19 from "path";
|
|
5723
|
+
import { isCancel as isCancel3, select as select2, text } from "@clack/prompts";
|
|
5611
5724
|
function isTemplateName(value) {
|
|
5612
5725
|
return TEMPLATE_NAMES.includes(value);
|
|
5613
5726
|
}
|
|
@@ -5621,10 +5734,10 @@ async function resolveCreateInput(options) {
|
|
|
5621
5734
|
defaultValue: "my-app",
|
|
5622
5735
|
placeholder: "my-app"
|
|
5623
5736
|
});
|
|
5624
|
-
if (
|
|
5737
|
+
if (isCancel3(resolvedName)) {
|
|
5625
5738
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5626
5739
|
}
|
|
5627
|
-
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await
|
|
5740
|
+
const pickedTemplate = options.template ? options.template : options.yes || !interactive ? "next-app" : await select2({
|
|
5628
5741
|
message: "Template",
|
|
5629
5742
|
initialValue: "next-app",
|
|
5630
5743
|
options: TEMPLATE_NAMES.map((template) => ({
|
|
@@ -5632,7 +5745,7 @@ async function resolveCreateInput(options) {
|
|
|
5632
5745
|
label: template
|
|
5633
5746
|
}))
|
|
5634
5747
|
});
|
|
5635
|
-
if (
|
|
5748
|
+
if (isCancel3(pickedTemplate)) {
|
|
5636
5749
|
throw new CliUsageError("Create prompt dibatalkan oleh pengguna");
|
|
5637
5750
|
}
|
|
5638
5751
|
const templateValue = pickedTemplate;
|
|
@@ -5644,7 +5757,7 @@ async function resolveCreateInput(options) {
|
|
|
5644
5757
|
return { name: resolvedName, template: templateValue };
|
|
5645
5758
|
}
|
|
5646
5759
|
async function writeProjectFile(context, relativePath, content) {
|
|
5647
|
-
const filePath =
|
|
5760
|
+
const filePath = path19.join(context.projectDir, relativePath);
|
|
5648
5761
|
await writeFileSafe(filePath, content, { dryRun: context.dryRun });
|
|
5649
5762
|
context.writtenFiles.push(relativePath.replaceAll("\\", "/"));
|
|
5650
5763
|
}
|
|
@@ -5960,7 +6073,7 @@ async function createSimpleApp(context) {
|
|
|
5960
6073
|
}
|
|
5961
6074
|
async function createProject(options, output) {
|
|
5962
6075
|
const { name, template } = await resolveCreateInput(options);
|
|
5963
|
-
const projectDir =
|
|
6076
|
+
const projectDir = path19.resolve(process.cwd(), name);
|
|
5964
6077
|
if (await pathExists2(projectDir)) {
|
|
5965
6078
|
throw new CliUsageError(`Directory ${name} already exists.`);
|
|
5966
6079
|
}
|
|
@@ -6009,7 +6122,7 @@ function buildCreateProgram(context) {
|
|
|
6009
6122
|
async function main(rawArgs = process.argv.slice(2)) {
|
|
6010
6123
|
await runCliMain({
|
|
6011
6124
|
argv: [process.execPath, "create-tailwind-styled", ...rawArgs],
|
|
6012
|
-
importMetaUrl: import.meta.url
|
|
6125
|
+
importMetaUrl: typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : `file://${process.argv[1] ?? "unknown"}`,
|
|
6013
6126
|
commandHint: "create",
|
|
6014
6127
|
buildProgram: buildCreateProgram
|
|
6015
6128
|
});
|
|
@@ -6017,6 +6130,7 @@ async function main(rawArgs = process.argv.slice(2)) {
|
|
|
6017
6130
|
var TEMPLATE_NAMES, TEMPLATES;
|
|
6018
6131
|
var init_createApp = __esm({
|
|
6019
6132
|
"packages/infrastructure/cli/src/createApp.ts"() {
|
|
6133
|
+
"use strict";
|
|
6020
6134
|
init_esm();
|
|
6021
6135
|
init_errors();
|
|
6022
6136
|
init_fs();
|
|
@@ -6036,6 +6150,7 @@ var init_createApp = __esm({
|
|
|
6036
6150
|
var _loadNative, log3, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
6037
6151
|
var init_nativeBridge = __esm({
|
|
6038
6152
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
6153
|
+
"use strict";
|
|
6039
6154
|
init_src();
|
|
6040
6155
|
_loadNative = (path30) => __require(path30);
|
|
6041
6156
|
log3 = (...args) => {
|
|
@@ -6134,41 +6249,53 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
6134
6249
|
// packages/domain/compiler/src/compiler/index.ts
|
|
6135
6250
|
var init_compiler = __esm({
|
|
6136
6251
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
6252
|
+
"use strict";
|
|
6137
6253
|
}
|
|
6138
6254
|
});
|
|
6139
6255
|
|
|
6140
6256
|
// packages/domain/compiler/src/parser/index.ts
|
|
6141
6257
|
var init_parser = __esm({
|
|
6142
6258
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
6259
|
+
"use strict";
|
|
6143
6260
|
}
|
|
6144
6261
|
});
|
|
6145
6262
|
|
|
6146
6263
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
6147
6264
|
var init_analyzer = __esm({
|
|
6148
6265
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
6266
|
+
"use strict";
|
|
6149
6267
|
}
|
|
6150
6268
|
});
|
|
6151
6269
|
|
|
6152
6270
|
// packages/domain/compiler/src/cache/index.ts
|
|
6153
6271
|
var init_cache = __esm({
|
|
6154
6272
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
6273
|
+
"use strict";
|
|
6155
6274
|
}
|
|
6156
6275
|
});
|
|
6157
6276
|
|
|
6158
6277
|
// packages/domain/compiler/src/redis/index.ts
|
|
6159
6278
|
var init_redis = __esm({
|
|
6160
6279
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
6280
|
+
"use strict";
|
|
6161
6281
|
}
|
|
6162
6282
|
});
|
|
6163
6283
|
|
|
6164
6284
|
// packages/domain/compiler/src/watch/index.ts
|
|
6165
6285
|
var init_watch = __esm({
|
|
6166
6286
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
6287
|
+
"use strict";
|
|
6167
6288
|
}
|
|
6168
6289
|
});
|
|
6169
|
-
|
|
6290
|
+
|
|
6291
|
+
// packages/domain/compiler/src/index.ts
|
|
6292
|
+
import fs12 from "fs";
|
|
6293
|
+
import path24 from "path";
|
|
6294
|
+
import { createRequire as createRequire4 } from "module";
|
|
6295
|
+
var _require3, compileCssFromClasses;
|
|
6170
6296
|
var init_src4 = __esm({
|
|
6171
6297
|
"packages/domain/compiler/src/index.ts"() {
|
|
6298
|
+
"use strict";
|
|
6172
6299
|
init_nativeBridge();
|
|
6173
6300
|
init_compiler();
|
|
6174
6301
|
init_parser();
|
|
@@ -6176,7 +6303,9 @@ var init_src4 = __esm({
|
|
|
6176
6303
|
init_cache();
|
|
6177
6304
|
init_redis();
|
|
6178
6305
|
init_watch();
|
|
6179
|
-
|
|
6306
|
+
_require3 = createRequire4(
|
|
6307
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
6308
|
+
);
|
|
6180
6309
|
compileCssFromClasses = (classes, prefix) => {
|
|
6181
6310
|
const native = getNativeBridge();
|
|
6182
6311
|
if (!native?.transformSource) {
|
|
@@ -6194,6 +6323,7 @@ var init_src4 = __esm({
|
|
|
6194
6323
|
// packages/domain/compiler/src/internal.ts
|
|
6195
6324
|
var init_internal = __esm({
|
|
6196
6325
|
"packages/domain/compiler/src/internal.ts"() {
|
|
6326
|
+
"use strict";
|
|
6197
6327
|
init_src4();
|
|
6198
6328
|
init_compiler();
|
|
6199
6329
|
init_parser();
|
|
@@ -6204,9 +6334,16 @@ var init_internal = __esm({
|
|
|
6204
6334
|
}
|
|
6205
6335
|
});
|
|
6206
6336
|
|
|
6337
|
+
// packages/infrastructure/cli/src/index.ts
|
|
6338
|
+
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
6339
|
+
|
|
6207
6340
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
6208
6341
|
init_esm();
|
|
6209
6342
|
|
|
6343
|
+
// packages/infrastructure/cli/src/analyze.ts
|
|
6344
|
+
import path10 from "path";
|
|
6345
|
+
import { parseArgs as parseNodeArgs } from "util";
|
|
6346
|
+
|
|
6210
6347
|
// packages/infrastructure/cli/src/utils/analyzer.ts
|
|
6211
6348
|
init_errors();
|
|
6212
6349
|
async function loadAnalyzerModule() {
|
|
@@ -6263,7 +6400,7 @@ function printAnalysisReport(report, output) {
|
|
|
6263
6400
|
output.writeText("");
|
|
6264
6401
|
}
|
|
6265
6402
|
async function runAnalyzeCli(args) {
|
|
6266
|
-
const parsed =
|
|
6403
|
+
const parsed = parseNodeArgs({
|
|
6267
6404
|
args,
|
|
6268
6405
|
allowPositionals: true,
|
|
6269
6406
|
strict: false,
|
|
@@ -6278,7 +6415,7 @@ async function runAnalyzeCli(args) {
|
|
|
6278
6415
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6279
6416
|
});
|
|
6280
6417
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6281
|
-
const dir =
|
|
6418
|
+
const dir = path10.resolve(process.cwd(), dirArg);
|
|
6282
6419
|
if (!await pathExists2(dir)) {
|
|
6283
6420
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6284
6421
|
}
|
|
@@ -6295,6 +6432,10 @@ async function runAnalyzeCli(args) {
|
|
|
6295
6432
|
}
|
|
6296
6433
|
printAnalysisReport(report, output);
|
|
6297
6434
|
}
|
|
6435
|
+
|
|
6436
|
+
// packages/infrastructure/cli/src/extract.ts
|
|
6437
|
+
import path11 from "path";
|
|
6438
|
+
import { parseArgs as parseNodeArgs2 } from "util";
|
|
6298
6439
|
init_errors();
|
|
6299
6440
|
init_fs();
|
|
6300
6441
|
init_output();
|
|
@@ -6315,7 +6456,7 @@ function guessSuggestedTag(pattern) {
|
|
|
6315
6456
|
return "div";
|
|
6316
6457
|
}
|
|
6317
6458
|
async function runExtractCli(args) {
|
|
6318
|
-
const parsed =
|
|
6459
|
+
const parsed = parseNodeArgs2({
|
|
6319
6460
|
args,
|
|
6320
6461
|
allowPositionals: true,
|
|
6321
6462
|
strict: false,
|
|
@@ -6334,7 +6475,7 @@ async function runExtractCli(args) {
|
|
|
6334
6475
|
const parsedMin = parseInt(minRaw, 10);
|
|
6335
6476
|
const minCount = Number.isFinite(parsedMin) && parsedMin > 0 ? parsedMin : 2;
|
|
6336
6477
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
6337
|
-
const dir =
|
|
6478
|
+
const dir = path11.resolve(process.cwd(), dirArg);
|
|
6338
6479
|
if (!await pathExists2(dir)) {
|
|
6339
6480
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
6340
6481
|
}
|
|
@@ -6391,6 +6532,7 @@ async function runExtractCli(args) {
|
|
|
6391
6532
|
// packages/infrastructure/cli/src/init.ts
|
|
6392
6533
|
init_fs();
|
|
6393
6534
|
init_output();
|
|
6535
|
+
import path12 from "path";
|
|
6394
6536
|
async function ensureFile(filePath, content, report) {
|
|
6395
6537
|
const status = await ensureFileSafe(filePath, content);
|
|
6396
6538
|
if (status === "created") {
|
|
@@ -6407,15 +6549,15 @@ async function runInitCli(rawArgs) {
|
|
|
6407
6549
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6408
6550
|
});
|
|
6409
6551
|
const target = rawArgs.find((arg) => !arg.startsWith("-")) ?? ".";
|
|
6410
|
-
const root =
|
|
6552
|
+
const root = path12.resolve(process.cwd(), target);
|
|
6411
6553
|
const report = { created: [], skipped: [] };
|
|
6412
6554
|
await ensureFile(
|
|
6413
|
-
|
|
6555
|
+
path12.join(root, "src", "tailwind.css"),
|
|
6414
6556
|
'@import "tailwindcss";\n\n@theme {\n --color-primary: #3b82f6;\n --spacing-section: 3rem;\n}\n',
|
|
6415
6557
|
report
|
|
6416
6558
|
);
|
|
6417
6559
|
await ensureFile(
|
|
6418
|
-
|
|
6560
|
+
path12.join(root, "tailwind-styled.config.json"),
|
|
6419
6561
|
`${JSON.stringify(
|
|
6420
6562
|
{
|
|
6421
6563
|
version: 1,
|
|
@@ -6435,18 +6577,23 @@ async function runInitCli(rawArgs) {
|
|
|
6435
6577
|
output.writeText("\nInit complete");
|
|
6436
6578
|
output.writeText(`Created: ${report.created.length}`);
|
|
6437
6579
|
for (const filePath of report.created) {
|
|
6438
|
-
output.writeText(` + ${
|
|
6580
|
+
output.writeText(` + ${path12.relative(root, filePath)}`);
|
|
6439
6581
|
}
|
|
6440
6582
|
if (report.skipped.length > 0) {
|
|
6441
6583
|
output.writeText(`Skipped: ${report.skipped.length}`);
|
|
6442
6584
|
for (const filePath of report.skipped) {
|
|
6443
|
-
output.writeText(` - ${
|
|
6585
|
+
output.writeText(` - ${path12.relative(root, filePath)} (exists)`);
|
|
6444
6586
|
}
|
|
6445
6587
|
}
|
|
6446
6588
|
}
|
|
6447
6589
|
|
|
6590
|
+
// packages/infrastructure/cli/src/migrate.ts
|
|
6591
|
+
import fs8 from "fs/promises";
|
|
6592
|
+
import path13 from "path";
|
|
6593
|
+
|
|
6448
6594
|
// packages/infrastructure/cli/src/migrateWizard.ts
|
|
6449
6595
|
init_errors();
|
|
6596
|
+
import { confirm, intro, isCancel } from "@clack/prompts";
|
|
6450
6597
|
async function runMigrationWizard() {
|
|
6451
6598
|
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
6452
6599
|
return {
|
|
@@ -6501,15 +6648,15 @@ async function findSourceFiles(dir) {
|
|
|
6501
6648
|
const out = [];
|
|
6502
6649
|
async function walk(currentDir) {
|
|
6503
6650
|
if (!await pathExists2(currentDir)) return;
|
|
6504
|
-
const entries = await
|
|
6651
|
+
const entries = await fs8.readdir(currentDir, { withFileTypes: true });
|
|
6505
6652
|
for (const entry of entries) {
|
|
6506
|
-
const fullPath =
|
|
6653
|
+
const fullPath = path13.join(currentDir, entry.name);
|
|
6507
6654
|
if (entry.isDirectory()) {
|
|
6508
6655
|
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
6509
6656
|
await walk(fullPath);
|
|
6510
6657
|
continue;
|
|
6511
6658
|
}
|
|
6512
|
-
if (SOURCE_EXTENSIONS.has(
|
|
6659
|
+
if (SOURCE_EXTENSIONS.has(path13.extname(entry.name))) {
|
|
6513
6660
|
out.push(fullPath);
|
|
6514
6661
|
}
|
|
6515
6662
|
}
|
|
@@ -6530,7 +6677,7 @@ function migrateSource(source, options) {
|
|
|
6530
6677
|
return { output, classRenames: 0, importRenames };
|
|
6531
6678
|
}
|
|
6532
6679
|
async function migrateConfig(root, dryRun) {
|
|
6533
|
-
const cssPath =
|
|
6680
|
+
const cssPath = path13.join(root, "src", "tailwind.css");
|
|
6534
6681
|
if (await pathExists2(cssPath)) return 0;
|
|
6535
6682
|
await writeFileSafe(cssPath, DEFAULT_TAILWIND_CSS, { dryRun });
|
|
6536
6683
|
return 1;
|
|
@@ -6543,7 +6690,7 @@ async function runMigrateCli(rawArgs) {
|
|
|
6543
6690
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6544
6691
|
});
|
|
6545
6692
|
const target = firstPositional(rawArgs) ?? ".";
|
|
6546
|
-
const root =
|
|
6693
|
+
const root = path13.resolve(process.cwd(), target);
|
|
6547
6694
|
const dryRunFlag = hasFlag("dry-run", rawArgs);
|
|
6548
6695
|
const wizardOptions = hasFlag("wizard", rawArgs) ? await runMigrationWizard() : null;
|
|
6549
6696
|
const { dryRun, includeConfig, includeClasses, includeImports } = wizardOptions ? {
|
|
@@ -6567,12 +6714,12 @@ async function runMigrateCli(rawArgs) {
|
|
|
6567
6714
|
report.configWrites += await migrateConfig(root, dryRun);
|
|
6568
6715
|
}
|
|
6569
6716
|
for (const filePath of files) {
|
|
6570
|
-
const source = await
|
|
6717
|
+
const source = await fs8.readFile(filePath, "utf8");
|
|
6571
6718
|
const migrated = migrateSource(source, { includeImports, includeClasses });
|
|
6572
6719
|
if (migrated.output !== source) {
|
|
6573
6720
|
report.updatedFiles++;
|
|
6574
6721
|
if (!dryRun) {
|
|
6575
|
-
await
|
|
6722
|
+
await fs8.writeFile(filePath, migrated.output, "utf8");
|
|
6576
6723
|
}
|
|
6577
6724
|
}
|
|
6578
6725
|
report.classRenames += migrated.classRenames;
|
|
@@ -6594,6 +6741,8 @@ async function runMigrateCli(rawArgs) {
|
|
|
6594
6741
|
// packages/infrastructure/cli/src/scan.ts
|
|
6595
6742
|
init_src2();
|
|
6596
6743
|
init_output();
|
|
6744
|
+
import fs9 from "fs";
|
|
6745
|
+
import path14 from "path";
|
|
6597
6746
|
function buildTopClasses(files) {
|
|
6598
6747
|
const counts = /* @__PURE__ */ new Map();
|
|
6599
6748
|
for (const file of files) {
|
|
@@ -6636,10 +6785,10 @@ function buildClassNames(files, uniqueClasses) {
|
|
|
6636
6785
|
});
|
|
6637
6786
|
}
|
|
6638
6787
|
function writeScanCache(root, cacheData) {
|
|
6639
|
-
const cacheDir =
|
|
6640
|
-
const cachePath =
|
|
6641
|
-
|
|
6642
|
-
|
|
6788
|
+
const cacheDir = path14.join(root, ".tailwind-styled");
|
|
6789
|
+
const cachePath = path14.join(cacheDir, "scan-cache.json");
|
|
6790
|
+
fs9.mkdirSync(cacheDir, { recursive: true });
|
|
6791
|
+
fs9.writeFileSync(cachePath, JSON.stringify(cacheData, null, 2), "utf-8");
|
|
6643
6792
|
return cachePath;
|
|
6644
6793
|
}
|
|
6645
6794
|
async function runScanCli(rawArgs) {
|
|
@@ -6651,7 +6800,7 @@ async function runScanCli(rawArgs) {
|
|
|
6651
6800
|
debug: process.env.TWS_DEBUG === "1" || process.env.DEBUG === "1",
|
|
6652
6801
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
6653
6802
|
});
|
|
6654
|
-
const root =
|
|
6803
|
+
const root = path14.resolve(process.cwd(), target);
|
|
6655
6804
|
const spinner = output.spinner();
|
|
6656
6805
|
spinner.start(`Scanning ${root}`);
|
|
6657
6806
|
const scanned = await scanWorkspaceAsync(root);
|
|
@@ -6701,7 +6850,8 @@ Scan root : ${result.root}`);
|
|
|
6701
6850
|
}
|
|
6702
6851
|
|
|
6703
6852
|
// packages/infrastructure/cli/src/setup.ts
|
|
6704
|
-
var import_picocolors3 = __toESM(require_picocolors());
|
|
6853
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
6854
|
+
import path16 from "path";
|
|
6705
6855
|
|
|
6706
6856
|
// packages/infrastructure/cli/src/commands/setup/patchers.ts
|
|
6707
6857
|
function patchNextConfigImpl(src) {
|
|
@@ -6897,6 +7047,7 @@ function patchTsConfigImpl(src) {
|
|
|
6897
7047
|
|
|
6898
7048
|
// packages/infrastructure/cli/src/commands/setup/prompt.ts
|
|
6899
7049
|
init_errors();
|
|
7050
|
+
import { isCancel as isCancel2, select } from "@clack/prompts";
|
|
6900
7051
|
async function pickProjectTypeInteractive(detected, flags, projectOptions, options = {}) {
|
|
6901
7052
|
const log5 = options.log ?? console.log;
|
|
6902
7053
|
if (flags.explicitProjectType) {
|
|
@@ -6935,7 +7086,7 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6935
7086
|
hint: detected === option.value ? "terdeteksi" : void 0
|
|
6936
7087
|
}))
|
|
6937
7088
|
});
|
|
6938
|
-
if (
|
|
7089
|
+
if (isCancel2(selected)) {
|
|
6939
7090
|
throw new CliUsageError("Prompt dibatalkan oleh pengguna");
|
|
6940
7091
|
}
|
|
6941
7092
|
const selectedLabel = projectOptions.find((option) => option.value === selected)?.label ?? selected;
|
|
@@ -6947,10 +7098,12 @@ async function pickProjectTypeInteractive(detected, flags, projectOptions, optio
|
|
|
6947
7098
|
|
|
6948
7099
|
// packages/infrastructure/cli/src/commands/setup/workspace.ts
|
|
6949
7100
|
init_fs();
|
|
7101
|
+
import path15 from "path";
|
|
6950
7102
|
|
|
6951
7103
|
// packages/infrastructure/cli/src/utils/process.ts
|
|
6952
7104
|
init_errors();
|
|
6953
7105
|
init_json();
|
|
7106
|
+
import { spawn } from "child_process";
|
|
6954
7107
|
var npmCommandName = () => {
|
|
6955
7108
|
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
6956
7109
|
};
|
|
@@ -7114,12 +7267,12 @@ function configureSetupFlags(rawArgs) {
|
|
|
7114
7267
|
};
|
|
7115
7268
|
}
|
|
7116
7269
|
async function readPackageJson(cwd2) {
|
|
7117
|
-
return readJsonSafe(
|
|
7270
|
+
return readJsonSafe(path15.join(cwd2, "package.json"));
|
|
7118
7271
|
}
|
|
7119
7272
|
async function detectPm(cwd2) {
|
|
7120
|
-
if (await pathExists2(
|
|
7121
|
-
if (await pathExists2(
|
|
7122
|
-
if (await pathExists2(
|
|
7273
|
+
if (await pathExists2(path15.join(cwd2, "bun.lockb"))) return "bun";
|
|
7274
|
+
if (await pathExists2(path15.join(cwd2, "pnpm-lock.yaml"))) return "pnpm";
|
|
7275
|
+
if (await pathExists2(path15.join(cwd2, "yarn.lock"))) return "yarn";
|
|
7123
7276
|
return "npm";
|
|
7124
7277
|
}
|
|
7125
7278
|
async function detectBundler(cwd2) {
|
|
@@ -7140,7 +7293,7 @@ async function alreadyInstalled(cwd2, pkgName) {
|
|
|
7140
7293
|
}
|
|
7141
7294
|
async function findExisting(cwd2, names) {
|
|
7142
7295
|
for (const name of names) {
|
|
7143
|
-
const resolved =
|
|
7296
|
+
const resolved = path15.join(cwd2, name);
|
|
7144
7297
|
if (await pathExists2(resolved)) return resolved;
|
|
7145
7298
|
}
|
|
7146
7299
|
return null;
|
|
@@ -7151,7 +7304,7 @@ async function writeFileWithDryRun(cwd2, filePath, content, label, flags, logger
|
|
|
7151
7304
|
return;
|
|
7152
7305
|
}
|
|
7153
7306
|
await writeFileSafe(filePath, content);
|
|
7154
|
-
logger.ok(
|
|
7307
|
+
logger.ok(path15.relative(cwd2, filePath) || label);
|
|
7155
7308
|
}
|
|
7156
7309
|
async function patchFileWithDryRun(filePath, patcher, label, flags, logger) {
|
|
7157
7310
|
const source = await readFileSafe(filePath);
|
|
@@ -7178,7 +7331,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7178
7331
|
logger.dry(`${pm} install ${pkgs.join(" ")}`);
|
|
7179
7332
|
return;
|
|
7180
7333
|
}
|
|
7181
|
-
const flag = "--save";
|
|
7334
|
+
const flag = dev ? pm === "yarn" || pm === "bun" ? "-D" : "--save-dev" : "--save";
|
|
7182
7335
|
const cmd = pm === "yarn" ? ["add", flag, ...pkgs] : pm === "bun" ? ["add", flag, ...pkgs] : ["install", flag, ...pkgs];
|
|
7183
7336
|
logger.info(`$ ${pm} ${cmd.join(" ")}`);
|
|
7184
7337
|
try {
|
|
@@ -7196,7 +7349,7 @@ async function installPackages(cwd2, pm, pkgs, dev, flags, logger) {
|
|
|
7196
7349
|
}
|
|
7197
7350
|
|
|
7198
7351
|
// packages/infrastructure/cli/src/utils/logger.ts
|
|
7199
|
-
var import_picocolors2 = __toESM(require_picocolors());
|
|
7352
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
7200
7353
|
function createCliLogger(options = {}) {
|
|
7201
7354
|
function emit(level, icon, colorize, message) {
|
|
7202
7355
|
options.onEvent?.({ level, message });
|
|
@@ -7314,7 +7467,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7314
7467
|
if (bundlerConfig) {
|
|
7315
7468
|
const cfg = await findExisting(cwd, bundlerConfig.files);
|
|
7316
7469
|
if (cfg)
|
|
7317
|
-
await patchFileWithDryRun(cfg, bundlerConfig.patcher,
|
|
7470
|
+
await patchFileWithDryRun(cfg, bundlerConfig.patcher, path16.basename(cfg), setupFlags, logger);
|
|
7318
7471
|
else logger.warn(bundlerConfig.warnMsg);
|
|
7319
7472
|
} else {
|
|
7320
7473
|
logger.skip("React tanpa bundler - tidak ada bundler config yang di-patch");
|
|
@@ -7333,13 +7486,13 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7333
7486
|
if (cssFile) {
|
|
7334
7487
|
await patchFileWithDryRun(
|
|
7335
7488
|
cssFile,
|
|
7336
|
-
(src) => patchTailwindCss(src, bundler,
|
|
7337
|
-
|
|
7489
|
+
(src) => patchTailwindCss(src, bundler, path16.relative(cwd, cssFile), cwd),
|
|
7490
|
+
path16.relative(cwd, cssFile),
|
|
7338
7491
|
setupFlags,
|
|
7339
7492
|
logger
|
|
7340
7493
|
);
|
|
7341
|
-
const detectedCssEntry =
|
|
7342
|
-
const twConfigPath =
|
|
7494
|
+
const detectedCssEntry = path16.relative(cwd, cssFile).replace(/\\/g, "/");
|
|
7495
|
+
const twConfigPath = path16.join(cwd, "tailwind-styled.config.json");
|
|
7343
7496
|
const twConfig = {
|
|
7344
7497
|
version: 1,
|
|
7345
7498
|
compiler: { engine: "rust" },
|
|
@@ -7357,7 +7510,7 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7357
7510
|
logger.warn('CSS entry tidak ditemukan \u2014 tambahkan @import "tailwindcss" manual ke globals.css');
|
|
7358
7511
|
}
|
|
7359
7512
|
output.writeText("\n" + import_picocolors3.default.bold(" [4/4]") + import_picocolors3.default.cyan(" tsconfig.json"));
|
|
7360
|
-
const tsCfg =
|
|
7513
|
+
const tsCfg = path16.join(cwd, "tsconfig.json");
|
|
7361
7514
|
const hasTsConfig = await findExisting(cwd, ["tsconfig.json"]);
|
|
7362
7515
|
if (hasTsConfig) {
|
|
7363
7516
|
await patchFileWithDryRun(tsCfg, patchTsConfig, "tsconfig.json", setupFlags, logger);
|
|
@@ -7402,6 +7555,10 @@ var runSetupCli = async (rawArgs) => {
|
|
|
7402
7555
|
output.jsonSuccess("setup", report);
|
|
7403
7556
|
}
|
|
7404
7557
|
};
|
|
7558
|
+
|
|
7559
|
+
// packages/infrastructure/cli/src/stats.ts
|
|
7560
|
+
import path17 from "path";
|
|
7561
|
+
import { parseArgs as parseNodeArgs4 } from "util";
|
|
7405
7562
|
init_errors();
|
|
7406
7563
|
init_fs();
|
|
7407
7564
|
init_output();
|
|
@@ -7423,7 +7580,7 @@ function estimateClassBytes(className) {
|
|
|
7423
7580
|
return base + 15;
|
|
7424
7581
|
}
|
|
7425
7582
|
async function runStatsCli(args) {
|
|
7426
|
-
const parsed =
|
|
7583
|
+
const parsed = parseNodeArgs4({
|
|
7427
7584
|
args,
|
|
7428
7585
|
allowPositionals: true,
|
|
7429
7586
|
strict: false,
|
|
@@ -7438,7 +7595,7 @@ async function runStatsCli(args) {
|
|
|
7438
7595
|
verbose: process.env.TWS_VERBOSE === "1" || process.env.VERBOSE === "1"
|
|
7439
7596
|
});
|
|
7440
7597
|
const dirArg = parsed.positionals[0] ?? ".";
|
|
7441
|
-
const dir =
|
|
7598
|
+
const dir = path17.resolve(process.cwd(), dirArg);
|
|
7442
7599
|
if (!await pathExists2(dir)) {
|
|
7443
7600
|
throw new CliUsageError(`Directory not found: ${dir}`);
|
|
7444
7601
|
}
|
|
@@ -7490,11 +7647,16 @@ async function runStatsCli(args) {
|
|
|
7490
7647
|
|
|
7491
7648
|
// packages/infrastructure/cli/src/commands/program.ts
|
|
7492
7649
|
init_runtime();
|
|
7650
|
+
|
|
7651
|
+
// packages/infrastructure/cli/src/commands/boundary.ts
|
|
7652
|
+
import { readFileSync, readdirSync } from "fs";
|
|
7653
|
+
import { join as join2, extname } from "path";
|
|
7654
|
+
import { parseArgs as parseNodeArgs5 } from "util";
|
|
7493
7655
|
function collectTsFiles(dir, extensions) {
|
|
7494
7656
|
const files = [];
|
|
7495
7657
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
7496
7658
|
for (const entry of entries) {
|
|
7497
|
-
const full =
|
|
7659
|
+
const full = join2(dir, entry.name);
|
|
7498
7660
|
if (entry.isDirectory()) {
|
|
7499
7661
|
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".next") continue;
|
|
7500
7662
|
files.push(...collectTsFiles(full, extensions));
|
|
@@ -7557,7 +7719,7 @@ function printBoundaryReport(report, output) {
|
|
|
7557
7719
|
}
|
|
7558
7720
|
}
|
|
7559
7721
|
async function runBoundaryCli(args, context) {
|
|
7560
|
-
const parsed =
|
|
7722
|
+
const parsed = parseNodeArgs5({
|
|
7561
7723
|
args,
|
|
7562
7724
|
allowPositionals: true,
|
|
7563
7725
|
strict: false,
|
|
@@ -7625,10 +7787,13 @@ var createCommand2 = {
|
|
|
7625
7787
|
// packages/infrastructure/cli/src/commands/dashboard.ts
|
|
7626
7788
|
init_errors();
|
|
7627
7789
|
init_fs();
|
|
7790
|
+
import { parseArgs as parseNodeArgs6 } from "util";
|
|
7628
7791
|
|
|
7629
7792
|
// packages/infrastructure/cli/src/commands/helpers.ts
|
|
7630
7793
|
init_errors();
|
|
7631
7794
|
init_paths();
|
|
7795
|
+
import fs10 from "fs/promises";
|
|
7796
|
+
import path20 from "path";
|
|
7632
7797
|
function enumerateVariantProps(matrix) {
|
|
7633
7798
|
const keys = Object.keys(matrix);
|
|
7634
7799
|
if (keys.length === 0) return [{}];
|
|
@@ -7650,7 +7815,7 @@ function enumerateVariantProps(matrix) {
|
|
|
7650
7815
|
}
|
|
7651
7816
|
async function resolveScript(context, relativeToRepoRoot) {
|
|
7652
7817
|
const fromRuntime = await resolveMonorepoPath(context.runtimeDir, relativeToRepoRoot);
|
|
7653
|
-
const fromCwd =
|
|
7818
|
+
const fromCwd = path20.resolve(process.cwd(), relativeToRepoRoot);
|
|
7654
7819
|
const resolved = await firstExistingPath([fromRuntime, fromCwd]);
|
|
7655
7820
|
if (!resolved) {
|
|
7656
7821
|
throw new CliUsageError(`Required script not found: ${relativeToRepoRoot}`);
|
|
@@ -7664,13 +7829,13 @@ async function loadRegistry(context) {
|
|
|
7664
7829
|
);
|
|
7665
7830
|
const candidates = [
|
|
7666
7831
|
runtimeRegistryPath,
|
|
7667
|
-
|
|
7832
|
+
path20.resolve(process.cwd(), "packages/domain/plugin-registry/registry.json")
|
|
7668
7833
|
];
|
|
7669
7834
|
const registryPath = await firstExistingPath(candidates);
|
|
7670
7835
|
if (!registryPath) {
|
|
7671
7836
|
throw new CliUsageError("Plugin registry file not found.");
|
|
7672
7837
|
}
|
|
7673
|
-
const raw = await
|
|
7838
|
+
const raw = await fs10.readFile(registryPath, "utf8");
|
|
7674
7839
|
const data = JSON.parse(raw);
|
|
7675
7840
|
return [
|
|
7676
7841
|
...data.official.map((item) => ({ ...item, official: true })),
|
|
@@ -7690,7 +7855,7 @@ var dashboardCommand = {
|
|
|
7690
7855
|
"[tw dashboard] --json is not supported for long-running dashboard output"
|
|
7691
7856
|
);
|
|
7692
7857
|
}
|
|
7693
|
-
const parsed =
|
|
7858
|
+
const parsed = parseNodeArgs6({
|
|
7694
7859
|
args,
|
|
7695
7860
|
allowPositionals: true,
|
|
7696
7861
|
strict: false,
|
|
@@ -7717,9 +7882,12 @@ var dashboardCommand = {
|
|
|
7717
7882
|
init_errors();
|
|
7718
7883
|
init_fs();
|
|
7719
7884
|
init_json();
|
|
7885
|
+
import fsp from "fs/promises";
|
|
7886
|
+
import path21 from "path";
|
|
7887
|
+
import { parseArgs as parseNodeArgs7 } from "util";
|
|
7720
7888
|
var postJson = async (url, body, token) => {
|
|
7721
|
-
const { default: https } = await import(
|
|
7722
|
-
const { default: http } = await import(
|
|
7889
|
+
const { default: https } = await import("https");
|
|
7890
|
+
const { default: http } = await import("http");
|
|
7723
7891
|
return new Promise((resolve2, reject) => {
|
|
7724
7892
|
const client = url.protocol === "https:" ? https : http;
|
|
7725
7893
|
const req = client.request(
|
|
@@ -7753,7 +7921,7 @@ var postJson = async (url, body, token) => {
|
|
|
7753
7921
|
var deployCommand = {
|
|
7754
7922
|
name: "deploy",
|
|
7755
7923
|
async run(args, context) {
|
|
7756
|
-
const parsed =
|
|
7924
|
+
const parsed = parseNodeArgs7({
|
|
7757
7925
|
args,
|
|
7758
7926
|
allowPositionals: true,
|
|
7759
7927
|
strict: false,
|
|
@@ -7769,7 +7937,7 @@ var deployCommand = {
|
|
|
7769
7937
|
const version = typeof parsed.values.version === "string" ? parsed.values.version : "0.1.0";
|
|
7770
7938
|
const tag = typeof parsed.values.tag === "string" ? parsed.values.tag : "latest";
|
|
7771
7939
|
const registryUrl = typeof parsed.values.registry === "string" ? parsed.values.registry : process.env.TW_REGISTRY_URL ?? null;
|
|
7772
|
-
const pkgPath =
|
|
7940
|
+
const pkgPath = path21.join(process.cwd(), "package.json");
|
|
7773
7941
|
if (!await pathExists2(pkgPath)) {
|
|
7774
7942
|
throw new CliUsageError("[tw deploy] No package.json found in current directory");
|
|
7775
7943
|
}
|
|
@@ -7804,10 +7972,10 @@ var deployCommand = {
|
|
|
7804
7972
|
}
|
|
7805
7973
|
return;
|
|
7806
7974
|
}
|
|
7807
|
-
const cacheDir =
|
|
7808
|
-
await
|
|
7809
|
-
await
|
|
7810
|
-
|
|
7975
|
+
const cacheDir = path21.join(process.cwd(), ".tw-cache");
|
|
7976
|
+
await fsp.mkdir(cacheDir, { recursive: true });
|
|
7977
|
+
await fsp.writeFile(
|
|
7978
|
+
path21.join(cacheDir, "deploy-manifest.json"),
|
|
7811
7979
|
JSON.stringify(manifest, null, 2)
|
|
7812
7980
|
);
|
|
7813
7981
|
if (!registryUrl) {
|
|
@@ -7870,11 +8038,14 @@ var deployCommand = {
|
|
|
7870
8038
|
};
|
|
7871
8039
|
|
|
7872
8040
|
// packages/infrastructure/cli/src/commands/doctor.ts
|
|
7873
|
-
var import_picocolors4 = __toESM(require_picocolors());
|
|
8041
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
8042
|
+
import { parseArgs as parseNodeArgs8 } from "util";
|
|
7874
8043
|
|
|
7875
8044
|
// packages/infrastructure/cli/src/utils/doctorService.ts
|
|
7876
8045
|
init_src3();
|
|
7877
8046
|
init_src2();
|
|
8047
|
+
import fs11 from "fs";
|
|
8048
|
+
import path22 from "path";
|
|
7878
8049
|
var SUPPORTED_DIAGNOSTIC_INCLUDES = [
|
|
7879
8050
|
"workspace",
|
|
7880
8051
|
"tailwind",
|
|
@@ -7907,9 +8078,9 @@ function addIssue(issues, severity, type, message, suggestion, location) {
|
|
|
7907
8078
|
issues.push({ severity, type, message, suggestion, location });
|
|
7908
8079
|
}
|
|
7909
8080
|
function readJsonFile(filePath) {
|
|
7910
|
-
if (!
|
|
8081
|
+
if (!fs11.existsSync(filePath)) return null;
|
|
7911
8082
|
try {
|
|
7912
|
-
return JSON.parse(
|
|
8083
|
+
return JSON.parse(fs11.readFileSync(filePath, "utf8"));
|
|
7913
8084
|
} catch (parseErr) {
|
|
7914
8085
|
if (process.env.TWS_DEBUG === "1") {
|
|
7915
8086
|
const msg = parseErr instanceof Error ? parseErr.message : String(parseErr);
|
|
@@ -7920,16 +8091,16 @@ function readJsonFile(filePath) {
|
|
|
7920
8091
|
}
|
|
7921
8092
|
}
|
|
7922
8093
|
function findWorkspacePackageJsonFiles(root) {
|
|
7923
|
-
const packagesDir =
|
|
7924
|
-
if (!
|
|
7925
|
-
return
|
|
8094
|
+
const packagesDir = path22.join(root, "packages");
|
|
8095
|
+
if (!fs11.existsSync(packagesDir)) return [];
|
|
8096
|
+
return fs11.readdirSync(packagesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => path22.join(packagesDir, entry.name, "package.json")).filter((filePath) => fs11.existsSync(filePath));
|
|
7926
8097
|
}
|
|
7927
8098
|
function findFiles(dir, ext) {
|
|
7928
8099
|
const files = [];
|
|
7929
8100
|
try {
|
|
7930
|
-
const entries =
|
|
8101
|
+
const entries = fs11.readdirSync(dir, { withFileTypes: true });
|
|
7931
8102
|
for (const entry of entries) {
|
|
7932
|
-
const fullPath =
|
|
8103
|
+
const fullPath = path22.join(dir, entry.name);
|
|
7933
8104
|
if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
|
|
7934
8105
|
files.push(...findFiles(fullPath, ext));
|
|
7935
8106
|
} else if (entry.isFile() && entry.name.endsWith(ext)) {
|
|
@@ -7947,7 +8118,7 @@ function findFiles(dir, ext) {
|
|
|
7947
8118
|
return files;
|
|
7948
8119
|
}
|
|
7949
8120
|
function runWorkspaceDiagnostics(root, issues, checks) {
|
|
7950
|
-
const rootPackageJsonPath =
|
|
8121
|
+
const rootPackageJsonPath = path22.join(root, "package.json");
|
|
7951
8122
|
const rootPackageJson = readJsonFile(rootPackageJsonPath);
|
|
7952
8123
|
if (!rootPackageJson) {
|
|
7953
8124
|
addCheck(
|
|
@@ -8000,7 +8171,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8000
8171
|
const scripts = typeof manifest.scripts === "object" && manifest.scripts !== null ? manifest.scripts : {};
|
|
8001
8172
|
const missing = requiredScripts.filter((name) => typeof scripts[name] !== "string");
|
|
8002
8173
|
if (missing.length === 0) return [];
|
|
8003
|
-
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name :
|
|
8174
|
+
const packageName = typeof manifest.name === "string" && manifest.name.length > 0 ? manifest.name : path22.basename(path22.dirname(filePath));
|
|
8004
8175
|
return [{ packageName, missing }];
|
|
8005
8176
|
});
|
|
8006
8177
|
if (missingScripts.length === 0) {
|
|
@@ -8035,7 +8206,7 @@ function runWorkspaceDiagnostics(root, issues, checks) {
|
|
|
8035
8206
|
);
|
|
8036
8207
|
}
|
|
8037
8208
|
function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
8038
|
-
const packageJsonPath =
|
|
8209
|
+
const packageJsonPath = path22.join(root, "package.json");
|
|
8039
8210
|
const packageJson = readJsonFile(packageJsonPath);
|
|
8040
8211
|
if (!packageJson) {
|
|
8041
8212
|
addCheck(
|
|
@@ -8094,7 +8265,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8094
8265
|
const cssFiles = findFiles(root, ".css");
|
|
8095
8266
|
const hasTailwindImport = cssFiles.slice(0, 10).some((filePath) => {
|
|
8096
8267
|
try {
|
|
8097
|
-
const content =
|
|
8268
|
+
const content = fs11.readFileSync(filePath, "utf8");
|
|
8098
8269
|
return content.includes("@tailwind") || content.includes('@import "tailwindcss"');
|
|
8099
8270
|
} catch {
|
|
8100
8271
|
return false;
|
|
@@ -8118,7 +8289,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8118
8289
|
);
|
|
8119
8290
|
}
|
|
8120
8291
|
const configFiles = ["tailwind.config.js", "tailwind.config.ts", "tailwind.config.mjs"];
|
|
8121
|
-
const hasConfig = configFiles.some((name) =>
|
|
8292
|
+
const hasConfig = configFiles.some((name) => fs11.existsSync(path22.join(root, name)));
|
|
8122
8293
|
addCheck(
|
|
8123
8294
|
checks,
|
|
8124
8295
|
"tailwind",
|
|
@@ -8127,7 +8298,7 @@ function runTailwindProjectDiagnostics(root, issues, checks) {
|
|
|
8127
8298
|
"info",
|
|
8128
8299
|
hasConfig ? "Tailwind config file detected." : "No tailwind.config file found."
|
|
8129
8300
|
);
|
|
8130
|
-
const tsconfig = readJsonFile(
|
|
8301
|
+
const tsconfig = readJsonFile(path22.join(root, "tsconfig.json"));
|
|
8131
8302
|
const jsx = tsconfig?.compilerOptions?.jsx;
|
|
8132
8303
|
addCheck(
|
|
8133
8304
|
checks,
|
|
@@ -8293,7 +8464,7 @@ async function runAnalysisDiagnostics(root, issues, checks, verbose) {
|
|
|
8293
8464
|
}
|
|
8294
8465
|
}
|
|
8295
8466
|
var runDiagnostics = async (options = {}) => {
|
|
8296
|
-
const root =
|
|
8467
|
+
const root = path22.resolve(options.root ?? process.cwd());
|
|
8297
8468
|
const includes = parseIncludes(options.include);
|
|
8298
8469
|
const issues = [];
|
|
8299
8470
|
const checks = [];
|
|
@@ -8339,7 +8510,7 @@ function parseIncludeOption(value) {
|
|
|
8339
8510
|
return includes;
|
|
8340
8511
|
}
|
|
8341
8512
|
async function runDoctorCli(args, context) {
|
|
8342
|
-
const parsed =
|
|
8513
|
+
const parsed = parseNodeArgs8({
|
|
8343
8514
|
args,
|
|
8344
8515
|
allowPositionals: true,
|
|
8345
8516
|
strict: false,
|
|
@@ -8415,10 +8586,12 @@ function printDoctorOutput(result, output) {
|
|
|
8415
8586
|
init_errors();
|
|
8416
8587
|
init_fs();
|
|
8417
8588
|
init_json();
|
|
8589
|
+
import path23 from "path";
|
|
8590
|
+
import { parseArgs as parseNodeArgs9 } from "util";
|
|
8418
8591
|
var testCommand = {
|
|
8419
8592
|
name: "test",
|
|
8420
8593
|
async run(args) {
|
|
8421
|
-
const parsed =
|
|
8594
|
+
const parsed = parseNodeArgs9({
|
|
8422
8595
|
args,
|
|
8423
8596
|
allowPositionals: true,
|
|
8424
8597
|
strict: false,
|
|
@@ -8443,7 +8616,7 @@ var shareCommand = {
|
|
|
8443
8616
|
name: "share",
|
|
8444
8617
|
async run(args, context) {
|
|
8445
8618
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8446
|
-
const manifestPath =
|
|
8619
|
+
const manifestPath = path23.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8447
8620
|
const defaultManifest = {
|
|
8448
8621
|
name,
|
|
8449
8622
|
version: "0.1.0"
|
|
@@ -8480,7 +8653,7 @@ var codeCommand = {
|
|
|
8480
8653
|
async run(args, context) {
|
|
8481
8654
|
const docsUrl = "https://marketplace.visualstudio.com/search?term=tailwind-styled&target=VSCode";
|
|
8482
8655
|
const extension = "tailwind-styled.tailwind-styled-v4";
|
|
8483
|
-
const parsed =
|
|
8656
|
+
const parsed = parseNodeArgs9({
|
|
8484
8657
|
args,
|
|
8485
8658
|
allowPositionals: true,
|
|
8486
8659
|
strict: false,
|
|
@@ -8529,14 +8702,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8529
8702
|
};
|
|
8530
8703
|
var resolveCurrentCliVersion = async (context) => {
|
|
8531
8704
|
const candidates = [
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8705
|
+
path23.resolve(context.runtimeDir, "..", "package.json"),
|
|
8706
|
+
path23.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
8707
|
+
path23.resolve(process.cwd(), "package.json")
|
|
8535
8708
|
];
|
|
8536
8709
|
for (const candidate of candidates) {
|
|
8537
8710
|
if (!await pathExists2(candidate)) continue;
|
|
8538
8711
|
const pkg = await readJsonSafe(candidate);
|
|
8539
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
8712
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${path23.sep}packages${path23.sep}cli${path23.sep}`));
|
|
8540
8713
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8541
8714
|
}
|
|
8542
8715
|
return "0.0.0";
|
|
@@ -8586,7 +8759,7 @@ var versionCommand = {
|
|
|
8586
8759
|
name: "version",
|
|
8587
8760
|
aliases: ["v"],
|
|
8588
8761
|
async run(args, context) {
|
|
8589
|
-
const parsed =
|
|
8762
|
+
const parsed = parseNodeArgs9({
|
|
8590
8763
|
args,
|
|
8591
8764
|
allowPositionals: true,
|
|
8592
8765
|
strict: false,
|
|
@@ -8620,7 +8793,7 @@ var upgradeCommand = {
|
|
|
8620
8793
|
name: "upgrade",
|
|
8621
8794
|
aliases: ["update"],
|
|
8622
8795
|
async run(args, context) {
|
|
8623
|
-
const parsed =
|
|
8796
|
+
const parsed = parseNodeArgs9({
|
|
8624
8797
|
args,
|
|
8625
8798
|
allowPositionals: true,
|
|
8626
8799
|
strict: false,
|
|
@@ -8779,6 +8952,8 @@ init_errors();
|
|
|
8779
8952
|
init_fs();
|
|
8780
8953
|
init_json();
|
|
8781
8954
|
init_src4();
|
|
8955
|
+
import path25 from "path";
|
|
8956
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
8782
8957
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
8783
8958
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
8784
8959
|
{
|
|
@@ -8804,8 +8979,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
8804
8979
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8805
8980
|
let configPath = null;
|
|
8806
8981
|
for (const file of twConfigFiles) {
|
|
8807
|
-
if (await pathExists2(
|
|
8808
|
-
configPath =
|
|
8982
|
+
if (await pathExists2(path25.join(cwd2, file))) {
|
|
8983
|
+
configPath = path25.join(cwd2, file);
|
|
8809
8984
|
break;
|
|
8810
8985
|
}
|
|
8811
8986
|
}
|
|
@@ -8814,7 +8989,7 @@ async function validateThemeConfig(cwd2) {
|
|
|
8814
8989
|
return results;
|
|
8815
8990
|
}
|
|
8816
8991
|
try {
|
|
8817
|
-
const configUrl =
|
|
8992
|
+
const configUrl = pathToFileURL2(configPath);
|
|
8818
8993
|
const configModule = await import(configUrl.href);
|
|
8819
8994
|
const config = configModule.default || configModule;
|
|
8820
8995
|
const theme = config.theme || {};
|
|
@@ -8896,7 +9071,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
8896
9071
|
async function hasTailwindCssImport(cwd2) {
|
|
8897
9072
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
8898
9073
|
for (const file of cssFiles) {
|
|
8899
|
-
const raw = await readFileSafe(
|
|
9074
|
+
const raw = await readFileSafe(path25.join(cwd2, file));
|
|
8900
9075
|
if (raw?.includes("tailwindcss")) return true;
|
|
8901
9076
|
}
|
|
8902
9077
|
return false;
|
|
@@ -8912,7 +9087,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
8912
9087
|
"app/globals.css"
|
|
8913
9088
|
];
|
|
8914
9089
|
for (const file of cssFiles) {
|
|
8915
|
-
const raw = await readFileSafe(
|
|
9090
|
+
const raw = await readFileSafe(path25.join(cwd2, file));
|
|
8916
9091
|
if (raw === null) continue;
|
|
8917
9092
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
8918
9093
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -8920,8 +9095,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
8920
9095
|
return { found: false, cssFile: null };
|
|
8921
9096
|
}
|
|
8922
9097
|
async function applyTailwindInit(cwd2) {
|
|
8923
|
-
await ensureFileSafe(
|
|
8924
|
-
await ensureFileSafe(
|
|
9098
|
+
await ensureFileSafe(path25.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9099
|
+
await ensureFileSafe(path25.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
8925
9100
|
}
|
|
8926
9101
|
function check(results, id, label, pass, message, fix) {
|
|
8927
9102
|
results.push({ id, label, pass, message, fix });
|
|
@@ -8943,7 +9118,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8943
9118
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
8944
9119
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
8945
9120
|
);
|
|
8946
|
-
const pkg = await readJsonSafe(
|
|
9121
|
+
const pkg = await readJsonSafe(path25.join(cwd2, "package.json"));
|
|
8947
9122
|
check(
|
|
8948
9123
|
results,
|
|
8949
9124
|
"package-json",
|
|
@@ -8977,7 +9152,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8977
9152
|
}
|
|
8978
9153
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
8979
9154
|
const twConfigChecks = await Promise.all(
|
|
8980
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9155
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(path25.join(cwd2, file)) }))
|
|
8981
9156
|
);
|
|
8982
9157
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
8983
9158
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -8989,7 +9164,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
8989
9164
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
8990
9165
|
"tw init"
|
|
8991
9166
|
);
|
|
8992
|
-
const oldConfig = await readJsonSafe(
|
|
9167
|
+
const oldConfig = await readJsonSafe(path25.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(path25.join(cwd2, "tailwind.config.ts"));
|
|
8993
9168
|
if (oldConfig) {
|
|
8994
9169
|
const hasOldJit = oldConfig.mode === "jit";
|
|
8995
9170
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9013,7 +9188,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9013
9188
|
validation.message
|
|
9014
9189
|
);
|
|
9015
9190
|
}
|
|
9016
|
-
const hasTsConfig = await pathExists2(
|
|
9191
|
+
const hasTsConfig = await pathExists2(path25.join(cwd2, "tsconfig.json"));
|
|
9017
9192
|
check(
|
|
9018
9193
|
results,
|
|
9019
9194
|
"typescript",
|
|
@@ -9089,7 +9264,8 @@ async function runPreflightCli(rawArgs) {
|
|
|
9089
9264
|
function isDirectExecution() {
|
|
9090
9265
|
const scriptPath = process.argv[1];
|
|
9091
9266
|
if (!scriptPath) return false;
|
|
9092
|
-
|
|
9267
|
+
const currentUrl = typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : `file://${scriptPath}`;
|
|
9268
|
+
return currentUrl === pathToFileURL2(scriptPath).href;
|
|
9093
9269
|
}
|
|
9094
9270
|
if (isDirectExecution()) {
|
|
9095
9271
|
runPreflightCli(process.argv.slice(2)).catch((error) => {
|
|
@@ -9158,6 +9334,7 @@ var installRegistryCommand = {
|
|
|
9158
9334
|
|
|
9159
9335
|
// packages/infrastructure/cli/src/commands/scriptCommands.ts
|
|
9160
9336
|
init_errors();
|
|
9337
|
+
import { parseArgs as parseNodeArgs10 } from "util";
|
|
9161
9338
|
async function runScriptCommand(commandName, context, relativeScriptPath, args, options = {}) {
|
|
9162
9339
|
if (context.json && options.jsonUnsupported) {
|
|
9163
9340
|
throw new CliUsageError(
|
|
@@ -9186,7 +9363,7 @@ var parseCommand = {
|
|
|
9186
9363
|
var transformCommand = {
|
|
9187
9364
|
name: "transform",
|
|
9188
9365
|
async run(args, context) {
|
|
9189
|
-
const parsed =
|
|
9366
|
+
const parsed = parseNodeArgs10({
|
|
9190
9367
|
args,
|
|
9191
9368
|
allowPositionals: true,
|
|
9192
9369
|
strict: false,
|
|
@@ -9229,7 +9406,7 @@ var lintCommand = {
|
|
|
9229
9406
|
var formatCommand2 = {
|
|
9230
9407
|
name: "format",
|
|
9231
9408
|
async run(args, context) {
|
|
9232
|
-
const parsed =
|
|
9409
|
+
const parsed = parseNodeArgs10({
|
|
9233
9410
|
args,
|
|
9234
9411
|
allowPositionals: true,
|
|
9235
9412
|
strict: false,
|
|
@@ -9271,7 +9448,7 @@ var optimizeCommand = {
|
|
|
9271
9448
|
var splitCommand = {
|
|
9272
9449
|
name: "split",
|
|
9273
9450
|
async run(args, context) {
|
|
9274
|
-
const parsed =
|
|
9451
|
+
const parsed = parseNodeArgs10({
|
|
9275
9452
|
args,
|
|
9276
9453
|
allowPositionals: true,
|
|
9277
9454
|
strict: false,
|
|
@@ -9370,10 +9547,12 @@ var scriptCommands = [
|
|
|
9370
9547
|
init_errors();
|
|
9371
9548
|
init_fs();
|
|
9372
9549
|
init_json();
|
|
9550
|
+
import path26 from "path";
|
|
9551
|
+
import { parseArgs as parseNodeArgs11 } from "util";
|
|
9373
9552
|
var storybookCommand = {
|
|
9374
9553
|
name: "storybook",
|
|
9375
9554
|
async run(args, context) {
|
|
9376
|
-
const parsed =
|
|
9555
|
+
const parsed = parseNodeArgs11({
|
|
9377
9556
|
args,
|
|
9378
9557
|
allowPositionals: true,
|
|
9379
9558
|
strict: false,
|
|
@@ -9407,7 +9586,7 @@ var storybookCommand = {
|
|
|
9407
9586
|
context.output.writeText(
|
|
9408
9587
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9409
9588
|
);
|
|
9410
|
-
const localBin =
|
|
9589
|
+
const localBin = path26.join(
|
|
9411
9590
|
process.cwd(),
|
|
9412
9591
|
"node_modules",
|
|
9413
9592
|
".bin",
|
|
@@ -9425,13 +9604,14 @@ var storybookCommand = {
|
|
|
9425
9604
|
|
|
9426
9605
|
// packages/infrastructure/cli/src/commands/studio.ts
|
|
9427
9606
|
init_errors();
|
|
9607
|
+
import { parseArgs as parseNodeArgs12 } from "util";
|
|
9428
9608
|
var studioCommand = {
|
|
9429
9609
|
name: "studio",
|
|
9430
9610
|
async run(args, context) {
|
|
9431
9611
|
if (context.json) {
|
|
9432
9612
|
throw new CliUsageError("[tw studio] --json is not supported for this command");
|
|
9433
9613
|
}
|
|
9434
|
-
const parsed =
|
|
9614
|
+
const parsed = parseNodeArgs12({
|
|
9435
9615
|
args,
|
|
9436
9616
|
allowPositionals: true,
|
|
9437
9617
|
strict: false,
|
|
@@ -9497,8 +9677,9 @@ var syncCommand = {
|
|
|
9497
9677
|
};
|
|
9498
9678
|
|
|
9499
9679
|
// packages/infrastructure/cli/src/commands/trace.ts
|
|
9500
|
-
var import_picocolors5 = __toESM(require_picocolors());
|
|
9680
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
9501
9681
|
init_errors();
|
|
9682
|
+
import { parseArgs as parseNodeArgs13 } from "util";
|
|
9502
9683
|
|
|
9503
9684
|
// packages/infrastructure/cli/src/utils/traceService.ts
|
|
9504
9685
|
init_internal();
|
|
@@ -10322,7 +10503,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
10322
10503
|
const parsed = native.parseCssRules(css);
|
|
10323
10504
|
for (const r of parsed) {
|
|
10324
10505
|
const className = prefix + r.className;
|
|
10325
|
-
r.variants.length > 0;
|
|
10506
|
+
const hasVariants = r.variants.length > 0;
|
|
10326
10507
|
const layerName = detectLayerFromClassName(className);
|
|
10327
10508
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
10328
10509
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -10574,8 +10755,10 @@ async function traceClass(className, options) {
|
|
|
10574
10755
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10575
10756
|
init_internal();
|
|
10576
10757
|
init_src2();
|
|
10758
|
+
import fs13 from "fs";
|
|
10759
|
+
import path27 from "path";
|
|
10577
10760
|
function toRelativePath(root, value) {
|
|
10578
|
-
const relative =
|
|
10761
|
+
const relative = path27.relative(root, value);
|
|
10579
10762
|
return relative.length > 0 ? relative : ".";
|
|
10580
10763
|
}
|
|
10581
10764
|
function uniqueSorted(values) {
|
|
@@ -10644,7 +10827,7 @@ function tryCompileClasses(classes) {
|
|
|
10644
10827
|
}
|
|
10645
10828
|
}
|
|
10646
10829
|
function traceSingleFile(filePath, root) {
|
|
10647
|
-
const source =
|
|
10830
|
+
const source = fs13.readFileSync(filePath, "utf8");
|
|
10648
10831
|
const classes = uniqueSorted(scanSource(source));
|
|
10649
10832
|
const imports = extractImports(source);
|
|
10650
10833
|
const compiled = tryCompileClasses(classes);
|
|
@@ -10675,7 +10858,7 @@ function traceDirectory(targetDir, root) {
|
|
|
10675
10858
|
const imports = [];
|
|
10676
10859
|
const importKeys = /* @__PURE__ */ new Set();
|
|
10677
10860
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
10678
|
-
const source =
|
|
10861
|
+
const source = fs13.readFileSync(entry.file, "utf8");
|
|
10679
10862
|
const fileImports = extractImports(source);
|
|
10680
10863
|
for (const fileImport of fileImports) {
|
|
10681
10864
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -10706,12 +10889,12 @@ function traceDirectory(targetDir, root) {
|
|
|
10706
10889
|
};
|
|
10707
10890
|
}
|
|
10708
10891
|
async function traceTarget(target, options = {}) {
|
|
10709
|
-
const root =
|
|
10710
|
-
const resolvedTarget =
|
|
10711
|
-
if (!
|
|
10892
|
+
const root = path27.resolve(options.root ?? process.cwd());
|
|
10893
|
+
const resolvedTarget = path27.resolve(root, target);
|
|
10894
|
+
if (!fs13.existsSync(resolvedTarget)) {
|
|
10712
10895
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
10713
10896
|
}
|
|
10714
|
-
const stat =
|
|
10897
|
+
const stat = fs13.statSync(resolvedTarget);
|
|
10715
10898
|
if (stat.isDirectory()) {
|
|
10716
10899
|
return traceDirectory(resolvedTarget, root);
|
|
10717
10900
|
}
|
|
@@ -10729,7 +10912,7 @@ function parseTraceFormat(value, context) {
|
|
|
10729
10912
|
throw new CliUsageError(`Unsupported trace format "${value}". Use text, json, or mermaid.`);
|
|
10730
10913
|
}
|
|
10731
10914
|
async function runTraceCli(args, context) {
|
|
10732
|
-
const parsed =
|
|
10915
|
+
const parsed = parseNodeArgs13({
|
|
10733
10916
|
args,
|
|
10734
10917
|
allowPositionals: true,
|
|
10735
10918
|
strict: false,
|
|
@@ -10873,14 +11056,16 @@ function printClassTraceOutput(result, output) {
|
|
|
10873
11056
|
}
|
|
10874
11057
|
|
|
10875
11058
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
10876
|
-
var import_picocolors6 = __toESM(require_picocolors());
|
|
11059
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
10877
11060
|
init_output();
|
|
11061
|
+
import fs14 from "fs";
|
|
11062
|
+
import path28 from "path";
|
|
10878
11063
|
async function runGenerateTypesCli(rawArgs) {
|
|
10879
11064
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
10880
11065
|
const logger = createCliLogger({ output });
|
|
10881
11066
|
const cwd2 = process.cwd();
|
|
10882
11067
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
10883
|
-
const outPath =
|
|
11068
|
+
const outPath = path28.resolve(cwd2, outFile);
|
|
10884
11069
|
output.writeText("");
|
|
10885
11070
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
10886
11071
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
@@ -10916,12 +11101,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10916
11101
|
}
|
|
10917
11102
|
output.writeText("");
|
|
10918
11103
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
10919
|
-
const outDir =
|
|
10920
|
-
if (!
|
|
10921
|
-
|
|
11104
|
+
const outDir = path28.dirname(outPath);
|
|
11105
|
+
if (!fs14.existsSync(outDir)) {
|
|
11106
|
+
fs14.mkdirSync(outDir, { recursive: true });
|
|
10922
11107
|
}
|
|
10923
|
-
|
|
10924
|
-
logger.ok(
|
|
11108
|
+
fs14.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11109
|
+
logger.ok(path28.relative(cwd2, outPath));
|
|
10925
11110
|
output.writeText("");
|
|
10926
11111
|
output.writeText(import_picocolors6.default.dim(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
10927
11112
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -10932,11 +11117,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
10932
11117
|
}
|
|
10933
11118
|
async function loadNativeBinding2(cwd2) {
|
|
10934
11119
|
const candidates = [
|
|
10935
|
-
|
|
10936
|
-
|
|
11120
|
+
path28.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11121
|
+
path28.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
10937
11122
|
];
|
|
10938
11123
|
for (const candidate of candidates) {
|
|
10939
|
-
if (
|
|
11124
|
+
if (fs14.existsSync(candidate)) {
|
|
10940
11125
|
try {
|
|
10941
11126
|
return __require(candidate);
|
|
10942
11127
|
} catch {
|
|
@@ -10948,9 +11133,12 @@ async function loadNativeBinding2(cwd2) {
|
|
|
10948
11133
|
|
|
10949
11134
|
// packages/infrastructure/cli/src/commands/why.ts
|
|
10950
11135
|
init_errors();
|
|
11136
|
+
import { parseArgs as parseNodeArgs14 } from "util";
|
|
10951
11137
|
|
|
10952
11138
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
10953
11139
|
init_internal();
|
|
11140
|
+
import fs15 from "fs";
|
|
11141
|
+
import path29 from "path";
|
|
10954
11142
|
init_src2();
|
|
10955
11143
|
function extractVariantChain(usage) {
|
|
10956
11144
|
const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
|
|
@@ -10998,7 +11186,7 @@ async function whyClass(className, options) {
|
|
|
10998
11186
|
for (const file of scanResult.files) {
|
|
10999
11187
|
const source = (() => {
|
|
11000
11188
|
try {
|
|
11001
|
-
return
|
|
11189
|
+
return fs15.readFileSync(file.file, "utf8");
|
|
11002
11190
|
} catch {
|
|
11003
11191
|
return "";
|
|
11004
11192
|
}
|
|
@@ -11012,7 +11200,7 @@ async function whyClass(className, options) {
|
|
|
11012
11200
|
className
|
|
11013
11201
|
]);
|
|
11014
11202
|
usedIn.push({
|
|
11015
|
-
file:
|
|
11203
|
+
file: path29.relative(root, file.file) || path29.basename(file.file),
|
|
11016
11204
|
line: location.line,
|
|
11017
11205
|
column: location.column,
|
|
11018
11206
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11133,7 +11321,7 @@ function printWhyOutput(result, output) {
|
|
|
11133
11321
|
output.writeText("");
|
|
11134
11322
|
}
|
|
11135
11323
|
async function runWhyCli(args, context) {
|
|
11136
|
-
const parsed =
|
|
11324
|
+
const parsed = parseNodeArgs14({
|
|
11137
11325
|
args,
|
|
11138
11326
|
allowPositionals: true,
|
|
11139
11327
|
strict: false,
|
|
@@ -11175,7 +11363,7 @@ function toVariadic(value) {
|
|
|
11175
11363
|
return Array.isArray(value) ? value : [value];
|
|
11176
11364
|
}
|
|
11177
11365
|
function buildMainProgram(context) {
|
|
11178
|
-
new Map(miscCommands.map((command) => [command.name, command]));
|
|
11366
|
+
const _miscByName = new Map(miscCommands.map((command) => [command.name, command]));
|
|
11179
11367
|
const scriptByName = new Map(scriptCommands.map((command) => [command.name, command]));
|
|
11180
11368
|
const program2 = new Command("tw");
|
|
11181
11369
|
program2.name("tw").description("tailwind-styled-v4 CLI").version("5.0.4", "--version", "Output the current version").option("--json", "Output strict JSON envelope").option("--debug", "Include stack traces for errors").option("--verbose", "Verbose runtime logs");
|
|
@@ -11476,11 +11664,14 @@ async function main2() {
|
|
|
11476
11664
|
buildProgram: buildMainProgram
|
|
11477
11665
|
});
|
|
11478
11666
|
}
|
|
11479
|
-
var
|
|
11480
|
-
if (process.argv[1] ===
|
|
11667
|
+
var __currentFile = fileURLToPath6(import.meta.url);
|
|
11668
|
+
if (process.argv[1] === __currentFile) {
|
|
11481
11669
|
main2();
|
|
11482
11670
|
}
|
|
11483
|
-
|
|
11484
|
-
|
|
11485
|
-
|
|
11671
|
+
export {
|
|
11672
|
+
createCliOutput,
|
|
11673
|
+
ensureFlag,
|
|
11674
|
+
parseCliInput as parseCliArgs,
|
|
11675
|
+
runScanCli
|
|
11676
|
+
};
|
|
11486
11677
|
//# sourceMappingURL=cli.mjs.map
|