chaincss 2.1.22 → 2.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.
@@ -3435,6 +3435,23 @@ const setManifest = (manifest) => {
3435
3435
  }
3436
3436
  console.log(` \u2514\u2500 Found ${total} chain calls (${chainMatches?.length || 0} static, ${smartMatches?.length || 0} hybrid)`);
3437
3437
  }
3438
+ if (id.endsWith(".chain.ts") || id.endsWith(".chain.js")) {
3439
+ try {
3440
+ const results = await compiler.compileFile(id);
3441
+ let css2 = "";
3442
+ for (const r of Object.values(results)) {
3443
+ if (r.css) css2 += r.css + "\n";
3444
+ }
3445
+ if (css2.trim()) {
3446
+ generatedCSS += css2;
3447
+ totalCSSBytes += css2.length;
3448
+ if (options.verbose) {
3449
+ console.log(` \u2514\u2500 Extracted ${css2.length} bytes of CSS`);
3450
+ }
3451
+ }
3452
+ } catch (e) {
3453
+ }
3454
+ }
3438
3455
  await compiler.compileSource(source, id);
3439
3456
  const css = compiler.getCombinedCSS();
3440
3457
  if (css && css.trim()) {
@@ -3506,7 +3523,13 @@ ${source}`,
3506
3523
  hybridCount = 0;
3507
3524
  totalCSSBytes = 0;
3508
3525
  },
3509
- buildEnd() {
3526
+ async buildEnd() {
3527
+ if (generatedCSS.trim() && options.cssOutput) {
3528
+ const fs8 = await import("fs");
3529
+ const outputPath = path6.resolve(process.cwd(), options.cssOutput);
3530
+ fs8.writeFileSync(outputPath, generatedCSS, "utf8");
3531
+ console.log(` \u{1F4C1} CSS written to ${options.cssOutput} (${generatedCSS.length} bytes)`);
3532
+ }
3510
3533
  const finalCSS = updateCSS();
3511
3534
  const stats = compiler.getStats();
3512
3535
  console.log("");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaincss",
3
- "version": "2.1.22",
3
+ "version": "2.1.23",
4
4
  "description": "ChainCSS - The first CSS-in-JS library with true auto-detection mixed mode. Zero runtime by default, dynamic when you need it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -317,7 +317,27 @@ const setManifest = (manifest) => {
317
317
  console.log(` └─ Found ${total} chain calls (${chainMatches?.length || 0} static, ${smartMatches?.length || 0} hybrid)`);
318
318
  }
319
319
 
320
- // Compile the source
320
+ // Compile .chain.ts files to CSS
321
+ if (id.endsWith('.chain.ts') || id.endsWith('.chain.js')) {
322
+ try {
323
+ const results = await compiler.compileFile(id);
324
+ let css = '';
325
+ for (const r of Object.values(results)) {
326
+ if (r.css) css += r.css + '\n';
327
+ }
328
+ if (css.trim()) {
329
+ generatedCSS += css;
330
+ totalCSSBytes += css.length;
331
+ if (options.verbose) {
332
+ console.log(` └─ Extracted ${css.length} bytes of CSS`);
333
+ }
334
+ }
335
+ } catch (e) {
336
+ // Not a compilable chain file
337
+ }
338
+ }
339
+
340
+ // Also detect chain() calls in JSX/TSX for stats
321
341
  await compiler.compileSource(source, id);
322
342
 
323
343
  // Show what was found
@@ -416,7 +436,15 @@ const setManifest = (manifest) => {
416
436
  totalCSSBytes = 0;
417
437
  },
418
438
 
419
- buildEnd() {
439
+ async buildEnd() {
440
+ // Write CSS to file if we have any
441
+ if (generatedCSS.trim() && options.cssOutput) {
442
+ const fs = await import('fs');
443
+ const outputPath = path.resolve(process.cwd(), options.cssOutput);
444
+ fs.writeFileSync(outputPath, generatedCSS, 'utf8');
445
+ console.log(` 📁 CSS written to ${options.cssOutput} (${generatedCSS.length} bytes)`);
446
+ }
447
+
420
448
  const finalCSS = updateCSS();
421
449
  const stats = compiler.getStats();
422
450