@teacss/postcss 0.6.7 → 0.6.9
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/esm.mjs +18 -1
- package/package.json +7 -7
package/dist/esm.mjs
CHANGED
|
@@ -108,7 +108,24 @@ async function parseApply(root, generator, directiveName, filename) {
|
|
|
108
108
|
if (hostRule.type === "rule" && !hostRule.nodes?.length) hostRule.remove();
|
|
109
109
|
}
|
|
110
110
|
const dependencies = await generateApplyPreflights(generator, generated, filename);
|
|
111
|
-
if (dependencies) root
|
|
111
|
+
if (dependencies) appendDependencies(root, postcss.parse(dependencies));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Append dependency CSS the way `@teacss/directives` does: after the
|
|
115
|
+
* stylesheet's own trailing whitespace, on a new line, with the generated
|
|
116
|
+
* text's whitespace intact. Appending a parsed root would let PostCSS
|
|
117
|
+
* normalize each node's leading whitespace away.
|
|
118
|
+
*/
|
|
119
|
+
function appendDependencies(root, dependencies) {
|
|
120
|
+
const nodes = dependencies.nodes.map((node) => ({
|
|
121
|
+
before: node.raws.before,
|
|
122
|
+
node
|
|
123
|
+
}));
|
|
124
|
+
if (!nodes.length) return;
|
|
125
|
+
const trailing = root.raws.after ?? "";
|
|
126
|
+
for (const { node } of nodes) root.append(node);
|
|
127
|
+
for (const [index, { before, node }] of nodes.entries()) node.raws.before = index === 0 ? `${trailing}\n` : before;
|
|
128
|
+
root.raws.after = dependencies.raws.after ?? "";
|
|
112
129
|
}
|
|
113
130
|
//#endregion
|
|
114
131
|
//#region src/screen.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/postcss",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
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,16 +23,16 @@
|
|
|
23
23
|
"dev": "tsdown --watch"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@teacss/config": "0.6.
|
|
27
|
-
"@teacss/core": "0.6.
|
|
28
|
-
"@teacss/directives": "0.6.
|
|
29
|
-
"@teacss/rule-helpers": "0.6.
|
|
30
|
-
"@teacss/runtime": "0.6.
|
|
26
|
+
"@teacss/config": "0.6.9",
|
|
27
|
+
"@teacss/core": "0.6.9",
|
|
28
|
+
"@teacss/directives": "0.6.9",
|
|
29
|
+
"@teacss/rule-helpers": "0.6.9",
|
|
30
|
+
"@teacss/runtime": "0.6.9",
|
|
31
31
|
"css-tree": "^3.2.1",
|
|
32
32
|
"tinyglobby": "^0.2.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@teacss/preset-standard": "0.6.
|
|
35
|
+
"@teacss/preset-standard": "0.6.9",
|
|
36
36
|
"@types/css-tree": "^3.2.0",
|
|
37
37
|
"consola": "^3.4.2",
|
|
38
38
|
"magic-string": "^1.2.3",
|