@bamboocss/vite 1.37.2 → 1.37.4

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.
package/dist/index.cjs CHANGED
@@ -111,10 +111,19 @@ const pruneStaticCss = (css, session, { prune = true } = {}) => {
111
111
  if (present.has(className)) continue;
112
112
  orphaned.push(className);
113
113
  }
114
- if (orphaned.length) throw new Error(`bamboocss: ${orphaned.length} compiled class(es) have no rule in the emitted stylesheet. Elements carrying them would render unstyled.\n\n${(0, _bamboocss_shared.truncateList)(orphaned, {
115
- unit: "class",
116
- separator: "\n"
117
- })}\n\nThis is a compiler bug rather than anything to fix in your source please report it with the class names above.`);
114
+ if (orphaned.length) {
115
+ const describe = (className) => {
116
+ if (/\s/.test(className)) return ` ${className}\n (malformed key: a class name cannot contain whitespace)`;
117
+ const extracted = session.prunableClasses.has(className) ? "in the extracted atoms" : "NOT extracted";
118
+ const bare = className.replaceAll("\\", "");
119
+ const near = [...present].filter((candidate) => candidate !== className && candidate.replaceAll("\\", "") === bare);
120
+ return ` ${className}\n (${extracted}; no rule in the sheet` + (near.length ? `; a rule exists under ${near.map((n) => JSON.stringify(n)).join(", ")}` : "") + `)`;
121
+ };
122
+ throw new Error(`bamboocss: ${orphaned.length} compiled class(es) have no rule in the emitted stylesheet. Elements carrying them would render unstyled.\n\n${(0, _bamboocss_shared.truncateList)(orphaned.map(describe), {
123
+ unit: "class",
124
+ separator: "\n"
125
+ })}\n\nThis is a compiler bug rather than anything to fix in your source. Please report it with the block above — the parenthesised part is what distinguishes an atom that was never emitted from one whose rule is present under a different spelling.`);
126
+ }
118
127
  }
119
128
  return root.toString();
120
129
  };
@@ -2706,7 +2715,7 @@ const createStaticCompilationSession = () => {
2706
2715
  markClassUsed(className) {
2707
2716
  for (const token of className.split(" ")) {
2708
2717
  if (!token) continue;
2709
- session.usedClasses.add((0, _bamboocss_shared.esc)(token));
2718
+ session.usedClasses.add(token.includes("\\") ? token : (0, _bamboocss_shared.esc)(token));
2710
2719
  }
2711
2720
  }
2712
2721
  };
package/dist/index.mjs CHANGED
@@ -81,10 +81,19 @@ const pruneStaticCss = (css, session, { prune = true } = {}) => {
81
81
  if (present.has(className)) continue;
82
82
  orphaned.push(className);
83
83
  }
84
- if (orphaned.length) throw new Error(`bamboocss: ${orphaned.length} compiled class(es) have no rule in the emitted stylesheet. Elements carrying them would render unstyled.\n\n${truncateList(orphaned, {
85
- unit: "class",
86
- separator: "\n"
87
- })}\n\nThis is a compiler bug rather than anything to fix in your source please report it with the class names above.`);
84
+ if (orphaned.length) {
85
+ const describe = (className) => {
86
+ if (/\s/.test(className)) return ` ${className}\n (malformed key: a class name cannot contain whitespace)`;
87
+ const extracted = session.prunableClasses.has(className) ? "in the extracted atoms" : "NOT extracted";
88
+ const bare = className.replaceAll("\\", "");
89
+ const near = [...present].filter((candidate) => candidate !== className && candidate.replaceAll("\\", "") === bare);
90
+ return ` ${className}\n (${extracted}; no rule in the sheet` + (near.length ? `; a rule exists under ${near.map((n) => JSON.stringify(n)).join(", ")}` : "") + `)`;
91
+ };
92
+ throw new Error(`bamboocss: ${orphaned.length} compiled class(es) have no rule in the emitted stylesheet. Elements carrying them would render unstyled.\n\n${truncateList(orphaned.map(describe), {
93
+ unit: "class",
94
+ separator: "\n"
95
+ })}\n\nThis is a compiler bug rather than anything to fix in your source. Please report it with the block above — the parenthesised part is what distinguishes an atom that was never emitted from one whose rule is present under a different spelling.`);
96
+ }
88
97
  }
89
98
  return root.toString();
90
99
  };
@@ -2676,7 +2685,7 @@ const createStaticCompilationSession = () => {
2676
2685
  markClassUsed(className) {
2677
2686
  for (const token of className.split(" ")) {
2678
2687
  if (!token) continue;
2679
- session.usedClasses.add(esc(token));
2688
+ session.usedClasses.add(token.includes("\\") ? token : esc(token));
2680
2689
  }
2681
2690
  }
2682
2691
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.37.2",
3
+ "version": "1.37.4",
4
4
  "description": "Vite integration for Bamboo CSS",
5
5
  "homepage": "https://bamboocss.com",
6
6
  "license": "MIT",
@@ -40,18 +40,18 @@
40
40
  "postcss": "8.5.26",
41
41
  "postcss-selector-parser": "7.1.5",
42
42
  "ts-morph": "28.0.0",
43
- "@bamboocss/config": "1.37.2",
44
- "@bamboocss/core": "1.37.2",
45
- "@bamboocss/extractor": "1.37.2",
46
- "@bamboocss/logger": "1.37.2",
47
- "@bamboocss/node": "1.37.2",
48
- "@bamboocss/shared": "1.37.2",
49
- "@bamboocss/types": "1.37.2"
43
+ "@bamboocss/config": "1.37.4",
44
+ "@bamboocss/core": "1.37.4",
45
+ "@bamboocss/extractor": "1.37.4",
46
+ "@bamboocss/node": "1.37.4",
47
+ "@bamboocss/logger": "1.37.4",
48
+ "@bamboocss/shared": "1.37.4",
49
+ "@bamboocss/types": "1.37.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
53
  "vite": "7.2.6",
54
- "@bamboocss/fixture": "1.37.2"
54
+ "@bamboocss/fixture": "1.37.4"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vite": ">=5"