@plumeria/webpack-plugin 6.0.0 → 6.0.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 +15 -27
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -574,22 +574,10 @@ function loader(source) {
574
574
  const table = {};
575
575
  const combinations = 1 << conditionals.length;
576
576
  for (let i = 0; i < combinations; i++) {
577
- const currentClassNames = [];
577
+ let currentStyle = { ...baseStyle };
578
578
  const seenGroups = new Set();
579
579
  let impossible = false;
580
- if (Object.keys(baseStyle).length > 0) {
581
- if (!isProduction) {
582
- (0, utils_1.extractOndemandStyles)(baseStyle, extractedSheets, scannedTables);
583
- }
584
- const hash = (0, zss_engine_1.genBase36Hash)(baseStyle, 1, 8);
585
- const records = (0, utils_1.getStyleRecords)(hash, baseStyle, 2);
586
- if (!isProduction) {
587
- records.forEach((r) => extractedSheets.push(r.sheet));
588
- }
589
- currentClassNames.push(...records.map((r) => r.hash));
590
- }
591
580
  for (let j = 0; j < conditionals.length; j++) {
592
- let targetStyle = {};
593
581
  if ((i >> j) & 1) {
594
582
  if (conditionals[j].groupId !== undefined) {
595
583
  if (seenGroups.has(conditionals[j].groupId)) {
@@ -598,28 +586,28 @@ function loader(source) {
598
586
  }
599
587
  seenGroups.add(conditionals[j].groupId);
600
588
  }
601
- targetStyle = conditionals[j].truthy;
589
+ currentStyle = (0, utils_1.deepMerge)(currentStyle, conditionals[j].truthy);
602
590
  }
603
591
  else {
604
- targetStyle = conditionals[j].falsy;
605
- }
606
- if (Object.keys(targetStyle).length > 0) {
607
- if (!isProduction) {
608
- (0, utils_1.extractOndemandStyles)(targetStyle, extractedSheets, scannedTables);
609
- }
610
- const hash = (0, zss_engine_1.genBase36Hash)(targetStyle, 1, 8);
611
- const records = (0, utils_1.getStyleRecords)(hash, targetStyle, 2);
612
- if (!isProduction) {
613
- records.forEach((r) => extractedSheets.push(r.sheet));
614
- }
615
- currentClassNames.push(...records.map((r) => r.hash));
592
+ currentStyle = (0, utils_1.deepMerge)(currentStyle, conditionals[j].falsy);
616
593
  }
617
594
  }
618
595
  if (impossible) {
619
596
  table[i] = '';
620
597
  continue;
621
598
  }
622
- table[i] = currentClassNames.join(' ');
599
+ if (!isProduction) {
600
+ (0, utils_1.extractOndemandStyles)(currentStyle, extractedSheets, scannedTables);
601
+ }
602
+ const hash = (0, zss_engine_1.genBase36Hash)(currentStyle, 1, 8);
603
+ const records = (0, utils_1.getStyleRecords)(hash, currentStyle, 2);
604
+ if (!isProduction) {
605
+ records.forEach((r) => extractedSheets.push(r.sheet));
606
+ }
607
+ const className = records
608
+ .map((r) => r.hash)
609
+ .join(' ');
610
+ table[i] = className;
623
611
  }
624
612
  let indexExpr = '';
625
613
  if (conditionals.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/webpack-plugin",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Plumeria Webpack plugin",
5
5
  "author": "Refirst 11",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "zero-virtual.css"
23
23
  ],
24
24
  "dependencies": {
25
- "@plumeria/utils": "^6.0.0"
25
+ "@plumeria/utils": "^6.0.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@swc/core": "1.15.8",