@plumeria/vite-plugin 6.1.1 → 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 -18
  2. package/package.json +3 -3
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
  },
@@ -438,20 +434,6 @@ export function plumeria(options = {}) {
438
434
  if (!hash) {
439
435
  hash = mergedCreateTable[varName];
440
436
  }
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
437
  if (hash) {
456
438
  let atomMap;
457
439
  if (scannedTables.createAtomicMapTable[hash]) {
@@ -467,6 +449,44 @@ export function plumeria(options = {}) {
467
449
  }
468
450
  }
469
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
+ },
470
490
  CallExpression({ node }) {
471
491
  const callee = node.callee;
472
492
  let isPropsCall = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/vite-plugin",
3
- "version": "6.1.1",
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.1"
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",