@teacss/astro 0.9.4 → 0.10.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/README.md CHANGED
@@ -1,27 +1,35 @@
1
1
  # @teacss/astro
2
2
 
3
- Astro integration for TeaCSS. It registers `@teacss/vite` and injects the
4
- generated stylesheet into Astro pages.
3
+ The Astro integration for TeaCSS. It registers `@teacss/vite`, which runs the Rust engine in process, and imports the generated stylesheet into every page. It needs Node.js 26 or later and Astro 6 or later.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install --save-dev @teacss/astro astro
9
+ ```
10
+
11
+ ## Use
5
12
 
6
13
  ```ts
14
+ // astro.config.mjs
15
+ import { teacss } from "@teacss/astro";
7
16
  import { defineConfig } from "astro/config";
8
- import { pluginTeacss } from "@teacss/astro";
9
17
 
10
- export default defineConfig({
11
- integrations: [pluginTeacss()],
12
- });
18
+ export default defineConfig({ integrations: [teacss()] });
13
19
  ```
14
20
 
15
- Set `injectEntry: false` to import `virtual:teacss.css` yourself. A string
16
- `injectEntry` fully replaces the default import and must be a complete module
17
- statement. Use `injectExtra` to append statements while keeping the default:
21
+ Configuration lives in a CSS entry. Create `index.css` at the project root:
18
22
 
19
- ```ts
20
- pluginTeacss({
21
- injectExtra: ['import "./src/styles.css";'],
22
- });
23
+ ```css
24
+ @presets "standard,icons,official";
25
+ @source "./src/**/*.{astro,md,mdx,js,jsx,ts,tsx}";
26
+ @teacss;
23
27
  ```
24
28
 
25
- Use `@teacss/vite` directly for non-Astro Vite applications.
29
+ Every page gets the generated CSS; `injectEntry: false` turns that off, and a string names another module to import instead. The dev server serves the inspector at `/__teacss`.
30
+
31
+ ## Documentation
26
32
 
