@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 +23 -15
- package/dist/index.d.ts +11 -22
- package/dist/index.js +18 -2
- package/package.json +38 -25
package/README.md
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
# @teacss/astro
|
|
2
2
|
|
|
3
|
-
Astro integration for TeaCSS. It registers `@teacss/vite
|
|
4
|
-
|
|
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
|
-
|
|
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
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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{
|
|
2
|
-
|
|
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.
|
|
4
|
-
"description": "Astro integration for TeaCSS
|
|
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
|
-
".":
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
13
20
|
"./package.json": "./package.json"
|
|
14
21
|
},
|
|
15
|
-
"
|
|
22
|
+
"imports": {
|
|
23
|
+
"#src/*": "./dist/*"
|
|
24
|
+
},
|
|
16
25
|
"files": [
|
|
17
|
-
"dist",
|
|
18
|
-
"
|
|
26
|
+
"dist/**/*.js",
|
|
27
|
+
"dist/**/*.d.ts",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
19
30
|
],
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
"
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=26"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"astro": ">=6"
|
|
23
37
|
},
|
|
24
38
|
"dependencies": {
|
|
25
|
-
"@teacss/
|
|
26
|
-
"@teacss/engine": "0.9.4",
|
|
27
|
-
"@teacss/vite": "0.9.4"
|
|
39
|
+
"@teacss/vite": "0.10.2"
|
|
28
40
|
},
|
|
29
41
|
"devDependencies": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
42
|
+
"@types/node": "^22.20.5",
|
|
43
|
+
"astro": "7.4.2",
|
|
44
|
+
"typescript": "^5.9.3"
|
|
32
45
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
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
|
}
|