@plumeria/unplugin 18.3.18 → 18.4.0

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
@@ -156,6 +156,10 @@ plumeria.vite({
156
156
  | `exclude` | — | Files to skip. |
157
157
  | `devEmitToDisk` | `false` | Write CSS to disk in development so the bundler's watcher drives HMR. |
158
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
+
162
+ 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.
159
163
 
160
164
  ### styleProp
161
165
 
package/dist/core.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { UnpluginFactory } from 'unplugin';
2
- export interface PluginOptions {
2
+ import type { PropertyPolicyOptions } from '@plumeria/utils';
3
+ export interface PluginOptions extends PropertyPolicyOptions {
3
4
  include?: string | RegExp | Array<string | RegExp>;
4
5
  exclude?: string | RegExp | Array<string | RegExp>;
5
6
  devEmitToDisk?: boolean;
package/dist/core.js CHANGED
@@ -222,6 +222,7 @@ const applyVarFallback = (style, cssVar, literal) => {
222
222
  };
223
223
  const unpluginFactory = (options = {}, unpluginMeta) => {
224
224
  const filter = (0, pluginutils_1.createFilter)(options.include, options.exclude);
225
+ const propertyPolicy = (0, utils_1.resolvePropertyPolicy)(options);
225
226
  const styleProp = options.styleProp ?? utils_1.DEFAULT_STYLE_PROP;
226
227
  const cssLookup = new Map();
227
228
  const cssFileLookup = new Map();
@@ -291,6 +292,7 @@ const unpluginFactory = (options = {}, unpluginMeta) => {
291
292
  tsx: true,
292
293
  target: 'es2022',
293
294
  });
295
+ (0, utils_1.assertPropertyPolicy)(ast, propertyPolicy, id);
294
296
  const leadingLen = (0, utils_1.getLeadingCommentLength)(source);
295
297
  const sourceBuffer = Buffer.from(source, 'utf-8');
296
298
  const leadingBytes = Buffer.byteLength(source.slice(0, leadingLen), 'utf-8');
package/dist/core.mjs CHANGED
@@ -2,7 +2,7 @@ import { createFilter } from '@rollup/pluginutils';
2
2
  import { parseSync } from '@swc/core';
3
3
  import * as path from 'path';
4
4
  import { applyCssValue, genBase36Hash, exceptionCamelCase, camelToKebabCase, isAtRule, } from 'zss-engine';
5
- import { traverse, collectReferenceIdentifiers, getStyleRecords, getStateWeights, collectLocalConsts, objectExpressionToObject, t, getRootIdentifier, extractOndemandStyles, deepMerge, scanAll, resolveFileError, resolveImportPath, getLeadingCommentLength, optimizer, themeHashOf, getFileDependencies, resolveExport, resolveComponentKey, resolveThemeSelector, DEFAULT_STYLE_PROP, } from '@plumeria/utils';
5
+ import { traverse, resolvePropertyPolicy, assertPropertyPolicy, collectReferenceIdentifiers, getStyleRecords, getStateWeights, collectLocalConsts, objectExpressionToObject, t, getRootIdentifier, extractOndemandStyles, deepMerge, scanAll, resolveFileError, resolveImportPath, getLeadingCommentLength, optimizer, themeHashOf, getFileDependencies, resolveExport, resolveComponentKey, resolveThemeSelector, DEFAULT_STYLE_PROP, } from '@plumeria/utils';
6
6
  export const TARGET_EXTENSIONS = ['ts', 'tsx', 'js', 'jsx'];
7
7
  export const EXTENSION_PATTERN = /\.(ts|tsx|js|jsx)$/;
8
8
  const unwrapExport = (node) => {
@@ -186,6 +186,7 @@ const applyVarFallback = (style, cssVar, literal) => {
186
186
  };
187
187
  export const unpluginFactory = (options = {}, unpluginMeta) => {
188
188
  const filter = createFilter(options.include, options.exclude);
189
+ const propertyPolicy = resolvePropertyPolicy(options);
189
190
  const styleProp = options.styleProp ?? DEFAULT_STYLE_PROP;
190
191
  const cssLookup = new Map();
191
192
  const cssFileLookup = new Map();
@@ -255,6 +256,7 @@ export const unpluginFactory = (options = {}, unpluginMeta) => {
255
256
  tsx: true,
256
257
  target: 'es2022',
257
258
  });
259
+ assertPropertyPolicy(ast, propertyPolicy, id);
258
260
  const leadingLen = getLeadingCommentLength(source);
259
261
  const sourceBuffer = Buffer.from(source, 'utf-8');
260
262
  const leadingBytes = Buffer.byteLength(source.slice(0, leadingLen), 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/unplugin",
3
- "version": "18.3.18",
3
+ "version": "18.4.0",
4
4
  "description": "Universal Plumeria plugin for various build tools",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -94,12 +94,12 @@
94
94
  "dependencies": {
95
95
  "@rollup/pluginutils": "^5.4.0",
96
96
  "unplugin": "^3.0.0",
97
- "@plumeria/utils": "^18.3.18"
97
+ "@plumeria/utils": "^18.4.0"
98
98
  },
99
99
  "devDependencies": {
100
100
  "@swc/core": "1.15.47",
101
101
  "vite": "^8.0.13",
102
- "zss-engine": "2.7.0"
102
+ "zss-engine": "2.8.0"
103
103
  },
104
104
  "publishConfig": {
105
105
  "access": "public",