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/next.mjs
CHANGED
|
@@ -65,11 +65,11 @@ function resolvePath(...segments) {
|
|
|
65
65
|
return segments.join("/").replace(/\/+/g, "/");
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
function existsSync(
|
|
68
|
+
function existsSync(path15) {
|
|
69
69
|
if (isBrowser) return false;
|
|
70
70
|
try {
|
|
71
71
|
const nodeFs = __require(NODE_FS);
|
|
72
|
-
return nodeFs.existsSync(
|
|
72
|
+
return nodeFs.existsSync(path15);
|
|
73
73
|
} catch {
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
@@ -250,7 +250,7 @@ var init_nativeBridge = __esm({
|
|
|
250
250
|
"use strict";
|
|
251
251
|
init_esm_shims();
|
|
252
252
|
init_src2();
|
|
253
|
-
_loadNative = (
|
|
253
|
+
_loadNative = (path15) => __require(path15);
|
|
254
254
|
log = (...args) => {
|
|
255
255
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
256
256
|
console.log("[compiler:native]", ...args);
|
|
@@ -2286,6 +2286,320 @@ var init_routeGraph = __esm({
|
|
|
2286
2286
|
}
|
|
2287
2287
|
});
|
|
2288
2288
|
|
|
2289
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2290
|
+
function inferSemanticFromTag(tag) {
|
|
2291
|
+
const tagLower = tag.toLowerCase();
|
|
2292
|
+
const semanticMap = {
|
|
2293
|
+
"button": "button",
|
|
2294
|
+
"a": "link",
|
|
2295
|
+
"nav": "navigation",
|
|
2296
|
+
"h1": "heading",
|
|
2297
|
+
"h2": "heading",
|
|
2298
|
+
"h3": "heading",
|
|
2299
|
+
"h4": "heading",
|
|
2300
|
+
"h5": "heading",
|
|
2301
|
+
"h6": "heading",
|
|
2302
|
+
"p": "paragraph",
|
|
2303
|
+
"ul": "list",
|
|
2304
|
+
"ol": "list",
|
|
2305
|
+
"input": "input",
|
|
2306
|
+
"form": "form",
|
|
2307
|
+
"dialog": "dialog",
|
|
2308
|
+
"select": "select",
|
|
2309
|
+
"textarea": "input"
|
|
2310
|
+
};
|
|
2311
|
+
return semanticMap[tagLower] ?? "custom";
|
|
2312
|
+
}
|
|
2313
|
+
function extractSemanticMetadata(config) {
|
|
2314
|
+
const metadata = {};
|
|
2315
|
+
for (const [key, value] of Object.entries(config)) {
|
|
2316
|
+
if (key.startsWith("@")) {
|
|
2317
|
+
metadata[key] = value;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
return metadata;
|
|
2321
|
+
}
|
|
2322
|
+
function analyzeComponentSemantics(componentName, config) {
|
|
2323
|
+
const metadata = extractSemanticMetadata(config);
|
|
2324
|
+
const tag = config.tag ?? "div";
|
|
2325
|
+
let semantic = inferSemanticFromTag(tag);
|
|
2326
|
+
if (metadata["@semantic"]) {
|
|
2327
|
+
semantic = metadata["@semantic"];
|
|
2328
|
+
}
|
|
2329
|
+
const stateProperties = /* @__PURE__ */ new Map();
|
|
2330
|
+
if (metadata["@state"]) {
|
|
2331
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2332
|
+
if (typeof value === "string") {
|
|
2333
|
+
stateProperties.set(key, value);
|
|
2334
|
+
}
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
return {
|
|
2338
|
+
componentName,
|
|
2339
|
+
tag,
|
|
2340
|
+
semantic,
|
|
2341
|
+
metadata,
|
|
2342
|
+
stateProperties
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
function getAriaRoleForSemantic(semantic) {
|
|
2346
|
+
const roleMap = {
|
|
2347
|
+
"button": "button",
|
|
2348
|
+
"link": "link",
|
|
2349
|
+
"navigation": "navigation",
|
|
2350
|
+
"heading": "heading",
|
|
2351
|
+
"paragraph": void 0,
|
|
2352
|
+
// paragraph tidak perlu explicit role
|
|
2353
|
+
"list": "list",
|
|
2354
|
+
"input": "textbox",
|
|
2355
|
+
"form": "form",
|
|
2356
|
+
"dialog": "dialog",
|
|
2357
|
+
"alert": "alert",
|
|
2358
|
+
"tab": "tab",
|
|
2359
|
+
"checkbox": "checkbox",
|
|
2360
|
+
"radio": "radio",
|
|
2361
|
+
"select": "listbox",
|
|
2362
|
+
"custom": void 0
|
|
2363
|
+
};
|
|
2364
|
+
return roleMap[semantic];
|
|
2365
|
+
}
|
|
2366
|
+
function analyzeComponentBatch(components) {
|
|
2367
|
+
const results = /* @__PURE__ */ new Map();
|
|
2368
|
+
for (const [name, config] of components) {
|
|
2369
|
+
const analysis = analyzeComponentSemantics(name, config);
|
|
2370
|
+
results.set(name, analysis);
|
|
2371
|
+
}
|
|
2372
|
+
return results;
|
|
2373
|
+
}
|
|
2374
|
+
function validateSemanticMetadata(metadata) {
|
|
2375
|
+
const issues = [];
|
|
2376
|
+
const validSemantics = [
|
|
2377
|
+
"button",
|
|
2378
|
+
"link",
|
|
2379
|
+
"navigation",
|
|
2380
|
+
"heading",
|
|
2381
|
+
"paragraph",
|
|
2382
|
+
"list",
|
|
2383
|
+
"input",
|
|
2384
|
+
"form",
|
|
2385
|
+
"dialog",
|
|
2386
|
+
"alert",
|
|
2387
|
+
"tab",
|
|
2388
|
+
"checkbox",
|
|
2389
|
+
"radio",
|
|
2390
|
+
"select",
|
|
2391
|
+
"custom"
|
|
2392
|
+
];
|
|
2393
|
+
if (metadata["@semantic"] && !validSemantics.includes(metadata["@semantic"])) {
|
|
2394
|
+
issues.push(`Invalid @semantic value: ${metadata["@semantic"]}`);
|
|
2395
|
+
}
|
|
2396
|
+
if (metadata["@aria"]) {
|
|
2397
|
+
if (typeof metadata["@aria"] !== "object" || Array.isArray(metadata["@aria"])) {
|
|
2398
|
+
issues.push("@aria must be object");
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
if (metadata["@state"]) {
|
|
2402
|
+
if (typeof metadata["@state"] !== "object" || Array.isArray(metadata["@state"])) {
|
|
2403
|
+
issues.push("@state must be object");
|
|
2404
|
+
}
|
|
2405
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2406
|
+
if (typeof value !== "string") {
|
|
2407
|
+
issues.push(`@state.${key} must be string (ARIA property name)`);
|
|
2408
|
+
}
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
return issues;
|
|
2412
|
+
}
|
|
2413
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2414
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2415
|
+
"use strict";
|
|
2416
|
+
init_esm_shims();
|
|
2417
|
+
}
|
|
2418
|
+
});
|
|
2419
|
+
|
|
2420
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2421
|
+
function generateJsDocFromSemantic(analysis) {
|
|
2422
|
+
const lines = [
|
|
2423
|
+
"/**",
|
|
2424
|
+
` * ${analysis.componentName}`,
|
|
2425
|
+
` * `,
|
|
2426
|
+
` * Semantic intent: ${analysis.semantic}`,
|
|
2427
|
+
` * Tag: ${analysis.tag}`
|
|
2428
|
+
];
|
|
2429
|
+
if (analysis.metadata["@aria"]) {
|
|
2430
|
+
lines.push(` * ARIA: auto-injected dari semantic metadata`);
|
|
2431
|
+
}
|
|
2432
|
+
if (analysis.stateProperties.size > 0) {
|
|
2433
|
+
const states = Array.from(analysis.stateProperties.entries()).map(([k, v]) => `${k} \u2192 ${v}`).join(", ");
|
|
2434
|
+
lines.push(` * State mappings: ${states}`);
|
|
2435
|
+
}
|
|
2436
|
+
lines.push(" */");
|
|
2437
|
+
return lines.join("\n");
|
|
2438
|
+
}
|
|
2439
|
+
function getBaseComponentType(analysis) {
|
|
2440
|
+
const tag = analysis.tag.toLowerCase();
|
|
2441
|
+
const tagMap = {
|
|
2442
|
+
"button": "React.ButtonHTMLAttributes<HTMLButtonElement>",
|
|
2443
|
+
"a": "React.AnchorHTMLAttributes<HTMLAnchorElement>",
|
|
2444
|
+
"input": "React.InputHTMLAttributes<HTMLInputElement>",
|
|
2445
|
+
"textarea": "React.TextareaHTMLAttributes<HTMLTextAreaElement>",
|
|
2446
|
+
"select": "React.SelectHTMLAttributes<HTMLSelectElement>",
|
|
2447
|
+
"form": "React.FormHTMLAttributes<HTMLFormElement>",
|
|
2448
|
+
"div": "React.HTMLAttributes<HTMLDivElement>",
|
|
2449
|
+
"span": "React.HTMLAttributes<HTMLSpanElement>",
|
|
2450
|
+
"nav": "React.HTMLAttributes<HTMLElement>",
|
|
2451
|
+
"dialog": "React.DialogHTMLAttributes<HTMLDialogElement>"
|
|
2452
|
+
};
|
|
2453
|
+
return tagMap[tag] ?? "React.HTMLAttributes<HTMLElement>";
|
|
2454
|
+
}
|
|
2455
|
+
function generateStateProperties(analysis) {
|
|
2456
|
+
const props = /* @__PURE__ */ new Map();
|
|
2457
|
+
for (const [stateName, ariaProp] of analysis.stateProperties) {
|
|
2458
|
+
props.set(stateName, {
|
|
2459
|
+
name: stateName,
|
|
2460
|
+
type: "boolean | undefined",
|
|
2461
|
+
description: `State mapped to ARIA property: ${ariaProp}`,
|
|
2462
|
+
optional: true
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
return props;
|
|
2466
|
+
}
|
|
2467
|
+
function generateTypeDefinition(analysis, componentName) {
|
|
2468
|
+
const interfaceName = `${componentName}Props`;
|
|
2469
|
+
const baseType = getBaseComponentType(analysis);
|
|
2470
|
+
const stateProps = generateStateProperties(analysis);
|
|
2471
|
+
return {
|
|
2472
|
+
interfaceName,
|
|
2473
|
+
extendsFrom: baseType,
|
|
2474
|
+
properties: stateProps,
|
|
2475
|
+
jsDocComment: generateJsDocFromSemantic(analysis)
|
|
2476
|
+
};
|
|
2477
|
+
}
|
|
2478
|
+
function renderTypeDefinition(def) {
|
|
2479
|
+
const lines = [];
|
|
2480
|
+
if (def.jsDocComment) {
|
|
2481
|
+
lines.push(def.jsDocComment);
|
|
2482
|
+
}
|
|
2483
|
+
lines.push(`export interface ${def.interfaceName} extends ${def.extendsFrom} {`);
|
|
2484
|
+
for (const prop of def.properties.values()) {
|
|
2485
|
+
const optional = prop.optional ? "?" : "";
|
|
2486
|
+
if (prop.description) {
|
|
2487
|
+
lines.push(` /** ${prop.description} */`);
|
|
2488
|
+
}
|
|
2489
|
+
lines.push(` ${prop.name}${optional}: ${prop.type}`);
|
|
2490
|
+
}
|
|
2491
|
+
lines.push("}");
|
|
2492
|
+
return lines.join("\n");
|
|
2493
|
+
}
|
|
2494
|
+
function generateTypeStubFile(analyses, packageName = "tailwind-styled") {
|
|
2495
|
+
const lines = [
|
|
2496
|
+
"/**",
|
|
2497
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2498
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2499
|
+
` * Package: ${packageName}`,
|
|
2500
|
+
` */`,
|
|
2501
|
+
"",
|
|
2502
|
+
"import type * as React from 'react'",
|
|
2503
|
+
""
|
|
2504
|
+
];
|
|
2505
|
+
const interfaces = [];
|
|
2506
|
+
for (const [name, analysis] of analyses) {
|
|
2507
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2508
|
+
interfaces.push(renderTypeDefinition(def));
|
|
2509
|
+
}
|
|
2510
|
+
lines.push(interfaces.join("\n\n"));
|
|
2511
|
+
lines.push("");
|
|
2512
|
+
lines.push("export namespace Components {");
|
|
2513
|
+
for (const analysis of analyses.values()) {
|
|
2514
|
+
lines.push(` export type ${analysis.componentName}Props = ${analysis.componentName}Props`);
|
|
2515
|
+
}
|
|
2516
|
+
lines.push("}");
|
|
2517
|
+
lines.push("");
|
|
2518
|
+
return lines.join("\n");
|
|
2519
|
+
}
|
|
2520
|
+
function generateTypeStubOutputPaths(outputDir, packageName) {
|
|
2521
|
+
return [
|
|
2522
|
+
{
|
|
2523
|
+
filePath: `${outputDir}/${packageName}.d.ts`,
|
|
2524
|
+
content: "",
|
|
2525
|
+
// Will be set by caller
|
|
2526
|
+
format: "dts"
|
|
2527
|
+
}
|
|
2528
|
+
];
|
|
2529
|
+
}
|
|
2530
|
+
function generateTypeDefinitionsBatch(analyses) {
|
|
2531
|
+
const results = /* @__PURE__ */ new Map();
|
|
2532
|
+
for (const [name, analysis] of analyses) {
|
|
2533
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2534
|
+
const code = renderTypeDefinition(def);
|
|
2535
|
+
results.set(name, code);
|
|
2536
|
+
}
|
|
2537
|
+
return results;
|
|
2538
|
+
}
|
|
2539
|
+
function combineTypeDefinitions(definitions, packageName = "tailwind-styled") {
|
|
2540
|
+
const lines = [
|
|
2541
|
+
"/**",
|
|
2542
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2543
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2544
|
+
` * Package: ${packageName}`,
|
|
2545
|
+
" */",
|
|
2546
|
+
"",
|
|
2547
|
+
"import type * as React from 'react'",
|
|
2548
|
+
""
|
|
2549
|
+
];
|
|
2550
|
+
const defs = Array.from(definitions.values());
|
|
2551
|
+
lines.push(defs.join("\n\n"));
|
|
2552
|
+
return lines.join("\n");
|
|
2553
|
+
}
|
|
2554
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2555
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2556
|
+
"use strict";
|
|
2557
|
+
init_esm_shims();
|
|
2558
|
+
}
|
|
2559
|
+
});
|
|
2560
|
+
|
|
2561
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2562
|
+
import fs3 from "fs";
|
|
2563
|
+
import path4 from "path";
|
|
2564
|
+
function createTypeGenerationPlugin(options = {}) {
|
|
2565
|
+
const {
|
|
2566
|
+
outputDir = "./dist/types",
|
|
2567
|
+
packageName = "tailwind-styled",
|
|
2568
|
+
verbose = false,
|
|
2569
|
+
componentRegistryPath
|
|
2570
|
+
} = options;
|
|
2571
|
+
return {
|
|
2572
|
+
name: "type-generation",
|
|
2573
|
+
async setup(build) {
|
|
2574
|
+
if (verbose) {
|
|
2575
|
+
console.log("[type-generation] Plugin loaded");
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
async function generateTypesFromComponents(components, outputPath, packageName = "tailwind-styled") {
|
|
2581
|
+
if (components.size === 0) {
|
|
2582
|
+
console.warn("No components provided");
|
|
2583
|
+
return;
|
|
2584
|
+
}
|
|
2585
|
+
const analyses = analyzeComponentBatch(components);
|
|
2586
|
+
const typeContent = generateTypeStubFile(analyses, packageName);
|
|
2587
|
+
const dir = path4.dirname(outputPath);
|
|
2588
|
+
if (!fs3.existsSync(dir)) {
|
|
2589
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
2590
|
+
}
|
|
2591
|
+
fs3.writeFileSync(outputPath, typeContent, "utf8");
|
|
2592
|
+
console.log(`Generated type stubs \u2192 ${outputPath} (${components.size} components)`);
|
|
2593
|
+
}
|
|
2594
|
+
var init_typeGenerationPlugin = __esm({
|
|
2595
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2596
|
+
"use strict";
|
|
2597
|
+
init_esm_shims();
|
|
2598
|
+
init_semanticComponentAnalyzer();
|
|
2599
|
+
init_typeGeneratorFromMetadata();
|
|
2600
|
+
}
|
|
2601
|
+
});
|
|
2602
|
+
|
|
2289
2603
|
// packages/domain/compiler/src/index.ts
|
|
2290
2604
|
var src_exports = {};
|
|
2291
2605
|
__export(src_exports, {
|
|
@@ -2295,6 +2609,8 @@ __export(src_exports, {
|
|
|
2295
2609
|
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
2296
2610
|
analyzeClasses: () => analyzeClasses,
|
|
2297
2611
|
analyzeClassesNative: () => analyzeClassesNative,
|
|
2612
|
+
analyzeComponentBatch: () => analyzeComponentBatch,
|
|
2613
|
+
analyzeComponentSemantics: () => analyzeComponentSemantics,
|
|
2298
2614
|
analyzeFile: () => analyzeFile,
|
|
2299
2615
|
analyzeRscNative: () => analyzeRscNative,
|
|
2300
2616
|
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
@@ -2321,6 +2637,7 @@ __export(src_exports, {
|
|
|
2321
2637
|
clearResolverPool: () => clearResolverPool,
|
|
2322
2638
|
clearThemeCache: () => clearThemeCache,
|
|
2323
2639
|
collectFiles: () => collectFiles,
|
|
2640
|
+
combineTypeDefinitions: () => combineTypeDefinitions,
|
|
2324
2641
|
compileAnimation: () => compileAnimation,
|
|
2325
2642
|
compileClass: () => compileClass,
|
|
2326
2643
|
compileClasses: () => compileClasses,
|
|
@@ -2334,6 +2651,7 @@ __export(src_exports, {
|
|
|
2334
2651
|
compileVariantTableNative: () => compileVariantTableNative,
|
|
2335
2652
|
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
2336
2653
|
createFingerprint: () => createFingerprint,
|
|
2654
|
+
createTypeGenerationPlugin: () => createTypeGenerationPlugin,
|
|
2337
2655
|
detectConflicts: () => detectConflicts,
|
|
2338
2656
|
detectDeadCode: () => detectDeadCode,
|
|
2339
2657
|
diffClassLists: () => diffClassLists,
|
|
@@ -2349,6 +2667,7 @@ __export(src_exports, {
|
|
|
2349
2667
|
extractClassesFromSourceNative: () => extractClassesFromSourceNative,
|
|
2350
2668
|
extractComponentUsage: () => extractComponentUsage,
|
|
2351
2669
|
extractContainerCssFromSource: () => extractContainerCssFromSource,
|
|
2670
|
+
extractSemanticMetadata: () => extractSemanticMetadata,
|
|
2352
2671
|
extractTwContainerConfigs: () => extractTwContainerConfigs,
|
|
2353
2672
|
extractTwStateConfigs: () => extractTwStateConfigs,
|
|
2354
2673
|
extractTwStateConfigsNative: () => extractTwStateConfigsNative,
|
|
@@ -2363,8 +2682,14 @@ __export(src_exports, {
|
|
|
2363
2682
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2364
2683
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2365
2684
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
2685
|
+
generateTypeDefinition: () => generateTypeDefinition,
|
|
2686
|
+
generateTypeDefinitionsBatch: () => generateTypeDefinitionsBatch,
|
|
2687
|
+
generateTypeStubFile: () => generateTypeStubFile,
|
|
2688
|
+
generateTypeStubOutputPaths: () => generateTypeStubOutputPaths,
|
|
2689
|
+
generateTypesFromComponents: () => generateTypesFromComponents,
|
|
2366
2690
|
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
2367
2691
|
getAllRoutes: () => getAllRoutes,
|
|
2692
|
+
getAriaRoleForSemantic: () => getAriaRoleForSemantic,
|
|
2368
2693
|
getBucketEngine: () => getBucketEngine,
|
|
2369
2694
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
2370
2695
|
getCacheStatistics: () => getCacheStatistics,
|
|
@@ -2460,6 +2785,7 @@ __export(src_exports, {
|
|
|
2460
2785
|
registerPluginHook: () => registerPluginHook,
|
|
2461
2786
|
registerPropertyName: () => registerPropertyName,
|
|
2462
2787
|
registerValueName: () => registerValueName,
|
|
2788
|
+
renderTypeDefinition: () => renderTypeDefinition,
|
|
2463
2789
|
resetBucketEngine: () => resetBucketEngine,
|
|
2464
2790
|
resetCacheStats: () => resetCacheStats,
|
|
2465
2791
|
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
@@ -2502,6 +2828,7 @@ __export(src_exports, {
|
|
|
2502
2828
|
twMergeWithSeparator: () => twMergeWithSeparator,
|
|
2503
2829
|
unregisterPluginHook: () => unregisterPluginHook,
|
|
2504
2830
|
validateCssOutput: () => validateCssOutput,
|
|
2831
|
+
validateSemanticMetadata: () => validateSemanticMetadata,
|
|
2505
2832
|
validateThemeConfig: () => validateThemeConfig,
|
|
2506
2833
|
valueIdToString: () => valueIdToString,
|
|
2507
2834
|
walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
|
|
@@ -2513,8 +2840,8 @@ __export(src_exports, {
|
|
|
2513
2840
|
watchRemovePattern: () => watchRemovePattern,
|
|
2514
2841
|
watchResume: () => watchResume
|
|
2515
2842
|
});
|
|
2516
|
-
import
|
|
2517
|
-
import
|
|
2843
|
+
import fs4 from "fs";
|
|
2844
|
+
import path5 from "path";
|
|
2518
2845
|
import { createRequire as createRequire4 } from "module";
|
|
2519
2846
|
function _layoutClassesToCss(classes) {
|
|
2520
2847
|
const native = getNativeBridge();
|
|
@@ -2563,6 +2890,9 @@ var init_src = __esm({
|
|
|
2563
2890
|
init_redis();
|
|
2564
2891
|
init_watch();
|
|
2565
2892
|
init_routeGraph();
|
|
2893
|
+
init_semanticComponentAnalyzer();
|
|
2894
|
+
init_typeGeneratorFromMetadata();
|
|
2895
|
+
init_typeGenerationPlugin();
|
|
2566
2896
|
_require2 = createRequire4(
|
|
2567
2897
|
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2568
2898
|
);
|
|
@@ -2657,7 +2987,7 @@ var init_src = __esm({
|
|
|
2657
2987
|
};
|
|
2658
2988
|
scanProjectUsage = (dirs, cwd) => {
|
|
2659
2989
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2660
|
-
const files = dirs.map((dir) =>
|
|
2990
|
+
const files = dirs.map((dir) => path5.resolve(cwd, dir));
|
|
2661
2991
|
const results = batchExtractClasses2(files) || [];
|
|
2662
2992
|
const combined = {};
|
|
2663
2993
|
for (const result of results) {
|
|
@@ -2674,13 +3004,13 @@ var init_src = __esm({
|
|
|
2674
3004
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2675
3005
|
const allClasses = Object.keys(classes).sort();
|
|
2676
3006
|
if (outputPath) {
|
|
2677
|
-
|
|
3007
|
+
fs4.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2678
3008
|
}
|
|
2679
3009
|
return allClasses;
|
|
2680
3010
|
};
|
|
2681
3011
|
loadSafelist = (safelistPath) => {
|
|
2682
3012
|
try {
|
|
2683
|
-
const content =
|
|
3013
|
+
const content = fs4.readFileSync(safelistPath, "utf-8");
|
|
2684
3014
|
return JSON.parse(content);
|
|
2685
3015
|
} catch {
|
|
2686
3016
|
return [];
|
|
@@ -2694,8 +3024,8 @@ var init_src = __esm({
|
|
|
2694
3024
|
"tailwind.config.cjs"
|
|
2695
3025
|
];
|
|
2696
3026
|
for (const file of configFiles) {
|
|
2697
|
-
const fullPath =
|
|
2698
|
-
if (
|
|
3027
|
+
const fullPath = path5.join(cwd, file);
|
|
3028
|
+
if (fs4.existsSync(fullPath)) {
|
|
2699
3029
|
const mod = __require(fullPath);
|
|
2700
3030
|
return mod.default || mod;
|
|
2701
3031
|
}
|
|
@@ -2705,9 +3035,9 @@ var init_src = __esm({
|
|
|
2705
3035
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2706
3036
|
return {
|
|
2707
3037
|
content: [
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
3038
|
+
path5.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3039
|
+
path5.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3040
|
+
path5.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2711
3041
|
]
|
|
2712
3042
|
};
|
|
2713
3043
|
};
|
|
@@ -3170,8 +3500,8 @@ var init_internal = __esm({
|
|
|
3170
3500
|
});
|
|
3171
3501
|
|
|
3172
3502
|
// packages/domain/shared/src/staticStateExtractor.ts
|
|
3173
|
-
import
|
|
3174
|
-
import
|
|
3503
|
+
import fs5 from "fs";
|
|
3504
|
+
import path6 from "path";
|
|
3175
3505
|
function getNative() {
|
|
3176
3506
|
if (_native) return _native;
|
|
3177
3507
|
try {
|
|
@@ -3201,17 +3531,17 @@ function getNative() {
|
|
|
3201
3531
|
function* walkSourceFiles(dir) {
|
|
3202
3532
|
let entries;
|
|
3203
3533
|
try {
|
|
3204
|
-
entries =
|
|
3534
|
+
entries = fs5.readdirSync(dir, { withFileTypes: true });
|
|
3205
3535
|
} catch {
|
|
3206
3536
|
return;
|
|
3207
3537
|
}
|
|
3208
3538
|
for (const entry of entries) {
|
|
3209
|
-
const fullPath =
|
|
3539
|
+
const fullPath = path6.join(dir, entry.name);
|
|
3210
3540
|
if (entry.isDirectory()) {
|
|
3211
3541
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3212
3542
|
yield* walkSourceFiles(fullPath);
|
|
3213
3543
|
} else if (entry.isFile()) {
|
|
3214
|
-
const ext =
|
|
3544
|
+
const ext = path6.extname(entry.name);
|
|
3215
3545
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3216
3546
|
}
|
|
3217
3547
|
}
|
|
@@ -3275,7 +3605,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3275
3605
|
allConfigs.push(...configs);
|
|
3276
3606
|
if (verbose) {
|
|
3277
3607
|
process.stderr.write(
|
|
3278
|
-
`[tw:static-state] ${
|
|
3608
|
+
`[tw:static-state] ${path6.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3279
3609
|
`
|
|
3280
3610
|
);
|
|
3281
3611
|
}
|
|
@@ -3286,7 +3616,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3286
3616
|
if (filesScanned >= maxFiles) break;
|
|
3287
3617
|
let source;
|
|
3288
3618
|
try {
|
|
3289
|
-
source =
|
|
3619
|
+
source = fs5.readFileSync(filePath, "utf-8");
|
|
3290
3620
|
} catch {
|
|
3291
3621
|
continue;
|
|
3292
3622
|
}
|
|
@@ -3299,7 +3629,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3299
3629
|
allConfigs.push(...configs);
|
|
3300
3630
|
if (verbose) {
|
|
3301
3631
|
process.stderr.write(
|
|
3302
|
-
`[tw:static-state] ${
|
|
3632
|
+
`[tw:static-state] ${path6.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3303
3633
|
`
|
|
3304
3634
|
);
|
|
3305
3635
|
}
|
|
@@ -3393,12 +3723,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3393
3723
|
resolvedCss: options.resolvedCss || ""
|
|
3394
3724
|
// ← ensure always passed
|
|
3395
3725
|
});
|
|
3396
|
-
const twClassesDir =
|
|
3397
|
-
|
|
3398
|
-
const stateFilePath =
|
|
3726
|
+
const twClassesDir = path6.join(path6.dirname(safelistPath), "tw-classes");
|
|
3727
|
+
fs5.mkdirSync(twClassesDir, { recursive: true });
|
|
3728
|
+
const stateFilePath = path6.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3399
3729
|
if (result.rulesGenerated === 0) {
|
|
3400
3730
|
try {
|
|
3401
|
-
|
|
3731
|
+
fs5.writeFileSync(
|
|
3402
3732
|
stateFilePath,
|
|
3403
3733
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3404
3734
|
"utf-8"
|
|
@@ -3408,7 +3738,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3408
3738
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3409
3739
|
}
|
|
3410
3740
|
try {
|
|
3411
|
-
|
|
3741
|
+
fs5.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3412
3742
|
return [
|
|
3413
3743
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3414
3744
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3433,8 +3763,8 @@ var init_staticStateExtractor = __esm({
|
|
|
3433
3763
|
});
|
|
3434
3764
|
|
|
3435
3765
|
// packages/domain/shared/src/logger.ts
|
|
3436
|
-
import
|
|
3437
|
-
import
|
|
3766
|
+
import fs6 from "fs";
|
|
3767
|
+
import path7 from "path";
|
|
3438
3768
|
function getEnvLevel() {
|
|
3439
3769
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3440
3770
|
if (env && env in LEVELS) return env;
|
|
@@ -3444,8 +3774,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3444
3774
|
_globalLogFile = filePath;
|
|
3445
3775
|
_logFileInitialized = false;
|
|
3446
3776
|
try {
|
|
3447
|
-
|
|
3448
|
-
|
|
3777
|
+
fs6.mkdirSync(path7.dirname(filePath), { recursive: true });
|
|
3778
|
+
fs6.writeFileSync(
|
|
3449
3779
|
filePath,
|
|
3450
3780
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3451
3781
|
`,
|
|
@@ -3458,7 +3788,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3458
3788
|
function writeToFile(line) {
|
|
3459
3789
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3460
3790
|
try {
|
|
3461
|
-
|
|
3791
|
+
fs6.appendFileSync(_globalLogFile, line);
|
|
3462
3792
|
} catch {
|
|
3463
3793
|
}
|
|
3464
3794
|
}
|
|
@@ -3499,8 +3829,8 @@ var init_logger = __esm({
|
|
|
3499
3829
|
|
|
3500
3830
|
// packages/domain/shared/src/index.ts
|
|
3501
3831
|
import { createHash } from "crypto";
|
|
3502
|
-
import
|
|
3503
|
-
import
|
|
3832
|
+
import fs7 from "fs";
|
|
3833
|
+
import path8 from "path";
|
|
3504
3834
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3505
3835
|
import { createRequire as createRequire5 } from "module";
|
|
3506
3836
|
function createLogger2(namespace) {
|
|
@@ -3532,9 +3862,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3532
3862
|
}
|
|
3533
3863
|
};
|
|
3534
3864
|
}
|
|
3535
|
-
function formatIssuePath(
|
|
3536
|
-
if (!
|
|
3537
|
-
return
|
|
3865
|
+
function formatIssuePath(path15) {
|
|
3866
|
+
if (!path15 || path15.length === 0) return "(root)";
|
|
3867
|
+
return path15.map(
|
|
3538
3868
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3539
3869
|
).join(".");
|
|
3540
3870
|
}
|
|
@@ -3542,9 +3872,9 @@ function loadNativeBinding(options) {
|
|
|
3542
3872
|
const { runtimeDir, candidates, isValid } = options;
|
|
3543
3873
|
const loadErrors = [];
|
|
3544
3874
|
for (const candidate of candidates) {
|
|
3545
|
-
const candidatePath =
|
|
3875
|
+
const candidatePath = path8.resolve(runtimeDir, candidate);
|
|
3546
3876
|
try {
|
|
3547
|
-
if (!
|
|
3877
|
+
if (!fs7.existsSync(candidatePath) && !fs7.existsSync(candidatePath + ".node")) {
|
|
3548
3878
|
continue;
|
|
3549
3879
|
}
|
|
3550
3880
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3576,9 +3906,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3576
3906
|
}
|
|
3577
3907
|
}
|
|
3578
3908
|
if (!includeDefaultCandidates) return candidates;
|
|
3579
|
-
if (
|
|
3909
|
+
if (fs7.existsSync(runtimeDir)) {
|
|
3580
3910
|
try {
|
|
3581
|
-
for (const entry of
|
|
3911
|
+
for (const entry of fs7.readdirSync(runtimeDir)) {
|
|
3582
3912
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3583
3913
|
}
|
|
3584
3914
|
} catch {
|
|
@@ -3587,22 +3917,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3587
3917
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3588
3918
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3589
3919
|
for (const bin of BINARY_NAMES) {
|
|
3590
|
-
candidates.push(
|
|
3591
|
-
candidates.push(
|
|
3592
|
-
candidates.push(
|
|
3593
|
-
candidates.push(
|
|
3594
|
-
candidates.push(
|
|
3595
|
-
candidates.push(
|
|
3596
|
-
candidates.push(
|
|
3597
|
-
candidates.push(
|
|
3598
|
-
candidates.push(
|
|
3920
|
+
candidates.push(path8.resolve(runtimeDir, `${bin}.node`));
|
|
3921
|
+
candidates.push(path8.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3922
|
+
candidates.push(path8.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3923
|
+
candidates.push(path8.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3924
|
+
candidates.push(path8.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3925
|
+
candidates.push(path8.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3926
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3927
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3928
|
+
candidates.push(path8.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3599
3929
|
}
|
|
3600
3930
|
return Array.from(new Set(candidates));
|
|
3601
3931
|
}
|
|
3602
3932
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3603
|
-
if (dir) return
|
|
3933
|
+
if (dir) return path8.resolve(dir);
|
|
3604
3934
|
try {
|
|
3605
|
-
return
|
|
3935
|
+
return path8.dirname(fileURLToPath2(importMetaUrl));
|
|
3606
3936
|
} catch {
|
|
3607
3937
|
return process.cwd();
|
|
3608
3938
|
}
|
|
@@ -3649,8 +3979,8 @@ var init_src2 = __esm({
|
|
|
3649
3979
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3650
3980
|
static fromZod(err) {
|
|
3651
3981
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3652
|
-
const
|
|
3653
|
-
const message = first ? `${
|
|
3982
|
+
const path15 = formatIssuePath(first?.path);
|
|
3983
|
+
const message = first ? `${path15}: ${first.message}` : "Schema validation failed";
|
|
3654
3984
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3655
3985
|
}
|
|
3656
3986
|
static wrap(source, code, err) {
|
|
@@ -3704,14 +4034,14 @@ __export(native_bridge_exports, {
|
|
|
3704
4034
|
startWatchNative: () => startWatchNative,
|
|
3705
4035
|
stopWatchNative: () => stopWatchNative
|
|
3706
4036
|
});
|
|
3707
|
-
import
|
|
4037
|
+
import path9 from "path";
|
|
3708
4038
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3709
4039
|
function getDirname2() {
|
|
3710
4040
|
if (typeof __dirname !== "undefined") {
|
|
3711
4041
|
return __dirname;
|
|
3712
4042
|
}
|
|
3713
4043
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3714
|
-
return
|
|
4044
|
+
return path9.dirname(fileURLToPath3(import.meta.url));
|
|
3715
4045
|
}
|
|
3716
4046
|
return process.cwd();
|
|
3717
4047
|
}
|
|
@@ -4047,27 +4377,27 @@ var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSch
|
|
|
4047
4377
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
4048
4378
|
init_esm_shims();
|
|
4049
4379
|
init_src2();
|
|
4050
|
-
import
|
|
4380
|
+
import fs12 from "fs";
|
|
4051
4381
|
import { createRequire as createRequire7 } from "module";
|
|
4052
|
-
import
|
|
4382
|
+
import path14 from "path";
|
|
4053
4383
|
|
|
4054
4384
|
// packages/domain/scanner/src/index.ts
|
|
4055
4385
|
init_esm_shims();
|
|
4056
4386
|
init_src2();
|
|
4057
|
-
import
|
|
4387
|
+
import fs9 from "fs";
|
|
4058
4388
|
import { createRequire as createRequire6 } from "module";
|
|
4059
|
-
import
|
|
4389
|
+
import path11 from "path";
|
|
4060
4390
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4061
4391
|
import { Worker } from "worker_threads";
|
|
4062
4392
|
|
|
4063
4393
|
// packages/domain/scanner/src/cache-native.ts
|
|
4064
4394
|
init_esm_shims();
|
|
4065
4395
|
init_native_bridge();
|
|
4066
|
-
import
|
|
4067
|
-
import
|
|
4396
|
+
import fs8 from "fs";
|
|
4397
|
+
import path10 from "path";
|
|
4068
4398
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4069
|
-
const dir = cacheDir ?
|
|
4070
|
-
return
|
|
4399
|
+
const dir = cacheDir ? path10.resolve(rootDir, cacheDir) : path10.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4400
|
+
return path10.join(dir, "scanner-cache.json");
|
|
4071
4401
|
}
|
|
4072
4402
|
function metaPathFor(cachePath) {
|
|
4073
4403
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4081,7 +4411,7 @@ function getBinaryFingerprint() {
|
|
|
4081
4411
|
_cachedFingerprint = null;
|
|
4082
4412
|
return null;
|
|
4083
4413
|
}
|
|
4084
|
-
const stat =
|
|
4414
|
+
const stat = fs8.statSync(loadedPath);
|
|
4085
4415
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4086
4416
|
} catch {
|
|
4087
4417
|
_cachedFingerprint = null;
|
|
@@ -4091,13 +4421,13 @@ function getBinaryFingerprint() {
|
|
|
4091
4421
|
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4092
4422
|
function readCache(rootDir, cacheDir) {
|
|
4093
4423
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4094
|
-
|
|
4424
|
+
fs8.mkdirSync(path10.dirname(cachePath), { recursive: true });
|
|
4095
4425
|
const currentFingerprint = getBinaryFingerprint();
|
|
4096
4426
|
if (currentFingerprint !== null) {
|
|
4097
4427
|
const metaPath = metaPathFor(cachePath);
|
|
4098
4428
|
let storedFingerprint = null;
|
|
4099
4429
|
try {
|
|
4100
|
-
storedFingerprint = JSON.parse(
|
|
4430
|
+
storedFingerprint = JSON.parse(fs8.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4101
4431
|
} catch {
|
|
4102
4432
|
}
|
|
4103
4433
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4121,7 +4451,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4121
4451
|
}
|
|
4122
4452
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4123
4453
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4124
|
-
|
|
4454
|
+
fs8.mkdirSync(path10.dirname(cachePath), { recursive: true });
|
|
4125
4455
|
const success = cacheWriteNative(cachePath, entries);
|
|
4126
4456
|
if (!success) {
|
|
4127
4457
|
throw new Error(
|
|
@@ -4131,7 +4461,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4131
4461
|
const currentFingerprint = getBinaryFingerprint();
|
|
4132
4462
|
if (currentFingerprint !== null) {
|
|
4133
4463
|
try {
|
|
4134
|
-
|
|
4464
|
+
fs8.writeFileSync(
|
|
4135
4465
|
metaPathFor(cachePath),
|
|
4136
4466
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4137
4467
|
"utf8"
|
|
@@ -4159,12 +4489,12 @@ init_native_bridge();
|
|
|
4159
4489
|
init_esm_shims();
|
|
4160
4490
|
init_src2();
|
|
4161
4491
|
import { z as z2 } from "zod";
|
|
4162
|
-
var formatIssuePath2 = (
|
|
4492
|
+
var formatIssuePath2 = (path15) => path15.length > 0 ? path15.map(
|
|
4163
4493
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4164
4494
|
).join(".") : "<root>";
|
|
4165
4495
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
4166
|
-
const
|
|
4167
|
-
return `${
|
|
4496
|
+
const path15 = formatIssuePath2(issue.path);
|
|
4497
|
+
return `${path15}: ${issue.message}`;
|
|
4168
4498
|
}).join("; ");
|
|
4169
4499
|
var parseWithSchema2 = (schema, data, label) => {
|
|
4170
4500
|
const parsed = schema.safeParse(data);
|
|
@@ -4224,7 +4554,7 @@ function getRuntimeDir() {
|
|
|
4224
4554
|
return __dirname;
|
|
4225
4555
|
}
|
|
4226
4556
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4227
|
-
return
|
|
4557
|
+
return path11.dirname(fileURLToPath4(import.meta.url));
|
|
4228
4558
|
}
|
|
4229
4559
|
return process.cwd();
|
|
4230
4560
|
}
|
|
@@ -4239,7 +4569,7 @@ var createNativeParserLoader = () => {
|
|
|
4239
4569
|
const loadNativeParserBinding = () => {
|
|
4240
4570
|
if (_state.binding !== void 0) return _state.binding;
|
|
4241
4571
|
const runtimeDir = getRuntimeDir();
|
|
4242
|
-
const req = createRequire6(
|
|
4572
|
+
const req = createRequire6(path11.join(runtimeDir, "noop.cjs"));
|
|
4243
4573
|
const _platform = process.platform;
|
|
4244
4574
|
const _arch = process.arch;
|
|
4245
4575
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4247,27 +4577,27 @@ var createNativeParserLoader = () => {
|
|
|
4247
4577
|
const candidates = [
|
|
4248
4578
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4249
4579
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4580
|
+
path11.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4581
|
+
path11.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4582
|
+
path11.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4253
4583
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4254
4584
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4585
|
+
path11.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4586
|
+
path11.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4587
|
+
path11.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4258
4588
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4259
|
-
|
|
4260
|
-
|
|
4589
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4590
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4261
4591
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4262
|
-
|
|
4263
|
-
|
|
4592
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4593
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4264
4594
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4595
|
+
path11.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4596
|
+
path11.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4597
|
+
path11.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4598
|
+
path11.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4599
|
+
path11.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4600
|
+
path11.resolve(
|
|
4271
4601
|
runtimeDir,
|
|
4272
4602
|
"..",
|
|
4273
4603
|
"..",
|
|
@@ -4279,7 +4609,7 @@ var createNativeParserLoader = () => {
|
|
|
4279
4609
|
)
|
|
4280
4610
|
];
|
|
4281
4611
|
for (const fullPath of candidates) {
|
|
4282
|
-
if (!
|
|
4612
|
+
if (!fs9.existsSync(fullPath)) continue;
|
|
4283
4613
|
try {
|
|
4284
4614
|
const required = req(fullPath);
|
|
4285
4615
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4320,19 +4650,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4320
4650
|
if (!currentDir) continue;
|
|
4321
4651
|
const entries = (() => {
|
|
4322
4652
|
try {
|
|
4323
|
-
return
|
|
4653
|
+
return fs9.readdirSync(currentDir, { withFileTypes: true });
|
|
4324
4654
|
} catch {
|
|
4325
4655
|
return [];
|
|
4326
4656
|
}
|
|
4327
4657
|
})();
|
|
4328
4658
|
for (const entry of entries) {
|
|
4329
|
-
const fullPath =
|
|
4659
|
+
const fullPath = path11.join(currentDir, entry.name);
|
|
4330
4660
|
if (entry.isDirectory()) {
|
|
4331
4661
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4332
4662
|
continue;
|
|
4333
4663
|
}
|
|
4334
4664
|
if (!entry.isFile()) continue;
|
|
4335
|
-
if (!extensionSet.has(
|
|
4665
|
+
if (!extensionSet.has(path11.extname(entry.name))) continue;
|
|
4336
4666
|
candidates.push(fullPath);
|
|
4337
4667
|
}
|
|
4338
4668
|
}
|
|
@@ -4416,7 +4746,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4416
4746
|
for (const filePath of candidates) {
|
|
4417
4747
|
const stat = (() => {
|
|
4418
4748
|
try {
|
|
4419
|
-
return
|
|
4749
|
+
return fs9.statSync(filePath);
|
|
4420
4750
|
} catch {
|
|
4421
4751
|
return null;
|
|
4422
4752
|
}
|
|
@@ -4442,7 +4772,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4442
4772
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4443
4773
|
const content = (() => {
|
|
4444
4774
|
try {
|
|
4445
|
-
return
|
|
4775
|
+
return fs9.readFileSync(filePath, "utf8");
|
|
4446
4776
|
} catch {
|
|
4447
4777
|
return null;
|
|
4448
4778
|
}
|
|
@@ -4509,8 +4839,8 @@ init_src2();
|
|
|
4509
4839
|
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4510
4840
|
init_esm_shims();
|
|
4511
4841
|
init_src();
|
|
4512
|
-
import
|
|
4513
|
-
import
|
|
4842
|
+
import fs10 from "fs";
|
|
4843
|
+
import path12 from "path";
|
|
4514
4844
|
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4515
4845
|
function getNative2() {
|
|
4516
4846
|
try {
|
|
@@ -4521,10 +4851,10 @@ function getNative2() {
|
|
|
4521
4851
|
}
|
|
4522
4852
|
function fingerprintFile(filePath) {
|
|
4523
4853
|
try {
|
|
4524
|
-
const stat =
|
|
4854
|
+
const stat = fs10.statSync(filePath);
|
|
4525
4855
|
const native = getNative2();
|
|
4526
4856
|
if (native?.create_fingerprint) {
|
|
4527
|
-
const content =
|
|
4857
|
+
const content = fs10.readFileSync(filePath, "utf-8");
|
|
4528
4858
|
const hash = native.create_fingerprint(filePath, content);
|
|
4529
4859
|
return { hash, mtime: stat.mtimeMs };
|
|
4530
4860
|
}
|
|
@@ -4564,9 +4894,9 @@ function hasSourceChanged(sourceFiles) {
|
|
|
4564
4894
|
}
|
|
4565
4895
|
function isIncrementalEnabled(cwd) {
|
|
4566
4896
|
try {
|
|
4567
|
-
const configPath =
|
|
4568
|
-
if (!
|
|
4569
|
-
const config = JSON.parse(
|
|
4897
|
+
const configPath = path12.join(cwd, "tailwind-styled.config.json");
|
|
4898
|
+
if (!fs10.existsSync(configPath)) return false;
|
|
4899
|
+
const config = JSON.parse(fs10.readFileSync(configPath, "utf-8"));
|
|
4570
4900
|
return config.compiler?.incremental === true;
|
|
4571
4901
|
} catch {
|
|
4572
4902
|
return false;
|
|
@@ -4575,8 +4905,8 @@ function isIncrementalEnabled(cwd) {
|
|
|
4575
4905
|
|
|
4576
4906
|
// packages/presentation/next/src/staticCssWebpackPlugin.ts
|
|
4577
4907
|
init_esm_shims();
|
|
4578
|
-
import
|
|
4579
|
-
import
|
|
4908
|
+
import fs11 from "fs";
|
|
4909
|
+
import path13 from "path";
|
|
4580
4910
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4581
4911
|
function setFileStaticCss(filepath, css) {
|
|
4582
4912
|
if (css && css.trim()) {
|
|
@@ -4610,14 +4940,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4610
4940
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4611
4941
|
outPath;
|
|
4612
4942
|
constructor(safelistPath) {
|
|
4613
|
-
this.outPath =
|
|
4943
|
+
this.outPath = path13.join(path13.dirname(safelistPath), "_tw-state-static.css");
|
|
4614
4944
|
}
|
|
4615
4945
|
apply(compiler) {
|
|
4616
4946
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4617
4947
|
try {
|
|
4618
4948
|
const content = buildContent(_fileStaticCssMap);
|
|
4619
|
-
|
|
4620
|
-
|
|
4949
|
+
fs11.mkdirSync(path13.dirname(this.outPath), { recursive: true });
|
|
4950
|
+
fs11.writeFileSync(
|
|
4621
4951
|
this.outPath,
|
|
4622
4952
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4623
4953
|
"utf-8"
|
|
@@ -4654,12 +4984,12 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4654
4984
|
} catch {
|
|
4655
4985
|
const runtimeDir = resolveRuntimeDir2();
|
|
4656
4986
|
const candidates = [
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4987
|
+
path14.resolve(runtimeDir, `${basename}.mjs`),
|
|
4988
|
+
path14.resolve(runtimeDir, `${basename}.js`),
|
|
4989
|
+
path14.resolve(runtimeDir, `${basename}.cjs`)
|
|
4660
4990
|
];
|
|
4661
4991
|
for (const candidate of candidates) {
|
|
4662
|
-
if (
|
|
4992
|
+
if (fs12.existsSync(candidate)) {
|
|
4663
4993
|
return candidate;
|
|
4664
4994
|
}
|
|
4665
4995
|
}
|
|
@@ -4697,7 +5027,7 @@ var createLoaderOptions = (options) => {
|
|
|
4697
5027
|
preserveImports: true
|
|
4698
5028
|
};
|
|
4699
5029
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4700
|
-
opts.safelistPath = options.safelistPath ??
|
|
5030
|
+
opts.safelistPath = options.safelistPath ?? path14.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4701
5031
|
return Object.freeze(opts);
|
|
4702
5032
|
};
|
|
4703
5033
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4710,7 +5040,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4710
5040
|
])
|
|
4711
5041
|
);
|
|
4712
5042
|
};
|
|
4713
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
5043
|
+
var normalizeLoaderPath = (loaderPath) => path14.resolve(loaderPath);
|
|
4714
5044
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4715
5045
|
const loaderOptions = createLoaderOptions(options);
|
|
4716
5046
|
const rules = config.module?.rules ?? [];
|
|
@@ -4727,7 +5057,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4727
5057
|
enforce: "pre",
|
|
4728
5058
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4729
5059
|
};
|
|
4730
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
5060
|
+
const safelistPath = loaderOptions.safelistPath ?? path14.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4731
5061
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4732
5062
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4733
5063
|
);
|
|
@@ -4827,17 +5157,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4827
5157
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4828
5158
|
};
|
|
4829
5159
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4830
|
-
const twClassesDir =
|
|
4831
|
-
|
|
4832
|
-
setGlobalLogFile(
|
|
4833
|
-
|
|
4834
|
-
|
|
5160
|
+
const twClassesDir = path14.join(path14.dirname(safelistPath), "tw-classes");
|
|
5161
|
+
fs12.mkdirSync(twClassesDir, { recursive: true });
|
|
5162
|
+
setGlobalLogFile(path14.join(twClassesDir, "_tw-build.log"));
|
|
5163
|
+
fs12.writeFileSync(
|
|
5164
|
+
path14.join(twClassesDir, "_start.txt"),
|
|
4835
5165
|
String(Date.now()),
|
|
4836
5166
|
"utf-8"
|
|
4837
5167
|
);
|
|
4838
|
-
const stateStaticPath =
|
|
5168
|
+
const stateStaticPath = path14.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4839
5169
|
try {
|
|
4840
|
-
|
|
5170
|
+
fs12.writeFileSync(
|
|
4841
5171
|
stateStaticPath,
|
|
4842
5172
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4843
5173
|
"utf-8"
|
|
@@ -4853,14 +5183,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4853
5183
|
"src/index.css",
|
|
4854
5184
|
"styles/globals.css"
|
|
4855
5185
|
];
|
|
4856
|
-
const safelistDir =
|
|
5186
|
+
const safelistDir = path14.dirname(safelistPath);
|
|
4857
5187
|
for (const candidate of CSS_CANDIDATES) {
|
|
4858
|
-
const candidatePath =
|
|
4859
|
-
if (!
|
|
4860
|
-
const content =
|
|
5188
|
+
const candidatePath = path14.join(process.cwd(), candidate);
|
|
5189
|
+
if (!fs12.existsSync(candidatePath)) continue;
|
|
5190
|
+
const content = fs12.readFileSync(candidatePath, "utf-8");
|
|
4861
5191
|
if (content.includes("_tw-state-static.css")) break;
|
|
4862
|
-
const globalsDir =
|
|
4863
|
-
const rel =
|
|
5192
|
+
const globalsDir = path14.dirname(candidatePath);
|
|
5193
|
+
const rel = path14.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4864
5194
|
const importLine = `@import "./${rel}";`;
|
|
4865
5195
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4866
5196
|
let updated;
|
|
@@ -4874,7 +5204,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4874
5204
|
updated = `${importLine}
|
|
4875
5205
|
${content}`;
|
|
4876
5206
|
}
|
|
4877
|
-
|
|
5207
|
+
fs12.writeFileSync(candidatePath, updated, "utf-8");
|
|
4878
5208
|
if (options.verbose) {
|
|
4879
5209
|
console.log(
|
|
4880
5210
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4886,27 +5216,27 @@ ${content}`;
|
|
|
4886
5216
|
}
|
|
4887
5217
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4888
5218
|
const runtimeDir = resolveRuntimeDir2();
|
|
4889
|
-
const nativePath =
|
|
4890
|
-
if (
|
|
5219
|
+
const nativePath = path14.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
5220
|
+
if (fs12.existsSync(nativePath)) {
|
|
4891
5221
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4892
5222
|
}
|
|
4893
5223
|
}
|
|
4894
|
-
const srcDir =
|
|
4895
|
-
if (
|
|
5224
|
+
const srcDir = path14.join(process.cwd(), "src");
|
|
5225
|
+
if (fs12.existsSync(srcDir)) {
|
|
4896
5226
|
try {
|
|
4897
5227
|
const result = scanWorkspace2(srcDir);
|
|
4898
5228
|
if (result.uniqueClasses.length > 0) {
|
|
4899
5229
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4900
5230
|
const tmpPath = `${filePath}.tmp`;
|
|
4901
5231
|
try {
|
|
4902
|
-
|
|
4903
|
-
|
|
5232
|
+
fs12.writeFileSync(tmpPath, content, "utf-8");
|
|
5233
|
+
fs12.renameSync(tmpPath, filePath);
|
|
4904
5234
|
} catch {
|
|
4905
5235
|
try {
|
|
4906
|
-
|
|
5236
|
+
fs12.unlinkSync(tmpPath);
|
|
4907
5237
|
} catch {
|
|
4908
5238
|
}
|
|
4909
|
-
|
|
5239
|
+
fs12.writeFileSync(filePath, content, "utf-8");
|
|
4910
5240
|
}
|
|
4911
5241
|
};
|
|
4912
5242
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4970,14 +5300,14 @@ ${content}`;
|
|
|
4970
5300
|
"styles/globals.css"
|
|
4971
5301
|
];
|
|
4972
5302
|
try {
|
|
4973
|
-
const twConfigPath =
|
|
4974
|
-
if (
|
|
4975
|
-
const twConfig = JSON.parse(
|
|
5303
|
+
const twConfigPath = path14.join(process.cwd(), "tailwind-styled.config.json");
|
|
5304
|
+
if (fs12.existsSync(twConfigPath)) {
|
|
5305
|
+
const twConfig = JSON.parse(fs12.readFileSync(twConfigPath, "utf-8"));
|
|
4976
5306
|
const cssEntry = twConfig.css?.entry;
|
|
4977
5307
|
if (cssEntry) {
|
|
4978
|
-
const cssEntryPath =
|
|
4979
|
-
if (
|
|
4980
|
-
cssEntryContent =
|
|
5308
|
+
const cssEntryPath = path14.join(process.cwd(), cssEntry);
|
|
5309
|
+
if (fs12.existsSync(cssEntryPath)) {
|
|
5310
|
+
cssEntryContent = fs12.readFileSync(cssEntryPath, "utf-8");
|
|
4981
5311
|
}
|
|
4982
5312
|
}
|
|
4983
5313
|
}
|
|
@@ -4985,9 +5315,9 @@ ${content}`;
|
|
|
4985
5315
|
}
|
|
4986
5316
|
if (!cssEntryContent) {
|
|
4987
5317
|
for (const candidate of CSS_CANDIDATES) {
|
|
4988
|
-
const candidatePath =
|
|
4989
|
-
if (
|
|
4990
|
-
cssEntryContent =
|
|
5318
|
+
const candidatePath = path14.join(process.cwd(), candidate);
|
|
5319
|
+
if (fs12.existsSync(candidatePath)) {
|
|
5320
|
+
cssEntryContent = fs12.readFileSync(candidatePath, "utf-8");
|
|
4991
5321
|
break;
|
|
4992
5322
|
}
|
|
4993
5323
|
}
|
|
@@ -4995,8 +5325,8 @@ ${content}`;
|
|
|
4995
5325
|
if (cssEntryContent) {
|
|
4996
5326
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
4997
5327
|
}
|
|
4998
|
-
const initialScanPath =
|
|
4999
|
-
if (!
|
|
5328
|
+
const initialScanPath = path14.join(twClassesDir, "_initial-scan.css");
|
|
5329
|
+
if (!fs12.existsSync(initialScanPath)) {
|
|
5000
5330
|
atomicWriteFile2(
|
|
5001
5331
|
initialScanPath,
|
|
5002
5332
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
@@ -5004,7 +5334,7 @@ ${content}`;
|
|
|
5004
5334
|
}
|
|
5005
5335
|
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
5006
5336
|
const incremental = isIncrementalEnabled(process.cwd());
|
|
5007
|
-
if (incremental &&
|
|
5337
|
+
if (incremental && fs12.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
5008
5338
|
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
5009
5339
|
} else {
|
|
5010
5340
|
void (async () => {
|
|
@@ -5045,8 +5375,8 @@ ${utilitiesOnly}`
|
|
|
5045
5375
|
classes: f.classes.filter(isValidTwClass)
|
|
5046
5376
|
}));
|
|
5047
5377
|
const buckets = buildRouteClassBuckets2(process.cwd(), srcDir, filesForGraph);
|
|
5048
|
-
const cssManifestDir =
|
|
5049
|
-
|
|
5378
|
+
const cssManifestDir = path14.join(process.cwd(), ".next", "static", "css", "tw");
|
|
5379
|
+
fs12.mkdirSync(cssManifestDir, { recursive: true });
|
|
5050
5380
|
const manifestRoutes = {};
|
|
5051
5381
|
const usedFilenames = /* @__PURE__ */ new Set(["_global.css"]);
|
|
5052
5382
|
const minifyManifestCss = process.env.NODE_ENV === "production";
|
|
@@ -5061,7 +5391,7 @@ ${utilitiesOnly}`
|
|
|
5061
5391
|
const globalUtilities = extractUtilitiesLayer2(globalCss);
|
|
5062
5392
|
if (globalUtilities.trim()) {
|
|
5063
5393
|
const filename = "_global.css";
|
|
5064
|
-
atomicWriteFile2(
|
|
5394
|
+
atomicWriteFile2(path14.join(cssManifestDir, filename), globalUtilities);
|
|
5065
5395
|
manifestRoutes.__global = filename;
|
|
5066
5396
|
}
|
|
5067
5397
|
}
|
|
@@ -5083,11 +5413,11 @@ ${utilitiesOnly}`
|
|
|
5083
5413
|
suffix++;
|
|
5084
5414
|
}
|
|
5085
5415
|
usedFilenames.add(filename);
|
|
5086
|
-
atomicWriteFile2(
|
|
5416
|
+
atomicWriteFile2(path14.join(cssManifestDir, filename), routeUtilities);
|
|
5087
5417
|
manifestRoutes[route] = filename;
|
|
5088
5418
|
}
|
|
5089
5419
|
atomicWriteFile2(
|
|
5090
|
-
|
|
5420
|
+
path14.join(cssManifestDir, "css-manifest.json"),
|
|
5091
5421
|
JSON.stringify({ routes: manifestRoutes }, null, 2)
|
|
5092
5422
|
);
|
|
5093
5423
|
if (options.verbose) {
|