tailwind-styled-v4 5.1.22 → 5.1.23
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/README.md +216 -0
- package/dist/atomic.js +34 -4
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +31 -2
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +132 -97
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +129 -95
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +195 -1
- package/dist/compiler.d.ts +195 -1
- package/dist/compiler.js +356 -12
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +340 -10
- package/dist/compiler.mjs.map +1 -1
- package/dist/engine.js +194 -164
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +184 -155
- package/dist/engine.mjs.map +1 -1
- package/dist/index.browser.mjs +144 -14
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +45 -4
- package/dist/index.d.ts +45 -4
- package/dist/index.js +174 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -21
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +489 -158
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +483 -153
- package/dist/next.mjs.map +1 -1
- package/dist/runtime-css.js +1 -1
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +1 -1
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +17 -0
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +23 -0
- package/dist/runtime.mjs.map +1 -1
- package/dist/shared.js +91 -61
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -56
- package/dist/shared.mjs.map +1 -1
- package/dist/turbopackLoader.js +79 -49
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +76 -47
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +132 -97
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +129 -95
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +157 -127
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +150 -121
- package/dist/vite.mjs.map +1 -1
- package/dist/webpackLoader.js +39 -9
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +36 -7
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +1 -1
- package/CHANGELOG.md +0 -182
package/dist/cli.js
CHANGED
|
@@ -988,8 +988,8 @@ var require_command = __commonJS({
|
|
|
988
988
|
init_cjs_shims();
|
|
989
989
|
var EventEmitter = require("events").EventEmitter;
|
|
990
990
|
var childProcess = require("child_process");
|
|
991
|
-
var
|
|
992
|
-
var
|
|
991
|
+
var path33 = require("path");
|
|
992
|
+
var fs19 = require("fs");
|
|
993
993
|
var process2 = require("process");
|
|
994
994
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
995
995
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1921,11 +1921,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1921
1921
|
let launchWithNode = false;
|
|
1922
1922
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1923
1923
|
function findFile(baseDir, baseName) {
|
|
1924
|
-
const localBin =
|
|
1925
|
-
if (
|
|
1926
|
-
if (sourceExt.includes(
|
|
1924
|
+
const localBin = path33.resolve(baseDir, baseName);
|
|
1925
|
+
if (fs19.existsSync(localBin)) return localBin;
|
|
1926
|
+
if (sourceExt.includes(path33.extname(baseName))) return void 0;
|
|
1927
1927
|
const foundExt = sourceExt.find(
|
|
1928
|
-
(ext) =>
|
|
1928
|
+
(ext) => fs19.existsSync(`${localBin}${ext}`)
|
|
1929
1929
|
);
|
|
1930
1930
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1931
1931
|
return void 0;
|
|
@@ -1937,21 +1937,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1937
1937
|
if (this._scriptPath) {
|
|
1938
1938
|
let resolvedScriptPath;
|
|
1939
1939
|
try {
|
|
1940
|
-
resolvedScriptPath =
|
|
1940
|
+
resolvedScriptPath = fs19.realpathSync(this._scriptPath);
|
|
1941
1941
|
} catch (err) {
|
|
1942
1942
|
resolvedScriptPath = this._scriptPath;
|
|
1943
1943
|
}
|
|
1944
|
-
executableDir =
|
|
1945
|
-
|
|
1944
|
+
executableDir = path33.resolve(
|
|
1945
|
+
path33.dirname(resolvedScriptPath),
|
|
1946
1946
|
executableDir
|
|
1947
1947
|
);
|
|
1948
1948
|
}
|
|
1949
1949
|
if (executableDir) {
|
|
1950
1950
|
let localFile = findFile(executableDir, executableFile);
|
|
1951
1951
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1952
|
-
const legacyName =
|
|
1952
|
+
const legacyName = path33.basename(
|
|
1953
1953
|
this._scriptPath,
|
|
1954
|
-
|
|
1954
|
+
path33.extname(this._scriptPath)
|
|
1955
1955
|
);
|
|
1956
1956
|
if (legacyName !== this._name) {
|
|
1957
1957
|
localFile = findFile(
|
|
@@ -1962,7 +1962,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1962
1962
|
}
|
|
1963
1963
|
executableFile = localFile || executableFile;
|
|
1964
1964
|
}
|
|
1965
|
-
launchWithNode = sourceExt.includes(
|
|
1965
|
+
launchWithNode = sourceExt.includes(path33.extname(executableFile));
|
|
1966
1966
|
let proc;
|
|
1967
1967
|
if (process2.platform !== "win32") {
|
|
1968
1968
|
if (launchWithNode) {
|
|
@@ -2802,7 +2802,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2802
2802
|
* @return {Command}
|
|
2803
2803
|
*/
|
|
2804
2804
|
nameFromFilename(filename) {
|
|
2805
|
-
this._name =
|
|
2805
|
+
this._name = path33.basename(filename, path33.extname(filename));
|
|
2806
2806
|
return this;
|
|
2807
2807
|
}
|
|
2808
2808
|
/**
|
|
@@ -2816,9 +2816,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2816
2816
|
* @param {string} [path]
|
|
2817
2817
|
* @return {(string|null|Command)}
|
|
2818
2818
|
*/
|
|
2819
|
-
executableDir(
|
|
2820
|
-
if (
|
|
2821
|
-
this._executableDir =
|
|
2819
|
+
executableDir(path34) {
|
|
2820
|
+
if (path34 === void 0) return this._executableDir;
|
|
2821
|
+
this._executableDir = path34;
|
|
2822
2822
|
return this;
|
|
2823
2823
|
}
|
|
2824
2824
|
/**
|
|
@@ -3332,9 +3332,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3332
3332
|
}
|
|
3333
3333
|
};
|
|
3334
3334
|
}
|
|
3335
|
-
function formatIssuePath(
|
|
3336
|
-
if (!
|
|
3337
|
-
return
|
|
3335
|
+
function formatIssuePath(path33) {
|
|
3336
|
+
if (!path33 || path33.length === 0) return "(root)";
|
|
3337
|
+
return path33.map(
|
|
3338
3338
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3339
3339
|
).join(".");
|
|
3340
3340
|
}
|
|
@@ -3455,8 +3455,8 @@ var init_src = __esm({
|
|
|
3455
3455
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3456
3456
|
static fromZod(err) {
|
|
3457
3457
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3458
|
-
const
|
|
3459
|
-
const message = first ? `${
|
|
3458
|
+
const path33 = formatIssuePath(first?.path);
|
|
3459
|
+
const message = first ? `${path33}: ${first.message}` : "Schema validation failed";
|
|
3460
3460
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3461
3461
|
}
|
|
3462
3462
|
static wrap(source, code, err) {
|
|
@@ -4013,12 +4013,12 @@ var init_schemas = __esm({
|
|
|
4013
4013
|
init_cjs_shims();
|
|
4014
4014
|
import_zod = require("zod");
|
|
4015
4015
|
init_src();
|
|
4016
|
-
formatIssuePath2 = (
|
|
4016
|
+
formatIssuePath2 = (path33) => path33.length > 0 ? path33.map(
|
|
4017
4017
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4018
4018
|
).join(".") : "<root>";
|
|
4019
4019
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4020
|
-
const
|
|
4021
|
-
return `${
|
|
4020
|
+
const path33 = formatIssuePath2(issue.path);
|
|
4021
|
+
return `${path33}: ${issue.message}`;
|
|
4022
4022
|
}).join("; ");
|
|
4023
4023
|
parseWithSchema = (schema, data, label) => {
|
|
4024
4024
|
const parsed = schema.safeParse(data);
|
|
@@ -4624,7 +4624,7 @@ var init_schemas2 = __esm({
|
|
|
4624
4624
|
init_cjs_shims();
|
|
4625
4625
|
init_src();
|
|
4626
4626
|
import_zod2 = require("zod");
|
|
4627
|
-
formatIssuePath3 = (
|
|
4627
|
+
formatIssuePath3 = (path33) => path33.length > 0 ? path33.map(
|
|
4628
4628
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4629
4629
|
).join(".") : "<root>";
|
|
4630
4630
|
isPlainObject = (value) => {
|
|
@@ -4633,8 +4633,8 @@ var init_schemas2 = __esm({
|
|
|
4633
4633
|
return proto === Object.prototype || proto === null;
|
|
4634
4634
|
};
|
|
4635
4635
|
formatIssues2 = (error) => error.issues.map((issue) => {
|
|
4636
|
-
const
|
|
4637
|
-
return `${
|
|
4636
|
+
const path33 = formatIssuePath3(issue.path);
|
|
4637
|
+
return `${path33}: ${issue.message}`;
|
|
4638
4638
|
}).join("; ");
|
|
4639
4639
|
parseWithSchema2 = (schema, data, label) => {
|
|
4640
4640
|
const parsed = schema.safeParse(data);
|
|
@@ -6254,7 +6254,7 @@ var init_nativeBridge = __esm({
|
|
|
6254
6254
|
"use strict";
|
|
6255
6255
|
init_cjs_shims();
|
|
6256
6256
|
init_src();
|
|
6257
|
-
_loadNative = (
|
|
6257
|
+
_loadNative = (path33) => require(path33);
|
|
6258
6258
|
log3 = (...args) => {
|
|
6259
6259
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6260
6260
|
console.log("[compiler:native]", ...args);
|
|
@@ -6407,14 +6407,41 @@ var init_routeGraph = __esm({
|
|
|
6407
6407
|
}
|
|
6408
6408
|
});
|
|
6409
6409
|
|
|
6410
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
6411
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
6412
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
6413
|
+
"use strict";
|
|
6414
|
+
init_cjs_shims();
|
|
6415
|
+
}
|
|
6416
|
+
});
|
|
6417
|
+
|
|
6418
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
6419
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
6420
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
6421
|
+
"use strict";
|
|
6422
|
+
init_cjs_shims();
|
|
6423
|
+
}
|
|
6424
|
+
});
|
|
6425
|
+
|
|
6426
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
6427
|
+
var import_node_fs11, import_node_path26;
|
|
6428
|
+
var init_typeGenerationPlugin = __esm({
|
|
6429
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
6430
|
+
"use strict";
|
|
6431
|
+
init_cjs_shims();
|
|
6432
|
+
import_node_fs11 = __toESM(require("fs"), 1);
|
|
6433
|
+
import_node_path26 = __toESM(require("path"), 1);
|
|
6434
|
+
}
|
|
6435
|
+
});
|
|
6436
|
+
|
|
6410
6437
|
// packages/domain/compiler/src/index.ts
|
|
6411
|
-
var
|
|
6438
|
+
var import_node_fs12, import_node_path27, import_node_module4, _require3, compileCssFromClasses;
|
|
6412
6439
|
var init_src4 = __esm({
|
|
6413
6440
|
"packages/domain/compiler/src/index.ts"() {
|
|
6414
6441
|
"use strict";
|
|
6415
6442
|
init_cjs_shims();
|
|
6416
|
-
|
|
6417
|
-
|
|
6443
|
+
import_node_fs12 = __toESM(require("fs"), 1);
|
|
6444
|
+
import_node_path27 = __toESM(require("path"), 1);
|
|
6418
6445
|
import_node_module4 = require("module");
|
|
6419
6446
|
init_nativeBridge();
|
|
6420
6447
|
init_compiler();
|
|
@@ -6424,6 +6451,9 @@ var init_src4 = __esm({
|
|
|
6424
6451
|
init_redis();
|
|
6425
6452
|
init_watch();
|
|
6426
6453
|
init_routeGraph();
|
|
6454
|
+
init_semanticComponentAnalyzer();
|
|
6455
|
+
init_typeGeneratorFromMetadata();
|
|
6456
|
+
init_typeGenerationPlugin();
|
|
6427
6457
|
_require3 = (0, import_node_module4.createRequire)(
|
|
6428
6458
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
6429
6459
|
);
|
|
@@ -8775,7 +8805,7 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8775
8805
|
const tokens = {};
|
|
8776
8806
|
const { variables = {}, variableCollections = {} } = variablesData;
|
|
8777
8807
|
for (const [id, variable] of Object.entries(variables)) {
|
|
8778
|
-
const collection = variableCollections[variable.variableCollectionId];
|
|
8808
|
+
const collection = variableCollections?.[variable.variableCollectionId];
|
|
8779
8809
|
if (!collection) continue;
|
|
8780
8810
|
const modeId = Object.keys(variable.valuesByMode)[0];
|
|
8781
8811
|
const rawValue = variable.valuesByMode[modeId];
|
|
@@ -8790,12 +8820,13 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8790
8820
|
}
|
|
8791
8821
|
const leafKey = parts[parts.length - 1];
|
|
8792
8822
|
if (variable.resolvedType === "COLOR") {
|
|
8793
|
-
|
|
8794
|
-
$value: typeof rawValue === "object" && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8795
|
-
$type: "color"
|
|
8796
|
-
$description: variable.description || void 0,
|
|
8797
|
-
_figmaId: id
|
|
8823
|
+
const token = {
|
|
8824
|
+
$value: typeof rawValue === "object" && rawValue !== null && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8825
|
+
$type: "color"
|
|
8798
8826
|
};
|
|
8827
|
+
if (variable.description) token.$description = variable.description;
|
|
8828
|
+
token._figmaId = id;
|
|
8829
|
+
cursor[leafKey] = token;
|
|
8799
8830
|
} else if (variable.resolvedType === "FLOAT") {
|
|
8800
8831
|
cursor[leafKey] = {
|
|
8801
8832
|
$value: typeof rawValue === "number" ? `${rawValue}px` : String(rawValue),
|
|
@@ -8817,10 +8848,11 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8817
8848
|
init_cjs_shims();
|
|
8818
8849
|
function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
8819
8850
|
const updates = [];
|
|
8820
|
-
function walk(obj,
|
|
8851
|
+
function walk(obj, path33 = []) {
|
|
8821
8852
|
for (const [key, val] of Object.entries(obj)) {
|
|
8822
|
-
if (val
|
|
8823
|
-
const
|
|
8853
|
+
if (typeof val === "object" && val !== null && "$value" in val) {
|
|
8854
|
+
const tokenVal = val;
|
|
8855
|
+
const name = path33.concat(key).map(
|
|
8824
8856
|
(p) => p.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
|
|
8825
8857
|
).join("/");
|
|
8826
8858
|
const existing = Object.values(existingVariables).find(
|
|
@@ -8830,12 +8862,12 @@ function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
|
8830
8862
|
updates.push({
|
|
8831
8863
|
id: existing.id,
|
|
8832
8864
|
name,
|
|
8833
|
-
value:
|
|
8834
|
-
type:
|
|
8865
|
+
value: tokenVal.$value,
|
|
8866
|
+
type: tokenVal.$type
|
|
8835
8867
|
});
|
|
8836
8868
|
}
|
|
8837
|
-
} else if (typeof val === "object" && !val
|
|
8838
|
-
walk(val,
|
|
8869
|
+
} else if (typeof val === "object" && val !== null && !("$type" in val)) {
|
|
8870
|
+
walk(val, path33.concat(key));
|
|
8839
8871
|
}
|
|
8840
8872
|
}
|
|
8841
8873
|
}
|
|
@@ -8845,9 +8877,10 @@ function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
|
8845
8877
|
function flattenTokens(obj, prefix = "", target = {}) {
|
|
8846
8878
|
for (const [k, v] of Object.entries(obj)) {
|
|
8847
8879
|
const key = [prefix, k].filter(Boolean).join(".");
|
|
8848
|
-
if (v
|
|
8849
|
-
|
|
8850
|
-
|
|
8880
|
+
if (typeof v === "object" && v !== null && "$value" in v) {
|
|
8881
|
+
const tokenVal = v;
|
|
8882
|
+
target[key] = tokenVal.$value;
|
|
8883
|
+
} else if (typeof v === "object" && v !== null && !("$type" in v)) {
|
|
8851
8884
|
flattenTokens(v, key, target);
|
|
8852
8885
|
}
|
|
8853
8886
|
}
|
|
@@ -8878,7 +8911,7 @@ var figmaCommand = {
|
|
|
8878
8911
|
const FIGMA_FILE_KEY = process.env.FIGMA_FILE_KEY;
|
|
8879
8912
|
const TOKEN_FILE = import_node_path23.default.join(context.cwd, "tokens.sync.json");
|
|
8880
8913
|
if (!cmd || cmd === "help") {
|
|
8881
|
-
context.output.
|
|
8914
|
+
context.output.writeText(`Usage: tw figma <pull|push|diff> [--dry-run]
|
|
8882
8915
|
|
|
8883
8916
|
Environment variables:
|
|
8884
8917
|
FIGMA_TOKEN \u2014 Figma personal access token (figd_...)
|
|
@@ -8900,16 +8933,18 @@ Options:
|
|
|
8900
8933
|
);
|
|
8901
8934
|
}
|
|
8902
8935
|
try {
|
|
8903
|
-
context.output.
|
|
8936
|
+
const spinner = context.output.spinner();
|
|
8937
|
+
spinner.start("Fetching Figma variables...");
|
|
8904
8938
|
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8905
8939
|
token: FIGMA_TOKEN,
|
|
8906
8940
|
fileKey: FIGMA_FILE_KEY
|
|
8907
8941
|
});
|
|
8942
|
+
spinner.stop();
|
|
8908
8943
|
const tokens = figmaVariablesToTokens(data);
|
|
8909
8944
|
const variableCount = Object.values(data.variables ?? {}).length;
|
|
8910
8945
|
if (isDryRun) {
|
|
8911
|
-
context.output.
|
|
8912
|
-
context.output.
|
|
8946
|
+
context.output.info("DRY RUN \u2014 would write:");
|
|
8947
|
+
context.output.writeText(JSON.stringify({ version: 1, tokens }, null, 2));
|
|
8913
8948
|
} else {
|
|
8914
8949
|
let existing = { version: 1, tokens: {} };
|
|
8915
8950
|
if (import_node_fs9.default.existsSync(TOKEN_FILE)) {
|
|
@@ -8950,15 +8985,15 @@ Options:
|
|
|
8950
8985
|
token: FIGMA_TOKEN,
|
|
8951
8986
|
fileKey: FIGMA_FILE_KEY
|
|
8952
8987
|
});
|
|
8953
|
-
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables ?? {});
|
|
8988
|
+
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables?.length ? Object.entries(data.variables ?? {}).reduce((acc, [id, v]) => ({ ...acc, [id]: { ...v, id } }), {}) : {});
|
|
8954
8989
|
if (isDryRun) {
|
|
8955
|
-
context.output.
|
|
8956
|
-
`
|
|
8990
|
+
context.output.info(
|
|
8991
|
+
`DRY RUN \u2014 would update ${updates.length} variables in Figma:`
|
|
8957
8992
|
);
|
|
8958
|
-
updates.forEach((u) => context.output.
|
|
8993
|
+
updates.forEach((u) => context.output.writeText(` ${u.name}: ${u.value}`));
|
|
8959
8994
|
} else {
|
|
8960
8995
|
if (updates.length === 0) {
|
|
8961
|
-
context.output.
|
|
8996
|
+
context.output.info("No matching variables to update");
|
|
8962
8997
|
} else {
|
|
8963
8998
|
context.output.success(`Updated ${updates.length} variables in Figma`);
|
|
8964
8999
|
}
|
|
@@ -8992,12 +9027,12 @@ Options:
|
|
|
8992
9027
|
if (diffs.length === 0) {
|
|
8993
9028
|
context.output.success("No differences \u2014 local and Figma are in sync");
|
|
8994
9029
|
} else {
|
|
8995
|
-
context.output.
|
|
9030
|
+
context.output.info(`${diffs.length} differences found:
|
|
8996
9031
|
`);
|
|
8997
9032
|
diffs.forEach((d) => {
|
|
8998
|
-
context.output.
|
|
8999
|
-
context.output.
|
|
9000
|
-
context.output.
|
|
9033
|
+
context.output.writeText(` ${d.key}`);
|
|
9034
|
+
context.output.writeText(` local: ${d.local ?? "(missing)"}`);
|
|
9035
|
+
context.output.writeText(` figma: ${d.figma ?? "(missing)"}`);
|
|
9001
9036
|
});
|
|
9002
9037
|
}
|
|
9003
9038
|
} catch (e) {
|
|
@@ -9382,7 +9417,7 @@ init_cjs_shims();
|
|
|
9382
9417
|
|
|
9383
9418
|
// packages/infrastructure/cli/src/preflight.ts
|
|
9384
9419
|
init_cjs_shims();
|
|
9385
|
-
var
|
|
9420
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
9386
9421
|
var import_node_url7 = require("url");
|
|
9387
9422
|
init_args();
|
|
9388
9423
|
init_errors();
|
|
@@ -9415,8 +9450,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
9415
9450
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9416
9451
|
let configPath = null;
|
|
9417
9452
|
for (const file of twConfigFiles) {
|
|
9418
|
-
if (await pathExists2(
|
|
9419
|
-
configPath =
|
|
9453
|
+
if (await pathExists2(import_node_path28.default.join(cwd2, file))) {
|
|
9454
|
+
configPath = import_node_path28.default.join(cwd2, file);
|
|
9420
9455
|
break;
|
|
9421
9456
|
}
|
|
9422
9457
|
}
|
|
@@ -9507,7 +9542,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
9507
9542
|
async function hasTailwindCssImport(cwd2) {
|
|
9508
9543
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
9509
9544
|
for (const file of cssFiles) {
|
|
9510
|
-
const raw = await readFileSafe(
|
|
9545
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9511
9546
|
if (raw?.includes("tailwindcss")) return true;
|
|
9512
9547
|
}
|
|
9513
9548
|
return false;
|
|
@@ -9523,7 +9558,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
9523
9558
|
"app/globals.css"
|
|
9524
9559
|
];
|
|
9525
9560
|
for (const file of cssFiles) {
|
|
9526
|
-
const raw = await readFileSafe(
|
|
9561
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9527
9562
|
if (raw === null) continue;
|
|
9528
9563
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
9529
9564
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -9531,8 +9566,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
9531
9566
|
return { found: false, cssFile: null };
|
|
9532
9567
|
}
|
|
9533
9568
|
async function applyTailwindInit(cwd2) {
|
|
9534
|
-
await ensureFileSafe(
|
|
9535
|
-
await ensureFileSafe(
|
|
9569
|
+
await ensureFileSafe(import_node_path28.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9570
|
+
await ensureFileSafe(import_node_path28.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
9536
9571
|
}
|
|
9537
9572
|
function check(results, id, label, pass, message, fix) {
|
|
9538
9573
|
results.push({ id, label, pass, message, fix });
|
|
@@ -9554,7 +9589,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9554
9589
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
9555
9590
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
9556
9591
|
);
|
|
9557
|
-
const pkg = await readJsonSafe(
|
|
9592
|
+
const pkg = await readJsonSafe(import_node_path28.default.join(cwd2, "package.json"));
|
|
9558
9593
|
check(
|
|
9559
9594
|
results,
|
|
9560
9595
|
"package-json",
|
|
@@ -9588,7 +9623,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9588
9623
|
}
|
|
9589
9624
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9590
9625
|
const twConfigChecks = await Promise.all(
|
|
9591
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9626
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path28.default.join(cwd2, file)) }))
|
|
9592
9627
|
);
|
|
9593
9628
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9594
9629
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9600,7 +9635,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9600
9635
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9601
9636
|
"tw init"
|
|
9602
9637
|
);
|
|
9603
|
-
const oldConfig = await readJsonSafe(
|
|
9638
|
+
const oldConfig = await readJsonSafe(import_node_path28.default.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(import_node_path28.default.join(cwd2, "tailwind.config.ts"));
|
|
9604
9639
|
if (oldConfig) {
|
|
9605
9640
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9606
9641
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9624,7 +9659,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9624
9659
|
validation.message
|
|
9625
9660
|
);
|
|
9626
9661
|
}
|
|
9627
|
-
const hasTsConfig = await pathExists2(
|
|
9662
|
+
const hasTsConfig = await pathExists2(import_node_path28.default.join(cwd2, "tsconfig.json"));
|
|
9628
9663
|
check(
|
|
9629
9664
|
results,
|
|
9630
9665
|
"typescript",
|
|
@@ -9983,7 +10018,7 @@ var scriptCommands = [
|
|
|
9983
10018
|
|
|
9984
10019
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9985
10020
|
init_cjs_shims();
|
|
9986
|
-
var
|
|
10021
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
9987
10022
|
var import_node_util11 = require("util");
|
|
9988
10023
|
init_errors();
|
|
9989
10024
|
init_fs();
|
|
@@ -10025,7 +10060,7 @@ var storybookCommand = {
|
|
|
10025
10060
|
context.output.writeText(
|
|
10026
10061
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
10027
10062
|
);
|
|
10028
|
-
const localBin =
|
|
10063
|
+
const localBin = import_node_path29.default.join(
|
|
10029
10064
|
process.cwd(),
|
|
10030
10065
|
"node_modules",
|
|
10031
10066
|
".bin",
|
|
@@ -11211,12 +11246,12 @@ async function traceClass(className, options) {
|
|
|
11211
11246
|
|
|
11212
11247
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
11213
11248
|
init_cjs_shims();
|
|
11214
|
-
var
|
|
11215
|
-
var
|
|
11249
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
11250
|
+
var import_node_path30 = __toESM(require("path"), 1);
|
|
11216
11251
|
init_internal();
|
|
11217
11252
|
init_src2();
|
|
11218
11253
|
function toRelativePath(root, value) {
|
|
11219
|
-
const relative =
|
|
11254
|
+
const relative = import_node_path30.default.relative(root, value);
|
|
11220
11255
|
return relative.length > 0 ? relative : ".";
|
|
11221
11256
|
}
|
|
11222
11257
|
function uniqueSorted(values) {
|
|
@@ -11285,7 +11320,7 @@ function tryCompileClasses(classes) {
|
|
|
11285
11320
|
}
|
|
11286
11321
|
}
|
|
11287
11322
|
function traceSingleFile(filePath, root) {
|
|
11288
|
-
const source =
|
|
11323
|
+
const source = import_node_fs13.default.readFileSync(filePath, "utf8");
|
|
11289
11324
|
const classes = uniqueSorted(scanSource(source));
|
|
11290
11325
|
const imports = extractImports(source);
|
|
11291
11326
|
const compiled = tryCompileClasses(classes);
|
|
@@ -11316,7 +11351,7 @@ function traceDirectory(targetDir, root) {
|
|
|
11316
11351
|
const imports = [];
|
|
11317
11352
|
const importKeys = /* @__PURE__ */ new Set();
|
|
11318
11353
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
11319
|
-
const source =
|
|
11354
|
+
const source = import_node_fs13.default.readFileSync(entry.file, "utf8");
|
|
11320
11355
|
const fileImports = extractImports(source);
|
|
11321
11356
|
for (const fileImport of fileImports) {
|
|
11322
11357
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -11347,12 +11382,12 @@ function traceDirectory(targetDir, root) {
|
|
|
11347
11382
|
};
|
|
11348
11383
|
}
|
|
11349
11384
|
async function traceTarget(target, options = {}) {
|
|
11350
|
-
const root =
|
|
11351
|
-
const resolvedTarget =
|
|
11352
|
-
if (!
|
|
11385
|
+
const root = import_node_path30.default.resolve(options.root ?? process.cwd());
|
|
11386
|
+
const resolvedTarget = import_node_path30.default.resolve(root, target);
|
|
11387
|
+
if (!import_node_fs13.default.existsSync(resolvedTarget)) {
|
|
11353
11388
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
11354
11389
|
}
|
|
11355
|
-
const stat =
|
|
11390
|
+
const stat = import_node_fs13.default.statSync(resolvedTarget);
|
|
11356
11391
|
if (stat.isDirectory()) {
|
|
11357
11392
|
return traceDirectory(resolvedTarget, root);
|
|
11358
11393
|
}
|
|
@@ -11515,8 +11550,8 @@ function printClassTraceOutput(result, output) {
|
|
|
11515
11550
|
|
|
11516
11551
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
11517
11552
|
init_cjs_shims();
|
|
11518
|
-
var
|
|
11519
|
-
var
|
|
11553
|
+
var import_node_fs14 = __toESM(require("fs"), 1);
|
|
11554
|
+
var import_node_path31 = __toESM(require("path"), 1);
|
|
11520
11555
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
11521
11556
|
init_output();
|
|
11522
11557
|
async function runGenerateTypesCli(rawArgs) {
|
|
@@ -11524,7 +11559,7 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11524
11559
|
const logger = createCliLogger({ output });
|
|
11525
11560
|
const cwd2 = process.cwd();
|
|
11526
11561
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
11527
|
-
const outPath =
|
|
11562
|
+
const outPath = import_node_path31.default.resolve(cwd2, outFile);
|
|
11528
11563
|
output.writeText("");
|
|
11529
11564
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
11530
11565
|
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"));
|
|
@@ -11560,12 +11595,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11560
11595
|
}
|
|
11561
11596
|
output.writeText("");
|
|
11562
11597
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
11563
|
-
const outDir =
|
|
11564
|
-
if (!
|
|
11565
|
-
|
|
11598
|
+
const outDir = import_node_path31.default.dirname(outPath);
|
|
11599
|
+
if (!import_node_fs14.default.existsSync(outDir)) {
|
|
11600
|
+
import_node_fs14.default.mkdirSync(outDir, { recursive: true });
|
|
11566
11601
|
}
|
|
11567
|
-
|
|
11568
|
-
logger.ok(
|
|
11602
|
+
import_node_fs14.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11603
|
+
logger.ok(import_node_path31.default.relative(cwd2, outPath));
|
|
11569
11604
|
output.writeText("");
|
|
11570
11605
|
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"));
|
|
11571
11606
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -11576,11 +11611,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11576
11611
|
}
|
|
11577
11612
|
async function loadNativeBinding2(cwd2) {
|
|
11578
11613
|
const candidates = [
|
|
11579
|
-
|
|
11580
|
-
|
|
11614
|
+
import_node_path31.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11615
|
+
import_node_path31.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
11581
11616
|
];
|
|
11582
11617
|
for (const candidate of candidates) {
|
|
11583
|
-
if (
|
|
11618
|
+
if (import_node_fs14.default.existsSync(candidate)) {
|
|
11584
11619
|
try {
|
|
11585
11620
|
return require(candidate);
|
|
11586
11621
|
} catch {
|
|
@@ -11597,8 +11632,8 @@ init_errors();
|
|
|
11597
11632
|
|
|
11598
11633
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11599
11634
|
init_cjs_shims();
|
|
11600
|
-
var
|
|
11601
|
-
var
|
|
11635
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
|
11636
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
|
11602
11637
|
init_internal();
|
|
11603
11638
|
init_src2();
|
|
11604
11639
|
function extractVariantChain(usage) {
|
|
@@ -11647,7 +11682,7 @@ async function whyClass(className, options) {
|
|
|
11647
11682
|
for (const file of scanResult.files) {
|
|
11648
11683
|
const source = (() => {
|
|
11649
11684
|
try {
|
|
11650
|
-
return
|
|
11685
|
+
return import_node_fs15.default.readFileSync(file.file, "utf8");
|
|
11651
11686
|
} catch {
|
|
11652
11687
|
return "";
|
|
11653
11688
|
}
|
|
@@ -11661,7 +11696,7 @@ async function whyClass(className, options) {
|
|
|
11661
11696
|
className
|
|
11662
11697
|
]);
|
|
11663
11698
|
usedIn.push({
|
|
11664
|
-
file:
|
|
11699
|
+
file: import_node_path32.default.relative(root, file.file) || import_node_path32.default.basename(file.file),
|
|
11665
11700
|
line: location.line,
|
|
11666
11701
|
column: location.column,
|
|
11667
11702
|
usage: normalizeScannedClass(fileClass)
|