@pikacss/unplugin-pikacss 0.0.47 → 0.0.49

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/rolldown.mjs CHANGED
@@ -1,10 +1,23 @@
1
1
  import { unpluginFactory } from "./index.mjs";
2
2
  import { createRolldownPlugin } from "unplugin";
3
-
4
- export * from "@pikacss/integration"
5
-
3
+ export * from "@pikacss/integration";
6
4
  //#region src/rolldown.ts
5
+ /**
6
+ * PikaCSS plugin factory for Rolldown.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into a Rolldown-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/rolldown'
15
+ *
16
+ * export default {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
7
21
  var rolldown_default = createRolldownPlugin(unpluginFactory);
8
-
9
22
  //#endregion
10
- export { rolldown_default as default };
23
+ export { rolldown_default as default };
package/dist/rollup.d.mts CHANGED
@@ -1,8 +1,24 @@
1
- import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CnxVmogs.mjs";
2
- import * as rollup from "rollup";
1
+ import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-237J7YdE.mjs";
2
+ import * as _$unplugin from "unplugin";
3
3
  export * from "@pikacss/integration";
4
4
 
5
5
  //#region src/rollup.d.ts
6
- declare const _default: (options?: PluginOptions | undefined) => rollup.Plugin<any> | rollup.Plugin<any>[];
6
+ /**
7
+ * PikaCSS plugin factory for Rollup.
8
+ *
9
+ * Wraps the shared PikaCSS unplugin factory into a Rollup-compatible
10
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
11
+ * code generation, and engine settings.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import pikacss from '@pikacss/unplugin-pikacss/rollup'
16
+ *
17
+ * export default {
18
+ * plugins: [pikacss()],
19
+ * }
20
+ * ```
21
+ */
22
+ declare const _default: (options?: PluginOptions | undefined) => _$unplugin.RollupPlugin<any> | _$unplugin.RollupPlugin<any>[];
7
23
  //#endregion
8
24
  export { PluginOptions, ResolvedPluginOptions, _default as default };
package/dist/rollup.mjs CHANGED
@@ -1,10 +1,23 @@
1
1
  import { unpluginFactory } from "./index.mjs";
2
2
  import { createRollupPlugin } from "unplugin";
3
-
4
- export * from "@pikacss/integration"
5
-
3
+ export * from "@pikacss/integration";
6
4
  //#region src/rollup.ts
