weapp-tailwindcss 5.0.12 → 5.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bundle-state-DU2ATDhw.js → bundle-state-CKWeTEhv.js} +2 -2
- package/dist/{bundle-state-BxMNKjBV.mjs → bundle-state-zQ2MrDdi.mjs} +1 -1
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +7 -2
- package/dist/bundlers/shared/generator-css/source-files.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/source-resolver/config.d.ts +7 -0
- package/dist/bundlers/shared/generator-css/source-resolver/matching.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +15 -0
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-resolver/types.d.ts +22 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +5 -22
- package/dist/bundlers/shared/generator-css/types.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
- package/dist/bundlers/vite/css-memory.d.ts +27 -0
- package/dist/bundlers/vite/generate-bundle/bundle-file-names.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/configured-css-sources.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -0
- package/dist/bundlers/vite/generate-bundle/css-output.d.ts +8 -7
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +58 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +31 -0
- package/dist/bundlers/vite/generate-bundle/memory-debug.d.ts +77 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +53 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/runtime-linked-css.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +21 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +29 -0
- package/dist/bundlers/vite/generate-bundle/timing.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/uni-app-x-postprocess.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/vite-css-cache.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
- package/dist/bundlers/vite/hot-css-modules.d.ts +5 -0
- package/dist/bundlers/vite/map-cache.d.ts +2 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +16 -0
- package/dist/bundlers/vite/resolve-app-type.d.ts +1 -2
- package/dist/bundlers/vite/source-candidate-scan-signature.d.ts +13 -0
- package/dist/bundlers/vite/source-candidates.d.ts +3 -0
- package/dist/bundlers/vite/source-scan/css-entries.d.ts +1 -0
- package/dist/bundlers/vite/source-scan.d.ts +1 -1
- package/dist/bundlers/vite/weapp-vite-config.d.ts +3 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/helpers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +2 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +5 -0
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-DH0ZQRhy.mjs → defaults-Bqx18S1f.mjs} +2 -35
- package/dist/{defaults-Boc26eel.js → defaults-C_J_kBpw.js} +2 -35
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/framework/index.d.ts +59 -0
- package/dist/framework.d.ts +1 -0
- package/dist/framework.js +198 -0
- package/dist/framework.mjs +180 -0
- package/dist/{generator-Cb1Zp3Al.js → generator-CzpArpCL.js} +1 -1
- package/dist/{generator-mvNFUvns.mjs → generator-ITLd7PTl.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-BfZpaYSQ.mjs → gulp-DfOQERcV.mjs} +44 -16
- package/dist/{gulp-CxGZU0-v.js → gulp-XT8Jc7lH.js} +44 -16
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DFR51wgo.js → hmr-timing-BMftW7Us.js} +298 -221
- package/dist/{hmr-timing-DNjF8bWA.mjs → hmr-timing-DQIP_8qP.mjs} +297 -220
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -4
- package/dist/index.mjs +6 -5
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/{precheck-30zNPRlI.js → precheck-B0Z8yW7E.js} +98 -27
- package/dist/{precheck-CsFr1q2l.mjs → precheck-CRI90iL1.mjs} +97 -26
- package/dist/presets.js +3 -3
- package/dist/presets.mjs +3 -3
- package/dist/{tailwindcss-CK84uGBp.mjs → tailwindcss-DTq3uYBK.mjs} +2 -2
- package/dist/{tailwindcss-Clpkz1oR.js → tailwindcss-DZEwT3C_.js} +3 -3
- package/dist/{transform-Cju08-aJ.mjs → transform-DfcEjsZF.mjs} +29 -21
- package/dist/{transform-CaVEBOuR.js → transform-YmrmxuF3.js} +29 -21
- package/dist/types/user-defined-options/general.d.ts +3 -1
- package/dist/{utils-Dolmt8EO.js → utils-BCa37Wqj.js} +2 -17
- package/dist/{utils-DsaS975I.mjs → utils-DodxWHGz.mjs} +2 -17
- package/dist/{v3-engine-CQE5JJNZ.js → v3-engine-2rrgylhn.js} +53 -6
- package/dist/{v3-engine-DKBaKWGL.mjs → v3-engine-C6eJ0YzK.mjs} +46 -5
- package/dist/{vite-BBGOjh9e.js → vite-CXHVsHmX.js} +1945 -1280
- package/dist/{vite-CS5DE-HD.mjs → vite-DjI09vVN.mjs} +1944 -1279
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +346 -186
- package/dist/weapp-tw-runtime-classset-loader.js +25 -0
- package/dist/{webpack-SPcri_D8.mjs → webpack-BcPpnT90.mjs} +165 -35
- package/dist/{webpack-DIWrcpRo.js → webpack-CfkUkMXG.js} +167 -37
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +9 -4
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
//#region src/framework/index.ts
|
|
5
|
+
const KNOWN_MAC_HBUILDERX_PLUGIN_DIRS = ["/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli"];
|
|
6
|
+
const HBUILDERX_PLUGIN_CWD_RE = /[\\/]HBuilderX(?:\.[^\\/]*)?(?:[\\/]Contents[\\/]HBuilderX)?[\\/]plugins[\\/]uniapp-cli(?:-vite)?(?:[\\/]|$)/i;
|
|
7
|
+
const PACKAGE_JSON_FILE = "package.json";
|
|
8
|
+
const MANIFEST_JSON_FILE = "manifest.json";
|
|
9
|
+
const MPX_SCRIPT_RE = /\bmpx(?:-cli-service)?\b/u;
|
|
10
|
+
const TARO_SCRIPT_RE = /\btaro\b/u;
|
|
11
|
+
const WEAPP_VITE_SCRIPT_RE = /\bweapp-vite\b/u;
|
|
12
|
+
const UNI_APP_SCRIPT_RE = /\buni(?:\s|$)/u;
|
|
13
|
+
const UNI_APP_VITE_SCRIPT_RE = /\buni(?:\s|$)/u;
|
|
14
|
+
const MPX_MARKERS = [["src/app.mpx", "mpx"], ["app.mpx", "mpx"]];
|
|
15
|
+
function getProcessEnv() {
|
|
16
|
+
return {
|
|
17
|
+
MPX_CLI_MODE: process.env["MPX_CLI_MODE"],
|
|
18
|
+
MPX_CURRENT_TARGET_MODE: process.env["MPX_CURRENT_TARGET_MODE"],
|
|
19
|
+
NODE_PATH: process.env["NODE_PATH"],
|
|
20
|
+
TARO_ENV: process.env["TARO_ENV"],
|
|
21
|
+
UNI_PLATFORM: process.env["UNI_PLATFORM"],
|
|
22
|
+
UNI_UTS_PLATFORM: process.env["UNI_UTS_PLATFORM"],
|
|
23
|
+
WEAPP_TAILWINDCSS_TARGET: process.env["WEAPP_TAILWINDCSS_TARGET"],
|
|
24
|
+
WEAPP_TW_TARGET: process.env["WEAPP_TW_TARGET"]
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function resolveDependencyNames(pkg) {
|
|
28
|
+
return new Set([
|
|
29
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
30
|
+
...Object.keys(pkg.devDependencies ?? {}),
|
|
31
|
+
...Object.keys(pkg.peerDependencies ?? {}),
|
|
32
|
+
...Object.keys(pkg.optionalDependencies ?? {})
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
function hasDependencyPrefix(dependencyNames, prefix) {
|
|
36
|
+
return [...dependencyNames].some((name) => name.startsWith(prefix));
|
|
37
|
+
}
|
|
38
|
+
function hasScriptMatch(pkg, pattern) {
|
|
39
|
+
return Object.values(pkg.scripts ?? {}).some((script) => pattern.test(script));
|
|
40
|
+
}
|
|
41
|
+
function normalizePlatform(value) {
|
|
42
|
+
return value?.trim().toLowerCase() || void 0;
|
|
43
|
+
}
|
|
44
|
+
function resolvePlatformInfo(value) {
|
|
45
|
+
const normalized = normalizePlatform(value);
|
|
46
|
+
const isAppAndroid = normalized === "app-android";
|
|
47
|
+
const isAppIos = normalized === "app-ios";
|
|
48
|
+
const isAppHarmony = normalized === "app-harmony";
|
|
49
|
+
return {
|
|
50
|
+
raw: value,
|
|
51
|
+
normalized,
|
|
52
|
+
isApp: normalized?.startsWith("app-") === true || normalized === "app" || normalized === "app-plus",
|
|
53
|
+
isAppAndroid,
|
|
54
|
+
isAppHarmony,
|
|
55
|
+
isAppIos,
|
|
56
|
+
isMp: normalized?.startsWith("mp-") === true,
|
|
57
|
+
isWeb: normalized?.startsWith("web") === true || normalized === "h5"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function hasKnownHBuilderXPluginPrefix(normalizedCwd) {
|
|
61
|
+
for (const dir of KNOWN_MAC_HBUILDERX_PLUGIN_DIRS) {
|
|
62
|
+
const normalizedDir = path.normalize(dir);
|
|
63
|
+
if (normalizedCwd === normalizedDir || normalizedCwd.startsWith(`${normalizedDir}${path.sep}`)) return true;
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
function matchesHBuilderXPluginCwd(cwd) {
|
|
68
|
+
const normalized = path.normalize(cwd);
|
|
69
|
+
if (hasKnownHBuilderXPluginPrefix(normalized)) return true;
|
|
70
|
+
return HBUILDERX_PLUGIN_CWD_RE.test(normalized);
|
|
71
|
+
}
|
|
72
|
+
function isRunningInHBuilderX(options = {}) {
|
|
73
|
+
const env = options.env ?? getProcessEnv();
|
|
74
|
+
const nodePath = "nodePath" in options ? options.nodePath : env.NODE_PATH;
|
|
75
|
+
if (!(nodePath == null || nodePath.trim().length === 0)) return false;
|
|
76
|
+
return matchesHBuilderXPluginCwd(options.cwd ?? process.cwd());
|
|
77
|
+
}
|
|
78
|
+
function resolveUniPlatform(value) {
|
|
79
|
+
return resolvePlatformInfo(value);
|
|
80
|
+
}
|
|
81
|
+
function resolveUniUtsPlatform(value) {
|
|
82
|
+
return resolvePlatformInfo(value);
|
|
83
|
+
}
|
|
84
|
+
function resolveUniPlatformsFromEnv(env = getProcessEnv()) {
|
|
85
|
+
return {
|
|
86
|
+
uniPlatform: resolveUniPlatform(env.UNI_PLATFORM),
|
|
87
|
+
uniUtsPlatform: resolveUniUtsPlatform(env.UNI_UTS_PLATFORM)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function detectAppTypeFromEnv(env = getProcessEnv(), options = {}) {
|
|
91
|
+
if (env.WEAPP_TW_TARGET === "weapp-vite" || env.WEAPP_TAILWINDCSS_TARGET === "weapp-vite") return "weapp-vite";
|
|
92
|
+
if (env.TARO_ENV) return "taro";
|
|
93
|
+
if (env.MPX_CLI_MODE || env.MPX_CURRENT_TARGET_MODE) return "mpx";
|
|
94
|
+
const { uniPlatform, uniUtsPlatform } = resolveUniPlatformsFromEnv(env);
|
|
95
|
+
if (uniUtsPlatform.normalized) return "uni-app-x";
|
|
96
|
+
if (uniPlatform.normalized) return "uni-app-vite";
|
|
97
|
+
if (isRunningInHBuilderX({
|
|
98
|
+
cwd: options.cwd,
|
|
99
|
+
env
|
|
100
|
+
})) return options.hbuilderxVite === false ? "uni-app" : "uni-app-vite";
|
|
101
|
+
}
|
|
102
|
+
function isWeappVitePackage(pkg) {
|
|
103
|
+
const dependencyNames = resolveDependencyNames(pkg);
|
|
104
|
+
return dependencyNames.has("weapp-vite") || hasDependencyPrefix(dependencyNames, "@weapp-vite/") || hasScriptMatch(pkg, WEAPP_VITE_SCRIPT_RE);
|
|
105
|
+
}
|
|
106
|
+
function isMpxPackage(pkg) {
|
|
107
|
+
return hasDependencyPrefix(resolveDependencyNames(pkg), "@mpxjs/") || hasScriptMatch(pkg, MPX_SCRIPT_RE);
|
|
108
|
+
}
|
|
109
|
+
function isTaroPackage(pkg) {
|
|
110
|
+
return hasDependencyPrefix(resolveDependencyNames(pkg), "@tarojs/") || hasScriptMatch(pkg, TARO_SCRIPT_RE);
|
|
111
|
+
}
|
|
112
|
+
function isUniAppVitePackage(pkg) {
|
|
113
|
+
return resolveDependencyNames(pkg).has("@dcloudio/vite-plugin-uni") || hasScriptMatch(pkg, UNI_APP_VITE_SCRIPT_RE);
|
|
114
|
+
}
|
|
115
|
+
function isUniAppXPackage(pkg) {
|
|
116
|
+
const dependencyNames = resolveDependencyNames(pkg);
|
|
117
|
+
return dependencyNames.has("@dcloudio/uni-uts-v1") || dependencyNames.has("@weapp-tailwindcss/debug-uni-app-x");
|
|
118
|
+
}
|
|
119
|
+
function isUniAppPackage(pkg) {
|
|
120
|
+
const dependencyNames = resolveDependencyNames(pkg);
|
|
121
|
+
return dependencyNames.has("@dcloudio/vue-cli-plugin-uni") || dependencyNames.has("@dcloudio/uni-app") || Object.hasOwn(pkg, "uni-app") || hasScriptMatch(pkg, UNI_APP_SCRIPT_RE);
|
|
122
|
+
}
|
|
123
|
+
function isUniAppXManifest(manifest) {
|
|
124
|
+
return Boolean(manifest && Object.hasOwn(manifest, "uni-app-x"));
|
|
125
|
+
}
|
|
126
|
+
function detectAppTypeFromPackageJson(pkg) {
|
|
127
|
+
if (isWeappVitePackage(pkg)) return "weapp-vite";
|
|
128
|
+
if (isMpxPackage(pkg)) return "mpx";
|
|
129
|
+
if (isTaroPackage(pkg)) return "taro";
|
|
130
|
+
if (isUniAppXPackage(pkg)) return "uni-app-x";
|
|
131
|
+
if (isUniAppVitePackage(pkg)) return "uni-app-vite";
|
|
132
|
+
if (isUniAppPackage(pkg)) return "uni-app";
|
|
133
|
+
}
|
|
134
|
+
function tryReadJson(file) {
|
|
135
|
+
if (!existsSync(file)) return;
|
|
136
|
+
try {
|
|
137
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
138
|
+
} catch {}
|
|
139
|
+
}
|
|
140
|
+
function detectAppTypeFromMarkers(root) {
|
|
141
|
+
for (const [relativePath, appType] of MPX_MARKERS) if (existsSync(path.join(root, relativePath))) return appType;
|
|
142
|
+
}
|
|
143
|
+
function detectAppTypeFromRoot(root, searchUp = true) {
|
|
144
|
+
const resolvedRoot = path.resolve(root);
|
|
145
|
+
if (!existsSync(resolvedRoot)) return;
|
|
146
|
+
const markerDetected = detectAppTypeFromMarkers(resolvedRoot);
|
|
147
|
+
if (markerDetected) return markerDetected;
|
|
148
|
+
let current = resolvedRoot;
|
|
149
|
+
while (true) {
|
|
150
|
+
if (isUniAppXManifest(tryReadJson(path.join(current, MANIFEST_JSON_FILE)))) return "uni-app-x";
|
|
151
|
+
const pkg = tryReadJson(path.join(current, PACKAGE_JSON_FILE));
|
|
152
|
+
if (pkg) {
|
|
153
|
+
const detected = detectAppTypeFromPackageJson(pkg);
|
|
154
|
+
if (detected) return detected;
|
|
155
|
+
}
|
|
156
|
+
if (!searchUp) break;
|
|
157
|
+
const parent = path.dirname(current);
|
|
158
|
+
if (parent === current) break;
|
|
159
|
+
current = parent;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function detectAppType(options = {}) {
|
|
163
|
+
if (isUniAppXManifest(options.manifest)) return "uni-app-x";
|
|
164
|
+
if (options.packageJson) {
|
|
165
|
+
const detected = detectAppTypeFromPackageJson(options.packageJson);
|
|
166
|
+
if (detected) return detected;
|
|
167
|
+
}
|
|
168
|
+
if (options.root) {
|
|
169
|
+
const detected = detectAppTypeFromRoot(options.root, options.searchUp ?? true);
|
|
170
|
+
if (detected) return detected;
|
|
171
|
+
}
|
|
172
|
+
const env = options.env ?? (options.detectEnv ? getProcessEnv() : void 0);
|
|
173
|
+
if (env) return detectAppTypeFromEnv(env, {
|
|
174
|
+
cwd: options.cwd ?? options.root ?? (options.detectEnv ? process.cwd() : void 0),
|
|
175
|
+
hbuilderxVite: options.hbuilderxVite
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const resolveImplicitAppTypeFromViteRoot = (root) => detectAppType({ root });
|
|
179
|
+
//#endregion
|
|
180
|
+
export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-2rrgylhn.js");
|
|
3
3
|
let node_process = require("node:process");
|
|
4
4
|
node_process = require_chunk.__toESM(node_process);
|
|
5
5
|
//#region src/generator/options.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as resolveTailwindV4SourceFromPatcher, J as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher } from "./v3-engine-C6eJ0YzK.mjs";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
//#region src/generator/options.ts
|
|
4
4
|
const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
|
package/dist/generator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-2rrgylhn.js");
|
|
3
|
+
const require_generator = require("./generator-CzpArpCL.js");
|
|
4
4
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
5
5
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
6
6
|
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { C as resolveTailwindV4SourceFromPatcher, S as resolveTailwindV4SourceFromPatchOptions, X as transformTailwindV4CssByTarget, Z as transformTailwindV4CssToWeapp, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssByTarget, r as resolveTailwindV3SourceOptionsFromPatcher, s as transformTailwindV3CssToWeapp, t as resolveTailwindV3Source, w as resolveTailwindV4SourceOptionsFromPatcher, x as resolveTailwindV4Source } from "./v3-engine-C6eJ0YzK.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-ITLd7PTl.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-
|
|
3
|
-
import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-
|
|
4
|
-
import { _ as createCssSourceTraceCacheSignature, a as createTailwindV3DefaultExtractor, b as processCachedTask, g as annotateCssSourceTrace, n as emitHmrTiming, o as createBundleRuntimeClassSetManager, r as createSourceCandidateCollector, s as generateCssByGenerator, v as createCssTokenSourceMap } from "./hmr-timing-
|
|
1
|
+
import { D as hasTailwindRootDirectives, Y as getTailwindV4IncrementalGenerateCacheStats, a as getTailwindV3IncrementalGenerateCacheStats, h as resolveViteSourceScanEntries, j as normalizeTailwindSourceForGenerator, k as normalizeTailwindConfigDirectives, ot as createDebug, u as getRuntimeClassSetSignature } from "./v3-engine-C6eJ0YzK.mjs";
|
|
2
|
+
import { n as getCompilerContext, t as shouldSkipJsTransform, v as createTailwindRuntimeReadyPromise, y as ensureRuntimeClassSet } from "./precheck-CRI90iL1.mjs";
|
|
3
|
+
import { c as hasConfiguredTailwindV4CssRoots, l as upsertTailwindV4CssSource } from "./tailwindcss-DTq3uYBK.mjs";
|
|
4
|
+
import { _ as createCssSourceTraceCacheSignature, a as createTailwindV3DefaultExtractor, b as processCachedTask, g as annotateCssSourceTrace, n as emitHmrTiming, o as createBundleRuntimeClassSetManager, r as createSourceCandidateCollector, s as generateCssByGenerator, v as createCssTokenSourceMap } from "./hmr-timing-DQIP_8qP.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
@@ -259,7 +259,7 @@ function createPlugins(options = {}) {
|
|
|
259
259
|
type
|
|
260
260
|
});
|
|
261
261
|
pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
|
|
262
|
-
if (changed
|
|
262
|
+
if (changed) invalidateGulpSourceCandidates();
|
|
263
263
|
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
264
264
|
if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
|
|
265
265
|
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
|
|
@@ -332,12 +332,13 @@ function createPlugins(options = {}) {
|
|
|
332
332
|
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
333
333
|
return cachedGulpSourceCandidateGetter;
|
|
334
334
|
}
|
|
335
|
-
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature) {
|
|
335
|
+
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature) {
|
|
336
336
|
return cache.computeHash([
|
|
337
337
|
rawSource,
|
|
338
338
|
getRuntimeClassSetSignature(runtimeState.twPatcher),
|
|
339
339
|
[...nextRuntimeSet].sort().join("\n"),
|
|
340
|
-
sourceTraceSignature ?? "css-source-trace:0"
|
|
340
|
+
sourceTraceSignature ?? "css-source-trace:0",
|
|
341
|
+
sourceCandidateSignature ?? "gulp-source-candidates:0"
|
|
341
342
|
].join("\n\n"));
|
|
342
343
|
}
|
|
343
344
|
async function registerAutoCssSource(file, rawSource) {
|
|
@@ -378,12 +379,36 @@ function createPlugins(options = {}) {
|
|
|
378
379
|
function resolveGulpMatcherName(file) {
|
|
379
380
|
return (file.relative || path.basename(file.path)).replaceAll(path.sep, "/");
|
|
380
381
|
}
|
|
381
|
-
function resolveWxssFileHandlerOptions(file, options) {
|
|
382
|
+
function resolveWxssFileHandlerOptions(file, rawSource, options) {
|
|
382
383
|
const resolved = resolveWxssHandlerOptions(options);
|
|
383
|
-
|
|
384
|
+
const sourceFile = file.path ? path.resolve(file.path) : void 0;
|
|
385
|
+
const sourceOptions = sourceFile ? {
|
|
386
|
+
outputRoot: path.resolve(file.cwd ?? process.cwd()),
|
|
387
|
+
sourceCss: rawSource,
|
|
388
|
+
sourceFile
|
|
389
|
+
} : void 0;
|
|
390
|
+
if (resolved.isMainChunk !== void 0) return {
|
|
391
|
+
...resolved,
|
|
392
|
+
postcssOptions: {
|
|
393
|
+
...resolved.postcssOptions,
|
|
394
|
+
options: {
|
|
395
|
+
...resolved.postcssOptions?.options,
|
|
396
|
+
...sourceFile ? { from: sourceFile } : {}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
...sourceOptions ? { sourceOptions } : {}
|
|
400
|
+
};
|
|
384
401
|
return {
|
|
385
402
|
...resolved,
|
|
386
|
-
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
|
|
403
|
+
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
|
|
404
|
+
postcssOptions: {
|
|
405
|
+
...resolved.postcssOptions,
|
|
406
|
+
options: {
|
|
407
|
+
...resolved.postcssOptions?.options,
|
|
408
|
+
...sourceFile ? { from: sourceFile } : {}
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
...sourceOptions ? { sourceOptions } : {}
|
|
387
412
|
};
|
|
388
413
|
}
|
|
389
414
|
function resolveWxssUserHandlerOptions(options) {
|
|
@@ -422,14 +447,16 @@ function createPlugins(options = {}) {
|
|
|
422
447
|
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
423
448
|
const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
|
|
424
449
|
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || hasTailwindRootDirectives(rawSource);
|
|
425
|
-
|
|
450
|
+
let gulpSourceCandidateGetter;
|
|
451
|
+
if (shouldUseGenerator && runtimeState.twPatcher.majorVersion === 4) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
426
452
|
let nextRuntimeSet = await refreshRuntimeSet({
|
|
427
453
|
forceRefresh: cssSourceChanged,
|
|
428
454
|
forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
|
|
429
455
|
clearCache: cssSourceChanged
|
|
430
456
|
});
|
|
431
|
-
if (runtimeState.twPatcher.majorVersion === 3 &&
|
|
432
|
-
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
|
|
457
|
+
if (runtimeState.twPatcher.majorVersion === 3 && shouldUseGenerator) {
|
|
458
|
+
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged || isMainChunk);
|
|
459
|
+
gulpSourceCandidateGetter = cachedGulpSourceCandidateGetter;
|
|
433
460
|
if (sourceCandidates.size > 0) {
|
|
434
461
|
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
435
462
|
runtimeSet = nextRuntimeSet;
|
|
@@ -437,10 +464,11 @@ function createPlugins(options = {}) {
|
|
|
437
464
|
}
|
|
438
465
|
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
439
466
|
const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
467
|
+
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
440
468
|
await processCachedTask({
|
|
441
469
|
cache,
|
|
442
470
|
cacheKey: file.path,
|
|
443
|
-
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature),
|
|
471
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature),
|
|
444
472
|
applyResult(source) {
|
|
445
473
|
file.contents = Buffer.from(source);
|
|
446
474
|
},
|
|
@@ -449,7 +477,7 @@ function createPlugins(options = {}) {
|
|
|
449
477
|
},
|
|
450
478
|
async transform() {
|
|
451
479
|
await runtimeState.readyPromise;
|
|
452
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
480
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
453
481
|
const css = annotateCssSourceTrace((shouldUseGenerator ? await generateCssByGenerator({
|
|
454
482
|
opts,
|
|
455
483
|
runtimeState,
|
|
@@ -458,7 +486,7 @@ function createPlugins(options = {}) {
|
|
|
458
486
|
file: file.path,
|
|
459
487
|
cssHandlerOptions,
|
|
460
488
|
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
461
|
-
getSourceCandidatesForEntries:
|
|
489
|
+
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
462
490
|
styleHandler,
|
|
463
491
|
debug
|
|
464
492
|
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_precheck = require("./precheck-
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-2rrgylhn.js");
|
|
3
|
+
const require_precheck = require("./precheck-B0Z8yW7E.js");
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-DZEwT3C_.js");
|
|
5
|
+
const require_hmr_timing = require("./hmr-timing-BMftW7Us.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
node_fs = require_chunk.__toESM(node_fs);
|
|
8
8
|
let node_path = require("node:path");
|
|
@@ -264,7 +264,7 @@ function createPlugins(options = {}) {
|
|
|
264
264
|
type
|
|
265
265
|
});
|
|
266
266
|
pruneGulpRuntimeSourceCaches(runtimeSourceHashByFile, runtimeSourcesByFile);
|
|
267
|
-
if (changed
|
|
267
|
+
if (changed) invalidateGulpSourceCandidates();
|
|
268
268
|
if (!changed && runtimeSetInitialized) return runtimeSet;
|
|
269
269
|
if (runtimeState.twPatcher.majorVersion === 4 && !runtimeSetDirty) try {
|
|
270
270
|
runtimeSet = await bundleRuntimeClassSetManager.sync(runtimeState.twPatcher, createGulpRuntimeSnapshot(runtimeSourcesByFile, [filename]));
|
|
@@ -337,12 +337,13 @@ function createPlugins(options = {}) {
|
|
|
337
337
|
cachedGulpSourceCandidateSourceGetter = (entries) => collector.sourcesForEntries(entries);
|
|
338
338
|
return cachedGulpSourceCandidateGetter;
|
|
339
339
|
}
|
|
340
|
-
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature) {
|
|
340
|
+
function createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature) {
|
|
341
341
|
return cache.computeHash([
|
|
342
342
|
rawSource,
|
|
343
343
|
require_v3_engine.getRuntimeClassSetSignature(runtimeState.twPatcher),
|
|
344
344
|
[...nextRuntimeSet].sort().join("\n"),
|
|
345
|
-
sourceTraceSignature ?? "css-source-trace:0"
|
|
345
|
+
sourceTraceSignature ?? "css-source-trace:0",
|
|
346
|
+
sourceCandidateSignature ?? "gulp-source-candidates:0"
|
|
346
347
|
].join("\n\n"));
|
|
347
348
|
}
|
|
348
349
|
async function registerAutoCssSource(file, rawSource) {
|
|
@@ -383,12 +384,36 @@ function createPlugins(options = {}) {
|
|
|
383
384
|
function resolveGulpMatcherName(file) {
|
|
384
385
|
return (file.relative || node_path.default.basename(file.path)).replaceAll(node_path.default.sep, "/");
|
|
385
386
|
}
|
|
386
|
-
function resolveWxssFileHandlerOptions(file, options) {
|
|
387
|
+
function resolveWxssFileHandlerOptions(file, rawSource, options) {
|
|
387
388
|
const resolved = resolveWxssHandlerOptions(options);
|
|
388
|
-
|
|
389
|
+
const sourceFile = file.path ? node_path.default.resolve(file.path) : void 0;
|
|
390
|
+
const sourceOptions = sourceFile ? {
|
|
391
|
+
outputRoot: node_path.default.resolve(file.cwd ?? node_process.default.cwd()),
|
|
392
|
+
sourceCss: rawSource,
|
|
393
|
+
sourceFile
|
|
394
|
+
} : void 0;
|
|
395
|
+
if (resolved.isMainChunk !== void 0) return {
|
|
396
|
+
...resolved,
|
|
397
|
+
postcssOptions: {
|
|
398
|
+
...resolved.postcssOptions,
|
|
399
|
+
options: {
|
|
400
|
+
...resolved.postcssOptions?.options,
|
|
401
|
+
...sourceFile ? { from: sourceFile } : {}
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
...sourceOptions ? { sourceOptions } : {}
|
|
405
|
+
};
|
|
389
406
|
return {
|
|
390
407
|
...resolved,
|
|
391
|
-
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType)
|
|
408
|
+
isMainChunk: opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType),
|
|
409
|
+
postcssOptions: {
|
|
410
|
+
...resolved.postcssOptions,
|
|
411
|
+
options: {
|
|
412
|
+
...resolved.postcssOptions?.options,
|
|
413
|
+
...sourceFile ? { from: sourceFile } : {}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
...sourceOptions ? { sourceOptions } : {}
|
|
392
417
|
};
|
|
393
418
|
}
|
|
394
419
|
function resolveWxssUserHandlerOptions(options) {
|
|
@@ -427,14 +452,16 @@ function createPlugins(options = {}) {
|
|
|
427
452
|
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
428
453
|
const isMainChunk = opts.mainCssChunkMatcher(resolveGulpMatcherName(file), opts.appType);
|
|
429
454
|
const shouldUseGenerator = runtimeState.twPatcher.majorVersion !== 3 || require_v3_engine.hasTailwindRootDirectives(rawSource);
|
|
430
|
-
|
|
455
|
+
let gulpSourceCandidateGetter;
|
|
456
|
+
if (shouldUseGenerator && runtimeState.twPatcher.majorVersion === 4) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
431
457
|
let nextRuntimeSet = await refreshRuntimeSet({
|
|
432
458
|
forceRefresh: cssSourceChanged,
|
|
433
459
|
forceCollect: cssSourceChanged || runtimeState.twPatcher.majorVersion !== 4 && isMainChunk,
|
|
434
460
|
clearCache: cssSourceChanged
|
|
435
461
|
});
|
|
436
|
-
if (runtimeState.twPatcher.majorVersion === 3 &&
|
|
437
|
-
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged);
|
|
462
|
+
if (runtimeState.twPatcher.majorVersion === 3 && shouldUseGenerator) {
|
|
463
|
+
const sourceCandidates = await refreshGulpSourceCandidates(cssSourceChanged || isMainChunk);
|
|
464
|
+
gulpSourceCandidateGetter = cachedGulpSourceCandidateGetter;
|
|
438
465
|
if (sourceCandidates.size > 0) {
|
|
439
466
|
nextRuntimeSet = new Set([...nextRuntimeSet, ...sourceCandidates]);
|
|
440
467
|
runtimeSet = nextRuntimeSet;
|
|
@@ -442,10 +469,11 @@ function createPlugins(options = {}) {
|
|
|
442
469
|
}
|
|
443
470
|
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? require_hmr_timing.createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
444
471
|
const sourceTraceSignature = require_hmr_timing.createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
472
|
+
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
445
473
|
await require_hmr_timing.processCachedTask({
|
|
446
474
|
cache,
|
|
447
475
|
cacheKey: file.path,
|
|
448
|
-
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature),
|
|
476
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature),
|
|
449
477
|
applyResult(source) {
|
|
450
478
|
file.contents = node_buffer.Buffer.from(source);
|
|
451
479
|
},
|
|
@@ -454,7 +482,7 @@ function createPlugins(options = {}) {
|
|
|
454
482
|
},
|
|
455
483
|
async transform() {
|
|
456
484
|
await runtimeState.readyPromise;
|
|
457
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, options);
|
|
485
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
458
486
|
const css = require_hmr_timing.annotateCssSourceTrace((shouldUseGenerator ? await require_hmr_timing.generateCssByGenerator({
|
|
459
487
|
opts,
|
|
460
488
|
runtimeState,
|
|
@@ -463,7 +491,7 @@ function createPlugins(options = {}) {
|
|
|
463
491
|
file: file.path,
|
|
464
492
|
cssHandlerOptions,
|
|
465
493
|
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
466
|
-
getSourceCandidatesForEntries:
|
|
494
|
+
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
467
495
|
styleHandler,
|
|
468
496
|
debug
|
|
469
497
|
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
package/dist/gulp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_gulp = require("./gulp-
|
|
2
|
+
const require_gulp = require("./gulp-XT8Jc7lH.js");
|
|
3
3
|
exports.WeappTailwindcss = require_gulp.createPlugins;
|
|
4
4
|
exports.createPlugins = require_gulp.createPlugins;
|
|
5
5
|
exports.weappTailwindcss = require_gulp.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPlugins } from "./gulp-
|
|
1
|
+
import { t as createPlugins } from "./gulp-DfOQERcV.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|