@bamboocss/vite 1.37.6 → 1.37.8

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
@@ -158,6 +158,23 @@ const VIRTUAL_CSS_ID = "virtual:bamboo.css";
158
158
  */
159
159
  const RESOLVED_ID = `\0${VIRTUAL_CSS_ID}`;
160
160
  /**
161
+ * The queries Vite appends to a CSS module — `?url`, `?raw`, `?inline`, and the
162
+ * `?transform-only` that its own `?url` handling rewrites to.
163
+ *
164
+ * None of them resolved here, so asking the stylesheet for its URL failed as an unresolvable
165
+ * path. Rather than answering each one, the query is carried onto the resolved id and the CSS
166
+ * is served for whatever it is: Vite's CSS pipeline already knows what each means, and
167
+ * answering them here would be a second, worse copy of it.
168
+ *
169
+ * `?url` in particular makes the sheet an asset of its own rather than part of whatever
170
+ * stylesheet the importer belongs to. That is what `?url` means rather than a shortcoming, but
171
+ * it is not what a project concatenating Bamboo's CSS into one global stylesheet wants.
172
+ */
173
+ const queryOf = (id) => {
174
+ const at = id.indexOf("?");
175
+ return at === -1 ? "" : id.slice(at);
176
+ };
177
+ /**
161
178
  * A thrown value Vite can actually report.
162
179
  *
163
180
  * `catch` binds `unknown`, and anything under compilation — a dependency, a config hook, a
@@ -333,11 +350,14 @@ const bamboocssCss = (options) => {
333
350
  session.sourcemap = config.build.sourcemap;
334
351
  },
335
352
  resolveId(id) {
336
- if (id === "virtual:bamboo.css") return RESOLVED_ID;
337
- return null;
353
+ const query = queryOf(id);
354
+ const base = id.slice(0, id.length - query.length);
355
+ if (base !== "virtual:bamboo.css" && base !== RESOLVED_ID) return null;
356
+ return `${RESOLVED_ID}${query}`;
338
357
  },
339
358
  async load(id) {
340
- if (id !== RESOLVED_ID) return null;
359
+ const query = queryOf(id);
360
+ if (id.slice(0, id.length - query.length) !== RESOLVED_ID) return null;
341
361
  servedEnvironments.add(this.environment?.name ?? "default");
342
362
  let css;
343
363
  try {
package/dist/index.mjs CHANGED
@@ -128,6 +128,23 @@ const VIRTUAL_CSS_ID = "virtual:bamboo.css";
128
128
  */
129
129
  const RESOLVED_ID = `\0${VIRTUAL_CSS_ID}`;
130
130
  /**
131
+ * The queries Vite appends to a CSS module — `?url`, `?raw`, `?inline`, and the
132
+ * `?transform-only` that its own `?url` handling rewrites to.
133
+ *
134
+ * None of them resolved here, so asking the stylesheet for its URL failed as an unresolvable
135
+ * path. Rather than answering each one, the query is carried onto the resolved id and the CSS
136
+ * is served for whatever it is: Vite's CSS pipeline already knows what each means, and
137
+ * answering them here would be a second, worse copy of it.
138
+ *
139
+ * `?url` in particular makes the sheet an asset of its own rather than part of whatever
140
+ * stylesheet the importer belongs to. That is what `?url` means rather than a shortcoming, but
141
+ * it is not what a project concatenating Bamboo's CSS into one global stylesheet wants.
142
+ */
143
+ const queryOf = (id) => {
144
+ const at = id.indexOf("?");
145
+ return at === -1 ? "" : id.slice(at);
146
+ };
147
+ /**
131
148
  * A thrown value Vite can actually report.
132
149
  *
133
150
  * `catch` binds `unknown`, and anything under compilation — a dependency, a config hook, a
@@ -303,11 +320,14 @@ const bamboocssCss = (options) => {
303
320
  session.sourcemap = config.build.sourcemap;
304
321
  },
305
322
  resolveId(id) {
306
- if (id === "virtual:bamboo.css") return RESOLVED_ID;
307
- return null;
323
+ const query = queryOf(id);
324
+ const base = id.slice(0, id.length - query.length);
325
+ if (base !== "virtual:bamboo.css" && base !== RESOLVED_ID) return null;
326
+ return `${RESOLVED_ID}${query}`;
308
327
  },
309
328
  async load(id) {
310
- if (id !== RESOLVED_ID) return null;
329
+ const query = queryOf(id);
330
+ if (id.slice(0, id.length - query.length) !== RESOLVED_ID) return null;
311
331
  servedEnvironments.add(this.environment?.name ?? "default");
312
332
  let css;
313
333
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bamboocss/vite",
3
- "version": "1.37.6",
3
+ "version": "1.37.8",
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.6",
44
- "@bamboocss/extractor": "1.37.6",
45
- "@bamboocss/core": "1.37.6",
46
- "@bamboocss/node": "1.37.6",
47
- "@bamboocss/logger": "1.37.6",
48
- "@bamboocss/shared": "1.37.6",
49
- "@bamboocss/types": "1.37.6"
43
+ "@bamboocss/config": "1.37.8",
44
+ "@bamboocss/core": "1.37.8",
45
+ "@bamboocss/extractor": "1.37.8",
46
+ "@bamboocss/logger": "1.37.8",
47
+ "@bamboocss/node": "1.37.8",
48
+ "@bamboocss/shared": "1.37.8",
49
+ "@bamboocss/types": "1.37.8"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
53
  "vite": "7.2.6",
54
- "@bamboocss/fixture": "1.37.6"
54
+ "@bamboocss/fixture": "1.37.8"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "vite": ">=5"