@plumeria/vite-plugin 8.0.3 → 9.0.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.
Files changed (2) hide show
  1. package/dist/index.js +10 -11
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createFilter } from 'vite';
2
2
  import { parseSync } from '@swc/core';
3
- import path from 'path';
3
+ import * as path from 'path';
4
4
  import { genBase36Hash } from 'zss-engine';
5
5
  import { traverse, getStyleRecords, collectLocalConsts, objectExpressionToObject, t, extractOndemandStyles, deepMerge, scanAll, resolveImportPath, optimizer, processVariants, } from '@plumeria/utils';
6
6
  import { getLeadingCommentLength } from '@plumeria/utils';
@@ -248,7 +248,7 @@ export function plumeria(options = {}) {
248
248
  if ((localCreateStyles[varName] &&
249
249
  localCreateStyles[varName].type === 'variant') ||
250
250
  mergedVariantsTable[varName]) {
251
- throw new Error(`Plumeria: Assigning the return value of "css.variants" to a variable is not supported.\nPlease pass the variant function directly to "css.props". Found assignment to: ${t.isIdentifier(decl.id) ? decl.id.value : 'unknown'}`);
251
+ throw new Error(`Plumeria: Assigning the return value of "css.variants" to a variable is not supported.\nPlease pass the variant function directly to "css.use". Found assignment to: ${t.isIdentifier(decl.id) ? decl.id.value : 'unknown'}`);
252
252
  }
253
253
  }
254
254
  };
@@ -265,7 +265,7 @@ export function plumeria(options = {}) {
265
265
  const objectName = callee.object.value;
266
266
  const propertyName = callee.property.value;
267
267
  const alias = plumeriaAliases[objectName];
268
- if (alias === 'NAMESPACE' || objectName === 'css') {
268
+ if (alias === 'NAMESPACE') {
269
269
  propName = propertyName;
270
270
  }
271
271
  }
@@ -414,7 +414,7 @@ export function plumeria(options = {}) {
414
414
  const objectName = callee.object.value;
415
415
  const propertyName = callee.property.value;
416
416
  const alias = plumeriaAliases[objectName];
417
- if (alias === 'NAMESPACE' || objectName === 'css') {
417
+ if (alias === 'NAMESPACE') {
418
418
  propName = propertyName;
419
419
  }
420
420
  }
@@ -601,26 +601,25 @@ export function plumeria(options = {}) {
601
601
  },
602
602
  CallExpression({ node }) {
603
603
  const callee = node.callee;
604
- let isPropsCall = false;
604
+ let isUseCall = false;
605
605
  if (t.isMemberExpression(callee) &&
606
606
  t.isIdentifier(callee.object) &&
607
607
  t.isIdentifier(callee.property)) {
608
608
  const objectName = callee.object.value;
609
609
  const propertyName = callee.property.value;
610
610
  const alias = plumeriaAliases[objectName];
611
- if ((alias === 'NAMESPACE' || objectName === 'css') &&
612
- propertyName === 'props') {
613
- isPropsCall = true;
611
+ if (alias === 'NAMESPACE' && propertyName === 'use') {
612
+ isUseCall = true;
614
613
  }
615
614
  }
616
615
  else if (t.isIdentifier(callee)) {
617
616
  const calleeName = callee.value;
618
617
  const originalName = plumeriaAliases[calleeName];
619
- if (originalName === 'props') {
620
- isPropsCall = true;
618
+ if (originalName === 'use') {
619
+ isUseCall = true;
621
620
  }
622
621
  }
623
- if (isPropsCall) {
622
+ if (isUseCall) {
624
623
  const args = node.arguments;
625
624
  const resolveStyleObject = (expr) => {
626
625
  if (t.isObjectExpression(expr)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "8.0.3",
3
+ "version": "9.0.0",
4
4
  "type": "module",
5
5
  "description": "Plumeria Vite plugin",
6
6
  "author": "Refirst 11",
@@ -22,7 +22,7 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^8.0.3"
25
+ "@plumeria/utils": "^9.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.18",