weapp-tailwindcss 5.0.0-next.11 → 5.0.0-next.13

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.
Files changed (81) hide show
  1. package/dist/{bundle-state-BRkhpjio.js → bundle-state-Bz8vLnCf.js} +3 -2
  2. package/dist/{bundle-state-BrtFgX-A.mjs → bundle-state-CP2XS3Uj.mjs} +3 -2
  3. package/dist/bundlers/shared/css-cleanup.d.ts +6 -1
  4. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  5. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  6. package/dist/bundlers/shared/generator-css.d.ts +4 -0
  7. package/dist/bundlers/shared/hmr-timing.d.ts +18 -1
  8. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  9. package/dist/bundlers/vite/css-finalizer.d.ts +2 -0
  10. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  11. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  12. package/dist/bundlers/vite/generate-bundle.d.ts +8 -1
  13. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +1 -0
  14. package/dist/bundlers/vite/runtime-class-set.d.ts +4 -1
  15. package/dist/bundlers/vite/source-candidates.d.ts +11 -0
  16. package/dist/bundlers/vite/source-scan.d.ts +18 -1
  17. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  18. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  19. package/dist/cli.js +453 -9
  20. package/dist/cli.mjs +451 -8
  21. package/dist/core.js +1 -1
  22. package/dist/core.mjs +1 -1
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +2 -2
  26. package/dist/css-macro.mjs +2 -2
  27. package/dist/defaults.js +1 -1
  28. package/dist/defaults.mjs +1 -1
  29. package/dist/generator-C9H44wEF.mjs +32 -0
  30. package/dist/generator-CRORPkpW.js +55 -0
  31. package/dist/generator.js +12 -11
  32. package/dist/generator.mjs +2 -1
  33. package/dist/gulp.js +49 -13
  34. package/dist/gulp.mjs +46 -10
  35. package/dist/{incremental-runtime-class-set-CBMefNHQ.js → incremental-runtime-class-set-DN9KKjSi.js} +512 -103
  36. package/dist/{incremental-runtime-class-set-DaS2yw5c.mjs → incremental-runtime-class-set-Dbn4yPfZ.mjs} +491 -88
  37. package/dist/index.js +4 -4
  38. package/dist/index.mjs +4 -4
  39. package/dist/{postcss-BdcRlSpp.js → postcss-Ab7YzAbs.js} +30 -19
  40. package/dist/{postcss-Bs-RbNzK.js → postcss-CZE8k8oP.js} +59 -53
  41. package/dist/{postcss-xZDiTRII.mjs → postcss-CtlrNknb.mjs} +19 -8
  42. package/dist/postcss.js +1 -1
  43. package/dist/postcss.mjs +1 -1
  44. package/dist/{precheck-D5eEdqeH.js → precheck-CRX-pMKJ.js} +37 -17
  45. package/dist/{precheck-DtBGFS-n.mjs → precheck-SG48aLG2.mjs} +29 -9
  46. package/dist/presets.js +6 -6
  47. package/dist/presets.mjs +4 -4
  48. package/dist/source-candidates-C4YgmZ8A.js +274 -0
  49. package/dist/source-candidates-CyupdLKi.mjs +259 -0
  50. package/dist/tailwindcss/runtime/cache.d.ts +1 -0
  51. package/dist/tailwindcss/v3-engine/types.d.ts +3 -0
  52. package/dist/tailwindcss/v4-engine/types.d.ts +8 -0
  53. package/dist/{tailwindcss-DGM8lHUj.mjs → tailwindcss-BbTVeQkG.mjs} +9 -4
  54. package/dist/{tailwindcss-B78nj6n7.js → tailwindcss-DZ6jVYb4.js} +21 -16
  55. package/dist/v3-engine-D61eilBl.mjs +3208 -0
  56. package/dist/v3-engine-DwV1E6rX.js +3461 -0
  57. package/dist/{vite-C8S1wfyQ.mjs → vite-Ti_qSctn.mjs} +380 -542
  58. package/dist/{vite-BEj9JOOA.js → vite-xKS6RvLR.js} +385 -550
  59. package/dist/vite.js +1 -1
  60. package/dist/vite.mjs +1 -1
  61. package/dist/weapp-tw-css-import-rewrite-loader.js +29 -9
  62. package/dist/weapp-tw-runtime-classset-loader.js +1 -1
  63. package/dist/{webpack-ZGIKKpFf.mjs → webpack-DvptFz7B.mjs} +36 -19
  64. package/dist/{webpack-Dm1IXTIh.js → webpack-wfNutjMm.js} +40 -23
  65. package/dist/webpack.js +1 -1
  66. package/dist/webpack.mjs +1 -1
  67. package/package.json +3 -3
  68. package/dist/cache-B_9E7FxF.js +0 -517
  69. package/dist/cache-DEDxBMIw.mjs +0 -443
  70. package/dist/generator-CahkD2vq.mjs +0 -1469
  71. package/dist/generator-Ck1Dd1V0.js +0 -1568
  72. package/dist/runtime-patch-CqB-A4zA.js +0 -85
  73. package/dist/runtime-patch-DGKsVkiG.mjs +0 -71
  74. package/dist/source-scan-CIVTa3Cj.js +0 -297
  75. package/dist/source-scan-CJ0y0XBj.mjs +0 -258
  76. /package/dist/{constants-BeeyfJ9k.js → constants-BoB_6lFw.js} +0 -0
  77. /package/dist/{constants-BG12WAKw.mjs → constants-E_loJC49.mjs} +0 -0
  78. /package/dist/{logger-EVNB9z7i.js → logger-BRy6XPQ2.js} +0 -0
  79. /package/dist/{logger-CZUxvJJD.mjs → logger-Bub1jggA.mjs} +0 -0
  80. /package/dist/{utils-CGBVVNm6.mjs → utils-CycMvPn_.mjs} +0 -0
  81. /package/dist/{utils-4ODFyoqD.js → utils-D0MZP_tr.js} +0 -0
