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/tw.js
CHANGED
|
@@ -989,8 +989,8 @@ var require_command = __commonJS({
|
|
|
989
989
|
init_cjs_shims();
|
|
990
990
|
var EventEmitter = require("events").EventEmitter;
|
|
991
991
|
var childProcess = require("child_process");
|
|
992
|
-
var
|
|
993
|
-
var
|
|
992
|
+
var path33 = require("path");
|
|
993
|
+
var fs19 = require("fs");
|
|
994
994
|
var process2 = require("process");
|
|
995
995
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
996
996
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1922,11 +1922,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1922
1922
|
let launchWithNode = false;
|
|
1923
1923
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1924
1924
|
function findFile(baseDir, baseName) {
|
|
1925
|
-
const localBin =
|
|
1926
|
-
if (
|
|
1927
|
-
if (sourceExt.includes(
|
|
1925
|
+
const localBin = path33.resolve(baseDir, baseName);
|
|
1926
|
+
if (fs19.existsSync(localBin)) return localBin;
|
|
1927
|
+
if (sourceExt.includes(path33.extname(baseName))) return void 0;
|
|
1928
1928
|
const foundExt = sourceExt.find(
|
|
1929
|
-
(ext) =>
|
|
1929
|
+
(ext) => fs19.existsSync(`${localBin}${ext}`)
|
|
1930
1930
|
);
|
|
1931
1931
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1932
1932
|
return void 0;
|
|
@@ -1938,21 +1938,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1938
1938
|
if (this._scriptPath) {
|
|
1939
1939
|
let resolvedScriptPath;
|
|
1940
1940
|
try {
|
|
1941
|
-
resolvedScriptPath =
|
|
1941
|
+
resolvedScriptPath = fs19.realpathSync(this._scriptPath);
|
|
1942
1942
|
} catch (err) {
|
|
1943
1943
|
resolvedScriptPath = this._scriptPath;
|
|
1944
1944
|
}
|
|
1945
|
-
executableDir =
|
|
1946
|
-
|
|
1945
|
+
executableDir = path33.resolve(
|
|
1946
|
+
path33.dirname(resolvedScriptPath),
|
|
1947
1947
|
executableDir
|
|
1948
1948
|
);
|
|
1949
1949
|
}
|
|
1950
1950
|
if (executableDir) {
|
|
1951
1951
|
let localFile = findFile(executableDir, executableFile);
|
|
1952
1952
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1953
|
-
const legacyName =
|
|
1953
|
+
const legacyName = path33.basename(
|
|
1954
1954
|
this._scriptPath,
|
|
1955
|
-
|
|
1955
|
+
path33.extname(this._scriptPath)
|
|
1956
1956
|
);
|
|
1957
1957
|
if (legacyName !== this._name) {
|
|
1958
1958
|
localFile = findFile(
|
|
@@ -1963,7 +1963,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1963
1963
|
}
|
|
1964
1964
|
executableFile = localFile || executableFile;
|
|
1965
1965
|
}
|
|
1966
|
-
launchWithNode = sourceExt.includes(
|
|
1966
|
+
launchWithNode = sourceExt.includes(path33.extname(executableFile));
|
|
1967
1967
|
let proc;
|
|
1968
1968
|
if (process2.platform !== "win32") {
|
|
1969
1969
|
if (launchWithNode) {
|
|
@@ -2803,7 +2803,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2803
2803
|
* @return {Command}
|
|
2804
2804
|
*/
|
|
2805
2805
|
nameFromFilename(filename) {
|
|
2806
|
-
this._name =
|
|
2806
|
+
this._name = path33.basename(filename, path33.extname(filename));
|
|
2807
2807
|
return this;
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
@@ -2817,9 +2817,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2817
2817
|
* @param {string} [path]
|
|
2818
2818
|
* @return {(string|null|Command)}
|
|
2819
2819
|
*/
|
|
2820
|
-
executableDir(
|
|
2821
|
-
if (
|
|
2822
|
-
this._executableDir =
|
|
2820
|
+
executableDir(path34) {
|
|
2821
|
+
if (path34 === void 0) return this._executableDir;
|
|
2822
|
+
this._executableDir = path34;
|
|
2823
2823
|
return this;
|
|
2824
2824
|
}
|
|
2825
2825
|
/**
|
|
@@ -3333,9 +3333,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3333
3333
|
}
|
|
3334
3334
|
};
|
|
3335
3335
|
}
|
|
3336
|
-
function formatIssuePath(
|
|
3337
|
-
if (!
|
|
3338
|
-
return
|
|
3336
|
+
function formatIssuePath(path33) {
|
|
3337
|
+
if (!path33 || path33.length === 0) return "(root)";
|
|
3338
|
+
return path33.map(
|
|
3339
3339
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3340
3340
|
).join(".");
|
|
3341
3341
|
}
|
|
@@ -3456,8 +3456,8 @@ var init_src = __esm({
|
|
|
3456
3456
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3457
3457
|
static fromZod(err) {
|
|
3458
3458
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3459
|
-
const
|
|
3460
|
-
const message = first ? `${
|
|
3459
|
+
const path33 = formatIssuePath(first?.path);
|
|
3460
|
+
const message = first ? `${path33}: ${first.message}` : "Schema validation failed";
|
|
3461
3461
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3462
3462
|
}
|
|
3463
3463
|
static wrap(source, code, err) {
|
|
@@ -4014,12 +4014,12 @@ var init_schemas = __esm({
|
|
|
4014
4014
|
init_cjs_shims();
|
|
4015
4015
|
import_zod = require("zod");
|
|
4016
4016
|
init_src();
|
|
4017
|
-
formatIssuePath2 = (
|
|
4017
|
+
formatIssuePath2 = (path33) => path33.length > 0 ? path33.map(
|
|
4018
4018
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4019
4019
|
).join(".") : "<root>";
|
|
4020
4020
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4021
|
-
const
|
|
4022
|
-
return `${
|
|
4021
|
+
const path33 = formatIssuePath2(issue.path);
|
|
4022
|
+
return `${path33}: ${issue.message}`;
|
|
4023
4023
|
}).join("; ");
|
|
4024
4024
|
parseWithSchema = (schema, data, label) => {
|
|
4025
4025
|
const parsed = schema.safeParse(data);
|
|
@@ -4625,7 +4625,7 @@ var init_schemas2 = __esm({
|
|
|
4625
4625
|
init_cjs_shims();
|
|
4626
4626
|
init_src();
|
|
4627
4627
|
import_zod2 = require("zod");
|
|
4628
|
-
formatIssuePath3 = (
|
|
4628
|
+
formatIssuePath3 = (path33) => path33.length > 0 ? path33.map(
|
|
4629
4629
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4630
4630
|
).join(".") : "<root>";
|
|
4631
4631
|
isPlainObject = (value) => {
|
|
@@ -4634,8 +4634,8 @@ var init_schemas2 = __esm({
|
|
|
4634
4634
|
return proto === Object.prototype || proto === null;
|
|
4635
4635
|
};
|
|
4636
4636
|
formatIssues2 = (error) => error.issues.map((issue) => {
|
|
4637
|
-
const
|
|
4638
|
-
return `${
|
|
4637
|
+
const path33 = formatIssuePath3(issue.path);
|
|
4638
|
+
return `${path33}: ${issue.message}`;
|
|
4639
4639
|
}).join("; ");
|
|
4640
4640
|
parseWithSchema2 = (schema, data, label) => {
|
|
4641
4641
|
const parsed = schema.safeParse(data);
|
|
@@ -6255,7 +6255,7 @@ var init_nativeBridge = __esm({
|
|
|
6255
6255
|
"use strict";
|
|
6256
6256
|
init_cjs_shims();
|
|
6257
6257
|
init_src();
|
|
6258
|
-
_loadNative = (
|
|
6258
|
+
_loadNative = (path33) => require(path33);
|
|
6259
6259
|
log3 = (...args) => {
|
|
6260
6260
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6261
6261
|
console.log("[compiler:native]", ...args);
|
|
@@ -6408,14 +6408,41 @@ var init_routeGraph = __esm({
|
|
|
6408
6408
|
}
|
|
6409
6409
|
});
|
|
6410
6410
|
|
|
6411
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
6412
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
6413
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
6414
|
+
"use strict";
|
|
6415
|
+
init_cjs_shims();
|
|
6416
|
+
}
|
|
6417
|
+
});
|
|
6418
|
+
|
|
6419
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
6420
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
6421
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
6422
|
+
"use strict";
|
|
6423
|
+
init_cjs_shims();
|
|
6424
|
+
}
|
|
6425
|
+
});
|
|
6426
|
+
|
|
6427
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
6428
|
+
var import_node_fs11, import_node_path26;
|
|
6429
|
+
var init_typeGenerationPlugin = __esm({
|
|
6430
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
6431
|
+
"use strict";
|
|
6432
|
+
init_cjs_shims();
|
|
6433
|
+
import_node_fs11 = __toESM(require("fs"), 1);
|
|
6434
|
+
import_node_path26 = __toESM(require("path"), 1);
|
|
6435
|
+
}
|
|
6436
|
+
});
|
|
6437
|
+
|
|
6411
6438
|
// packages/domain/compiler/src/index.ts
|
|
6412
|
-
var
|
|
6439
|
+
var import_node_fs12, import_node_path27, import_node_module4, _require3, compileCssFromClasses;
|
|
6413
6440
|
var init_src4 = __esm({
|
|
6414
6441
|
"packages/domain/compiler/src/index.ts"() {
|
|
6415
6442
|
"use strict";
|
|
6416
6443
|
init_cjs_shims();
|
|
6417
|
-
|
|
6418
|
-
|
|
6444
|
+
import_node_fs12 = __toESM(require("fs"), 1);
|
|
6445
|
+
import_node_path27 = __toESM(require("path"), 1);
|
|
6419
6446
|
import_node_module4 = require("module");
|
|
6420
6447
|
init_nativeBridge();
|
|
6421
6448
|
init_compiler();
|
|
@@ -6425,6 +6452,9 @@ var init_src4 = __esm({
|
|
|
6425
6452
|
init_redis();
|
|
6426
6453
|
init_watch();
|
|
6427
6454
|
init_routeGraph();
|
|
6455
|
+
init_semanticComponentAnalyzer();
|
|
6456
|
+
init_typeGeneratorFromMetadata();
|
|
6457
|
+
init_typeGenerationPlugin();
|
|
6428
6458
|
_require3 = (0, import_node_module4.createRequire)(
|
|
6429
6459
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
6430
6460
|
);
|
|
@@ -8767,7 +8797,7 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8767
8797
|
const tokens = {};
|
|
8768
8798
|
const { variables = {}, variableCollections = {} } = variablesData;
|
|
8769
8799
|
for (const [id, variable] of Object.entries(variables)) {
|
|
8770
|
-
const collection = variableCollections[variable.variableCollectionId];
|
|
8800
|
+
const collection = variableCollections?.[variable.variableCollectionId];
|
|
8771
8801
|
if (!collection) continue;
|
|
8772
8802
|
const modeId = Object.keys(variable.valuesByMode)[0];
|
|
8773
8803
|
const rawValue = variable.valuesByMode[modeId];
|
|
@@ -8782,12 +8812,13 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8782
8812
|
}
|
|
8783
8813
|
const leafKey = parts[parts.length - 1];
|
|
8784
8814
|
if (variable.resolvedType === "COLOR") {
|
|
8785
|
-
|
|
8786
|
-
$value: typeof rawValue === "object" && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8787
|
-
$type: "color"
|
|
8788
|
-
$description: variable.description || void 0,
|
|
8789
|
-
_figmaId: id
|
|
8815
|
+
const token = {
|
|
8816
|
+
$value: typeof rawValue === "object" && rawValue !== null && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8817
|
+
$type: "color"
|
|
8790
8818
|
};
|
|
8819
|
+
if (variable.description) token.$description = variable.description;
|
|
8820
|
+
token._figmaId = id;
|
|
8821
|
+
cursor[leafKey] = token;
|
|
8791
8822
|
} else if (variable.resolvedType === "FLOAT") {
|
|
8792
8823
|
cursor[leafKey] = {
|
|
8793
8824
|
$value: typeof rawValue === "number" ? `${rawValue}px` : String(rawValue),
|
|
@@ -8809,10 +8840,11 @@ function figmaVariablesToTokens(variablesData) {
|
|
|
8809
8840
|
init_cjs_shims();
|
|
8810
8841
|
function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
8811
8842
|
const updates = [];
|
|
8812
|
-
function walk(obj,
|
|
8843
|
+
function walk(obj, path33 = []) {
|
|
8813
8844
|
for (const [key, val] of Object.entries(obj)) {
|
|
8814
|
-
if (val
|
|
8815
|
-
const
|
|
8845
|
+
if (typeof val === "object" && val !== null && "$value" in val) {
|
|
8846
|
+
const tokenVal = val;
|
|
8847
|
+
const name = path33.concat(key).map(
|
|
8816
8848
|
(p) => p.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
|
|
8817
8849
|
).join("/");
|
|
8818
8850
|
const existing = Object.values(existingVariables).find(
|
|
@@ -8822,12 +8854,12 @@ function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
|
8822
8854
|
updates.push({
|
|
8823
8855
|
id: existing.id,
|
|
8824
8856
|
name,
|
|
8825
|
-
value:
|
|
8826
|
-
type:
|
|
8857
|
+
value: tokenVal.$value,
|
|
8858
|
+
type: tokenVal.$type
|
|
8827
8859
|
});
|
|
8828
8860
|
}
|
|
8829
|
-
} else if (typeof val === "object" && !val
|
|
8830
|
-
walk(val,
|
|
8861
|
+
} else if (typeof val === "object" && val !== null && !("$type" in val)) {
|
|
8862
|
+
walk(val, path33.concat(key));
|
|
8831
8863
|
}
|
|
8832
8864
|
}
|
|
8833
8865
|
}
|
|
@@ -8837,9 +8869,10 @@ function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
|
8837
8869
|
function flattenTokens(obj, prefix = "", target = {}) {
|
|
8838
8870
|
for (const [k, v] of Object.entries(obj)) {
|
|
8839
8871
|
const key = [prefix, k].filter(Boolean).join(".");
|
|
8840
|
-
if (v
|
|
8841
|
-
|
|
8842
|
-
|
|
8872
|
+
if (typeof v === "object" && v !== null && "$value" in v) {
|
|
8873
|
+
const tokenVal = v;
|
|
8874
|
+
target[key] = tokenVal.$value;
|
|
8875
|
+
} else if (typeof v === "object" && v !== null && !("$type" in v)) {
|
|
8843
8876
|
flattenTokens(v, key, target);
|
|
8844
8877
|
}
|
|
8845
8878
|
}
|
|
@@ -8870,7 +8903,7 @@ var figmaCommand = {
|
|
|
8870
8903
|
const FIGMA_FILE_KEY = process.env.FIGMA_FILE_KEY;
|
|
8871
8904
|
const TOKEN_FILE = import_node_path23.default.join(context.cwd, "tokens.sync.json");
|
|
8872
8905
|
if (!cmd || cmd === "help") {
|
|
8873
|
-
context.output.
|
|
8906
|
+
context.output.writeText(`Usage: tw figma <pull|push|diff> [--dry-run]
|
|
8874
8907
|
|
|
8875
8908
|
Environment variables:
|
|
8876
8909
|
FIGMA_TOKEN \u2014 Figma personal access token (figd_...)
|
|
@@ -8892,16 +8925,18 @@ Options:
|
|
|
8892
8925
|
);
|
|
8893
8926
|
}
|
|
8894
8927
|
try {
|
|
8895
|
-
context.output.
|
|
8928
|
+
const spinner = context.output.spinner();
|
|
8929
|
+
spinner.start("Fetching Figma variables...");
|
|
8896
8930
|
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8897
8931
|
token: FIGMA_TOKEN,
|
|
8898
8932
|
fileKey: FIGMA_FILE_KEY
|
|
8899
8933
|
});
|
|
8934
|
+
spinner.stop();
|
|
8900
8935
|
const tokens = figmaVariablesToTokens(data);
|
|
8901
8936
|
const variableCount = Object.values(data.variables ?? {}).length;
|
|
8902
8937
|
if (isDryRun) {
|
|
8903
|
-
context.output.
|
|
8904
|
-
context.output.
|
|
8938
|
+
context.output.info("DRY RUN \u2014 would write:");
|
|
8939
|
+
context.output.writeText(JSON.stringify({ version: 1, tokens }, null, 2));
|
|
8905
8940
|
} else {
|
|
8906
8941
|
let existing = { version: 1, tokens: {} };
|
|
8907
8942
|
if (import_node_fs9.default.existsSync(TOKEN_FILE)) {
|
|
@@ -8942,15 +8977,15 @@ Options:
|
|
|
8942
8977
|
token: FIGMA_TOKEN,
|
|
8943
8978
|
fileKey: FIGMA_FILE_KEY
|
|
8944
8979
|
});
|
|
8945
|
-
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables ?? {});
|
|
8980
|
+
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables?.length ? Object.entries(data.variables ?? {}).reduce((acc, [id, v]) => ({ ...acc, [id]: { ...v, id } }), {}) : {});
|
|
8946
8981
|
if (isDryRun) {
|
|
8947
|
-
context.output.
|
|
8948
|
-
`
|
|
8982
|
+
context.output.info(
|
|
8983
|
+
`DRY RUN \u2014 would update ${updates.length} variables in Figma:`
|
|
8949
8984
|
);
|
|
8950
|
-
updates.forEach((u) => context.output.
|
|
8985
|
+
updates.forEach((u) => context.output.writeText(` ${u.name}: ${u.value}`));
|
|
8951
8986
|
} else {
|
|
8952
8987
|
if (updates.length === 0) {
|
|
8953
|
-
context.output.
|
|
8988
|
+
context.output.info("No matching variables to update");
|
|
8954
8989
|
} else {
|
|
8955
8990
|
context.output.success(`Updated ${updates.length} variables in Figma`);
|
|
8956
8991
|
}
|
|
@@ -8984,12 +9019,12 @@ Options:
|
|
|
8984
9019
|
if (diffs.length === 0) {
|
|
8985
9020
|
context.output.success("No differences \u2014 local and Figma are in sync");
|
|
8986
9021
|
} else {
|
|
8987
|
-
context.output.
|
|
9022
|
+
context.output.info(`${diffs.length} differences found:
|
|
8988
9023
|
`);
|
|
8989
9024
|
diffs.forEach((d) => {
|
|
8990
|
-
context.output.
|
|
8991
|
-
context.output.
|
|
8992
|
-
context.output.
|
|
9025
|
+
context.output.writeText(` ${d.key}`);
|
|
9026
|
+
context.output.writeText(` local: ${d.local ?? "(missing)"}`);
|
|
9027
|
+
context.output.writeText(` figma: ${d.figma ?? "(missing)"}`);
|
|
8993
9028
|
});
|
|
8994
9029
|
}
|
|
8995
9030
|
} catch (e) {
|
|
@@ -9374,7 +9409,7 @@ init_cjs_shims();
|
|
|
9374
9409
|
|
|
9375
9410
|
// packages/infrastructure/cli/src/preflight.ts
|
|
9376
9411
|
init_cjs_shims();
|
|
9377
|
-
var
|
|
9412
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
9378
9413
|
var import_node_url7 = require("url");
|
|
9379
9414
|
init_args();
|
|
9380
9415
|
init_errors();
|
|
@@ -9407,8 +9442,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
9407
9442
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9408
9443
|
let configPath = null;
|
|
9409
9444
|
for (const file of twConfigFiles) {
|
|
9410
|
-
if (await pathExists2(
|
|
9411
|
-
configPath =
|
|
9445
|
+
if (await pathExists2(import_node_path28.default.join(cwd2, file))) {
|
|
9446
|
+
configPath = import_node_path28.default.join(cwd2, file);
|
|
9412
9447
|
break;
|
|
9413
9448
|
}
|
|
9414
9449
|
}
|
|
@@ -9499,7 +9534,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
9499
9534
|
async function hasTailwindCssImport(cwd2) {
|
|
9500
9535
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
9501
9536
|
for (const file of cssFiles) {
|
|
9502
|
-
const raw = await readFileSafe(
|
|
9537
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9503
9538
|
if (raw?.includes("tailwindcss")) return true;
|
|
9504
9539
|
}
|
|
9505
9540
|
return false;
|
|
@@ -9515,7 +9550,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
9515
9550
|
"app/globals.css"
|
|
9516
9551
|
];
|
|
9517
9552
|
for (const file of cssFiles) {
|
|
9518
|
-
const raw = await readFileSafe(
|
|
9553
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9519
9554
|
if (raw === null) continue;
|
|
9520
9555
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
9521
9556
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -9523,8 +9558,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
9523
9558
|
return { found: false, cssFile: null };
|
|
9524
9559
|
}
|
|
9525
9560
|
async function applyTailwindInit(cwd2) {
|
|
9526
|
-
await ensureFileSafe(
|
|
9527
|
-
await ensureFileSafe(
|
|
9561
|
+
await ensureFileSafe(import_node_path28.default.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9562
|
+
await ensureFileSafe(import_node_path28.default.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
9528
9563
|
}
|
|
9529
9564
|
function check(results, id, label, pass, message, fix) {
|
|
9530
9565
|
results.push({ id, label, pass, message, fix });
|
|
@@ -9546,7 +9581,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9546
9581
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
9547
9582
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
9548
9583
|
);
|
|
9549
|
-
const pkg = await readJsonSafe(
|
|
9584
|
+
const pkg = await readJsonSafe(import_node_path28.default.join(cwd2, "package.json"));
|
|
9550
9585
|
check(
|
|
9551
9586
|
results,
|
|
9552
9587
|
"package-json",
|
|
@@ -9580,7 +9615,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9580
9615
|
}
|
|
9581
9616
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9582
9617
|
const twConfigChecks = await Promise.all(
|
|
9583
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9618
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path28.default.join(cwd2, file)) }))
|
|
9584
9619
|
);
|
|
9585
9620
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9586
9621
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9592,7 +9627,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9592
9627
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9593
9628
|
"tw init"
|
|
9594
9629
|
);
|
|
9595
|
-
const oldConfig = await readJsonSafe(
|
|
9630
|
+
const oldConfig = await readJsonSafe(import_node_path28.default.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(import_node_path28.default.join(cwd2, "tailwind.config.ts"));
|
|
9596
9631
|
if (oldConfig) {
|
|
9597
9632
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9598
9633
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9616,7 +9651,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9616
9651
|
validation.message
|
|
9617
9652
|
);
|
|
9618
9653
|
}
|
|
9619
|
-
const hasTsConfig = await pathExists2(
|
|
9654
|
+
const hasTsConfig = await pathExists2(import_node_path28.default.join(cwd2, "tsconfig.json"));
|
|
9620
9655
|
check(
|
|
9621
9656
|
results,
|
|
9622
9657
|
"typescript",
|
|
@@ -9975,7 +10010,7 @@ var scriptCommands = [
|
|
|
9975
10010
|
|
|
9976
10011
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9977
10012
|
init_cjs_shims();
|
|
9978
|
-
var
|
|
10013
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
9979
10014
|
var import_node_util11 = require("util");
|
|
9980
10015
|
init_errors();
|
|
9981
10016
|
init_fs();
|
|
@@ -10017,7 +10052,7 @@ var storybookCommand = {
|
|
|
10017
10052
|
context.output.writeText(
|
|
10018
10053
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
10019
10054
|
);
|
|
10020
|
-
const localBin =
|
|
10055
|
+
const localBin = import_node_path29.default.join(
|
|
10021
10056
|
process.cwd(),
|
|
10022
10057
|
"node_modules",
|
|
10023
10058
|
".bin",
|
|
@@ -11203,12 +11238,12 @@ async function traceClass(className, options) {
|
|
|
11203
11238
|
|
|
11204
11239
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
11205
11240
|
init_cjs_shims();
|
|
11206
|
-
var
|
|
11207
|
-
var
|
|
11241
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
11242
|
+
var import_node_path30 = __toESM(require("path"), 1);
|
|
11208
11243
|
init_internal();
|
|
11209
11244
|
init_src2();
|
|
11210
11245
|
function toRelativePath(root, value) {
|
|
11211
|
-
const relative =
|
|
11246
|
+
const relative = import_node_path30.default.relative(root, value);
|
|
11212
11247
|
return relative.length > 0 ? relative : ".";
|
|
11213
11248
|
}
|
|
11214
11249
|
function uniqueSorted(values) {
|
|
@@ -11277,7 +11312,7 @@ function tryCompileClasses(classes) {
|
|
|
11277
11312
|
}
|
|
11278
11313
|
}
|
|
11279
11314
|
function traceSingleFile(filePath, root) {
|
|
11280
|
-
const source =
|
|
11315
|
+
const source = import_node_fs13.default.readFileSync(filePath, "utf8");
|
|
11281
11316
|
const classes = uniqueSorted(scanSource(source));
|
|
11282
11317
|
const imports = extractImports(source);
|
|
11283
11318
|
const compiled = tryCompileClasses(classes);
|
|
@@ -11308,7 +11343,7 @@ function traceDirectory(targetDir, root) {
|
|
|
11308
11343
|
const imports = [];
|
|
11309
11344
|
const importKeys = /* @__PURE__ */ new Set();
|
|
11310
11345
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
11311
|
-
const source =
|
|
11346
|
+
const source = import_node_fs13.default.readFileSync(entry.file, "utf8");
|
|
11312
11347
|
const fileImports = extractImports(source);
|
|
11313
11348
|
for (const fileImport of fileImports) {
|
|
11314
11349
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -11339,12 +11374,12 @@ function traceDirectory(targetDir, root) {
|
|
|
11339
11374
|
};
|
|
11340
11375
|
}
|
|
11341
11376
|
async function traceTarget(target, options = {}) {
|
|
11342
|
-
const root =
|
|
11343
|
-
const resolvedTarget =
|
|
11344
|
-
if (!
|
|
11377
|
+
const root = import_node_path30.default.resolve(options.root ?? process.cwd());
|
|
11378
|
+
const resolvedTarget = import_node_path30.default.resolve(root, target);
|
|
11379
|
+
if (!import_node_fs13.default.existsSync(resolvedTarget)) {
|
|
11345
11380
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
11346
11381
|
}
|
|
11347
|
-
const stat =
|
|
11382
|
+
const stat = import_node_fs13.default.statSync(resolvedTarget);
|
|
11348
11383
|
if (stat.isDirectory()) {
|
|
11349
11384
|
return traceDirectory(resolvedTarget, root);
|
|
11350
11385
|
}
|
|
@@ -11507,8 +11542,8 @@ function printClassTraceOutput(result, output) {
|
|
|
11507
11542
|
|
|
11508
11543
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
11509
11544
|
init_cjs_shims();
|
|
11510
|
-
var
|
|
11511
|
-
var
|
|
11545
|
+
var import_node_fs14 = __toESM(require("fs"), 1);
|
|
11546
|
+
var import_node_path31 = __toESM(require("path"), 1);
|
|
11512
11547
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
11513
11548
|
init_output();
|
|
11514
11549
|
async function runGenerateTypesCli(rawArgs) {
|
|
@@ -11516,7 +11551,7 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11516
11551
|
const logger = createCliLogger({ output });
|
|
11517
11552
|
const cwd2 = process.cwd();
|
|
11518
11553
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
11519
|
-
const outPath =
|
|
11554
|
+
const outPath = import_node_path31.default.resolve(cwd2, outFile);
|
|
11520
11555
|
output.writeText("");
|
|
11521
11556
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
11522
11557
|
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"));
|
|
@@ -11552,12 +11587,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11552
11587
|
}
|
|
11553
11588
|
output.writeText("");
|
|
11554
11589
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
11555
|
-
const outDir =
|
|
11556
|
-
if (!
|
|
11557
|
-
|
|
11590
|
+
const outDir = import_node_path31.default.dirname(outPath);
|
|
11591
|
+
if (!import_node_fs14.default.existsSync(outDir)) {
|
|
11592
|
+
import_node_fs14.default.mkdirSync(outDir, { recursive: true });
|
|
11558
11593
|
}
|
|
11559
|
-
|
|
11560
|
-
logger.ok(
|
|
11594
|
+
import_node_fs14.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11595
|
+
logger.ok(import_node_path31.default.relative(cwd2, outPath));
|
|
11561
11596
|
output.writeText("");
|
|
11562
11597
|
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"));
|
|
11563
11598
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -11568,11 +11603,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11568
11603
|
}
|
|
11569
11604
|
async function loadNativeBinding2(cwd2) {
|
|
11570
11605
|
const candidates = [
|
|
11571
|
-
|
|
11572
|
-
|
|
11606
|
+
import_node_path31.default.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11607
|
+
import_node_path31.default.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
11573
11608
|
];
|
|
11574
11609
|
for (const candidate of candidates) {
|
|
11575
|
-
if (
|
|
11610
|
+
if (import_node_fs14.default.existsSync(candidate)) {
|
|
11576
11611
|
try {
|
|
11577
11612
|
return require(candidate);
|
|
11578
11613
|
} catch {
|
|
@@ -11589,8 +11624,8 @@ init_errors();
|
|
|
11589
11624
|
|
|
11590
11625
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11591
11626
|
init_cjs_shims();
|
|
11592
|
-
var
|
|
11593
|
-
var
|
|
11627
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
|
11628
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
|
11594
11629
|
init_internal();
|
|
11595
11630
|
init_src2();
|
|
11596
11631
|
function extractVariantChain(usage) {
|
|
@@ -11639,7 +11674,7 @@ async function whyClass(className, options) {
|
|
|
11639
11674
|
for (const file of scanResult.files) {
|
|
11640
11675
|
const source = (() => {
|
|
11641
11676
|
try {
|
|
11642
|
-
return
|
|
11677
|
+
return import_node_fs15.default.readFileSync(file.file, "utf8");
|
|
11643
11678
|
} catch {
|
|
11644
11679
|
return "";
|
|
11645
11680
|
}
|
|
@@ -11653,7 +11688,7 @@ async function whyClass(className, options) {
|
|
|
11653
11688
|
className
|
|
11654
11689
|
]);
|
|
11655
11690
|
usedIn.push({
|
|
11656
|
-
file:
|
|
11691
|
+
file: import_node_path32.default.relative(root, file.file) || import_node_path32.default.basename(file.file),
|
|
11657
11692
|
line: location.line,
|
|
11658
11693
|
column: location.column,
|
|
11659
11694
|
usage: normalizeScannedClass(fileClass)
|