@plumeria/vite-plugin 6.1.0 → 6.1.1

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 +27 -25
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -199,6 +199,9 @@ export function plumeria(options = {}) {
199
199
  const processedDecls = new Set();
200
200
  const idSpans = new Set();
201
201
  const excludedSpans = new Set();
202
+ if (scannedTables.extractedSheet) {
203
+ addSheet(scannedTables.extractedSheet);
204
+ }
202
205
  const checkVariantAssignment = (decl) => {
203
206
  if (decl.init &&
204
207
  t.isCallExpression(decl.init) &&
@@ -430,37 +433,36 @@ export function plumeria(options = {}) {
430
433
  if (t.isIdentifier(node.object) && t.isIdentifier(node.property)) {
431
434
  const varName = node.object.value;
432
435
  const propName = node.property.value;
433
- const styleInfo = localCreateStyles[varName];
434
- if (styleInfo) {
435
- const atomMap = styleInfo.hashMap[propName];
436
+ const uniqueKey = `${id}-${varName}`;
437
+ let hash = scannedTables.createHashTable[uniqueKey];
438
+ if (!hash) {
439
+ hash = mergedCreateTable[varName];
440
+ }
441
+ if (!hash) {
442
+ const styleInfo = localCreateStyles[varName];
443
+ if (styleInfo) {
444
+ const atomMap = styleInfo.hashMap[propName];
445
+ if (atomMap) {
446
+ replacements.push({
447
+ start: node.span.start - ast.span.start,
448
+ end: node.span.end - ast.span.start,
449
+ content: JSON.stringify(atomMap),
450
+ });
451
+ return;
452
+ }
453
+ }
454
+ }
455
+ if (hash) {
456
+ let atomMap;
457
+ if (scannedTables.createAtomicMapTable[hash]) {
458
+ atomMap = scannedTables.createAtomicMapTable[hash][propName];
459
+ }
436
460
  if (atomMap) {
437
461
  replacements.push({
438
462
  start: node.span.start - ast.span.start,
439
463
  end: node.span.end - ast.span.start,
440
464
  content: JSON.stringify(atomMap),
441
465
  });
442
- return;
443
- }
444
- }
445
- const hash = mergedCreateTable[varName];
446
- if (hash) {
447
- const obj = scannedTables.createObjectTable[hash];
448
- if (obj && obj[propName]) {
449
- const style = obj[propName];
450
- if (typeof style === 'object' && style !== null) {
451
- const records = getStyleRecords(propName, style, 2);
452
- extractOndemandStyles(style, extractedSheets, scannedTables);
453
- records.forEach((r) => addSheet(r.sheet));
454
- const atomMap = {};
455
- records.forEach((r) => (atomMap[r.key] = r.hash));
456
- if (Object.keys(atomMap).length > 0) {
457
- replacements.push({
458
- start: node.span.start - ast.span.start,
459
- end: node.span.end - ast.span.start,
460
- content: JSON.stringify(atomMap),
461
- });
462
- }
463
- }
464
466
  }
465
467
  }
466
468
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
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": "^6.1.0"
25
+ "@plumeria/utils": "^6.1.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",