@csszyx/unplugin 0.1.0 → 0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -21
  3. package/package.json +15 -15
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 csszyx contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,52 +1,76 @@
1
1
  # @csszyx/unplugin
2
2
 
3
- > Vite, Webpack, and Rollup integration for csszyx.
3
+ > Vite, Webpack, and esbuild integration for csszyx.
4
4
 
5
- This package provides the build-time transformations needed to make csszyx work. It handles:
6
-
7
- - 🔍 Extracting styles from your code.
8
- - 🎨 Generating static CSS.
9
- - 🧩 Mangling class names for production.
10
- - ⚡ Injecting hydration scripts.
5
+ Build-time plugin that transforms `sz` props into Tailwind classes, generates static CSS, mangles class names in production, and injects hydration scripts for SSR.
11
6
 
12
7
  ## Installation
13
8
 
14
9
  ```bash
15
- npm install -D @csszyx/unplugin
10
+ pnpm add -D @csszyx/unplugin
16
11
  ```
17
12
 
18
- ## Usage
13
+ Or install the umbrella package which includes this:
14
+
15
+ ```bash
16
+ pnpm add csszyx
17
+ ```
19
18
 
20
- ### Vite
19
+ ## Vite
21
20
 
22
21
  ```ts
23
22
  // vite.config.ts
24
23
  import { defineConfig } from "vite";
25
- import csszyx from "@csszyx/unplugin/vite";
24
+ import tailwindcss from "@tailwindcss/vite";
25
+ import react from "@vitejs/plugin-react";
26
+ import csszyx from "csszyx/vite";
26
27
 
27
28
  export default defineConfig({
28
- plugins: [csszyx()],
29
+ plugins: [...csszyx(), tailwindcss(), react()],
29
30
  });
30
31
  ```
31
32
 
32
- ### Webpack
33
+ The direct import also works:
34
+
35
+ ```ts
36
+ import csszyx from "@csszyx/unplugin/vite";
37
+ ```
38
+
39
+ ## Webpack (Next.js)
40
+
41
+ ```js
42
+ // next.config.js
43
+ const csszyx = require("@csszyx/unplugin/webpack").default;
44
+
45
+ /** @type {import('next').NextConfig} */
46
+ const nextConfig = {
47
+ webpack: (config) => {
48
+ config.plugins.push(...csszyx());
49
+ return config;
50
+ },
51
+ };
52
+
53
+ module.exports = nextConfig;
54
+ ```
55
+
56
+ ## Webpack (standalone)
33
57
 
34
58
  ```js
35
59
  // webpack.config.js
36
- import csszyx from "@csszyx/unplugin/webpack";
60
+ const csszyx = require("@csszyx/unplugin/webpack").default;
37
61
 
38
- export default {
39
- plugins: [csszyx()],
62
+ module.exports = {
63
+ plugins: [...csszyx()],
40
64
  };
41
65
  ```
42
66
 
43
67
  ## Features
44
68
 
45
- - **Universal Support**: Works with standard unplugin hooks.
46
- - **HTML Injection**: Automatically injects mangle maps and checksums.
47
- - **Hot Module Replacement**: Updates styles instantly in dev.
48
- - **CSS Mangling**: Compresses class names (e.g., `text-center` -> `a`) in production.
69
+ - **sz prop transform** -- Compiles `sz={{ }}` objects into `className` strings via Babel AST
70
+ - **HTML injection** -- Injects mangle maps and checksums for SSR hydration
71
+ - **HMR support** -- Updates styles instantly during development
72
+ - **CSS mangling** -- Compresses class names (e.g., `text-center` -> `z`) in production builds
49
73
 
50
74
  ## License
51
75
 
52
- MIT © [csszyx contributors](https://github.com/nguyennhutien/csszyx)
76
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/unplugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Vite and Webpack integration for csszyx",
5
5
  "keywords": [
6
6
  "csszyx",
@@ -51,22 +51,15 @@
51
51
  "files": [
52
52
  "dist"
53
53
  ],
54
- "scripts": {
55
- "build": "tsup src/index.ts src/vite.ts src/webpack.ts src/css-mangler.ts --format esm,cjs --dts --clean",
56
- "dev": "tsup src/index.ts src/vite.ts src/webpack.ts src/css-mangler.ts --format esm --dts --watch",
57
- "lint": "eslint src",
58
- "test": "vitest run",
59
- "test:watch": "vitest"
60
- },
61
54
  "dependencies": {
62
- "@csszyx/compiler": "workspace:*",
63
- "@csszyx/core": "workspace:*",
64
- "@csszyx/svelte-adapter": "workspace:*",
65
- "@csszyx/types": "workspace:*",
66
- "@csszyx/vue-adapter": "workspace:*",
67
55
  "postcss": "^8.4.35",
68
56
  "postcss-selector-parser": "^6.0.15",
69
- "unplugin": "^1.10.1"
57
+ "unplugin": "^1.10.1",
58
+ "@csszyx/compiler": "0.1.2",
59
+ "@csszyx/core": "0.1.2",
60
+ "@csszyx/svelte-adapter": "0.0.0",
61
+ "@csszyx/types": "0.1.2",
62
+ "@csszyx/vue-adapter": "0.0.0"
70
63
  },
71
64
  "devDependencies": {
72
65
  "@types/node": "^20.11.0",
@@ -77,5 +70,12 @@
77
70
  "vite": "^7.3.1",
78
71
  "vitest": "^1.2.0",
79
72
  "webpack": "^5.104.1"
73
+ },
74
+ "scripts": {
75
+ "build": "tsup src/index.ts src/vite.ts src/webpack.ts src/css-mangler.ts --format esm,cjs --dts --clean",
76
+ "dev": "tsup src/index.ts src/vite.ts src/webpack.ts src/css-mangler.ts --format esm --dts --watch",
77
+ "lint": "eslint src",
78
+ "test": "vitest run",
79
+ "test:watch": "vitest"
80
80
  }
81
- }
81
+ }