@@ -1,258 +0,0 @@
1
- import path from "node:path";
2
- import { stat } from "node:fs/promises";
3
- import fg from "fast-glob";
4
- import micromatch from "micromatch";
5
- //#region src/tailwindcss/source-scan.ts
6
- const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
7
- "html",
8
- "wxml",
9
- "axml",
10
- "jxml",
11
- "ksml",
12
- "ttml",
13
- "qml",
14
- "tyml",
15
- "xhsml",
16
- "swan",
17
- "vue",
18
- "mpx",
19
- "js",
20
- "jsx",
21
- "ts",
22
- "tsx"
23
- ];
24
- function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
25
- return `**/*.{${extensions.join(",")}}`;
26
- }
27
- const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
28
- function parseConfigParam(params) {
29
- const value = params.trim();
30
- return /^(['"])(.+)\1$/.exec(value)?.[2];
31
- }
32
- function isLegacyContentObject(value) {
33
- return typeof value === "object" && value !== null && "files" in value;
34
- }
35
- function normalizeGlobPattern(pattern) {
36
- return pattern.startsWith("./") ? pattern.slice(2) : pattern;
37
- }
38
- function segmentTopLevel(input, separator) {
39
- const parts = [];
40
- const stack = [];
41
- let lastPos = 0;
42
- let quote;
43
- for (let index = 0; index < input.length; index++) {
44
- const char = input[index];
45
- if (char === "\\") {
46
- index += 1;
47
- continue;
48
- }
49
- if (quote) {
50
- if (char === quote) quote = void 0;
51
- continue;
52
- }
53
- if (char === "\"" || char === "'") {
54
- quote = char;
55
- continue;
56
- }
57
- if (char === "(") {
58
- stack.push(")");
59
- continue;
60
- }
61
- if (char === "[") {
62
- stack.push("]");
63
- continue;
64
- }
65
- if (char === "{") {
66
- stack.push("}");
67
- continue;
68
- }
69
- if (stack.length > 0 && char === stack[stack.length - 1]) {
70
- stack.pop();
71
- continue;
72
- }
73
- if (stack.length === 0 && char === separator) {
74
- parts.push(input.slice(lastPos, index));
75
- lastPos = index + 1;
76
- }
77
- }
78
- parts.push(input.slice(lastPos));
79
- return parts;
80
- }
81
- function isSequence(value) {
82
- return NUMERICAL_RANGE_RE.test(value);
83
- }
84
- function expandSequence(value) {
85
- const match = value.match(NUMERICAL_RANGE_RE);
86
- if (!match) return [value];
87
- const [, start, end, stepValue] = match;
88
- if (start === void 0 || end === void 0) return [value];
89
- let step = stepValue ? Number.parseInt(stepValue, 10) : void 0;
90
- const startNumber = Number.parseInt(start, 10);
91
- const endNumber = Number.parseInt(end, 10);
92
- const increasing = startNumber < endNumber;
93
- if (step === void 0) step = increasing ? 1 : -1;
94
- if (step === 0) return [];
95
- if (increasing && step < 0) step = -step;
96
- if (!increasing && step > 0) step = -step;
97
- const result = [];
98
- for (let value = startNumber; increasing ? value <= endNumber : value >= endNumber; value += step) result.push(String(value));
99
- return result;
100
- }
101
- function expandInlineSourceCandidatePattern(pattern) {
102
- const index = pattern.indexOf("{");
103
- if (index === -1) return [pattern];
104
- const prefix = pattern.slice(0, index);
105
- const rest = pattern.slice(index);
106
- let depth = 0;
107
- let endIndex = -1;
108
- for (let index = 0; index < rest.length; index++) {
109
- const char = rest[index];
110
- if (char === "{") depth += 1;
111
- else if (char === "}") {
112
- depth -= 1;
113
- if (depth === 0) {
114
- endIndex = index;
115
- break;
116
- }
117
- }
118
- }
119
- if (endIndex === -1) return [pattern];
120
- const inner = rest.slice(1, endIndex);
121
- const suffix = rest.slice(endIndex + 1);
122
- const parts = (isSequence(inner) ? expandSequence(inner) : segmentTopLevel(inner, ",")).flatMap((part) => expandInlineSourceCandidatePattern(part));
123
- return expandInlineSourceCandidatePattern(suffix).flatMap((suffix) => parts.map((part) => `${prefix}${part}${suffix}`));
124
- }
125
- function parseSourceInlineParam(params) {
126
- let value = params.trim();
127
- const negated = value.startsWith("not ");
128
- if (negated) value = value.slice(4).trim();
129
- if (!value.startsWith("inline(") || !value.endsWith(")")) return;
130
- const inlineValue = value.slice(7, -1).trim();
131
- const match = /^(['"])([\s\S]*)\1$/.exec(inlineValue);
132
- if (!match) return;
133
- const source = match[2];
134
- if (source === void 0) return;
135
- return {
136
- negated,
137
- source
138
- };
139
- }
140
- function collectCssInlineSourceCandidates(root) {
141
- const included = /* @__PURE__ */ new Set();
142
- const excluded = /* @__PURE__ */ new Set();
143
- root.walkAtRules("source", (rule) => {
144
- const parsed = parseSourceInlineParam(rule.params);
145
- if (!parsed) return;
146
- const target = parsed.negated ? excluded : included;
147
- for (const source of segmentTopLevel(parsed.source, " ")) {
148
- const trimmed = source.trim();
149
- if (!trimmed) continue;
150
- for (const candidate of expandInlineSourceCandidatePattern(trimmed)) {
151
- const normalized = candidate.trim();
152
- if (normalized) target.add(normalized);
153
- }
154
- }
155
- });
156
- for (const candidate of excluded) included.delete(candidate);
157
- return {
158
- included,
159
- excluded
160
- };
161
- }
162
- function normalizeLegacyContentEntries(content, base) {
163
- if (typeof content === "string") {
164
- const negated = content.startsWith("!");
165
- return [{
166
- base,
167
- negated,
168
- pattern: normalizeGlobPattern(negated ? content.slice(1) : content)
169
- }];
170
- }
171
- if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base));
172
- if (isLegacyContentObject(content)) return normalizeLegacyContentEntries(content.files, base);
173
- return [];
174
- }
175
- async function pathExistsAsDirectory(file) {
176
- try {
177
- return (await stat(file)).isDirectory();
178
- } catch {
179
- return false;
180
- }
181
- }
182
- async function resolveTailwindSourceEntry(sourcePath, base, negated, defaultPattern = createSourceScanPattern()) {
183
- const absoluteSource = path.isAbsolute(sourcePath) ? path.resolve(sourcePath) : path.resolve(base, sourcePath);
184
- if (await pathExistsAsDirectory(absoluteSource)) return {
185
- base: absoluteSource,
186
- negated,
187
- pattern: normalizeGlobPattern(defaultPattern)
188
- };
189
- if (path.isAbsolute(sourcePath)) return {
190
- base: path.dirname(absoluteSource),
191
- negated,
192
- pattern: normalizeGlobPattern(path.basename(absoluteSource))
193
- };
194
- return {
195
- base,
196
- negated,
197
- pattern: normalizeGlobPattern(sourcePath)
198
- };
199
- }
200
- function parseSourceFileParam(params) {
201
- const value = params.trim();
202
- if (!value || value === "none" || value.startsWith("inline(")) return;
203
- const negated = value.startsWith("not ");
204
- const sourceValue = negated ? value.slice(4).trim() : value;
205
- if (sourceValue.startsWith("inline(")) return;
206
- const match = /^(['"])(.+)\1$/.exec(sourceValue);
207
- return match?.[2] ? {
208
- negated,
209
- sourcePath: match[2]
210
- } : void 0;
211
- }
212
- async function resolveCssSourceEntries(root, base, defaultPattern = createSourceScanPattern()) {
213
- const entries = [];
214
- const tasks = [];
215
- root.walkAtRules("source", (rule) => {
216
- const parsed = parseSourceFileParam(rule.params);
217
- if (!parsed) return;
218
- tasks.push(resolveTailwindSourceEntry(parsed.sourcePath, base, parsed.negated, defaultPattern));
219
- });
220
- entries.push(...await Promise.all(tasks));
221
- return entries;
222
- }
223
- async function expandTailwindSourceEntries(entries, options = {}) {
224
- const files = /* @__PURE__ */ new Set();
225
- const negativeEntries = entries.filter((entry) => entry.negated);
226
- const entriesByBase = /* @__PURE__ */ new Map();
227
- for (const entry of entries) {
228
- const base = path.resolve(entry.base);
229
- const group = entriesByBase.get(base) ?? [];
230
- group.push({
231
- ...entry,
232
- base
233
- });
234
- entriesByBase.set(base, group);
235
- }
236
- await Promise.all([...entriesByBase.entries()].map(async ([base, group]) => {
237
- const patterns = group.map((entry) => {
238
- const pattern = normalizeGlobPattern(entry.pattern);
239
- return entry.negated ? `!${pattern}` : pattern;
240
- });
241
- if (!patterns.some((pattern) => !pattern.startsWith("!"))) return;
242
- const ignore = options.ignore;
243
- const matched = await fg(patterns, {
244
- absolute: true,
245
- cwd: base,
246
- ...ignore === void 0 ? {} : { ignore },
247
- onlyFiles: true,
248
- unique: true
249
- });
250
- for (const file of matched) files.add(path.resolve(file));
251
- }));
252
- return [...files].filter((file) => !negativeEntries.some((entry) => {
253
- const relative = path.relative(path.resolve(entry.base), file).split(path.sep).join("/");
254
- return relative && !relative.startsWith("../") && !path.isAbsolute(relative) && micromatch.isMatch(relative, normalizeGlobPattern(entry.pattern));
255
- }));
256
- }
257
- //#endregion
258
- export { parseConfigParam as a, normalizeLegacyContentEntries as i, createSourceScanPattern as n, resolveCssSourceEntries as o, expandTailwindSourceEntries as r, collectCssInlineSourceCandidates as t };
File without changes
File without changes
File without changes