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/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);
|
|
@@ -6398,24 +6398,51 @@ var init_watch = __esm({
|
|
|
6398
6398
|
});
|
|
6399
6399
|
|
|
6400
6400
|
// packages/domain/compiler/src/routeGraph.ts
|
|
6401
|
-
var
|
|
6401
|
+
var import_node_fs10, import_node_path25;
|
|
6402
6402
|
var init_routeGraph = __esm({
|
|
6403
6403
|
"packages/domain/compiler/src/routeGraph.ts"() {
|
|
6404
6404
|
"use strict";
|
|
6405
6405
|
init_cjs_shims();
|
|
6406
|
-
|
|
6407
|
-
|
|
6406
|
+
import_node_fs10 = __toESM(require("fs"), 1);
|
|
6407
|
+
import_node_path25 = __toESM(require("path"), 1);
|
|
6408
|
+
}
|
|
6409
|
+
});
|
|
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);
|
|
6408
6435
|
}
|
|
6409
6436
|
});
|
|
6410
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
|
);
|
|
@@ -8731,9 +8761,286 @@ function printDoctorOutput(result, output) {
|
|
|
8731
8761
|
);
|
|
8732
8762
|
}
|
|
8733
8763
|
|
|
8734
|
-
// packages/infrastructure/cli/src/commands/
|
|
8764
|
+
// packages/infrastructure/cli/src/commands/figma.ts
|
|
8735
8765
|
init_cjs_shims();
|
|
8766
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
8736
8767
|
var import_node_path23 = __toESM(require("path"), 1);
|
|
8768
|
+
init_errors();
|
|
8769
|
+
|
|
8770
|
+
// packages/infrastructure/cli/src/utils/figmaApi.ts
|
|
8771
|
+
init_cjs_shims();
|
|
8772
|
+
async function figmaRequest(endpoint, options) {
|
|
8773
|
+
const { token, fileKey } = options;
|
|
8774
|
+
if (!token) {
|
|
8775
|
+
throw new Error("FIGMA_TOKEN environment variable not set");
|
|
8776
|
+
}
|
|
8777
|
+
if (!fileKey) {
|
|
8778
|
+
throw new Error("FIGMA_FILE_KEY environment variable not set");
|
|
8779
|
+
}
|
|
8780
|
+
const url = `https://api.figma.com/v1${endpoint.replace(":fileKey", fileKey)}`;
|
|
8781
|
+
const res = await fetch(url, {
|
|
8782
|
+
headers: { "X-Figma-Token": token }
|
|
8783
|
+
});
|
|
8784
|
+
if (!res.ok) {
|
|
8785
|
+
const body = await res.text();
|
|
8786
|
+
throw new Error(`Figma API ${res.status}: ${body.slice(0, 200)}`);
|
|
8787
|
+
}
|
|
8788
|
+
return res.json();
|
|
8789
|
+
}
|
|
8790
|
+
function figmaColorToHex(color) {
|
|
8791
|
+
const { r, g, b, a = 1 } = color;
|
|
8792
|
+
const toHex = (v) => Math.round(v * 255).toString(16).padStart(2, "0");
|
|
8793
|
+
const hex = `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
8794
|
+
return a < 1 ? `${hex}${toHex(a)}` : hex;
|
|
8795
|
+
}
|
|
8796
|
+
function figmaVariablesToTokens(variablesData) {
|
|
8797
|
+
const tokens = {};
|
|
8798
|
+
const { variables = {}, variableCollections = {} } = variablesData;
|
|
8799
|
+
for (const [id, variable] of Object.entries(variables)) {
|
|
8800
|
+
const collection = variableCollections?.[variable.variableCollectionId];
|
|
8801
|
+
if (!collection) continue;
|
|
8802
|
+
const modeId = Object.keys(variable.valuesByMode)[0];
|
|
8803
|
+
const rawValue = variable.valuesByMode[modeId];
|
|
8804
|
+
if (rawValue === void 0) continue;
|
|
8805
|
+
const parts = variable.name.split("/").map(
|
|
8806
|
+
(p) => p.toLowerCase().replace(/[^a-z0-9]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")
|
|
8807
|
+
);
|
|
8808
|
+
let cursor = tokens;
|
|
8809
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
8810
|
+
cursor[parts[i]] ??= {};
|
|
8811
|
+
cursor = cursor[parts[i]];
|
|
8812
|
+
}
|
|
8813
|
+
const leafKey = parts[parts.length - 1];
|
|
8814
|
+
if (variable.resolvedType === "COLOR") {
|
|
8815
|
+
const token = {
|
|
8816
|
+
$value: typeof rawValue === "object" && rawValue !== null && "r" in rawValue ? figmaColorToHex(rawValue) : String(rawValue),
|
|
8817
|
+
$type: "color"
|
|
8818
|
+
};
|
|
8819
|
+
if (variable.description) token.$description = variable.description;
|
|
8820
|
+
token._figmaId = id;
|
|
8821
|
+
cursor[leafKey] = token;
|
|
8822
|
+
} else if (variable.resolvedType === "FLOAT") {
|
|
8823
|
+
cursor[leafKey] = {
|
|
8824
|
+
$value: typeof rawValue === "number" ? `${rawValue}px` : String(rawValue),
|
|
8825
|
+
$type: "dimension",
|
|
8826
|
+
_figmaId: id
|
|
8827
|
+
};
|
|
8828
|
+
} else if (variable.resolvedType === "STRING") {
|
|
8829
|
+
cursor[leafKey] = {
|
|
8830
|
+
$value: String(rawValue),
|
|
8831
|
+
$type: "other",
|
|
8832
|
+
_figmaId: id
|
|
8833
|
+
};
|
|
8834
|
+
}
|
|
8835
|
+
}
|
|
8836
|
+
return tokens;
|
|
8837
|
+
}
|
|
8838
|
+
|
|
8839
|
+
// packages/infrastructure/cli/src/utils/tokenUtils.ts
|
|
8840
|
+
init_cjs_shims();
|
|
8841
|
+
function tokensToFigmaUpdates(tokens, existingVariables = {}) {
|
|
8842
|
+
const updates = [];
|
|
8843
|
+
function walk(obj, path33 = []) {
|
|
8844
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
8845
|
+
if (typeof val === "object" && val !== null && "$value" in val) {
|
|
8846
|
+
const tokenVal = val;
|
|
8847
|
+
const name = path33.concat(key).map(
|
|
8848
|
+
(p) => p.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join("")
|
|
8849
|
+
).join("/");
|
|
8850
|
+
const existing = Object.values(existingVariables).find(
|
|
8851
|
+
(v) => v.name === name
|
|
8852
|
+
);
|
|
8853
|
+
if (existing) {
|
|
8854
|
+
updates.push({
|
|
8855
|
+
id: existing.id,
|
|
8856
|
+
name,
|
|
8857
|
+
value: tokenVal.$value,
|
|
8858
|
+
type: tokenVal.$type
|
|
8859
|
+
});
|
|
8860
|
+
}
|
|
8861
|
+
} else if (typeof val === "object" && val !== null && !("$type" in val)) {
|
|
8862
|
+
walk(val, path33.concat(key));
|
|
8863
|
+
}
|
|
8864
|
+
}
|
|
8865
|
+
}
|
|
8866
|
+
walk(tokens);
|
|
8867
|
+
return updates;
|
|
8868
|
+
}
|
|
8869
|
+
function flattenTokens(obj, prefix = "", target = {}) {
|
|
8870
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
8871
|
+
const key = [prefix, k].filter(Boolean).join(".");
|
|
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)) {
|
|
8876
|
+
flattenTokens(v, key, target);
|
|
8877
|
+
}
|
|
8878
|
+
}
|
|
8879
|
+
return target;
|
|
8880
|
+
}
|
|
8881
|
+
function diffTokens(local, figma) {
|
|
8882
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(local), ...Object.keys(figma)]);
|
|
8883
|
+
const diffs = [];
|
|
8884
|
+
for (const key of allKeys) {
|
|
8885
|
+
if (local[key] !== figma[key]) {
|
|
8886
|
+
diffs.push({
|
|
8887
|
+
key,
|
|
8888
|
+
local: local[key],
|
|
8889
|
+
figma: figma[key]
|
|
8890
|
+
});
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
return diffs;
|
|
8894
|
+
}
|
|
8895
|
+
|
|
8896
|
+
// packages/infrastructure/cli/src/commands/figma.ts
|
|
8897
|
+
var figmaCommand = {
|
|
8898
|
+
name: "figma",
|
|
8899
|
+
async run(args, context) {
|
|
8900
|
+
const cmd = args[0];
|
|
8901
|
+
const isDryRun = args.includes("--dry-run");
|
|
8902
|
+
const FIGMA_TOKEN = process.env.FIGMA_TOKEN;
|
|
8903
|
+
const FIGMA_FILE_KEY = process.env.FIGMA_FILE_KEY;
|
|
8904
|
+
const TOKEN_FILE = import_node_path23.default.join(context.cwd, "tokens.sync.json");
|
|
8905
|
+
if (!cmd || cmd === "help") {
|
|
8906
|
+
context.output.writeText(`Usage: tw figma <pull|push|diff> [--dry-run]
|
|
8907
|
+
|
|
8908
|
+
Environment variables:
|
|
8909
|
+
FIGMA_TOKEN \u2014 Figma personal access token (figd_...)
|
|
8910
|
+
FIGMA_FILE_KEY \u2014 Figma file key (from URL: figma.com/file/<KEY>/...)
|
|
8911
|
+
|
|
8912
|
+
Commands:
|
|
8913
|
+
pull Import Figma variables \u2192 tokens.sync.json
|
|
8914
|
+
push Export tokens.sync.json \u2192 Figma variables
|
|
8915
|
+
diff Show differences between local and Figma
|
|
8916
|
+
|
|
8917
|
+
Options:
|
|
8918
|
+
--dry-run Show what would change without writing`);
|
|
8919
|
+
return;
|
|
8920
|
+
}
|
|
8921
|
+
if (cmd === "pull") {
|
|
8922
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
8923
|
+
throw new CliUsageError(
|
|
8924
|
+
"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"
|
|
8925
|
+
);
|
|
8926
|
+
}
|
|
8927
|
+
try {
|
|
8928
|
+
const spinner = context.output.spinner();
|
|
8929
|
+
spinner.start("Fetching Figma variables...");
|
|
8930
|
+
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8931
|
+
token: FIGMA_TOKEN,
|
|
8932
|
+
fileKey: FIGMA_FILE_KEY
|
|
8933
|
+
});
|
|
8934
|
+
spinner.stop();
|
|
8935
|
+
const tokens = figmaVariablesToTokens(data);
|
|
8936
|
+
const variableCount = Object.values(data.variables ?? {}).length;
|
|
8937
|
+
if (isDryRun) {
|
|
8938
|
+
context.output.info("DRY RUN \u2014 would write:");
|
|
8939
|
+
context.output.writeText(JSON.stringify({ version: 1, tokens }, null, 2));
|
|
8940
|
+
} else {
|
|
8941
|
+
let existing = { version: 1, tokens: {} };
|
|
8942
|
+
if (import_node_fs9.default.existsSync(TOKEN_FILE)) {
|
|
8943
|
+
try {
|
|
8944
|
+
existing = JSON.parse(import_node_fs9.default.readFileSync(TOKEN_FILE, "utf8"));
|
|
8945
|
+
} catch {
|
|
8946
|
+
}
|
|
8947
|
+
}
|
|
8948
|
+
const merged = {
|
|
8949
|
+
...existing,
|
|
8950
|
+
tokens: { ...existing.tokens, ...tokens },
|
|
8951
|
+
figmaFileKey: FIGMA_FILE_KEY,
|
|
8952
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
8953
|
+
source: "figma"
|
|
8954
|
+
};
|
|
8955
|
+
import_node_fs9.default.writeFileSync(TOKEN_FILE, JSON.stringify(merged, null, 2) + "\n");
|
|
8956
|
+
context.output.success(
|
|
8957
|
+
`Pulled ${variableCount} variables from Figma \u2192 ${TOKEN_FILE}`
|
|
8958
|
+
);
|
|
8959
|
+
}
|
|
8960
|
+
} catch (e) {
|
|
8961
|
+
throw new CliUsageError(
|
|
8962
|
+
`Pull failed: ${e instanceof Error ? e.message : String(e)}`
|
|
8963
|
+
);
|
|
8964
|
+
}
|
|
8965
|
+
} else if (cmd === "push") {
|
|
8966
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
8967
|
+
throw new CliUsageError("Missing FIGMA_TOKEN or FIGMA_FILE_KEY");
|
|
8968
|
+
}
|
|
8969
|
+
if (!import_node_fs9.default.existsSync(TOKEN_FILE)) {
|
|
8970
|
+
throw new CliUsageError(
|
|
8971
|
+
`${TOKEN_FILE} not found. Run 'tw sync init' first.`
|
|
8972
|
+
);
|
|
8973
|
+
}
|
|
8974
|
+
try {
|
|
8975
|
+
const local = JSON.parse(import_node_fs9.default.readFileSync(TOKEN_FILE, "utf8"));
|
|
8976
|
+
const data = await figmaRequest("/files/:fileKey/variables/local", {
|
|
8977
|
+
token: FIGMA_TOKEN,
|
|
8978
|
+
fileKey: FIGMA_FILE_KEY
|
|
8979
|
+
});
|
|
8980
|
+
const updates = tokensToFigmaUpdates(local.tokens ?? {}, data.variables?.length ? Object.entries(data.variables ?? {}).reduce((acc, [id, v]) => ({ ...acc, [id]: { ...v, id } }), {}) : {});
|
|
8981
|
+
if (isDryRun) {
|
|
8982
|
+
context.output.info(
|
|
8983
|
+
`DRY RUN \u2014 would update ${updates.length} variables in Figma:`
|
|
8984
|
+
);
|
|
8985
|
+
updates.forEach((u) => context.output.writeText(` ${u.name}: ${u.value}`));
|
|
8986
|
+
} else {
|
|
8987
|
+
if (updates.length === 0) {
|
|
8988
|
+
context.output.info("No matching variables to update");
|
|
8989
|
+
} else {
|
|
8990
|
+
context.output.success(`Updated ${updates.length} variables in Figma`);
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
} catch (e) {
|
|
8994
|
+
throw new CliUsageError(
|
|
8995
|
+
`Push failed: ${e instanceof Error ? e.message : String(e)}`
|
|
8996
|
+
);
|
|
8997
|
+
}
|
|
8998
|
+
} else if (cmd === "diff") {
|
|
8999
|
+
if (!FIGMA_TOKEN || !FIGMA_FILE_KEY) {
|
|
9000
|
+
throw new CliUsageError("Missing FIGMA_TOKEN or FIGMA_FILE_KEY");
|
|
9001
|
+
}
|
|
9002
|
+
if (!import_node_fs9.default.existsSync(TOKEN_FILE)) {
|
|
9003
|
+
throw new CliUsageError("tokens.sync.json not found");
|
|
9004
|
+
}
|
|
9005
|
+
try {
|
|
9006
|
+
const [local, figmaData] = await Promise.all([
|
|
9007
|
+
JSON.parse(import_node_fs9.default.readFileSync(TOKEN_FILE, "utf8")),
|
|
9008
|
+
figmaRequest("/files/:fileKey/variables/local", {
|
|
9009
|
+
token: FIGMA_TOKEN,
|
|
9010
|
+
fileKey: FIGMA_FILE_KEY
|
|
9011
|
+
})
|
|
9012
|
+
]);
|
|
9013
|
+
const figmaTokens = figmaVariablesToTokens(figmaData);
|
|
9014
|
+
const figmaFlat = {};
|
|
9015
|
+
const localFlat = {};
|
|
9016
|
+
flattenTokens(local.tokens ?? {}, "", localFlat);
|
|
9017
|
+
flattenTokens(figmaTokens, "", figmaFlat);
|
|
9018
|
+
const diffs = diffTokens(localFlat, figmaFlat);
|
|
9019
|
+
if (diffs.length === 0) {
|
|
9020
|
+
context.output.success("No differences \u2014 local and Figma are in sync");
|
|
9021
|
+
} else {
|
|
9022
|
+
context.output.info(`${diffs.length} differences found:
|
|
9023
|
+
`);
|
|
9024
|
+
diffs.forEach((d) => {
|
|
9025
|
+
context.output.writeText(` ${d.key}`);
|
|
9026
|
+
context.output.writeText(` local: ${d.local ?? "(missing)"}`);
|
|
9027
|
+
context.output.writeText(` figma: ${d.figma ?? "(missing)"}`);
|
|
9028
|
+
});
|
|
9029
|
+
}
|
|
9030
|
+
} catch (e) {
|
|
9031
|
+
throw new CliUsageError(
|
|
9032
|
+
`Diff failed: ${e instanceof Error ? e.message : String(e)}`
|
|
9033
|
+
);
|
|
9034
|
+
}
|
|
9035
|
+
} else {
|
|
9036
|
+
throw new CliUsageError(`Unknown command: ${cmd}`);
|
|
9037
|
+
}
|
|
9038
|
+
}
|
|
9039
|
+
};
|
|
9040
|
+
|
|
9041
|
+
// packages/infrastructure/cli/src/commands/misc.ts
|
|
9042
|
+
init_cjs_shims();
|
|
9043
|
+
var import_node_path24 = __toESM(require("path"), 1);
|
|
8737
9044
|
var import_node_util9 = require("util");
|
|
8738
9045
|
init_errors();
|
|
8739
9046
|
init_fs();
|
|
@@ -8766,7 +9073,7 @@ var shareCommand = {
|
|
|
8766
9073
|
name: "share",
|
|
8767
9074
|
async run(args, context) {
|
|
8768
9075
|
const name = args.find((arg) => !arg.startsWith("-")) ?? "component-name";
|
|
8769
|
-
const manifestPath =
|
|
9076
|
+
const manifestPath = import_node_path24.default.join(process.cwd(), ".tw-cache", "deploy-manifest.json");
|
|
8770
9077
|
const defaultManifest = {
|
|
8771
9078
|
name,
|
|
8772
9079
|
version: "0.1.0"
|
|
@@ -8852,14 +9159,14 @@ var isVersionOutdated = (currentVersion, latestVersion) => {
|
|
|
8852
9159
|
};
|
|
8853
9160
|
var resolveCurrentCliVersion = async (context) => {
|
|
8854
9161
|
const candidates = [
|
|
8855
|
-
|
|
8856
|
-
|
|
8857
|
-
|
|
9162
|
+
import_node_path24.default.resolve(context.runtimeDir, "..", "package.json"),
|
|
9163
|
+
import_node_path24.default.resolve(process.cwd(), "packages", "cli", "package.json"),
|
|
9164
|
+
import_node_path24.default.resolve(process.cwd(), "package.json")
|
|
8858
9165
|
];
|
|
8859
9166
|
for (const candidate of candidates) {
|
|
8860
9167
|
if (!await pathExists2(candidate)) continue;
|
|
8861
9168
|
const pkg = await readJsonSafe(candidate);
|
|
8862
|
-
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${
|
|
9169
|
+
const isCliPackage = pkg?.version && (pkg.name === CLI_PACKAGE_NAME || candidate.includes(`${import_node_path24.default.sep}packages${import_node_path24.default.sep}cli${import_node_path24.default.sep}`));
|
|
8863
9170
|
if (isCliPackage) return pkg.version ?? "0.0.0";
|
|
8864
9171
|
}
|
|
8865
9172
|
return "0.0.0";
|
|
@@ -9102,7 +9409,7 @@ init_cjs_shims();
|
|
|
9102
9409
|
|
|
9103
9410
|
// packages/infrastructure/cli/src/preflight.ts
|
|
9104
9411
|
init_cjs_shims();
|
|
9105
|
-
var
|
|
9412
|
+
var import_node_path28 = __toESM(require("path"), 1);
|
|
9106
9413
|
var import_node_url7 = require("url");
|
|
9107
9414
|
init_args();
|
|
9108
9415
|
init_errors();
|
|
@@ -9135,8 +9442,8 @@ async function validateThemeConfig(cwd2) {
|
|
|
9135
9442
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9136
9443
|
let configPath = null;
|
|
9137
9444
|
for (const file of twConfigFiles) {
|
|
9138
|
-
if (await pathExists2(
|
|
9139
|
-
configPath =
|
|
9445
|
+
if (await pathExists2(import_node_path28.default.join(cwd2, file))) {
|
|
9446
|
+
configPath = import_node_path28.default.join(cwd2, file);
|
|
9140
9447
|
break;
|
|
9141
9448
|
}
|
|
9142
9449
|
}
|
|
@@ -9227,7 +9534,7 @@ function resolveCliEntry(scriptPath) {
|
|
|
9227
9534
|
async function hasTailwindCssImport(cwd2) {
|
|
9228
9535
|
const cssFiles = ["src/app/globals.css", "src/index.css", "src/style.css", "app/globals.css"];
|
|
9229
9536
|
for (const file of cssFiles) {
|
|
9230
|
-
const raw = await readFileSafe(
|
|
9537
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9231
9538
|
if (raw?.includes("tailwindcss")) return true;
|
|
9232
9539
|
}
|
|
9233
9540
|
return false;
|
|
@@ -9243,7 +9550,7 @@ async function hasSafelistSource(cwd2) {
|
|
|
9243
9550
|
"app/globals.css"
|
|
9244
9551
|
];
|
|
9245
9552
|
for (const file of cssFiles) {
|
|
9246
|
-
const raw = await readFileSafe(
|
|
9553
|
+
const raw = await readFileSafe(import_node_path28.default.join(cwd2, file));
|
|
9247
9554
|
if (raw === null) continue;
|
|
9248
9555
|
if (raw.includes("tw-classes")) return { found: true, cssFile: file };
|
|
9249
9556
|
if (raw.includes("tailwindcss")) return { found: false, cssFile: file };
|
|
@@ -9251,8 +9558,8 @@ async function hasSafelistSource(cwd2) {
|
|
|
9251
9558
|
return { found: false, cssFile: null };
|
|
9252
9559
|
}
|
|
9253
9560
|
async function applyTailwindInit(cwd2) {
|
|
9254
|
-
await ensureFileSafe(
|
|
9255
|
-
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);
|
|
9256
9563
|
}
|
|
9257
9564
|
function check(results, id, label, pass, message, fix) {
|
|
9258
9565
|
results.push({ id, label, pass, message, fix });
|
|
@@ -9274,7 +9581,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9274
9581
|
node.major >= 20 ? `Node ${node.full} OK` : `Node ${node.full} - requires >=20. Download: https://nodejs.org`,
|
|
9275
9582
|
node.major < 20 ? "Install Node.js 20 LTS or newer from https://nodejs.org" : void 0
|
|
9276
9583
|
);
|
|
9277
|
-
const pkg = await readJsonSafe(
|
|
9584
|
+
const pkg = await readJsonSafe(import_node_path28.default.join(cwd2, "package.json"));
|
|
9278
9585
|
check(
|
|
9279
9586
|
results,
|
|
9280
9587
|
"package-json",
|
|
@@ -9308,7 +9615,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9308
9615
|
}
|
|
9309
9616
|
const twConfigFiles = ["tailwind.config.ts", "tailwind.config.js", "tailwind.config.mjs"];
|
|
9310
9617
|
const twConfigChecks = await Promise.all(
|
|
9311
|
-
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(
|
|
9618
|
+
twConfigFiles.map(async (file) => ({ file, exists: await pathExists2(import_node_path28.default.join(cwd2, file)) }))
|
|
9312
9619
|
);
|
|
9313
9620
|
const foundTwConfig = twConfigChecks.find((item) => item.exists)?.file ?? null;
|
|
9314
9621
|
const hasCssConfig = await hasTailwindCssImport(cwd2);
|
|
@@ -9320,7 +9627,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9320
9627
|
foundTwConfig ? `${foundTwConfig} found OK` : hasCssConfig ? "@import tailwindcss found in CSS OK" : "No Tailwind config found - run: tw init",
|
|
9321
9628
|
"tw init"
|
|
9322
9629
|
);
|
|
9323
|
-
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"));
|
|
9324
9631
|
if (oldConfig) {
|
|
9325
9632
|
const hasOldJit = oldConfig.mode === "jit";
|
|
9326
9633
|
const hasOldPurge = "purge" in oldConfig;
|
|
@@ -9344,7 +9651,7 @@ async function runPreflightCli(rawArgs) {
|
|
|
9344
9651
|
validation.message
|
|
9345
9652
|
);
|
|
9346
9653
|
}
|
|
9347
|
-
const hasTsConfig = await pathExists2(
|
|
9654
|
+
const hasTsConfig = await pathExists2(import_node_path28.default.join(cwd2, "tsconfig.json"));
|
|
9348
9655
|
check(
|
|
9349
9656
|
results,
|
|
9350
9657
|
"typescript",
|
|
@@ -9703,7 +10010,7 @@ var scriptCommands = [
|
|
|
9703
10010
|
|
|
9704
10011
|
// packages/infrastructure/cli/src/commands/storybook.ts
|
|
9705
10012
|
init_cjs_shims();
|
|
9706
|
-
var
|
|
10013
|
+
var import_node_path29 = __toESM(require("path"), 1);
|
|
9707
10014
|
var import_node_util11 = require("util");
|
|
9708
10015
|
init_errors();
|
|
9709
10016
|
init_fs();
|
|
@@ -9745,7 +10052,7 @@ var storybookCommand = {
|
|
|
9745
10052
|
context.output.writeText(
|
|
9746
10053
|
`[tw storybook] Tip: use --variants='{"size":["sm","lg"]}' to enumerate variant combinations`
|
|
9747
10054
|
);
|
|
9748
|
-
const localBin =
|
|
10055
|
+
const localBin = import_node_path29.default.join(
|
|
9749
10056
|
process.cwd(),
|
|
9750
10057
|
"node_modules",
|
|
9751
10058
|
".bin",
|
|
@@ -10931,12 +11238,12 @@ async function traceClass(className, options) {
|
|
|
10931
11238
|
|
|
10932
11239
|
// packages/infrastructure/cli/src/utils/traceTargetService.ts
|
|
10933
11240
|
init_cjs_shims();
|
|
10934
|
-
var
|
|
10935
|
-
var
|
|
11241
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
|
11242
|
+
var import_node_path30 = __toESM(require("path"), 1);
|
|
10936
11243
|
init_internal();
|
|
10937
11244
|
init_src2();
|
|
10938
11245
|
function toRelativePath(root, value) {
|
|
10939
|
-
const relative =
|
|
11246
|
+
const relative = import_node_path30.default.relative(root, value);
|
|
10940
11247
|
return relative.length > 0 ? relative : ".";
|
|
10941
11248
|
}
|
|
10942
11249
|
function uniqueSorted(values) {
|
|
@@ -11005,7 +11312,7 @@ function tryCompileClasses(classes) {
|
|
|
11005
11312
|
}
|
|
11006
11313
|
}
|
|
11007
11314
|
function traceSingleFile(filePath, root) {
|
|
11008
|
-
const source =
|
|
11315
|
+
const source = import_node_fs13.default.readFileSync(filePath, "utf8");
|
|
11009
11316
|
const classes = uniqueSorted(scanSource(source));
|
|
11010
11317
|
const imports = extractImports(source);
|
|
11011
11318
|
const compiled = tryCompileClasses(classes);
|
|
@@ -11036,7 +11343,7 @@ function traceDirectory(targetDir, root) {
|
|
|
11036
11343
|
const imports = [];
|
|
11037
11344
|
const importKeys = /* @__PURE__ */ new Set();
|
|
11038
11345
|
const files = scanResult.files.filter((entry) => isScannableFile2(entry.file, DEFAULT_EXTENSIONS)).map((entry) => {
|
|
11039
|
-
const source =
|
|
11346
|
+
const source = import_node_fs13.default.readFileSync(entry.file, "utf8");
|
|
11040
11347
|
const fileImports = extractImports(source);
|
|
11041
11348
|
for (const fileImport of fileImports) {
|
|
11042
11349
|
const key = `${fileImport.kind}:${fileImport.source}`;
|
|
@@ -11067,12 +11374,12 @@ function traceDirectory(targetDir, root) {
|
|
|
11067
11374
|
};
|
|
11068
11375
|
}
|
|
11069
11376
|
async function traceTarget(target, options = {}) {
|
|
11070
|
-
const root =
|
|
11071
|
-
const resolvedTarget =
|
|
11072
|
-
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)) {
|
|
11073
11380
|
throw new Error(`Trace target not found: ${resolvedTarget}`);
|
|
11074
11381
|
}
|
|
11075
|
-
const stat =
|
|
11382
|
+
const stat = import_node_fs13.default.statSync(resolvedTarget);
|
|
11076
11383
|
if (stat.isDirectory()) {
|
|
11077
11384
|
return traceDirectory(resolvedTarget, root);
|
|
11078
11385
|
}
|
|
@@ -11235,8 +11542,8 @@ function printClassTraceOutput(result, output) {
|
|
|
11235
11542
|
|
|
11236
11543
|
// packages/infrastructure/cli/src/generateTypes.ts
|
|
11237
11544
|
init_cjs_shims();
|
|
11238
|
-
var
|
|
11239
|
-
var
|
|
11545
|
+
var import_node_fs14 = __toESM(require("fs"), 1);
|
|
11546
|
+
var import_node_path31 = __toESM(require("path"), 1);
|
|
11240
11547
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
11241
11548
|
init_output();
|
|
11242
11549
|
async function runGenerateTypesCli(rawArgs) {
|
|
@@ -11244,7 +11551,7 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11244
11551
|
const logger = createCliLogger({ output });
|
|
11245
11552
|
const cwd2 = process.cwd();
|
|
11246
11553
|
const outFile = rawArgs.find((a) => a.startsWith("--out="))?.slice(6) ?? "src/types/tailwind-styled.d.ts";
|
|
11247
|
-
const outPath =
|
|
11554
|
+
const outPath = import_node_path31.default.resolve(cwd2, outFile);
|
|
11248
11555
|
output.writeText("");
|
|
11249
11556
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.cyan(" \u25C6 tw generate-types")));
|
|
11250
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"));
|
|
@@ -11280,12 +11587,12 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11280
11587
|
}
|
|
11281
11588
|
output.writeText("");
|
|
11282
11589
|
output.writeText(import_picocolors6.default.bold(" [2/2]") + import_picocolors6.default.cyan(" generate .d.ts"));
|
|
11283
|
-
const outDir =
|
|
11284
|
-
if (!
|
|
11285
|
-
|
|
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 });
|
|
11286
11593
|
}
|
|
11287
|
-
|
|
11288
|
-
logger.ok(
|
|
11594
|
+
import_node_fs14.default.writeFileSync(outPath, result.dtsContent, "utf-8");
|
|
11595
|
+
logger.ok(import_node_path31.default.relative(cwd2, outPath));
|
|
11289
11596
|
output.writeText("");
|
|
11290
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"));
|
|
11291
11598
|
output.writeText(import_picocolors6.default.bold(import_picocolors6.default.green(" \u2713 types generated")));
|
|
@@ -11296,11 +11603,11 @@ async function runGenerateTypesCli(rawArgs) {
|
|
|
11296
11603
|
}
|
|
11297
11604
|
async function loadNativeBinding2(cwd2) {
|
|
11298
11605
|
const candidates = [
|
|
11299
|
-
|
|
11300
|
-
|
|
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")
|
|
11301
11608
|
];
|
|
11302
11609
|
for (const candidate of candidates) {
|
|
11303
|
-
if (
|
|
11610
|
+
if (import_node_fs14.default.existsSync(candidate)) {
|
|
11304
11611
|
try {
|
|
11305
11612
|
return require(candidate);
|
|
11306
11613
|
} catch {
|
|
@@ -11317,8 +11624,8 @@ init_errors();
|
|
|
11317
11624
|
|
|
11318
11625
|
// packages/infrastructure/cli/src/utils/whyService.ts
|
|
11319
11626
|
init_cjs_shims();
|
|
11320
|
-
var
|
|
11321
|
-
var
|
|
11627
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
|
11628
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
|
11322
11629
|
init_internal();
|
|
11323
11630
|
init_src2();
|
|
11324
11631
|
function extractVariantChain(usage) {
|
|
@@ -11367,7 +11674,7 @@ async function whyClass(className, options) {
|
|
|
11367
11674
|
for (const file of scanResult.files) {
|
|
11368
11675
|
const source = (() => {
|
|
11369
11676
|
try {
|
|
11370
|
-
return
|
|
11677
|
+
return import_node_fs15.default.readFileSync(file.file, "utf8");
|
|
11371
11678
|
} catch {
|
|
11372
11679
|
return "";
|
|
11373
11680
|
}
|
|
@@ -11381,7 +11688,7 @@ async function whyClass(className, options) {
|
|
|
11381
11688
|
className
|
|
11382
11689
|
]);
|
|
11383
11690
|
usedIn.push({
|
|
11384
|
-
file:
|
|
11691
|
+
file: import_node_path32.default.relative(root, file.file) || import_node_path32.default.basename(file.file),
|
|
11385
11692
|
line: location.line,
|
|
11386
11693
|
column: location.column,
|
|
11387
11694
|
usage: normalizeScannedClass(fileClass)
|
|
@@ -11688,6 +11995,12 @@ function buildMainProgram(context) {
|
|
|
11688
11995
|
);
|
|
11689
11996
|
});
|
|
11690
11997
|
});
|
|
11998
|
+
const figmaTopLevel = program2.command("figma").description("Figma design token sync");
|
|
11999
|
+
["pull", "push", "diff"].forEach((subcommand) => {
|
|
12000
|
+
figmaTopLevel.command(`${subcommand} [args...]`).description(`Figma ${subcommand}`).allowUnknownOption(true).action(async (args) => {
|
|
12001
|
+
await figmaCommand.run(contextArgs([subcommand, ...toVariadic(args)], context), context);
|
|
12002
|
+
});
|
|
12003
|
+
});
|
|
11691
12004
|
program2.command("test").description("Test shortcut wrapper").option("--watch", "Watch mode").action(async (...actionArgs) => {
|
|
11692
12005
|
const options = actionCommand(actionArgs).opts();
|
|
11693
12006
|
const args = [];
|