5
+ /**
6
+ * PikaCSS plugin factory for Rollup.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into a Rollup-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/rollup'
15
+ *
16
+ * export default {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
7
21
  var rollup_default = createRollupPlugin(unpluginFactory);
8
-
9
22
  //#endregion
10
- export { rollup_default as default };
23
+ export { rollup_default as default };
package/dist/rspack.d.mts CHANGED
@@ -1,7 +1,23 @@
1
- import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CnxVmogs.mjs";
1
+ import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-237J7YdE.mjs";
2
2
  export * from "@pikacss/integration";
3
3
 
4
4
  //#region src/rspack.d.ts
5
+ /**
6
+ * PikaCSS plugin factory for Rspack.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into an Rspack-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/rspack'
15
+ *
16
+ * module.exports = {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
5
21
  declare const _default: (options?: PluginOptions | undefined) => RspackPluginInstance;
6
22
  //#endregion
7
23
  export { PluginOptions, ResolvedPluginOptions, _default as default };
package/dist/rspack.mjs CHANGED
@@ -1,10 +1,23 @@
1
1
  import { unpluginFactory } from "./index.mjs";
2
2
  import { createRspackPlugin } from "unplugin";
3
-
4
- export * from "@pikacss/integration"
5
-
3
+ export * from "@pikacss/integration";
6
4
  //#region src/rspack.ts
5
+ /**
6
+ * PikaCSS plugin factory for Rspack.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into an Rspack-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/rspack'
15
+ *
16
+ * module.exports = {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
7
21
  var rspack_default = createRspackPlugin(unpluginFactory);
8
-
9
22
  //#endregion
10
- export { rspack_default as default };
23
+ export { rspack_default as default };
@@ -0,0 +1,130 @@
1
+ import { EngineConfig, IntegrationContextOptions, Nullish } from "@pikacss/integration";
2
+
3
+ //#region src/types.d.ts
4
+ /**
5
+ * User-facing configuration options for the PikaCSS bundler plugin.
6
+ *
7
+ * @remarks
8
+ * Passed to the unplugin factory when creating a Vite, webpack, Rollup, or esbuild plugin.
9
+ * All properties are optional — sensible defaults are applied for zero-config setups.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import pika from '@pikacss/unplugin-pikacss/vite'
14
+ *
15
+ * export default defineConfig({
16
+ * plugins: [
17
+ * pika({
18
+ * config: './pika.config.ts',
19
+ * fnName: 'css',
20
+ * transformedFormat: 'array',
21
+ * }),
22
+ * ],
23
+ * })
24
+ * ```
25
+ */
26
+ interface PluginOptions {
27
+ /**
28
+ * Explicit working directory for resolving config files, codegen output paths, and source
29
+ * scanning globs. When set, overrides the bundler-detected project root.
30
+ *
31
+ * @remarks
32
+ * Resolution priority: `cwd` option → bundler root (e.g., Vite `root`, webpack `context`) → `process.cwd()`.
33
+ *
34
+ * @default `undefined` (use bundler-detected root)
35
+ */
36
+ cwd?: string;
37
+ /**
38
+ * Glob patterns controlling which source files are scanned for `pika()` calls.
39
+ *
40
+ * @default `{ include: ['**\/*.{js,ts,jsx,tsx,vue}'], exclude: ['node_modules/**', 'dist/**'] }`
41
+ */
42
+ scan?: {
43
+ /**
44
+ * File glob patterns to scan. Supports a single string or array of strings.
45
+ * @default ['**\/*.{js,ts,jsx,tsx,vue}']
46
+ */
47
+ include?: string | string[];
48
+ /**
49
+ * File glob patterns to exclude. Supports a single string or array of strings.
50
+ * @default ['node_modules/**', 'dist/**']
51
+ */
52
+ exclude?: string | string[];
53
+ };
54
+ /**
55
+ * Engine configuration object or a path to a `pika.config.*` file. When omitted, the plugin
56
+ * auto-discovers a config file in the project root.
57
+ *
58
+ * @default `undefined` (auto-discover)
59
+ */
60
+ config?: EngineConfig | string;
61
+ /**
62
+ * When `true`, automatically scaffolds a default `pika.config.js` file if no existing config is found.
63
+ *
64
+ * @default `true`
65
+ */
66
+ autoCreateConfig?: boolean;
67
+ /**
68
+ * Base function name to recognize in source code. All variants (`.str`, `.arr`, preview) are
69
+ * derived from this name.
70
+ *
71
+ * @default `'pika'`
72
+ */
73
+ fnName?: string;
74
+ /**
75
+ * Default output format for normal `pika()` calls. `'string'` produces a space-joined class string;
76
+ * `'array'` produces a string array of class names.
77
+ *
78
+ * @default `'string'`
79
+ */
80
+ transformedFormat?: 'string' | 'array';
81
+ /**
82
+ * Controls TypeScript declaration codegen. `true` writes to `'pika.gen.ts'`, a string sets a custom
83
+ * output path, and `false` disables codegen entirely.
84
+ *
85
+ * @default `true`
86
+ */
87
+ tsCodegen?: boolean | string;
88
+ /**
89
+ * Controls CSS output file generation. `true` writes to `'pika.gen.css'`; a string sets a custom
90
+ * output path.
91
+ *
92
+ * @default `true`
93
+ */
94
+ cssCodegen?: true | string;
95
+ /**
96
+ * npm package name of the plugin consumer, embedded in generated file headers and import paths.
97
+ * Override when wrapping the unplugin in a framework-specific package (e.g., `@pikacss/nuxt`).
98
+ *
99
+ * @default `'@pikacss/unplugin-pikacss'`
100
+ */
101
+ currentPackageName?: string;
102
+ }
103
+ /**
104
+ * Normalized plugin configuration with all defaults applied and boolean shorthands expanded.
105
+ *
106
+ * @remarks
107
+ * Produced internally by the unplugin factory from `PluginOptions`. Consumers should not
108
+ * construct this type directly — it exists so that internal helpers receive fully resolved,
109
+ * non-optional values.
110
+ */
111
+ interface ResolvedPluginOptions {
112
+ /** npm package name of the integration consumer, used in generated file headers and import paths. */
113
+ currentPackageName: string;
114
+ /** Engine configuration object, a path to a config file, or `null`/`undefined` for auto-discovery. */
115
+ configOrPath: EngineConfig | string | Nullish;
116
+ /** Resolved TypeScript codegen output path, or `false` when codegen is disabled. */
117
+ tsCodegen: false | string;
118
+ /** Resolved CSS output file path (always a string after defaults are applied). */
119
+ cssCodegen: string;
120
+ /** Normalized include/exclude glob arrays controlling source file scanning. */
121
+ scan: IntegrationContextOptions['scan'];
122
+ /** Base function name to recognize in source transforms (e.g., `'pika'`). */
123
+ fnName: string;
124
+ /** Default output format for normal `pika()` calls: `'string'` or `'array'`. */
125
+ transformedFormat: 'string' | 'array';
126
+ /** Whether to scaffold a default config file when none is found. */
127
+ autoCreateConfig: boolean;
128
+ }
129
+ //#endregion
130
+ export { ResolvedPluginOptions as n, PluginOptions as t };
package/dist/vite.d.mts CHANGED
@@ -1,9 +1,24 @@
1
- import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CnxVmogs.mjs";
2
- import "./index.mjs";
1
+ import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-237J7YdE.mjs";
3
2
  import { Plugin } from "vite";
