weapp-tailwindcss 5.0.0-next.9 → 5.0.0
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 +2 -2
- package/dist/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/bundle-state-CnaJxkFY.mjs +413 -0
- package/dist/bundle-state-DgGEhk_z.js +529 -0
- package/dist/bundlers/shared/cache.d.ts +9 -7
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -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/directives.d.ts +11 -3
- package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +6 -2
- 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 +6 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +24 -2
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- 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 -8
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
- package/dist/cli/context.d.ts +1 -11
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +684 -41
- package/dist/cli.mjs +682 -40
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +11 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -46
- package/dist/css-macro/postcss.mjs +2 -46
- package/dist/css-macro.js +16 -7
- package/dist/css-macro.mjs +15 -6
- package/dist/defaults-8xrgzxFY.mjs +151 -0
- package/dist/defaults-zKUH2mDe.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/options.d.ts +11 -6
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator--0-ekuVO.js +92 -0
- package/dist/generator-B76ovqsv.mjs +67 -0
- package/dist/generator.js +12 -12
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +163 -40
- package/dist/gulp.mjs +155 -32
- package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
- package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/dist/index.mjs +6 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/precheck.d.ts +2 -2
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/postcss-C7BMYpEF.mjs +169 -0
- package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
- package/dist/postcss-CiYLsqZn.js +192 -0
- package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BrNwLG2e.mjs +4716 -0
- package/dist/precheck-DPtJjZmV.js +4842 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +27 -13
- package/dist/presets.mjs +25 -13
- package/dist/reset.js +1 -1
- package/dist/runtime-registry-DpcR3IHI.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-DN1mihlU.mjs +322 -0
- package/dist/source-candidates-DSxme_O2.js +335 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime.d.ts +9 -9
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
- package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
- package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +51 -41
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/types/user-defined-options/general.d.ts +25 -22
- package/dist/types/user-defined-options/important.d.ts +32 -27
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
- package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
- package/dist/v3-engine-D3BMLVAN.js +3712 -0
- package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
- package/dist/vite-DOprpdH-.mjs +24493 -0
- package/dist/vite-Ec0uX6kF.js +24507 -0
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
- package/dist/weapp-tw-runtime-classset-loader.js +32 -9
- package/dist/{webpack-BzN2ly34.js → webpack-Ccohlg3A.js} +341 -96
- package/dist/{webpack-DJazm5sT.mjs → webpack-DFlZcqAU.mjs} +323 -79
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +22 -20
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/cache-BVAiJV3J.js +0 -502
- package/dist/cache-CHs4DXui.mjs +0 -434
- package/dist/constants-BoB_6lFw.js +0 -73
- package/dist/constants-E_loJC49.mjs +0 -44
- package/dist/generator-DKkhJbOg.js +0 -1531
- package/dist/generator-UBmfduYg.mjs +0 -1432
- package/dist/generator-css-Bwp3nbrl.js +0 -1381
- package/dist/generator-css-DeLLmp2N.mjs +0 -1342
- 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/precheck-B32p-gLI.js +0 -2736
- package/dist/precheck-B4RH6ZNN.mjs +0 -2622
- package/dist/run-tasks-B50A3pxt.js +0 -128
- package/dist/run-tasks-DdNi-hkk.mjs +0 -91
- package/dist/runtime-patch-CwN5ya72.mjs +0 -71
- package/dist/runtime-patch-D6mBo_KB.js +0 -85
- package/dist/vite-By5KQi9s.js +0 -2419
- package/dist/vite-Cyp42bBf.mjs +0 -2406
- /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
+
const require_precheck = require("./precheck-DPtJjZmV.js");
|
|
3
|
+
let node_module = require("node:module");
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
node_process = require_chunk.__toESM(node_process);
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_chunk.__toESM(node_path);
|
|
8
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
9
|
+
let node_buffer = require("node:buffer");
|
|
10
|
+
//#region src/bundlers/shared/module-graph.ts
|
|
11
|
+
const QUERY_HASH_RE = /[?#].*$/u;
|
|
12
|
+
const PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
13
|
+
const WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
|
|
14
|
+
const VIRTUAL_PREFIX = "\0";
|
|
15
|
+
const JS_EXTENSIONS = [
|
|
16
|
+
".js",
|
|
17
|
+
".mjs",
|
|
18
|
+
".cjs"
|
|
19
|
+
];
|
|
20
|
+
function normalizeOutputPathKey(value) {
|
|
21
|
+
return node_path.default.normalize(value).replace(/\\/g, "/");
|
|
22
|
+
}
|
|
23
|
+
function stripQueryAndHash(specifier) {
|
|
24
|
+
return specifier.replace(QUERY_HASH_RE, "");
|
|
25
|
+
}
|
|
26
|
+
function isResolvableSpecifier(specifier) {
|
|
27
|
+
if (!specifier) return false;
|
|
28
|
+
const normalized = stripQueryAndHash(specifier);
|
|
29
|
+
if (normalized.startsWith(VIRTUAL_PREFIX)) return false;
|
|
30
|
+
if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) return true;
|
|
31
|
+
return !PROTOCOL_RE.test(normalized);
|
|
32
|
+
}
|
|
33
|
+
function toAbsoluteOutputPath(fileName, outDir) {
|
|
34
|
+
if (node_path.default.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) return node_path.default.normalize(fileName);
|
|
35
|
+
return node_path.default.resolve(outDir, fileName);
|
|
36
|
+
}
|
|
37
|
+
function matchWithExtensions(candidate, hasOutput) {
|
|
38
|
+
if (hasOutput(candidate)) return candidate;
|
|
39
|
+
if (!node_path.default.extname(candidate)) for (const ext of JS_EXTENSIONS) {
|
|
40
|
+
const extended = `${candidate}${ext}`;
|
|
41
|
+
if (hasOutput(extended)) return extended;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
45
|
+
if (!isResolvableSpecifier(specifier)) return;
|
|
46
|
+
const normalized = stripQueryAndHash(specifier);
|
|
47
|
+
let candidate;
|
|
48
|
+
if (node_path.default.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) candidate = node_path.default.normalize(normalized);
|
|
49
|
+
else if (normalized.startsWith("/")) candidate = node_path.default.resolve(outDir, normalized.slice(1));
|
|
50
|
+
else candidate = node_path.default.resolve(node_path.default.dirname(importer), normalized);
|
|
51
|
+
return matchWithExtensions(candidate, hasOutput);
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/bundlers/shared/style-requests.ts
|
|
55
|
+
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
56
|
+
const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
|
|
57
|
+
const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
|
|
58
|
+
function stripHash(request) {
|
|
59
|
+
const hashIndex = request.indexOf("#");
|
|
60
|
+
return hashIndex === -1 ? request : request.slice(0, hashIndex);
|
|
61
|
+
}
|
|
62
|
+
function stripRequestQuery(request) {
|
|
63
|
+
const normalized = stripHash(request);
|
|
64
|
+
const queryIndex = normalized.indexOf("?");
|
|
65
|
+
return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
66
|
+
}
|
|
67
|
+
function isSourceStyleRequest(request) {
|
|
68
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
69
|
+
const normalized = stripHash(request);
|
|
70
|
+
const queryIndex = normalized.indexOf("?");
|
|
71
|
+
const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
72
|
+
if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
|
|
73
|
+
if (queryIndex === -1) return false;
|
|
74
|
+
const query = normalized.slice(queryIndex + 1);
|
|
75
|
+
return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/bundlers/vite/utils.ts
|
|
79
|
+
function slash(p) {
|
|
80
|
+
return (0, _weapp_tailwindcss_shared.ensurePosix)(p);
|
|
81
|
+
}
|
|
82
|
+
const isWindows = node_process.default.platform === "win32";
|
|
83
|
+
const cssLangRE = new RegExp(`\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`);
|
|
84
|
+
function isCSSRequest(request) {
|
|
85
|
+
return cssLangRE.test(request) || isSourceStyleRequest(request);
|
|
86
|
+
}
|
|
87
|
+
function normalizePath(id) {
|
|
88
|
+
return node_path.default.posix.normalize(isWindows ? (0, _weapp_tailwindcss_shared.ensurePosix)(id) : id);
|
|
89
|
+
}
|
|
90
|
+
async function formatPostcssSourceMap(rawMap, file) {
|
|
91
|
+
const inputFileDir = node_path.default.dirname(file);
|
|
92
|
+
const sources = rawMap.sources.map((source) => {
|
|
93
|
+
const cleanSource = (0, _weapp_tailwindcss_shared.cleanUrl)(decodeURIComponent(source));
|
|
94
|
+
if (cleanSource[0] === "<" && cleanSource.endsWith(">")) return `\0${cleanSource}`;
|
|
95
|
+
return normalizePath(node_path.default.resolve(inputFileDir, cleanSource));
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
file,
|
|
99
|
+
mappings: rawMap.mappings,
|
|
100
|
+
names: rawMap.names,
|
|
101
|
+
sources,
|
|
102
|
+
sourcesContent: rawMap.sourcesContent,
|
|
103
|
+
version: rawMap.version
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region src/utils/disabled.ts
|
|
108
|
+
function resolvePluginDisabledState(disabled) {
|
|
109
|
+
if (disabled === true) return { plugin: true };
|
|
110
|
+
if (disabled === false || disabled == null) return { plugin: false };
|
|
111
|
+
return { plugin: disabled.plugin ?? false };
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/utils/resolve-package.ts
|
|
115
|
+
const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
116
|
+
function resolvePackageDir(name) {
|
|
117
|
+
const pkgPath = require$1.resolve(`${name}/package.json`);
|
|
118
|
+
return node_path.default.dirname(pkgPath);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/bundlers/shared/generated-css-marker.ts
|
|
122
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/i;
|
|
123
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?::[^\s*]+)?\s*\*\/\s*/gi;
|
|
124
|
+
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
125
|
+
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
126
|
+
}
|
|
127
|
+
function hasBundlerGeneratedCssMarker(source) {
|
|
128
|
+
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
129
|
+
}
|
|
130
|
+
function stripBundlerGeneratedCssMarkers(source) {
|
|
131
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
|
|
132
|
+
}
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/bundlers/shared/run-tasks.ts
|
|
135
|
+
async function runWithConcurrency(factories, limit = Math.min(4, Math.max(1, factories.length))) {
|
|
136
|
+
if (factories.length === 0) return [];
|
|
137
|
+
const results = Array.from({ length: factories.length });
|
|
138
|
+
const executing = /* @__PURE__ */ new Set();
|
|
139
|
+
let cursor = 0;
|
|
140
|
+
const effectiveLimit = Math.max(1, limit);
|
|
141
|
+
const scheduleNext = () => {
|
|
142
|
+
if (cursor >= factories.length) return;
|
|
143
|
+
const currentIndex = cursor++;
|
|
144
|
+
const factory = factories[currentIndex];
|
|
145
|
+
if (!factory) return;
|
|
146
|
+
const wrapped = Promise.resolve(factory()).then((value) => {
|
|
147
|
+
results[currentIndex] = value;
|
|
148
|
+
}).finally(() => {
|
|
149
|
+
executing.delete(wrapped);
|
|
150
|
+
});
|
|
151
|
+
executing.add(wrapped);
|
|
152
|
+
};
|
|
153
|
+
while (cursor < factories.length && executing.size < effectiveLimit) scheduleNext();
|
|
154
|
+
while (cursor < factories.length) {
|
|
155
|
+
await Promise.race(executing);
|
|
156
|
+
scheduleNext();
|
|
157
|
+
}
|
|
158
|
+
await Promise.all(executing);
|
|
159
|
+
return results;
|
|
160
|
+
}
|
|
161
|
+
function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
162
|
+
if (factories.length === 0) return;
|
|
163
|
+
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/bundlers/vite/bundle-entries.ts
|
|
167
|
+
function readOutputEntry(entry) {
|
|
168
|
+
if (entry.output.type === "chunk") return entry.output.code;
|
|
169
|
+
const source = entry.output.source;
|
|
170
|
+
if (typeof source === "string") return source;
|
|
171
|
+
if (source instanceof Uint8Array) return node_buffer.Buffer.from(source).toString();
|
|
172
|
+
const fallbackSource = source;
|
|
173
|
+
if (fallbackSource == null) return;
|
|
174
|
+
if (typeof fallbackSource.toString === "function") return fallbackSource.toString();
|
|
175
|
+
}
|
|
176
|
+
function isJavaScriptEntry(entry) {
|
|
177
|
+
if (entry.output.type === "chunk") return true;
|
|
178
|
+
return entry.fileName.endsWith(".js");
|
|
179
|
+
}
|
|
180
|
+
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
181
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
182
|
+
for (const [id, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(id), entry);
|
|
183
|
+
const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
184
|
+
return {
|
|
185
|
+
resolve(specifier, importer) {
|
|
186
|
+
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
187
|
+
},
|
|
188
|
+
load(id) {
|
|
189
|
+
const entry = getEntry(id);
|
|
190
|
+
if (!entry) return;
|
|
191
|
+
return readOutputEntry(entry);
|
|
192
|
+
},
|
|
193
|
+
filter(id) {
|
|
194
|
+
return Boolean(getEntry(id));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
199
|
+
if (!linked) return;
|
|
200
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const [entryId, entry] of entries) normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
|
|
202
|
+
for (const [id, { code }] of Object.entries(linked)) {
|
|
203
|
+
const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
204
|
+
if (!entry) continue;
|
|
205
|
+
const previous = readOutputEntry(entry);
|
|
206
|
+
if (previous == null || previous === code) continue;
|
|
207
|
+
if (entry.output.type === "chunk") entry.output.code = code;
|
|
208
|
+
else entry.output.source = code;
|
|
209
|
+
onApplied?.(entry, code);
|
|
210
|
+
onLinkedUpdate(entry.fileName, previous, code);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//#endregion
|
|
214
|
+
//#region src/bundlers/vite/runtime-affecting-signature.ts
|
|
215
|
+
const CSS_BLOCK_COMMENT_RE = /\/\*[\s\S]*?\*\//g;
|
|
216
|
+
const CSS_AROUND_PUNCTUATION_RE = /\s*([{}:;,>+~()])\s*/g;
|
|
217
|
+
const CSS_TRAILING_DECLARATION_SEMICOLON_RE = /;\}/g;
|
|
218
|
+
const CSS_WHITESPACE_RE = /\s+/g;
|
|
219
|
+
function createHtmlRuntimeAffectingSignature(source) {
|
|
220
|
+
try {
|
|
221
|
+
const parts = [];
|
|
222
|
+
const parser = new require_precheck.Parser({
|
|
223
|
+
onattribute(name, value) {
|
|
224
|
+
parts.push(`a:${name}=${value}`);
|
|
225
|
+
},
|
|
226
|
+
oncomment(data) {
|
|
227
|
+
parts.push(`c:${data}`);
|
|
228
|
+
},
|
|
229
|
+
ontext(data) {
|
|
230
|
+
const value = data.trim();
|
|
231
|
+
if (value.length > 0) parts.push(`t:${value}`);
|
|
232
|
+
}
|
|
233
|
+
}, { xmlMode: true });
|
|
234
|
+
parser.write(source);
|
|
235
|
+
parser.end();
|
|
236
|
+
return parts.join("\n");
|
|
237
|
+
} catch {
|
|
238
|
+
return source;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function createJsRuntimeAffectingSignature(source) {
|
|
242
|
+
try {
|
|
243
|
+
const ast = require_precheck.babelParse(source, {
|
|
244
|
+
cache: true,
|
|
245
|
+
cacheKey: "vite-runtime-affecting:unambiguous",
|
|
246
|
+
plugins: ["jsx", "typescript"],
|
|
247
|
+
sourceType: "unambiguous"
|
|
248
|
+
});
|
|
249
|
+
const parts = [];
|
|
250
|
+
require_precheck.traverse(ast, {
|
|
251
|
+
noScope: true,
|
|
252
|
+
StringLiteral(path) {
|
|
253
|
+
parts.push(`s:${path.node.value}`);
|
|
254
|
+
},
|
|
255
|
+
TemplateElement(path) {
|
|
256
|
+
parts.push(`t:${path.node.value.raw}`);
|
|
257
|
+
},
|
|
258
|
+
JSXText(path) {
|
|
259
|
+
const value = path.node.value.trim();
|
|
260
|
+
if (value.length > 0) parts.push(`x:${value}`);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
const comments = ast.comments;
|
|
264
|
+
if (Array.isArray(comments)) {
|
|
265
|
+
for (const comment of comments) if (typeof comment?.value === "string" && comment.value.length > 0) parts.push(`c:${comment.value}`);
|
|
266
|
+
}
|
|
267
|
+
return parts.join("\n");
|
|
268
|
+
} catch {
|
|
269
|
+
return source;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function createCssRuntimeAffectingSignature(source) {
|
|
273
|
+
return source.replace(CSS_BLOCK_COMMENT_RE, "").replace(CSS_AROUND_PUNCTUATION_RE, "$1").replace(CSS_TRAILING_DECLARATION_SEMICOLON_RE, "}").replace(CSS_WHITESPACE_RE, " ").trim();
|
|
274
|
+
}
|
|
275
|
+
function createRuntimeAffectingSourceSignature(source, type) {
|
|
276
|
+
if (type === "html") return createHtmlRuntimeAffectingSignature(source);
|
|
277
|
+
if (type === "js") return createJsRuntimeAffectingSignature(source);
|
|
278
|
+
if (type === "css") return createCssRuntimeAffectingSignature(source);
|
|
279
|
+
return source;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/bundlers/vite/bundle-state.ts
|
|
283
|
+
function createBundleBuildState() {
|
|
284
|
+
return {
|
|
285
|
+
iteration: 0,
|
|
286
|
+
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
287
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
288
|
+
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
289
|
+
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
290
|
+
dependentsByLinkedFile: /* @__PURE__ */ new Map(),
|
|
291
|
+
generatorCandidateSignature: void 0
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
function createChangedByType() {
|
|
295
|
+
return {
|
|
296
|
+
html: /* @__PURE__ */ new Set(),
|
|
297
|
+
js: /* @__PURE__ */ new Set(),
|
|
298
|
+
css: /* @__PURE__ */ new Set(),
|
|
299
|
+
other: /* @__PURE__ */ new Set()
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function createProcessFiles() {
|
|
303
|
+
return {
|
|
304
|
+
html: /* @__PURE__ */ new Set(),
|
|
305
|
+
js: /* @__PURE__ */ new Set(),
|
|
306
|
+
css: /* @__PURE__ */ new Set()
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
function readEntrySource(output) {
|
|
310
|
+
if (output.type === "chunk") return output.code;
|
|
311
|
+
return output.source.toString();
|
|
312
|
+
}
|
|
313
|
+
function classifyBundleEntry(file, opts) {
|
|
314
|
+
if (opts.cssMatcher(file) || isCSSRequest(file)) return "css";
|
|
315
|
+
if (opts.htmlMatcher(file)) return "html";
|
|
316
|
+
if (opts.jsMatcher(file) || opts.wxsMatcher(file)) return "js";
|
|
317
|
+
return "other";
|
|
318
|
+
}
|
|
319
|
+
function collectJsEntries(fileName, output, outDir, store) {
|
|
320
|
+
const entry = {
|
|
321
|
+
fileName,
|
|
322
|
+
output
|
|
323
|
+
};
|
|
324
|
+
if (!isJavaScriptEntry(entry)) return;
|
|
325
|
+
const absolute = toAbsoluteOutputPath(fileName, outDir);
|
|
326
|
+
store.set(absolute, entry);
|
|
327
|
+
}
|
|
328
|
+
function markProcessFile(type, file, processFiles) {
|
|
329
|
+
if (type === "html" || type === "js" || type === "css") processFiles[type].add(file);
|
|
330
|
+
}
|
|
331
|
+
function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
332
|
+
const sourceHashByFile = /* @__PURE__ */ new Map();
|
|
333
|
+
const runtimeAffectingSignatureByFile = /* @__PURE__ */ new Map();
|
|
334
|
+
const runtimeAffectingHashByFile = /* @__PURE__ */ new Map();
|
|
335
|
+
const changedByType = createChangedByType();
|
|
336
|
+
const runtimeAffectingChangedByType = createChangedByType();
|
|
337
|
+
const processFiles = createProcessFiles();
|
|
338
|
+
const linkedImpactsByEntry = /* @__PURE__ */ new Map();
|
|
339
|
+
const jsEntries = /* @__PURE__ */ new Map();
|
|
340
|
+
const entries = [];
|
|
341
|
+
const firstRun = state.linkedByEntry.size === 0;
|
|
342
|
+
for (const [file, output] of Object.entries(bundle)) {
|
|
343
|
+
const type = classifyBundleEntry(file, opts);
|
|
344
|
+
const source = readEntrySource(output);
|
|
345
|
+
const hash = opts.cache.computeHash(source);
|
|
346
|
+
sourceHashByFile.set(file, hash);
|
|
347
|
+
const previousHash = state.sourceHashByFile.get(file);
|
|
348
|
+
const changed = previousHash == null || previousHash !== hash;
|
|
349
|
+
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
350
|
+
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
351
|
+
const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
|
|
352
|
+
const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
|
|
353
|
+
const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
|
|
354
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
355
|
+
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
356
|
+
if (changed) changedByType[type].add(file);
|
|
357
|
+
if (previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash) runtimeAffectingChangedByType[type].add(file);
|
|
358
|
+
if (forceAll || firstRun) markProcessFile(type, file, processFiles);
|
|
359
|
+
else if (type === "html") processFiles.html.add(file);
|
|
360
|
+
else if (changed && (type === "js" || type === "css")) processFiles[type].add(file);
|
|
361
|
+
collectJsEntries(file, output, outDir, jsEntries);
|
|
362
|
+
entries.push({
|
|
363
|
+
file,
|
|
364
|
+
output,
|
|
365
|
+
source,
|
|
366
|
+
type
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (!forceAll && !firstRun) for (const changedFile of changedByType.js) {
|
|
370
|
+
const dependents = state.dependentsByLinkedFile.get(changedFile);
|
|
371
|
+
if (!dependents) continue;
|
|
372
|
+
for (const entryFile of dependents) {
|
|
373
|
+
processFiles.js.add(entryFile);
|
|
374
|
+
let impacts = linkedImpactsByEntry.get(entryFile);
|
|
375
|
+
if (!impacts) {
|
|
376
|
+
impacts = /* @__PURE__ */ new Set();
|
|
377
|
+
linkedImpactsByEntry.set(entryFile, impacts);
|
|
378
|
+
}
|
|
379
|
+
impacts.add(changedFile);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return {
|
|
383
|
+
entries,
|
|
384
|
+
jsEntries,
|
|
385
|
+
sourceHashByFile,
|
|
386
|
+
runtimeAffectingSignatureByFile,
|
|
387
|
+
runtimeAffectingHashByFile,
|
|
388
|
+
changedByType,
|
|
389
|
+
runtimeAffectingChangedByType,
|
|
390
|
+
processFiles,
|
|
391
|
+
linkedImpactsByEntry
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function invertLinkedByEntry(linkedByEntry) {
|
|
395
|
+
const dependentsByLinkedFile = /* @__PURE__ */ new Map();
|
|
396
|
+
for (const [entryFile, linkedFiles] of linkedByEntry.entries()) for (const linkedFile of linkedFiles) {
|
|
397
|
+
let dependents = dependentsByLinkedFile.get(linkedFile);
|
|
398
|
+
if (!dependents) {
|
|
399
|
+
dependents = /* @__PURE__ */ new Set();
|
|
400
|
+
dependentsByLinkedFile.set(linkedFile, dependents);
|
|
401
|
+
}
|
|
402
|
+
dependents.add(entryFile);
|
|
403
|
+
}
|
|
404
|
+
return dependentsByLinkedFile;
|
|
405
|
+
}
|
|
406
|
+
function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
407
|
+
const incremental = options.incremental === true;
|
|
408
|
+
state.iteration += 1;
|
|
409
|
+
state.sourceHashByFile = incremental ? new Map([...state.sourceHashByFile, ...snapshot.sourceHashByFile]) : snapshot.sourceHashByFile;
|
|
410
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
411
|
+
state.runtimeAffectingHashByFile = incremental ? new Map([...state.runtimeAffectingHashByFile, ...snapshot.runtimeAffectingHashByFile]) : snapshot.runtimeAffectingHashByFile;
|
|
412
|
+
state.linkedByEntry = incremental ? new Map([...state.linkedByEntry, ...linkedByEntry]) : linkedByEntry;
|
|
413
|
+
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
Object.defineProperty(exports, "applyLinkedResults", {
|
|
417
|
+
enumerable: true,
|
|
418
|
+
get: function() {
|
|
419
|
+
return applyLinkedResults;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
Object.defineProperty(exports, "buildBundleSnapshot", {
|
|
423
|
+
enumerable: true,
|
|
424
|
+
get: function() {
|
|
425
|
+
return buildBundleSnapshot;
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
Object.defineProperty(exports, "createBundleBuildState", {
|
|
429
|
+
enumerable: true,
|
|
430
|
+
get: function() {
|
|
431
|
+
return createBundleBuildState;
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
Object.defineProperty(exports, "createBundleModuleGraphOptions", {
|
|
435
|
+
enumerable: true,
|
|
436
|
+
get: function() {
|
|
437
|
+
return createBundleModuleGraphOptions;
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
441
|
+
enumerable: true,
|
|
442
|
+
get: function() {
|
|
443
|
+
return createBundlerGeneratedCssMarker;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
Object.defineProperty(exports, "formatPostcssSourceMap", {
|
|
447
|
+
enumerable: true,
|
|
448
|
+
get: function() {
|
|
449
|
+
return formatPostcssSourceMap;
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
Object.defineProperty(exports, "hasBundlerGeneratedCssMarker", {
|
|
453
|
+
enumerable: true,
|
|
454
|
+
get: function() {
|
|
455
|
+
return hasBundlerGeneratedCssMarker;
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
Object.defineProperty(exports, "isCSSRequest", {
|
|
459
|
+
enumerable: true,
|
|
460
|
+
get: function() {
|
|
461
|
+
return isCSSRequest;
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
Object.defineProperty(exports, "isSourceStyleRequest", {
|
|
465
|
+
enumerable: true,
|
|
466
|
+
get: function() {
|
|
467
|
+
return isSourceStyleRequest;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
Object.defineProperty(exports, "normalizeOutputPathKey", {
|
|
471
|
+
enumerable: true,
|
|
472
|
+
get: function() {
|
|
473
|
+
return normalizeOutputPathKey;
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
477
|
+
enumerable: true,
|
|
478
|
+
get: function() {
|
|
479
|
+
return pushConcurrentTaskFactories;
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
Object.defineProperty(exports, "resolveOutputSpecifier", {
|
|
483
|
+
enumerable: true,
|
|
484
|
+
get: function() {
|
|
485
|
+
return resolveOutputSpecifier;
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
Object.defineProperty(exports, "resolvePackageDir", {
|
|
489
|
+
enumerable: true,
|
|
490
|
+
get: function() {
|
|
491
|
+
return resolvePackageDir;
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
Object.defineProperty(exports, "resolvePluginDisabledState", {
|
|
495
|
+
enumerable: true,
|
|
496
|
+
get: function() {
|
|
497
|
+
return resolvePluginDisabledState;
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
Object.defineProperty(exports, "slash", {
|
|
501
|
+
enumerable: true,
|
|
502
|
+
get: function() {
|
|
503
|
+
return slash;
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
Object.defineProperty(exports, "stripBundlerGeneratedCssMarkers", {
|
|
507
|
+
enumerable: true,
|
|
508
|
+
get: function() {
|
|
509
|
+
return stripBundlerGeneratedCssMarkers;
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
Object.defineProperty(exports, "stripRequestQuery", {
|
|
513
|
+
enumerable: true,
|
|
514
|
+
get: function() {
|
|
515
|
+
return stripRequestQuery;
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
Object.defineProperty(exports, "toAbsoluteOutputPath", {
|
|
519
|
+
enumerable: true,
|
|
520
|
+
get: function() {
|
|
521
|
+
return toAbsoluteOutputPath;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
Object.defineProperty(exports, "updateBundleBuildState", {
|
|
525
|
+
enumerable: true,
|
|
526
|
+
get: function() {
|
|
527
|
+
return updateBundleBuildState;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
@@ -2,15 +2,17 @@ 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;
|
|
9
|
-
applyResult: (value: TValue
|
|
5
|
+
hashKey?: HashMapKey | undefined;
|
|
6
|
+
rawSource?: string | undefined;
|
|
7
|
+
hash?: string | undefined;
|
|
8
|
+
readCache?: (() => TValue | undefined) | undefined;
|
|
9
|
+
applyResult: (value: TValue, meta: {
|
|
10
|
+
cacheHit: boolean;
|
|
11
|
+
}) => void | Promise<void>;
|
|
10
12
|
transform: () => Promise<{
|
|
11
13
|
result: TValue;
|
|
12
|
-
cacheValue?: CacheValue;
|
|
14
|
+
cacheValue?: CacheValue | undefined;
|
|
13
15
|
}>;
|
|
14
|
-
onCacheHit?: () => void;
|
|
16
|
+
onCacheHit?: (() => void) | undefined;
|
|
15
17
|
}
|
|
16
18
|
export declare function processCachedTask<TValue extends CacheValue>({ cache, cacheKey, hashKey, rawSource, hash, readCache, applyResult, transform, onCacheHit, }: ProcessCachedTaskOptions<TValue>): Promise<void>;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function removeUnsupportedAtSupports(css: string): string;
|
|
1
|
+
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules, } from '@weapp-tailwindcss/postcss';
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export { removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules } from '
|
|
2
|
-
export declare function hoistTailwindPreflightBase(css: string): string;
|
|
3
|
-
export declare function finalizeMiniProgramCss(css: string): string;
|
|
1
|
+
export { finalizeMiniProgramCss, hoistTailwindPreflightBase, removeUnsupportedAtSupports, removeUnsupportedMiniProgramAtRules, } from '@weapp-tailwindcss/postcss';
|
|
@@ -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;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
interface TailwindDirectiveOptions {
|
|
2
|
+
importFallback?: boolean | undefined;
|
|
3
|
+
}
|
|
1
4
|
export declare function parseImportRequest(params: string): string | undefined;
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function normalizeTailwindSourceForGenerator(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
6
|
+
export declare function normalizeTailwindV3CssEntrySource(rawSource: string): string;
|
|
7
|
+
export declare function normalizeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
8
|
+
export declare function removeTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): string;
|
|
9
|
+
export declare function hasTailwindSourceDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
|
|
10
|
+
export declare function hasTailwindRootDirectives(rawSource: string, options?: TailwindDirectiveOptions): boolean;
|
|
5
11
|
export declare function hasTailwindApplyDirective(rawSource: string): boolean;
|
|
6
12
|
export declare function resolveCssEntrySource(rawSource: string, base: string, options?: {
|
|
7
13
|
removeConfig?: boolean;
|
|
14
|
+
importFallback?: boolean;
|
|
8
15
|
}): {
|
|
9
16
|
css: string;
|
|
10
17
|
config: string | undefined;
|
|
11
18
|
configRequest: string | undefined;
|
|
12
19
|
base: string;
|
|
13
20
|
} | undefined;
|
|
21
|
+
export {};
|
|
@@ -8,7 +8,19 @@ export declare const TAILWIND_BANNER_GLOBAL_RE: RegExp;
|
|
|
8
8
|
export declare const VITE_MARKER_RE: RegExp;
|
|
9
9
|
export declare function createCssAppend(base: string, extra: string): string;
|
|
10
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;
|
|
11
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;
|
|
12
24
|
export declare function stripTailwindBanner(css: string): string;
|
|
13
25
|
export declare function stripTailwindBanners(css: string): string;
|
|
14
26
|
export declare function stripGeneratorPlaceholderMarkers(css: string): string;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
export interface SourceSideCssEntrySource {
|
|
2
|
+
css: string;
|
|
3
|
+
config?: string | undefined;
|
|
4
|
+
configRequest?: string | undefined;
|
|
5
|
+
base: string;
|
|
6
|
+
file: string;
|
|
7
|
+
}
|
|
1
8
|
export declare function resolveSourceSideCssEntrySource(file: string, sourceOptions: {
|
|
2
9
|
projectRoot?: string;
|
|
3
10
|
cwd?: string;
|
|
11
|
+
outputRoot?: string;
|
|
4
12
|
}, resolveOptions?: {
|
|
5
13
|
removeConfig?: boolean;
|
|
6
|
-
}):
|
|
7
|
-
css: string;
|
|
8
|
-
config: string | undefined;
|
|
9
|
-
configRequest: string | undefined;
|
|
10
|
-
base: string;
|
|
11
|
-
} | undefined;
|
|
14
|
+
}): SourceSideCssEntrySource | undefined;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { NormalizedWeappTailwindcssGeneratorOptions, TailwindResolvedSource } from '../../../generator';
|
|
3
|
+
import type { TailwindSourceEntry } from '../../../tailwindcss/source-scan';
|
|
3
4
|
import type { InternalUserDefinedOptions } from '../../../types';
|
|
4
5
|
interface GeneratorSourceRuntimeState {
|
|
5
6
|
twPatcher: InternalUserDefinedOptions['twPatcher'];
|
|
6
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
|
+
};
|
|
7
20
|
export declare function resolveCssSourceBase(file: string, cssHandlerOptions: IStyleHandlerOptions): string;
|
|
8
|
-
export declare function resolveGeneratorSource(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<import("
|
|
9
|
-
export declare function resolveGeneratorSources(majorVersion: number | undefined, runtimeState: GeneratorSourceRuntimeState, rawSource: string, file: string, cssHandlerOptions: IStyleHandlerOptions, generatorOptions?: NormalizedWeappTailwindcssGeneratorOptions): Promise<TailwindResolvedSource[]>;
|
|
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>;
|
|
10
24
|
export {};
|