@plumeria/turbopack-loader 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
@@ -573,22 +573,10 @@ async function loader(source) {
573
573
  const table = {};
574
574
  const combinations = 1 << conditionals.length;
575
575
  for (let i = 0; i < combinations; i++) {
576
- const currentClassNames = [];
576
+ let currentStyle = { ...baseStyle };
577
577
  const seenGroups = new Set();
578
578
  let impossible = false;
579
- if (Object.keys(baseStyle).length > 0) {
580
- if (!isProduction) {
581
- (0, utils_1.extractOndemandStyles)(baseStyle, extractedSheets, scannedTables);
582
- }
583
- const hash = (0, zss_engine_1.genBase36Hash)(baseStyle, 1, 8);
584
- const records = (0, utils_1.getStyleRecords)(hash, baseStyle, 2);
585
- if (!isProduction) {
586
- records.forEach((r) => extractedSheets.push(r.sheet));
587
- }
588
- currentClassNames.push(...records.map((r) => r.hash));
589
- }
590
579
  for (let j = 0; j < conditionals.length; j++) {
591
- let targetStyle = {};
592
580
  if ((i >> j) & 1) {
593
581
  if (conditionals[j].groupId !== undefined) {
594
582
  if (seenGroups.has(conditionals[j].groupId)) {
@@ -597,28 +585,28 @@ async function loader(source) {
597
585
  }
598
586
  seenGroups.add(conditionals[j].groupId);
599
587
  }
600
- targetStyle = conditionals[j].truthy;
588
+ currentStyle = (0, utils_1.deepMerge)(currentStyle, conditionals[j].truthy);
601
589
  }
602
590
  else {
603
- targetStyle = conditionals[j].falsy;
604
- }
605
- if (Object.keys(targetStyle).length > 0) {
606
- if (!isProduction) {
607
- (0, utils_1.extractOndemandStyles)(targetStyle, extractedSheets, scannedTables);
608
- }
609
- const hash = (0, zss_engine_1.genBase36Hash)(targetStyle, 1, 8);
610
- const records = (0, utils_1.getStyleRecords)(hash, targetStyle, 2);
611
- if (!isProduction) {
612
- records.forEach((r) => extractedSheets.push(r.sheet));
613
- }
614
- currentClassNames.push(...records.map((r) => r.hash));
591
+ currentStyle = (0, utils_1.deepMerge)(currentStyle, conditionals[j].falsy);
615
592
  }
616
593
  }
617
594
  if (impossible) {
618
595
  table[i] = '';
619
596
  continue;
620
597
  }
621
- table[i] = currentClassNames.join(' ');
598
+ if (process.env.NODE_ENV !== 'production') {
599
+ (0, utils_1.extractOndemandStyles)(currentStyle, extractedSheets, scannedTables);
600
+ }
601
+ const hash = (0, zss_engine_1.genBase36Hash)(currentStyle, 1, 8);
602
+ const records = (0, utils_1.getStyleRecords)(hash, currentStyle, 2);
603
+ if (process.env.NODE_ENV !== 'production') {
604
+ records.forEach((r) => extractedSheets.push(r.sheet));
605
+ }
606
+ const className = records
607
+ .map((r) => r.hash)
608
+ .join(' ');
609
+ table[i] = className;
622
610
  }
623
611
  let indexExpr = '';
624
612
  if (conditionals.length === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Plumeria Turbopack-loader",
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",