classix 2.0.1 → 2.1.2

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
@@ -1,5 +1,9 @@
1
1
  # classix
2
2
 
3
+ ![Build](https://img.shields.io/github/workflow/status/alexnault/classix/ci-and-publish?style=flat-square)
4
+ ![NPM version](https://img.shields.io/npm/v/classix?style=flat-square)
5
+ ![Size](https://img.shields.io/bundlephobia/minzip/classix?&style=flat-square)
6
+
3
7
  The [fastest](#comparison) and [tiniest](#comparison) utility for conditionally joining classNames.
4
8
 
5
9
  ## Installation
@@ -56,7 +60,7 @@ Sources: [classix](https://bundlephobia.com/package/classix), [clsx](https://bun
56
60
 
57
61
  Sources: Ran [benchmark](benchmark/) on an AMD Ryzen 5 5600x.
58
62
 
59
- Compared to other librairies, classix simplifies its API by forbidding object arguments, which it considers less ergonomic than string expressions:
63
+ Compared to other libraries, classix simplifies its API by omitting the use of object arguments, which it considers less ergonomic than string expressions:
60
64
 
61
65
  ```js
62
66
  // 🚫
@@ -0,0 +1,13 @@
1
+ function cx() {
2
+ let str = "", i = 0, arg;
3
+ while (i < arguments.length) {
4
+ if ((arg = arguments[i++]) && typeof arg === "string") {
5
+ str && (str += " ");
6
+ str += arg;
7
+ }
8
+ }
9
+ return str;
10
+ }
11
+
12
+ exports.cx = cx;
13
+ exports["default"] = cx;
@@ -5,5 +5,5 @@ declare type Argument = string | boolean | null | undefined;
5
5
  * @returns {String} The joined classNames
6
6
  */
7
7
  declare function cx(...args: Argument[]): string;
8
- export { cx };
9
- export default cx;
8
+
9
+ export { cx, cx as default };
@@ -0,0 +1,12 @@
1
+ function cx() {
2
+ let str = "", i = 0, arg;
3
+ while (i < arguments.length) {
4
+ if ((arg = arguments[i++]) && typeof arg === "string") {
5
+ str && (str += " ");
6
+ str += arg;
7
+ }
8
+ }
9
+ return str;
10
+ }
11
+
12
+ export { cx, cx as default };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "classix",
3
- "version": "2.0.1",
3
+ "version": "2.1.2",
4
4
  "description": "The fastest and tiniest utility for conditionally joining classNames.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/classix.cjs.js",
6
+ "module": "dist/classix.mjs.js",
7
+ "types": "dist/classix.d.ts",
7
8
  "author": "Alex Nault",
8
9
  "keywords": [
9
10
  "class",
@@ -19,7 +20,7 @@
19
20
  "homepage": "https://github.com/alexnault/classix#readme",
20
21
  "scripts": {
21
22
  "bench": "node benchmark",
22
- "build": "rm -rf ./dist && tsc",
23
+ "build": "rm -rf ./dist && rollup -c",
23
24
  "format": "prettier --write \"{src,benchmark}/**/*.{js,ts}\"",
24
25
  "lint": "eslint src/ --max-warnings=0",
25
26
  "test": "jest"
@@ -35,10 +36,14 @@
35
36
  "classnames": "^2.3.1",
36
37
  "clsx": "^1.2.1",
37
38
  "conventional-changelog-conventionalcommits": "^4.6.3",
39
+ "esbuild": "^0.14.49",
38
40
  "eslint": "^8.19.0",
39
41
  "eslint-config-prettier": "^8.5.0",
40
42
  "jest": "^28.0.0",
41
43
  "prettier": "^2.7.1",
44
+ "rollup": "^2.77.0",
45
+ "rollup-plugin-dts": "^4.2.2",
46
+ "rollup-plugin-esbuild": "^4.9.1",
42
47
  "semantic-release": "^19.0.3",
43
48
  "ts-jest": "^28.0.0",
44
49
  "typescript": "^4.7.4"
package/dist/index.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cx = void 0;
4
- function cx() {
5
- var str = "", i = 0, arg;
6
- while (i < arguments.length) {
7
- if ((arg = arguments[i++]) && typeof arg === "string") {
8
- str && (str += " ");
9
- str += arg;
10
- }
11
- }
12
- return str;
13
- }
14
- exports.cx = cx;
15
- exports.default = cx;