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