tailwind-styled-v4 5.1.22 → 5.1.24
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 +136 -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 +166 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +177 -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/next.js
CHANGED
|
@@ -66,11 +66,11 @@ function resolvePath(...segments) {
|
|
|
66
66
|
return segments.join("/").replace(/\/+/g, "/");
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
function existsSync(
|
|
69
|
+
function existsSync(path14) {
|
|
70
70
|
if (isBrowser) return false;
|
|
71
71
|
try {
|
|
72
72
|
const nodeFs = require(NODE_FS);
|
|
73
|
-
return nodeFs.existsSync(
|
|
73
|
+
return nodeFs.existsSync(path14);
|
|
74
74
|
} catch {
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
@@ -252,7 +252,7 @@ var init_nativeBridge = __esm({
|
|
|
252
252
|
"use strict";
|
|
253
253
|
init_cjs_shims();
|
|
254
254
|
init_src2();
|
|
255
|
-
_loadNative = (
|
|
255
|
+
_loadNative = (path14) => require(path14);
|
|
256
256
|
log = (...args) => {
|
|
257
257
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
258
258
|
console.log("[compiler:native]", ...args);
|
|
@@ -2290,6 +2290,321 @@ var init_routeGraph = __esm({
|
|
|
2290
2290
|
}
|
|
2291
2291
|
});
|
|
2292
2292
|
|
|
2293
|
+
// packages/domain/compiler/src/semanticComponentAnalyzer.ts
|
|
2294
|
+
function inferSemanticFromTag(tag) {
|
|
2295
|
+
const tagLower = tag.toLowerCase();
|
|
2296
|
+
const semanticMap = {
|
|
2297
|
+
"button": "button",
|
|
2298
|
+
"a": "link",
|
|
2299
|
+
"nav": "navigation",
|
|
2300
|
+
"h1": "heading",
|
|
2301
|
+
"h2": "heading",
|
|
2302
|
+
"h3": "heading",
|
|
2303
|
+
"h4": "heading",
|
|
2304
|
+
"h5": "heading",
|
|
2305
|
+
"h6": "heading",
|
|
2306
|
+
"p": "paragraph",
|
|
2307
|
+
"ul": "list",
|
|
2308
|
+
"ol": "list",
|
|
2309
|
+
"input": "input",
|
|
2310
|
+
"form": "form",
|
|
2311
|
+
"dialog": "dialog",
|
|
2312
|
+
"select": "select",
|
|
2313
|
+
"textarea": "input"
|
|
2314
|
+
};
|
|
2315
|
+
return semanticMap[tagLower] ?? "custom";
|
|
2316
|
+
}
|
|
2317
|
+
function extractSemanticMetadata(config) {
|
|
2318
|
+
const metadata = {};
|
|
2319
|
+
for (const [key, value] of Object.entries(config)) {
|
|
2320
|
+
if (key.startsWith("@")) {
|
|
2321
|
+
metadata[key] = value;
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
return metadata;
|
|
2325
|
+
}
|
|
2326
|
+
function analyzeComponentSemantics(componentName, config) {
|
|
2327
|
+
const metadata = extractSemanticMetadata(config);
|
|
2328
|
+
const tag = config.tag ?? "div";
|
|
2329
|
+
let semantic = inferSemanticFromTag(tag);
|
|
2330
|
+
if (metadata["@semantic"]) {
|
|
2331
|
+
semantic = metadata["@semantic"];
|
|
2332
|
+
}
|
|
2333
|
+
const stateProperties = /* @__PURE__ */ new Map();
|
|
2334
|
+
if (metadata["@state"]) {
|
|
2335
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2336
|
+
if (typeof value === "string") {
|
|
2337
|
+
stateProperties.set(key, value);
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
return {
|
|
2342
|
+
componentName,
|
|
2343
|
+
tag,
|
|
2344
|
+
semantic,
|
|
2345
|
+
metadata,
|
|
2346
|
+
stateProperties
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
function getAriaRoleForSemantic(semantic) {
|
|
2350
|
+
const roleMap = {
|
|
2351
|
+
"button": "button",
|
|
2352
|
+
"link": "link",
|
|
2353
|
+
"navigation": "navigation",
|
|
2354
|
+
"heading": "heading",
|
|
2355
|
+
"paragraph": void 0,
|
|
2356
|
+
// paragraph tidak perlu explicit role
|
|
2357
|
+
"list": "list",
|
|
2358
|
+
"input": "textbox",
|
|
2359
|
+
"form": "form",
|
|
2360
|
+
"dialog": "dialog",
|
|
2361
|
+
"alert": "alert",
|
|
2362
|
+
"tab": "tab",
|
|
2363
|
+
"checkbox": "checkbox",
|
|
2364
|
+
"radio": "radio",
|
|
2365
|
+
"select": "listbox",
|
|
2366
|
+
"custom": void 0
|
|
2367
|
+
};
|
|
2368
|
+
return roleMap[semantic];
|
|
2369
|
+
}
|
|
2370
|
+
function analyzeComponentBatch(components) {
|
|
2371
|
+
const results = /* @__PURE__ */ new Map();
|
|
2372
|
+
for (const [name, config] of components) {
|
|
2373
|
+
const analysis = analyzeComponentSemantics(name, config);
|
|
2374
|
+
results.set(name, analysis);
|
|
2375
|
+
}
|
|
2376
|
+
return results;
|
|
2377
|
+
}
|
|
2378
|
+
function validateSemanticMetadata(metadata) {
|
|
2379
|
+
const issues = [];
|
|
2380
|
+
const validSemantics = [
|
|
2381
|
+
"button",
|
|
2382
|
+
"link",
|
|
2383
|
+
"navigation",
|
|
2384
|
+
"heading",
|
|
2385
|
+
"paragraph",
|
|
2386
|
+
"list",
|
|
2387
|
+
"input",
|
|
2388
|
+
"form",
|
|
2389
|
+
"dialog",
|
|
2390
|
+
"alert",
|
|
2391
|
+
"tab",
|
|
2392
|
+
"checkbox",
|
|
2393
|
+
"radio",
|
|
2394
|
+
"select",
|
|
2395
|
+
"custom"
|
|
2396
|
+
];
|
|
2397
|
+
if (metadata["@semantic"] && !validSemantics.includes(metadata["@semantic"])) {
|
|
2398
|
+
issues.push(`Invalid @semantic value: ${metadata["@semantic"]}`);
|
|
2399
|
+
}
|
|
2400
|
+
if (metadata["@aria"]) {
|
|
2401
|
+
if (typeof metadata["@aria"] !== "object" || Array.isArray(metadata["@aria"])) {
|
|
2402
|
+
issues.push("@aria must be object");
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
if (metadata["@state"]) {
|
|
2406
|
+
if (typeof metadata["@state"] !== "object" || Array.isArray(metadata["@state"])) {
|
|
2407
|
+
issues.push("@state must be object");
|
|
2408
|
+
}
|
|
2409
|
+
for (const [key, value] of Object.entries(metadata["@state"])) {
|
|
2410
|
+
if (typeof value !== "string") {
|
|
2411
|
+
issues.push(`@state.${key} must be string (ARIA property name)`);
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
return issues;
|
|
2416
|
+
}
|
|
2417
|
+
var init_semanticComponentAnalyzer = __esm({
|
|
2418
|
+
"packages/domain/compiler/src/semanticComponentAnalyzer.ts"() {
|
|
2419
|
+
"use strict";
|
|
2420
|
+
init_cjs_shims();
|
|
2421
|
+
}
|
|
2422
|
+
});
|
|
2423
|
+
|
|
2424
|
+
// packages/domain/compiler/src/typeGeneratorFromMetadata.ts
|
|
2425
|
+
function generateJsDocFromSemantic(analysis) {
|
|
2426
|
+
const lines = [
|
|
2427
|
+
"/**",
|
|
2428
|
+
` * ${analysis.componentName}`,
|
|
2429
|
+
` * `,
|
|
2430
|
+
` * Semantic intent: ${analysis.semantic}`,
|
|
2431
|
+
` * Tag: ${analysis.tag}`
|
|
2432
|
+
];
|
|
2433
|
+
if (analysis.metadata["@aria"]) {
|
|
2434
|
+
lines.push(` * ARIA: auto-injected dari semantic metadata`);
|
|
2435
|
+
}
|
|
2436
|
+
if (analysis.stateProperties.size > 0) {
|
|
2437
|
+
const states = Array.from(analysis.stateProperties.entries()).map(([k, v]) => `${k} \u2192 ${v}`).join(", ");
|
|
2438
|
+
lines.push(` * State mappings: ${states}`);
|
|
2439
|
+
}
|
|
2440
|
+
lines.push(" */");
|
|
2441
|
+
return lines.join("\n");
|
|
2442
|
+
}
|
|
2443
|
+
function getBaseComponentType(analysis) {
|
|
2444
|
+
const tag = analysis.tag.toLowerCase();
|
|
2445
|
+
const tagMap = {
|
|
2446
|
+
"button": "React.ButtonHTMLAttributes<HTMLButtonElement>",
|
|
2447
|
+
"a": "React.AnchorHTMLAttributes<HTMLAnchorElement>",
|
|
2448
|
+
"input": "React.InputHTMLAttributes<HTMLInputElement>",
|
|
2449
|
+
"textarea": "React.TextareaHTMLAttributes<HTMLTextAreaElement>",
|
|
2450
|
+
"select": "React.SelectHTMLAttributes<HTMLSelectElement>",
|
|
2451
|
+
"form": "React.FormHTMLAttributes<HTMLFormElement>",
|
|
2452
|
+
"div": "React.HTMLAttributes<HTMLDivElement>",
|
|
2453
|
+
"span": "React.HTMLAttributes<HTMLSpanElement>",
|
|
2454
|
+
"nav": "React.HTMLAttributes<HTMLElement>",
|
|
2455
|
+
"dialog": "React.DialogHTMLAttributes<HTMLDialogElement>"
|
|
2456
|
+
};
|
|
2457
|
+
return tagMap[tag] ?? "React.HTMLAttributes<HTMLElement>";
|
|
2458
|
+
}
|
|
2459
|
+
function generateStateProperties(analysis) {
|
|
2460
|
+
const props = /* @__PURE__ */ new Map();
|
|
2461
|
+
for (const [stateName, ariaProp] of analysis.stateProperties) {
|
|
2462
|
+
props.set(stateName, {
|
|
2463
|
+
name: stateName,
|
|
2464
|
+
type: "boolean | undefined",
|
|
2465
|
+
description: `State mapped to ARIA property: ${ariaProp}`,
|
|
2466
|
+
optional: true
|
|
2467
|
+
});
|
|
2468
|
+
}
|
|
2469
|
+
return props;
|
|
2470
|
+
}
|
|
2471
|
+
function generateTypeDefinition(analysis, componentName) {
|
|
2472
|
+
const interfaceName = `${componentName}Props`;
|
|
2473
|
+
const baseType = getBaseComponentType(analysis);
|
|
2474
|
+
const stateProps = generateStateProperties(analysis);
|
|
2475
|
+
return {
|
|
2476
|
+
interfaceName,
|
|
2477
|
+
extendsFrom: baseType,
|
|
2478
|
+
properties: stateProps,
|
|
2479
|
+
jsDocComment: generateJsDocFromSemantic(analysis)
|
|
2480
|
+
};
|
|
2481
|
+
}
|
|
2482
|
+
function renderTypeDefinition(def) {
|
|
2483
|
+
const lines = [];
|
|
2484
|
+
if (def.jsDocComment) {
|
|
2485
|
+
lines.push(def.jsDocComment);
|
|
2486
|
+
}
|
|
2487
|
+
lines.push(`export interface ${def.interfaceName} extends ${def.extendsFrom} {`);
|
|
2488
|
+
for (const prop of def.properties.values()) {
|
|
2489
|
+
const optional = prop.optional ? "?" : "";
|
|
2490
|
+
if (prop.description) {
|
|
2491
|
+
lines.push(` /** ${prop.description} */`);
|
|
2492
|
+
}
|
|
2493
|
+
lines.push(` ${prop.name}${optional}: ${prop.type}`);
|
|
2494
|
+
}
|
|
2495
|
+
lines.push("}");
|
|
2496
|
+
return lines.join("\n");
|
|
2497
|
+
}
|
|
2498
|
+
function generateTypeStubFile(analyses, packageName = "tailwind-styled") {
|
|
2499
|
+
const lines = [
|
|
2500
|
+
"/**",
|
|
2501
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2502
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2503
|
+
` * Package: ${packageName}`,
|
|
2504
|
+
` */`,
|
|
2505
|
+
"",
|
|
2506
|
+
"import type * as React from 'react'",
|
|
2507
|
+
""
|
|
2508
|
+
];
|
|
2509
|
+
const interfaces = [];
|
|
2510
|
+
for (const [name, analysis] of analyses) {
|
|
2511
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2512
|
+
interfaces.push(renderTypeDefinition(def));
|
|
2513
|
+
}
|
|
2514
|
+
lines.push(interfaces.join("\n\n"));
|
|
2515
|
+
lines.push("");
|
|
2516
|
+
lines.push("export namespace Components {");
|
|
2517
|
+
for (const analysis of analyses.values()) {
|
|
2518
|
+
lines.push(` export type ${analysis.componentName}Props = ${analysis.componentName}Props`);
|
|
2519
|
+
}
|
|
2520
|
+
lines.push("}");
|
|
2521
|
+
lines.push("");
|
|
2522
|
+
return lines.join("\n");
|
|
2523
|
+
}
|
|
2524
|
+
function generateTypeStubOutputPaths(outputDir, packageName) {
|
|
2525
|
+
return [
|
|
2526
|
+
{
|
|
2527
|
+
filePath: `${outputDir}/${packageName}.d.ts`,
|
|
2528
|
+
content: "",
|
|
2529
|
+
// Will be set by caller
|
|
2530
|
+
format: "dts"
|
|
2531
|
+
}
|
|
2532
|
+
];
|
|
2533
|
+
}
|
|
2534
|
+
function generateTypeDefinitionsBatch(analyses) {
|
|
2535
|
+
const results = /* @__PURE__ */ new Map();
|
|
2536
|
+
for (const [name, analysis] of analyses) {
|
|
2537
|
+
const def = generateTypeDefinition(analysis, name);
|
|
2538
|
+
const code = renderTypeDefinition(def);
|
|
2539
|
+
results.set(name, code);
|
|
2540
|
+
}
|
|
2541
|
+
return results;
|
|
2542
|
+
}
|
|
2543
|
+
function combineTypeDefinitions(definitions, packageName = "tailwind-styled") {
|
|
2544
|
+
const lines = [
|
|
2545
|
+
"/**",
|
|
2546
|
+
` * Auto-generated type definitions dari semantic component metadata`,
|
|
2547
|
+
` * Generated at build-time dari @semantic, @aria, @state annotations`,
|
|
2548
|
+
` * Package: ${packageName}`,
|
|
2549
|
+
" */",
|
|
2550
|
+
"",
|
|
2551
|
+
"import type * as React from 'react'",
|
|
2552
|
+
""
|
|
2553
|
+
];
|
|
2554
|
+
const defs = Array.from(definitions.values());
|
|
2555
|
+
lines.push(defs.join("\n\n"));
|
|
2556
|
+
return lines.join("\n");
|
|
2557
|
+
}
|
|
2558
|
+
var init_typeGeneratorFromMetadata = __esm({
|
|
2559
|
+
"packages/domain/compiler/src/typeGeneratorFromMetadata.ts"() {
|
|
2560
|
+
"use strict";
|
|
2561
|
+
init_cjs_shims();
|
|
2562
|
+
}
|
|
2563
|
+
});
|
|
2564
|
+
|
|
2565
|
+
// packages/domain/compiler/src/typeGenerationPlugin.ts
|
|
2566
|
+
function createTypeGenerationPlugin(options = {}) {
|
|
2567
|
+
const {
|
|
2568
|
+
outputDir = "./dist/types",
|
|
2569
|
+
packageName = "tailwind-styled",
|
|
2570
|
+
verbose = false,
|
|
2571
|
+
componentRegistryPath
|
|
2572
|
+
} = options;
|
|
2573
|
+
return {
|
|
2574
|
+
name: "type-generation",
|
|
2575
|
+
async setup(build) {
|
|
2576
|
+
if (verbose) {
|
|
2577
|
+
console.log("[type-generation] Plugin loaded");
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
};
|
|
2581
|
+
}
|
|
2582
|
+
async function generateTypesFromComponents(components, outputPath, packageName = "tailwind-styled") {
|
|
2583
|
+
if (components.size === 0) {
|
|
2584
|
+
console.warn("No components provided");
|
|
2585
|
+
return;
|
|
2586
|
+
}
|
|
2587
|
+
const analyses = analyzeComponentBatch(components);
|
|
2588
|
+
const typeContent = generateTypeStubFile(analyses, packageName);
|
|
2589
|
+
const dir = import_node_path2.default.dirname(outputPath);
|
|
2590
|
+
if (!import_node_fs2.default.existsSync(dir)) {
|
|
2591
|
+
import_node_fs2.default.mkdirSync(dir, { recursive: true });
|
|
2592
|
+
}
|
|
2593
|
+
import_node_fs2.default.writeFileSync(outputPath, typeContent, "utf8");
|
|
2594
|
+
console.log(`Generated type stubs \u2192 ${outputPath} (${components.size} components)`);
|
|
2595
|
+
}
|
|
2596
|
+
var import_node_fs2, import_node_path2;
|
|
2597
|
+
var init_typeGenerationPlugin = __esm({
|
|
2598
|
+
"packages/domain/compiler/src/typeGenerationPlugin.ts"() {
|
|
2599
|
+
"use strict";
|
|
2600
|
+
init_cjs_shims();
|
|
2601
|
+
import_node_fs2 = __toESM(require("fs"), 1);
|
|
2602
|
+
import_node_path2 = __toESM(require("path"), 1);
|
|
2603
|
+
init_semanticComponentAnalyzer();
|
|
2604
|
+
init_typeGeneratorFromMetadata();
|
|
2605
|
+
}
|
|
2606
|
+
});
|
|
2607
|
+
|
|
2293
2608
|
// packages/domain/compiler/src/index.ts
|
|
2294
2609
|
var src_exports = {};
|
|
2295
2610
|
__export(src_exports, {
|
|
@@ -2299,6 +2614,8 @@ __export(src_exports, {
|
|
|
2299
2614
|
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
2300
2615
|
analyzeClasses: () => analyzeClasses,
|
|
2301
2616
|
analyzeClassesNative: () => analyzeClassesNative,
|
|
2617
|
+
analyzeComponentBatch: () => analyzeComponentBatch,
|
|
2618
|
+
analyzeComponentSemantics: () => analyzeComponentSemantics,
|
|
2302
2619
|
analyzeFile: () => analyzeFile,
|
|
2303
2620
|
analyzeRscNative: () => analyzeRscNative,
|
|
2304
2621
|
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
@@ -2325,6 +2642,7 @@ __export(src_exports, {
|
|
|
2325
2642
|
clearResolverPool: () => clearResolverPool,
|
|
2326
2643
|
clearThemeCache: () => clearThemeCache,
|
|
2327
2644
|
collectFiles: () => collectFiles,
|
|
2645
|
+
combineTypeDefinitions: () => combineTypeDefinitions,
|
|
2328
2646
|
compileAnimation: () => compileAnimation,
|
|
2329
2647
|
compileClass: () => compileClass,
|
|
2330
2648
|
compileClasses: () => compileClasses,
|
|
@@ -2338,6 +2656,7 @@ __export(src_exports, {
|
|
|
2338
2656
|
compileVariantTableNative: () => compileVariantTableNative,
|
|
2339
2657
|
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
2340
2658
|
createFingerprint: () => createFingerprint,
|
|
2659
|
+
createTypeGenerationPlugin: () => createTypeGenerationPlugin,
|
|
2341
2660
|
detectConflicts: () => detectConflicts,
|
|
2342
2661
|
detectDeadCode: () => detectDeadCode,
|
|
2343
2662
|
diffClassLists: () => diffClassLists,
|
|
@@ -2353,6 +2672,7 @@ __export(src_exports, {
|
|
|
2353
2672
|
extractClassesFromSourceNative: () => extractClassesFromSourceNative,
|
|
2354
2673
|
extractComponentUsage: () => extractComponentUsage,
|
|
2355
2674
|
extractContainerCssFromSource: () => extractContainerCssFromSource,
|
|
2675
|
+
extractSemanticMetadata: () => extractSemanticMetadata,
|
|
2356
2676
|
extractTwContainerConfigs: () => extractTwContainerConfigs,
|
|
2357
2677
|
extractTwStateConfigs: () => extractTwStateConfigs,
|
|
2358
2678
|
extractTwStateConfigsNative: () => extractTwStateConfigsNative,
|
|
@@ -2367,8 +2687,14 @@ __export(src_exports, {
|
|
|
2367
2687
|
generateStaticStateCss: () => generateStaticStateCss,
|
|
2368
2688
|
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
2369
2689
|
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
2690
|
+
generateTypeDefinition: () => generateTypeDefinition,
|
|
2691
|
+
generateTypeDefinitionsBatch: () => generateTypeDefinitionsBatch,
|
|
2692
|
+
generateTypeStubFile: () => generateTypeStubFile,
|
|
2693
|
+
generateTypeStubOutputPaths: () => generateTypeStubOutputPaths,
|
|
2694
|
+
generateTypesFromComponents: () => generateTypesFromComponents,
|
|
2370
2695
|
getAllRegisteredClasses: () => getAllRegisteredClasses,
|
|
2371
2696
|
getAllRoutes: () => getAllRoutes,
|
|
2697
|
+
getAriaRoleForSemantic: () => getAriaRoleForSemantic,
|
|
2372
2698
|
getBucketEngine: () => getBucketEngine,
|
|
2373
2699
|
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
2374
2700
|
getCacheStatistics: () => getCacheStatistics,
|
|
@@ -2464,6 +2790,7 @@ __export(src_exports, {
|
|
|
2464
2790
|
registerPluginHook: () => registerPluginHook,
|
|
2465
2791
|
registerPropertyName: () => registerPropertyName,
|
|
2466
2792
|
registerValueName: () => registerValueName,
|
|
2793
|
+
renderTypeDefinition: () => renderTypeDefinition,
|
|
2467
2794
|
resetBucketEngine: () => resetBucketEngine,
|
|
2468
2795
|
resetCacheStats: () => resetCacheStats,
|
|
2469
2796
|
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
@@ -2506,6 +2833,7 @@ __export(src_exports, {
|
|
|
2506
2833
|
twMergeWithSeparator: () => twMergeWithSeparator,
|
|
2507
2834
|
unregisterPluginHook: () => unregisterPluginHook,
|
|
2508
2835
|
validateCssOutput: () => validateCssOutput,
|
|
2836
|
+
validateSemanticMetadata: () => validateSemanticMetadata,
|
|
2509
2837
|
validateThemeConfig: () => validateThemeConfig,
|
|
2510
2838
|
valueIdToString: () => valueIdToString,
|
|
2511
2839
|
walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
|
|
@@ -2551,13 +2879,13 @@ function extractContainerCssFromSource(source) {
|
|
|
2551
2879
|
}
|
|
2552
2880
|
return rules.join("\n");
|
|
2553
2881
|
}
|
|
2554
|
-
var
|
|
2882
|
+
var import_node_fs3, import_node_path3, import_node_module4, _require2, 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;
|
|
2555
2883
|
var init_src = __esm({
|
|
2556
2884
|
"packages/domain/compiler/src/index.ts"() {
|
|
2557
2885
|
"use strict";
|
|
2558
2886
|
init_cjs_shims();
|
|
2559
|
-
|
|
2560
|
-
|
|
2887
|
+
import_node_fs3 = __toESM(require("fs"), 1);
|
|
2888
|
+
import_node_path3 = __toESM(require("path"), 1);
|
|
2561
2889
|
import_node_module4 = require("module");
|
|
2562
2890
|
init_nativeBridge();
|
|
2563
2891
|
init_compiler();
|
|
@@ -2567,6 +2895,9 @@ var init_src = __esm({
|
|
|
2567
2895
|
init_redis();
|
|
2568
2896
|
init_watch();
|
|
2569
2897
|
init_routeGraph();
|
|
2898
|
+
init_semanticComponentAnalyzer();
|
|
2899
|
+
init_typeGeneratorFromMetadata();
|
|
2900
|
+
init_typeGenerationPlugin();
|
|
2570
2901
|
_require2 = (0, import_node_module4.createRequire)(
|
|
2571
2902
|
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : importMetaUrl
|
|
2572
2903
|
);
|
|
@@ -2661,7 +2992,7 @@ var init_src = __esm({
|
|
|
2661
2992
|
};
|
|
2662
2993
|
scanProjectUsage = (dirs, cwd) => {
|
|
2663
2994
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2664
|
-
const files = dirs.map((dir) =>
|
|
2995
|
+
const files = dirs.map((dir) => import_node_path3.default.resolve(cwd, dir));
|
|
2665
2996
|
const results = batchExtractClasses2(files) || [];
|
|
2666
2997
|
const combined = {};
|
|
2667
2998
|
for (const result of results) {
|
|
@@ -2678,13 +3009,13 @@ var init_src = __esm({
|
|
|
2678
3009
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2679
3010
|
const allClasses = Object.keys(classes).sort();
|
|
2680
3011
|
if (outputPath) {
|
|
2681
|
-
|
|
3012
|
+
import_node_fs3.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2682
3013
|
}
|
|
2683
3014
|
return allClasses;
|
|
2684
3015
|
};
|
|
2685
3016
|
loadSafelist = (safelistPath) => {
|
|
2686
3017
|
try {
|
|
2687
|
-
const content =
|
|
3018
|
+
const content = import_node_fs3.default.readFileSync(safelistPath, "utf-8");
|
|
2688
3019
|
return JSON.parse(content);
|
|
2689
3020
|
} catch {
|
|
2690
3021
|
return [];
|
|
@@ -2698,8 +3029,8 @@ var init_src = __esm({
|
|
|
2698
3029
|
"tailwind.config.cjs"
|
|
2699
3030
|
];
|
|
2700
3031
|
for (const file of configFiles) {
|
|
2701
|
-
const fullPath =
|
|
2702
|
-
if (
|
|
3032
|
+
const fullPath = import_node_path3.default.join(cwd, file);
|
|
3033
|
+
if (import_node_fs3.default.existsSync(fullPath)) {
|
|
2703
3034
|
const mod = require(fullPath);
|
|
2704
3035
|
return mod.default || mod;
|
|
2705
3036
|
}
|
|
@@ -2709,9 +3040,9 @@ var init_src = __esm({
|
|
|
2709
3040
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2710
3041
|
return {
|
|
2711
3042
|
content: [
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
3043
|
+
import_node_path3.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3044
|
+
import_node_path3.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3045
|
+
import_node_path3.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2715
3046
|
]
|
|
2716
3047
|
};
|
|
2717
3048
|
};
|
|
@@ -3203,17 +3534,17 @@ function getNative() {
|
|
|
3203
3534
|
function* walkSourceFiles(dir) {
|
|
3204
3535
|
let entries;
|
|
3205
3536
|
try {
|
|
3206
|
-
entries =
|
|
3537
|
+
entries = import_node_fs4.default.readdirSync(dir, { withFileTypes: true });
|
|
3207
3538
|
} catch {
|
|
3208
3539
|
return;
|
|
3209
3540
|
}
|
|
3210
3541
|
for (const entry of entries) {
|
|
3211
|
-
const fullPath =
|
|
3542
|
+
const fullPath = import_node_path4.default.join(dir, entry.name);
|
|
3212
3543
|
if (entry.isDirectory()) {
|
|
3213
3544
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3214
3545
|
yield* walkSourceFiles(fullPath);
|
|
3215
3546
|
} else if (entry.isFile()) {
|
|
3216
|
-
const ext =
|
|
3547
|
+
const ext = import_node_path4.default.extname(entry.name);
|
|
3217
3548
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3218
3549
|
}
|
|
3219
3550
|
}
|
|
@@ -3277,7 +3608,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3277
3608
|
allConfigs.push(...configs);
|
|
3278
3609
|
if (verbose) {
|
|
3279
3610
|
process.stderr.write(
|
|
3280
|
-
`[tw:static-state] ${
|
|
3611
|
+
`[tw:static-state] ${import_node_path4.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3281
3612
|
`
|
|
3282
3613
|
);
|
|
3283
3614
|
}
|
|
@@ -3288,7 +3619,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3288
3619
|
if (filesScanned >= maxFiles) break;
|
|
3289
3620
|
let source;
|
|
3290
3621
|
try {
|
|
3291
|
-
source =
|
|
3622
|
+
source = import_node_fs4.default.readFileSync(filePath, "utf-8");
|
|
3292
3623
|
} catch {
|
|
3293
3624
|
continue;
|
|
3294
3625
|
}
|
|
@@ -3301,7 +3632,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3301
3632
|
allConfigs.push(...configs);
|
|
3302
3633
|
if (verbose) {
|
|
3303
3634
|
process.stderr.write(
|
|
3304
|
-
`[tw:static-state] ${
|
|
3635
|
+
`[tw:static-state] ${import_node_path4.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3305
3636
|
`
|
|
3306
3637
|
);
|
|
3307
3638
|
}
|
|
@@ -3395,12 +3726,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3395
3726
|
resolvedCss: options.resolvedCss || ""
|
|
3396
3727
|
// ← ensure always passed
|
|
3397
3728
|
});
|
|
3398
|
-
const twClassesDir =
|
|
3399
|
-
|
|
3400
|
-
const stateFilePath =
|
|
3729
|
+
const twClassesDir = import_node_path4.default.join(import_node_path4.default.dirname(safelistPath), "tw-classes");
|
|
3730
|
+
import_node_fs4.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3731
|
+
const stateFilePath = import_node_path4.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3401
3732
|
if (result.rulesGenerated === 0) {
|
|
3402
3733
|
try {
|
|
3403
|
-
|
|
3734
|
+
import_node_fs4.default.writeFileSync(
|
|
3404
3735
|
stateFilePath,
|
|
3405
3736
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3406
3737
|
"utf-8"
|
|
@@ -3410,7 +3741,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3410
3741
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3411
3742
|
}
|
|
3412
3743
|
try {
|
|
3413
|
-
|
|
3744
|
+
import_node_fs4.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3414
3745
|
return [
|
|
3415
3746
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3416
3747
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3422,13 +3753,13 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3422
3753
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3423
3754
|
}
|
|
3424
3755
|
}
|
|
3425
|
-
var
|
|
3756
|
+
var import_node_fs4, import_node_path4, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3426
3757
|
var init_staticStateExtractor = __esm({
|
|
3427
3758
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3428
3759
|
"use strict";
|
|
3429
3760
|
init_cjs_shims();
|
|
3430
|
-
|
|
3431
|
-
|
|
3761
|
+
import_node_fs4 = __toESM(require("fs"));
|
|
3762
|
+
import_node_path4 = __toESM(require("path"));
|
|
3432
3763
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3433
3764
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3434
3765
|
_native = null;
|
|
@@ -3446,8 +3777,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3446
3777
|
_globalLogFile = filePath;
|
|
3447
3778
|
_logFileInitialized = false;
|
|
3448
3779
|
try {
|
|
3449
|
-
|
|
3450
|
-
|
|
3780
|
+
import_node_fs5.default.mkdirSync(import_node_path5.default.dirname(filePath), { recursive: true });
|
|
3781
|
+
import_node_fs5.default.writeFileSync(
|
|
3451
3782
|
filePath,
|
|
3452
3783
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3453
3784
|
`,
|
|
@@ -3460,7 +3791,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3460
3791
|
function writeToFile(line) {
|
|
3461
3792
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3462
3793
|
try {
|
|
3463
|
-
|
|
3794
|
+
import_node_fs5.default.appendFileSync(_globalLogFile, line);
|
|
3464
3795
|
} catch {
|
|
3465
3796
|
}
|
|
3466
3797
|
}
|
|
@@ -3487,13 +3818,13 @@ function createLogger(prefix, level) {
|
|
|
3487
3818
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3488
3819
|
};
|
|
3489
3820
|
}
|
|
3490
|
-
var
|
|
3821
|
+
var import_node_fs5, import_node_path5, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3491
3822
|
var init_logger = __esm({
|
|
3492
3823
|
"packages/domain/shared/src/logger.ts"() {
|
|
3493
3824
|
"use strict";
|
|
3494
3825
|
init_cjs_shims();
|
|
3495
|
-
|
|
3496
|
-
|
|
3826
|
+
import_node_fs5 = __toESM(require("fs"));
|
|
3827
|
+
import_node_path5 = __toESM(require("path"));
|
|
3497
3828
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3498
3829
|
_globalLogFile = null;
|
|
3499
3830
|
_logFileInitialized = false;
|
|
@@ -3531,9 +3862,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3531
3862
|
}
|
|
3532
3863
|
};
|
|
3533
3864
|
}
|
|
3534
|
-
function formatIssuePath(
|
|
3535
|
-
if (!
|
|
3536
|
-
return
|
|
3865
|
+
function formatIssuePath(path14) {
|
|
3866
|
+
if (!path14 || path14.length === 0) return "(root)";
|
|
3867
|
+
return path14.map(
|
|
3537
3868
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3538
3869
|
).join(".");
|
|
3539
3870
|
}
|
|
@@ -3541,9 +3872,9 @@ function loadNativeBinding(options) {
|
|
|
3541
3872
|
const { runtimeDir, candidates, isValid } = options;
|
|
3542
3873
|
const loadErrors = [];
|
|
3543
3874
|
for (const candidate of candidates) {
|
|
3544
|
-
const candidatePath =
|
|
3875
|
+
const candidatePath = import_node_path6.default.resolve(runtimeDir, candidate);
|
|
3545
3876
|
try {
|
|
3546
|
-
if (!
|
|
3877
|
+
if (!import_node_fs6.default.existsSync(candidatePath) && !import_node_fs6.default.existsSync(candidatePath + ".node")) {
|
|
3547
3878
|
continue;
|
|
3548
3879
|
}
|
|
3549
3880
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3575,9 +3906,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3575
3906
|
}
|
|
3576
3907
|
}
|
|
3577
3908
|
if (!includeDefaultCandidates) return candidates;
|
|
3578
|
-
if (
|
|
3909
|
+
if (import_node_fs6.default.existsSync(runtimeDir)) {
|
|
3579
3910
|
try {
|
|
3580
|
-
for (const entry of
|
|
3911
|
+
for (const entry of import_node_fs6.default.readdirSync(runtimeDir)) {
|
|
3581
3912
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3582
3913
|
}
|
|
3583
3914
|
} catch {
|
|
@@ -3586,34 +3917,34 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3586
3917
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3587
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}`;
|
|
3588
3919
|
for (const bin of BINARY_NAMES) {
|
|
3589
|
-
candidates.push(
|
|
3590
|
-
candidates.push(
|
|
3591
|
-
candidates.push(
|
|
3592
|
-
candidates.push(
|
|
3593
|
-
candidates.push(
|
|
3594
|
-
candidates.push(
|
|
3595
|
-
candidates.push(
|
|
3596
|
-
candidates.push(
|
|
3597
|
-
candidates.push(
|
|
3920
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, `${bin}.node`));
|
|
3921
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3922
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3923
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3924
|
+
candidates.push(import_node_path6.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3925
|
+
candidates.push(import_node_path6.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3926
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3927
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3928
|
+
candidates.push(import_node_path6.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3598
3929
|
}
|
|
3599
3930
|
return Array.from(new Set(candidates));
|
|
3600
3931
|
}
|
|
3601
3932
|
function resolveRuntimeDir(dir, importMetaUrl2) {
|
|
3602
|
-
if (dir) return
|
|
3933
|
+
if (dir) return import_node_path6.default.resolve(dir);
|
|
3603
3934
|
try {
|
|
3604
|
-
return
|
|
3935
|
+
return import_node_path6.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl2));
|
|
3605
3936
|
} catch {
|
|
3606
3937
|
return process.cwd();
|
|
3607
3938
|
}
|
|
3608
3939
|
}
|
|
3609
|
-
var import_node_crypto,
|
|
3940
|
+
var import_node_crypto, import_node_fs6, import_node_path6, import_node_url, import_node_module5, TwError, _require3;
|
|
3610
3941
|
var init_src2 = __esm({
|
|
3611
3942
|
"packages/domain/shared/src/index.ts"() {
|
|
3612
3943
|
"use strict";
|
|
3613
3944
|
init_cjs_shims();
|
|
3614
3945
|
import_node_crypto = require("crypto");
|
|
3615
|
-
|
|
3616
|
-
|
|
3946
|
+
import_node_fs6 = __toESM(require("fs"));
|
|
3947
|
+
import_node_path6 = __toESM(require("path"));
|
|
3617
3948
|
import_node_url = require("url");
|
|
3618
3949
|
import_node_module5 = require("module");
|
|
3619
3950
|
init_workerResolver();
|
|
@@ -3653,8 +3984,8 @@ var init_src2 = __esm({
|
|
|
3653
3984
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3654
3985
|
static fromZod(err) {
|
|
3655
3986
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3656
|
-
const
|
|
3657
|
-
const message = first ? `${
|
|
3987
|
+
const path14 = formatIssuePath(first?.path);
|
|
3988
|
+
const message = first ? `${path14}: ${first.message}` : "Schema validation failed";
|
|
3658
3989
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3659
3990
|
}
|
|
3660
3991
|
static wrap(source, code, err) {
|
|
@@ -3713,7 +4044,7 @@ function getDirname() {
|
|
|
3713
4044
|
return __dirname;
|
|
3714
4045
|
}
|
|
3715
4046
|
if (typeof import_meta4 !== "undefined" && importMetaUrl) {
|
|
3716
|
-
return
|
|
4047
|
+
return import_node_path7.default.dirname((0, import_node_url2.fileURLToPath)(importMetaUrl));
|
|
3717
4048
|
}
|
|
3718
4049
|
return process.cwd();
|
|
3719
4050
|
}
|
|
@@ -3925,12 +4256,12 @@ function hasNativeWatchBinding() {
|
|
|
3925
4256
|
return false;
|
|
3926
4257
|
}
|
|
3927
4258
|
}
|
|
3928
|
-
var
|
|
4259
|
+
var import_node_path7, import_node_url2, import_meta4, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3929
4260
|
var init_native_bridge = __esm({
|
|
3930
4261
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3931
4262
|
"use strict";
|
|
3932
4263
|
init_cjs_shims();
|
|
3933
|
-
|
|
4264
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
3934
4265
|
import_node_url2 = require("url");
|
|
3935
4266
|
init_src2();
|
|
3936
4267
|
import_meta4 = {};
|
|
@@ -4060,28 +4391,28 @@ var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSch
|
|
|
4060
4391
|
|
|
4061
4392
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
4062
4393
|
init_cjs_shims();
|
|
4063
|
-
var
|
|
4394
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
4064
4395
|
var import_node_module7 = require("module");
|
|
4065
|
-
var
|
|
4396
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
4066
4397
|
init_src2();
|
|
4067
4398
|
|
|
4068
4399
|
// packages/domain/scanner/src/index.ts
|
|
4069
4400
|
init_cjs_shims();
|
|
4070
|
-
var
|
|
4401
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
4071
4402
|
var import_node_module6 = require("module");
|
|
4072
|
-
var
|
|
4403
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
4073
4404
|
var import_node_url3 = require("url");
|
|
4074
4405
|
var import_node_worker_threads = require("worker_threads");
|
|
4075
4406
|
init_src2();
|
|
4076
4407
|
|
|
4077
4408
|
// packages/domain/scanner/src/cache-native.ts
|
|
4078
4409
|
init_cjs_shims();
|
|
4079
|
-
var
|
|
4080
|
-
var
|
|
4410
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
4411
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
4081
4412
|
init_native_bridge();
|
|
4082
4413
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4083
|
-
const dir = cacheDir ?
|
|
4084
|
-
return
|
|
4414
|
+
const dir = cacheDir ? import_node_path8.default.resolve(rootDir, cacheDir) : import_node_path8.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4415
|
+
return import_node_path8.default.join(dir, "scanner-cache.json");
|
|
4085
4416
|
}
|
|
4086
4417
|
function metaPathFor(cachePath) {
|
|
4087
4418
|
return cachePath.replace(/\.json$/, ".meta.json");
|
|
@@ -4095,7 +4426,7 @@ function getBinaryFingerprint() {
|
|
|
4095
4426
|
_cachedFingerprint = null;
|
|
4096
4427
|
return null;
|
|
4097
4428
|
}
|
|
4098
|
-
const stat =
|
|
4429
|
+
const stat = import_node_fs7.default.statSync(loadedPath);
|
|
4099
4430
|
_cachedFingerprint = `${stat.mtimeMs}:${stat.size}`;
|
|
4100
4431
|
} catch {
|
|
4101
4432
|
_cachedFingerprint = null;
|
|
@@ -4105,13 +4436,13 @@ function getBinaryFingerprint() {
|
|
|
4105
4436
|
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4106
4437
|
function readCache(rootDir, cacheDir) {
|
|
4107
4438
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4108
|
-
|
|
4439
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(cachePath), { recursive: true });
|
|
4109
4440
|
const currentFingerprint = getBinaryFingerprint();
|
|
4110
4441
|
if (currentFingerprint !== null) {
|
|
4111
4442
|
const metaPath = metaPathFor(cachePath);
|
|
4112
4443
|
let storedFingerprint = null;
|
|
4113
4444
|
try {
|
|
4114
|
-
storedFingerprint = JSON.parse(
|
|
4445
|
+
storedFingerprint = JSON.parse(import_node_fs7.default.readFileSync(metaPath, "utf8")).binaryFingerprint ?? null;
|
|
4115
4446
|
} catch {
|
|
4116
4447
|
}
|
|
4117
4448
|
if (storedFingerprint !== currentFingerprint) {
|
|
@@ -4135,7 +4466,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4135
4466
|
}
|
|
4136
4467
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4137
4468
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4138
|
-
|
|
4469
|
+
import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(cachePath), { recursive: true });
|
|
4139
4470
|
const success = cacheWriteNative(cachePath, entries);
|
|
4140
4471
|
if (!success) {
|
|
4141
4472
|
throw new Error(
|
|
@@ -4145,7 +4476,7 @@ function writeCache(rootDir, entries, cacheDir) {
|
|
|
4145
4476
|
const currentFingerprint = getBinaryFingerprint();
|
|
4146
4477
|
if (currentFingerprint !== null) {
|
|
4147
4478
|
try {
|
|
4148
|
-
|
|
4479
|
+
import_node_fs7.default.writeFileSync(
|
|
4149
4480
|
metaPathFor(cachePath),
|
|
4150
4481
|
JSON.stringify({ binaryFingerprint: currentFingerprint }),
|
|
4151
4482
|
"utf8"
|
|
@@ -4173,12 +4504,12 @@ init_native_bridge();
|
|
|
4173
4504
|
init_cjs_shims();
|
|
4174
4505
|
var import_zod2 = require("zod");
|
|
4175
4506
|
init_src2();
|
|
4176
|
-
var formatIssuePath2 = (
|
|
4507
|
+
var formatIssuePath2 = (path14) => path14.length > 0 ? path14.map(
|
|
4177
4508
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
4178
4509
|
).join(".") : "<root>";
|
|
4179
4510
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
4180
|
-
const
|
|
4181
|
-
return `${
|
|
4511
|
+
const path14 = formatIssuePath2(issue.path);
|
|
4512
|
+
return `${path14}: ${issue.message}`;
|
|
4182
4513
|
}).join("; ");
|
|
4183
4514
|
var parseWithSchema2 = (schema, data, label) => {
|
|
4184
4515
|
const parsed = schema.safeParse(data);
|
|
@@ -4239,7 +4570,7 @@ function getRuntimeDir() {
|
|
|
4239
4570
|
return __dirname;
|
|
4240
4571
|
}
|
|
4241
4572
|
if (typeof import_meta5 !== "undefined" && importMetaUrl) {
|
|
4242
|
-
return
|
|
4573
|
+
return import_node_path9.default.dirname((0, import_node_url3.fileURLToPath)(importMetaUrl));
|
|
4243
4574
|
}
|
|
4244
4575
|
return process.cwd();
|
|
4245
4576
|
}
|
|
@@ -4254,7 +4585,7 @@ var createNativeParserLoader = () => {
|
|
|
4254
4585
|
const loadNativeParserBinding = () => {
|
|
4255
4586
|
if (_state.binding !== void 0) return _state.binding;
|
|
4256
4587
|
const runtimeDir = getRuntimeDir();
|
|
4257
|
-
const req = (0, import_node_module6.createRequire)(
|
|
4588
|
+
const req = (0, import_node_module6.createRequire)(import_node_path9.default.join(runtimeDir, "noop.cjs"));
|
|
4258
4589
|
const _platform = process.platform;
|
|
4259
4590
|
const _arch = process.arch;
|
|
4260
4591
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4262,27 +4593,27 @@ var createNativeParserLoader = () => {
|
|
|
4262
4593
|
const candidates = [
|
|
4263
4594
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4264
4595
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4596
|
+
import_node_path9.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4597
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4598
|
+
import_node_path9.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4268
4599
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4269
4600
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4601
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4602
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4603
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4273
4604
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4274
|
-
|
|
4275
|
-
|
|
4605
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4606
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4276
4607
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4277
|
-
|
|
4278
|
-
|
|
4608
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4609
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4279
4610
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4611
|
+
import_node_path9.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4612
|
+
import_node_path9.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4613
|
+
import_node_path9.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4614
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4615
|
+
import_node_path9.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4616
|
+
import_node_path9.default.resolve(
|
|
4286
4617
|
runtimeDir,
|
|
4287
4618
|
"..",
|
|
4288
4619
|
"..",
|
|
@@ -4294,7 +4625,7 @@ var createNativeParserLoader = () => {
|
|
|
4294
4625
|
)
|
|
4295
4626
|
];
|
|
4296
4627
|
for (const fullPath of candidates) {
|
|
4297
|
-
if (!
|
|
4628
|
+
if (!import_node_fs8.default.existsSync(fullPath)) continue;
|
|
4298
4629
|
try {
|
|
4299
4630
|
const required = req(fullPath);
|
|
4300
4631
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4335,19 +4666,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4335
4666
|
if (!currentDir) continue;
|
|
4336
4667
|
const entries = (() => {
|
|
4337
4668
|
try {
|
|
4338
|
-
return
|
|
4669
|
+
return import_node_fs8.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4339
4670
|
} catch {
|
|
4340
4671
|
return [];
|
|
4341
4672
|
}
|
|
4342
4673
|
})();
|
|
4343
4674
|
for (const entry of entries) {
|
|
4344
|
-
const fullPath =
|
|
4675
|
+
const fullPath = import_node_path9.default.join(currentDir, entry.name);
|
|
4345
4676
|
if (entry.isDirectory()) {
|
|
4346
4677
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4347
4678
|
continue;
|
|
4348
4679
|
}
|
|
4349
4680
|
if (!entry.isFile()) continue;
|
|
4350
|
-
if (!extensionSet.has(
|
|
4681
|
+
if (!extensionSet.has(import_node_path9.default.extname(entry.name))) continue;
|
|
4351
4682
|
candidates.push(fullPath);
|
|
4352
4683
|
}
|
|
4353
4684
|
}
|
|
@@ -4431,7 +4762,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4431
4762
|
for (const filePath of candidates) {
|
|
4432
4763
|
const stat = (() => {
|
|
4433
4764
|
try {
|
|
4434
|
-
return
|
|
4765
|
+
return import_node_fs8.default.statSync(filePath);
|
|
4435
4766
|
} catch {
|
|
4436
4767
|
return null;
|
|
4437
4768
|
}
|
|
@@ -4457,7 +4788,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4457
4788
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4458
4789
|
const content = (() => {
|
|
4459
4790
|
try {
|
|
4460
|
-
return
|
|
4791
|
+
return import_node_fs8.default.readFileSync(filePath, "utf8");
|
|
4461
4792
|
} catch {
|
|
4462
4793
|
return null;
|
|
4463
4794
|
}
|
|
@@ -4523,8 +4854,8 @@ init_src2();
|
|
|
4523
4854
|
|
|
4524
4855
|
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4525
4856
|
init_cjs_shims();
|
|
4526
|
-
var
|
|
4527
|
-
var
|
|
4857
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
4858
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
4528
4859
|
init_src();
|
|
4529
4860
|
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4530
4861
|
function getNative2() {
|
|
@@ -4536,10 +4867,10 @@ function getNative2() {
|
|
|
4536
4867
|
}
|
|
4537
4868
|
function fingerprintFile(filePath) {
|
|
4538
4869
|
try {
|
|
4539
|
-
const stat =
|
|
4870
|
+
const stat = import_node_fs9.default.statSync(filePath);
|
|
4540
4871
|
const native = getNative2();
|
|
4541
4872
|
if (native?.create_fingerprint) {
|
|
4542
|
-
const content =
|
|
4873
|
+
const content = import_node_fs9.default.readFileSync(filePath, "utf-8");
|
|
4543
4874
|
const hash = native.create_fingerprint(filePath, content);
|
|
4544
4875
|
return { hash, mtime: stat.mtimeMs };
|
|
4545
4876
|
}
|
|
@@ -4579,9 +4910,9 @@ function hasSourceChanged(sourceFiles) {
|
|
|
4579
4910
|
}
|
|
4580
4911
|
function isIncrementalEnabled(cwd) {
|
|
4581
4912
|
try {
|
|
4582
|
-
const configPath =
|
|
4583
|
-
if (!
|
|
4584
|
-
const config = JSON.parse(
|
|
4913
|
+
const configPath = import_node_path10.default.join(cwd, "tailwind-styled.config.json");
|
|
4914
|
+
if (!import_node_fs9.default.existsSync(configPath)) return false;
|
|
4915
|
+
const config = JSON.parse(import_node_fs9.default.readFileSync(configPath, "utf-8"));
|
|
4585
4916
|
return config.compiler?.incremental === true;
|
|
4586
4917
|
} catch {
|
|
4587
4918
|
return false;
|
|
@@ -4590,8 +4921,8 @@ function isIncrementalEnabled(cwd) {
|
|
|
4590
4921
|
|
|
4591
4922
|
// packages/presentation/next/src/staticCssWebpackPlugin.ts
|
|
4592
4923
|
init_cjs_shims();
|
|
4593
|
-
var
|
|
4594
|
-
var
|
|
4924
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
4925
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
4595
4926
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4596
4927
|
function setFileStaticCss(filepath, css) {
|
|
4597
4928
|
if (css && css.trim()) {
|
|
@@ -4625,14 +4956,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4625
4956
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4626
4957
|
outPath;
|
|
4627
4958
|
constructor(safelistPath) {
|
|
4628
|
-
this.outPath =
|
|
4959
|
+
this.outPath = import_node_path11.default.join(import_node_path11.default.dirname(safelistPath), "_tw-state-static.css");
|
|
4629
4960
|
}
|
|
4630
4961
|
apply(compiler) {
|
|
4631
4962
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4632
4963
|
try {
|
|
4633
4964
|
const content = buildContent(_fileStaticCssMap);
|
|
4634
|
-
|
|
4635
|
-
|
|
4965
|
+
import_node_fs10.default.mkdirSync(import_node_path11.default.dirname(this.outPath), { recursive: true });
|
|
4966
|
+
import_node_fs10.default.writeFileSync(
|
|
4636
4967
|
this.outPath,
|
|
4637
4968
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4638
4969
|
"utf-8"
|
|
@@ -4670,12 +5001,12 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4670
5001
|
} catch {
|
|
4671
5002
|
const runtimeDir = resolveRuntimeDir2();
|
|
4672
5003
|
const candidates = [
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
5004
|
+
import_node_path12.default.resolve(runtimeDir, `${basename}.mjs`),
|
|
5005
|
+
import_node_path12.default.resolve(runtimeDir, `${basename}.js`),
|
|
5006
|
+
import_node_path12.default.resolve(runtimeDir, `${basename}.cjs`)
|
|
4676
5007
|
];
|
|
4677
5008
|
for (const candidate of candidates) {
|
|
4678
|
-
if (
|
|
5009
|
+
if (import_node_fs11.default.existsSync(candidate)) {
|
|
4679
5010
|
return candidate;
|
|
4680
5011
|
}
|
|
4681
5012
|
}
|
|
@@ -4713,7 +5044,7 @@ var createLoaderOptions = (options) => {
|
|
|
4713
5044
|
preserveImports: true
|
|
4714
5045
|
};
|
|
4715
5046
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4716
|
-
opts.safelistPath = options.safelistPath ??
|
|
5047
|
+
opts.safelistPath = options.safelistPath ?? import_node_path12.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4717
5048
|
return Object.freeze(opts);
|
|
4718
5049
|
};
|
|
4719
5050
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4726,7 +5057,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4726
5057
|
])
|
|
4727
5058
|
);
|
|
4728
5059
|
};
|
|
4729
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
5060
|
+
var normalizeLoaderPath = (loaderPath) => import_node_path12.default.resolve(loaderPath);
|
|
4730
5061
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4731
5062
|
const loaderOptions = createLoaderOptions(options);
|
|
4732
5063
|
const rules = config.module?.rules ?? [];
|
|
@@ -4743,7 +5074,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4743
5074
|
enforce: "pre",
|
|
4744
5075
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4745
5076
|
};
|
|
4746
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
5077
|
+
const safelistPath = loaderOptions.safelistPath ?? import_node_path12.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4747
5078
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4748
5079
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4749
5080
|
);
|
|
@@ -4843,17 +5174,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4843
5174
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4844
5175
|
};
|
|
4845
5176
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4846
|
-
const twClassesDir =
|
|
4847
|
-
|
|
4848
|
-
setGlobalLogFile(
|
|
4849
|
-
|
|
4850
|
-
|
|
5177
|
+
const twClassesDir = import_node_path12.default.join(import_node_path12.default.dirname(safelistPath), "tw-classes");
|
|
5178
|
+
import_node_fs11.default.mkdirSync(twClassesDir, { recursive: true });
|
|
5179
|
+
setGlobalLogFile(import_node_path12.default.join(twClassesDir, "_tw-build.log"));
|
|
5180
|
+
import_node_fs11.default.writeFileSync(
|
|
5181
|
+
import_node_path12.default.join(twClassesDir, "_start.txt"),
|
|
4851
5182
|
String(Date.now()),
|
|
4852
5183
|
"utf-8"
|
|
4853
5184
|
);
|
|
4854
|
-
const stateStaticPath =
|
|
5185
|
+
const stateStaticPath = import_node_path12.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4855
5186
|
try {
|
|
4856
|
-
|
|
5187
|
+
import_node_fs11.default.writeFileSync(
|
|
4857
5188
|
stateStaticPath,
|
|
4858
5189
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4859
5190
|
"utf-8"
|
|
@@ -4869,14 +5200,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4869
5200
|
"src/index.css",
|
|
4870
5201
|
"styles/globals.css"
|
|
4871
5202
|
];
|
|
4872
|
-
const safelistDir =
|
|
5203
|
+
const safelistDir = import_node_path12.default.dirname(safelistPath);
|
|
4873
5204
|
for (const candidate of CSS_CANDIDATES) {
|
|
4874
|
-
const candidatePath =
|
|
4875
|
-
if (!
|
|
4876
|
-
const content =
|
|
5205
|
+
const candidatePath = import_node_path12.default.join(process.cwd(), candidate);
|
|
5206
|
+
if (!import_node_fs11.default.existsSync(candidatePath)) continue;
|
|
5207
|
+
const content = import_node_fs11.default.readFileSync(candidatePath, "utf-8");
|
|
4877
5208
|
if (content.includes("_tw-state-static.css")) break;
|
|
4878
|
-
const globalsDir =
|
|
4879
|
-
const rel =
|
|
5209
|
+
const globalsDir = import_node_path12.default.dirname(candidatePath);
|
|
5210
|
+
const rel = import_node_path12.default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4880
5211
|
const importLine = `@import "./${rel}";`;
|
|
4881
5212
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4882
5213
|
let updated;
|
|
@@ -4890,7 +5221,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4890
5221
|
updated = `${importLine}
|
|
4891
5222
|
${content}`;
|
|
4892
5223
|
}
|
|
4893
|
-
|
|
5224
|
+
import_node_fs11.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
4894
5225
|
if (options.verbose) {
|
|
4895
5226
|
console.log(
|
|
4896
5227
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4902,27 +5233,27 @@ ${content}`;
|
|
|
4902
5233
|
}
|
|
4903
5234
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4904
5235
|
const runtimeDir = resolveRuntimeDir2();
|
|
4905
|
-
const nativePath =
|
|
4906
|
-
if (
|
|
5236
|
+
const nativePath = import_node_path12.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
5237
|
+
if (import_node_fs11.default.existsSync(nativePath)) {
|
|
4907
5238
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4908
5239
|
}
|
|
4909
5240
|
}
|
|
4910
|
-
const srcDir =
|
|
4911
|
-
if (
|
|
5241
|
+
const srcDir = import_node_path12.default.join(process.cwd(), "src");
|
|
5242
|
+
if (import_node_fs11.default.existsSync(srcDir)) {
|
|
4912
5243
|
try {
|
|
4913
5244
|
const result = scanWorkspace2(srcDir);
|
|
4914
5245
|
if (result.uniqueClasses.length > 0) {
|
|
4915
5246
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4916
5247
|
const tmpPath = `${filePath}.tmp`;
|
|
4917
5248
|
try {
|
|
4918
|
-
|
|
4919
|
-
|
|
5249
|
+
import_node_fs11.default.writeFileSync(tmpPath, content, "utf-8");
|
|
5250
|
+
import_node_fs11.default.renameSync(tmpPath, filePath);
|
|
4920
5251
|
} catch {
|
|
4921
5252
|
try {
|
|
4922
|
-
|
|
5253
|
+
import_node_fs11.default.unlinkSync(tmpPath);
|
|
4923
5254
|
} catch {
|
|
4924
5255
|
}
|
|
4925
|
-
|
|
5256
|
+
import_node_fs11.default.writeFileSync(filePath, content, "utf-8");
|
|
4926
5257
|
}
|
|
4927
5258
|
};
|
|
4928
5259
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4986,14 +5317,14 @@ ${content}`;
|
|
|
4986
5317
|
"styles/globals.css"
|
|
4987
5318
|
];
|
|
4988
5319
|
try {
|
|
4989
|
-
const twConfigPath =
|
|
4990
|
-
if (
|
|
4991
|
-
const twConfig = JSON.parse(
|
|
5320
|
+
const twConfigPath = import_node_path12.default.join(process.cwd(), "tailwind-styled.config.json");
|
|
5321
|
+
if (import_node_fs11.default.existsSync(twConfigPath)) {
|
|
5322
|
+
const twConfig = JSON.parse(import_node_fs11.default.readFileSync(twConfigPath, "utf-8"));
|
|
4992
5323
|
const cssEntry = twConfig.css?.entry;
|
|
4993
5324
|
if (cssEntry) {
|
|
4994
|
-
const cssEntryPath =
|
|
4995
|
-
if (
|
|
4996
|
-
cssEntryContent =
|
|
5325
|
+
const cssEntryPath = import_node_path12.default.join(process.cwd(), cssEntry);
|
|
5326
|
+
if (import_node_fs11.default.existsSync(cssEntryPath)) {
|
|
5327
|
+
cssEntryContent = import_node_fs11.default.readFileSync(cssEntryPath, "utf-8");
|
|
4997
5328
|
}
|
|
4998
5329
|
}
|
|
4999
5330
|
}
|
|
@@ -5001,9 +5332,9 @@ ${content}`;
|
|
|
5001
5332
|
}
|
|
5002
5333
|
if (!cssEntryContent) {
|
|
5003
5334
|
for (const candidate of CSS_CANDIDATES) {
|
|
5004
|
-
const candidatePath =
|
|
5005
|
-
if (
|
|
5006
|
-
cssEntryContent =
|
|
5335
|
+
const candidatePath = import_node_path12.default.join(process.cwd(), candidate);
|
|
5336
|
+
if (import_node_fs11.default.existsSync(candidatePath)) {
|
|
5337
|
+
cssEntryContent = import_node_fs11.default.readFileSync(candidatePath, "utf-8");
|
|
5007
5338
|
break;
|
|
5008
5339
|
}
|
|
5009
5340
|
}
|
|
@@ -5011,8 +5342,8 @@ ${content}`;
|
|
|
5011
5342
|
if (cssEntryContent) {
|
|
5012
5343
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
5013
5344
|
}
|
|
5014
|
-
const initialScanPath =
|
|
5015
|
-
if (!
|
|
5345
|
+
const initialScanPath = import_node_path12.default.join(twClassesDir, "_initial-scan.css");
|
|
5346
|
+
if (!import_node_fs11.default.existsSync(initialScanPath)) {
|
|
5016
5347
|
atomicWriteFile2(
|
|
5017
5348
|
initialScanPath,
|
|
5018
5349
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
@@ -5020,7 +5351,7 @@ ${content}`;
|
|
|
5020
5351
|
}
|
|
5021
5352
|
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
5022
5353
|
const incremental = isIncrementalEnabled(process.cwd());
|
|
5023
|
-
if (incremental &&
|
|
5354
|
+
if (incremental && import_node_fs11.default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
5024
5355
|
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
5025
5356
|
} else {
|
|
5026
5357
|
void (async () => {
|
|
@@ -5061,8 +5392,8 @@ ${utilitiesOnly}`
|
|
|
5061
5392
|
classes: f.classes.filter(isValidTwClass)
|
|
5062
5393
|
}));
|
|
5063
5394
|
const buckets = buildRouteClassBuckets2(process.cwd(), srcDir, filesForGraph);
|
|
5064
|
-
const cssManifestDir =
|
|
5065
|
-
|
|
5395
|
+
const cssManifestDir = import_node_path12.default.join(process.cwd(), ".next", "static", "css", "tw");
|
|
5396
|
+
import_node_fs11.default.mkdirSync(cssManifestDir, { recursive: true });
|
|
5066
5397
|
const manifestRoutes = {};
|
|
5067
5398
|
const usedFilenames = /* @__PURE__ */ new Set(["_global.css"]);
|
|
5068
5399
|
const minifyManifestCss = process.env.NODE_ENV === "production";
|
|
@@ -5077,7 +5408,7 @@ ${utilitiesOnly}`
|
|
|
5077
5408
|
const globalUtilities = extractUtilitiesLayer2(globalCss);
|
|
5078
5409
|
if (globalUtilities.trim()) {
|
|
5079
5410
|
const filename = "_global.css";
|
|
5080
|
-
atomicWriteFile2(
|
|
5411
|
+
atomicWriteFile2(import_node_path12.default.join(cssManifestDir, filename), globalUtilities);
|
|
5081
5412
|
manifestRoutes.__global = filename;
|
|
5082
5413
|
}
|
|
5083
5414
|
}
|
|
@@ -5099,11 +5430,11 @@ ${utilitiesOnly}`
|
|
|
5099
5430
|
suffix++;
|
|
5100
5431
|
}
|
|
5101
5432
|
usedFilenames.add(filename);
|
|
5102
|
-
atomicWriteFile2(
|
|
5433
|
+
atomicWriteFile2(import_node_path12.default.join(cssManifestDir, filename), routeUtilities);
|
|
5103
5434
|
manifestRoutes[route] = filename;
|
|
5104
5435
|
}
|
|
5105
5436
|
atomicWriteFile2(
|
|
5106
|
-
|
|
5437
|
+
import_node_path12.default.join(cssManifestDir, "css-manifest.json"),
|
|
5107
5438
|
JSON.stringify({ routes: manifestRoutes }, null, 2)
|
|
5108
5439
|
);
|
|
5109
5440
|
if (options.verbose) {
|