tailwindcss-injector 1.0.17 → 1.0.19
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/postcss.cjs +5 -21
- package/dist/postcss.d.ts +1 -1
- package/dist/postcss.js +5 -21
- package/package.json +4 -4
package/dist/postcss.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
//#endregion
|
|
23
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
23
24
|
let node_process = require("node:process");
|
|
24
25
|
node_process = __toESM(node_process, 1);
|
|
25
26
|
let node_path = require("node:path");
|
|
@@ -135,28 +136,11 @@ const creator = (options) => {
|
|
|
135
136
|
async Once(root, helpers) {
|
|
136
137
|
const sourceInput = root.source?.input;
|
|
137
138
|
if (filter(sourceInput)) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
nodes.forEach((node, index) => {
|
|
143
|
-
if (node.type === "atrule") {
|
|
144
|
-
if (insertAfterAtRulesNames.includes(node.name)) atruleAnchorIndex = Math.max(atruleAnchorIndex, index);
|
|
145
|
-
if (typeof node.params === "string") directivePresence.add(node.params);
|
|
146
|
-
} else if (node.type === "comment" && (0, _weapp_tailwindcss_shared.regExpTest)(insertAfterComments, node.text)) commentAnchorIndex = Math.max(commentAnchorIndex, index);
|
|
139
|
+
(0, _weapp_tailwindcss_postcss.injectTailwindDirectives)(root, {
|
|
140
|
+
directiveParams,
|
|
141
|
+
insertAfterAtRulesNames,
|
|
142
|
+
matchesComment: (text) => (0, _weapp_tailwindcss_shared.regExpTest)(insertAfterComments, text)
|
|
147
143
|
});
|
|
148
|
-
const anchorIndex = Math.max(atruleAnchorIndex, commentAnchorIndex);
|
|
149
|
-
let lastInserted = anchorIndex >= 0 ? nodes[anchorIndex] : void 0;
|
|
150
|
-
for (const params of directiveParams) if (!directivePresence.has(params)) {
|
|
151
|
-
const atRule = helpers.atRule({
|
|
152
|
-
name: "tailwind",
|
|
153
|
-
params
|
|
154
|
-
});
|
|
155
|
-
if (lastInserted) root.insertAfter(lastInserted, atRule);
|
|
156
|
-
else root.prepend(atRule);
|
|
157
|
-
lastInserted = atRule;
|
|
158
|
-
directivePresence.add(params);
|
|
159
|
-
}
|
|
160
144
|
if (sourceInput?.file) {
|
|
161
145
|
const deps = await getDepFiles(sourceInput.file.replace(/\.[^.]+$/, ".wxml"));
|
|
162
146
|
for (const dep of deps) helpers.result.messages.push({
|
package/dist/postcss.d.ts
CHANGED
package/dist/postcss.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { injectTailwindDirectives } from "@weapp-tailwindcss/postcss";
|
|
1
2
|
import process from "node:process";
|
|
2
3
|
import { defuOverrideArray, regExpTest } from "@weapp-tailwindcss/shared";
|
|
3
4
|
import { md5 } from "@weapp-tailwindcss/shared/node";
|
|
@@ -109,28 +110,11 @@ const creator = (options) => {
|
|
|
109
110
|
async Once(root, helpers) {
|
|
110
111
|
const sourceInput = root.source?.input;
|
|
111
112
|
if (filter(sourceInput)) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
nodes.forEach((node, index) => {
|
|
117
|
-
if (node.type === "atrule") {
|
|
118
|
-
if (insertAfterAtRulesNames.includes(node.name)) atruleAnchorIndex = Math.max(atruleAnchorIndex, index);
|
|
119
|
-
if (typeof node.params === "string") directivePresence.add(node.params);
|
|
120
|
-
} else if (node.type === "comment" && regExpTest(insertAfterComments, node.text)) commentAnchorIndex = Math.max(commentAnchorIndex, index);
|
|
113
|
+
injectTailwindDirectives(root, {
|
|
114
|
+
directiveParams,
|
|
115
|
+
insertAfterAtRulesNames,
|
|
116
|
+
matchesComment: (text) => regExpTest(insertAfterComments, text)
|
|
121
117
|
});
|
|
122
|
-
const anchorIndex = Math.max(atruleAnchorIndex, commentAnchorIndex);
|
|
123
|
-
let lastInserted = anchorIndex >= 0 ? nodes[anchorIndex] : void 0;
|
|
124
|
-
for (const params of directiveParams) if (!directivePresence.has(params)) {
|
|
125
|
-
const atRule = helpers.atRule({
|
|
126
|
-
name: "tailwind",
|
|
127
|
-
params
|
|
128
|
-
});
|
|
129
|
-
if (lastInserted) root.insertAfter(lastInserted, atRule);
|
|
130
|
-
else root.prepend(atRule);
|
|
131
|
-
lastInserted = atRule;
|
|
132
|
-
directivePresence.add(params);
|
|
133
|
-
}
|
|
134
118
|
if (sourceInput?.file) {
|
|
135
119
|
const deps = await getDepFiles(sourceInput.file.replace(/\.[^.]+$/, ".wxml"));
|
|
136
120
|
for (const dep of deps) helpers.result.messages.push({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss-injector",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.19",
|
|
5
5
|
"description": "Tailwind CSS generation and source injection helpers for cross-platform builds. 跨端构建的 Tailwind CSS 生成与源码注入工具。",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"node": "^20.19.0 || >=22.12.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@weapp-tailwindcss/postcss": "3.3.7",
|
|
38
39
|
"@weapp-tailwindcss/shared": "2.0.3",
|
|
39
40
|
"fs-extra": "^11.4.0",
|
|
40
41
|
"htmlparser2": "^12.0.0",
|
|
41
|
-
"magic-string": "^1.
|
|
42
|
-
"postcss": "^8.5.26",
|
|
42
|
+
"magic-string": "^1.4.1",
|
|
43
43
|
"tailwindcss": "^4.3.3",
|
|
44
|
-
"tailwindcss-config": "2.0.
|
|
44
|
+
"tailwindcss-config": "2.0.5"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"dev": "tsdown --watch --sourcemap",
|