27
- Pre-1.0. Install this adapter and `teacss` as development dependencies.
33
+ - [Build integrations](https://github.com/teacss/teacss-rs/blob/master/skills/teacss/references/integrations.md) and [their options](https://github.com/teacss/teacss-rs/blob/master/skills/teacss/references/integrations.md#options)
34
+ - [The CSS entry](https://github.com/teacss/teacss-rs/blob/master/skills/teacss/references/setup.md#css-entry)
35
+ - [The TeaCSS skill](https://github.com/teacss/teacss-rs/blob/master/skills/teacss/SKILL.md) for syntax, presets and tooling
package/dist/index.d.ts CHANGED
@@ -1,23 +1,12 @@
1
- import { TeacssVitePluginConfig } from "@teacss/vite";
2
- import { UserConfigDefaults } from "@teacss/core";
3
- import { AstroIntegration } from "astro";
4
- //#region src/index.d.ts
5
- export interface AstroIntegrationConfig<Theme extends object = object> extends TeacssVitePluginConfig<Theme> {
6
- /**
7
- * Inject the TeaCSS entry (`import "virtual:teacss.css"`) into every page.
8
- * Pass complete module code to replace the default statement. A replacement
9
- * must import `virtual:teacss.css` itself when the generated stylesheet is
10
- * still needed; use `injectExtra` to add modules without replacing it.
11
- *
12
- * @default true
13
- */
14
- injectEntry?: boolean | string;
15
- /**
16
- * Extra module statements to inject into every page.
17
- *
18
- * @default []
19
- */
20
- injectExtra?: string[];
1
+ import { type TeacssViteOptions } from "@teacss/vite";
2
+ import type { AstroIntegration } from "astro";
3
+ export type { ShellOptions, TeacssViteOptions } from "@teacss/vite";
4
+ export interface TeacssAstroOptions extends TeacssViteOptions {
5
+ /** Import the generated stylesheet into every page; a string names the module to import instead of `virtual:teacss.css`. Default `true`. */
6
+ injectEntry?: boolean | string;
7
+ /** Module statements injected into every page after the entry. */
8
+ injectExtra?: string[];
21
9
  }
22
- export declare function pluginTeacss<Theme extends object>(options?: AstroIntegrationConfig<Theme>, defaults?: UserConfigDefaults): AstroIntegration;
23
- //#endregion
10
+ /** v10.2 §3.2: registers `@teacss/vite` with Astro's Vite and injects the stylesheet import at `page-ssr`. */
11
+ export declare function teacss(options?: TeacssAstroOptions): AstroIntegration;
12
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,18 @@
1
- import{join as e}from"node:path";import{pluginTeacss as t}from"@teacss/vite";import{normalizePath as n}from"vite";const r=`teacss-astro`;function i(t){let i=t.join(`
2
- `),a,o;return{name:`teacss:astro`,enforce:`pre`,configResolved(e){a=e.root;let t=e.plugins.find(e=>e.name===`teacss:api`)?.api;if(!t)throw Error(`[@teacss/astro] Unable to find TeaCSS Vite plugin API`);o=t.getContext()},async resolveId(t,i){if(t===r)return t;let{RESOLVED_ID_RE:s}=await o.getVMPRegexes();if(s.test(t))return this.resolve(n(e(a,t)),i,{skipSelf:!0})},load(e){if(e===r)return i}}}function a(e={},n={}){let{injectEntry:a=!0,injectExtra:o=[],...s}=e,c=Object.values(s).some(e=>e!==void 0)?s:void 0,l=[];return a&&l.push(typeof a==`string`?a:`import "virtual:teacss.css";`),l.push(...o),{name:`@teacss/astro`,hooks:{"astro:config:setup":({updateConfig:e,injectScript:a})=>{e({vite:{plugins:[...t(c,n),i(l)]}}),l.length&&a(`page-ssr`,`import ${JSON.stringify(r)}`)}}}}export{a as pluginTeacss};
1
+ import { teacss as vite } from "@teacss/vite";
2
+ /** v10.2 §3.2: registers `@teacss/vite` with Astro's Vite and injects the stylesheet import at `page-ssr`. */
3
+ export function teacss(options = {}) {
4
+ const { injectEntry = true, injectExtra = [], ...viteOptions } = options;
5
+ return {
6
+ name: "@teacss/astro",
7
+ hooks: {
8
+ "astro:config:setup": ({ updateConfig, injectScript }) => {
9
+ updateConfig({ vite: { plugins: vite(viteOptions) } });
10
+ if (injectEntry !== false)
11
+ injectScript("page-ssr", `import ${JSON.stringify(typeof injectEntry === "string" ? injectEntry : "virtual:teacss.css")};`);
12
+ for (const statement of injectExtra)
13
+ injectScript("page-ssr", statement);
14
+ },
15
+ },
16
+ };
17
+ }
18
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,43 +1,56 @@
1
1
  {
2
2
  "name": "@teacss/astro",
3
- "version": "0.9.4",
4
- "description": "Astro integration for TeaCSS — registers the Vite plugin and injects the generated stylesheet.",
5
- "homepage": "https://css.teasim.com",
6
- "funding": "https://github.com/sponsors/billgo",
3
+ "version": "0.10.2",
4
+ "description": "Astro integration for TeaCSS on the Rust engine: registers @teacss/vite and injects the generated stylesheet",
7
5
  "license": "MIT",
8
- "author": "Billgo <hi@billgo.me>",
9
- "sideEffects": false,
10
6
  "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/teacss/teacss-rs.git",
10
+ "directory": "packages/astro"
11
+ },
12
+ "homepage": "https://github.com/teacss/teacss-rs/tree/master/packages/astro#readme",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
11
15
  "exports": {
12
- ".": "./dist/index.js",
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
13
20
  "./package.json": "./package.json"
14
21
  },
15
- "types": "./dist/index.d.ts",
22
+ "imports": {
23
+ "#src/*": "./dist/*"
24
+ },
16
25
  "files": [
17
- "dist",
18
- "README.md"
26
+ "dist/**/*.js",
27
+ "dist/**/*.d.ts",
28
+ "README.md",
29
+ "LICENSE"
19
30
  ],
20
- "scripts": {
21
- "build": "bunx tsdown --config tsdown.config.mts",
22
- "dev": "tsdown --watch"
31
+ "sideEffects": false,
32
+ "engines": {
33
+ "node": ">=26"
34
+ },
35
+ "peerDependencies": {
36
+ "astro": ">=6"
23
37
  },
24
38
  "dependencies": {
25
- "@teacss/core": "0.9.4",
26
- "@teacss/engine": "0.9.4",
27
- "@teacss/vite": "0.9.4"
39
+ "@teacss/vite": "0.10.2"
28
40
  },
29
41
  "devDependencies": {
30
- "astro": "^7.3.1",
31
- "vite": "^8.2.2"
42
+ "@types/node": "^22.20.5",
43
+ "astro": "7.4.2",
44
+ "typescript": "^5.9.3"
32
45
  },
33
- "peerDependencies": {
34
- "astro": ">=7.0.0",
35
- "vite": ">=8.0.0"
36
- },
37
- "engines": {
38
- "node": ">=22.12.0"
46
+ "scripts": {
47
+ "build:ts": "node -e \"for (const d of ['build','dist']) require('fs').rmSync(d,{recursive:true,force:true})\" && tsc -p tsconfig.json && tsc -p tsconfig.test.json",
48
+ "build": "npm run build:ts",
49
+ "check:types": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
50
+ "test": "npm run build:ts && node --test \"build/tests/**/*.test.js\""
39
51
  },
40
52
  "publishConfig": {
41
- "access": "public"
53
+ "access": "public",
54
+ "registry": "https://registry.npmjs.org/"
42
55
  }
43
56
  }