@plumeria/turbopack-loader 18.2.14 → 18.2.15

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 +14 -7
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -307,8 +307,8 @@ async function loader(source) {
307
307
  extractedSheets.push(sheet);
308
308
  }
309
309
  };
310
- const processStyleRecords = (style) => {
311
- const records = (0, utils_1.getStyleRecords)(style);
310
+ const processStyleRecords = (style, weights) => {
311
+ const records = (0, utils_1.getStyleRecords)(style, weights);
312
312
  if (!isProduction) {
313
313
  (0, utils_1.extractOndemandStyles)(style, extractedSheets, scannedTables);
314
314
  records.forEach((r) => {
@@ -1449,6 +1449,13 @@ async function loader(source) {
1449
1449
  dynamicVars,
1450
1450
  };
1451
1451
  }
1452
+ const stateSources = baseChunks.map(({ order, style }) => ({ order, style: style }));
1453
+ conditionals.forEach((c) => {
1454
+ const order = c.order ?? 0;
1455
+ stateSources.push({ order, style: c.truthy });
1456
+ stateSources.push({ order, style: c.falsy });
1457
+ });
1458
+ const stateWeights = (0, utils_1.getStateWeights)(stateSources);
1452
1459
  const participation = {};
1453
1460
  const registerParticipation = (style, sourceId) => {
1454
1461
  Object.keys(style).forEach((key) => {
@@ -1534,7 +1541,7 @@ async function loader(source) {
1534
1541
  if (existingClass)
1535
1542
  classParts.push(existingClass);
1536
1543
  if (Object.keys(baseIndependent).length > 0) {
1537
- const className = processStyleRecords(baseIndependent)
1544
+ const className = processStyleRecords(baseIndependent, stateWeights)
1538
1545
  .map((r) => r.hash)
1539
1546
  .join(' ');
1540
1547
  if (className)
@@ -1546,7 +1553,7 @@ async function loader(source) {
1546
1553
  const processBranch = (style) => {
1547
1554
  if (Object.keys(style).length === 0)
1548
1555
  return '""';
1549
- return JSON.stringify(processStyleRecords(style)
1556
+ return JSON.stringify(processStyleRecords(style, stateWeights)
1550
1557
  .map((r) => r.hash)
1551
1558
  .join(' '));
1552
1559
  };
@@ -1568,7 +1575,7 @@ async function loader(source) {
1568
1575
  const lookupMap = {};
1569
1576
  options.forEach((opt) => {
1570
1577
  if (opt.valueName !== undefined && opt.truthy) {
1571
- const className = processStyleRecords(opt.truthy)
1578
+ const className = processStyleRecords(opt.truthy, stateWeights)
1572
1579
  .map((r) => r.hash)
1573
1580
  .join(' ');
1574
1581
  if (className)
@@ -1668,7 +1675,7 @@ async function loader(source) {
1668
1675
  const results = {};
1669
1676
  const recurse = (dimIndex, currentStyle, keyParts) => {
1670
1677
  if (dimIndex >= dimensions.length) {
1671
- const className = processStyleRecords(currentStyle)
1678
+ const className = processStyleRecords(currentStyle, stateWeights)
1672
1679
  .map((r) => r.hash)
1673
1680
  .join(' ');
1674
1681
  if (className)
@@ -1682,7 +1689,7 @@ async function loader(source) {
1682
1689
  };
1683
1690
  recurse(0, {}, []);
1684
1691
  const baseConflictClass = Object.keys(baseConflict).length > 0
1685
- ? processStyleRecords(baseConflict)
1692
+ ? processStyleRecords(baseConflict, stateWeights)
1686
1693
  .map((r) => r.hash)
1687
1694
  .join(' ')
1688
1695
  : '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumeria/turbopack-loader",
3
- "version": "18.2.14",
3
+ "version": "18.2.15",
4
4
  "description": "Plumeria Turbopack-loader",
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/compiler": "^18.2.14",
26
- "@plumeria/utils": "^18.2.14"
25
+ "@plumeria/compiler": "^18.2.15",
26
+ "@plumeria/utils": "^18.2.15"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@swc/core": "1.15.47",
30
- "zss-engine": "2.5.0"
30
+ "zss-engine": "2.6.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public",