@bamboocss/vite 1.37.1 → 1.37.3
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 +39 -12
- package/dist/index.mjs +39 -12
- package/package.json +9 -9
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)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
};
|
|
@@ -245,6 +254,15 @@ const optimizeStaticCssAssets = (bundle, session, options = {}) => {
|
|
|
245
254
|
*/
|
|
246
255
|
const bamboocssCss = (options) => {
|
|
247
256
|
const { configPath, cwd, session, renameCssAsset = true } = options;
|
|
257
|
+
/**
|
|
258
|
+
* Environments whose `load` served the virtual stylesheet.
|
|
259
|
+
*
|
|
260
|
+
* The lost-sheet guard below is about an asset that existed and then went missing, so it
|
|
261
|
+
* can only be asked of an environment that asked for one. An SSR bundle never imports the
|
|
262
|
+
* stylesheet — the client build emits it — and firing there turned a correct two-environment
|
|
263
|
+
* build into a hard failure.
|
|
264
|
+
*/
|
|
265
|
+
const servedEnvironments = /* @__PURE__ */ new Set();
|
|
248
266
|
const builder = new _bamboocss_node.Builder();
|
|
249
267
|
let server;
|
|
250
268
|
let command = "build";
|
|
@@ -305,6 +323,7 @@ const bamboocssCss = (options) => {
|
|
|
305
323
|
},
|
|
306
324
|
async load(id) {
|
|
307
325
|
if (id !== RESOLVED_ID) return null;
|
|
326
|
+
servedEnvironments.add(this.environment?.name ?? "default");
|
|
308
327
|
let css;
|
|
309
328
|
try {
|
|
310
329
|
css = await generate();
|
|
@@ -334,6 +353,7 @@ const bamboocssCss = (options) => {
|
|
|
334
353
|
order: "post",
|
|
335
354
|
handler(_, bundle) {
|
|
336
355
|
optimizeStaticCssAssets(bundle, session, { rename: renameCssAsset });
|
|
356
|
+
if (!servedEnvironments.has(this.environment?.name ?? "default")) return;
|
|
337
357
|
if (!session.transformedFiles.size) return;
|
|
338
358
|
if (!Object.values(bundle).some((output) => {
|
|
339
359
|
if (!carriesGeneratedCss(output)) return false;
|
|
@@ -2763,6 +2783,8 @@ const formatSkipped = (id, skipped) => {
|
|
|
2763
2783
|
const bamboocss = (options = {}) => {
|
|
2764
2784
|
const { configPath, cwd, reportSkipped = false, reportSummary = true, maxRecipeStates, renameCssAsset = true } = options;
|
|
2765
2785
|
if (maxRecipeStates !== void 0 && (!Number.isSafeInteger(maxRecipeStates) || maxRecipeStates < 1)) throw new Error("bamboocss: `maxRecipeStates` must be a positive safe integer.");
|
|
2786
|
+
/** Environments whose `buildStart` has run in the build currently in progress. */
|
|
2787
|
+
const seenEnvironments = /* @__PURE__ */ new Set();
|
|
2766
2788
|
/** Totals across the build, for the summary. */
|
|
2767
2789
|
const totals = {
|
|
2768
2790
|
folded: 0,
|
|
@@ -2834,14 +2856,19 @@ const bamboocss = (options = {}) => {
|
|
|
2834
2856
|
command = config.command;
|
|
2835
2857
|
},
|
|
2836
2858
|
async buildStart() {
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2859
|
+
const environment = this.environment?.name ?? "default";
|
|
2860
|
+
if (seenEnvironments.has(environment)) {
|
|
2861
|
+
seenEnvironments.clear();
|
|
2862
|
+
totals.folded = 0;
|
|
2863
|
+
totals.files = 0;
|
|
2864
|
+
totals.filesWithFolds = 0;
|
|
2865
|
+
totals.skipped.clear();
|
|
2866
|
+
survivors.length = 0;
|
|
2867
|
+
survivorKeys.clear();
|
|
2868
|
+
recipeConfigCache.clear();
|
|
2869
|
+
resetStaticCompilationSession(staticSession);
|
|
2870
|
+
}
|
|
2871
|
+
seenEnvironments.add(environment);
|
|
2845
2872
|
try {
|
|
2846
2873
|
await ensureContext();
|
|
2847
2874
|
} catch (error) {
|
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)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
};
|
|
@@ -215,6 +224,15 @@ const optimizeStaticCssAssets = (bundle, session, options = {}) => {
|
|
|
215
224
|
*/
|
|
216
225
|
const bamboocssCss = (options) => {
|
|
217
226
|
const { configPath, cwd, session, renameCssAsset = true } = options;
|
|
227
|
+
/**
|
|
228
|
+
* Environments whose `load` served the virtual stylesheet.
|
|
229
|
+
*
|
|
230
|
+
* The lost-sheet guard below is about an asset that existed and then went missing, so it
|
|
231
|
+
* can only be asked of an environment that asked for one. An SSR bundle never imports the
|
|
232
|
+
* stylesheet — the client build emits it — and firing there turned a correct two-environment
|
|
233
|
+
* build into a hard failure.
|
|
234
|
+
*/
|
|
235
|
+
const servedEnvironments = /* @__PURE__ */ new Set();
|
|
218
236
|
const builder = new Builder();
|
|
219
237
|
let server;
|
|
220
238
|
let command = "build";
|
|
@@ -275,6 +293,7 @@ const bamboocssCss = (options) => {
|
|
|
275
293
|
},
|
|
276
294
|
async load(id) {
|
|
277
295
|
if (id !== RESOLVED_ID) return null;
|
|
296
|
+
servedEnvironments.add(this.environment?.name ?? "default");
|
|
278
297
|
let css;
|
|
279
298
|
try {
|
|
280
299
|
css = await generate();
|
|
@@ -304,6 +323,7 @@ const bamboocssCss = (options) => {
|
|
|
304
323
|
order: "post",
|
|
305
324
|
handler(_, bundle) {
|
|
306
325
|
optimizeStaticCssAssets(bundle, session, { rename: renameCssAsset });
|
|
326
|
+
if (!servedEnvironments.has(this.environment?.name ?? "default")) return;
|
|
307
327
|
if (!session.transformedFiles.size) return;
|
|
308
328
|
if (!Object.values(bundle).some((output) => {
|
|
309
329
|
if (!carriesGeneratedCss(output)) return false;
|
|
@@ -2733,6 +2753,8 @@ const formatSkipped = (id, skipped) => {
|
|
|
2733
2753
|
const bamboocss = (options = {}) => {
|
|
2734
2754
|
const { configPath, cwd, reportSkipped = false, reportSummary = true, maxRecipeStates, renameCssAsset = true } = options;
|
|
2735
2755
|
if (maxRecipeStates !== void 0 && (!Number.isSafeInteger(maxRecipeStates) || maxRecipeStates < 1)) throw new Error("bamboocss: `maxRecipeStates` must be a positive safe integer.");
|
|
2756
|
+
/** Environments whose `buildStart` has run in the build currently in progress. */
|
|
2757
|
+
const seenEnvironments = /* @__PURE__ */ new Set();
|
|
2736
2758
|
/** Totals across the build, for the summary. */
|
|
2737
2759
|
const totals = {
|
|
2738
2760
|
folded: 0,
|
|
@@ -2804,14 +2826,19 @@ const bamboocss = (options = {}) => {
|
|
|
2804
2826
|
command = config.command;
|
|
2805
2827
|
},
|
|
2806
2828
|
async buildStart() {
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2829
|
+
const environment = this.environment?.name ?? "default";
|
|
2830
|
+
if (seenEnvironments.has(environment)) {
|
|
2831
|
+
seenEnvironments.clear();
|
|
2832
|
+
totals.folded = 0;
|
|
2833
|
+
totals.files = 0;
|
|
2834
|
+
totals.filesWithFolds = 0;
|
|
2835
|
+
totals.skipped.clear();
|
|
2836
|
+
survivors.length = 0;
|
|
2837
|
+
survivorKeys.clear();
|
|
2838
|
+
recipeConfigCache.clear();
|
|
2839
|
+
resetStaticCompilationSession(staticSession);
|
|
2840
|
+
}
|
|
2841
|
+
seenEnvironments.add(environment);
|
|
2815
2842
|
try {
|
|
2816
2843
|
await ensureContext();
|
|
2817
2844
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bamboocss/vite",
|
|
3
|
-
"version": "1.37.
|
|
3
|
+
"version": "1.37.3",
|
|
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.
|
|
44
|
-
"@bamboocss/
|
|
45
|
-
"@bamboocss/
|
|
46
|
-
"@bamboocss/node": "1.37.
|
|
47
|
-
"@bamboocss/
|
|
48
|
-
"@bamboocss/
|
|
49
|
-
"@bamboocss/
|
|
43
|
+
"@bamboocss/config": "1.37.3",
|
|
44
|
+
"@bamboocss/core": "1.37.3",
|
|
45
|
+
"@bamboocss/extractor": "1.37.3",
|
|
46
|
+
"@bamboocss/node": "1.37.3",
|
|
47
|
+
"@bamboocss/shared": "1.37.3",
|
|
48
|
+
"@bamboocss/types": "1.37.3",
|
|
49
|
+
"@bamboocss/logger": "1.37.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
53
53
|
"vite": "7.2.6",
|
|
54
|
-
"@bamboocss/fixture": "1.37.
|
|
54
|
+
"@bamboocss/fixture": "1.37.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"vite": ">=5"
|