weapp-tailwindcss 5.0.0-next.26 → 5.0.0-next.27
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/{auto-CqyEtds4.js → auto-DP-qtQzE.js} +2 -2
- package/dist/{auto-CsWz6lsU.mjs → auto-XyKTOP7B.mjs} +1 -1
- package/dist/{bundle-state-CWcrb3mH.mjs → bundle-state-7DRnJcJp.mjs} +1 -1
- package/dist/{bundle-state-uCtqRm0p.js → bundle-state-Nn90UQDa.js} +2 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/source-candidates.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/cli.js +5 -6
- package/dist/cli.mjs +5 -6
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +4 -4
- package/dist/css-macro.mjs +3 -3
- package/dist/{defaults-B-1EEhdL.mjs → defaults-8xrgzxFY.mjs} +1 -1
- package/dist/{defaults-C10hYUch.js → defaults-C5w9OOrj.js} +1 -2
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-iI_265gt.mjs → generator-CbpjNxJh.mjs} +1 -1
- package/dist/{generator-BH6a0xuB.js → generator-DRNbzjx5.js} +2 -2
- package/dist/generator.js +2 -3
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-mY0v1k-Y.js → incremental-runtime-class-set-BQPhkSov.js} +48 -14
- package/dist/{incremental-runtime-class-set-ECHyKwUL.mjs → incremental-runtime-class-set-C4JgSgRY.mjs} +48 -14
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -6
- package/dist/index.mjs +5 -5
- package/dist/{postcss-DEEAZ8J5.js → postcss-Br1eOaFd.js} +3 -3
- package/dist/{postcss-DJoU--Z-.mjs → postcss-YetooK6S.mjs} +2 -2
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-DLJg0_pu.js → precheck-B6xigu7s.js} +12 -13
- package/dist/{precheck-BI8oBeUg.mjs → precheck-uG16Cqaj.mjs} +11 -12
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +4 -4
- package/dist/reset.js +1 -1
- package/dist/{source-candidates-DkScNh9A.mjs → source-candidates-CX2ozpKM.mjs} +49 -7
- package/dist/{source-candidates-mfvC9gMc.js → source-candidates-DeK5b9i9.js} +50 -8
- package/dist/{tailwindcss-DFa5Yes8.mjs → tailwindcss-C7dJHZ0G.mjs} +2 -2
- package/dist/{tailwindcss-Cm93idme.js → tailwindcss-DEEtJf4u.js} +3 -3
- package/dist/{utils-CSA174-I.js → utils-nta4tfFs.js} +1 -1
- package/dist/{v3-engine-CGsbY81C.js → v3-engine-B_33V3Lu.js} +12 -4
- package/dist/{v3-engine-CPJ9uGyr.mjs → v3-engine-DcvCCHfs.mjs} +11 -3
- package/dist/{vite-BM_ksf1q.js → vite-Bg18XZZc.js} +38 -10
- package/dist/{vite-CqEF-Wx5.mjs → vite-DOmiMftw.mjs} +37 -9
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +46 -12
- package/dist/weapp-tw-runtime-classset-loader.js +1 -1
- package/dist/{webpack-D--XZMBB.mjs → webpack-BdrjJf41.mjs} +14 -13
- package/dist/{webpack-CfcuDhQ8.js → webpack-BzPDhzSz.js} +15 -14
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/package.json +4 -4
- /package/dist/{chunk-8l464Juk.js → chunk-D6vf50IK.js} +0 -0
- /package/dist/{logger-Dr7IvyH2.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-Cdzl3p8j.js → logger-TlKT3xmR.js} +0 -0
- /package/dist/{postcss-BzaRjBL0.mjs → postcss-C7BMYpEF.mjs} +0 -0
- /package/dist/{postcss-BwW8zO24.js → postcss-CiYLsqZn.js} +0 -0
- /package/dist/{runtime-registry-CdCV3Opt.js → runtime-registry-DpcR3IHI.js} +0 -0
- /package/dist/{utils-B2SJgA1L.mjs → utils-DsaS975I.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-DcvCCHfs.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -22,12 +22,22 @@ const TAILWIND_V4_IGNORED_CONTENT_DIRS = [
|
|
|
22
22
|
"venv"
|
|
23
23
|
];
|
|
24
24
|
const TAILWIND_V4_IGNORED_EXTENSIONS = [
|
|
25
|
+
"css",
|
|
25
26
|
"less",
|
|
27
|
+
"postcss",
|
|
28
|
+
"pcss",
|
|
26
29
|
"lock",
|
|
27
30
|
"sass",
|
|
28
31
|
"scss",
|
|
29
32
|
"styl",
|
|
30
|
-
"
|
|
33
|
+
"stylus",
|
|
34
|
+
"log",
|
|
35
|
+
"wxss",
|
|
36
|
+
"acss",
|
|
37
|
+
"jxss",
|
|
38
|
+
"ttss",
|
|
39
|
+
"qss",
|
|
40
|
+
"tyss"
|
|
31
41
|
];
|
|
32
42
|
const TAILWIND_V4_IGNORED_FILES = [
|
|
33
43
|
"package-lock.json",
|
|
@@ -68,8 +78,8 @@ function normalizeScanEntries(root, entries, outDirIgnore) {
|
|
|
68
78
|
function shouldApplyDefaultIgnoredSources(entries) {
|
|
69
79
|
return entries?.length === void 0 ? false : entries.length > 0 && entries.every((entry) => entry.negated);
|
|
70
80
|
}
|
|
71
|
-
function createDefaultIgnoredSources(root, outDirIgnore, entries) {
|
|
72
|
-
return [
|
|
81
|
+
function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
82
|
+
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ? [
|
|
73
83
|
...TAILWIND_V4_IGNORED_CONTENT_DIRS.map((pattern) => ({
|
|
74
84
|
base: root,
|
|
75
85
|
pattern: `**/${pattern}/**`,
|
|
@@ -119,6 +129,7 @@ function createSourceCandidateCollector() {
|
|
|
119
129
|
const candidatesById = /* @__PURE__ */ new Map();
|
|
120
130
|
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
121
131
|
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
132
|
+
const cssCandidatesById = /* @__PURE__ */ new Map();
|
|
122
133
|
const candidateCount = /* @__PURE__ */ new Map();
|
|
123
134
|
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
124
135
|
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
@@ -135,6 +146,18 @@ function createSourceCandidateCollector() {
|
|
|
135
146
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
136
147
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
137
148
|
}
|
|
149
|
+
async function syncCss(id, source) {
|
|
150
|
+
const normalizedId = cleanUrl(id);
|
|
151
|
+
const contentCacheKey = createSourceCandidateContentCacheKey("css", source);
|
|
152
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
153
|
+
if (cachedCandidates) {
|
|
154
|
+
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
const nextCandidates = new Set(await extractSourceCandidates(source, "css"));
|
|
158
|
+
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
159
|
+
replaceCssLayer(normalizedId, nextCandidates);
|
|
160
|
+
}
|
|
138
161
|
async function merge(id, source) {
|
|
139
162
|
const normalizedId = cleanUrl(id);
|
|
140
163
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
@@ -153,11 +176,11 @@ function createSourceCandidateCollector() {
|
|
|
153
176
|
transformCandidatesById.delete(normalizedId);
|
|
154
177
|
await syncFile(normalizedId);
|
|
155
178
|
}
|
|
156
|
-
async function scanRoot({ entries, root, outDir }) {
|
|
179
|
+
async function scanRoot({ entries, explicit, root, outDir }) {
|
|
157
180
|
const resolvedRoot = path.resolve(root);
|
|
158
181
|
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, outDir);
|
|
159
182
|
const scanEntries = normalizeScanEntries(resolvedRoot, entries, outDirIgnore);
|
|
160
|
-
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, entries);
|
|
183
|
+
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, entries, explicit);
|
|
161
184
|
const files = await resolveProjectSourceFiles({
|
|
162
185
|
cwd: resolvedRoot,
|
|
163
186
|
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
@@ -189,9 +212,19 @@ function createSourceCandidateCollector() {
|
|
|
189
212
|
else transformCandidatesById.set(normalizedId, nextCandidates);
|
|
190
213
|
recompute(normalizedId);
|
|
191
214
|
}
|
|
215
|
+
function replaceCssLayer(id, nextCandidates) {
|
|
216
|
+
const normalizedId = cleanUrl(id);
|
|
217
|
+
if (nextCandidates.size === 0) cssCandidatesById.delete(normalizedId);
|
|
218
|
+
else cssCandidatesById.set(normalizedId, nextCandidates);
|
|
219
|
+
recompute(normalizedId);
|
|
220
|
+
}
|
|
192
221
|
function recompute(id) {
|
|
193
222
|
const normalizedId = cleanUrl(id);
|
|
194
|
-
replaceFinal(normalizedId, new Set([
|
|
223
|
+
replaceFinal(normalizedId, new Set([
|
|
224
|
+
...scanCandidatesById.get(normalizedId) ?? [],
|
|
225
|
+
...transformCandidatesById.get(normalizedId) ?? [],
|
|
226
|
+
...cssCandidatesById.get(normalizedId) ?? []
|
|
227
|
+
]));
|
|
195
228
|
}
|
|
196
229
|
function syncInline(inlineCandidates) {
|
|
197
230
|
inlineIncludedCandidates = new Set(inlineCandidates?.included ?? []);
|
|
@@ -201,6 +234,7 @@ function createSourceCandidateCollector() {
|
|
|
201
234
|
const normalizedId = cleanUrl(id);
|
|
202
235
|
scanCandidatesById.delete(normalizedId);
|
|
203
236
|
transformCandidatesById.delete(normalizedId);
|
|
237
|
+
cssCandidatesById.delete(normalizedId);
|
|
204
238
|
const previousCandidates = candidatesById.get(normalizedId);
|
|
205
239
|
if (!previousCandidates) return;
|
|
206
240
|
removeCandidateSet(candidateCount, previousCandidates);
|
|
@@ -226,6 +260,7 @@ function createSourceCandidateCollector() {
|
|
|
226
260
|
candidatesById.clear();
|
|
227
261
|
scanCandidatesById.clear();
|
|
228
262
|
transformCandidatesById.clear();
|
|
263
|
+
cssCandidatesById.clear();
|
|
229
264
|
candidateCount.clear();
|
|
230
265
|
inlineIncludedCandidates.clear();
|
|
231
266
|
inlineExcludedCandidates.clear();
|
|
@@ -233,6 +268,7 @@ function createSourceCandidateCollector() {
|
|
|
233
268
|
function snapshot() {
|
|
234
269
|
return {
|
|
235
270
|
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
271
|
+
cssCandidatesById: [...cssCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
236
272
|
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
237
273
|
transformCandidatesById: [...transformCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
238
274
|
inlineExcludedCandidates: [...inlineExcludedCandidates],
|
|
@@ -254,6 +290,11 @@ function createSourceCandidateCollector() {
|
|
|
254
290
|
if (candidateSet.size === 0) continue;
|
|
255
291
|
transformCandidatesById.set(id, candidateSet);
|
|
256
292
|
}
|
|
293
|
+
for (const [id, candidates] of snapshot.cssCandidatesById ?? []) {
|
|
294
|
+
const candidateSet = new Set(candidates);
|
|
295
|
+
if (candidateSet.size === 0) continue;
|
|
296
|
+
cssCandidatesById.set(id, candidateSet);
|
|
297
|
+
}
|
|
257
298
|
for (const [id, candidates] of snapshot.candidatesById) {
|
|
258
299
|
const candidateSet = new Set(candidates);
|
|
259
300
|
if (candidateSet.size === 0) continue;
|
|
@@ -263,6 +304,7 @@ function createSourceCandidateCollector() {
|
|
|
263
304
|
}
|
|
264
305
|
return {
|
|
265
306
|
sync,
|
|
307
|
+
syncCss,
|
|
266
308
|
merge,
|
|
267
309
|
syncFile,
|
|
268
310
|
syncCurrentFile,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
1
|
+
const require_chunk = require("./chunk-D6vf50IK.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-B_33V3Lu.js");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -24,12 +24,22 @@ const TAILWIND_V4_IGNORED_CONTENT_DIRS = [
|
|
|
24
24
|
"venv"
|
|
25
25
|
];
|
|
26
26
|
const TAILWIND_V4_IGNORED_EXTENSIONS = [
|
|
27
|
+
"css",
|
|
27
28
|
"less",
|
|
29
|
+
"postcss",
|
|
30
|
+
"pcss",
|
|
28
31
|
"lock",
|
|
29
32
|
"sass",
|
|
30
33
|
"scss",
|
|
31
34
|
"styl",
|
|
32
|
-
"
|
|
35
|
+
"stylus",
|
|
36
|
+
"log",
|
|
37
|
+
"wxss",
|
|
38
|
+
"acss",
|
|
39
|
+
"jxss",
|
|
40
|
+
"ttss",
|
|
41
|
+
"qss",
|
|
42
|
+
"tyss"
|
|
33
43
|
];
|
|
34
44
|
const TAILWIND_V4_IGNORED_FILES = [
|
|
35
45
|
"package-lock.json",
|
|
@@ -70,8 +80,8 @@ function normalizeScanEntries(root, entries, outDirIgnore) {
|
|
|
70
80
|
function shouldApplyDefaultIgnoredSources(entries) {
|
|
71
81
|
return entries?.length === void 0 ? false : entries.length > 0 && entries.every((entry) => entry.negated);
|
|
72
82
|
}
|
|
73
|
-
function createDefaultIgnoredSources(root, outDirIgnore, entries) {
|
|
74
|
-
return [
|
|
83
|
+
function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
84
|
+
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ? [
|
|
75
85
|
...TAILWIND_V4_IGNORED_CONTENT_DIRS.map((pattern) => ({
|
|
76
86
|
base: root,
|
|
77
87
|
pattern: `**/${pattern}/**`,
|
|
@@ -121,6 +131,7 @@ function createSourceCandidateCollector() {
|
|
|
121
131
|
const candidatesById = /* @__PURE__ */ new Map();
|
|
122
132
|
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
123
133
|
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
134
|
+
const cssCandidatesById = /* @__PURE__ */ new Map();
|
|
124
135
|
const candidateCount = /* @__PURE__ */ new Map();
|
|
125
136
|
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
126
137
|
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
@@ -137,6 +148,18 @@ function createSourceCandidateCollector() {
|
|
|
137
148
|
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
138
149
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
139
150
|
}
|
|
151
|
+
async function syncCss(id, source) {
|
|
152
|
+
const normalizedId = cleanUrl(id);
|
|
153
|
+
const contentCacheKey = createSourceCandidateContentCacheKey("css", source);
|
|
154
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
155
|
+
if (cachedCandidates) {
|
|
156
|
+
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, "css"));
|
|
160
|
+
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
161
|
+
replaceCssLayer(normalizedId, nextCandidates);
|
|
162
|
+
}
|
|
140
163
|
async function merge(id, source) {
|
|
141
164
|
const normalizedId = cleanUrl(id);
|
|
142
165
|
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
@@ -155,11 +178,11 @@ function createSourceCandidateCollector() {
|
|
|
155
178
|
transformCandidatesById.delete(normalizedId);
|
|
156
179
|
await syncFile(normalizedId);
|
|
157
180
|
}
|
|
158
|
-
async function scanRoot({ entries, root, outDir }) {
|
|
181
|
+
async function scanRoot({ entries, explicit, root, outDir }) {
|
|
159
182
|
const resolvedRoot = node_path.default.resolve(root);
|
|
160
183
|
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, outDir);
|
|
161
184
|
const scanEntries = normalizeScanEntries(resolvedRoot, entries, outDirIgnore);
|
|
162
|
-
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, entries);
|
|
185
|
+
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, entries, explicit);
|
|
163
186
|
const files = await (0, tailwindcss_patch.resolveProjectSourceFiles)({
|
|
164
187
|
cwd: resolvedRoot,
|
|
165
188
|
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
@@ -191,9 +214,19 @@ function createSourceCandidateCollector() {
|
|
|
191
214
|
else transformCandidatesById.set(normalizedId, nextCandidates);
|
|
192
215
|
recompute(normalizedId);
|
|
193
216
|
}
|
|
217
|
+
function replaceCssLayer(id, nextCandidates) {
|
|
218
|
+
const normalizedId = cleanUrl(id);
|
|
219
|
+
if (nextCandidates.size === 0) cssCandidatesById.delete(normalizedId);
|
|
220
|
+
else cssCandidatesById.set(normalizedId, nextCandidates);
|
|
221
|
+
recompute(normalizedId);
|
|
222
|
+
}
|
|
194
223
|
function recompute(id) {
|
|
195
224
|
const normalizedId = cleanUrl(id);
|
|
196
|
-
replaceFinal(normalizedId, new Set([
|
|
225
|
+
replaceFinal(normalizedId, new Set([
|
|
226
|
+
...scanCandidatesById.get(normalizedId) ?? [],
|
|
227
|
+
...transformCandidatesById.get(normalizedId) ?? [],
|
|
228
|
+
...cssCandidatesById.get(normalizedId) ?? []
|
|
229
|
+
]));
|
|
197
230
|
}
|
|
198
231
|
function syncInline(inlineCandidates) {
|
|
199
232
|
inlineIncludedCandidates = new Set(inlineCandidates?.included ?? []);
|
|
@@ -203,6 +236,7 @@ function createSourceCandidateCollector() {
|
|
|
203
236
|
const normalizedId = cleanUrl(id);
|
|
204
237
|
scanCandidatesById.delete(normalizedId);
|
|
205
238
|
transformCandidatesById.delete(normalizedId);
|
|
239
|
+
cssCandidatesById.delete(normalizedId);
|
|
206
240
|
const previousCandidates = candidatesById.get(normalizedId);
|
|
207
241
|
if (!previousCandidates) return;
|
|
208
242
|
removeCandidateSet(candidateCount, previousCandidates);
|
|
@@ -228,6 +262,7 @@ function createSourceCandidateCollector() {
|
|
|
228
262
|
candidatesById.clear();
|
|
229
263
|
scanCandidatesById.clear();
|
|
230
264
|
transformCandidatesById.clear();
|
|
265
|
+
cssCandidatesById.clear();
|
|
231
266
|
candidateCount.clear();
|
|
232
267
|
inlineIncludedCandidates.clear();
|
|
233
268
|
inlineExcludedCandidates.clear();
|
|
@@ -235,6 +270,7 @@ function createSourceCandidateCollector() {
|
|
|
235
270
|
function snapshot() {
|
|
236
271
|
return {
|
|
237
272
|
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
273
|
+
cssCandidatesById: [...cssCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
238
274
|
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
239
275
|
transformCandidatesById: [...transformCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
240
276
|
inlineExcludedCandidates: [...inlineExcludedCandidates],
|
|
@@ -256,6 +292,11 @@ function createSourceCandidateCollector() {
|
|
|
256
292
|
if (candidateSet.size === 0) continue;
|
|
257
293
|
transformCandidatesById.set(id, candidateSet);
|
|
258
294
|
}
|
|
295
|
+
for (const [id, candidates] of snapshot.cssCandidatesById ?? []) {
|
|
296
|
+
const candidateSet = new Set(candidates);
|
|
297
|
+
if (candidateSet.size === 0) continue;
|
|
298
|
+
cssCandidatesById.set(id, candidateSet);
|
|
299
|
+
}
|
|
259
300
|
for (const [id, candidates] of snapshot.candidatesById) {
|
|
260
301
|
const candidateSet = new Set(candidates);
|
|
261
302
|
if (candidateSet.size === 0) continue;
|
|
@@ -265,6 +306,7 @@ function createSourceCandidateCollector() {
|
|
|
265
306
|
}
|
|
266
307
|
return {
|
|
267
308
|
sync,
|
|
309
|
+
syncCss,
|
|
268
310
|
merge,
|
|
269
311
|
syncFile,
|
|
270
312
|
syncCurrentFile,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-
|
|
2
|
-
import { n as defuOverrideArray } from "./utils-
|
|
1
|
+
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-DcvCCHfs.mjs";
|
|
2
|
+
import { n as defuOverrideArray } from "./utils-DsaS975I.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
require("./utils-
|
|
1
|
+
const require_chunk = require("./chunk-D6vf50IK.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-B_33V3Lu.js");
|
|
3
|
+
require("./utils-nta4tfFs.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_auto = require("./auto-
|
|
1
|
+
const require_chunk = require("./chunk-D6vf50IK.js");
|
|
2
|
+
const require_auto = require("./auto-DP-qtQzE.js");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
node_fs = require_chunk.__toESM(node_fs);
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -2496,9 +2496,17 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
|
|
|
2496
2496
|
const cssInlineCandidates = [];
|
|
2497
2497
|
const dependencies = /* @__PURE__ */ new Set();
|
|
2498
2498
|
let explicit = false;
|
|
2499
|
+
let readableCssEntryCount = 0;
|
|
2499
2500
|
for (const cssEntry of cssEntries) {
|
|
2500
2501
|
addSourceScanDependency(dependencies, cssEntry);
|
|
2501
|
-
|
|
2502
|
+
let css;
|
|
2503
|
+
try {
|
|
2504
|
+
css = (0, node_fs.readFileSync)(cssEntry, "utf8");
|
|
2505
|
+
} catch {
|
|
2506
|
+
continue;
|
|
2507
|
+
}
|
|
2508
|
+
readableCssEntryCount++;
|
|
2509
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(css, node_path.default.dirname(cssEntry));
|
|
2502
2510
|
if (resolved) {
|
|
2503
2511
|
entries.push(...resolved.entries);
|
|
2504
2512
|
cssInlineCandidates.push(resolved.inlineCandidates);
|
|
@@ -2507,7 +2515,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
|
|
|
2507
2515
|
}
|
|
2508
2516
|
}
|
|
2509
2517
|
const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
2510
|
-
if (entries.length > 0 || inlineCandidates || explicit ||
|
|
2518
|
+
if (entries.length > 0 || inlineCandidates || explicit || readableCssEntryCount > 0) return createResolvedViteSourceScan({
|
|
2511
2519
|
entries: explicit ? entries : entries.length > 0 ? entries : void 0,
|
|
2512
2520
|
explicit,
|
|
2513
2521
|
inlineCandidates
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-
|
|
1
|
+
import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-XyKTOP7B.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
4
4
|
import postcss from "postcss";
|
|
@@ -2488,9 +2488,17 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
|
|
|
2488
2488
|
const cssInlineCandidates = [];
|
|
2489
2489
|
const dependencies = /* @__PURE__ */ new Set();
|
|
2490
2490
|
let explicit = false;
|
|
2491
|
+
let readableCssEntryCount = 0;
|
|
2491
2492
|
for (const cssEntry of cssEntries) {
|
|
2492
2493
|
addSourceScanDependency(dependencies, cssEntry);
|
|
2493
|
-
|
|
2494
|
+
let css;
|
|
2495
|
+
try {
|
|
2496
|
+
css = readFileSync(cssEntry, "utf8");
|
|
2497
|
+
} catch {
|
|
2498
|
+
continue;
|
|
2499
|
+
}
|
|
2500
|
+
readableCssEntryCount++;
|
|
2501
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(css, path.dirname(cssEntry));
|
|
2494
2502
|
if (resolved) {
|
|
2495
2503
|
entries.push(...resolved.entries);
|
|
2496
2504
|
cssInlineCandidates.push(resolved.inlineCandidates);
|
|
@@ -2499,7 +2507,7 @@ async function resolveViteSourceScanEntries(options, patcher, scanOptions = {})
|
|
|
2499
2507
|
}
|
|
2500
2508
|
}
|
|
2501
2509
|
const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
2502
|
-
if (entries.length > 0 || inlineCandidates || explicit ||
|
|
2510
|
+
if (entries.length > 0 || inlineCandidates || explicit || readableCssEntryCount > 0) return createResolvedViteSourceScan({
|
|
2503
2511
|
entries: explicit ? entries : entries.length > 0 ? entries : void 0,
|
|
2504
2512
|
explicit,
|
|
2505
2513
|
inlineCandidates
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
6
|
-
const require_utils = require("./utils-
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
10
|
-
require("./logger-
|
|
1
|
+
const require_chunk = require("./chunk-D6vf50IK.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-B_33V3Lu.js");
|
|
3
|
+
const require_generator = require("./generator-DRNbzjx5.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-BQPhkSov.js");
|
|
5
|
+
const require_precheck = require("./precheck-B6xigu7s.js");
|
|
6
|
+
const require_utils = require("./utils-nta4tfFs.js");
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-DEEtJf4u.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-DeK5b9i9.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-Nn90UQDa.js");
|
|
10
|
+
require("./logger-TlKT3xmR.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
13
13
|
let postcss = require("postcss");
|
|
@@ -1971,6 +1971,10 @@ function WeappTailwindcss(options = {}) {
|
|
|
1971
1971
|
let refreshRuntimeStateForAutoCssSources;
|
|
1972
1972
|
let autoCssSourcesRefresh;
|
|
1973
1973
|
let autoCssSourcesDiscovered = false;
|
|
1974
|
+
const syncTailwindCssSourceCandidates = async (id, css) => {
|
|
1975
|
+
await sourceCandidateCollector.syncCss(id, css);
|
|
1976
|
+
cacheCurrentSourceCandidateScan();
|
|
1977
|
+
};
|
|
1974
1978
|
const registerAutoCssSource = async (id, css, options = {}) => {
|
|
1975
1979
|
if (tailwindcssMajorVersion < 4 || !shouldOwnTailwindGeneration || hasInitialTailwindCssRoots) return;
|
|
1976
1980
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
@@ -1979,6 +1983,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
1979
1983
|
const sourceCss = require_incremental_runtime_class_set.normalizeTailwindSourceForGenerator(css, { importFallback: true });
|
|
1980
1984
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) return;
|
|
1981
1985
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
1986
|
+
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
1982
1987
|
const dependencies = await require_v3_engine.resolveViteTailwindV4CssDependencies(sourceCss, node_path.default.dirname(sourceFile));
|
|
1983
1988
|
if (!require_tailwindcss.upsertTailwindV4CssSource(opts, {
|
|
1984
1989
|
file: sourceFile,
|
|
@@ -2005,6 +2010,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2005
2010
|
const sourceCss = require_incremental_runtime_class_set.normalizeTailwindSourceForGenerator(await (0, node_fs_promises.readFile)(sourceFile, "utf8"), { importFallback: true });
|
|
2006
2011
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) continue;
|
|
2007
2012
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
2013
|
+
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
2008
2014
|
const resolved = await require_v3_engine.resolveTailwindV4EntriesFromCssCached(sourceCss, node_path.default.dirname(sourceFile));
|
|
2009
2015
|
changed = require_tailwindcss.upsertTailwindV4CssSource(opts, {
|
|
2010
2016
|
file: sourceFile,
|
|
@@ -2078,6 +2084,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2078
2084
|
const collectSourceCandidateScanRoots = (root, entries) => {
|
|
2079
2085
|
if (entries?.length) return [{
|
|
2080
2086
|
entries,
|
|
2087
|
+
explicit: sourceScanExplicit,
|
|
2081
2088
|
root
|
|
2082
2089
|
}];
|
|
2083
2090
|
if (sourceScanExplicit) return [];
|
|
@@ -2103,6 +2110,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2103
2110
|
const scanSourceCandidateRoots = async (roots, outDir) => {
|
|
2104
2111
|
await Promise.all(roots.map((root) => sourceCandidateCollector.scanRoot({
|
|
2105
2112
|
entries: root.entries,
|
|
2113
|
+
explicit: root.explicit,
|
|
2106
2114
|
root: root.root,
|
|
2107
2115
|
outDir
|
|
2108
2116
|
})));
|
|
@@ -2260,6 +2268,14 @@ function WeappTailwindcss(options = {}) {
|
|
|
2260
2268
|
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
2261
2269
|
});
|
|
2262
2270
|
};
|
|
2271
|
+
const hasSelfAcceptingNonStyleHotModule = (modules) => {
|
|
2272
|
+
return modules.some((mod) => {
|
|
2273
|
+
return !require_bundle_state.isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
2274
|
+
});
|
|
2275
|
+
};
|
|
2276
|
+
const isUniViteProject = () => {
|
|
2277
|
+
return resolvedConfig?.plugins?.some((plugin) => plugin.name.includes("uni")) ?? false;
|
|
2278
|
+
};
|
|
2263
2279
|
const sendSupplementalCssHotUpdates = (ctx, cssModules) => {
|
|
2264
2280
|
const updates = cssModules.filter((mod) => !includesHotModule(ctx.modules, mod)).map((mod) => {
|
|
2265
2281
|
const hotUrl = resolveModuleHotUrl(mod);
|
|
@@ -2281,6 +2297,13 @@ function WeappTailwindcss(options = {}) {
|
|
|
2281
2297
|
});
|
|
2282
2298
|
});
|
|
2283
2299
|
};
|
|
2300
|
+
const sendFullReloadForUnresolvedHotUpdate = (ctx) => {
|
|
2301
|
+
ctx.server.ws?.send?.({
|
|
2302
|
+
type: "full-reload",
|
|
2303
|
+
path: "*",
|
|
2304
|
+
triggeredBy: ctx.file
|
|
2305
|
+
});
|
|
2306
|
+
};
|
|
2284
2307
|
const matchesViteProcessedCssSource = (candidate) => {
|
|
2285
2308
|
const normalized = normalizeViteProcessedCssFile(candidate);
|
|
2286
2309
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
@@ -2432,9 +2455,14 @@ function WeappTailwindcss(options = {}) {
|
|
|
2432
2455
|
},
|
|
2433
2456
|
async handleHotUpdate(ctx) {
|
|
2434
2457
|
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
2458
|
+
const isSourceCandidateHotUpdate = shouldOwnTailwindGeneration && require_source_candidates.isSourceCandidateRequest(ctx.file);
|
|
2435
2459
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
2436
2460
|
invalidateRecordedGeneratorCandidates();
|
|
2437
2461
|
const cssModules = resolveHotTailwindCssModules(ctx);
|
|
2462
|
+
if (isSourceCandidateHotUpdate && !require_bundle_state.isSourceStyleRequest(ctx.file) && (!hasSelfAcceptingNonStyleHotModule(ctx.modules) && cssModules.length === 0 || cssModules.length > 0 && isUniViteProject())) {
|
|
2463
|
+
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
2464
|
+
return [];
|
|
2465
|
+
}
|
|
2438
2466
|
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
2439
2467
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
2440
2468
|
}, { emit: false });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
3
|
-
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-
|
|
4
|
-
import { _ as collectRuntimeClassSet, a as vitePluginName, b as refreshTailwindRuntimeState, c as createAttributeMatcher, d as _defineProperty, f as isClassContextLiteralPath, g as toCustomAttributesEntities, l as analyzeSource, m as babelParse, n as getCompilerContext, p as replaceWxml, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
5
|
-
import { o as resolveUniUtsPlatform } from "./utils-
|
|
6
|
-
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-
|
|
8
|
-
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-
|
|
9
|
-
import { t as logger$1 } from "./logger-
|
|
1
|
+
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-DcvCCHfs.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CbpjNxJh.mjs";
|
|
3
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-C4JgSgRY.mjs";
|
|
4
|
+
import { _ as collectRuntimeClassSet, a as vitePluginName, b as refreshTailwindRuntimeState, c as createAttributeMatcher, d as _defineProperty, f as isClassContextLiteralPath, g as toCustomAttributesEntities, l as analyzeSource, m as babelParse, n as getCompilerContext, p as replaceWxml, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as createTailwindRuntimeReadyPromise } from "./precheck-uG16Cqaj.mjs";
|
|
5
|
+
import { o as resolveUniUtsPlatform } from "./utils-DsaS975I.mjs";
|
|
6
|
+
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-C7dJHZ0G.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-CX2ozpKM.mjs";
|
|
8
|
+
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-7DRnJcJp.mjs";
|
|
9
|
+
import { t as logger$1 } from "./logger-BNzxZbZj.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import postcss from "postcss";
|
|
12
12
|
import path from "node:path";
|
|
@@ -1962,6 +1962,10 @@ function WeappTailwindcss(options = {}) {
|
|
|
1962
1962
|
let refreshRuntimeStateForAutoCssSources;
|
|
1963
1963
|
let autoCssSourcesRefresh;
|
|
1964
1964
|
let autoCssSourcesDiscovered = false;
|
|
1965
|
+
const syncTailwindCssSourceCandidates = async (id, css) => {
|
|
1966
|
+
await sourceCandidateCollector.syncCss(id, css);
|
|
1967
|
+
cacheCurrentSourceCandidateScan();
|
|
1968
|
+
};
|
|
1965
1969
|
const registerAutoCssSource = async (id, css, options = {}) => {
|
|
1966
1970
|
if (tailwindcssMajorVersion < 4 || !shouldOwnTailwindGeneration || hasInitialTailwindCssRoots) return;
|
|
1967
1971
|
const file = cleanUrl(id);
|
|
@@ -1970,6 +1974,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
1970
1974
|
const sourceCss = normalizeTailwindSourceForGenerator(css, { importFallback: true });
|
|
1971
1975
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) return;
|
|
1972
1976
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
1977
|
+
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
1973
1978
|
const dependencies = await resolveViteTailwindV4CssDependencies(sourceCss, path.dirname(sourceFile));
|
|
1974
1979
|
if (!upsertTailwindV4CssSource(opts, {
|
|
1975
1980
|
file: sourceFile,
|
|
@@ -1996,6 +2001,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
1996
2001
|
const sourceCss = normalizeTailwindSourceForGenerator(await readFile(sourceFile, "utf8"), { importFallback: true });
|
|
1997
2002
|
if (autoCssSourceContent.get(sourceFile) === sourceCss) continue;
|
|
1998
2003
|
autoCssSourceContent.set(sourceFile, sourceCss);
|
|
2004
|
+
await syncTailwindCssSourceCandidates(sourceFile, sourceCss);
|
|
1999
2005
|
const resolved = await resolveTailwindV4EntriesFromCssCached(sourceCss, path.dirname(sourceFile));
|
|
2000
2006
|
changed = upsertTailwindV4CssSource(opts, {
|
|
2001
2007
|
file: sourceFile,
|
|
@@ -2069,6 +2075,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2069
2075
|
const collectSourceCandidateScanRoots = (root, entries) => {
|
|
2070
2076
|
if (entries?.length) return [{
|
|
2071
2077
|
entries,
|
|
2078
|
+
explicit: sourceScanExplicit,
|
|
2072
2079
|
root
|
|
2073
2080
|
}];
|
|
2074
2081
|
if (sourceScanExplicit) return [];
|
|
@@ -2094,6 +2101,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2094
2101
|
const scanSourceCandidateRoots = async (roots, outDir) => {
|
|
2095
2102
|
await Promise.all(roots.map((root) => sourceCandidateCollector.scanRoot({
|
|
2096
2103
|
entries: root.entries,
|
|
2104
|
+
explicit: root.explicit,
|
|
2097
2105
|
root: root.root,
|
|
2098
2106
|
outDir
|
|
2099
2107
|
})));
|
|
@@ -2251,6 +2259,14 @@ function WeappTailwindcss(options = {}) {
|
|
|
2251
2259
|
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
2252
2260
|
});
|
|
2253
2261
|
};
|
|
2262
|
+
const hasSelfAcceptingNonStyleHotModule = (modules) => {
|
|
2263
|
+
return modules.some((mod) => {
|
|
2264
|
+
return !isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
2265
|
+
});
|
|
2266
|
+
};
|
|
2267
|
+
const isUniViteProject = () => {
|
|
2268
|
+
return resolvedConfig?.plugins?.some((plugin) => plugin.name.includes("uni")) ?? false;
|
|
2269
|
+
};
|
|
2254
2270
|
const sendSupplementalCssHotUpdates = (ctx, cssModules) => {
|
|
2255
2271
|
const updates = cssModules.filter((mod) => !includesHotModule(ctx.modules, mod)).map((mod) => {
|
|
2256
2272
|
const hotUrl = resolveModuleHotUrl(mod);
|
|
@@ -2272,6 +2288,13 @@ function WeappTailwindcss(options = {}) {
|
|
|
2272
2288
|
});
|
|
2273
2289
|
});
|
|
2274
2290
|
};
|
|
2291
|
+
const sendFullReloadForUnresolvedHotUpdate = (ctx) => {
|
|
2292
|
+
ctx.server.ws?.send?.({
|
|
2293
|
+
type: "full-reload",
|
|
2294
|
+
path: "*",
|
|
2295
|
+
triggeredBy: ctx.file
|
|
2296
|
+
});
|
|
2297
|
+
};
|
|
2275
2298
|
const matchesViteProcessedCssSource = (candidate) => {
|
|
2276
2299
|
const normalized = normalizeViteProcessedCssFile(candidate);
|
|
2277
2300
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
@@ -2423,9 +2446,14 @@ function WeappTailwindcss(options = {}) {
|
|
|
2423
2446
|
},
|
|
2424
2447
|
async handleHotUpdate(ctx) {
|
|
2425
2448
|
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
2449
|
+
const isSourceCandidateHotUpdate = shouldOwnTailwindGeneration && isSourceCandidateRequest(ctx.file);
|
|
2426
2450
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
2427
2451
|
invalidateRecordedGeneratorCandidates();
|
|
2428
2452
|
const cssModules = resolveHotTailwindCssModules(ctx);
|
|
2453
|
+
if (isSourceCandidateHotUpdate && !isSourceStyleRequest(ctx.file) && (!hasSelfAcceptingNonStyleHotModule(ctx.modules) && cssModules.length === 0 || cssModules.length > 0 && isUniViteProject())) {
|
|
2454
|
+
sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
2455
|
+
return [];
|
|
2456
|
+
}
|
|
2429
2457
|
sendSupplementalCssHotUpdates(ctx, cssModules);
|
|
2430
2458
|
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
2431
2459
|
}, { emit: false });
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-Bg18XZZc.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-DOmiMftw.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|