chaincss 2.1.16 → 2.1.18
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/dist/plugins/vite.js +34 -0
- package/package.json +1 -1
- package/src/plugins/vite.ts +41 -0
package/dist/plugins/vite.js
CHANGED
|
@@ -3370,12 +3370,28 @@ const setManifest = (manifest) => {
|
|
|
3370
3370
|
}
|
|
3371
3371
|
`;
|
|
3372
3372
|
}
|
|
3373
|
+
let chainCount = 0;
|
|
3374
|
+
let staticCount = 0;
|
|
3375
|
+
let dynamicCount = 0;
|
|
3376
|
+
let hybridCount = 0;
|
|
3377
|
+
let totalCSSBytes = 0;
|
|
3373
3378
|
return {
|
|
3374
3379
|
name: "chaincss",
|
|
3375
3380
|
enforce: "pre",
|
|
3376
3381
|
configureServer(_server) {
|
|
3377
3382
|
server = _server;
|
|
3378
3383
|
log("Vite plugin initialized");
|
|
3384
|
+
setTimeout(() => {
|
|
3385
|
+
if (chainCount > 0) {
|
|
3386
|
+
console.log("");
|
|
3387
|
+
console.log("\u26D3\uFE0F ChainCSS \u2014 Dev Mode Ready");
|
|
3388
|
+
console.log(` \u{1F4E6} Static: ${staticCount || 0} styles \u2192 CSS`);
|
|
3389
|
+
console.log(` \u26A1 Dynamic: ${dynamicCount || 0} styles \u2192 JS runtime`);
|
|
3390
|
+
console.log(` \u{1F500} Hybrid: ${hybridCount || 0} styles \u2192 Auto-split`);
|
|
3391
|
+
console.log(` \u{1F4DD} Total: ${chainCount || 0} chain() calls found`);
|
|
3392
|
+
console.log("");
|
|
3393
|
+
}
|
|
3394
|
+
}, 1e3);
|
|
3379
3395
|
_server.watcher.on("change", (filePath) => {
|
|
3380
3396
|
if (filePath.includes("chaincss.config")) {
|
|
3381
3397
|
log("Config changed, clearing cache...");
|
|
@@ -3417,6 +3433,19 @@ const setManifest = (manifest) => {
|
|
|
3417
3433
|
}
|
|
3418
3434
|
log(`Processing: ${fileName}`);
|
|
3419
3435
|
processedFiles.add(id);
|
|
3436
|
+
const chainMatches = source.match(/chain\(/g);
|
|
3437
|
+
const smartMatches = source.match(/smartChain\(/g);
|
|
3438
|
+
const total = (chainMatches?.length || 0) + (smartMatches?.length || 0);
|
|
3439
|
+
if (total > 0) {
|
|
3440
|
+
chainCount += total;
|
|
3441
|
+
if (smartMatches) {
|
|
3442
|
+
hybridCount += smartMatches.length;
|
|
3443
|
+
staticCount += chainMatches?.length || 0;
|
|
3444
|
+
} else {
|
|
3445
|
+
staticCount += total;
|
|
3446
|
+
}
|
|
3447
|
+
console.log(` \u2514\u2500 Found ${total} chain calls (${chainMatches?.length || 0} static, ${smartMatches?.length || 0} hybrid)`);
|
|
3448
|
+
}
|
|
3420
3449
|
await compiler.compileSource(source, id);
|
|
3421
3450
|
const css = compiler.getCombinedCSS();
|
|
3422
3451
|
if (css && css.trim()) {
|
|
@@ -3475,6 +3504,11 @@ ${source}`,
|
|
|
3475
3504
|
generatedCSS = "";
|
|
3476
3505
|
generatedManifest = {};
|
|
3477
3506
|
compiler.clearCSS();
|
|
3507
|
+
chainCount = 0;
|
|
3508
|
+
staticCount = 0;
|
|
3509
|
+
dynamicCount = 0;
|
|
3510
|
+
hybridCount = 0;
|
|
3511
|
+
totalCSSBytes = 0;
|
|
3478
3512
|
},
|
|
3479
3513
|
buildEnd() {
|
|
3480
3514
|
const finalCSS = updateCSS();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chaincss",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.18",
|
|
4
4
|
"description": "ChainCSS v3.0 - 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",
|
package/src/plugins/vite.ts
CHANGED
|
@@ -232,6 +232,12 @@ const setManifest = (manifest) => {
|
|
|
232
232
|
`;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
let chainCount = 0;
|
|
236
|
+
let staticCount = 0;
|
|
237
|
+
let dynamicCount = 0;
|
|
238
|
+
let hybridCount = 0;
|
|
239
|
+
let totalCSSBytes = 0;
|
|
240
|
+
|
|
235
241
|
return {
|
|
236
242
|
name: 'chaincss',
|
|
237
243
|
enforce: 'pre' as const,
|
|
@@ -240,6 +246,19 @@ const setManifest = (manifest) => {
|
|
|
240
246
|
server = _server;
|
|
241
247
|
log('Vite plugin initialized');
|
|
242
248
|
|
|
249
|
+
// Show stats after server starts
|
|
250
|
+
setTimeout(() => {
|
|
251
|
+
if (chainCount > 0) {
|
|
252
|
+
console.log('');
|
|
253
|
+
console.log('⛓️ ChainCSS — Dev Mode Ready');
|
|
254
|
+
console.log(` 📦 Static: ${staticCount || 0} styles → CSS`);
|
|
255
|
+
console.log(` ⚡ Dynamic: ${dynamicCount || 0} styles → JS runtime`);
|
|
256
|
+
console.log(` 🔀 Hybrid: ${hybridCount || 0} styles → Auto-split`);
|
|
257
|
+
console.log(` 📝 Total: ${chainCount || 0} chain() calls found`);
|
|
258
|
+
console.log('');
|
|
259
|
+
}
|
|
260
|
+
}, 1000);
|
|
261
|
+
|
|
243
262
|
// Watch for config changes
|
|
244
263
|
_server.watcher.on('change', (filePath) => {
|
|
245
264
|
if (filePath.includes('chaincss.config')) {
|
|
@@ -292,6 +311,23 @@ const setManifest = (manifest) => {
|
|
|
292
311
|
log(`Processing: ${fileName}`);
|
|
293
312
|
processedFiles.add(id);
|
|
294
313
|
|
|
314
|
+
// Count chain() and smartChain() calls
|
|
315
|
+
const chainMatches = source.match(/chain\(/g);
|
|
316
|
+
const smartMatches = source.match(/smartChain\(/g);
|
|
317
|
+
const total = (chainMatches?.length || 0) + (smartMatches?.length || 0);
|
|
318
|
+
|
|
319
|
+
if (total > 0) {
|
|
320
|
+
chainCount += total;
|
|
321
|
+
// Estimate static vs dynamic (smartChain is hybrid, chain is static)
|
|
322
|
+
if (smartMatches) {
|
|
323
|
+
hybridCount += smartMatches.length;
|
|
324
|
+
staticCount += (chainMatches?.length || 0);
|
|
325
|
+
} else {
|
|
326
|
+
staticCount += total;
|
|
327
|
+
}
|
|
328
|
+
console.log(` └─ Found ${total} chain calls (${chainMatches?.length || 0} static, ${smartMatches?.length || 0} hybrid)`);
|
|
329
|
+
}
|
|
330
|
+
|
|
295
331
|
// Compile the source
|
|
296
332
|
await compiler.compileSource(source, id);
|
|
297
333
|
|
|
@@ -375,6 +411,11 @@ const setManifest = (manifest) => {
|
|
|
375
411
|
generatedCSS = '';
|
|
376
412
|
generatedManifest = {};
|
|
377
413
|
compiler.clearCSS();
|
|
414
|
+
chainCount = 0;
|
|
415
|
+
staticCount = 0;
|
|
416
|
+
dynamicCount = 0;
|
|
417
|
+
hybridCount = 0;
|
|
418
|
+
totalCSSBytes = 0;
|
|
378
419
|
},
|
|
379
420
|
|
|
380
421
|
buildEnd() {
|