@bamboocss/vite 1.39.0 → 1.39.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.
package/dist/index.cjs CHANGED
@@ -366,6 +366,8 @@ const bamboocssCss = (options) => {
366
366
  const builder = new _bamboocss_node.Builder();
367
367
  let server;
368
368
  let command = "build";
369
+ /** The run's own `build` options, for a bundler with no per-environment config. */
370
+ let ssrBuildOptions;
369
371
  /**
370
372
  * Serialised, because both `load` and the watcher can reach it and `Builder` keeps one
371
373
  * context. Two overlapping passes would extract into the same encoder and emit the
@@ -427,6 +429,10 @@ const bamboocssCss = (options) => {
427
429
  configResolved(config) {
428
430
  command = config.command;
429
431
  session.sourcemap = config.build.sourcemap;
432
+ ssrBuildOptions = {
433
+ ssr: config.build.ssr,
434
+ ssrEmitAssets: config.build.ssrEmitAssets
435
+ };
430
436
  /**
431
437
  * Tell Vite that `bamboo.config.ts` is a config file, so editing one restarts the server.
432
438
  *
@@ -540,6 +546,25 @@ const bamboocssCss = (options) => {
540
546
  })} ${pending.length === 1 ? "has" : "have"} not been compiled in this run. The full extracted stylesheet ships — nothing is missing from it.`);
541
547
  if (!servedEnvironments.has(environment?.name ?? "default")) return;
542
548
  if (!session.transformedFiles.size) return;
549
+ /**
550
+ * An SSR bundle emits no CSS assets, and is not supposed to.
551
+ *
552
+ * `build.ssrEmitAssets` is off by default, so Vite discards them: the client build is
553
+ * what carries the stylesheet, and a server bundle that imports `virtual:bamboo.css`
554
+ * from shared code — a root component, a layout — still asks this plugin to load it.
555
+ * Which means the environment *served* the sheet and then emitted nothing, and the
556
+ * check below read that as the failure it exists to catch.
557
+ *
558
+ * It fails a build that is entirely correct. Qwik's `vite build --ssr` is the shape
559
+ * that showed it: 7/7 calls compiled, the client bundle carrying the stylesheet, and
560
+ * the server bundle refusing to finish. React Router does not hit it only because its
561
+ * plugin turns `ssrEmitAssets` on.
562
+ *
563
+ * Read per environment where that exists, falling back to the run's own config, so
564
+ * Vite 5's single-config builds are answered by the same question.
565
+ */
566
+ const buildOptions = environment?.config?.build ?? ssrBuildOptions;
567
+ if (buildOptions?.ssr && !buildOptions.ssrEmitAssets) return;
543
568
  if (!Object.values(bundle).some((output) => {
544
569
  if (!carriesGeneratedCss(output)) return false;
545
570
  return (typeof output.source === "string" ? output.source : Buffer.from(output.source).toString()).includes("--made-with-bamboo");
package/dist/index.mjs CHANGED
@@ -336,6 +336,8 @@ const bamboocssCss = (options) => {
336
336
  const builder = new Builder();
337
337
  let server;
338
338
  let command = "build";
339
+ /** The run's own `build` options, for a bundler with no per-environment config. */
340
+ let ssrBuildOptions;
339
341
  /**
340
342
  * Serialised, because both `load` and the watcher can reach it and `Builder` keeps one
341
343
  * context. Two overlapping passes would extract into the same encoder and emit the
@@ -397,6 +399,10 @@ const bamboocssCss = (options) => {
397
399
  configResolved(config) {
398
400
  command = config.command;
399
401
  session.sourcemap = config.build.sourcemap;
402
+ ssrBuildOptions = {
403
+ ssr: config.build.ssr,
404
+ ssrEmitAssets: config.build.ssrEmitAssets
405
+ };
400
406
  /**
401
407
  * Tell Vite that `bamboo.config.ts` is a config file, so editing one restarts the server.
402
408
  *
@@ -510,6 +516,25 @@ const bamboocssCss = (options) => {
510
516
  })} ${pending.length === 1 ? "has" : "have"} not been compiled in this run. The full extracted stylesheet ships — nothing is missing from it.`);
511
517
  if (!servedEnvironments.has(environment?.name ?? "default")) return;
512
518
  if (!session.transformedFiles.size) return;
519
+ /**
520
+ * An SSR bundle emits no CSS assets, and is not supposed to.
521
+ *
522
+ * `build.ssrEmitAssets` is off by default, so Vite discards them: the client build is
523
+ * what carries the stylesheet, and a server bundle that imports `virtual:bamboo.css`
524
+ * from shared code — a root component, a layout — still asks this plugin to load it.
525
+ * Which means the environment *served* the sheet and then emitted nothing, and the
526
+ * check below read that as the failure it exists to catch.
527
+ *
528
+ * It fails a build that is entirely correct. Qwik's `vite build --ssr` is the shape
529
+ * that showed it: 7/7 calls compiled, the client bundle carrying the stylesheet, and
530
+ * the server bundle refusing to finish. React Router does not hit it only because its
531
+ * plugin turns `ssrEmitAssets` on.
532
+ *
533
+ * Read per environment where that exists, falling back to the run's own config, so
534
+ * Vite 5's single-config builds are answered by the same question.
535
+ */
536
+ const buildOptions = environment?.config?.build ?? ssrBuildOptions;
537
+ if (buildOptions?.ssr && !buildOptions.ssrEmitAssets) return;
513
538
  if (!Object.values(bundle).some((output) => {
514
539
  if (!carriesGeneratedCss(output)) return false;
515
540
  return (typeof output.source === "string" ? output.source : Buffer.from(output.source).toString()).includes("--made-with-bamboo");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.39.0",
3
+ "version": "1.39.1",
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/core": "1.39.0",
44
- "@bamboocss/extractor": "1.39.0",
45
- "@bamboocss/config": "1.39.0",
46
- "@bamboocss/logger": "1.39.0",
47
- "@bamboocss/node": "1.39.0",
48
- "@bamboocss/shared": "1.39.0",
49
- "@bamboocss/types": "1.39.0"
43
+ "@bamboocss/config": "1.39.1",
44
+ "@bamboocss/extractor": "1.39.1",
45
+ "@bamboocss/core": "1.39.1",
46
+ "@bamboocss/logger": "1.39.1",
47
+ "@bamboocss/node": "1.39.1",
48
+ "@bamboocss/shared": "1.39.1",
49
+ "@bamboocss/types": "1.39.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
53
  "vite": "7.2.6",
54
- "@bamboocss/fixture": "1.39.0"
54
+ "@bamboocss/fixture": "1.39.1"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vite": ">=5"