@teacss/vite 0.10.6 → 0.10.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/README.md CHANGED
@@ -33,7 +33,7 @@ Import the generated CSS once from the application entry:
33
33
  import "virtual:teacss.css";
34
34
  ```
35
35
 
36
- The dev server also serves the inspector at `/__teacss`; pass `inspector: false` to turn it off. In dev, the dev server serves the Standard preset's fonts under `<base>__teacss_fonts/`, prefixed with `server.origin` when it is set; a build emits them as assets.
36
+ The dev server also serves the inspector at `/__teacss`; pass `inspector: false` to turn it off. In dev, the dev server serves the Standard preset's fonts under `<base>__teacss_fonts/`, prefixed with `server.origin` when it is set. The generated CSS writes these URLs as `URL(`, as teacss-ts does: CSS function names are case-insensitive, and Vite skips PostCSS for a stylesheet with no lowercase `url(`. A build emits the fonts as assets.
37
37
 
38
38
  Other plugins reach the project through the `api` of the plugin named `teacss:api` (`TeacssVitePluginApi`): `getProject()` returns it, and `invalidate()` updates the generated CSS on the dev client after a module was registered through `getProject().transform()`.
39
39
 
package/dist/plugin.js CHANGED
@@ -221,12 +221,17 @@ export function teacss(options = {}) {
221
221
  }
222
222
  /** `css` with the fonts it inlines linked from the dev server, which serves the bytes recorded here. */
223
223
  function linkDevFonts(css) {
224
- return extractBundledFonts(css, (digest, bytes) => {
224
+ // As Vite's own dev asset URLs: a page served by another server (`server.origin`) loads them from Vite.
225
+ const prefix = `${config.server.origin ?? ""}${config.base}${DEV_FONTS}/`;
226
+ const linked = extractBundledFonts(css, (digest, bytes) => {
225
227
  const name = `teacss-${digest}.woff2`;
226
228
  devFonts.set(name, bytes);
227
- // As Vite's own dev asset URLs: a page served by another server (`server.origin`) loads them from Vite.
228
- return `${config.server.origin ?? ""}${config.base}${DEV_FONTS}/${name}`;
229
+ return `${prefix}${name}`;
229
230
  }).css;
231
+ // Vite runs PostCSS on a stylesheet with a lowercase `url(`, and these URLs are final. CSS function names
232
+ // are case-insensitive, so writing them `URL(`, as teacss-ts does, lets the sheet skip PostCSS.
233
+ const quoted = JSON.stringify(prefix).slice(0, -1);
234
+ return linked.replaceAll(`url(${quoted}`, `URL(${quoted}`);
230
235
  }
231
236
  /** A font this instance has not linked yet, as in CSS another process generated, is looked up in the project's CSS. */
232
237
  function devFont(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teacss/vite",
3
- "version": "0.10.6",
3
+ "version": "0.10.8",
4
4
  "description": "Vite plugin for TeaCSS on the Rust engine (@teacss/engine)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -36,8 +36,8 @@
36
36
  "vite": ">=7"
37
37
  },
38
38
  "dependencies": {
39
- "@teacss/engine": "0.10.6",
40
- "@teacss/inspector": "0.10.6"
39
+ "@teacss/engine": "0.10.8",
40
+ "@teacss/inspector": "0.10.8"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.20.5",