@pikacss/unplugin-pikacss 0.0.40 → 0.0.41
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/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.mts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.mts +1 -1
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.mts +1 -1
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +1 -1
- package/package.json +4 -15
- package/README.md +0 -305
- package/dist/farm.cjs +0 -15
- package/dist/farm.d.cts +0 -8
- package/dist/farm.d.mts +0 -8
- package/dist/farm.mjs +0 -10
- /package/dist/{types-BHUcssZN.d.cts → types-BRfLr7ch.d.mts} +0 -0
- /package/dist/{types-Df8aMUxe.d.mts → types-CtaD-Nki.d.cts} +0 -0
package/dist/esbuild.d.cts
CHANGED
package/dist/esbuild.d.mts
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-
|
|
1
|
+
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CtaD-Nki.cjs";
|
|
2
2
|
import * as unplugin0 from "unplugin";
|
|
3
3
|
import { UnpluginFactory } from "unplugin";
|
|
4
4
|
export * from "@pikacss/integration";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-
|
|
1
|
+
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-BRfLr7ch.mjs";
|
|
2
2
|
import * as unplugin0 from "unplugin";
|
|
3
3
|
import { UnpluginFactory } from "unplugin";
|
|
4
4
|
export * from "@pikacss/integration";
|
package/dist/rolldown.d.cts
CHANGED
package/dist/rolldown.d.mts
CHANGED
package/dist/rollup.d.cts
CHANGED
package/dist/rollup.d.mts
CHANGED
package/dist/rspack.d.cts
CHANGED
package/dist/rspack.d.mts
CHANGED
package/dist/vite.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-
|
|
1
|
+
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CtaD-Nki.cjs";
|
|
2
2
|
import "./index.cjs";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
export * from "@pikacss/integration";
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-
|
|
1
|
+
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-BRfLr7ch.mjs";
|
|
2
2
|
import "./index.mjs";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
4
|
export * from "@pikacss/integration";
|
package/dist/webpack.d.cts
CHANGED
package/dist/webpack.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikacss/unplugin-pikacss",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.41",
|
|
5
5
|
"author": "DevilTea <ch19980814@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/pikacss/pikacss.
|
|
9
|
+
"url": "https://github.com/pikacss/pikacss.git",
|
|
10
10
|
"directory": "packages/unplugin"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
|
-
"url": "https://github.com/pikacss/pikacss
|
|
13
|
+
"url": "https://github.com/pikacss/pikacss/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"pikacss",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"webpack-plugin",
|
|
24
24
|
"esbuild-plugin",
|
|
25
25
|
"rspack-plugin",
|
|
26
|
-
"farm-plugin",
|
|
27
26
|
"rolldown-plugin"
|
|
28
27
|
],
|
|
29
28
|
"exports": {
|
|
@@ -87,16 +86,6 @@
|
|
|
87
86
|
"default": "./dist/rspack.cjs"
|
|
88
87
|
}
|
|
89
88
|
},
|
|
90
|
-
"./farm": {
|
|
91
|
-
"import": {
|
|
92
|
-
"types": "./dist/farm.d.mts",
|
|
93
|
-
"default": "./dist/farm.mjs"
|
|
94
|
-
},
|
|
95
|
-
"require": {
|
|
96
|
-
"types": "./dist/farm.d.cts",
|
|
97
|
-
"default": "./dist/farm.cjs"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
89
|
"./rolldown": {
|
|
101
90
|
"import": {
|
|
102
91
|
"types": "./dist/rolldown.d.mts",
|
|
@@ -129,7 +118,7 @@
|
|
|
129
118
|
"pathe": "^2.0.3",
|
|
130
119
|
"perfect-debounce": "^2.0.0",
|
|
131
120
|
"unplugin": "^2.3.11",
|
|
132
|
-
"@pikacss/integration": "0.0.
|
|
121
|
+
"@pikacss/integration": "0.0.41"
|
|
133
122
|
},
|
|
134
123
|
"devDependencies": {
|
|
135
124
|
"@farmfe/core": "^1.7.11",
|
package/README.md
DELETED
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
<!-- eslint-disable -->
|
|
2
|
-
# @pikacss/unplugin-pikacss
|
|
3
|
-
|
|
4
|
-
Universal plugin for PikaCSS that works with multiple bundlers.
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
pnpm add @pikacss/unplugin-pikacss
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Usage
|
|
13
|
-
|
|
14
|
-
### Vite
|
|
15
|
-
|
|
16
|
-
For full Vite support with hot reloading and build optimizations, use the Vite-specific export:
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
// vite.config.ts
|
|
20
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/vite'
|
|
21
|
-
|
|
22
|
-
export default {
|
|
23
|
-
plugins: [
|
|
24
|
-
PikaCSSPlugin({
|
|
25
|
-
// options
|
|
26
|
-
}),
|
|
27
|
-
],
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Rollup
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
// rollup.config.js
|
|
35
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/rollup'
|
|
36
|
-
|
|
37
|
-
export default {
|
|
38
|
-
plugins: [
|
|
39
|
-
PikaCSSPlugin({
|
|
40
|
-
// options
|
|
41
|
-
}),
|
|
42
|
-
],
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Webpack
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
// webpack.config.js
|
|
50
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/webpack'
|
|
51
|
-
|
|
52
|
-
export default {
|
|
53
|
-
plugins: [
|
|
54
|
-
PikaCSSPlugin({
|
|
55
|
-
// options
|
|
56
|
-
}),
|
|
57
|
-
],
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### esbuild
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
// esbuild.config.js
|
|
65
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/esbuild'
|
|
66
|
-
import esbuild from 'esbuild'
|
|
67
|
-
|
|
68
|
-
esbuild.build({
|
|
69
|
-
plugins: [
|
|
70
|
-
PikaCSSPlugin({
|
|
71
|
-
// options
|
|
72
|
-
}),
|
|
73
|
-
],
|
|
74
|
-
})
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### Rspack
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
// rspack.config.js
|
|
81
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/rspack'
|
|
82
|
-
|
|
83
|
-
export default {
|
|
84
|
-
plugins: [
|
|
85
|
-
PikaCSSPlugin({
|
|
86
|
-
// options
|
|
87
|
-
}),
|
|
88
|
-
],
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Farm
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
// farm.config.ts
|
|
96
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/farm'
|
|
97
|
-
|
|
98
|
-
export default {
|
|
99
|
-
plugins: [
|
|
100
|
-
PikaCSSPlugin({
|
|
101
|
-
// options
|
|
102
|
-
}),
|
|
103
|
-
],
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Rolldown
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
// rolldown.config.js
|
|
111
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/rolldown'
|
|
112
|
-
|
|
113
|
-
export default {
|
|
114
|
-
plugins: [
|
|
115
|
-
PikaCSSPlugin({
|
|
116
|
-
// options
|
|
117
|
-
}),
|
|
118
|
-
],
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Plugin Options
|
|
123
|
-
|
|
124
|
-
The plugin accepts a `PluginOptions` object with the following properties:
|
|
125
|
-
|
|
126
|
-
```ts
|
|
127
|
-
interface PluginOptions {
|
|
128
|
-
/**
|
|
129
|
-
* File patterns to scan for pika() function calls.
|
|
130
|
-
* @default { include: ['**\/*.{js,ts,jsx,tsx,vue}'], exclude: ['node_modules/**', 'dist/**'] }
|
|
131
|
-
*/
|
|
132
|
-
scan?: {
|
|
133
|
-
include?: string | string[]
|
|
134
|
-
exclude?: string | string[]
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* PikaCSS engine configuration object or path to config file.
|
|
139
|
-
* Pass an EngineConfig object for inline configuration or a string path.
|
|
140
|
-
* @default undefined
|
|
141
|
-
*/
|
|
142
|
-
config?: EngineConfig | string
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Automatically create config file when needed.
|
|
146
|
-
* @default true
|
|
147
|
-
*/
|
|
148
|
-
autoCreateConfig?: boolean
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Name of the style function to detect in source code.
|
|
152
|
-
* @default 'pika'
|
|
153
|
-
*/
|
|
154
|
-
fnName?: string
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Format of generated class names after transformation.
|
|
158
|
-
* - 'string': Space-separated class names
|
|
159
|
-
* - 'array': Array of class names
|
|
160
|
-
* - 'inline': Object format for direct style binding
|
|
161
|
-
* @default 'string'
|
|
162
|
-
*/
|
|
163
|
-
transformedFormat?: 'string' | 'array' | 'inline'
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* TypeScript type definitions generation.
|
|
167
|
-
* - true: Generate as 'pika.gen.ts'
|
|
168
|
-
* - string: Generate at specified path
|
|
169
|
-
* - false: Disable generation
|
|
170
|
-
* @default true
|
|
171
|
-
*/
|
|
172
|
-
tsCodegen?: boolean | string
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* CSS output file generation.
|
|
176
|
-
* - true: Generate as 'pika.gen.css'
|
|
177
|
-
* - string: Generate at specified path
|
|
178
|
-
* Note: Cannot be disabled (always generates CSS)
|
|
179
|
-
* @default true
|
|
180
|
-
*/
|
|
181
|
-
cssCodegen?: true | string
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
> **Note:** This plugin re-exports all APIs from `@pikacss/integration` package. For advanced customization (e.g., creating custom bundler plugins), refer to the [@pikacss/integration documentation](../integration/README.md).
|
|
186
|
-
|
|
187
|
-
## Setup Steps
|
|
188
|
-
|
|
189
|
-
### 1. Install and Configure Plugin
|
|
190
|
-
|
|
191
|
-
Add the plugin to your build tool configuration (see examples above).
|
|
192
|
-
|
|
193
|
-
### 2. Create Config File
|
|
194
|
-
|
|
195
|
-
Create `pika.config.ts` in your project root:
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
import { defineEngineConfig } from '@pikacss/core'
|
|
199
|
-
|
|
200
|
-
export default defineEngineConfig({
|
|
201
|
-
// Your PikaCSS configuration
|
|
202
|
-
plugins: []
|
|
203
|
-
})
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### 3. Import Virtual CSS Module
|
|
207
|
-
|
|
208
|
-
In your application entry file:
|
|
209
|
-
|
|
210
|
-
```ts
|
|
211
|
-
import 'pika.css'
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### 4. Use in Your Code
|
|
215
|
-
|
|
216
|
-
```ts
|
|
217
|
-
// Direct style object
|
|
218
|
-
const classes = pika({
|
|
219
|
-
display: 'flex',
|
|
220
|
-
alignItems: 'center',
|
|
221
|
-
gap: '1rem'
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
// Using shortcuts
|
|
225
|
-
const centered = pika('flex-center')
|
|
226
|
-
|
|
227
|
-
// Combining shortcuts with styles
|
|
228
|
-
const styled = pika('flex-center', { color: 'blue' })
|
|
229
|
-
|
|
230
|
-
// Multiple shortcuts
|
|
231
|
-
const multi = pika('btn', 'shadow', { margin: '1rem' })
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Migration from @pikacss/vite-plugin-pikacss
|
|
235
|
-
|
|
236
|
-
If you were using `@pikacss/vite-plugin-pikacss`, you can migrate to `@pikacss/unplugin-pikacss/vite`:
|
|
237
|
-
|
|
238
|
-
```diff
|
|
239
|
-
- import PikaCSSPlugin from '@pikacss/vite-plugin-pikacss'
|
|
240
|
-
+ import PikaCSSPlugin from '@pikacss/unplugin-pikacss/vite'
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
The API is fully compatible.
|
|
244
|
-
|
|
245
|
-
## API Reference
|
|
246
|
-
|
|
247
|
-
### Plugin Factory
|
|
248
|
-
|
|
249
|
-
Each bundler-specific export provides a default plugin factory function:
|
|
250
|
-
|
|
251
|
-
```ts
|
|
252
|
-
// All bundler exports follow this pattern
|
|
253
|
-
import PikaCSSPlugin from '@pikacss/unplugin-pikacss/{bundler}'
|
|
254
|
-
|
|
255
|
-
// Returns bundler-specific plugin instance
|
|
256
|
-
const plugin = PikaCSSPlugin(options)
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
**Supported bundler exports:**
|
|
260
|
-
- `@pikacss/unplugin-pikacss/vite` - Vite plugin
|
|
261
|
-
- `@pikacss/unplugin-pikacss/rollup` - Rollup plugin
|
|
262
|
-
- `@pikacss/unplugin-pikacss/webpack` - Webpack plugin
|
|
263
|
-
- `@pikacss/unplugin-pikacss/rspack` - Rspack plugin
|
|
264
|
-
- `@pikacss/unplugin-pikacss/esbuild` - esbuild plugin
|
|
265
|
-
- `@pikacss/unplugin-pikacss/farm` - Farm plugin
|
|
266
|
-
- `@pikacss/unplugin-pikacss/rolldown` - Rolldown plugin
|
|
267
|
-
|
|
268
|
-
### Type Exports
|
|
269
|
-
|
|
270
|
-
All bundler exports re-export types from `@pikacss/integration`:
|
|
271
|
-
|
|
272
|
-
```ts
|
|
273
|
-
import type { PluginOptions, ResolvedPluginOptions } from '@pikacss/unplugin-pikacss/vite'
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Integration Layer Re-exports
|
|
277
|
-
|
|
278
|
-
This package re-exports the entire `@pikacss/integration` API for advanced use cases:
|
|
279
|
-
|
|
280
|
-
```ts
|
|
281
|
-
import { createCtx, IntegrationContext } from '@pikacss/unplugin-pikacss'
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
For details on these APIs, see the [@pikacss/integration documentation](../integration/README.md).
|
|
285
|
-
|
|
286
|
-
### Virtual Module
|
|
287
|
-
|
|
288
|
-
The plugin provides a virtual CSS module that can be imported in your application:
|
|
289
|
-
|
|
290
|
-
```ts
|
|
291
|
-
import 'pika.css'
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
This virtual module resolves to the generated CSS file (`pika.gen.css` by default).
|
|
295
|
-
|
|
296
|
-
## How It Works
|
|
297
|
-
|
|
298
|
-
1. **Scan Phase**: Plugin scans source files matching `scan.include` patterns
|
|
299
|
-
2. **Detection**: Identifies `pika()` function calls (or custom `fnName`)
|
|
300
|
-
3. **Build-time Evaluation**: Evaluates style arguments at build time using `new Function()`
|
|
301
|
-
4. **Transformation**: Replaces function calls with generated class names
|
|
302
|
-
5. **CSS Generation**: Outputs atomic styles to `pika.gen.css`
|
|
303
|
-
6. **Type Generation**: Outputs TypeScript definitions to `pika.gen.ts`
|
|
304
|
-
|
|
305
|
-
The plugin integrates with bundler's hot module reload (HMR) to update styles during development.
|
package/dist/farm.cjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const require_src = require('./src-BsRreiwW.cjs');
|
|
2
|
-
let unplugin = require("unplugin");
|
|
3
|
-
|
|
4
|
-
//#region src/farm.ts
|
|
5
|
-
var farm_default = (0, unplugin.createFarmPlugin)(require_src.unpluginFactory);
|
|
6
|
-
|
|
7
|
-
//#endregion
|
|
8
|
-
module.exports = farm_default;
|
|
9
|
-
var _pikacss_integration = require("@pikacss/integration");
|
|
10
|
-
Object.keys(_pikacss_integration).forEach(function (k) {
|
|
11
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function () { return _pikacss_integration[k]; }
|
|
14
|
-
});
|
|
15
|
-
});
|
package/dist/farm.d.cts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-BHUcssZN.cjs";
|
|
2
|
-
import { JsPlugin } from "@farmfe/core";
|
|
3
|
-
export * from "@pikacss/integration";
|
|
4
|
-
|
|
5
|
-
//#region src/farm.d.ts
|
|
6
|
-
declare const _default: (options?: PluginOptions | undefined) => JsPlugin;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { PluginOptions, ResolvedPluginOptions, _default as default };
|
package/dist/farm.d.mts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-Df8aMUxe.mjs";
|
|
2
|
-
import { JsPlugin } from "@farmfe/core";
|
|
3
|
-
export * from "@pikacss/integration";
|
|
4
|
-
|
|
5
|
-
//#region src/farm.d.ts
|
|
6
|
-
declare const _default: (options?: PluginOptions | undefined) => JsPlugin;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { PluginOptions, ResolvedPluginOptions, _default as default };
|
package/dist/farm.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { unpluginFactory } from "./index.mjs";
|
|
2
|
-
import { createFarmPlugin } from "unplugin";
|
|
3
|
-
|
|
4
|
-
export * from "@pikacss/integration"
|
|
5
|
-
|
|
6
|
-
//#region src/farm.ts
|
|
7
|
-
var farm_default = createFarmPlugin(unpluginFactory);
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { farm_default as default };
|
|
File without changes
|
|
File without changes
|