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/compiler.js
CHANGED
|
@@ -186,7 +186,7 @@ var init_nativeBridge = __esm({
|
|
|
186
186
|
"use strict";
|
|
187
187
|
init_cjs_shims();
|
|
188
188
|
init_src();
|
|
189
|
-
_loadNative = (
|
|
189
|
+
_loadNative = (path6) => require(path6);
|
|
190
190
|
log = (...args) => {
|
|
191
191
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
192
192
|
console.log("[compiler:native]", ...args);
|
|
@@ -2224,6 +2224,321 @@ var init_routeGraph = __esm({
|
|
|
2224
2224
|
}
|
|
2225
2225
|
});
|
|
2226
2226
|
|
|
2227
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2228
|
+
function inferSemanticFromTag(tag) {
|
|
2229
|
+
const tagLower = tag.toLowerCase();
|
|
2230
|
+
const semanticMap = {
|
|
2231
|
+
"button": "button",
|
|
2232
|
+
"a": "link",
|
|
2233
|
+
"nav": "navigation",
|
|
2234
|
+
"h1": "heading",
|
|
2235
|
+
"h2": "heading",
|
|
2236
|
+
"h3": "heading",
|
|
2237
|
+
"h4": "heading",
|
|
2238
|
+
"h5": "heading",
|
|
2239
|
+
"h6": "heading",
|
|
2240
|
+
"p": "paragraph",
|
|
2241
|
+
"ul": "list",
|
|
2242
|
+
"ol": "list",
|
|
2243
|
+
"input": "input",
|
|
2244
|
+
"form": "form",
|
|
2245
|
+
"dialog": "dialog",
|
|
2246
|
+
"select": "select",
|
|
2247
|
+
"textarea": "input"
|
|
2248
|
+
};
|
|
2249
|
+
return semanticMap[tagLower] ?? "custom";
|
|
2250
|
+
}
|
|
2251
|
+
function extractSemanticMetadata(config) {
|
|
2252
|
+
const metadata = {};
|
|
2253
|
+
for (const [key, value] of Object.entries(config)) {
|
|
2254
|
+
if (key.startsWith("@")) {
|
|
2255
|
+
metadata[key] = value;
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
return metadata;
|
|
2259
|
+
}
|
|
2260
|
+
function analyzeComponentSemantics(componentName, config) {
|
|
2261
|
+
const metadata = extractSemanticMetadata(config);
|
|
2262
|
+
const tag = config.tag ?? "div";
|
|
2263
|
+
let semantic = inferSemanticFromTag(tag);
|
|
2264
|
+
if (metadata["@semantic"]) {
|
|
2265
|
+
semantic = metadata["@semantic"];
|
|
2266
|
+
}
|
|
2267
|
+
const stateProperties = /* @__PURE__ */ new Map();
|
|
2268
|
+
if (metadata["@state"]) {
|
|
2269
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2270
|
+
if (typeof value === "string") {
|
|
2271
|
+
stateProperties.set(key, value);
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
return {
|
|
2276
|
+
componentName,
|
|
2277
|
+
tag,
|
|
2278
|
+
semantic,
|
|
2279
|
+
metadata,
|
|
2280
|
+
stateProperties
|
|
2281
|
+
};
|
|
2282
|
+
}
|
|
2283
|
+
function getAriaRoleForSemantic(semantic) {
|
|
2284
|
+
const roleMap = {
|
|
2285
|
+
"button": "button",
|
|
2286
|
+
"link": "link",
|
|
2287
|
+
"navigation": "navigation",
|
|
2288
|
+
"heading": "heading",
|
|
2289
|
+
"paragraph": void 0,
|
|
2290
|
+
// paragraph tidak perlu explicit role
|
|
2291
|
+
"list": "list",
|
|
2292
|
+
"input": "textbox",
|
|
2293
|
+
"form": "form",
|
|
2294
|
+
"dialog": "dialog",
|
|
2295
|
+
"alert": "alert",
|
|
2296
|
+
"tab": "tab",
|
|
2297
|
+
"checkbox": "checkbox",
|
|
2298
|
+
"radio": "radio",
|
|
2299
|
+
"select": "listbox",
|
|
2300
|
+
"custom": void 0
|
|
2301
|
+
};
|
|
2302
|
+
return roleMap[semantic];
|
|
2303
|
+
}
|
|
2304
|
+
function analyzeComponentBatch(components) {
|
|
2305
|
+
const results = /* @__PURE__ */ new Map();
|
|
2306
|
+
for (const [name, config] of components) {
|
|
2307
|
+
const analysis = analyzeComponentSemantics(name, config);
|
|
2308
|
+
results.set(name, analysis);
|
|
2309
|
+
}
|
|
2310
|
+
return results;
|
|
2311
|
+
}
|
|
2312
|
+
function validateSemanticMetadata(metadata) {
|
|
2313
|
+
const issues = [];
|
|
2314
|
+
const validSemantics = [
|
|
2315
|
+
"button",
|
|
2316
|
+
"link",
|
|
2317
|
+
"navigation",
|
|
2318
|
+
"heading",
|
|
2319
|
+
"paragraph",
|
|
2320
|
+
"list",
|
|
2321
|
+
"input",
|
|
2322
|
+
"form",
|
|
2323
|
+
"dialog",
|
|
2324
|
+
"alert",
|
|
2325
|
+
"tab",
|
|
2326
|
+
"checkbox",
|
|
2327
|
+
"radio",
|
|
2328
|
+
"select",
|
|
2329
|
+
"custom"
|
|
2330
|
+
];
|
|
2331
|
+
if (metadata["@semantic"] && !validSemantics.includes(metadata["@semantic"])) {
|
|
2332
|
+
issues.push(`Invalid @semantic value: ${metadata["@semantic"]}`);
|
|
2333
|
+
}
|
|
2334
|
+
if (metadata["@aria"]) {
|
|
2335
|
+
if (typeof metadata["@aria"] !== "object" || Array.isArray(metadata["@aria"])) {
|
|
2336
|
+
issues.push("@aria must be object");
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
if (metadata["@state"]) {
|
|
2340
|
+
if (typeof metadata["@state"] !== "object" || Array.isArray(metadata["@state"])) {
|
|
2341
|
+
issues.push("@state must be object");
|
|
2342
|
+
}
|
|
2343
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2344
|
+
if (typeof value !== "string") {
|
|
2345
|
+
issues.push(`@state.${key} must be string (ARIA property name)`);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
return issues;
|
|
2350
|
+
}
|
|
2351
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2352
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2353
|
+
"use strict";
|
|
2354
|
+
init_cjs_shims();
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
|
|
2358
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2359
|
+
function generateJsDocFromSemantic(analysis) {
|
|
2360
|
+
const lines = [
|
|
2361
|
+
"/**",
|
|
2362
|
+
` * ${analysis.componentName}`,
|
|
2363
|
+
` * `,
|
|
2364
|
+
` * Semantic intent: ${analysis.semantic}`,
|
|
2365
|
+
` * Tag: ${analysis.tag}`
|
|
2366
|
+
];
|
|
2367
|
+
if (analysis.metadata["@aria"]) {
|
|
2368
|
+
lines.push(` * ARIA: auto-injected dari semantic metadata`);
|
|
2369
|
+
}
|
|
2370
|
+
if (analysis.stateProperties.size > 0) {
|
|
2371
|
+
const states = Array.from(analysis.stateProperties.entries()).map(([k, v]) => `${k} \u2192 ${v}`).join(", ");
|
|
2372
|
+
lines.push(` * State mappings: ${states}`);
|
|
2373
|
+
}
|
|
2374
|
+
lines.push(" */");
|
|
2375
|
+
return lines.join("\n");
|
|
2376
|
+
}
|
|
2377
|
+
function getBaseComponentType(analysis) {
|
|
2378
|
+
const tag = analysis.tag.toLowerCase();
|
|
2379
|
+
const tagMap = {
|
|
2380
|
+
"button": "React.ButtonHTMLAttributes<HTMLButtonElement>",
|
|
2381
|
+
"a": "React.AnchorHTMLAttributes<HTMLAnchorElement>",
|
|
2382
|
+
"input": "React.InputHTMLAttributes<HTMLInputElement>",
|
|
2383
|
+
"textarea": "React.TextareaHTMLAttributes<HTMLTextAreaElement>",
|
|
2384
|
+
"select": "React.SelectHTMLAttributes<HTMLSelectElement>",
|
|
2385
|
+
"form": "React.FormHTMLAttributes<HTMLFormElement>",
|
|
2386
|
+
"div": "React.HTMLAttributes<HTMLDivElement>",
|
|
2387
|
+
"span": "React.HTMLAttributes<HTMLSpanElement>",
|
|
2388
|
+
"nav": "React.HTMLAttributes<HTMLElement>",
|
|
2389
|
+
"dialog": "React.DialogHTMLAttributes<HTMLDialogElement>"
|
|
2390
|
+
};
|
|
2391
|
+
return tagMap[tag] ?? "React.HTMLAttributes<HTMLElement>";
|
|
2392
|
+
}
|
|
2393
|
+
function generateStateProperties(analysis) {
|
|
2394
|
+
const props = /* @__PURE__ */ new Map();
|
|
2395
|
+
for (const [stateName, ariaProp] of analysis.stateProperties) {
|
|
2396
|
+
props.set(stateName, {
|
|
2397
|
+
name: stateName,
|
|
2398
|
+
type: "boolean | undefined",
|
|
2399
|
+
description: `State mapped to ARIA property: ${ariaProp}`,
|
|
2400
|
+
optional: true
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2403
|
+
return props;
|
|
2404
|
+
}
|
|
2405
|
+
function generateTypeDefinition(analysis, componentName) {
|
|
2406
|
+
const interfaceName = `${componentName}Props`;
|
|
2407
|
+
const baseType = getBaseComponentType(analysis);
|
|
2408
|
+
const stateProps = generateStateProperties(analysis);
|
|
2409
|
+
return {
|
|
2410
|
+
interfaceName,
|
|
2411
|
+
extendsFrom: baseType,
|
|
2412
|
+
properties: stateProps,
|
|
2413
|
+
jsDocComment: generateJsDocFromSemantic(analysis)
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
function renderTypeDefinition(def) {
|
|
2417
|
+
const lines = [];
|
|
2418
|
+
if (def.jsDocComment) {
|
|
2419
|
+
lines.push(def.jsDocComment);
|
|
2420
|
+
}
|
|
2421
|
+
lines.push(`export interface ${def.interfaceName} extends ${def.extendsFrom} {`);
|
|
2422
|
+
for (const prop of def.properties.values()) {
|
|
2423
|
+
const optional = prop.optional ? "?" : "";
|
|
2424
|
+
if (prop.description) {
|
|
2425
|
+
lines.push(` /** ${prop.description} */`);
|
|
2426
|
+
}
|
|
2427
|
+
lines.push(` ${prop.name}${optional}: ${prop.type}`);
|
|
2428
|
+
}
|
|
2429
|
+
lines.push("}");
|
|
2430
|
+
return lines.join("\n");
|
|
2431
|
+
}
|
|
2432
|
+
function generateTypeStubFile(analyses, packageName = "tailwind-styled") {
|
|
2433
|
+
const lines = [
|
|
2434
|
+
"/**",
|
|
2435
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2436
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2437
|
+
` * Package: ${packageName}`,
|
|
2438
|
+
` */`,
|
|
2439
|
+
"",
|
|
2440
|
+
"import type * as React from 'react'",
|
|
2441
|
+
""
|
|
2442
|
+
];
|
|
2443
|
+
const interfaces = [];
|
|
2444
|
+
for (const [name, analysis] of analyses) {
|
|
2445
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2446
|
+
interfaces.push(renderTypeDefinition(def));
|
|
2447
|
+
}
|
|
2448
|
+
lines.push(interfaces.join("\n\n"));
|
|
2449
|
+
lines.push("");
|
|
2450
|
+
lines.push("export namespace Components {");
|
|
2451
|
+
for (const analysis of analyses.values()) {
|
|
2452
|
+
lines.push(` export type ${analysis.componentName}Props = ${analysis.componentName}Props`);
|
|
2453
|
+
}
|
|
2454
|
+
lines.push("}");
|
|
2455
|
+
lines.push("");
|
|
2456
|
+
return lines.join("\n");
|
|
2457
|
+
}
|
|
2458
|
+
function generateTypeStubOutputPaths(outputDir, packageName) {
|
|
2459
|
+
return [
|
|
2460
|
+
{
|
|
2461
|
+
filePath: `${outputDir}/${packageName}.d.ts`,
|
|
2462
|
+
content: "",
|
|
2463
|
+
// Will be set by caller
|
|
2464
|
+
format: "dts"
|
|
2465
|
+
}
|
|
2466
|
+
];
|
|
2467
|
+
}
|
|
2468
|
+
function generateTypeDefinitionsBatch(analyses) {
|
|
2469
|
+
const results = /* @__PURE__ */ new Map();
|
|
2470
|
+
for (const [name, analysis] of analyses) {
|
|
2471
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2472
|
+
const code = renderTypeDefinition(def);
|
|
2473
|
+
results.set(name, code);
|
|
2474
|
+
}
|
|
2475
|
+
return results;
|
|
2476
|
+
}
|
|
2477
|
+
function combineTypeDefinitions(definitions, packageName = "tailwind-styled") {
|
|
2478
|
+
const lines = [
|
|
2479
|
+
"/**",
|
|
2480
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2481
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2482
|
+
` * Package: ${packageName}`,
|
|
2483
|
+
" */",
|
|
2484
|
+
"",
|
|
2485
|
+
"import type * as React from 'react'",
|
|
2486
|
+
""
|
|
2487
|
+
];
|
|
2488
|
+
const defs = Array.from(definitions.values());
|
|
2489
|
+
lines.push(defs.join("\n\n"));
|
|
2490
|
+
return lines.join("\n");
|
|
2491
|
+
}
|
|
2492
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2493
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2494
|
+
"use strict";
|
|
2495
|
+
init_cjs_shims();
|
|
2496
|
+
}
|
|
2497
|
+
});
|
|
2498
|
+
|
|
2499
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2500
|
+
function createTypeGenerationPlugin(options = {}) {
|
|
2501
|
+
const {
|
|
2502
|
+
outputDir = "./dist/types",
|
|
2503
|
+
packageName = "tailwind-styled",
|
|
2504
|
+
verbose = false,
|
|
2505
|
+
componentRegistryPath
|
|
2506
|
+
} = options;
|
|
2507
|
+
return {
|
|
2508
|
+
name: "type-generation",
|
|
2509
|
+
async setup(build) {
|
|
2510
|
+
if (verbose) {
|
|
2511
|
+
console.log("[type-generation] Plugin loaded");
|
|
2512
|
+
}
|
|
2513
|
+
}
|
|
2514
|
+
};
|
|
2515
|
+
}
|
|
2516
|
+
async function generateTypesFromComponents(components, outputPath, packageName = "tailwind-styled") {
|
|
2517
|
+
if (components.size === 0) {
|
|
2518
|
+
console.warn("No components provided");
|
|
2519
|
+
return;
|
|
2520
|
+
}
|
|
2521
|
+
const analyses = analyzeComponentBatch(components);
|
|
2522
|
+
const typeContent = generateTypeStubFile(analyses, packageName);
|
|
2523
|
+
const dir = import_node_path3.default.dirname(outputPath);
|
|
2524
|
+
if (!import_node_fs3.default.existsSync(dir)) {
|
|
2525
|
+
import_node_fs3.default.mkdirSync(dir, { recursive: true });
|
|
2526
|
+
}
|
|
2527
|
+
import_node_fs3.default.writeFileSync(outputPath, typeContent, "utf8");
|
|
2528
|
+
console.log(`Generated type stubs \u2192 ${outputPath} (${components.size} components)`);
|
|
2529
|
+
}
|
|
2530
|
+
var import_node_fs3, import_node_path3;
|
|
2531
|
+
var init_typeGenerationPlugin = __esm({
|
|
2532
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2533
|
+
"use strict";
|
|
2534
|
+
init_cjs_shims();
|
|
2535
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
2536
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
2537
|
+
init_semanticComponentAnalyzer();
|
|
2538
|
+
init_typeGeneratorFromMetadata();
|
|
2539
|
+
}
|
|
2540
|
+
});
|
|
2541
|
+
|
|
2227
2542
|
// packages/domain/compiler/src/index.ts
|
|
2228
2543
|
function _layoutClassesToCss(classes) {
|
|
2229
2544
|
const native = getNativeBridge();
|
|
@@ -2259,13 +2574,13 @@ function extractContainerCssFromSource(source) {
|
|
|
2259
2574
|
}
|
|
2260
2575
|
return rules.join("\n");
|
|
2261
2576
|
}
|
|
2262
|
-
var
|
|
2577
|
+
var import_node_fs4, import_node_path4, import_node_module5, _require3, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, _fileClassesMap, _globalClasses, getRouteClasses, getAllRegisteredClasses, registerFileClasses, registerGlobalClasses, resetRouteClassRegistry, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2263
2578
|
var init_src2 = __esm({
|
|
2264
2579
|
"packages/domain/compiler/src/index.ts"() {
|
|
2265
2580
|
"use strict";
|
|
2266
2581
|
init_cjs_shims();
|
|
2267
|
-
|
|
2268
|
-
|
|
2582
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
2583
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
2269
2584
|
import_node_module5 = require("module");
|
|
2270
2585
|
init_nativeBridge();
|
|
2271
2586
|
init_compiler();
|
|
@@ -2275,6 +2590,9 @@ var init_src2 = __esm({
|
|
|
2275
2590
|
init_redis();
|
|
2276
2591
|
init_watch();
|
|
2277
2592
|
init_routeGraph();
|
|
2593
|
+
init_semanticComponentAnalyzer();
|
|
2594
|
+
init_typeGeneratorFromMetadata();
|
|
2595
|
+
init_typeGenerationPlugin();
|
|
2278
2596
|
_require3 = (0, import_node_module5.createRequire)(
|
|
2279
2597
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
2280
2598
|
);
|
|
@@ -2369,7 +2687,7 @@ var init_src2 = __esm({
|
|
|
2369
2687
|
};
|
|
2370
2688
|
scanProjectUsage = (dirs, cwd) => {
|
|
2371
2689
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
2372
|
-
const files = dirs.map((dir) =>
|
|
2690
|
+
const files = dirs.map((dir) => import_node_path4.default.resolve(cwd, dir));
|
|
2373
2691
|
const results = batchExtractClasses2(files) || [];
|
|
2374
2692
|
const combined = {};
|
|
2375
2693
|
for (const result of results) {
|
|
@@ -2386,13 +2704,13 @@ var init_src2 = __esm({
|
|
|
2386
2704
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2387
2705
|
const allClasses = Object.keys(classes).sort();
|
|
2388
2706
|
if (outputPath) {
|
|
2389
|
-
|
|
2707
|
+
import_node_fs4.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2390
2708
|
}
|
|
2391
2709
|
return allClasses;
|
|
2392
2710
|
};
|
|
2393
2711
|
loadSafelist = (safelistPath) => {
|
|
2394
2712
|
try {
|
|
2395
|
-
const content =
|
|
2713
|
+
const content = import_node_fs4.default.readFileSync(safelistPath, "utf-8");
|
|
2396
2714
|
return JSON.parse(content);
|
|
2397
2715
|
} catch {
|
|
2398
2716
|
return [];
|
|
@@ -2406,8 +2724,8 @@ var init_src2 = __esm({
|
|
|
2406
2724
|
"tailwind.config.cjs"
|
|
2407
2725
|
];
|
|
2408
2726
|
for (const file of configFiles) {
|
|
2409
|
-
const fullPath =
|
|
2410
|
-
if (
|
|
2727
|
+
const fullPath = import_node_path4.default.join(cwd, file);
|
|
2728
|
+
if (import_node_fs4.default.existsSync(fullPath)) {
|
|
2411
2729
|
const mod = require(fullPath);
|
|
2412
2730
|
return mod.default || mod;
|
|
2413
2731
|
}
|
|
@@ -2417,9 +2735,9 @@ var init_src2 = __esm({
|
|
|
2417
2735
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2418
2736
|
return {
|
|
2419
2737
|
content: [
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2738
|
+
import_node_path4.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2739
|
+
import_node_path4.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2740
|
+
import_node_path4.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2423
2741
|
]
|
|
2424
2742
|
};
|
|
2425
2743
|
};
|
|
@@ -2651,6 +2969,8 @@ __export(compiler_exports, {
|
|
|
2651
2969
|
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
2652
2970
|
analyzeClasses: () => analyzeClasses,
|
|
2653
2971
|
analyzeClassesNative: () => analyzeClassesNative,
|
|
2972
|
+
analyzeComponentBatch: () => analyzeComponentBatch,
|
|
2973
|
+
analyzeComponentSemantics: () => analyzeComponentSemantics,
|
|
2654
2974
|
analyzeFile: () => analyzeFile,
|
|
2655
2975
|
analyzeRscNative: () => analyzeRscNative,
|
|
2656
2976
|
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
@@ -2677,6 +2997,7 @@ __export(compiler_exports, {
|
|
|
2677
2997
|
clearResolverPool: () => clearResolverPool,
|
|
2678
2998
|
clearThemeCache: () => clearThemeCache,
|
|
2679
2999
|
collectFiles: () => collectFiles,
|
|
3000
|
+
combineTypeDefinitions: () => combineTypeDefinitions,
|
|
2680
3001
|
compileAnimation: () => compileAnimation,
|
|
2681
3002
|
compileClass: () => compileClass,
|
|
2682
3003
|
compileClasses: () => compileClasses,
|
|
@@ -2690,6 +3011,7 @@ __export(compiler_exports, {
|
|
|
2690
3011
|
compileVariantTableNative: () => compileVariantTableNative,
|
|
2691
3012
|
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
2692
3013
|
createFingerprint: () => createFingerprint,
|
|
3014
|
+
createTypeGenerationPlugin: () => createTypeGenerationPlugin,
|
|
2693
3015
|
detectConflicts: () => detectConflicts,
|
|
2694
3016
|
detectDeadCode: () => detectDeadCode,
|
|
2695
3017
|
diffClassLists: () => diffClassLists,
|
|
@@ -2705,6 +3027,7 @@ __export(compiler_exports, {
|
|
|
2705
3027
|
extractClassesFromSourceNative: () => extractClassesFromSourceNative,
|
|
2706
3028
|
extractComponentUsage: () => extractComponentUsage,
|
|
2707
3029
|
extractContainerCssFromSource: () => extractContainerCssFromSource,
|
|
3030
|
+
extractSemanticMetadata: () => extractSemanticMetadata,
|
|
2708
3031
|
extractTwContainerConfigs: () => extractTwContainerConfigs,
|
|
2709
3032
|
extractTwStateConfigs: () => extractTwStateConfigs,
|
|
2710
3033
|
extractTwStateConfigsNative: () => extractTwStateConfigsNative,
|
|
@@ -2719,8 +3042,14 @@ __export(compiler_exports, {
|
|
|
2719
3042
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2720
3043
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2721
3044
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
3045
|
+
generateTypeDefinition: () => generateTypeDefinition,
|
|
3046
|
+
generateTypeDefinitionsBatch: () => generateTypeDefinitionsBatch,
|
|
3047
|
+
generateTypeStubFile: () => generateTypeStubFile,
|
|
3048
|
+
generateTypeStubOutputPaths: () => generateTypeStubOutputPaths,
|
|
3049
|
+
generateTypesFromComponents: () => generateTypesFromComponents,
|
|
2722
3050
|
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
2723
3051
|
getAllRoutes: () => getAllRoutes,
|
|
3052
|
+
getAriaRoleForSemantic: () => getAriaRoleForSemantic,
|
|
2724
3053
|
getBucketEngine: () => getBucketEngine,
|
|
2725
3054
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
2726
3055
|
getCacheStatistics: () => getCacheStatistics,
|
|
@@ -2816,6 +3145,7 @@ __export(compiler_exports, {
|
|
|
2816
3145
|
registerPluginHook: () => registerPluginHook,
|
|
2817
3146
|
registerPropertyName: () => registerPropertyName,
|
|
2818
3147
|
registerValueName: () => registerValueName,
|
|
3148
|
+
renderTypeDefinition: () => renderTypeDefinition,
|
|
2819
3149
|
resetBucketEngine: () => resetBucketEngine,
|
|
2820
3150
|
resetCacheStats: () => resetCacheStats,
|
|
2821
3151
|
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
@@ -2858,6 +3188,7 @@ __export(compiler_exports, {
|
|
|
2858
3188
|
twMergeWithSeparator: () => twMergeWithSeparator,
|
|
2859
3189
|
unregisterPluginHook: () => unregisterPluginHook,
|
|
2860
3190
|
validateCssOutput: () => validateCssOutput,
|
|
3191
|
+
validateSemanticMetadata: () => validateSemanticMetadata,
|
|
2861
3192
|
validateThemeConfig: () => validateThemeConfig,
|
|
2862
3193
|
valueIdToString: () => valueIdToString,
|
|
2863
3194
|
walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
|
|
@@ -2880,6 +3211,8 @@ init_src2();
|
|
|
2880
3211
|
analyzeClassUsageNative,
|
|
2881
3212
|
analyzeClasses,
|
|
2882
3213
|
analyzeClassesNative,
|
|
3214
|
+
analyzeComponentBatch,
|
|
3215
|
+
analyzeComponentSemantics,
|
|
2883
3216
|
analyzeFile,
|
|
2884
3217
|
analyzeRscNative,
|
|
2885
3218
|
analyzeVariantUsage,
|
|
@@ -2906,6 +3239,7 @@ init_src2();
|
|
|
2906
3239
|
clearResolverPool,
|
|
2907
3240
|
clearThemeCache,
|
|
2908
3241
|
collectFiles,
|
|
3242
|
+
combineTypeDefinitions,
|
|
2909
3243
|
compileAnimation,
|
|
2910
3244
|
compileClass,
|
|
2911
3245
|
compileClasses,
|
|
@@ -2919,6 +3253,7 @@ init_src2();
|
|
|
2919
3253
|
compileVariantTableNative,
|
|
2920
3254
|
computeIncrementalDiff,
|
|
2921
3255
|
createFingerprint,
|
|
3256
|
+
createTypeGenerationPlugin,
|
|
2922
3257
|
detectConflicts,
|
|
2923
3258
|
detectDeadCode,
|
|
2924
3259
|
diffClassLists,
|
|
@@ -2934,6 +3269,7 @@ init_src2();
|
|
|
2934
3269
|
extractClassesFromSourceNative,
|
|
2935
3270
|
extractComponentUsage,
|
|
2936
3271
|
extractContainerCssFromSource,
|
|
3272
|
+
extractSemanticMetadata,
|
|
2937
3273
|
extractTwContainerConfigs,
|
|
2938
3274
|
extractTwStateConfigs,
|
|
2939
3275
|
extractTwStateConfigsNative,
|
|
@@ -2948,8 +3284,14 @@ init_src2();
|
|
|
2948
3284
|
generateStaticStateCss,
|
|
2949
3285
|
generateStaticStateCssNative,
|
|
2950
3286
|
generateSubComponentTypes,
|
|
3287
|
+
generateTypeDefinition,
|
|
3288
|
+
generateTypeDefinitionsBatch,
|
|
3289
|
+
generateTypeStubFile,
|
|
3290
|
+
generateTypeStubOutputPaths,
|
|
3291
|
+
generateTypesFromComponents,
|
|
2951
3292
|
getAllRegisteredClasses,
|
|
2952
3293
|
getAllRoutes,
|
|
3294
|
+
getAriaRoleForSemantic,
|
|
2953
3295
|
getBucketEngine,
|
|
2954
3296
|
getCacheOptimizationHints,
|
|
2955
3297
|
getCacheStatistics,
|
|
@@ -3045,6 +3387,7 @@ init_src2();
|
|
|
3045
3387
|
registerPluginHook,
|
|
3046
3388
|
registerPropertyName,
|
|
3047
3389
|
registerValueName,
|
|
3390
|
+
renderTypeDefinition,
|
|
3048
3391
|
resetBucketEngine,
|
|
3049
3392
|
resetCacheStats,
|
|
3050
3393
|
resetCompilationMetrics,
|
|
@@ -3087,6 +3430,7 @@ init_src2();
|
|
|
3087
3430
|
twMergeWithSeparator,
|
|
3088
3431
|
unregisterPluginHook,
|
|
3089
3432
|
validateCssOutput,
|
|
3433
|
+
validateSemanticMetadata,
|
|
3090
3434
|
validateThemeConfig,
|
|
3091
3435
|
valueIdToString,
|
|
3092
3436
|
walkAndPrefilterSourceFiles,
|