weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.21
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/README.md +6 -7
- package/bin/weapp-tailwindcss.js +1 -21
- package/dist/bundle-state-BnV8o2Yn.js +530 -0
- package/dist/bundle-state-CLnuf2CW.mjs +414 -0
- package/dist/bundlers/shared/cache.d.ts +6 -6
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -4
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
- package/dist/bundlers/shared/generator-css.d.ts +16 -22
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
- package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
- package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/index.d.ts +1 -1
- package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
- package/dist/bundlers/vite/postcss-config.d.ts +6 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
- package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
- package/dist/bundlers/vite/source-candidates.d.ts +16 -1
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/cli/context.d.ts +1 -14
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +605 -611
- package/dist/cli.mjs +614 -620
- package/dist/constants.d.ts +1 -2
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +3 -2
- package/dist/css-macro/postcss.mjs +3 -2
- package/dist/css-macro.d.ts +1 -0
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults-B1igPF_e.mjs +150 -0
- package/dist/defaults-IHhYxNeU.js +193 -0
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +6 -131
- package/dist/defaults.mjs +2 -129
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/index.d.ts +1 -1
- package/dist/generator/options.d.ts +9 -8
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator-B4RNgMLx.js +55 -0
- package/dist/generator-DvyhmC76.mjs +32 -0
- package/dist/generator.js +12 -11
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +185 -47
- package/dist/gulp.mjs +179 -41
- package/dist/incremental-runtime-class-set-C7Q7fC5u.mjs +1863 -0
- package/dist/incremental-runtime-class-set-DZsbM0-a.js +1926 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/index.d.ts +1 -0
- package/dist/js/literal-transform.d.ts +2 -0
- package/dist/js/precheck.d.ts +2 -2
- package/dist/logger-CZUxvJJD.mjs +2 -0
- package/dist/logger-EVNB9z7i.js +1 -0
- package/dist/postcss/config-directive.d.ts +1 -0
- package/dist/postcss/context.d.ts +9 -0
- package/dist/postcss/source-files.d.ts +8 -0
- package/dist/postcss/tailwind-version.d.ts +3 -0
- package/dist/postcss-CFa6-qO9.js +237 -0
- package/dist/postcss-Drpy7j-g.mjs +228 -0
- package/dist/postcss.d.ts +2 -2
- package/dist/postcss.js +3 -276
- package/dist/postcss.mjs +1 -269
- package/dist/{recorder-gYSNLfOP.js → precheck-8pQbjqpq.js} +218 -314
- package/dist/{recorder-zsgatmkB.mjs → precheck-D1O5AWzy.mjs} +186 -281
- package/dist/presets.js +13 -11
- package/dist/presets.mjs +11 -9
- package/dist/reset.d.ts +1 -0
- package/dist/runtime-registry-CdCV3Opt.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-CUTNdsiz.js +222 -0
- package/dist/source-candidates-CnD4vyic.mjs +209 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.d.ts +1 -2
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +11 -12
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
- package/dist/tailwindcss/v4/patcher.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
- package/dist/tailwindcss/version.d.ts +4 -0
- package/dist/tailwindcss-B_JAdOQf.mjs +600 -0
- package/dist/tailwindcss-whZE3HpL.js +651 -0
- package/dist/typedoc.export.d.ts +0 -2
- package/dist/types/index.d.ts +51 -48
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +23 -23
- package/dist/types/user-defined-options/important.d.ts +31 -28
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/utils/disabled.d.ts +2 -3
- package/dist/utils/object.d.ts +9 -0
- package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
- package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
- package/dist/v3-engine-CCwvhRrQ.js +3473 -0
- package/dist/v3-engine-DyIcbpZm.mjs +3190 -0
- package/dist/{vite-CrlzCNqz.mjs → vite-B8IiXgVD.mjs} +1256 -1088
- package/dist/vite-BcnwgJMt.js +2368 -0
- package/dist/vite.d.ts +1 -2
- package/dist/vite.js +3 -4
- package/dist/vite.mjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.js +4533 -16
- package/dist/weapp-tw-runtime-classset-loader.js +33 -7
- package/dist/webpack-C4zI624R.js +846 -0
- package/dist/webpack-DTkshAtp.mjs +836 -0
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +27 -37
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
- package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
- package/dist/cli/config.d.ts +0 -5
- package/dist/cli/helpers/patch-cwd.d.ts +0 -1
- package/dist/cli/mount-options/patch-status.d.ts +0 -2
- package/dist/cli/patch-options.d.ts +0 -6
- package/dist/cli/tokens.d.ts +0 -4
- package/dist/cli/workspace/package-dirs.d.ts +0 -3
- package/dist/cli/workspace/patch-package.d.ts +0 -3
- package/dist/cli/workspace/patch-utils.d.ts +0 -3
- package/dist/cli/workspace/types.d.ts +0 -11
- package/dist/cli/workspace/workspace-globs.d.ts +0 -2
- package/dist/cli/workspace/workspace-io.d.ts +0 -1
- package/dist/cli/workspace/workspace-lock.d.ts +0 -1
- package/dist/cli/workspace.d.ts +0 -2
- package/dist/css-imports-BbrbluP9.js +0 -177
- package/dist/css-imports-CSdPq_Sc.mjs +0 -128
- package/dist/experimental/index.d.ts +0 -2
- package/dist/experimental/oxc/ast-utils.d.ts +0 -30
- package/dist/experimental/oxc/index.d.ts +0 -2
- package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
- package/dist/experimental/shared/cache.d.ts +0 -3
- package/dist/experimental/shared/transform.d.ts +0 -3
- package/dist/experimental/shared.d.ts +0 -8
- package/dist/experimental/swc/ast-utils.d.ts +0 -30
- package/dist/experimental/swc/index.d.ts +0 -2
- package/dist/experimental/swc/module-specifiers.d.ts +0 -2
- package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
- package/dist/generator-css-B5ejWUMv.mjs +0 -1098
- package/dist/generator-css-D3OdPRiS.js +0 -1125
- package/dist/generator-mmhXzZnv.js +0 -1276
- package/dist/js/syntax.d.ts +0 -10
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/loader-anchors-CNkWT8hx.js +0 -273
- package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
- package/dist/logger-BZ45DZJT.js +0 -1003
- package/dist/logger-BoVx1Dbt.mjs +0 -935
- package/dist/patcher-options-6gJN2EXy.js +0 -115
- package/dist/patcher-options-DQfR5xxT.mjs +0 -92
- package/dist/tailwindcss/recorder.d.ts +0 -13
- package/dist/tailwindcss/targets/paths.d.ts +0 -13
- package/dist/tailwindcss/targets/record-io.d.ts +0 -5
- package/dist/tailwindcss/targets/recorder.d.ts +0 -3
- package/dist/tailwindcss/targets/types.d.ts +0 -35
- package/dist/types/disabled-options.d.ts +0 -4
- package/dist/vite-BC9U7ahn.js +0 -2199
- package/dist/webpack-Bu6M-Hbw.mjs +0 -441
- package/dist/webpack-DD7A6V0u.js +0 -456
- package/dist/webpack4.d.ts +0 -4
- package/dist/webpack4.js +0 -387
- package/dist/webpack4.mjs +0 -379
- package/scripts/postinstall.mjs +0 -59
- /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
- /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
package/dist/shared/mpx.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AppType } from '../types';
|
|
2
2
|
export declare function isMpx(appType?: AppType): appType is "mpx";
|
|
3
3
|
export declare function getTailwindcssCssEntry(pkgDir: string): string;
|
|
4
|
+
export declare function patchMpxWebpackPluginNormalizeLib(compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
|
|
4
5
|
export declare function ensureMpxTailwindcssAliases(compiler: any, pkgDir: string): string;
|
|
5
6
|
export declare function patchMpxLoaderResolve(loaderContext: any, pkgDir: string, enabled: boolean): void;
|
|
6
7
|
export declare function setupMpxTailwindcssRedirect(pkgDir: string, enabled: boolean): void;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
node_path = require_chunk.__toESM(node_path);
|
|
5
|
+
let tailwindcss_patch = require("tailwindcss-patch");
|
|
6
|
+
let node_fs_promises = require("node:fs/promises");
|
|
7
|
+
//#region src/bundlers/vite/source-candidates.ts
|
|
8
|
+
const CLEAN_URL_RE = /[?#].*$/;
|
|
9
|
+
const sourceCandidateContentCache = /* @__PURE__ */ new Map();
|
|
10
|
+
function cleanUrl(id) {
|
|
11
|
+
return require_v3_engine.resolveSourceScanPath(id.replace(CLEAN_URL_RE, ""));
|
|
12
|
+
}
|
|
13
|
+
function resolveOutDirIgnorePattern(root, outDir) {
|
|
14
|
+
if (!outDir) return;
|
|
15
|
+
const relative = node_path.default.relative(root, node_path.default.resolve(root, outDir));
|
|
16
|
+
if (!relative || relative.startsWith("..") || node_path.default.isAbsolute(relative)) return;
|
|
17
|
+
return `${require_v3_engine.toPosixPath(relative)}/**`;
|
|
18
|
+
}
|
|
19
|
+
function resolveSourceCandidateExtension(id) {
|
|
20
|
+
const normalized = cleanUrl(id);
|
|
21
|
+
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
22
|
+
}
|
|
23
|
+
function createSourceCandidateContentCacheKey(extension, source) {
|
|
24
|
+
return `${extension}\0${source}`;
|
|
25
|
+
}
|
|
26
|
+
function isSourceCandidateRequest(id) {
|
|
27
|
+
return require_v3_engine.FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
28
|
+
}
|
|
29
|
+
function removeCandidateSet(candidateCount, candidates) {
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
const count = candidateCount.get(candidate);
|
|
32
|
+
if (count == null) continue;
|
|
33
|
+
if (count <= 1) {
|
|
34
|
+
candidateCount.delete(candidate);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
candidateCount.set(candidate, count - 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function addCandidateSet(candidateCount, candidates) {
|
|
41
|
+
for (const candidate of candidates) candidateCount.set(candidate, (candidateCount.get(candidate) ?? 0) + 1);
|
|
42
|
+
}
|
|
43
|
+
function createSourceCandidateCollector() {
|
|
44
|
+
const candidatesById = /* @__PURE__ */ new Map();
|
|
45
|
+
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
46
|
+
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
47
|
+
const candidateCount = /* @__PURE__ */ new Map();
|
|
48
|
+
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
49
|
+
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
50
|
+
async function sync(id, source) {
|
|
51
|
+
const normalizedId = cleanUrl(id);
|
|
52
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
53
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
54
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
55
|
+
if (cachedCandidates) {
|
|
56
|
+
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const nextCandidates = new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension));
|
|
60
|
+
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
61
|
+
replaceScanLayer(normalizedId, nextCandidates);
|
|
62
|
+
}
|
|
63
|
+
async function merge(id, source) {
|
|
64
|
+
const normalizedId = cleanUrl(id);
|
|
65
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
66
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
67
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
68
|
+
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await (0, tailwindcss_patch.extractSourceCandidates)(source, extension));
|
|
69
|
+
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|
|
70
|
+
replaceTransformLayer(normalizedId, extractedCandidates);
|
|
71
|
+
}
|
|
72
|
+
async function syncFile(id) {
|
|
73
|
+
const normalizedId = cleanUrl(id);
|
|
74
|
+
await sync(normalizedId, await (0, node_fs_promises.readFile)(normalizedId, "utf8"));
|
|
75
|
+
}
|
|
76
|
+
async function syncCurrentFile(id) {
|
|
77
|
+
const normalizedId = cleanUrl(id);
|
|
78
|
+
transformCandidatesById.delete(normalizedId);
|
|
79
|
+
await syncFile(normalizedId);
|
|
80
|
+
}
|
|
81
|
+
async function scanRoot({ entries, root, outDir }) {
|
|
82
|
+
const resolvedRoot = node_path.default.resolve(root);
|
|
83
|
+
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, outDir);
|
|
84
|
+
const scanEntries = outDirIgnore ? [...entries?.length ? entries : [{
|
|
85
|
+
base: resolvedRoot,
|
|
86
|
+
pattern: "**/*",
|
|
87
|
+
negated: false
|
|
88
|
+
}], {
|
|
89
|
+
base: resolvedRoot,
|
|
90
|
+
pattern: outDirIgnore,
|
|
91
|
+
negated: true
|
|
92
|
+
}] : entries;
|
|
93
|
+
const files = await (0, tailwindcss_patch.resolveProjectSourceFiles)({
|
|
94
|
+
cwd: resolvedRoot,
|
|
95
|
+
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
96
|
+
filter: isSourceCandidateRequest
|
|
97
|
+
});
|
|
98
|
+
await Promise.all(files.map((file) => syncFile(file)));
|
|
99
|
+
}
|
|
100
|
+
function replaceFinal(id, nextCandidates) {
|
|
101
|
+
const normalizedId = cleanUrl(id);
|
|
102
|
+
const previousCandidates = candidatesById.get(normalizedId);
|
|
103
|
+
if (previousCandidates) {
|
|
104
|
+
removeCandidateSet(candidateCount, previousCandidates);
|
|
105
|
+
candidatesById.delete(normalizedId);
|
|
106
|
+
}
|
|
107
|
+
if (nextCandidates.size === 0) return;
|
|
108
|
+
candidatesById.set(normalizedId, nextCandidates);
|
|
109
|
+
addCandidateSet(candidateCount, nextCandidates);
|
|
110
|
+
}
|
|
111
|
+
function replaceScanLayer(id, nextCandidates) {
|
|
112
|
+
const normalizedId = cleanUrl(id);
|
|
113
|
+
if (nextCandidates.size === 0) scanCandidatesById.delete(normalizedId);
|
|
114
|
+
else scanCandidatesById.set(normalizedId, nextCandidates);
|
|
115
|
+
recompute(normalizedId);
|
|
116
|
+
}
|
|
117
|
+
function replaceTransformLayer(id, nextCandidates) {
|
|
118
|
+
const normalizedId = cleanUrl(id);
|
|
119
|
+
if (nextCandidates.size === 0) transformCandidatesById.delete(normalizedId);
|
|
120
|
+
else transformCandidatesById.set(normalizedId, nextCandidates);
|
|
121
|
+
recompute(normalizedId);
|
|
122
|
+
}
|
|
123
|
+
function recompute(id) {
|
|
124
|
+
const normalizedId = cleanUrl(id);
|
|
125
|
+
replaceFinal(normalizedId, new Set([...scanCandidatesById.get(normalizedId) ?? [], ...transformCandidatesById.get(normalizedId) ?? []]));
|
|
126
|
+
}
|
|
127
|
+
function syncInline(inlineCandidates) {
|
|
128
|
+
inlineIncludedCandidates = new Set(inlineCandidates?.included ?? []);
|
|
129
|
+
inlineExcludedCandidates = new Set(inlineCandidates?.excluded ?? []);
|
|
130
|
+
}
|
|
131
|
+
function remove(id) {
|
|
132
|
+
const normalizedId = cleanUrl(id);
|
|
133
|
+
scanCandidatesById.delete(normalizedId);
|
|
134
|
+
transformCandidatesById.delete(normalizedId);
|
|
135
|
+
const previousCandidates = candidatesById.get(normalizedId);
|
|
136
|
+
if (!previousCandidates) return;
|
|
137
|
+
removeCandidateSet(candidateCount, previousCandidates);
|
|
138
|
+
candidatesById.delete(normalizedId);
|
|
139
|
+
}
|
|
140
|
+
function values() {
|
|
141
|
+
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
142
|
+
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
143
|
+
return values;
|
|
144
|
+
}
|
|
145
|
+
function valuesForEntries(entries) {
|
|
146
|
+
if (entries === void 0) return values();
|
|
147
|
+
const filtered = /* @__PURE__ */ new Set();
|
|
148
|
+
for (const [id, candidates] of candidatesById) {
|
|
149
|
+
if (!require_v3_engine.isFileMatchedByTailwindSourceEntries(id, entries)) continue;
|
|
150
|
+
for (const candidate of candidates) filtered.add(candidate);
|
|
151
|
+
}
|
|
152
|
+
for (const candidate of inlineIncludedCandidates) filtered.add(candidate);
|
|
153
|
+
for (const candidate of inlineExcludedCandidates) filtered.delete(candidate);
|
|
154
|
+
return filtered;
|
|
155
|
+
}
|
|
156
|
+
function clear() {
|
|
157
|
+
candidatesById.clear();
|
|
158
|
+
scanCandidatesById.clear();
|
|
159
|
+
transformCandidatesById.clear();
|
|
160
|
+
candidateCount.clear();
|
|
161
|
+
inlineIncludedCandidates.clear();
|
|
162
|
+
inlineExcludedCandidates.clear();
|
|
163
|
+
}
|
|
164
|
+
function snapshot() {
|
|
165
|
+
return {
|
|
166
|
+
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
167
|
+
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
168
|
+
transformCandidatesById: [...transformCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
169
|
+
inlineExcludedCandidates: [...inlineExcludedCandidates],
|
|
170
|
+
inlineIncludedCandidates: [...inlineIncludedCandidates]
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function restore(snapshot) {
|
|
174
|
+
clear();
|
|
175
|
+
inlineExcludedCandidates = new Set(snapshot.inlineExcludedCandidates);
|
|
176
|
+
inlineIncludedCandidates = new Set(snapshot.inlineIncludedCandidates);
|
|
177
|
+
const scanEntries = snapshot.scanCandidatesById ?? snapshot.candidatesById;
|
|
178
|
+
for (const [id, candidates] of scanEntries) {
|
|
179
|
+
const candidateSet = new Set(candidates);
|
|
180
|
+
if (candidateSet.size === 0) continue;
|
|
181
|
+
scanCandidatesById.set(id, candidateSet);
|
|
182
|
+
}
|
|
183
|
+
for (const [id, candidates] of snapshot.transformCandidatesById ?? []) {
|
|
184
|
+
const candidateSet = new Set(candidates);
|
|
185
|
+
if (candidateSet.size === 0) continue;
|
|
186
|
+
transformCandidatesById.set(id, candidateSet);
|
|
187
|
+
}
|
|
188
|
+
for (const [id, candidates] of snapshot.candidatesById) {
|
|
189
|
+
const candidateSet = new Set(candidates);
|
|
190
|
+
if (candidateSet.size === 0) continue;
|
|
191
|
+
candidatesById.set(id, candidateSet);
|
|
192
|
+
addCandidateSet(candidateCount, candidateSet);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
sync,
|
|
197
|
+
merge,
|
|
198
|
+
syncFile,
|
|
199
|
+
syncCurrentFile,
|
|
200
|
+
scanRoot,
|
|
201
|
+
syncInline,
|
|
202
|
+
remove,
|
|
203
|
+
values,
|
|
204
|
+
valuesForEntries,
|
|
205
|
+
snapshot,
|
|
206
|
+
restore,
|
|
207
|
+
clear
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
Object.defineProperty(exports, "createSourceCandidateCollector", {
|
|
212
|
+
enumerable: true,
|
|
213
|
+
get: function() {
|
|
214
|
+
return createSourceCandidateCollector;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(exports, "isSourceCandidateRequest", {
|
|
218
|
+
enumerable: true,
|
|
219
|
+
get: function() {
|
|
220
|
+
return isSourceCandidateRequest;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-DyIcbpZm.mjs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
//#region src/bundlers/vite/source-candidates.ts
|
|
6
|
+
const CLEAN_URL_RE = /[?#].*$/;
|
|
7
|
+
const sourceCandidateContentCache = /* @__PURE__ */ new Map();
|
|
8
|
+
function cleanUrl(id) {
|
|
9
|
+
return resolveSourceScanPath(id.replace(CLEAN_URL_RE, ""));
|
|
10
|
+
}
|
|
11
|
+
function resolveOutDirIgnorePattern(root, outDir) {
|
|
12
|
+
if (!outDir) return;
|
|
13
|
+
const relative = path.relative(root, path.resolve(root, outDir));
|
|
14
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return;
|
|
15
|
+
return `${toPosixPath(relative)}/**`;
|
|
16
|
+
}
|
|
17
|
+
function resolveSourceCandidateExtension(id) {
|
|
18
|
+
const normalized = cleanUrl(id);
|
|
19
|
+
return /\.([^.\\/]+)$/.exec(normalized)?.[1] ?? "html";
|
|
20
|
+
}
|
|
21
|
+
function createSourceCandidateContentCacheKey(extension, source) {
|
|
22
|
+
return `${extension}\0${source}`;
|
|
23
|
+
}
|
|
24
|
+
function isSourceCandidateRequest(id) {
|
|
25
|
+
return FULL_SOURCE_SCAN_EXTENSION_RE.test(cleanUrl(id));
|
|
26
|
+
}
|
|
27
|
+
function removeCandidateSet(candidateCount, candidates) {
|
|
28
|
+
for (const candidate of candidates) {
|
|
29
|
+
const count = candidateCount.get(candidate);
|
|
30
|
+
if (count == null) continue;
|
|
31
|
+
if (count <= 1) {
|
|
32
|
+
candidateCount.delete(candidate);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
candidateCount.set(candidate, count - 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function addCandidateSet(candidateCount, candidates) {
|
|
39
|
+
for (const candidate of candidates) candidateCount.set(candidate, (candidateCount.get(candidate) ?? 0) + 1);
|
|
40
|
+
}
|
|
41
|
+
function createSourceCandidateCollector() {
|
|
42
|
+
const candidatesById = /* @__PURE__ */ new Map();
|
|
43
|
+
const scanCandidatesById = /* @__PURE__ */ new Map();
|
|
44
|
+
const transformCandidatesById = /* @__PURE__ */ new Map();
|
|
45
|
+
const candidateCount = /* @__PURE__ */ new Map();
|
|
46
|
+
let inlineIncludedCandidates = /* @__PURE__ */ new Set();
|
|
47
|
+
let inlineExcludedCandidates = /* @__PURE__ */ new Set();
|
|
48
|
+
async function sync(id, source) {
|
|
49
|
+
const normalizedId = cleanUrl(id);
|
|
50
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
51
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
52
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
53
|
+
if (cachedCandidates) {
|
|
54
|
+
replaceScanLayer(normalizedId, new Set(cachedCandidates));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const nextCandidates = new Set(await extractSourceCandidates(source, extension));
|
|
58
|
+
sourceCandidateContentCache.set(contentCacheKey, [...nextCandidates]);
|
|
59
|
+
replaceScanLayer(normalizedId, nextCandidates);
|
|
60
|
+
}
|
|
61
|
+
async function merge(id, source) {
|
|
62
|
+
const normalizedId = cleanUrl(id);
|
|
63
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
64
|
+
const contentCacheKey = createSourceCandidateContentCacheKey(extension, source);
|
|
65
|
+
const cachedCandidates = sourceCandidateContentCache.get(contentCacheKey);
|
|
66
|
+
const extractedCandidates = cachedCandidates ? new Set(cachedCandidates) : new Set(await extractSourceCandidates(source, extension));
|
|
67
|
+
if (!cachedCandidates) sourceCandidateContentCache.set(contentCacheKey, [...extractedCandidates]);
|
|
68
|
+
replaceTransformLayer(normalizedId, extractedCandidates);
|
|
69
|
+
}
|
|
70
|
+
async function syncFile(id) {
|
|
71
|
+
const normalizedId = cleanUrl(id);
|
|
72
|
+
await sync(normalizedId, await readFile(normalizedId, "utf8"));
|
|
73
|
+
}
|
|
74
|
+
async function syncCurrentFile(id) {
|
|
75
|
+
const normalizedId = cleanUrl(id);
|
|
76
|
+
transformCandidatesById.delete(normalizedId);
|
|
77
|
+
await syncFile(normalizedId);
|
|
78
|
+
}
|
|
79
|
+
async function scanRoot({ entries, root, outDir }) {
|
|
80
|
+
const resolvedRoot = path.resolve(root);
|
|
81
|
+
const outDirIgnore = resolveOutDirIgnorePattern(resolvedRoot, outDir);
|
|
82
|
+
const scanEntries = outDirIgnore ? [...entries?.length ? entries : [{
|
|
83
|
+
base: resolvedRoot,
|
|
84
|
+
pattern: "**/*",
|
|
85
|
+
negated: false
|
|
86
|
+
}], {
|
|
87
|
+
base: resolvedRoot,
|
|
88
|
+
pattern: outDirIgnore,
|
|
89
|
+
negated: true
|
|
90
|
+
}] : entries;
|
|
91
|
+
const files = await resolveProjectSourceFiles({
|
|
92
|
+
cwd: resolvedRoot,
|
|
93
|
+
...scanEntries === void 0 ? {} : { sources: scanEntries },
|
|
94
|
+
filter: isSourceCandidateRequest
|
|
95
|
+
});
|
|
96
|
+
await Promise.all(files.map((file) => syncFile(file)));
|
|
97
|
+
}
|
|
98
|
+
function replaceFinal(id, nextCandidates) {
|
|
99
|
+
const normalizedId = cleanUrl(id);
|
|
100
|
+
const previousCandidates = candidatesById.get(normalizedId);
|
|
101
|
+
if (previousCandidates) {
|
|
102
|
+
removeCandidateSet(candidateCount, previousCandidates);
|
|
103
|
+
candidatesById.delete(normalizedId);
|
|
104
|
+
}
|
|
105
|
+
if (nextCandidates.size === 0) return;
|
|
106
|
+
candidatesById.set(normalizedId, nextCandidates);
|
|
107
|
+
addCandidateSet(candidateCount, nextCandidates);
|
|
108
|
+
}
|
|
109
|
+
function replaceScanLayer(id, nextCandidates) {
|
|
110
|
+
const normalizedId = cleanUrl(id);
|
|
111
|
+
if (nextCandidates.size === 0) scanCandidatesById.delete(normalizedId);
|
|
112
|
+
else scanCandidatesById.set(normalizedId, nextCandidates);
|
|
113
|
+
recompute(normalizedId);
|
|
114
|
+
}
|
|
115
|
+
function replaceTransformLayer(id, nextCandidates) {
|
|
116
|
+
const normalizedId = cleanUrl(id);
|
|
117
|
+
if (nextCandidates.size === 0) transformCandidatesById.delete(normalizedId);
|
|
118
|
+
else transformCandidatesById.set(normalizedId, nextCandidates);
|
|
119
|
+
recompute(normalizedId);
|
|
120
|
+
}
|
|
121
|
+
function recompute(id) {
|
|
122
|
+
const normalizedId = cleanUrl(id);
|
|
123
|
+
replaceFinal(normalizedId, new Set([...scanCandidatesById.get(normalizedId) ?? [], ...transformCandidatesById.get(normalizedId) ?? []]));
|
|
124
|
+
}
|
|
125
|
+
function syncInline(inlineCandidates) {
|
|
126
|
+
inlineIncludedCandidates = new Set(inlineCandidates?.included ?? []);
|
|
127
|
+
inlineExcludedCandidates = new Set(inlineCandidates?.excluded ?? []);
|
|
128
|
+
}
|
|
129
|
+
function remove(id) {
|
|
130
|
+
const normalizedId = cleanUrl(id);
|
|
131
|
+
scanCandidatesById.delete(normalizedId);
|
|
132
|
+
transformCandidatesById.delete(normalizedId);
|
|
133
|
+
const previousCandidates = candidatesById.get(normalizedId);
|
|
134
|
+
if (!previousCandidates) return;
|
|
135
|
+
removeCandidateSet(candidateCount, previousCandidates);
|
|
136
|
+
candidatesById.delete(normalizedId);
|
|
137
|
+
}
|
|
138
|
+
function values() {
|
|
139
|
+
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
140
|
+
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
141
|
+
return values;
|
|
142
|
+
}
|
|
143
|
+
function valuesForEntries(entries) {
|
|
144
|
+
if (entries === void 0) return values();
|
|
145
|
+
const filtered = /* @__PURE__ */ new Set();
|
|
146
|
+
for (const [id, candidates] of candidatesById) {
|
|
147
|
+
if (!isFileMatchedByTailwindSourceEntries(id, entries)) continue;
|
|
148
|
+
for (const candidate of candidates) filtered.add(candidate);
|
|
149
|
+
}
|
|
150
|
+
for (const candidate of inlineIncludedCandidates) filtered.add(candidate);
|
|
151
|
+
for (const candidate of inlineExcludedCandidates) filtered.delete(candidate);
|
|
152
|
+
return filtered;
|
|
153
|
+
}
|
|
154
|
+
function clear() {
|
|
155
|
+
candidatesById.clear();
|
|
156
|
+
scanCandidatesById.clear();
|
|
157
|
+
transformCandidatesById.clear();
|
|
158
|
+
candidateCount.clear();
|
|
159
|
+
inlineIncludedCandidates.clear();
|
|
160
|
+
inlineExcludedCandidates.clear();
|
|
161
|
+
}
|
|
162
|
+
function snapshot() {
|
|
163
|
+
return {
|
|
164
|
+
candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
165
|
+
scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
166
|
+
transformCandidatesById: [...transformCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
|
|
167
|
+
inlineExcludedCandidates: [...inlineExcludedCandidates],
|
|
168
|
+
inlineIncludedCandidates: [...inlineIncludedCandidates]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function restore(snapshot) {
|
|
172
|
+
clear();
|
|
173
|
+
inlineExcludedCandidates = new Set(snapshot.inlineExcludedCandidates);
|
|
174
|
+
inlineIncludedCandidates = new Set(snapshot.inlineIncludedCandidates);
|
|
175
|
+
const scanEntries = snapshot.scanCandidatesById ?? snapshot.candidatesById;
|
|
176
|
+
for (const [id, candidates] of scanEntries) {
|
|
177
|
+
const candidateSet = new Set(candidates);
|
|
178
|
+
if (candidateSet.size === 0) continue;
|
|
179
|
+
scanCandidatesById.set(id, candidateSet);
|
|
180
|
+
}
|
|
181
|
+
for (const [id, candidates] of snapshot.transformCandidatesById ?? []) {
|
|
182
|
+
const candidateSet = new Set(candidates);
|
|
183
|
+
if (candidateSet.size === 0) continue;
|
|
184
|
+
transformCandidatesById.set(id, candidateSet);
|
|
185
|
+
}
|
|
186
|
+
for (const [id, candidates] of snapshot.candidatesById) {
|
|
187
|
+
const candidateSet = new Set(candidates);
|
|
188
|
+
if (candidateSet.size === 0) continue;
|
|
189
|
+
candidatesById.set(id, candidateSet);
|
|
190
|
+
addCandidateSet(candidateCount, candidateSet);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
sync,
|
|
195
|
+
merge,
|
|
196
|
+
syncFile,
|
|
197
|
+
syncCurrentFile,
|
|
198
|
+
scanRoot,
|
|
199
|
+
syncInline,
|
|
200
|
+
remove,
|
|
201
|
+
values,
|
|
202
|
+
valuesForEntries,
|
|
203
|
+
snapshot,
|
|
204
|
+
restore,
|
|
205
|
+
clear
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { isSourceCandidateRequest as n, createSourceCandidateCollector as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { pruneMiniProgramGeneratedCss } from '@weapp-tailwindcss/postcss';
|
|
@@ -1,56 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ILengthUnitsPatchOptions, NormalizedTailwindCssPatchOptions, TailwindCssPatchOptions } from 'tailwindcss-patch';
|
|
1
|
+
import type { ILengthUnitsPatchOptions, TailwindCssPatchOptions } from 'tailwindcss-patch';
|
|
3
2
|
type TailwindUserOptions = NonNullable<TailwindCssPatchOptions['tailwindcss']>;
|
|
4
|
-
type ResolvedTailwindUserOptions = TailwindUserOptions | NormalizedTailwindCssPatchOptions['tailwind'];
|
|
5
3
|
type TailwindApplyOptions = NonNullable<TailwindCssPatchOptions['apply']>;
|
|
6
|
-
type TailwindExtractOptions = NonNullable<TailwindCssPatchOptions['extract']>;
|
|
7
4
|
type TailwindExtendLengthUnitsOption = TailwindApplyOptions['extendLengthUnits'];
|
|
8
|
-
export
|
|
9
|
-
cache?: boolean | {
|
|
10
|
-
enabled?: boolean;
|
|
11
|
-
cwd?: string;
|
|
12
|
-
dir?: string;
|
|
13
|
-
file?: string;
|
|
14
|
-
strategy?: 'merge' | 'overwrite';
|
|
15
|
-
};
|
|
16
|
-
patch?: {
|
|
17
|
-
overwrite?: boolean;
|
|
18
|
-
basedir?: string;
|
|
19
|
-
cwd?: string;
|
|
20
|
-
filter?: (className: string) => boolean;
|
|
21
|
-
resolve?: PackageResolvingOptions;
|
|
22
|
-
tailwindcss?: TailwindUserOptions;
|
|
23
|
-
applyPatches?: {
|
|
24
|
-
exportContext?: boolean;
|
|
25
|
-
extendLengthUnits?: boolean | ILengthUnitsPatchOptions;
|
|
26
|
-
};
|
|
27
|
-
output?: {
|
|
28
|
-
filename?: string;
|
|
29
|
-
loose?: boolean;
|
|
30
|
-
removeUniversalSelector?: boolean;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export interface LegacyTailwindcssOutputOptions {
|
|
35
|
-
enabled?: boolean;
|
|
36
|
-
file?: string;
|
|
37
|
-
format?: TailwindExtractOptions['format'];
|
|
38
|
-
pretty?: TailwindExtractOptions['pretty'];
|
|
39
|
-
removeUniversalSelector?: boolean;
|
|
40
|
-
}
|
|
41
|
-
export interface LegacyTailwindcssFeatureOptions {
|
|
42
|
-
exposeContext?: TailwindApplyOptions['exposeContext'];
|
|
43
|
-
extendLengthUnits?: boolean | ILengthUnitsPatchOptions | TailwindExtendLengthUnitsOption;
|
|
44
|
-
}
|
|
45
|
-
export type CompatTailwindCssPatchOptions = TailwindCssPatchOptions & {
|
|
46
|
-
cwd?: string;
|
|
47
|
-
overwrite?: boolean;
|
|
48
|
-
features?: LegacyTailwindcssFeatureOptions;
|
|
49
|
-
output?: LegacyTailwindcssOutputOptions;
|
|
50
|
-
tailwind?: ResolvedTailwindUserOptions;
|
|
51
|
-
};
|
|
52
|
-
export declare function resolveTailwindcssOptions(options?: CompatTailwindCssPatchOptions | LegacyTailwindcssPatcherOptions): ResolvedTailwindUserOptions | undefined;
|
|
5
|
+
export declare function resolveTailwindcssOptions(options?: TailwindCssPatchOptions): TailwindUserOptions | undefined;
|
|
53
6
|
export declare function normalizeExtendLengthUnits(value: boolean | ILengthUnitsPatchOptions | undefined): TailwindExtendLengthUnitsOption | undefined;
|
|
54
|
-
export declare function normalizeTailwindcssPatcherOptions(options?:
|
|
55
|
-
export declare function toModernTailwindcssPatchOptions(options?: CompatTailwindCssPatchOptions): TailwindCssPatchOptions | undefined;
|
|
7
|
+
export declare function normalizeTailwindcssPatcherOptions(options?: TailwindCssPatchOptions): TailwindCssPatchOptions | undefined;
|
|
56
8
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ILengthUnitsPatchOptions, TailwindCssPatchOptions } from 'tailwindcss-patch';
|
|
2
|
-
import type { LegacyTailwindcssPatcherOptions } from './patcher-options';
|
|
3
2
|
import type { TailwindcssPatcherLike } from '../types';
|
|
4
3
|
type TailwindUserOptions = NonNullable<TailwindCssPatchOptions['tailwindcss']>;
|
|
5
4
|
export interface CreateTailwindcssPatcherOptions {
|
|
@@ -7,7 +6,7 @@ export interface CreateTailwindcssPatcherOptions {
|
|
|
7
6
|
cacheDir?: string;
|
|
8
7
|
supportCustomLengthUnitsPatch?: boolean | ILengthUnitsPatchOptions;
|
|
9
8
|
tailwindcss?: TailwindUserOptions;
|
|
10
|
-
tailwindcssPatcherOptions?: TailwindCssPatchOptions
|
|
9
|
+
tailwindcssPatcherOptions?: TailwindCssPatchOptions;
|
|
11
10
|
}
|
|
12
11
|
export declare function createTailwindcssPatcher(options?: CreateTailwindcssPatcherOptions): TailwindcssPatcherLike;
|
|
13
12
|
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function removeUnsupportedCascadeLayers(root: postcss.Root): void;
|
|
1
|
+
export { removeUnsupportedCascadeLayers, } from '@weapp-tailwindcss/postcss';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { TailwindcssPatcherLike } from '../../types';
|
|
2
2
|
interface RuntimeClassSetCacheEntry {
|
|
3
|
-
value?: Set<string
|
|
4
|
-
promise?: Promise<Set<string
|
|
5
|
-
signature?: string;
|
|
3
|
+
value?: Set<string> | undefined;
|
|
4
|
+
promise?: Promise<Set<string>> | undefined;
|
|
5
|
+
signature?: string | undefined;
|
|
6
6
|
}
|
|
7
7
|
export declare const runtimeSignaturePatchersSymbol: unique symbol;
|
|
8
8
|
export declare function invalidateRuntimeClassSet(twPatcher?: TailwindcssPatcherLike): void;
|
|
9
9
|
export declare function getRuntimeClassSetCacheEntry(twPatcher: TailwindcssPatcherLike): RuntimeClassSetCacheEntry;
|
|
10
10
|
export declare function getRuntimeClassSetSignature(twPatcher: TailwindcssPatcherLike): string;
|
|
11
|
+
export declare function getRuntimeClassSetSignatureWithSources(twPatcher: TailwindcssPatcherLike): Promise<string>;
|
|
11
12
|
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TailwindcssPatcherLike } from '../types';
|
|
2
|
+
export interface EnsureTailwindcssRuntimePatchOptions {
|
|
3
|
+
clearRequireCache?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function ensureTailwindcssRuntimePatch(twPatcher: TailwindcssPatcherLike, options?: EnsureTailwindcssRuntimePatchOptions): Promise<void>;
|
|
@@ -2,27 +2,26 @@ import type { RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike } from '.
|
|
|
2
2
|
import { invalidateRuntimeClassSet } from './runtime/cache';
|
|
3
3
|
export declare const refreshTailwindcssPatcherSymbol: unique symbol;
|
|
4
4
|
export interface CollectRuntimeClassSetOptions {
|
|
5
|
-
force?: boolean;
|
|
6
|
-
skipRefresh?: boolean;
|
|
7
|
-
clearCache?: boolean;
|
|
5
|
+
force?: boolean | undefined;
|
|
6
|
+
skipRefresh?: boolean | undefined;
|
|
7
|
+
clearCache?: boolean | undefined;
|
|
8
8
|
}
|
|
9
9
|
export interface RefreshTailwindRuntimeStateOptions {
|
|
10
10
|
force: boolean;
|
|
11
|
-
clearCache?: boolean;
|
|
11
|
+
clearCache?: boolean | undefined;
|
|
12
12
|
}
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function createTailwindRuntimeReadyPromise(twPatcher: TailwindcssPatcherLike): Promise<void>;
|
|
14
14
|
export interface TailwindRuntimeState {
|
|
15
15
|
twPatcher: TailwindcssPatcherLike;
|
|
16
|
-
|
|
17
|
-
refreshTailwindcssPatcher?: (options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike
|
|
18
|
-
onPatchCompleted?: () => Promise<void> | void;
|
|
16
|
+
readyPromise: Promise<void>;
|
|
17
|
+
refreshTailwindcssPatcher?: ((options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>) | undefined;
|
|
19
18
|
}
|
|
20
19
|
export declare function refreshTailwindRuntimeState(state: TailwindRuntimeState, forceOrOptions: boolean | RefreshTailwindRuntimeStateOptions): Promise<boolean>;
|
|
21
20
|
export interface EnsureRuntimeClassSetOptions {
|
|
22
|
-
forceRefresh?: boolean;
|
|
23
|
-
forceCollect?: boolean;
|
|
24
|
-
clearCache?: boolean;
|
|
25
|
-
allowEmpty?: boolean;
|
|
21
|
+
forceRefresh?: boolean | undefined;
|
|
22
|
+
forceCollect?: boolean | undefined;
|
|
23
|
+
clearCache?: boolean | undefined;
|
|
24
|
+
allowEmpty?: boolean | undefined;
|
|
26
25
|
}
|
|
27
26
|
export declare function ensureRuntimeClassSet(state: TailwindRuntimeState, options?: EnsureRuntimeClassSetOptions): Promise<Set<string>>;
|
|
28
27
|
declare function collectRuntimeClassSet(twPatcher: TailwindcssPatcherLike, options?: CollectRuntimeClassSetOptions): Promise<Set<string>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Root } from 'postcss';
|
|
2
|
+
import type { TailwindV4CssSource } from 'tailwindcss-patch';
|
|
3
|
+
export interface TailwindSourceEntry {
|
|
4
|
+
base: string;
|
|
5
|
+
pattern: string;
|
|
6
|
+
negated: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface TailwindInlineSourceCandidates {
|
|
9
|
+
included: Set<string>;
|
|
10
|
+
excluded: Set<string>;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_SOURCE_SCAN_EXTENSIONS: string[];
|
|
13
|
+
export declare const FULL_SOURCE_SCAN_EXTENSIONS: string[];
|
|
14
|
+
export declare function createSourceScanPattern(extensions?: string[]): string;
|
|
15
|
+
export declare const FULL_SOURCE_SCAN_PATTERN: string;
|
|
16
|
+
export declare const FULL_SOURCE_SCAN_EXTENSION_RE: RegExp;
|
|
17
|
+
export declare function toPosixPath(value: string): string;
|
|
18
|
+
export declare function resolveSourceScanPath(value: string): string;
|
|
19
|
+
export declare function isFileExcludedByTailwindSourceEntries(file: string, entries: TailwindSourceEntry[] | undefined): boolean;
|
|
20
|
+
export declare function isFileMatchedByTailwindSourceEntries(file: string, entries: TailwindSourceEntry[] | undefined): boolean;
|
|
21
|
+
export declare function createTailwindSourceEntryMatcher(entries: TailwindSourceEntry[] | undefined): ((file: string) => boolean) | undefined;
|
|
22
|
+
export declare function resolveTailwindV4CssSourceBase(source: Pick<TailwindV4CssSource, 'base' | 'file'>, fallbackBase: string): string;
|
|
23
|
+
export declare function parseConfigParam(params: string): string | undefined;
|
|
24
|
+
export declare function expandInlineSourceCandidatePattern(pattern: string): string[];
|
|
25
|
+
export declare function collectCssInlineSourceCandidates(root: Root): TailwindInlineSourceCandidates;
|
|
26
|
+
export declare function normalizeLegacyContentEntries(content: unknown, base: string): TailwindSourceEntry[];
|
|
27
|
+
export declare function resolveTailwindSourceEntry(sourcePath: string, base: string, negated: boolean, defaultPattern?: string): Promise<TailwindSourceEntry>;
|
|
28
|
+
export declare function parseSourceFileParam(params: string): {
|
|
29
|
+
negated: boolean;
|
|
30
|
+
sourcePath: string;
|
|
31
|
+
} | undefined;
|
|
32
|
+
export declare function resolveCssSourceEntries(root: Root, base: string, defaultPattern?: string): Promise<TailwindSourceEntry[]>;
|
|
33
|
+
export declare function expandTailwindSourceEntries(entries: TailwindSourceEntry[], options?: {
|
|
34
|
+
ignore?: string[];
|
|
35
|
+
}): Promise<string[]>;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
1
|
import type { TailwindcssPatcherLike } from '../types';
|
|
2
|
-
|
|
3
|
-
import { createPatchTargetRecorder } from './targets/recorder';
|
|
4
|
-
export type { PatchTargetRecorder, PatchTargetRecorderOptions, SavePatchTargetRecordOptions } from './targets/types';
|
|
5
|
-
export declare function logTailwindcssTarget(kind: 'cli' | 'runtime', patcher: TailwindcssPatcherLike | undefined, baseDir?: string): void;
|
|
6
|
-
export { __resetPatchTargetRecordWarningsForTests, createPatchTargetRecorder, saveCliPatchTargetRecord, };
|
|
2
|
+
export declare function logTailwindcssTarget(patcher: TailwindcssPatcherLike | undefined, baseDir?: string): void;
|