csskit 0.0.37 → 0.0.38-canary.0b5d777df3

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 CHANGED
@@ -50,6 +50,14 @@ WidthStyleValue.parse("100px");
50
50
  parse("@media print { a { color: red } }", { context: MediaRule });
51
51
  ```
52
52
 
53
+ `minify` minifies a stylesheet, and throws on a parse error:
54
+
55
+ ```js
56
+ import { minify } from "csskit";
57
+
58
+ minify("a { color: #ff0000 }"); // a{color:red}
59
+ ```
60
+
53
61
  #### Client Side
54
62
 
55
63
  While the main entry is a native addon, therefore only possible to use in Node,
package/index.d.ts CHANGED
@@ -70,6 +70,9 @@ export declare class Node {
70
70
  export declare function parse<T extends Node>(source: string, options: { context: { parse(source: string): T } }): T;
71
71
  export declare function parse(source: string, options?: { context?: undefined }): nodeClasses.StyleSheet;
72
72
 
73
+ /** Minifies `source` as a stylesheet. Throws if `source` has a parse error. */
74
+ export declare function minify(source: string): string;
75
+
73
76
  export declare const Color: typeof nodeClasses.Color;
74
77
  export declare const ComponentValues: typeof nodeClasses.ComponentValues;
75
78
  export declare const SelectorList: typeof nodeClasses.SelectorList;
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import addon from "./addon.js";
1
2
  export * from "./nodes.js";
2
3
  export * from "./om.js";
3
4
  import { StyleSheet } from "./nodes.js";
@@ -10,3 +11,8 @@ import { StyleSheet } from "./nodes.js";
10
11
  export function parse(source, options) {
11
12
  return (options?.context ?? StyleSheet).parse(source);
12
13
  }
14
+
15
+ /** Minifies `source` as a stylesheet. Throws if `source` has a parse error. */
16
+ export function minify(source) {
17
+ return addon.minify(source);
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "csskit",
3
- "version": "0.0.37",
3
+ "version": "0.0.38-canary.0b5d777df3",
4
4
  "description": "Refreshing CSS",
5
5
  "keywords": [],
6
6
  "repository": "https://github.com/csskit/csskit",
@@ -48,11 +48,11 @@
48
48
  "test:wasm": "node --test tests/bundle.test.js"
49
49
  },
50
50
  "optionalDependencies": {
51
- "csskit-darwin-arm64": "0.0.37",
52
- "csskit-darwin-x64": "0.0.37",
53
- "csskit-linux-arm64": "0.0.37",
54
- "csskit-linux-x64": "0.0.37",
55
- "csskit-win32-arm64": "0.0.37",
56
- "csskit-win32-x64": "0.0.37"
51
+ "csskit-darwin-arm64": "0.0.38-canary.0b5d777df3",
52
+ "csskit-darwin-x64": "0.0.38-canary.0b5d777df3",
53
+ "csskit-linux-arm64": "0.0.38-canary.0b5d777df3",
54
+ "csskit-linux-x64": "0.0.38-canary.0b5d777df3",
55
+ "csskit-win32-arm64": "0.0.38-canary.0b5d777df3",
56
+ "csskit-win32-x64": "0.0.38-canary.0b5d777df3"
57
57
  }
58
58
  }