@bamboocss/vite 1.37.1 → 1.37.2

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
@@ -245,6 +245,15 @@ const optimizeStaticCssAssets = (bundle, session, options = {}) => {
245
245
  */
246
246
  const bamboocssCss = (options) => {
247
247
  const { configPath, cwd, session, renameCssAsset = true } = options;
248
+ /**
249
+ * Environments whose `load` served the virtual stylesheet.
250
+ *
251
+ * The lost-sheet guard below is about an asset that existed and then went missing, so it
252
+ * can only be asked of an environment that asked for one. An SSR bundle never imports the
253
+ * stylesheet — the client build emits it — and firing there turned a correct two-environment
254
+ * build into a hard failure.
255
+ */
256
+ const servedEnvironments = /* @__PURE__ */ new Set();
248
257
  const builder = new _bamboocss_node.Builder();
249
258
  let server;
250
259
  let command = "build";
@@ -305,6 +314,7 @@ const bamboocssCss = (options) => {
305
314
  },
306
315
  async load(id) {
307
316
  if (id !== RESOLVED_ID) return null;
317
+ servedEnvironments.add(this.environment?.name ?? "default");
308
318
  let css;
309
319
  try {
310
320
  css = await generate();
@@ -334,6 +344,7 @@ const bamboocssCss = (options) => {
334
344
  order: "post",
335
345
  handler(_, bundle) {
336
346
  optimizeStaticCssAssets(bundle, session, { rename: renameCssAsset });
347
+ if (!servedEnvironments.has(this.environment?.name ?? "default")) return;
337
348
  if (!session.transformedFiles.size) return;
338
349
  if (!Object.values(bundle).some((output) => {
339
350
  if (!carriesGeneratedCss(output)) return false;
@@ -2763,6 +2774,8 @@ const formatSkipped = (id, skipped) => {
2763
2774
  const bamboocss = (options = {}) => {
2764
2775
  const { configPath, cwd, reportSkipped = false, reportSummary = true, maxRecipeStates, renameCssAsset = true } = options;
2765
2776
  if (maxRecipeStates !== void 0 && (!Number.isSafeInteger(maxRecipeStates) || maxRecipeStates < 1)) throw new Error("bamboocss: `maxRecipeStates` must be a positive safe integer.");
2777
+ /** Environments whose `buildStart` has run in the build currently in progress. */
2778
+ const seenEnvironments = /* @__PURE__ */ new Set();
2766
2779
  /** Totals across the build, for the summary. */
2767
2780
  const totals = {
2768
2781
  folded: 0,
@@ -2834,14 +2847,19 @@ const bamboocss = (options = {}) => {
2834
2847
  command = config.command;
2835
2848
  },
2836
2849
  async buildStart() {
2837
- totals.folded = 0;
2838
- totals.files = 0;
2839
- totals.filesWithFolds = 0;
2840
- totals.skipped.clear();
2841
- survivors.length = 0;
2842
- survivorKeys.clear();
2843
- recipeConfigCache.clear();
2844
- resetStaticCompilationSession(staticSession);
2850
+ const environment = this.environment?.name ?? "default";
2851
+ if (seenEnvironments.has(environment)) {
2852
+ seenEnvironments.clear();
2853
+ totals.folded = 0;
2854
+ totals.files = 0;
2855
+ totals.filesWithFolds = 0;
2856
+ totals.skipped.clear();
2857
+ survivors.length = 0;
2858
+ survivorKeys.clear();
2859
+ recipeConfigCache.clear();
2860
+ resetStaticCompilationSession(staticSession);
2861
+ }
2862
+ seenEnvironments.add(environment);
2845
2863
  try {
2846
2864
  await ensureContext();
2847
2865
  } catch (error) {
package/dist/index.mjs CHANGED
@@ -215,6 +215,15 @@ const optimizeStaticCssAssets = (bundle, session, options = {}) => {
215
215
  */
216
216
  const bamboocssCss = (options) => {
217
217
  const { configPath, cwd, session, renameCssAsset = true } = options;
218
+ /**
219
+ * Environments whose `load` served the virtual stylesheet.
220
+ *
221
+ * The lost-sheet guard below is about an asset that existed and then went missing, so it
222
+ * can only be asked of an environment that asked for one. An SSR bundle never imports the
223
+ * stylesheet — the client build emits it — and firing there turned a correct two-environment
224
+ * build into a hard failure.
225
+ */
226
+ const servedEnvironments = /* @__PURE__ */ new Set();
218
227
  const builder = new Builder();
219
228
  let server;
220
229
  let command = "build";
@@ -275,6 +284,7 @@ const bamboocssCss = (options) => {
275
284
  },
276
285
  async load(id) {
277
286
  if (id !== RESOLVED_ID) return null;
287
+ servedEnvironments.add(this.environment?.name ?? "default");
278
288
  let css;
279
289
  try {
280
290
  css = await generate();
@@ -304,6 +314,7 @@ const bamboocssCss = (options) => {
304
314
  order: "post",
305
315
  handler(_, bundle) {
306
316
  optimizeStaticCssAssets(bundle, session, { rename: renameCssAsset });
317
+ if (!servedEnvironments.has(this.environment?.name ?? "default")) return;
307
318
  if (!session.transformedFiles.size) return;
308
319
  if (!Object.values(bundle).some((output) => {
309
320
  if (!carriesGeneratedCss(output)) return false;
@@ -2733,6 +2744,8 @@ const formatSkipped = (id, skipped) => {
2733
2744
  const bamboocss = (options = {}) => {
2734
2745
  const { configPath, cwd, reportSkipped = false, reportSummary = true, maxRecipeStates, renameCssAsset = true } = options;
2735
2746
  if (maxRecipeStates !== void 0 && (!Number.isSafeInteger(maxRecipeStates) || maxRecipeStates < 1)) throw new Error("bamboocss: `maxRecipeStates` must be a positive safe integer.");
2747
+ /** Environments whose `buildStart` has run in the build currently in progress. */
2748
+ const seenEnvironments = /* @__PURE__ */ new Set();
2736
2749
  /** Totals across the build, for the summary. */
2737
2750
  const totals = {
2738
2751
  folded: 0,
@@ -2804,14 +2817,19 @@ const bamboocss = (options = {}) => {
2804
2817
  command = config.command;
2805
2818
  },
2806
2819
  async buildStart() {
2807
- totals.folded = 0;
2808
- totals.files = 0;
2809
- totals.filesWithFolds = 0;
2810
- totals.skipped.clear();
2811
- survivors.length = 0;
2812
- survivorKeys.clear();
2813
- recipeConfigCache.clear();
2814
- resetStaticCompilationSession(staticSession);
2820
+ const environment = this.environment?.name ?? "default";
2821
+ if (seenEnvironments.has(environment)) {
2822
+ seenEnvironments.clear();
2823
+ totals.folded = 0;
2824
+ totals.files = 0;
2825
+ totals.filesWithFolds = 0;
2826
+ totals.skipped.clear();
2827
+ survivors.length = 0;
2828
+ survivorKeys.clear();
2829
+ recipeConfigCache.clear();
2830
+ resetStaticCompilationSession(staticSession);
2831
+ }
2832
+ seenEnvironments.add(environment);
2815
2833
  try {
2816
2834
  await ensureContext();
2817
2835
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.37.1",
3
+ "version": "1.37.2",
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.1",
44
- "@bamboocss/extractor": "1.37.1",
45
- "@bamboocss/logger": "1.37.1",
46
- "@bamboocss/node": "1.37.1",
47
- "@bamboocss/core": "1.37.1",
48
- "@bamboocss/shared": "1.37.1",
49
- "@bamboocss/types": "1.37.1"
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"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
53
  "vite": "7.2.6",
54
- "@bamboocss/fixture": "1.37.1"
54
+ "@bamboocss/fixture": "1.37.2"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vite": ">=5"