@plumeria/vite-plugin 6.1.2 → 6.2.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 +38 -14
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -434,20 +434,6 @@ export function plumeria(options = {}) {
434
434
  if (!hash) {
435
435
  hash = mergedCreateTable[varName];
436
436
  }
437
- if (!hash) {
438
- const styleInfo = localCreateStyles[varName];
439
- if (styleInfo) {
440
- const atomMap = styleInfo.hashMap[propName];
441
- if (atomMap) {
442
- replacements.push({
443
- start: node.span.start - ast.span.start,
444
- end: node.span.end - ast.span.start,
445
- content: JSON.stringify(atomMap),
446
- });
447
- return;
448
- }
449
- }
450
- }
451
437
  if (hash) {
452
438
  let atomMap;
453
439
  if (scannedTables.createAtomicMapTable[hash]) {
@@ -463,6 +449,44 @@ export function plumeria(options = {}) {
463
449
  }
464
450
  }
465
451
  },
452
+ Identifier({ node }) {
453
+ if (excludedSpans.has(node.span.start))
454
+ return;
455
+ if (idSpans.has(node.span.start))
456
+ return;
457
+ const styleInfo = localCreateStyles[node.value];
458
+ if (styleInfo) {
459
+ replacements.push({
460
+ start: node.span.start - ast.span.start,
461
+ end: node.span.end - ast.span.start,
462
+ content: JSON.stringify(styleInfo.hashMap),
463
+ });
464
+ return;
465
+ }
466
+ const varName = node.value;
467
+ const uniqueKey = `${this.resourcePath}-${varName}`;
468
+ let hash = scannedTables.createHashTable[uniqueKey];
469
+ if (!hash) {
470
+ hash = mergedCreateTable[varName];
471
+ }
472
+ if (hash) {
473
+ const obj = scannedTables.createObjectTable[hash];
474
+ const atomicMap = scannedTables.createAtomicMapTable[hash];
475
+ if (obj && atomicMap) {
476
+ const hashMap = {};
477
+ Object.keys(obj).forEach((key) => {
478
+ if (atomicMap[key]) {
479
+ hashMap[key] = atomicMap[key];
480
+ }
481
+ });
482
+ replacements.push({
483
+ start: node.span.start - ast.span.start,
484
+ end: node.span.end - ast.span.start,
485
+ content: JSON.stringify(hashMap),
486
+ });
487
+ }
488
+ }
489
+ },
466
490
  CallExpression({ node }) {
467
491
  const callee = node.callee;
468
492
  let isPropsCall = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "6.1.2",
3
+ "version": "6.2.0",
4
4
  "type": "module",
5
5
  "description": "Plumeria Vite plugin",
6
6
  "author": "Refirst 11",
@@ -22,12 +22,12 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^6.1.2"
25
+ "@plumeria/utils": "^6.2.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",
29
29
  "vite": "^7.1.1",
30
- "zss-engine": "2.1.2"
30
+ "zss-engine": "2.2.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public",