@teacss/postcss 0.4.6 → 0.5.0
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 +16 -43
- package/dist/esm.d.mts +2 -3
- package/dist/esm.mjs +5 -3
- package/dist/index.d.ts +4 -4
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,40 +1,20 @@
|
|
|
1
1
|
# @teacss/postcss
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
PostCSS 8 integration for TeaCSS.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Use this package when PostCSS is the application's CSS build boundary. It owns
|
|
11
|
-
TeaCSS's PostCSS plugin behavior and reports file and directory dependencies to
|
|
12
|
-
the surrounding runner; the runner remains responsible for file watching and
|
|
13
|
-
rebuilds. Projects whose Vite, Astro, Rsbuild, or Bun integration already owns
|
|
14
|
-
TeaCSS generation do not need to add this plugin as a second pipeline.
|
|
15
|
-
|
|
16
|
-
PostCSS is a host peer rather than a bundled runtime. Install one compatible
|
|
17
|
-
PostCSS 8 copy in the application:
|
|
18
|
-
|
|
19
|
-
| Package manager | Install command |
|
|
20
|
-
| --- | --- |
|
|
21
|
-
| npm | `npm install teacss && npm install --save-dev @teacss/postcss postcss` |
|
|
22
|
-
| pnpm | `pnpm add teacss && pnpm add --save-dev @teacss/postcss postcss` |
|
|
23
|
-
| Yarn | `yarn add teacss && yarn add --dev @teacss/postcss postcss` |
|
|
24
|
-
| Bun | `bun add teacss && bun add --dev @teacss/postcss postcss` |
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
5
|
+
```sh
|
|
6
|
+
npm install teacss
|
|
7
|
+
npm install --save-dev @teacss/postcss postcss
|
|
8
|
+
```
|
|
27
9
|
|
|
28
10
|
```js
|
|
29
11
|
import { pluginTeacss } from "@teacss/postcss";
|
|
30
12
|
|
|
31
|
-
export default {
|
|
32
|
-
plugins: [pluginTeacss()],
|
|
33
|
-
};
|
|
13
|
+
export default { plugins: [pluginTeacss()] };
|
|
34
14
|
```
|
|
35
15
|
|
|
36
|
-
Runners that serialize
|
|
37
|
-
|
|
16
|
+
Runners that serialize configuration to workers, including Next.js, should use
|
|
17
|
+
the package-name form:
|
|
38
18
|
|
|
39
19
|
```js
|
|
40
20
|
export default {
|
|
@@ -47,23 +27,16 @@ export default {
|
|
|
47
27
|
```css
|
|
48
28
|
@preset "standard";
|
|
49
29
|
@source "./src/**/*.{ts,tsx,html}";
|
|
50
|
-
@custom { --color-brand-500: #0f766e; }
|
|
51
30
|
@teacss;
|
|
52
31
|
```
|
|
53
32
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
The plugin reports both file dependencies and stable directory dependencies for
|
|
60
|
-
positive `@source` globs, so PostCSS runners can rebuild when a new matching file
|
|
61
|
-
is created. If a glob's static root does not exist yet, the directory dependency
|
|
62
|
-
falls back to its nearest existing parent. Relative `@source` globs resolve from
|
|
63
|
-
the CSS entry directory, including when the discovered entry is nested at
|
|
64
|
-
`src/index.css`.
|
|
33
|
+
`@teacss;` selects the insertion point. Each generated layer is emitted at
|
|
34
|
+
most once even when the stylesheet has multiple insertion directives. The
|
|
35
|
+
plugin resolves TeaCSS directives and `theme(...)`, reports file and stable
|
|
36
|
+
directory dependencies, and resolves relative `@source` globs from the CSS
|
|
37
|
+
entry.
|
|
65
38
|
|
|
66
|
-
|
|
39
|
+
The surrounding PostCSS runner owns watching and rebuilds. Do not add this
|
|
40
|
+
plugin when another TeaCSS build adapter already owns generation.
|
|
67
41
|
|
|
68
|
-
Pre-1.0.
|
|
69
|
-
it beside the `teacss` runtime and import it directly from `@teacss/postcss`.
|
|
42
|
+
Pre-1.0. Install one compatible PostCSS 8 host.
|
package/dist/esm.d.mts
CHANGED
|
@@ -16,6 +16,5 @@ interface TeacssPostcssPluginOptions {
|
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/esm.d.ts
|
|
19
|
-
declare function createPlugin(options: TeacssPostcssPluginOptions): (root: Root, result: Result) => Promise<void>;
|
|
20
|
-
//#endregion
|
|
21
|
-
export { createPlugin };
|
|
19
|
+
export declare function createPlugin(options: TeacssPostcssPluginOptions): (root: Root, result: Result) => Promise<void>;
|
|
20
|
+
//#endregion
|
package/dist/esm.mjs
CHANGED
|
@@ -45,7 +45,8 @@ async function parseApply(root, generator, directiveName) {
|
|
|
45
45
|
});
|
|
46
46
|
const resolvedRules = await Promise.all(rules.map(async (rule) => {
|
|
47
47
|
const group = readGroupApply(rule, directiveName);
|
|
48
|
-
const
|
|
48
|
+
const classNames = splitClassTokens(expandVariantGroup(expandClassGroups(group ? group.body : rule.params)));
|
|
49
|
+
const parsed = await resolveApplyTokens(classNames, generator);
|
|
49
50
|
const missing = missingApplyTokens(parsed);
|
|
50
51
|
if (missing.length) throw rule.error(formatMissingApplyTokens(missing));
|
|
51
52
|
return {
|
|
@@ -130,11 +131,12 @@ async function parseTheme(root, generator) {
|
|
|
130
131
|
async function transformDeclarationValue(value, generator) {
|
|
131
132
|
const replacements = [];
|
|
132
133
|
const tasks = [];
|
|
133
|
-
|
|
134
|
+
const ast = parse(value, {
|
|
134
135
|
context: "value",
|
|
135
136
|
parseCustomProperty: true,
|
|
136
137
|
positions: true
|
|
137
|
-
})
|
|
138
|
+
});
|
|
139
|
+
walk(ast, function(node) {
|
|
138
140
|
if (node.type !== "Function" || node.name !== "theme" && node.name !== "icon" || !node.loc) return;
|
|
139
141
|
tasks.push(resolveCssFunction(generator, node, (start, end) => value.slice(start, end)).then((replacement) => {
|
|
140
142
|
if (replacement === void 0) return;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Result, Root } from "postcss";
|
|
2
2
|
import { UserConfig } from "@teacss/core";
|
|
3
3
|
//#region src/types.d.ts
|
|
4
|
-
interface TeacssPostcssPluginOptions {
|
|
4
|
+
export interface TeacssPostcssPluginOptions {
|
|
5
5
|
content?: (string | {
|
|
6
6
|
raw: string;
|
|
7
7
|
extension: string;
|
|
@@ -16,12 +16,12 @@ interface TeacssPostcssPluginOptions {
|
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region src/index.d.ts
|
|
19
|
-
declare function pluginTeacss(options?: TeacssPostcssPluginOptions): {
|
|
19
|
+
export declare function pluginTeacss(options?: TeacssPostcssPluginOptions): {
|
|
20
20
|
postcssPlugin: string;
|
|
21
21
|
plugins: ((root: Root, result: Result) => Promise<void>)[];
|
|
22
22
|
};
|
|
23
|
-
declare namespace pluginTeacss {
|
|
23
|
+
export declare namespace pluginTeacss {
|
|
24
24
|
var postcss: boolean;
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
|
-
export {
|
|
27
|
+
export { pluginTeacss as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/postcss",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "PostCSS plugin for TeaCSS — generate utilities within a PostCSS pipeline.",
|
|
5
5
|
"homepage": "https://css.teasim.com",
|
|
6
6
|
"funding": "https://github.com/sponsors/billgo",
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
"dev": "tsdown --watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@teacss/config": "0.
|
|
27
|
-
"@teacss/core": "0.
|
|
28
|
-
"@teacss/directives": "0.
|
|
29
|
-
"@teacss/rule-helpers": "0.
|
|
30
|
-
"@teacss/runtime": "0.
|
|
26
|
+
"@teacss/config": "0.5.0",
|
|
27
|
+
"@teacss/core": "0.5.0",
|
|
28
|
+
"@teacss/directives": "0.5.0",
|
|
29
|
+
"@teacss/rule-helpers": "0.5.0",
|
|
30
|
+
"@teacss/runtime": "0.5.0",
|
|
31
31
|
"css-tree": "^3.2.1",
|
|
32
32
|
"tinyglobby": "^0.2.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@teacss/preset-standard": "0.
|
|
36
|
-
"@types/css-tree": "^2.
|
|
35
|
+
"@teacss/preset-standard": "0.5.0",
|
|
36
|
+
"@types/css-tree": "^3.2.0",
|
|
37
37
|
"consola": "^3.4.2",
|
|
38
|
-
"magic-string": "^1.
|
|
38
|
+
"magic-string": "^1.2.3",
|
|
39
39
|
"postcss": "^8.5.22"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|