@typedcss/unplugin 22.0.1 → 22.0.3
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/package.json +4 -4
- package/README.md +0 -204
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typedcss/unplugin",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.3",
|
|
4
4
|
"description": "Universal TypedCSS plugin for various build tools",
|
|
5
5
|
"author": "Refirst 11",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/zss-labs/typedcss/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
-
"
|
|
17
|
+
"typedcss",
|
|
18
18
|
"css",
|
|
19
19
|
"unplugin",
|
|
20
20
|
"vite",
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
"@rollup/pluginutils": "^5.4.0",
|
|
95
95
|
"unplugin": "^3.0.0",
|
|
96
96
|
"zss-engine": "3.1.2",
|
|
97
|
-
"@typedcss/
|
|
98
|
-
"@typedcss/
|
|
97
|
+
"@typedcss/eslint-plugin": "22.0.3",
|
|
98
|
+
"@typedcss/oxide": "22.0.3"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"vite": "^8.0.13"
|
package/README.md
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# @plumeria/unplugin
|
|
2
|
-
|
|
3
|
-
This is a universal bundler plugin for Plumeria. Built on [unplugin](https://github.com/unjs/unplugin), it provides plugins for all major frontend build tools from a single codebase.
|
|
4
|
-
|
|
5
|
-
It completely eliminates runtime overhead by parsing Plumeria's Zero-Runtime CSS-in-JS at build time and extracting it as a virtual CSS module.
|
|
6
|
-
|
|
7
|
-
## Compatible Bundlers
|
|
8
|
-
|
|
9
|
-
- [Vite](https://vitejs.dev/)
|
|
10
|
-
- [Webpack](https://webpack.js.org/)
|
|
11
|
-
- [Rspack](https://www.rspack.dev/)
|
|
12
|
-
- [Farm](https://farmfe.org/)
|
|
13
|
-
- [Esbuild](https://esbuild.github.io/)
|
|
14
|
-
- [Rollup](https://rollupjs.org/)
|
|
15
|
-
- [Rolldown](https://rolldown.rs/)
|
|
16
|
-
- [Bun](https://bun.sh/)
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install -D @plumeria/unplugin
|
|
22
|
-
# or
|
|
23
|
-
yarn add -D @plumeria/unplugin
|
|
24
|
-
# or
|
|
25
|
-
pnpm add -D @plumeria/unplugin
|
|
26
|
-
# Alternatively,
|
|
27
|
-
bun add -D @plumeria/unplugin
|
|
28
|
-
```
|
|
29
|
-
## How to Use
|
|
30
|
-
|
|
31
|
-
Import `@plumeria/unplugin` in the configuration file of each bundler, and register it as a plugin by calling the bundler-specific method (`vite()`, `webpack()`, etc.).
|
|
32
|
-
|
|
33
|
-
### Vite
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
//vite.config.js
|
|
37
|
-
import { defineConfig } from 'vite';
|
|
38
|
-
import plumeria from '@plumeria/unplugin';
|
|
39
|
-
|
|
40
|
-
export default defineConfig({
|
|
41
|
-
plugins: [
|
|
42
|
-
plumeria.vite(),
|
|
43
|
-
],
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Webpack
|
|
48
|
-
|
|
49
|
-
```js
|
|
50
|
-
// webpack.config.js
|
|
51
|
-
import plumeria from '@plumeria/unplugin';
|
|
52
|
-
|
|
53
|
-
export default {
|
|
54
|
-
plugins: [
|
|
55
|
-
plumeria.webpack(),
|
|
56
|
-
],
|
|
57
|
-
};
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Rspack
|
|
61
|
-
|
|
62
|
-
```js
|
|
63
|
-
// rspack.config.js
|
|
64
|
-
import plumeria from '@plumeria/unplugin';
|
|
65
|
-
|
|
66
|
-
export default {
|
|
67
|
-
plugins: [
|
|
68
|
-
plumeria.rspack(),
|
|
69
|
-
],
|
|
70
|
-
};
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Farm
|
|
74
|
-
|
|
75
|
-
```js
|
|
76
|
-
// farm.config.js
|
|
77
|
-
import { defineConfig } from '@farmfe/core';
|
|
78
|
-
import plumeria from '@plumeria/unplugin';
|
|
79
|
-
|
|
80
|
-
export default defineConfig({
|
|
81
|
-
plugins: [
|
|
82
|
-
plumeria.farm({ devEmitToDisk: true }),
|
|
83
|
-
],
|
|
84
|
-
});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Esbuild
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
// build.js
|
|
91
|
-
import { build } from 'esbuild';
|
|
92
|
-
import plumeria from '@plumeria/unplugin';
|
|
93
|
-
|
|
94
|
-
build({
|
|
95
|
-
entryPoints: ['src/index.tsx'],
|
|
96
|
-
bundle: true,
|
|
97
|
-
outfile: 'dist/out.js',
|
|
98
|
-
plugins: [
|
|
99
|
-
plumeria.esbuild(),
|
|
100
|
-
],
|
|
101
|
-
}).catch(() => process.exit(1));
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Rollup
|
|
105
|
-
```js
|
|
106
|
-
// rollup.config.js
|
|
107
|
-
import plumeria from '@plumeria/unplugin';
|
|
108
|
-
export default {
|
|
109
|
-
input: 'src/index.tsx',
|
|
110
|
-
plugins: [
|
|
111
|
-
plumeria.rollup(),
|
|
112
|
-
],
|
|
113
|
-
};
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
### Rolldown
|
|
117
|
-
```js
|
|
118
|
-
// rolldown.config.js
|
|
119
|
-
import plumeria from '@plumeria/unplugin';
|
|
120
|
-
export default {
|
|
121
|
-
input: 'src/index.tsx',
|
|
122
|
-
plugins: [
|
|
123
|
-
plumeria.rolldown(),
|
|
124
|
-
],
|
|
125
|
-
};
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### Bun
|
|
129
|
-
```js
|
|
130
|
-
// build.js
|
|
131
|
-
import plumeria from '@plumeria/unplugin';
|
|
132
|
-
await Bun.build({
|
|
133
|
-
entrypoints: ['./src/index.tsx'],
|
|
134
|
-
outdir: './dist',
|
|
135
|
-
plugins: [
|
|
136
|
-
plumeria.bun(),
|
|
137
|
-
],
|
|
138
|
-
});
|
|
139
|
-
```
|
|
140
|
-
## Options
|
|
141
|
-
|
|
142
|
-
You can control the files to be converted by passing options when calling the plugin. By default `ts/tsx/js/jsx` is targeted.
|
|
143
|
-
|
|
144
|
-
```js
|
|
145
|
-
plumeria.vite({
|
|
146
|
-
include: ['**/*.{ts,tsx}'],
|
|
147
|
-
exclude: ['**/node_modules/**'],
|
|
148
|
-
devEmitToDisk: false,
|
|
149
|
-
styleProp: 'sx',
|
|
150
|
-
});
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
| Option | Default | Description |
|
|
154
|
-
| :-- | :-- | :-- |
|
|
155
|
-
| `include` | `ts/tsx/js/jsx` | Files to transform. |
|
|
156
|
-
| `exclude` | — | Files to skip. |
|
|
157
|
-
| `devEmitToDisk` | `false` | Write CSS to disk in development so the bundler's watcher drives HMR. |
|
|
158
|
-
| `styleProp` | `'classStyle'` | The JSX prop that carries styles. |
|
|
159
|
-
| `withoutLogicalProperties` | `false` | Reject the logical name of a property that also has a physical name. Takes `true` or `{ sizes?: boolean }`. |
|
|
160
|
-
| `withoutPhysicalProperties` | `false` | Reject the physical name of a property that also has a logical name. Takes `true` or `{ sizes?: boolean }`. |
|
|
161
|
-
| `lint` | `true` | Lint with `@plumeria/eslint-plugin` during a production build, integrated into the build so it needs no setup. Every bundler except esbuild and Bun. `false` builds without it. |
|
|
162
|
-
|
|
163
|
-
The two spelling options contradict each other, so enabling both is a configuration error. See [the docs](https://plumeria.dev/docs/api-reference/plugins/unplugin) for why the pair has to be settled and how it lines up with the lint rules.
|
|
164
|
-
|
|
165
|
-
### styleProp
|
|
166
|
-
|
|
167
|
-
Renaming the prop takes two steps, and they have to agree. Tell the plugin:
|
|
168
|
-
|
|
169
|
-
```js
|
|
170
|
-
plumeria.vite({ styleProp: 'sx' });
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
and declare the same name for TypeScript. `@plumeria/core` ships no prop declaration of its own, so add one file to your project:
|
|
174
|
-
|
|
175
|
-
```ts
|
|
176
|
-
// plumeria.d.ts
|
|
177
|
-
import type { Style } from '@plumeria/core';
|
|
178
|
-
|
|
179
|
-
declare global {
|
|
180
|
-
namespace React {
|
|
181
|
-
interface HTMLAttributes<T> {
|
|
182
|
-
sx?: Style
|
|
183
|
-
}
|
|
184
|
-
interface SVGAttributes<T> {
|
|
185
|
-
sx?: Style
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
For the default name, reference the declaration that ships with the package instead:
|
|
192
|
-
|
|
193
|
-
```ts
|
|
194
|
-
// plumeria.d.ts
|
|
195
|
-
/// <reference types="@plumeria/core/class-style" />
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
If the two disagree, the prop type-checks but is never compiled away. [`@plumeria/eslint-plugin`](https://www.npmjs.com/package/@plumeria/eslint-plugin) reads the same name from `settings.plumeria.styleProp`.
|
|
199
|
-
|
|
200
|
-
## Development Mode and HMR (Hot Module Replacement)
|
|
201
|
-
|
|
202
|
-
`@plumeria/unplugin` provides HMR optimized for each bundler in development mode (dev server).
|
|
203
|
-
|
|
204
|
-
- **Vite / Farm / Webpack / Rspack**: The plugin extracts styles as CSS modules, enabling seamless updates via hot reloading.
|