4
3
  export * from "@pikacss/integration";
5
4
 
6
5
  //#region src/vite.d.ts
6
+ /**
7
+ * PikaCSS plugin factory for Vite.
8
+ *
9
+ * Wraps the shared PikaCSS unplugin factory into a Vite-compatible plugin.
10
+ * Accepts optional {@link PluginOptions} to configure scanning, code
11
+ * generation, and engine settings. Returns a standard Vite `Plugin`.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import pikacss from '@pikacss/unplugin-pikacss/vite'
16
+ *
17
+ * export default defineConfig({
18
+ * plugins: [pikacss()],
19
+ * })
20
+ * ```
21
+ */
7
22
  declare const _default: (options?: PluginOptions) => Plugin;
8
23
  //#endregion
9
24
  export { PluginOptions, ResolvedPluginOptions, _default as default };
package/dist/vite.mjs CHANGED
@@ -1,10 +1,23 @@
1
1
  import { unpluginFactory } from "./index.mjs";
2
2
  import { createVitePlugin } from "unplugin";
3
-
4
- export * from "@pikacss/integration"
5
-
3
+ export * from "@pikacss/integration";
6
4
  //#region src/vite.ts
5
+ /**
6
+ * PikaCSS plugin factory for Vite.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into a Vite-compatible plugin.
9
+ * Accepts optional {@link PluginOptions} to configure scanning, code
10
+ * generation, and engine settings. Returns a standard Vite `Plugin`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/vite'
15
+ *
16
+ * export default defineConfig({
17
+ * plugins: [pikacss()],
18
+ * })
19
+ * ```
20
+ */
7
21
  var vite_default = createVitePlugin(unpluginFactory);
8
-
9
22
  //#endregion
10
- export { vite_default as default };
23
+ export { vite_default as default };
@@ -1,7 +1,23 @@
1
- import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-CnxVmogs.mjs";
1
+ import { n as ResolvedPluginOptions, t as PluginOptions } from "./types-237J7YdE.mjs";
2
2
  export * from "@pikacss/integration";
3
3
 
4
4
  //#region src/webpack.d.ts
