tailwind-styled-v4 5.1.21 → 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.d.mts +28 -16
- package/dist/cli.d.ts +28 -16
- package/dist/cli.js +392 -77
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +388 -75
- 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 +390 -77
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +387 -75
- 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/dist/cli.mjs
CHANGED
|
@@ -997,8 +997,8 @@ var require_command = __commonJS({
|
|
|
997
997
|
init_esm_shims();
|
|
998
998
|
var EventEmitter = __require("events").EventEmitter;
|
|
999
999
|
var childProcess = __require("child_process");
|
|
1000
|
-
var
|
|
1001
|
-
var
|
|
1000
|
+
var path34 = __require("path");
|
|
1001
|
+
var fs19 = __require("fs");
|
|
1002
1002
|
var process2 = __require("process");
|
|
1003
1003
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
1004
1004
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -1930,11 +1930,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1930
1930
|
let launchWithNode = false;
|
|
1931
1931
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1932
1932
|
function findFile(baseDir, baseName) {
|
|
1933
|
-
const localBin =
|
|
1934
|
-
if (
|
|
1935
|
-
if (sourceExt.includes(
|
|
1933
|
+
const localBin = path34.resolve(baseDir, baseName);
|
|
1934
|
+
if (fs19.existsSync(localBin)) return localBin;
|
|
1935
|
+
if (sourceExt.includes(path34.extname(baseName))) return void 0;
|
|
1936
1936
|
const foundExt = sourceExt.find(
|
|
1937
|
-
(ext) =>
|
|
1937
|
+
(ext) => fs19.existsSync(`${localBin}${ext}`)
|
|
1938
1938
|
);
|
|
1939
1939
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
1940
1940
|
return void 0;
|
|
@@ -1946,21 +1946,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1946
1946
|
if (this._scriptPath) {
|
|
1947
1947
|
let resolvedScriptPath;
|
|
1948
1948
|
try {
|
|
1949
|
-
resolvedScriptPath =
|
|
1949
|
+
resolvedScriptPath = fs19.realpathSync(this._scriptPath);
|
|
1950
1950
|
} catch (err) {
|
|
1951
1951
|
resolvedScriptPath = this._scriptPath;
|
|
1952
1952
|
}
|
|
1953
|
-
executableDir =
|
|
1954
|
-
|
|
1953
|
+
executableDir = path34.resolve(
|
|
1954
|
+
path34.dirname(resolvedScriptPath),
|
|
1955
1955
|
executableDir
|
|
1956
1956
|
);
|
|
1957
1957
|
}
|
|
1958
1958
|
if (executableDir) {
|
|
1959
1959
|
let localFile = findFile(executableDir, executableFile);
|
|
1960
1960
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1961
|
-
const legacyName =
|
|
1961
|
+
const legacyName = path34.basename(
|
|
1962
1962
|
this._scriptPath,
|
|
1963
|
-
|
|
1963
|
+
path34.extname(this._scriptPath)
|
|
1964
1964
|
);
|
|
1965
1965
|
if (legacyName !== this._name) {
|
|
1966
1966
|
localFile = findFile(
|
|
@@ -1971,7 +1971,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1971
1971
|
}
|
|
1972
1972
|
executableFile = localFile || executableFile;
|
|
1973
1973
|
}
|
|
1974
|
-
launchWithNode = sourceExt.includes(
|
|
1974
|
+
launchWithNode = sourceExt.includes(path34.extname(executableFile));
|
|
1975
1975
|
let proc;
|
|
1976
1976
|
if (process2.platform !== "win32") {
|
|
1977
1977
|
if (launchWithNode) {
|
|
@@ -2811,7 +2811,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2811
2811
|
* @return {Command}
|
|
2812
2812
|
*/
|
|
2813
2813
|
nameFromFilename(filename) {
|
|
2814
|
-
this._name =
|
|
2814
|
+
this._name = path34.basename(filename, path34.extname(filename));
|
|
2815
2815
|
return this;
|
|
2816
2816
|
}
|
|
2817
2817
|
/**
|
|
@@ -2825,9 +2825,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2825
2825
|
* @param {string} [path]
|
|
2826
2826
|
* @return {(string|null|Command)}
|
|
2827
2827
|
*/
|
|
2828
|
-
executableDir(
|
|
2829
|
-
if (
|
|
2830
|
-
this._executableDir =
|
|
2828
|
+
executableDir(path35) {
|
|
2829
|
+
if (path35 === void 0) return this._executableDir;
|
|
2830
|
+
this._executableDir = path35;
|
|
2831
2831
|
return this;
|
|
2832
2832
|
}
|
|
2833
2833
|
/**
|
|
@@ -3345,9 +3345,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3345
3345
|
}
|
|
3346
3346
|
};
|
|
3347
3347
|
}
|
|
3348
|
-
function formatIssuePath(
|
|
3349
|
-
if (!
|
|
3350
|
-
return
|
|
3348
|
+
function formatIssuePath(path34) {
|
|
3349
|
+
if (!path34 || path34.length === 0) return "(root)";
|
|
3350
|
+
return path34.map(
|
|
3351
3351
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3352
3352
|
).join(".");
|
|
3353
3353
|
}
|
|
@@ -3463,8 +3463,8 @@ var init_src = __esm({
|
|
|
3463
3463
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3464
3464
|
static fromZod(err) {
|
|
3465
3465
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3466
|
-
const
|
|
3467
|
-
const message = first ? `${
|
|
3466
|
+
const path34 = formatIssuePath(first?.path);
|
|
3467
|
+
const message = first ? `${path34}: ${first.message}` : "Schema validation failed";
|
|
3468
3468
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3469
3469
|
}
|
|
3470
3470
|
static wrap(source, code, err) {
|
|
@@ -4020,12 +4020,12 @@ var init_schemas = __esm({
|
|
|
4020
4020
|
"use strict";
|
|
4021
4021
|
init_esm_shims();
|
|
4022
4022
|
init_src();
|
|
4023
|
-
formatIssuePath2 = (
|
|
4023
|
+
formatIssuePath2 = (path34) => path34.length > 0 ? path34.map(
|
|
4024
4024
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4025
4025
|
).join(".") : "<root>";
|
|
4026
4026
|
formatIssues = (error) => error.issues.map((issue) => {
|
|
4027
|
-
const
|
|
4028
|
-
return `${
|
|
4027
|
+
const path34 = formatIssuePath2(issue.path);
|
|
4028
|
+
return `${path34}: ${issue.message}`;
|
|
4029
4029
|
}).join("; ");
|
|
4030
4030
|
parseWithSchema = (schema, data, label) => {
|
|
4031
4031
|
const parsed = schema.safeParse(data);
|
|
@@ -4630,7 +4630,7 @@ var init_schemas2 = __esm({
|
|
|
4630
4630
|
"use strict";
|
|
4631
4631
|
init_esm_shims();
|
|
4632
4632
|
init_src();
|
|
4633
|
-
formatIssuePath3 = (
|
|
4633
|
+
formatIssuePath3 = (path34) => path34.length > 0 ? path34.map(
|
|
4634
4634
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4635
4635
|
).join(".") : "<root>";
|
|
4636
4636
|
isPlainObject = (value) => {
|
|
@@ -4639,8 +4639,8 @@ var init_schemas2 = __esm({
|
|
|
4639
4639
|
return proto === Object.prototype || proto === null;
|
|
4640
4640
|
};
|
|
4641
4641
|
formatIssues2 = (error) => error.issues.map((issue) => {
|
|
4642
|
-
const
|
|
4643
|
-
return `${
|
|
4642
|
+
const path34 = formatIssuePath3(issue.path);
|
|
4643
|
+
return `${path34}: ${issue.message}`;
|
|
4644
4644
|
}).join("; ");
|
|
4645
4645
|
parseWithSchema2 = (schema, data, label) => {
|
|
4646
4646
|
const parsed = schema.safeParse(data);
|
|
@@ -6261,7 +6261,7 @@ var init_nativeBridge = __esm({
|
|
|
6261
6261
|
"use strict";
|
|
6262
6262
|
init_esm_shims();
|
|
6263
6263
|
init_src();
|
|
6264
|
-
_loadNative = (
|
|
6264
|
+
_loadNative = (path34) => __require(path34);
|
|
6265
6265
|
log3 = (...args) => {
|
|
6266
6266
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
6267
6267
|
console.log("[compiler:native]", ...args);
|
|
@@ -6404,8 +6404,8 @@ var init_watch = __esm({
|
|
|
6404
6404
|
});
|
|
6405
6405
|
|
|
6406
6406
|
// packages/domain/compiler/src/routeGraph.ts
|
|
6407
|
-
import
|
|
6408
|
-
import
|
|
6407
|
+
import fs13 from "fs";
|
|
6408
|
+
import path26 from "path";
|
|
6409
6409
|
var init_routeGraph = __esm({
|
|
6410
6410
|
"packages/domain/compiler/src/routeGraph.ts"() {
|
|
6411
6411
|
"use strict";
|
|
@@ -6413,9 +6413,35 @@ var init_routeGraph = __esm({
|
|
|
6413
6413
|
}
|
|
6414
6414
|
});
|
|
6415
6415
|
|
|
6416
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
6417
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
6418
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
6419
|
+
"use strict";
|
|
6420
|
+
init_esm_shims();
|
|
6421
|
+
}
|
|
6422
|
+
});
|
|
6423
|
+
|
|
6424
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
6425
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
6426
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
6427
|
+
"use strict";
|
|
6428
|
+
init_esm_shims();
|
|
6429
|
+
}
|
|
6430
|
+
});
|
|
6431
|
+
|
|
6432
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
6433
|
+
import fs14 from "fs";
|
|
6434
|
+
import path27 from "path";
|
|
6435
|
+
var init_typeGenerationPlugin = __esm({
|
|
6436
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
6437
|
+
"use strict";
|
|
6438
|
+
init_esm_shims();
|
|
6439
|
+
}
|
|
6440
|
+
});
|
|
6441
|
+
|
|
6416
6442
|
// packages/domain/compiler/src/index.ts
|
|
6417
|
-
import
|
|
6418
|
-
import
|
|
6443
|
+
import fs15 from "fs";
|
|
6444
|
+
import path28 from "path";
|
|
6419
6445
|
import { createRequire as createRequire4 } from "module";
|
|
6420
6446
|
var _require3, compileCssFromClasses;
|
|
6421
6447
|
var init_src4 = __esm({
|
|
@@ -6430,6 +6456,9 @@ var init_src4 = __esm({
|
|
|
6430
6456
|
init_redis();
|
|
6431
6457
|
init_watch();
|
|
6432
6458
|
init_routeGraph();
|
|
6459
|
+
init_semanticComponentAnalyzer();
|
|
6460
|
+
init_typeGeneratorFromMetadata();
|
|
6461
|
+
init_typeGenerationPlugin();
|
|
6433
6462
|
_require3 = createRequire4(
|
|
6434
6463
|
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
6435
6464
|
);
|
|
@@ -8736,12 +8765,289 @@ function printDoctorOutput(result, output) {
|
|
|
8736
8765
|
);
|
|
8737
8766
|
}
|
|
8738
8767
|
|
|
8768
|
+
// packages/infrastructure/cli/src/commands/figma.ts
|
|
8769
|
+
init_esm_shims();
|
|
8770
|
+
init_errors();
|
|
8771
|
+
import fs12 from "fs";
|
|
8772
|
+
import path24 from "path";
|
|
8773
|
+
|
|
8774
|
+
// packages/infrastructure/cli/src/utils/figmaApi.ts
|
|
8775
|
+
init_esm_shims();
|
|
8776
|
+
async function figmaRequest(endpoint, options) {
|
|
8777
|
+
const { token, fileKey } = options;
|
|
8778
|
+
if (!token) {
|
|
8779
|
+
throw new Error("FIGMA_TOKEN environment variable not set");
|
|
8780
|
+
}
|
|
8781
|
+
if (!fileKey) {
|
|
8782
|
+
throw new Error("FIGMA_FILE_KEY environment variable not set");
|
|
8783
|
+
}
|
|
8784
|
+
const url = `https://api.figma.com/v1${endpoint.replace(":fileKey", fileKey)}`;
|
|
8785
|
+
const res = await fetch(url, {
|
|
8786
|
+
headers: { "X-Figma-Token": token }
|
|
8787
|
+
});
|
|
8788
|
+
if (!res.ok) {
|
|
8789
|
+
const body = await res.text();
|
|
8790
|
+
throw new Error(`Figma API ${res.status}: ${body.slice(0, 200)}`);
|
|
8791
|
+
}
|
|
8792
|
+
return res.json();
|
|
8793
|
+
}
|
|
8794
|
+
function figmaColorToHex(color) {
|
|
8795
|
+
const { r, g, b, a = 1 } = color;
|
|
8796
|
+
const toHex = (v) => Math.round(v * 255).toString(16).padStart(2, "0");
|
|
8797
|
+
const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
8798
|
+
return a < 1 ? `${hex}${toHex(a)}` : hex;
|
|
8799
|
+
}
|
|
8800
|
+
function figmaVariablesToTokens(variablesData) {
|
|
8801
|
+
const tokens = {};
|
|
8802
|
+
const { variables = {}, variableCollections = {} } = variablesData;
|
|
8803
|
+
for (const [id, variable] of Object.entries(variables)) {
|
|
8804
|
+
const collection = variableCollections?.[variable.variableCollectionId];
|
|
8805
|
+
if (!collection) continue;
|
|
8806
|
+
const modeId = Object.keys(variable.valuesByMode)[0];
|
|
8807
|
+
const rawValue = variable.valuesByMode[modeId];
|
|
8808
|
+
if (rawValue === void 0) continue;
|
|
8809
|
+
const parts = variable.name.split("/").map(
|
|
8810
|
+
(p) => p.toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")
|
|
8811
|
+
);
|
|
8812
|
+
let cursor = tokens;
|
|
8813
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
8814
|
+
cursor[parts[i]] ??= {};
|
|
8815
|
+
cursor = cursor[parts[i]];
|
|
8816
|
+
}
|
|
8817
|
+
const leafKey = parts[parts.length - 1];
|
|
8818
|
+
if (variable.resolvedType === "COLOR") {
|
|
8819
|
+
const token = {
|
|
8820
|
+
$value: typeof rawValue === "object" && rawValue !== null && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8821
|
+
$type: "color"
|
|
8822
|
+
};
|
|
8823
|
+
if (variable.description) token.$description = variable.description;
|
|
8824
|
+
token._figmaId = id;
|
|
8825
|
+
cursor[leafKey] = token;
|
|
8826
|
+
} else if (variable.resolvedType === "FLOAT") {
|
|
8827
|
+
cursor[leafKey] = {
|
|
8828
|
+
$value: typeof rawValue === "number" ? `${rawValue}px` : String(rawValue),
|
|
8829
|
+
$type: "dimension",
|
|
8830
|
+
_figmaId: id
|
|
8831
|
+
};
|
|
8832
|
+
} else if (variable.resolvedType === "STRING") {
|
|
8833
|
+
cursor[leafKey] = {
|
|
8834
|
+
$value: String(rawValue),
|
|
8835
|
+
$type: "other",
|
|
8836
|
+
_figmaId: id
|
|
8837
|
+
};
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8840
|
+
return tokens;
|
|
8841
|
+
}
|
|
8842
|
+
|
|
8843
|
+
// packages/infrastructure/cli/src/utils/tokenUtils.ts
|
|
8844
|
+
init_esm_shims();
|
|
8845
|
+
function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
8846
|
+
const updates = [];
|
|
8847
|
+
function walk(obj, path34 = []) {
|
|
8848
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
8849
|
+
if (typeof val === "object" && val !== null && "$value" in val) {
|
|
8850
|
+
const tokenVal = val;
|
|
8851
|
+
const name = path34.concat(key).map(
|
|
8852
|
+
(p) => p.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
|
|
8853
|
+
).join("/");
|
|
8854
|
+
const existing = Object.values(existingVariables).find(
|
|
8855
|
+
(v) => v.name === name
|
|
8856
|
+
);
|
|
8857
|
+
if (existing) {
|
|
8858
|
+
updates.push({
|
|
8859
|
+
id: existing.id,
|
|
8860
|
+
name,
|
|
8861
|
+
value: tokenVal.$value,
|
|
8862
|
+
type: tokenVal.$type
|
|
8863
|
+
});
|
|
8864
|
+
}
|
|
8865
|
+
} else if (typeof val === "object" && val !== null && !("$type" in val)) {
|
|
8866
|
+
walk(val, path34.concat(key));
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8869
|
+
}
|
|
8870
|
+
walk(tokens);
|
|
8871
|
+
return updates;
|
|
8872
|
+
}
|
|
8873
|
+
function flattenTokens(obj, prefix = "", target = {}) {
|
|
8874
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
8875
|
+
const key = [prefix, k].filter(Boolean).join(".");
|
|
8876
|
+
if (typeof v === "object" && v !== null && "$value" in v) {
|
|
8877
|
+
const tokenVal = v;
|
|
8878
|
+
target[key] = tokenVal.$value;
|
|
8879
|
+
} else if (typeof v === "object" && v !== null && !("$type" in v)) {
|
|
8880
|
+
flattenTokens(v, key, target);
|
|
8881
|
+
}
|
|
8882
|
+
}
|
|
8883
|
+
return target;
|
|
8884
|
+
}
|
|
8885
|
+
function diffTokens(local, figma) {
|
|
8886
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(local), ...Object.keys(figma)]);
|
|
8887
|
+
const diffs = [];
|
|
8888
|
+
for (const key of allKeys) {
|
|
8889
|
+
if (local[key] !== figma[key]) {
|
|
8890
|
+
diffs.push({
|
|
8891
|
+
key,
|
|
8892
|
+
local: local[key],
|
|
8893
|
+
figma: figma[key]
|
|
8894
|
+
});
|
|
8895
|
+
}
|
|
8896
|
+
}
|
|
8897
|
+
return diffs;
|
|
8898
|
+
}
|
|
8899
|
+
|
|
8900
|
+
// packages/infrastructure/cli/src/commands/figma.ts
|
|
8901
|
+
var figmaCommand = {
|
|
8902
|
+
name: "figma",
|
|
8903
|
+
async run(args, context) {
|
|
8904
|
+
const cmd = args[0];
|
|
8905
|
+
const isDryRun = args.includes("--dry-run");
|
|
8906
|
+
const FIGMA_TOKEN = process.env.FIGMA_TOKEN;
|
|
8907
|
+
const FIGMA_FILE_KEY = process.env.FIGMA_FILE_KEY;
|
|
8908
|
+
const TOKEN_FILE = path24.join(context.cwd, "tokens.sync.json");
|
|
8909
|
+
if (!cmd || cmd === "help") {
|
|
8910
|
+
context.output.writeText(`Usage: tw figma <pull|push|diff> [--dry-run]
|
|
8911
|
+
|
|
8912
|
+
Environment variables:
|
|
8913
|
+
FIGMA_TOKEN \u2014 Figma personal access token (figd_...)
|
|
8914
|
+
FIGMA_FILE_KEY \u2014 Figma file key (from URL: figma.com/file/<KEY>/...)
|
|
8915
|
+
|
|
8916
|
+
Commands:
|
|
8917
|
+
pull Import Figma variables \u2192 tokens.sync.json
|
|
8918
|
+
push Export tokens.sync.json \u2192 Figma variables
|
|
8919
|
+
diff Show differences between local and Figma
|
|
8920
|
+
|
|
8921
|
+
Options:
|
|
8922
|
+
--dry-run Show what would change without writing`);
|
|
8923
|
+
return;
|
|
8924
|
+
}
|
|
8925
|
+
if (cmd === "pull") {
|
|
8926
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
8927
|
+
throw new CliUsageError(
|
|
8928
|
+
"Missing FIGMA_TOKEN or FIGMA_FILE_KEY\nSet environment variables and retry\n\nExample:\n export FIGMA_TOKEN=figd_your_token_here\n export FIGMA_FILE_KEY=abc123XYZ"
|
|
8929
|
+
);
|
|
8930
|
+
}
|
|
8931
|
+
try {
|
|
8932
|
+
const spinner = context.output.spinner();
|
|
8933
|
+
spinner.start("Fetching Figma variables...");
|
|
8934
|
+
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8935
|
+
token: FIGMA_TOKEN,
|
|
8936
|
+
fileKey: FIGMA_FILE_KEY
|
|
8937
|
+
});
|
|
8938
|
+
spinner.stop();
|
|
8939
|
+
const tokens = figmaVariablesToTokens(data);
|
|
8940
|
+
const variableCount = Object.values(data.variables ?? {}).length;
|
|
8941
|
+
if (isDryRun) {
|
|
8942
|
+
context.output.info("DRY RUN \u2014 would write:");
|
|
8943
|
+
context.output.writeText(JSON.stringify({ version: 1, tokens }, null, 2));
|
|
8944
|
+
} else {
|
|
8945
|
+
let existing = { version: 1, tokens: {} };
|
|
8946
|
+
if (fs12.existsSync(TOKEN_FILE)) {
|
|
8947
|
+
try {
|
|
8948
|
+
existing = JSON.parse(fs12.readFileSync(TOKEN_FILE, "utf8"));
|
|
8949
|
+
} catch {
|
|
8950
|
+
}
|
|
8951
|
+
}
|
|
8952
|
+
const merged = {
|
|
8953
|
+
...existing,
|
|
8954
|
+
tokens: { ...existing.tokens, ...tokens },
|
|
8955
|
+
figmaFileKey: FIGMA_FILE_KEY,
|
|
8956
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8957
|
+
source: "figma"
|
|
8958
|
+
};
|
|
8959
|
+
fs12.writeFileSync(TOKEN_FILE, JSON.stringify(merged, null, 2) + "\n");
|
|
8960
|
+
context.output.success(
|
|
8961
|
+
`Pulled ${variableCount} variables from Figma \u2192 ${TOKEN_FILE}`
|
|
8962
|
+
);
|
|
8963
|
+
}
|
|
8964
|
+
} catch (e) {
|
|
8965
|
+
throw new CliUsageError(
|
|
8966
|
+
`Pull failed: ${e instanceof Error ? e.message : String(e)}`
|
|
8967
|
+
);
|
|
8968
|
+
}
|
|
8969
|
+
} else if (cmd === "push") {
|
|
8970
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
8971
|
+
throw new CliUsageError("Missing FIGMA_TOKEN or FIGMA_FILE_KEY");
|
|
8972
|
+
}
|
|
8973
|
+
if (!fs12.existsSync(TOKEN_FILE)) {
|
|
8974
|
+
throw new CliUsageError(
|
|
8975
|
+
`${TOKEN_FILE} not found. Run 'tw sync init' first.`
|
|
8976
|
+
);
|
|
8977
|
+
}
|
|
8978
|
+
try {
|
|
8979
|
+
const local = JSON.parse(fs12.readFileSync(TOKEN_FILE, "utf8"));
|
|
8980
|
+
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8981
|
+
token: FIGMA_TOKEN,
|
|
8982
|
+
fileKey: FIGMA_FILE_KEY
|
|
8983
|
+
});
|
|
8984
|
+
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables?.length ? Object.entries(data.variables ?? {}).reduce((acc, [id, v]) => ({ ...acc, [id]: { ...v, id } }), {}) : {});
|
|
8985
|
+
if (isDryRun) {
|
|
8986
|
+
context.output.info(
|
|
8987
|
+
`DRY RUN \u2014 would update ${updates.length} variables in Figma:`
|
|
8988
|
+
);
|
|
8989
|
+
updates.forEach((u) => context.output.writeText(` ${u.name}: ${u.value}`));
|
|
8990
|
+
} else {
|
|
8991
|
+
if (updates.length === 0) {
|
|
8992
|
+
context.output.info("No matching variables to update");
|
|
8993
|
+
} else {
|
|
8994
|
+
context.output.success(`Updated ${updates.length} variables in Figma`);
|
|
8995
|
+
}
|
|
8996
|
+
}
|
|
8997
|
+
} catch (e) {
|
|
8998
|
+
throw new CliUsageError(
|
|
8999
|
+
`Push failed: ${e instanceof Error ? e.message : String(e)}`
|
|
9000
|
+
);
|
|
9001
|
+
}
|
|
9002
|
+
} else if (cmd === "diff") {
|
|
9003
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
9004
|
+
throw new CliUsageError("Missing FIGMA_TOKEN or FIGMA_FILE_KEY");
|
|
9005
|
+
}
|
|
9006
|
+
if (!fs12.existsSync(TOKEN_FILE)) {
|
|
9007
|
+
throw new CliUsageError("tokens.sync.json not found");
|
|
9008
|
+
}
|
|
9009
|
+
try {
|
|
9010
|
+
const [local, figmaData] = await Promise.all([
|
|
9011
|
+
JSON.parse(fs12.readFileSync(TOKEN_FILE, "utf8")),
|
|
9012
|
+
figmaRequest("/files/:fileKey/variables/local", {
|
|
9013
|
+
token: FIGMA_TOKEN,
|
|
9014
|
+
fileKey: FIGMA_FILE_KEY
|
|
9015
|
+
})
|
|
9016
|
+
]);
|
|
9017
|
+
const figmaTokens = figmaVariablesToTokens(figmaData);
|
|
9018
|
+
const figmaFlat = {};
|
|
9019
|
+
const localFlat = {};
|
|
9020
|
+
flattenTokens(local.tokens ?? {}, "", localFlat);
|
|
9021
|
+
flattenTokens(figmaTokens, "", figmaFlat);
|
|
9022
|
+
const diffs = diffTokens(localFlat, figmaFlat);
|
|
9023
|
+
if (diffs.length === 0) {
|
|
9024
|
+
context.output.success("No differences \u2014 local and Figma are in sync");
|
|
9025
|
+
} else {
|
|
9026
|
+
context.output.info(`${diffs.length} differences found:
|
|
9027
|
+
`);
|
|
9028
|
+
diffs.forEach((d) => {
|
|
9029
|
+
context.output.writeText(` ${d.key}`);
|
|
9030
|
+
context.output.writeText(` local: ${d.local ?? "(missing)"}`);
|
|
9031
|
+
context.output.writeText(` figma: ${d.figma ?? "(missing)"}`);
|
|
9032
|
+
});
|
|
9033
|
+
}
|
|
9034
|
+
} catch (e) {
|
|
9035
|
+
throw new CliUsageError(
|
|
9036
|
+
`Diff failed: ${e instanceof Error ? e.message : String(e)}`
|
|
9037
|
+
);
|
|
9038
|
+
}
|
|
9039
|
+
} else {
|
|
9040
|
+
throw new CliUsageError(`Unknown command: ${cmd}`);
|
|
9041
|
+
}
|
|
9042
|
+
}
|
|
9043
|
+
};
|
|
9044
|
+
|
|
8739
9045
|
// packages/infrastructure/cli/src/commands/misc.ts
|
|
8740
9046
|
init_esm_shims();
|
|
8741
9047
|
init_errors();
|
|
8742
9048
|
init_fs();
|
|
8743
9049
|
init_json();
|
|
8744
|
-
import
|
|
9050
|
+
import path25 from "path";
|
|
8745
9051
|
import { parseArgs as parseNodeArgs9 } from "util";
|
|
8746
9052
|
var testCommand = {
|
|
8747
9053
|
name: "test",
|
|
@@ -8771,7 +9077,7 @@ var shareCommand = {
|
|
|
8771
9077
|
name: "share",
|
|
8772
9078
|
async run(args, context) {
|
|
8773
9079
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8774
|
-
const manifestPath =
|
|
9080
|
+
const manifestPath = path25.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8775
9081
|
const defaultManifest = {
|
|
8776
9082
|
name,
|
|
8777
9083
|
version: "0.1.0"
|
|
@@ -8857,14 +9163,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8857
9163
|
};
|
|
8858
9164
|
var resolveCurrentCliVersion = async (context) => {
|
|
8859
9165
|
const candidates = [
|
|
8860
|
-
|
|
8861
|
-
|
|
8862
|
-
|
|
9166
|
+
path25.resolve(context.runtimeDir, "..", "package.json"),
|
|
9167
|
+
path25.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
9168
|
+
path25.resolve(process.cwd(), "package.json")
|
|
8863
9169
|
];
|
|
8864
9170
|
for (const candidate of candidates) {
|
|
8865
9171
|
if (!await pathExists2(candidate)) continue;
|
|
8866
9172
|
const pkg = await readJsonSafe(candidate);
|
|
8867
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
9173
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${path25.sep}packages${path25.sep}cli${path25.sep}`));
|
|
8868
9174
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8869
9175
|
}
|
|
8870
9176
|
return "0.0.0";
|
|
@@ -9112,7 +9418,7 @@ init_errors();
|
|
|
9112
9418
|
init_fs();
|
|
9113
9419
|
init_json();
|
|
9114
9420
|
init_src4();
|
|
9115
|
-
import
|
|
9421
|
+
import path29 from "path";
|
|
9116
9422
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
9117
9423
|
var DEFAULT_TAILWIND_CSS2 = '@import "tailwindcss";\n';
|
|
9118
9424
|
var DEFAULT_TW_CONFIG = `${JSON.stringify(
|
|
@@ -9139,8 +9445,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
9139
9445
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9140
9446
|
let configPath = null;
|
|
9141
9447
|
for (const file of twConfigFiles) {
|
|
9142
|
-
if (await pathExists2(
|
|
9143
|
-
configPath =
|
|
9448
|
+
if (await pathExists2(path29.join(cwd2, file))) {
|
|
9449
|
+
configPath = path29.join(cwd2, file);
|
|
9144
9450
|
break;
|
|
9145
9451
|
}
|
|
9146
9452
|
}
|
|
@@ -9231,7 +9537,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
9231
9537
|
async function hasTailwindCssImport(cwd2) {
|
|
9232
9538
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
9233
9539
|
for (const file of cssFiles) {
|
|
9234
|
-
const raw = await readFileSafe(
|
|
9540
|
+
const raw = await readFileSafe(path29.join(cwd2, file));
|
|
9235
9541
|
if (raw?.includes("tailwindcss")) return true;
|
|
9236
9542
|
}
|
|
9237
9543
|
return false;
|
|
@@ -9247,7 +9553,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
9247
9553
|
"app/globals.css"
|
|
9248
9554
|
];
|
|
9249
9555
|
for (const file of cssFiles) {
|
|
9250
|
-
const raw = await readFileSafe(
|
|
9556
|
+
const raw = await readFileSafe(path29.join(cwd2, file));
|
|
9251
9557
|
if (raw === null) continue;
|
|
9252
9558
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
9253
9559
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -9255,8 +9561,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
9255
9561
|
return { found: false, cssFile: null };
|
|
9256
9562
|
}
|
|
9257
9563
|
async function applyTailwindInit(cwd2) {
|
|
9258
|
-
await ensureFileSafe(
|
|
9259
|
-
await ensureFileSafe(
|
|
9564
|
+
await ensureFileSafe(path29.join(cwd2, "src", "tailwind.css"), DEFAULT_TAILWIND_CSS2);
|
|
9565
|
+
await ensureFileSafe(path29.join(cwd2, "tailwind-styled.config.json"), DEFAULT_TW_CONFIG);
|
|
9260
9566
|
}
|
|
9261
9567
|
function check(results, id, label, pass, message, fix) {
|
|
9262
9568
|
results.push({ id, label, pass, message, fix });
|
|
@@ -9278,7 +9584,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9278
9584
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
9279
9585
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
9280
9586
|
);
|
|
9281
|
-
const pkg = await readJsonSafe(
|
|
9587
|
+
const pkg = await readJsonSafe(path29.join(cwd2, "package.json"));
|
|
9282
9588
|
check(
|
|
9283
9589
|
results,
|
|
9284
9590
|
"package-json",
|
|
@@ -9312,7 +9618,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9312
9618
|
}
|
|
9313
9619
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9314
9620
|
const twConfigChecks = await Promise.all(
|
|
9315
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9621
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(path29.join(cwd2, file)) }))
|
|
9316
9622
|
);
|
|
9317
9623
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9318
9624
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9324,7 +9630,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9324
9630
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9325
9631
|
"tw init"
|
|
9326
9632
|
);
|
|
9327
|
-
const oldConfig = await readJsonSafe(
|
|
9633
|
+
const oldConfig = await readJsonSafe(path29.join(cwd2, "tailwind.config.js")) ?? await readJsonSafe(path29.join(cwd2, "tailwind.config.ts"));
|
|
9328
9634
|
if (oldConfig) {
|
|
9329
9635
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9330
9636
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9348,7 +9654,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9348
9654
|
validation.message
|
|
9349
9655
|
);
|
|
9350
9656
|
}
|
|
9351
|
-
const hasTsConfig = await pathExists2(
|
|
9657
|
+
const hasTsConfig = await pathExists2(path29.join(cwd2, "tsconfig.json"));
|
|
9352
9658
|
check(
|
|
9353
9659
|
results,
|
|
9354
9660
|
"typescript",
|
|
@@ -9710,7 +10016,7 @@ init_esm_shims();
|
|
|
9710
10016
|
init_errors();
|
|
9711
10017
|
init_fs();
|
|
9712
10018
|
init_json();
|
|
9713
|
-
import
|
|
10019
|
+
import path30 from "path";
|
|
9714
10020
|
import { parseArgs as parseNodeArgs11 } from "util";
|
|
9715
10021
|
var storybookCommand = {
|
|
9716
10022
|
name: "storybook",
|
|
@@ -9749,7 +10055,7 @@ var storybookCommand = {
|
|
|
9749
10055
|
context.output.writeText(
|
|
9750
10056
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9751
10057
|
);
|
|
9752
|
-
const localBin =
|
|
10058
|
+
const localBin = path30.join(
|
|
9753
10059
|
process.cwd(),
|
|
9754
10060
|
"node_modules",
|
|
9755
10061
|
".bin",
|
|
@@ -10936,10 +11242,10 @@ async function traceClass(className, options) {
|
|
|
10936
11242
|
init_esm_shims();
|
|
10937
11243
|
init_internal();
|
|
10938
11244
|
init_src2();
|
|
10939
|
-
import
|
|
10940
|
-
import
|
|
11245
|
+
import fs16 from "fs";
|
|
11246
|
+
import path31 from "path";
|
|
10941
11247
|
function toRelativePath(root, value) {
|
|
10942
|
-
const relative =
|
|
11248
|
+
const relative = path31.relative(root, value);
|
|
10943
11249
|
return relative.length > 0 ? relative : ".";
|
|
10944
11250
|
}
|
|
10945
11251
|
function uniqueSorted(values) {
|
|
@@ -11008,7 +11314,7 @@ function tryCompileClasses(classes) {
|
|
|
11008
11314
|
}
|
|
11009
11315
|
}
|
|
11010
11316
|
function traceSingleFile(filePath, root) {
|
|
11011
|
-
const source =
|
|
11317
|
+
const source = fs16.readFileSync(filePath, "utf8");
|
|
11012
11318
|
const classes = uniqueSorted(scanSource(source));
|
|
11013
11319
|
const imports = extractImports(source);
|
|
11014
11320
|
const compiled = tryCompileClasses(classes);
|
|
@@ -11039,7 +11345,7 @@ function traceDirectory(targetDir, root) {
|
|
|
11039
11345
|
const imports = [];
|
|
11040
11346
|
const importKeys = /* @__PURE__ */ new Set();
|
|
11041
11347
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
11042
|
-
const source =
|
|
11348
|
+
const source = fs16.readFileSync(entry.file, "utf8");
|
|
11043
11349
|
const fileImports = extractImports(source);
|
|
11044
11350
|
for (const fileImport of fileImports) {
|
|
11045
11351
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -11070,12 +11376,12 @@ function traceDirectory(targetDir, root) {
|
|
|
11070
11376
|
};
|
|
11071
11377
|
}
|
|
11072
11378
|
async function traceTarget(target, options = {}) {
|
|
11073
|
-
const root =
|
|
11074
|
-
const resolvedTarget =
|
|
11075
|
-
if (!
|
|
11379
|
+
const root = path31.resolve(options.root ?? process.cwd());
|
|
11380
|
+
const resolvedTarget = path31.resolve(root, target);
|
|
11381
|
+
if (!fs16.existsSync(resolvedTarget)) {
|
|
11076
11382
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
11077
11383
|
}
|
|
11078
|
-
const stat =
|
|
11384
|
+
const stat = fs16.statSync(resolvedTarget);
|
|
11079
11385
|
if (stat.isDirectory()) {
|
|
11080
11386
|
return traceDirectory(resolvedTarget, root);
|
|
11081
11387
|
}
|
|
@@ -11240,14 +11546,14 @@ function printClassTraceOutput(result, output) {
|
|
|
11240
11546
|
init_esm_shims();
|
|
11241
11547
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
11242
11548
|
init_output();
|
|
11243
|
-
import
|
|
11244
|
-
import
|
|
11549
|
+
import fs17 from "fs";
|
|
11550
|
+
import path32 from "path";
|
|
11245
11551
|
async function runGenerateTypesCli(rawArgs) {
|
|
11246
11552
|
const output = createCliOutput({ json: rawArgs.includes("--json") });
|
|
11247
11553
|
const logger = createCliLogger({ output });
|
|
11248
11554
|
const cwd2 = process.cwd();
|
|
11249
11555
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
11250
|
-
const outPath =
|
|
11556
|
+
const outPath = path32.resolve(cwd2, outFile);
|
|
11251
11557
|
output.writeText("");
|
|
11252
11558
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
11253
11559
|
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"));
|
|
@@ -11283,12 +11589,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11283
11589
|
}
|
|
11284
11590
|
output.writeText("");
|
|
11285
11591
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
11286
|
-
const outDir =
|
|
11287
|
-
if (!
|
|
11288
|
-
|
|
11592
|
+
const outDir = path32.dirname(outPath);
|
|
11593
|
+
if (!fs17.existsSync(outDir)) {
|
|
11594
|
+
fs17.mkdirSync(outDir, { recursive: true });
|
|
11289
11595
|
}
|
|
11290
|
-
|
|
11291
|
-
logger.ok(
|
|
11596
|
+
fs17.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11597
|
+
logger.ok(path32.relative(cwd2, outPath));
|
|
11292
11598
|
output.writeText("");
|
|
11293
11599
|
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"));
|
|
11294
11600
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -11299,11 +11605,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11299
11605
|
}
|
|
11300
11606
|
async function loadNativeBinding2(cwd2) {
|
|
11301
11607
|
const candidates = [
|
|
11302
|
-
|
|
11303
|
-
|
|
11608
|
+
path32.join(cwd2, "native", "tailwind-styled-native.node"),
|
|
11609
|
+
path32.join(cwd2, "node_modules", "tailwind-styled-v4", "native", "tailwind-styled-native.node")
|
|
11304
11610
|
];
|
|
11305
11611
|
for (const candidate of candidates) {
|
|
11306
|
-
if (
|
|
11612
|
+
if (fs17.existsSync(candidate)) {
|
|
11307
11613
|
try {
|
|
11308
11614
|
return __require(candidate);
|
|
11309
11615
|
} catch {
|
|
@@ -11321,8 +11627,8 @@ import { parseArgs as parseNodeArgs14 } from "util";
|
|
|
11321
11627
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11322
11628
|
init_esm_shims();
|
|
11323
11629
|
init_internal();
|
|
11324
|
-
import
|
|
11325
|
-
import
|
|
11630
|
+
import fs18 from "fs";
|
|
11631
|
+
import path33 from "path";
|
|
11326
11632
|
init_src2();
|
|
11327
11633
|
function extractVariantChain(usage) {
|
|
11328
11634
|
const segments = normalizeScannedClass(usage).split(":").filter(Boolean);
|
|
@@ -11370,7 +11676,7 @@ async function whyClass(className, options) {
|
|
|
11370
11676
|
for (const file of scanResult.files) {
|
|
11371
11677
|
const source = (() => {
|
|
11372
11678
|
try {
|
|
11373
|
-
return
|
|
11679
|
+
return fs18.readFileSync(file.file, "utf8");
|
|
11374
11680
|
} catch {
|
|
11375
11681
|
return "";
|
|
11376
11682
|
}
|
|
@@ -11384,7 +11690,7 @@ async function whyClass(className, options) {
|
|
|
11384
11690
|
className
|
|
11385
11691
|
]);
|
|
11386
11692
|
usedIn.push({
|
|
11387
|
-
file:
|
|
11693
|
+
file: path33.relative(root, file.file) || path33.basename(file.file),
|
|
11388
11694
|
line: location.line,
|
|
11389
11695
|
column: location.column,
|
|
11390
11696
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11691,6 +11997,12 @@ function buildMainProgram(context) {
|
|
|
11691
11997
|
);
|
|
11692
11998
|
});
|
|
11693
11999
|
});
|
|
12000
|
+
const figmaTopLevel = program2.command("figma").description("Figma design token sync");
|
|
12001
|
+
["pull", "push", "diff"].forEach((subcommand) => {
|
|
12002
|
+
figmaTopLevel.command(`${subcommand} [args...]`).description(`Figma ${subcommand}`).allowUnknownOption(true).action(async (args) => {
|
|
12003
|
+
await figmaCommand.run(contextArgs([subcommand, ...toVariadic(args)], context), context);
|
|
12004
|
+
});
|
|
12005
|
+
});
|
|
11694
12006
|
program2.command("test").description("Test shortcut wrapper").option("--watch", "Watch mode").action(async (...actionArgs) => {
|
|
11695
12007
|
const options = actionCommand(actionArgs).opts();
|
|
11696
12008
|
const args = [];
|
|
@@ -11853,6 +12165,7 @@ if (process.argv[1] === __currentFile) {
|
|
|
11853
12165
|
main2();
|
|
11854
12166
|
}
|
|
11855
12167
|
export {
|
|
12168
|
+
buildMainProgram,
|
|
11856
12169
|
createCliOutput,
|
|
11857
12170
|
ensureFlag,
|
|
11858
12171
|
parseCliInput as parseCliArgs,
|