@plumeria/vite-plugin 6.1.0 → 6.1.2

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 -29
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -27,8 +27,6 @@ export function plumeria(options = {}) {
27
27
  devServer = _server;
28
28
  },
29
29
  resolveId(importeeUrl) {
30
- if (!isDev)
31
- return;
32
30
  const [id] = importeeUrl.split('?', 1);
33
31
  if (cssLookup.has(id)) {
34
32
  return id;
@@ -36,8 +34,6 @@ export function plumeria(options = {}) {
36
34
  return cssFileLookup.get(id);
37
35
  },
38
36
  load(url) {
39
- if (!isDev)
40
- return;
41
37
  const [id] = url.split('?', 1);
42
38
  return cssLookup.get(id);
43
39
  },
@@ -199,6 +195,9 @@ export function plumeria(options = {}) {
199
195
  const processedDecls = new Set();
200
196
  const idSpans = new Set();
201
197
  const excludedSpans = new Set();
198
+ if (scannedTables.extractedSheet) {
199
+ addSheet(scannedTables.extractedSheet);
200
+ }
202
201
  const checkVariantAssignment = (decl) => {
203
202
  if (decl.init &&
204
203
  t.isCallExpression(decl.init) &&
@@ -430,37 +429,36 @@ export function plumeria(options = {}) {
430
429
  if (t.isIdentifier(node.object) && t.isIdentifier(node.property)) {
431
430
  const varName = node.object.value;
432
431
  const propName = node.property.value;
433
- const styleInfo = localCreateStyles[varName];
434
- if (styleInfo) {
435
- const atomMap = styleInfo.hashMap[propName];
432
+ const uniqueKey = `${id}-${varName}`;
433
+ let hash = scannedTables.createHashTable[uniqueKey];
434
+ if (!hash) {
435
+ hash = mergedCreateTable[varName];
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
+ if (hash) {
452
+ let atomMap;
453
+ if (scannedTables.createAtomicMapTable[hash]) {
454
+ atomMap = scannedTables.createAtomicMapTable[hash][propName];
455
+ }
436
456
  if (atomMap) {
437
457
  replacements.push({
438
458
  start: node.span.start - ast.span.start,
439
459
  end: node.span.end - ast.span.start,
440
460
  content: JSON.stringify(atomMap),
441
461
  });
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
462
  }
465
463
  }
466
464
  }
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.2",
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.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",