@teacss/postcss 0.5.1 → 0.5.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/dist/esm.mjs +7 -3
- package/package.json +7 -7
package/dist/esm.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { hasIconFn, hasThemeFn } from "@teacss/rule-helpers";
|
|
|
7
7
|
import { defaultFilesystemGlobs } from "@teacss/runtime";
|
|
8
8
|
import postcss from "postcss";
|
|
9
9
|
import { glob, isDynamicPattern } from "tinyglobby";
|
|
10
|
-
import { formatMissingApplyTokens, missingApplyTokens, prepareApplyUtilities, renderStandaloneApplyUtility, resolveApplyTokens, resolveCssFunction, resolveScreenQuery } from "@teacss/directives/core";
|
|
10
|
+
import { formatMissingApplyTokens, generateApplyPreflights, missingApplyTokens, prepareApplyUtilities, renderStandaloneApplyUtility, resolveApplyTokens, resolveCssFunction, resolveScreenQuery } from "@teacss/directives/core";
|
|
11
11
|
import { generate, parse, walk } from "css-tree";
|
|
12
12
|
//#region src/apply.ts
|
|
13
13
|
/**
|
|
@@ -36,10 +36,11 @@ function readGroupApply(rule, directiveName) {
|
|
|
36
36
|
consumed
|
|
37
37
|
} : void 0;
|
|
38
38
|
}
|
|
39
|
-
async function parseApply(root, generator, directiveName) {
|
|
39
|
+
async function parseApply(root, generator, directiveName, filename) {
|
|
40
40
|
const rules = [];
|
|
41
41
|
const lastParentAfterNode = /* @__PURE__ */ new Map();
|
|
42
42
|
const applyHosts = /* @__PURE__ */ new Map();
|
|
43
|
+
const generated = [];
|
|
43
44
|
root.walkAtRules(directiveName, (rule) => {
|
|
44
45
|
rules.push(rule);
|
|
45
46
|
});
|
|
@@ -58,6 +59,7 @@ async function parseApply(root, generator, directiveName) {
|
|
|
58
59
|
for (const { parsed, rule, consumed } of resolvedRules) {
|
|
59
60
|
const hostRule = rule.parent;
|
|
60
61
|
if (!hostRule) continue;
|
|
62
|
+
for (const [, utilities] of parsed) if (utilities) generated.push(...utilities);
|
|
61
63
|
for (const node of consumed) node.remove();
|
|
62
64
|
const source = rule.source;
|
|
63
65
|
const utils = prepareApplyUtilities(parsed, generator.parentOrders);
|
|
@@ -105,6 +107,8 @@ async function parseApply(root, generator, directiveName) {
|
|
|
105
107
|
rule.remove();
|
|
106
108
|
if (hostRule.type === "rule" && !hostRule.nodes?.length) hostRule.remove();
|
|
107
109
|
}
|
|
110
|
+
const dependencies = await generateApplyPreflights(generator, generated, filename);
|
|
111
|
+
if (dependencies) root.append(postcss.parse(dependencies));
|
|
108
112
|
}
|
|
109
113
|
//#endregion
|
|
110
114
|
//#region src/screen.ts
|
|
@@ -412,7 +416,7 @@ function createPlugin(options) {
|
|
|
412
416
|
}
|
|
413
417
|
const { generator } = state;
|
|
414
418
|
for (const file of getConfigSourceFiles(state.sources)) addDependency(file);
|
|
415
|
-
await parseApply(root, generator, directiveMap.apply);
|
|
419
|
+
await parseApply(root, generator, directiveMap.apply, from);
|
|
416
420
|
await parseTheme(root, generator);
|
|
417
421
|
await parseScreen(root, generator, directiveMap.screen);
|
|
418
422
|
removeEntryDirectives(root);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teacss/postcss",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
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.5.
|
|
27
|
-
"@teacss/core": "0.5.
|
|
28
|
-
"@teacss/directives": "0.5.
|
|
29
|
-
"@teacss/rule-helpers": "0.5.
|
|
30
|
-
"@teacss/runtime": "0.5.
|
|
26
|
+
"@teacss/config": "0.5.2",
|
|
27
|
+
"@teacss/core": "0.5.2",
|
|
28
|
+
"@teacss/directives": "0.5.2",
|
|
29
|
+
"@teacss/rule-helpers": "0.5.2",
|
|
30
|
+
"@teacss/runtime": "0.5.2",
|
|
31
31
|
"css-tree": "^3.2.1",
|
|
32
32
|
"tinyglobby": "^0.2.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@teacss/preset-standard": "0.5.
|
|
35
|
+
"@teacss/preset-standard": "0.5.2",
|
|
36
36
|
"@types/css-tree": "^3.2.0",
|
|
37
37
|
"consola": "^3.4.2",
|
|
38
38
|
"magic-string": "^1.2.3",
|