weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.20
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-BlXvU4jl.js +530 -0
- package/dist/bundle-state-PO6MysTJ.mjs +414 -0
- package/dist/bundlers/shared/cache.d.ts +6 -6
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +5 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
- 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-DIuglJub.mjs +32 -0
- package/dist/generator-N4jy1HCk.js +55 -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-CJ0Pnsw2.js +2348 -0
- package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -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/lightningcss/style-handler/selector-transform.d.ts +1 -1
- package/dist/lightningcss/style-handler.d.ts +3 -3
- 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-D4UdbBQ6.mjs +228 -0
- package/dist/postcss-DlY-YRvA.js +237 -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-BjEbVEpX.js} +218 -314
- package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.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-D5qnaSpo.js +5516 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-BrvneDDd.mjs +209 -0
- package/dist/source-candidates-gxijpPI3.js +222 -0
- package/dist/tailwindcss/miniprogram.d.ts +5 -1
- package/dist/tailwindcss/patcher-options.d.ts +3 -51
- package/dist/tailwindcss/patcher.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-BhG7BtB-.js +651 -0
- package/dist/tailwindcss-c6ROlNNW.mjs +600 -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-5LoZUH-4.js +3695 -0
- package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
- package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
- package/dist/vite-MyXBNux0.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 +5157 -16
- package/dist/weapp-tw-runtime-classset-loader.js +32 -7
- package/dist/webpack-BnVyDmsD.mjs +836 -0
- package/dist/webpack-Mz1V0A9p.js +846 -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/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
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { d as traverse, u as babelParse } from "./precheck-tbk626YL.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import process from "node:process";
|
|
5
|
+
import { cleanUrl, ensurePosix } from "@weapp-tailwindcss/shared";
|
|
6
|
+
import { Buffer } from "node:buffer";
|
|
7
|
+
import { Parser } from "htmlparser2";
|
|
8
|
+
//#region src/bundlers/shared/module-graph.ts
|
|
9
|
+
const QUERY_HASH_RE = /[?#].*$/u;
|
|
10
|
+
const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
11
|
+
const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
|
|
12
|
+
const VIRTUAL_PREFIX = "\0";
|
|
13
|
+
const JS_EXTENSIONS = [
|
|
14
|
+
".js",
|
|
15
|
+
".mjs",
|
|
16
|
+
".cjs"
|
|
17
|
+
];
|
|
18
|
+
function normalizeOutputPathKey(value) {
|
|
19
|
+
return path.normalize(value).replace(/\\/g, "/");
|
|
20
|
+
}
|
|
21
|
+
function stripQueryAndHash(specifier) {
|
|
22
|
+
return specifier.replace(QUERY_HASH_RE, "");
|
|
23
|
+
}
|
|
24
|
+
function isResolvableSpecifier(specifier) {
|
|
25
|
+
if (!specifier) return false;
|
|
26
|
+
const normalized = stripQueryAndHash(specifier);
|
|
27
|
+
if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
|
|
28
|
+
if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
|
|
29
|
+
return !PROTOCOL_RE.test(normalized);
|
|
30
|
+
}
|
|
31
|
+
function toAbsoluteOutputPath(fileName, outDir) {
|
|
32
|
+
if (path.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return path.normalize(fileName);
|
|
33
|
+
return path.resolve(outDir, fileName);
|
|
34
|
+
}
|
|
35
|
+
function matchWithExtensions(candidate, hasOutput) {
|
|
36
|
+
if (hasOutput(candidate)) return candidate;
|
|
37
|
+
if (!path.extname(candidate)) for (const ext of JS_EXTENSIONS) {
|
|
38
|
+
const extended = `${candidate}${ext}`;
|
|
39
|
+
if (hasOutput(extended)) return extended;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
43
|
+
if (!isResolvableSpecifier(specifier)) return;
|
|
44
|
+
const normalized = stripQueryAndHash(specifier);
|
|
45
|
+
let candidate;
|
|
46
|
+
if (path.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = path.normalize(normalized);
|
|
47
|
+
else if (normalized.startsWith("/")) candidate = path.resolve(outDir, normalized.slice(1));
|
|
48
|
+
else candidate = path.resolve(path.dirname(importer), normalized);
|
|
49
|
+
return matchWithExtensions(candidate, hasOutput);
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/bundlers/shared/style-requests.ts
|
|
53
|
+
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
54
|
+
const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
|
|
55
|
+
const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
|
|
56
|
+
function stripHash(request) {
|
|
57
|
+
const hashIndex = request.indexOf("#");
|
|
58
|
+
return hashIndex === -1 ? request : request.slice(0, hashIndex);
|
|
59
|
+
}
|
|
60
|
+
function stripRequestQuery(request) {
|
|
61
|
+
const normalized = stripHash(request);
|
|
62
|
+
const queryIndex = normalized.indexOf("?");
|
|
63
|
+
return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
64
|
+
}
|
|
65
|
+
function isSourceStyleRequest(request) {
|
|
66
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
67
|
+
const normalized = stripHash(request);
|
|
68
|
+
const queryIndex = normalized.indexOf("?");
|
|
69
|
+
const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
70
|
+
if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
|
|
71
|
+
if (queryIndex === -1) return false;
|
|
72
|
+
const query = normalized.slice(queryIndex + 1);
|
|
73
|
+
return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/bundlers/vite/utils.ts
|
|
77
|
+
function slash(p) {
|
|
78
|
+
return ensurePosix(p);
|
|
79
|
+
}
|
|
80
|
+
const isWindows = process.platform === "win32";
|
|
81
|
+
const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`);
|
|
82
|
+
function isCSSRequest(request) {
|
|
83
|
+
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
84
|
+
}
|
|
85
|
+
function normalizePath(id) {
|
|
86
|
+
return path.posix.normalize(isWindows ? ensurePosix(id) : id);
|
|
87
|
+
}
|
|
88
|
+
async function formatPostcssSourceMap(rawMap, file) {
|
|
89
|
+
const inputFileDir = path.dirname(file);
|
|
90
|
+
const sources = rawMap.sources.map((source) => {
|
|
91
|
+
const cleanSource = cleanUrl(decodeURIComponent(source));
|
|
92
|
+
if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
|
|
93
|
+
return normalizePath(path.resolve(inputFileDir, cleanSource));
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
file,
|
|
97
|
+
mappings: rawMap.mappings,
|
|
98
|
+
names: rawMap.names,
|
|
99
|
+
sources,
|
|
100
|
+
sourcesContent: rawMap.sourcesContent,
|
|
101
|
+
version: rawMap.version
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/utils/disabled.ts
|
|
106
|
+
function resolvePluginDisabledState(disabled) {
|
|
107
|
+
if (disabled === true) return { plugin: true };
|
|
108
|
+
if (disabled === false || disabled == null) return { plugin: false };
|
|
109
|
+
return { plugin: disabled.plugin ?? false };
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/utils/resolve-package.ts
|
|
113
|
+
const require = createRequire(import.meta.url);
|
|
114
|
+
function resolvePackageDir(name) {
|
|
115
|
+
const pkgPath = require.resolve(`${name}/package.json`);
|
|
116
|
+
return path.dirname(pkgPath);
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/bundlers/shared/generated-css-marker.ts
|
|
120
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/i;
|
|
121
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/gi;
|
|
122
|
+
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
123
|
+
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
124
|
+
}
|
|
125
|
+
function hasBundlerGeneratedCssMarker(source) {
|
|
126
|
+
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
127
|
+
}
|
|
128
|
+
function stripBundlerGeneratedCssMarkers(source) {
|
|
129
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/bundlers/shared/run-tasks.ts
|
|
133
|
+
async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
|
|
134
|
+
if (factories.length === 0) return [];
|
|
135
|
+
const results = Array.from({ length: factories.length });
|
|
136
|
+
const executing = /* @__PURE__ */ new Set();
|
|
137
|
+
let cursor = 0;
|
|
138
|
+
const effectiveLimit = Math.max(1, limit);
|
|
139
|
+
const scheduleNext = () => {
|
|
140
|
+
if (cursor >= factories.length) return;
|
|
141
|
+
const currentIndex = cursor++;
|
|
142
|
+
const factory = factories[currentIndex];
|
|
143
|
+
if (!factory) return;
|
|
144
|
+
const wrapped = Promise.resolve(factory()).then((value) => {
|
|
145
|
+
results[currentIndex] = value;
|
|
146
|
+
}).finally(() => {
|
|
147
|
+
executing.delete(wrapped);
|
|
148
|
+
});
|
|
149
|
+
executing.add(wrapped);
|
|
150
|
+
};
|
|
151
|
+
while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
|
|
152
|
+
while (cursor < factories.length) {
|
|
153
|
+
await Promise.race(executing);
|
|
154
|
+
scheduleNext();
|
|
155
|
+
}
|
|
156
|
+
await Promise.all(executing);
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
160
|
+
if (factories.length === 0) return;
|
|
161
|
+
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/bundlers/vite/bundle-entries.ts
|
|
165
|
+
function readOutputEntry(entry) {
|
|
166
|
+
if (entry.output.type === "chunk") return entry.output.code;
|
|
167
|
+
const source = entry.output.source;
|
|
168
|
+
if (typeof source === "string") return source;
|
|
169
|
+
if (source instanceof Uint8Array) return Buffer.from(source).toString();
|
|
170
|
+
const fallbackSource = source;
|
|
171
|
+
if (fallbackSource == null) return;
|
|
172
|
+
if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
|
|
173
|
+
}
|
|
174
|
+
function isJavaScriptEntry(entry) {
|
|
175
|
+
if (entry.output.type === "chunk") return true;
|
|
176
|
+
return entry.fileName.endsWith(".js");
|
|
177
|
+
}
|
|
178
|
+
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
179
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
180
|
+
for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
|
|
181
|
+
const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
182
|
+
return {
|
|
183
|
+
resolve(specifier, importer) {
|
|
184
|
+
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
185
|
+
},
|
|
186
|
+
load(id) {
|
|
187
|
+
const entry = getEntry(id);
|
|
188
|
+
if (!entry) return;
|
|
189
|
+
return readOutputEntry(entry);
|
|
190
|
+
},
|
|
191
|
+
filter(id) {
|
|
192
|
+
return Boolean(getEntry(id));
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
197
|
+
if (!linked) return;
|
|
198
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
|
|
200
|
+
for (const [id, { code }] of Object.entries(linked)) {
|
|
201
|
+
const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
202
|
+
if (!entry) continue;
|
|
203
|
+
const previous = readOutputEntry(entry);
|
|
204
|
+
if (previous == null || previous === code) continue;
|
|
205
|
+
if (entry.output.type === "chunk") entry.output.code = code;
|
|
206
|
+
else entry.output.source = code;
|
|
207
|
+
onApplied?.(entry, code);
|
|
208
|
+
onLinkedUpdate(entry.fileName, previous, code);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
//#region src/bundlers/vite/runtime-affecting-signature.ts
|
|
213
|
+
const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
214
|
+
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
215
|
+
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
216
|
+
const CSS_WHITESPACE_RE = /\s+/g;
|
|
217
|
+
function createHtmlRuntimeAffectingSignature(source) {
|
|
218
|
+
try {
|
|
219
|
+
const parts = [];
|
|
220
|
+
const parser = new Parser({
|
|
221
|
+
onattribute(name, value) {
|
|
222
|
+
parts.push(`a:${name}=${value}`);
|
|
223
|
+
},
|
|
224
|
+
oncomment(data) {
|
|
225
|
+
parts.push(`c:${data}`);
|
|
226
|
+
},
|
|
227
|
+
ontext(data) {
|
|
228
|
+
const value = data.trim();
|
|
229
|
+
if (value.length > 0) parts.push(`t:${value}`);
|
|
230
|
+
}
|
|
231
|
+
}, { xmlMode: true });
|
|
232
|
+
parser.write(source);
|
|
233
|
+
parser.end();
|
|
234
|
+
return parts.join("\n");
|
|
235
|
+
} catch {
|
|
236
|
+
return source;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function createJsRuntimeAffectingSignature(source) {
|
|
240
|
+
try {
|
|
241
|
+
const ast = babelParse(source, {
|
|
242
|
+
cache: true,
|
|
243
|
+
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
244
|
+
plugins: ["jsx", "typescript"],
|
|
245
|
+
sourceType: "unambiguous"
|
|
246
|
+
});
|
|
247
|
+
const parts = [];
|
|
248
|
+
traverse(ast, {
|
|
249
|
+
noScope: true,
|
|
250
|
+
StringLiteral(path) {
|
|
251
|
+
parts.push(`s:${path.node.value}`);
|
|
252
|
+
},
|
|
253
|
+
TemplateElement(path) {
|
|
254
|
+
parts.push(`t:${path.node.value.raw}`);
|
|
255
|
+
},
|
|
256
|
+
JSXText(path) {
|
|
257
|
+
const value = path.node.value.trim();
|
|
258
|
+
if (value.length > 0) parts.push(`x:${value}`);
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
const comments = ast.comments;
|
|
262
|
+
if (Array.isArray(comments)) {
|
|
263
|
+
for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
|
|
264
|
+
}
|
|
265
|
+
return parts.join("\n");
|
|
266
|
+
} catch {
|
|
267
|
+
return source;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
function createCssRuntimeAffectingSignature(source) {
|
|
271
|
+
return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
|
|
272
|
+
}
|
|
273
|
+
function createRuntimeAffectingSourceSignature(source, type) {
|
|
274
|
+
if (type === "html") return createHtmlRuntimeAffectingSignature(source);
|
|
275
|
+
if (type === "js") return createJsRuntimeAffectingSignature(source);
|
|
276
|
+
if (type === "css") return createCssRuntimeAffectingSignature(source);
|
|
277
|
+
return source;
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/bundlers/vite/bundle-state.ts
|
|
281
|
+
function createBundleBuildState() {
|
|
282
|
+
return {
|
|
283
|
+
iteration: 0,
|
|
284
|
+
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
285
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
286
|
+
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
287
|
+
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
288
|
+
dependentsByLinkedFile: /* @__PURE__ */ new Map(),
|
|
289
|
+
generatorCandidateSignature: void 0
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function createChangedByType() {
|
|
293
|
+
return {
|
|
294
|
+
html: /* @__PURE__ */ new Set(),
|
|
295
|
+
js: /* @__PURE__ */ new Set(),
|
|
296
|
+
css: /* @__PURE__ */ new Set(),
|
|
297
|
+
other: /* @__PURE__ */ new Set()
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
function createProcessFiles() {
|
|
301
|
+
return {
|
|
302
|
+
html: /* @__PURE__ */ new Set(),
|
|
303
|
+
js: /* @__PURE__ */ new Set(),
|
|
304
|
+
css: /* @__PURE__ */ new Set()
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function readEntrySource(output) {
|
|
308
|
+
if (output.type === "chunk") return output.code;
|
|
309
|
+
return output.source.toString();
|
|
310
|
+
}
|
|
311
|
+
function classifyBundleEntry(file, opts) {
|
|
312
|
+
if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
|
|
313
|
+
if (opts.htmlMatcher(file)) return "html";
|
|
314
|
+
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
315
|
+
return "other";
|
|
316
|
+
}
|
|
317
|
+
function collectJsEntries(fileName, output, outDir, store) {
|
|
318
|
+
const entry = {
|
|
319
|
+
fileName,
|
|
320
|
+
output
|
|
321
|
+
};
|
|
322
|
+
if (!isJavaScriptEntry(entry)) return;
|
|
323
|
+
const absolute = toAbsoluteOutputPath(fileName, outDir);
|
|
324
|
+
store.set(absolute, entry);
|
|
325
|
+
}
|
|
326
|
+
function markProcessFile(type, file, processFiles) {
|
|
327
|
+
if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
|
|
328
|
+
}
|
|
329
|
+
function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
330
|
+
const sourceHashByFile = /* @__PURE__ */ new Map();
|
|
331
|
+
const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
|
|
332
|
+
const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
|
|
333
|
+
const changedByType = createChangedByType();
|
|
334
|
+
const runtimeAffectingChangedByType = createChangedByType();
|
|
335
|
+
const processFiles = createProcessFiles();
|
|
336
|
+
const linkedImpactsByEntry = /* @__PURE__ */ new Map();
|
|
337
|
+
const jsEntries = /* @__PURE__ */ new Map();
|
|
338
|
+
const entries = [];
|
|
339
|
+
const firstRun = state.linkedByEntry.size === 0;
|
|
340
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
341
|
+
const type = classifyBundleEntry(file, opts);
|
|
342
|
+
const source = readEntrySource(output);
|
|
343
|
+
const hash = opts.cache.computeHash(source);
|
|
344
|
+
sourceHashByFile.set(file, hash);
|
|
345
|
+
const previousHash = state.sourceHashByFile.get(file);
|
|
346
|
+
const changed = previousHash == null || previousHash !== hash;
|
|
347
|
+
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
348
|
+
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
349
|
+
const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
|
|
350
|
+
const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
|
|
351
|
+
const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
|
|
352
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
353
|
+
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
354
|
+
if (changed) changedByType[type].add(file);
|
|
355
|
+
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
356
|
+
if (forceAll || firstRun) markProcessFile(type, file, processFiles);
|
|
357
|
+
else if (type === "html") processFiles.html.add(file);
|
|
358
|
+
else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
|
|
359
|
+
collectJsEntries(file, output, outDir, jsEntries);
|
|
360
|
+
entries.push({
|
|
361
|
+
file,
|
|
362
|
+
output,
|
|
363
|
+
source,
|
|
364
|
+
type
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
|
|
368
|
+
const dependents = state.dependentsByLinkedFile.get(changedFile);
|
|
369
|
+
if (!dependents) continue;
|
|
370
|
+
for (const entryFile of dependents) {
|
|
371
|
+
processFiles.js.add(entryFile);
|
|
372
|
+
let impacts = linkedImpactsByEntry.get(entryFile);
|
|
373
|
+
if (!impacts) {
|
|
374
|
+
impacts = /* @__PURE__ */ new Set();
|
|
375
|
+
linkedImpactsByEntry.set(entryFile, impacts);
|
|
376
|
+
}
|
|
377
|
+
impacts.add(changedFile);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return {
|
|
381
|
+
entries,
|
|
382
|
+
jsEntries,
|
|
383
|
+
sourceHashByFile,
|
|
384
|
+
runtimeAffectingSignatureByFile,
|
|
385
|
+
runtimeAffectingHashByFile,
|
|
386
|
+
changedByType,
|
|
387
|
+
runtimeAffectingChangedByType,
|
|
388
|
+
processFiles,
|
|
389
|
+
linkedImpactsByEntry
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
function invertLinkedByEntry(linkedByEntry) {
|
|
393
|
+
const dependentsByLinkedFile = /* @__PURE__ */ new Map();
|
|
394
|
+
for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
|
|
395
|
+
let dependents = dependentsByLinkedFile.get(linkedFile);
|
|
396
|
+
if (!dependents) {
|
|
397
|
+
dependents = /* @__PURE__ */ new Set();
|
|
398
|
+
dependentsByLinkedFile.set(linkedFile, dependents);
|
|
399
|
+
}
|
|
400
|
+
dependents.add(entryFile);
|
|
401
|
+
}
|
|
402
|
+
return dependentsByLinkedFile;
|
|
403
|
+
}
|
|
404
|
+
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
405
|
+
const incremental = options.incremental === true;
|
|
406
|
+
state.iteration += 1;
|
|
407
|
+
state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
|
|
408
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
409
|
+
state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
|
|
410
|
+
state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
|
|
411
|
+
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
412
|
+
}
|
|
413
|
+
//#endregion
|
|
414
|
+
export { stripRequestQuery as _, createBundleModuleGraphOptions as a, toAbsoluteOutputPath as b, hasBundlerGeneratedCssMarker as c, resolvePluginDisabledState as d, cleanUrl as f, isSourceStyleRequest as g, slash as h, applyLinkedResults as i, stripBundlerGeneratedCssMarkers as l, isCSSRequest as m, createBundleBuildState as n, pushConcurrentTaskFactories as o, formatPostcssSourceMap as p, updateBundleBuildState as r, createBundlerGeneratedCssMarker as s, buildBundleSnapshot as t, resolvePackageDir as u, normalizeOutputPathKey as v, resolveOutputSpecifier as y };
|
|
@@ -2,15 +2,15 @@ import type { CacheValue, HashMapKey, ICreateCacheReturnType } from '../../cache
|
|
|
2
2
|
export interface ProcessCachedTaskOptions<TValue extends CacheValue> {
|
|
3
3
|
cache: ICreateCacheReturnType;
|
|
4
4
|
cacheKey: string;
|
|
5
|
-
hashKey?: HashMapKey;
|
|
6
|
-
rawSource?: string;
|
|
7
|
-
hash?: string;
|
|
8
|
-
readCache?: () => TValue | undefined;
|
|
5
|
+
hashKey?: HashMapKey | undefined;
|
|
6
|
+
rawSource?: string | undefined;
|
|
7
|
+
hash?: string | undefined;
|
|
8
|
+
readCache?: (() => TValue | undefined) | undefined;
|
|
9
9
|
applyResult: (value: TValue) => void | Promise<void>;
|
|
10
10
|
transform: () => Promise<{
|
|
11
11
|
result: TValue;
|
|
12
|
-
cacheValue?: CacheValue;
|
|
12
|
+
cacheValue?: CacheValue | undefined;
|
|
13
13
|
}>;
|
|
14
|
-
onCacheHit?: () => void;
|
|
14
|
+
onCacheHit?: (() => void) | undefined;
|
|
15
15
|
}
|
|
16
16
|
export declare function processCachedTask<TValue extends CacheValue>({ cache, cacheKey, hashKey, rawSource, hash, readCache, applyResult, transform, onCacheHit, }: ProcessCachedTaskOptions<TValue>): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type postcss from 'postcss';
|
|
2
|
+
export declare function removeSpecificityPlaceholders(root: postcss.Root): void;
|
|
3
|
+
export declare function removeUnsupportedBrowserSelectors(root: postcss.Root): void;
|
|
4
|
+
export declare function removeDisplayP3Declarations(root: postcss.Root): void;
|
|
5
|
+
export declare function removeUnsupportedModernColorDeclarations(root: postcss.Root): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type postcss from 'postcss';
|
|
2
|
+
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTOR = ":host,page,.tw-root,wx-root-portal-content";
|
|
3
|
+
export declare const MINI_PROGRAM_PREFLIGHT_SELECTORS: Set<string>;
|
|
4
|
+
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTORS: Set<string>;
|
|
5
|
+
export declare const SPECIFICITY_PLACEHOLDER_SUFFIXES: string[];
|
|
6
|
+
export declare function normalizeSelector(selector: string): string;
|
|
7
|
+
export declare function getRuleSelectors(rule: postcss.Rule): string[];
|
|
8
|
+
export declare function isUnsupportedBrowserSelector(selector: string): boolean;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
1
|
+
import type { CssPreflightOptions } from '../../types';
|
|
2
|
+
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules } from './css-cleanup/at-rules';
|
|
3
|
+
interface FinalizeMiniProgramCssOptions {
|
|
4
|
+
cssPreflight?: CssPreflightOptions | undefined;
|
|
5
|
+
preservePseudoContentInit?: boolean;
|
|
6
|
+
}
|
|
3
7
|
export declare function hoistTailwindPreflightBase(css: string): string;
|
|
4
|
-
export declare function finalizeMiniProgramCss(css: string): string;
|
|
8
|
+
export declare function finalizeMiniProgramCss(css: string, options?: FinalizeMiniProgramCssOptions): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AppType } from '../../types';
|
|
2
2
|
export interface ResolveTailwindcssImportOptions {
|
|
3
|
-
join?: (base: string, subpath: string) => string;
|
|
4
|
-
appType?: AppType;
|
|
5
|
-
rootImport?: string;
|
|
3
|
+
join?: ((base: string, subpath: string) => string) | undefined;
|
|
4
|
+
appType?: AppType | undefined;
|
|
5
|
+
rootImport?: string | undefined;
|
|
6
6
|
}
|
|
7
7
|
export declare function resolveTailwindcssImport(specifier: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | null;
|
|
8
8
|
export declare function rewriteTailwindcssImportsInCode(code: string, pkgDir: string, options?: ResolveTailwindcssImportOptions): string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface TailwindDirectiveOptions {
|
|
2
|
+
importFallback?: boolean | undefined;
|
|
3
|
+
}
|
|
4
|
+
export declare function parseImportRequest(params: string): string | undefined;
|
|
5
|
+
export declare function normalizeTailwindSourceForGenerator(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
6
|
+
export declare function normalizeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
7
|
+
export declare function removeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
8
|
+
export declare function hasTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
|
|
9
|
+
export declare function hasTailwindRootDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
|
|
10
|
+
export declare function hasTailwindApplyDirective(rawSource: string): boolean;
|
|
11
|
+
export declare function resolveCssEntrySource(rawSource: string, base: string, options?: {
|
|
12
|
+
removeConfig?: boolean;
|
|
13
|
+
importFallback?: boolean;
|
|
14
|
+
}): {
|
|
15
|
+
css: string;
|
|
16
|
+
config: string | undefined;
|
|
17
|
+
configRequest: string | undefined;
|
|
18
|
+
base: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { TailwindResolvedSource } from '../../../generator';
|
|
3
|
+
import type { InternalUserDefinedOptions } from '../../../types';
|
|
4
|
+
export declare function removeTailwindApplyRules(rawSource: string): string;
|
|
5
|
+
export declare function hasConfiguredContainerCompatSources(sources: TailwindResolvedSource[]): boolean;
|
|
6
|
+
export declare function appendLegacyCompatCss(css: string, rawSource: string, generatorTarget: string, styleHandler: InternalUserDefinedOptions['styleHandler'], cssHandlerOptions: IStyleHandlerOptions, generatorStyleOptions: Partial<IStyleHandlerOptions> | undefined): Promise<string>;
|
|
7
|
+
export declare function appendLegacyContainerCompatCss(css: string, rawSource: string, file: string, runtime: Set<string>, configuredContainerCompat: boolean, generatorTarget: string, styleHandler: InternalUserDefinedOptions['styleHandler'], cssHandlerOptions: IStyleHandlerOptions, generatorStyleOptions: Partial<IStyleHandlerOptions> | undefined): Promise<string>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function normalizeCompatSelectors(selector: string): string[];
|
|
2
|
+
export declare function collectGeneratedSelectors(css: string): Set<string>;
|
|
3
|
+
export declare function removeGeneratedSelectorCompatCss(css: string, generatedCss: string): string;
|
|
4
|
+
export declare function collectDedupedPostTransformCompatCss(css: string, generatedCss: string): string;
|
|
5
|
+
export declare function removeDuplicatedViteMarkers(css: string, baseCss: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function inheritLegacyUnitConvertedDeclarations(css: string, legacyCss: string): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare const TAILWIND_V4_BANNER_RE: RegExp;
|
|
2
|
+
export declare const TAILWIND_GENERATED_CSS_MARKER_RE: RegExp;
|
|
3
|
+
export declare const GENERATOR_PLACEHOLDER_MARKER_RE: RegExp;
|
|
4
|
+
export declare const GENERATOR_PLACEHOLDER_MARKER_GLOBAL_RE: RegExp;
|
|
5
|
+
export declare const TAILWIND_BANNER_PREFIX_RE: RegExp;
|
|
6
|
+
export declare const TAILWIND_BANNER_RE: RegExp;
|
|
7
|
+
export declare const TAILWIND_BANNER_GLOBAL_RE: RegExp;
|
|
8
|
+
export declare const VITE_MARKER_RE: RegExp;
|
|
9
|
+
export declare function createCssAppend(base: string, extra: string): string;
|
|
10
|
+
export declare function splitTailwindV4GeneratedCss(rawSource: string, rawTailwindCss: string): string | undefined;
|
|
11
|
+
export declare function splitTailwindV4GeneratedCssBySourceOrder(rawSource: string, rawTailwindCss: string): {
|
|
12
|
+
before: string;
|
|
13
|
+
after: string;
|
|
14
|
+
} | undefined;
|
|
15
|
+
export declare function splitGeneratorPlaceholderCssBySourceOrder(rawSource: string, rawTailwindCss?: string): {
|
|
16
|
+
before: string;
|
|
17
|
+
after: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
export declare function removeTailwindGeneratedCssByBanner(rawSource: string): string | undefined;
|
|
20
|
+
export declare function splitTailwindGeneratedCssByBanner(rawSource: string, start?: number): {
|
|
21
|
+
before: string;
|
|
22
|
+
after: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
export declare function stripTailwindBanner(css: string): string;
|
|
25
|
+
export declare function stripTailwindBanners(css: string): string;
|
|
26
|
+
export declare function stripGeneratorPlaceholderMarkers(css: string): string;
|
|
27
|
+
export declare function hasTailwindGeneratedCss(rawSource: string): boolean;
|
|
28
|
+
export declare function hasTailwindGeneratedCssMarkers(rawSource: string): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SourceSideCssEntrySource {
|
|
2
|
+
css: string;
|
|
3
|
+
config?: string | undefined;
|
|
4
|
+
configRequest?: string | undefined;
|
|
5
|
+
base: string;
|
|
6
|
+
file: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveSourceSideCssEntrySource(file: string, sourceOptions: {
|
|
9
|
+
projectRoot?: string;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
outputRoot?: string;
|
|
12
|
+
}, resolveOptions?: {
|
|
13
|
+
removeConfig?: boolean;
|
|
14
|
+
}): SourceSideCssEntrySource | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource } from '../../../generator';
|
|
3
|
+
import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
|
|
4
|
+
import type { InternalUserDefinedOptions } from '../../../types';
|
|
5
|
+
interface GeneratorSourceRuntimeState {
|
|
6
|
+
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
7
|
+
}
|
|
8
|
+
interface GeneratorSourceSelectionOptions {
|
|
9
|
+
runtime?: Set<string> | undefined;
|
|
10
|
+
getSourceCandidatesForEntries?: ((entries: TailwindSourceEntry[] | undefined) => Set<string>) | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface GeneratorSourceMetadata {
|
|
13
|
+
matchedCssSourceFile?: string | undefined;
|
|
14
|
+
sourceBase?: string | undefined;
|
|
15
|
+
sourceCss?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export type GeneratorResolvedSource = TailwindResolvedSource & {
|
|
18
|
+
__weappTailwindcssMeta?: GeneratorSourceMetadata | undefined;
|
|
19
|
+
};
|
|
20
|
+
export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
|
|
21
|
+
export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<import("tailwindcss-patch").TailwindV4ResolvedSource | import("@/generator").TailwindV3ResolvedSource | undefined>;
|
|
22
|
+
export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions, selectionOptions?: GeneratorSourceSelectionOptions): Promise<TailwindResolvedSource[]>;
|
|
23
|
+
export declare function resolveGeneratorSourceEntries(source: TailwindResolvedSource, runtimeState?: GeneratorSourceRuntimeState): Promise<TailwindSourceEntry[] | undefined>;
|
|
24
|
+
export {};
|