chaincss 2.4.3 → 2.4.4

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.
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from 'vite';
2
- export interface ChainCSSPluginOptions {
2
+ export default function chaincssPlugin(options?: {
3
3
  verbose?: boolean;
4
- }
5
- export default function chaincssPlugin(options?: ChainCSSPluginOptions): Plugin;
4
+ }): Plugin;
@@ -19,6 +19,7 @@ function chaincssPlugin(options = {}) {
19
19
  if (file === cssPath) {
20
20
  try {
21
21
  cssContent = fs.readFileSync(cssPath, "utf8");
22
+ log("CSS updated");
22
23
  } catch {
23
24
  }
24
25
  server.ws.send({ type: "full-reload" });
@@ -26,7 +27,9 @@ function chaincssPlugin(options = {}) {
26
27
  });
27
28
  try {
28
29
  cssContent = fs.readFileSync(cssPath, "utf8");
30
+ log(`Serving ${cssContent.length} bytes`);
29
31
  } catch {
32
+ log("No CSS file yet");
30
33
  }
31
34
  server.middlewares.use("/__chaincss.css", (_req, res) => {
32
35
  res.setHeader("Content-Type", "text/css");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaincss",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
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",
@@ -2,11 +2,7 @@ import { Plugin } from 'vite';
2
2
  import path from 'path';
3
3
  import fs from 'fs';
4
4
 
5
- export interface ChainCSSPluginOptions {
6
- verbose?: boolean;
7
- }
8
-
9
- export default function chaincssPlugin(options: ChainCSSPluginOptions = {}): Plugin {
5
+ export default function chaincssPlugin(options: { verbose?: boolean } = {}): Plugin {
10
6
  let cssContent = '';
11
7
  let cssPath = '';
12
8
 
@@ -26,12 +22,11 @@ export default function chaincssPlugin(options: ChainCSSPluginOptions = {}): Plu
26
22
  server.watcher.add(cssPath);
27
23
  server.watcher.on('change', (file: string) => {
28
24
  if (file === cssPath) {
29
- try { cssContent = fs.readFileSync(cssPath, 'utf8'); } catch {}
25
+ try { cssContent = fs.readFileSync(cssPath, 'utf8'); log('CSS updated'); } catch {}
30
26
  server.ws.send({ type: 'full-reload' });
31
27
  }
32
28
  });
33
-
34
- try { cssContent = fs.readFileSync(cssPath, 'utf8'); } catch {}
29
+ try { cssContent = fs.readFileSync(cssPath, 'utf8'); log(`Serving ${cssContent.length} bytes`); } catch { log('No CSS file yet'); }
35
30
 
36
31
  server.middlewares.use('/__chaincss.css', (_req, res) => {
37
32
  res.setHeader('Content-Type', 'text/css');