weapp-tailwindcss 5.0.5 → 5.0.7
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/{bundle-state-Cso_ceUo.js → bundle-state-BzwPS-UI.js} +2 -1
- package/dist/{bundle-state-DEyxCR4f.mjs → bundle-state-ChcOKb9w.mjs} +2 -1
- package/dist/bundlers/gulp/index.d.ts +3 -4
- package/dist/bundlers/gulp/module-graph.d.ts +2 -0
- package/dist/bundlers/gulp/runtime-snapshot.d.ts +5 -0
- package/dist/bundlers/gulp/vinyl-transform.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -1
- package/dist/bundlers/shared/css-source-trace.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/directives/fallback.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +56 -0
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +27 -0
- package/dist/bundlers/shared/generator-css/user-css.d.ts +26 -0
- package/dist/bundlers/shared/generator-css/validate.d.ts +5 -0
- package/dist/bundlers/shared/generator-css.d.ts +4 -32
- package/dist/bundlers/vite/css-finalizer.d.ts +3 -0
- package/dist/bundlers/vite/generate-bundle/css-config-directives.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +14 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +11 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/style-matching.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/subpackages.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +68 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +4 -62
- package/dist/bundlers/vite/incremental-runtime-class-set/entries.d.ts +4 -0
- package/dist/bundlers/vite/incremental-runtime-class-set/escaped-candidates.d.ts +2 -0
- package/dist/bundlers/vite/incremental-runtime-class-set/v3-candidates.d.ts +13 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets/css-rules.d.ts +17 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +2 -0
- package/dist/bundlers/vite/source-candidates/scan-root.d.ts +10 -0
- package/dist/bundlers/vite/source-candidates/script.d.ts +7 -0
- package/dist/bundlers/vite/source-candidates/tailwind-v3-default-extractor.d.ts +1 -0
- package/dist/bundlers/vite/source-candidates.d.ts +8 -3
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +20 -0
- package/dist/bundlers/vite/source-scan/dependencies.d.ts +2 -0
- package/dist/bundlers/vite/source-scan.d.ts +2 -12
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +48 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -20
- package/dist/cli.js +69 -69
- package/dist/cli.mjs +69 -69
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{defaults-BPUuNYcD.js → defaults-Boc26eel.js} +1 -0
- package/dist/{defaults-8xrgzxFY.mjs → defaults-DH0ZQRhy.mjs} +1 -0
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-AD-eX8Tr.js → generator-6yF8wjxR.js} +1 -1
- package/dist/{generator-DVWLNO0n.mjs → generator-BON6M1bL.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp-_7p1Z2vc.js +473 -0
- package/dist/gulp-oE-Byqk6.mjs +463 -0
- package/dist/gulp.js +4 -414
- package/dist/gulp.mjs +1 -406
- package/dist/{incremental-runtime-class-set-vOetpdWs.js → hmr-timing-BKQNRxHr.js} +1257 -459
- package/dist/{incremental-runtime-class-set-xf49kky6.mjs → hmr-timing-BVTGf5ch.mjs} +1221 -477
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{postcss-Cbi6RFpf.js → postcss-BTIunhWl.js} +7 -7
- package/dist/{postcss-hSUxK7oR.mjs → postcss-BtmrrZ31.mjs} +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-Bsn_LMmo.mjs → precheck-CZjr87m_.mjs} +19 -5
- package/dist/{precheck-b8Y8qZg0.js → precheck-fhIkzCSU.js} +19 -5
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/tailwindcss/source-scan/inline-source.d.ts +7 -0
- package/dist/tailwindcss/source-scan.d.ts +2 -7
- package/dist/tailwindcss/v3-engine/generator/cache-key.d.ts +3 -0
- package/dist/tailwindcss/v3-engine/generator/content.d.ts +10 -0
- package/dist/tailwindcss/v3-engine/generator/runtime-ready.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/generator/css-compat.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/generator/rpx-candidates.d.ts +6 -0
- package/dist/tailwindcss/v4-engine/generator/scan-sources.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
- package/dist/{tailwindcss-AWaPVF2B.mjs → tailwindcss-bbQUg25J.mjs} +2 -2
- package/dist/{tailwindcss-CpQ6X4l6.js → tailwindcss-vswd1gc3.js} +2 -2
- package/dist/{transform-BkGtbxb1.js → transform-CReJxxh_.js} +11 -2
- package/dist/{transform-DumSZmTh.mjs → transform-DEsFlG9k.mjs} +11 -2
- package/dist/types/typedoc-tailwindcss-patch.d.ts +4 -2
- package/dist/types/user-defined-options/general.d.ts +5 -0
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/harmony.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +16 -0
- package/dist/uni-app-x/style-asset.d.ts +20 -0
- package/dist/uni-app-x/transform.d.ts +1 -0
- package/dist/uni-app-x/vite.d.ts +1 -0
- package/dist/{v3-engine-CM0TRa8V.js → v3-engine-CEMXFegG.js} +714 -663
- package/dist/{v3-engine-Cczrkzqt.mjs → v3-engine-CdIwmHuc.mjs} +758 -707
- package/dist/{vite-CTuHPC91.js → vite-0jFbh9hx.js} +1797 -386
- package/dist/{vite-DLXDMHON.mjs → vite-C7BGAlCE.mjs} +1779 -369
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +1169 -1002
- package/dist/{webpack-DJFw08SK.mjs → webpack-Dx6_eg5k.mjs} +96 -36
- package/dist/{webpack-BBHJYKqB.js → webpack-aEuDoYfQ.js} +105 -44
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +6 -5
- package/dist/source-candidates-BsWYoIPN.mjs +0 -355
- package/dist/source-candidates-o2ZrKWzu.js +0 -374
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import { Q as FULL_SOURCE_SCAN_EXTENSION_RE, ct as toPosixPath, nt as isFileMatchedByTailwindSourceEntries, ot as resolveSourceScanPath } from "./v3-engine-Cczrkzqt.mjs";
|
|
2
|
-
import { createRequire } from "node:module";
|
|
3
|
-
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { readFile } from "node:fs/promises";
|
|
6
|
-
//#region src/bundlers/vite/source-candidates.ts
|
|
7
|
-
const CLEAN_URL_RE = /[?#].*$/;
|
|
8
|
-
const TAILWIND_V4_IGNORED_CONTENT_DIRS = [
|
|
9
|
-
".git",
|
|
10
|
-
".hg",
|
|
11
|
-
".jj",
|
|
12
|
-
".next",
|
|
13
|
-
".parcel-cache",
|
|
14
|
-
".pnpm-store",
|
|
15
|
-
".svelte-kit",
|
|
16
|
-
".svn",
|
|
17
|
-
".turbo",
|
|
18
|
-
".venv",
|
|
19
|
-
".vercel",
|
|
20
|
-
".yarn",
|
|
21
|
-
"__pycache__",
|
|
22
|
-
"node_modules",
|
|
23
|
-
"venv"
|
|
24
|
-
];
|
|
25
|
-
const TAILWIND_V4_IGNORED_EXTENSIONS = [
|
|
26
|
-
"css",
|
|
27
|
-
"less",
|
|
28
|
-
"postcss",
|
|
29
|
-
"pcss",
|
|
30
|
-
"lock",
|
|
31
|
-
"sass",
|
|
32
|
-
"scss",
|
|
33
|
-
"styl",
|
|
34
|
-
"stylus",
|
|
35
|
-
"log",
|
|
36
|
-
"wxss",
|
|
37
|
-
"acss",
|
|
38
|
-
"jxss",
|
|
39
|
-
"ttss",
|
|
40
|
-
"qss",
|
|
41
|
-
"tyss"
|
|
42
|
-
];
|
|
43
|
-
const TAILWIND_V4_IGNORED_FILES = [
|
|
44
|
-
"package-lock.json",
|
|
45
|
-
"pnpm-lock.yaml",
|
|
46
|
-
"bun.lockb",
|
|
47
|
-
".gitignore",
|
|
48
|
-
".env",
|
|
49
|
-
".env.*"
|
|
50
|
-
];
|
|
51
|
-
const sourceCandidateContentCache = /* @__PURE__ */ new Map();
|
|
52
|
-
const require = createRequire(import.meta.url);
|
|
53
|
-
const TAILWIND_V3_HTML_TOKEN_CANDIDATES = new Set([
|
|
54
|
-
"/block",
|
|
55
|
-
"/div",
|
|
56
|
-
"/span",
|
|
57
|
-
"/template",
|
|
58
|
-
"/text",
|
|
59
|
-
"/view",
|
|
60
|
-
"class",
|
|
61
|
-
"className",
|
|
62
|
-
"div",
|
|
63
|
-
"hover-class",
|
|
64
|
-
"span",
|
|
65
|
-
"template",
|
|
66
|
-
"text",
|
|
67
|
-
"view"
|
|
68
|
-
]);
|
|
69
|
-
function cleanUrl(id) {
|
|
70
|
-
return resolveSourceScanPath(id.replace(CLEAN_URL_RE, ""));
|
|
71
|
-
}
|
|
72
|
-
function resolveOutDirIgnorePattern(root, outDir) {
|
|
73
|
-
if (!outDir) return;
|
|
74
|
-
const relative = path.relative(root, path.resolve(root, outDir));
|
|
75
|
-
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return;
|
|
76
|
-
return `${toPosixPath(relative)}/**`;
|
|
77
|
-
}
|
|
78
|
-
function normalizeScanEntries(root, entries, outDirIgnore) {
|
|
79
|
-
const hasPositiveEntry = entries?.some((entry) => !entry.negated) === true;
|
|
80
|
-
const scanEntries = entries?.length ? hasPositiveEntry ? entries : [{
|
|
81
|
-
base: root,
|
|
82
|
-
pattern: "**/*",
|
|
83
|
-
negated: false
|
|
84
|
-
}, ...entries] : void 0;
|
|
85
|
-
if (!outDirIgnore) return scanEntries;
|
|
86
|
-
return [...scanEntries ?? [{
|
|
87
|
-
base: root,
|
|
88
|
-
pattern: "**/*",
|
|
89
|
-
negated: false
|
|
90
|
-
}], {
|
|
91
|
-
base: root,
|
|
92
|
-
pattern: outDirIgnore,
|
|
93
|
-
negated: true
|
|
94
|
-
}];
|
|
95
|
-
}
|
|
96
|
-
function shouldApplyDefaultIgnoredSources(entries) {
|
|
97
|
-
return entries?.length === void 0 ? false : entries.length > 0 && entries.every((entry) => entry.negated);
|
|
98
|
-
}
|
|
99
|
-
function createDefaultIgnoredSources(root, outDirIgnore, entries, explicit) {
|
|
100
|
-
return [...!explicit || shouldApplyDefaultIgnoredSources(entries) ? [
|
|
101
|
-
...TAILWIND_V4_IGNORED_CONTENT_DIRS.map((pattern) => ({
|
|
102
|
-
base: root,
|
|
103
|
-
pattern: `**/${pattern}/**`,
|
|
104
|
-
negated: true
|
|
105
|
-
})),
|
|
106
|
-
...TAILWIND_V4_IGNORED_EXTENSIONS.map((extension) => ({
|
|
107
|
-
base: root,
|
|
108
|
-
pattern: `**/*.${extension}`,
|
|
109
|
-
negated: true
|
|
110
|
-
})),
|
|
111
|
-
...TAILWIND_V4_IGNORED_FILES.map((pattern) => ({
|
|
112
|
-
base: root,
|
|
113
|
-
pattern: `**/${pattern}`,
|
|
114
|
-
negated: true
|
|
115
|
-
}))
|
|
116
|
-
] : [], ...outDirIgnore ? [{
|
|
117
|
-
base: root,
|
|
118
|
-
pattern: outDirIgnore,
|
|
119
|
-
negated: true
|
|
120
|
-
}] : []];
|
|
121
|
-
}
|
|
122
|
-
function resolveSourceCandidateExtension(id) {
|
|
123
|
-
const normalized = cleanUrl(id);
|
|
124
|
-
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
125
|
-
}
|
|
126
|
-
function createSourceCandidateContentCacheKey(extension, source, bareArbitraryValues, extractor) {
|
|
127
|
-
return `${extension}\0${JSON.stringify(bareArbitraryValues ?? false)}\0${extractor ? "custom" : "default"}\0${source}`;
|
|
128
|
-
}
|
|
129
|
-
async function extractCandidates(source, extension, options) {
|
|
130
|
-
if (options.extractor) return new Set(await options.extractor(source, extension));
|
|
131
|
-
return new Set(await extractSourceCandidates(source, extension, { ...options.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: options.bareArbitraryValues } }));
|
|
132
|
-
}
|
|
133
|
-
function createTailwindV3DefaultExtractor() {
|
|
134
|
-
try {
|
|
135
|
-
const defaultExtractorModule = require("tailwindcss/lib/lib/defaultExtractor");
|
|
136
|
-
const resolveConfigModule = require("tailwindcss/resolveConfig");
|
|
137
|
-
const resolveConfig = resolveConfigModule.default ?? resolveConfigModule;
|
|
138
|
-
const extractor = (defaultExtractorModule.defaultExtractor ?? defaultExtractorModule.default ?? defaultExtractorModule)({ tailwindConfig: resolveConfig({ content: [] }) });
|
|
139
|
-
return (source) => new Set(extractor(source).filter((candidate) => !TAILWIND_V3_HTML_TOKEN_CANDIDATES.has(candidate)));
|
|
140
|
-
} catch {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function isSourceCandidateRequest(id) {
|
|
145
|
-
return FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
146
|
-
}
|
|
147
|
-
function removeCandidateSet(candidateCount, candidates) {
|
|
148
|
-
for (const candidate of candidates) {
|
|
149
|
-
const count = candidateCount.get(candidate);
|
|
150
|
-
if (count == null) continue;
|
|
151
|
-
if (count <= 1) {
|
|
152
|
-
candidateCount.delete(candidate);
|
|
153
|
-
continue;
|
|
154
|
-
}
|
|
155
|
-
candidateCount.set(candidate, count - 1);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function addCandidateSet(candidateCount, candidates) {
|
|
159
|
-
for (const candidate of candidates) candidateCount.set(candidate, (candidateCount.get(candidate) ?? 0) + 1);
|
|
160
|
-
}
|
|
161
|
-
function createSourceCandidateCollector(options = {}) {
|
|
162
|
-
const candidatesById = /* @__PURE__ */ new Map();
|
|
163
|
-
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
164
|
-
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
165
|
-
const cssCandidatesById = /* @__PURE__ */ new Map();
|
|
166
|
-
const candidateCount = /* @__PURE__ */ new Map();
|
|
167
|
-
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
168
|
-
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
169
|
-
async function sync(id, source) {
|
|
170
|
-
const normalizedId = cleanUrl(id);
|
|
171
|
-
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
172
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.extractor);
|
|
173
|
-
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
174
|
-
if (cachedCandidates) {
|
|
175
|
-
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
const nextCandidates = await extractCandidates(source, extension, options);
|
|
179
|
-
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
180
|
-
replaceScanLayer(normalizedId, nextCandidates);
|
|
181
|
-
}
|
|
182
|
-
async function syncCss(id, source) {
|
|
183
|
-
const normalizedId = cleanUrl(id);
|
|
184
|
-
const contentCacheKey = createSourceCandidateContentCacheKey("css", source, options.bareArbitraryValues, options.extractor);
|
|
185
|
-
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
186
|
-
if (cachedCandidates) {
|
|
187
|
-
replaceCssLayer(normalizedId, new Set(cachedCandidates));
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const nextCandidates = await extractCandidates(source, "css", options);
|
|
191
|
-
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
192
|
-
replaceCssLayer(normalizedId, nextCandidates);
|
|
193
|
-
}
|
|
194
|
-
async function merge(id, source) {
|
|
195
|
-
const normalizedId = cleanUrl(id);
|
|
196
|
-
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
197
|
-
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source, options.bareArbitraryValues, options.extractor);
|
|
198
|
-
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
199
|
-
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : await extractCandidates(source, extension, options);
|
|
200
|
-
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|
|
201
|
-
replaceTransformLayer(normalizedId, extractedCandidates);
|
|
202
|
-
}
|
|
203
|
-
async function syncFile(id) {
|
|
204
|
-
const normalizedId = cleanUrl(id);
|
|
205
|
-
await sync(normalizedId, await readFile(normalizedId, "utf8"));
|
|
206
|
-
}
|
|
207
|
-
async function syncCurrentFile(id) {
|
|
208
|
-
const normalizedId = cleanUrl(id);
|
|
209
|
-
transformCandidatesById.delete(normalizedId);
|
|
210
|
-
await syncFile(normalizedId);
|
|
211
|
-
}
|
|
212
|
-
async function scanRoot({ entries, explicit, root, outDir }) {
|
|
213
|
-
const resolvedRoot = path.resolve(root);
|
|
214
|
-
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, outDir);
|
|
215
|
-
const scanEntries = normalizeScanEntries(resolvedRoot, entries, outDirIgnore);
|
|
216
|
-
const ignoredSources = createDefaultIgnoredSources(resolvedRoot, outDirIgnore, entries, explicit);
|
|
217
|
-
const files = await resolveProjectSourceFiles({
|
|
218
|
-
cwd: resolvedRoot,
|
|
219
|
-
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
220
|
-
...ignoredSources.length > 0 ? { ignoredSources } : {},
|
|
221
|
-
filter: isSourceCandidateRequest
|
|
222
|
-
});
|
|
223
|
-
await Promise.all(files.map((file) => syncFile(resolveSourceScanPath(file))));
|
|
224
|
-
}
|
|
225
|
-
function replaceFinal(id, nextCandidates) {
|
|
226
|
-
const normalizedId = cleanUrl(id);
|
|
227
|
-
const previousCandidates = candidatesById.get(normalizedId);
|
|
228
|
-
if (previousCandidates) {
|
|
229
|
-
removeCandidateSet(candidateCount, previousCandidates);
|
|
230
|
-
candidatesById.delete(normalizedId);
|
|
231
|
-
}
|
|
232
|
-
if (nextCandidates.size === 0) return;
|
|
233
|
-
candidatesById.set(normalizedId, nextCandidates);
|
|
234
|
-
addCandidateSet(candidateCount, nextCandidates);
|
|
235
|
-
}
|
|
236
|
-
function replaceScanLayer(id, nextCandidates) {
|
|
237
|
-
const normalizedId = cleanUrl(id);
|
|
238
|
-
if (nextCandidates.size === 0) scanCandidatesById.delete(normalizedId);
|
|
239
|
-
else scanCandidatesById.set(normalizedId, nextCandidates);
|
|
240
|
-
recompute(normalizedId);
|
|
241
|
-
}
|
|
242
|
-
function replaceTransformLayer(id, nextCandidates) {
|
|
243
|
-
const normalizedId = cleanUrl(id);
|
|
244
|
-
if (nextCandidates.size === 0) transformCandidatesById.delete(normalizedId);
|
|
245
|
-
else transformCandidatesById.set(normalizedId, nextCandidates);
|
|
246
|
-
recompute(normalizedId);
|
|
247
|
-
}
|
|
248
|
-
function replaceCssLayer(id, nextCandidates) {
|
|
249
|
-
const normalizedId = cleanUrl(id);
|
|
250
|
-
if (nextCandidates.size === 0) cssCandidatesById.delete(normalizedId);
|
|
251
|
-
else cssCandidatesById.set(normalizedId, nextCandidates);
|
|
252
|
-
recompute(normalizedId);
|
|
253
|
-
}
|
|
254
|
-
function recompute(id) {
|
|
255
|
-
const normalizedId = cleanUrl(id);
|
|
256
|
-
replaceFinal(normalizedId, new Set([
|
|
257
|
-
...scanCandidatesById.get(normalizedId) ?? [],
|
|
258
|
-
...transformCandidatesById.get(normalizedId) ?? [],
|
|
259
|
-
...cssCandidatesById.get(normalizedId) ?? []
|
|
260
|
-
]));
|
|
261
|
-
}
|
|
262
|
-
function syncInline(inlineCandidates) {
|
|
263
|
-
inlineIncludedCandidates = new Set(inlineCandidates?.included ?? []);
|
|
264
|
-
inlineExcludedCandidates = new Set(inlineCandidates?.excluded ?? []);
|
|
265
|
-
}
|
|
266
|
-
function remove(id) {
|
|
267
|
-
const normalizedId = cleanUrl(id);
|
|
268
|
-
scanCandidatesById.delete(normalizedId);
|
|
269
|
-
transformCandidatesById.delete(normalizedId);
|
|
270
|
-
cssCandidatesById.delete(normalizedId);
|
|
271
|
-
const previousCandidates = candidatesById.get(normalizedId);
|
|
272
|
-
if (!previousCandidates) return;
|
|
273
|
-
removeCandidateSet(candidateCount, previousCandidates);
|
|
274
|
-
candidatesById.delete(normalizedId);
|
|
275
|
-
}
|
|
276
|
-
function values() {
|
|
277
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
278
|
-
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
279
|
-
return values;
|
|
280
|
-
}
|
|
281
|
-
function valuesForEntries(entries) {
|
|
282
|
-
if (entries === void 0) return values();
|
|
283
|
-
const filtered = /* @__PURE__ */ new Set();
|
|
284
|
-
for (const [id, candidates] of candidatesById) {
|
|
285
|
-
if (!isFileMatchedByTailwindSourceEntries(id, entries)) continue;
|
|
286
|
-
for (const candidate of candidates) filtered.add(candidate);
|
|
287
|
-
}
|
|
288
|
-
for (const candidate of inlineIncludedCandidates) filtered.add(candidate);
|
|
289
|
-
for (const candidate of inlineExcludedCandidates) filtered.delete(candidate);
|
|
290
|
-
return filtered;
|
|
291
|
-
}
|
|
292
|
-
function clear() {
|
|
293
|
-
candidatesById.clear();
|
|
294
|
-
scanCandidatesById.clear();
|
|
295
|
-
transformCandidatesById.clear();
|
|
296
|
-
cssCandidatesById.clear();
|
|
297
|
-
candidateCount.clear();
|
|
298
|
-
inlineIncludedCandidates.clear();
|
|
299
|
-
inlineExcludedCandidates.clear();
|
|
300
|
-
}
|
|
301
|
-
function snapshot() {
|
|
302
|
-
return {
|
|
303
|
-
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
304
|
-
cssCandidatesById: [...cssCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
305
|
-
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
306
|
-
transformCandidatesById: [...transformCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
307
|
-
inlineExcludedCandidates: [...inlineExcludedCandidates],
|
|
308
|
-
inlineIncludedCandidates: [...inlineIncludedCandidates]
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
function restore(snapshot) {
|
|
312
|
-
clear();
|
|
313
|
-
inlineExcludedCandidates = new Set(snapshot.inlineExcludedCandidates);
|
|
314
|
-
inlineIncludedCandidates = new Set(snapshot.inlineIncludedCandidates);
|
|
315
|
-
const scanEntries = snapshot.scanCandidatesById ?? snapshot.candidatesById;
|
|
316
|
-
for (const [id, candidates] of scanEntries) {
|
|
317
|
-
const candidateSet = new Set(candidates);
|
|
318
|
-
if (candidateSet.size === 0) continue;
|
|
319
|
-
scanCandidatesById.set(id, candidateSet);
|
|
320
|
-
}
|
|
321
|
-
for (const [id, candidates] of snapshot.transformCandidatesById ?? []) {
|
|
322
|
-
const candidateSet = new Set(candidates);
|
|
323
|
-
if (candidateSet.size === 0) continue;
|
|
324
|
-
transformCandidatesById.set(id, candidateSet);
|
|
325
|
-
}
|
|
326
|
-
for (const [id, candidates] of snapshot.cssCandidatesById ?? []) {
|
|
327
|
-
const candidateSet = new Set(candidates);
|
|
328
|
-
if (candidateSet.size === 0) continue;
|
|
329
|
-
cssCandidatesById.set(id, candidateSet);
|
|
330
|
-
}
|
|
331
|
-
for (const [id, candidates] of snapshot.candidatesById) {
|
|
332
|
-
const candidateSet = new Set(candidates);
|
|
333
|
-
if (candidateSet.size === 0) continue;
|
|
334
|
-
candidatesById.set(id, candidateSet);
|
|
335
|
-
addCandidateSet(candidateCount, candidateSet);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return {
|
|
339
|
-
sync,
|
|
340
|
-
syncCss,
|
|
341
|
-
merge,
|
|
342
|
-
syncFile,
|
|
343
|
-
syncCurrentFile,
|
|
344
|
-
scanRoot,
|
|
345
|
-
syncInline,
|
|
346
|
-
remove,
|
|
347
|
-
values,
|
|
348
|
-
valuesForEntries,
|
|
349
|
-
snapshot,
|
|
350
|
-
restore,
|
|
351
|
-
clear
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
//#endregion
|
|
355
|
-
export { createTailwindV3DefaultExtractor as n, isSourceCandidateRequest as r, createSourceCandidateCollector as t };
|