@plumeria/webpack-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 -14
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -396,20 +396,6 @@ function loader(source) {
396
396
  if (!hash) {
397
397
  hash = mergedCreateTable[varName];
398
398
  }
399
- if (!hash) {
400
- const styleInfo = localCreateStyles[varName];
401
- if (styleInfo) {
402
- const atomMap = styleInfo.hashMap[propName];
403
- if (atomMap) {
404
- replacements.push({
405
- start: node.span.start - ast.span.start,
406
- end: node.span.end - ast.span.start,
407
- content: JSON.stringify(atomMap),
408
- });
409
- return;
410
- }
411
- }
412
- }
413
399
  if (hash) {
414
400
  let atomMap;
415
401
  if (scannedTables.createAtomicMapTable[hash]) {
@@ -425,6 +411,44 @@ function loader(source) {
425
411
  }
426
412
  }
427
413
  },
414
+ Identifier({ node }) {
415
+ if (excludedSpans.has(node.span.start))
416
+ return;
417
+ if (idSpans.has(node.span.start))
418
+ return;
419
+ const styleInfo = localCreateStyles[node.value];
420
+ if (styleInfo) {
421
+ replacements.push({
422
+ start: node.span.start - ast.span.start,
423
+ end: node.span.end - ast.span.start,
424
+ content: JSON.stringify(styleInfo.hashMap),
425
+ });
426
+ return;
427
+ }
428
+ const varName = node.value;
429
+ const uniqueKey = `${this.resourcePath}-${varName}`;
430
+ let hash = scannedTables.createHashTable[uniqueKey];
431
+ if (!hash) {
432
+ hash = mergedCreateTable[varName];
433
+ }
434
+ if (hash) {
435
+ const obj = scannedTables.createObjectTable[hash];
436
+ const atomicMap = scannedTables.createAtomicMapTable[hash];
437
+ if (obj && atomicMap) {
438
+ const hashMap = {};
439
+ Object.keys(obj).forEach((key) => {
440
+ if (atomicMap[key]) {
441
+ hashMap[key] = atomicMap[key];
442
+ }
443
+ });
444
+ replacements.push({
445
+ start: node.span.start - ast.span.start,
446
+ end: node.span.end - ast.span.start,
447
+ content: JSON.stringify(hashMap),
448
+ });
449
+ }
450
+ }
451
+ },
428
452
  CallExpression({ node }) {
429
453
  const callee = node.callee;
430
454
  let isPropsCall = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/webpack-plugin",
3
- "version": "6.1.1",
3
+ "version": "6.2.0",
4
4
  "description": "Plumeria Webpack plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,12 +22,12 @@
22
22
  "zero-virtual.css"
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
  "webpack": "5.101.0",
30
- "zss-engine": "2.1.2"
30
+ "zss-engine": "2.2.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public",