5
+ /**
6
+ * PikaCSS plugin factory for webpack.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into a webpack-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/webpack'
15
+ *
16
+ * module.exports = {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
5
21
  declare const _default: (options?: PluginOptions | undefined) => WebpackPluginInstance;
6
22
  //#endregion
7
23
  export { PluginOptions, ResolvedPluginOptions, _default as default };
package/dist/webpack.mjs CHANGED
@@ -1,10 +1,23 @@
1
1
  import { unpluginFactory } from "./index.mjs";
2
2
  import { createWebpackPlugin } from "unplugin";
3
-
4
- export * from "@pikacss/integration"
5
-
3
+ export * from "@pikacss/integration";
6
4
  //#region src/webpack.ts
5
+ /**
6
+ * PikaCSS plugin factory for webpack.
7
+ *
8
+ * Wraps the shared PikaCSS unplugin factory into a webpack-compatible
9
+ * plugin. Accepts optional {@link PluginOptions} to configure scanning,
10
+ * code generation, and engine settings.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import pikacss from '@pikacss/unplugin-pikacss/webpack'
15
+ *
16
+ * module.exports = {
17
+ * plugins: [pikacss()],
18
+ * }
19
+ * ```
20
+ */
7
21
  var webpack_default = createWebpackPlugin(unpluginFactory);
8
-
9
22
  //#endregion
10
- export { webpack_default as default };
23
+ export { webpack_default as default };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@pikacss/unplugin-pikacss",
3
3
  "type": "module",
4
- "version": "0.0.47",
4
+ "version": "0.0.49",
5
5
  "author": "DevilTea <ch19980814@gmail.com>",
6
6
  "license": "MIT",
7
+ "homepage": "https://pikacss.com",
7
8
  "repository": {
8
9
  "type": "git",
9
- "url": "https://github.com/pikacss/pikacss.git",
10
+ "url": "git+https://github.com/pikacss/pikacss.git",
10
11
  "directory": "packages/unplugin"
11
12
  },
12
13
  "bugs": {
@@ -25,6 +26,7 @@
25
26
  "rspack-plugin",
26
27
  "rolldown-plugin"
27
28
  ],
29
+ "sideEffects": false,
28
30
  "exports": {
29
31
  ".": {
30
32
  "import": {
@@ -74,11 +76,14 @@
74
76
  "files": [
75
77
  "dist"
76
78
  ],
79
+ "engines": {
80
+ "node": ">=22"
81
+ },
77
82
  "publishConfig": {
78
83
  "access": "public"
79
84
  },
80
85
  "peerDependencies": {
81
- "vite": "^5.0.0 || ^6.0.0"
86
+ "vite": "^7.0.0 || ^8.0.0"
82
87
  },
83
88
  "peerDependenciesMeta": {
84
89
  "vite": {
@@ -89,12 +94,11 @@
89
94
  "pathe": "^2.0.3",
90
95
  "perfect-debounce": "^2.1.0",
91
96
  "unplugin": "^3.0.0",
92
- "@pikacss/integration": "0.0.47"
97
+ "@pikacss/integration": "0.0.49"
93
98
  },
94
99
  "devDependencies": {
95
- "@farmfe/core": "^1.7.11",
96
- "esbuild": "^0.27.3",
97
- "vite": "^7.3.1"
100
+ "esbuild": "^0.27.4",
101
+ "vite": "^8.0.3"
98
102
  },
99
103
  "scripts": {
100
104
  "build": "tsdown",
@@ -102,7 +106,7 @@
102
106
  "typecheck": "pnpm typecheck:package && pnpm typecheck:test",
103
107
  "typecheck:package": "tsc --project ./tsconfig.package.json --noEmit",
104
108
  "typecheck:test": "tsc --project ./tsconfig.tests.json --noEmit",
105
- "test": "vitest run",
106
- "test:watch": "vitest"
109
+ "test": "vitest run --config ./vitest.config.ts",
110
+ "test:watch": "vitest --config ./vitest.config.ts"
107
111
  }
108
112
  }
@@ -1,103 +0,0 @@
1
- import { EngineConfig, IntegrationContextOptions, Nullish } from "@pikacss/integration";
2
-
3
- //#region src/types.d.ts
4
- interface PluginOptions {
5
- /**
6
- * Specify file patterns to scan for detecting pika() function calls and generating atomic styles.
7
- *
8
- * Default values:
9
- * - `include`: `['**\/*.{js,ts,jsx,tsx,vue}']` - Scans all JS/TS/Vue files by default
10
- * - `exclude`: `['node_modules/**', 'dist/**']` - Excludes dependency and build output folders by default
11
- * Different wrappers may further narrow or extend these defaults before they reach unplugin.
12
- * @example
13
- * scan: {
14
- * include: ['src/**\/{*.ts,*.tsx,*.vue}'],
15
- * exclude: ['node_modules/**', 'dist/**']
16
- * }
17
- */
18
- scan?: {
19
- /**
20
- * File glob patterns to scan. Supports a single string or array of strings.
21
- * @default ['**\/*.{js,ts,jsx,tsx,vue}']
22
- */
23
- include?: string | string[];
24
- /**
25
- * File glob patterns to exclude. Supports a single string or array of strings.
26
- * @default ['node_modules/**', 'dist/**']
27
- */
28
- exclude?: string | string[];
29
- };
30
- /**
31
- * Configuration object or path to a configuration file for the PikaCSS engine.
32
- * Can pass a config object directly to define engine options, or a config file path (e.g., 'pika.config.js').
33
- *
34
- * Behavior:
35
- * - If a file path is specified but the file doesn't exist and autoCreateConfig is true, a config file will be generated at the specified path.
36
- * - If an inline config object is passed, autoCreateConfig will be ignored.
37
- * - If not provided and autoCreateConfig is true, a default config file will be created.
38
- * @example
39
- * config: { prefix: 'pika-', defaultSelector: '.%' }
40
- * // or
41
- * config: './pika.config.js'
42
- */
43
- config?: EngineConfig | string;
44
- /**
45
- * Whether to automatically create a configuration file when needed.
46
- *
47
- * Behavior:
48
- * - If config is not provided: Creates a default 'pika.config.js' in the project root.
49
- * - If config is a file path that doesn't exist: Creates a config file at the specified path.
50
- * - If config is an inline config object: This option is ignored (no file will be created).
51
- * @default true
52
- */
53
- autoCreateConfig?: boolean;
54
- /**
55
- * The name of the PikaCSS function in source code. Used to identify function calls that need to be transformed.
56
- * @default 'pika'
57
- * @example
58
- * fnName: 'classname' // Transform classname() function calls to atomic styles
59
- */
60
- fnName?: string;
61
- /**
62
- * The format of the generated atomic style class names.
63
- * - `'string'`: Returns a space-separated string of class names (e.g., "a b c")
64
- * - `'array'`: Returns an array of class names (e.g., ['a', 'b', 'c'])
65
- * @default 'string'
66
- */
67
- transformedFormat?: 'string' | 'array';
68
- /**
69
- * Configuration for TypeScript code generation file.
70
- * - `true`: Auto-generate as 'pika.gen.ts'
71
- * - string: Use the specified file path
72
- * - `false`: Disable TypeScript code generation
73
- * The generated TypeScript file provides type hints and auto-completion support.
74
- * @default true
75
- * @example
76
- * tsCodegen: 'src/pika.gen.ts' // Generate to a custom location
77
- */
78
- tsCodegen?: boolean | string;
79
- /**
80
- * Configuration for CSS code generation file.
81
- * - `true`: Auto-generate as 'pika.gen.css'
82
- * - string: Use the specified file path
83
- * The generated CSS file contains all scanned atomic styles.
84
- * @default true
85
- * @example
86
- * cssCodegen: 'src/styles/generated.css' // Generate to a custom location
87
- */
88
- cssCodegen?: true | string;
89
- /** @internal */
90
- currentPackageName?: string;
91
- }
92
- interface ResolvedPluginOptions {
93
- currentPackageName: string;
94
- configOrPath: EngineConfig | string | Nullish;
95
- tsCodegen: false | string;
96
- cssCodegen: string;
97
- scan: IntegrationContextOptions['scan'];
98
- fnName: string;
99
- transformedFormat: 'string' | 'array';
100
- autoCreateConfig: boolean;
101
- }
102
- //#endregion
103
- export { ResolvedPluginOptions as n, PluginOptions as t };