weapp-tailwindcss 5.0.0-next.5 → 5.0.0-next.8
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/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 +4 -0
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +12 -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 +16 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +10 -23
- package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -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 +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/rewrite-css-imports.d.ts +1 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
- package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +2 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -0
- package/dist/cache-BVAiJV3J.js +502 -0
- package/dist/cache-CHs4DXui.mjs +434 -0
- package/dist/cli/helpers.d.ts +1 -2
- package/dist/cli/mount-options.d.ts +2 -2
- package/dist/cli/types.d.ts +0 -2
- package/dist/cli.js +107 -603
- package/dist/cli.mjs +118 -613
- package/dist/constants.d.ts +0 -1
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +13 -20
- package/dist/core.mjs +8 -14
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +2 -2
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.d.ts +15 -1
- package/dist/defaults.js +28 -7
- package/dist/defaults.mjs +25 -8
- package/dist/{generator-9UEp8OoQ.js → generator-DKkhJbOg.js} +24 -7
- package/dist/{generator-Dpp-5s8z.mjs → generator-UBmfduYg.mjs} +20 -3
- package/dist/{generator-css-MyjZhF0z.mjs → generator-css-BIapP56i.mjs} +691 -606
- package/dist/{generator-css-CGueCYbX.js → generator-css-Mksw8PgB.js} +703 -606
- package/dist/generator.js +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/gulp.js +33 -21
- package/dist/gulp.mjs +29 -17
- package/dist/index.js +5 -5
- package/dist/index.mjs +4 -4
- package/dist/logger-BRy6XPQ2.js +1 -0
- package/dist/logger-Bub1jggA.mjs +2 -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-QIXwT40c.js +298 -0
- package/dist/postcss-w48mGIhe.mjs +288 -0
- package/dist/postcss.js +3 -285
- package/dist/postcss.mjs +1 -278
- package/dist/{recorder-D4BKt75Q.js → precheck-B32p-gLI.js} +139 -274
- package/dist/{recorder-BIW3Kuke.mjs → precheck-B4RH6ZNN.mjs} +105 -239
- package/dist/presets.js +6 -4
- package/dist/presets.mjs +4 -2
- package/dist/runtime-patch-CwN5ya72.mjs +71 -0
- package/dist/runtime-patch-D6mBo_KB.js +85 -0
- package/dist/tailwindcss/runtime-patch.d.ts +5 -0
- package/dist/tailwindcss/runtime.d.ts +2 -3
- package/dist/tailwindcss/targets.d.ts +1 -5
- package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/{logger-D9clu_3f.js → tailwindcss-Bu-RWIHx.js} +70 -413
- package/dist/{logger-1gx9UllH.mjs → tailwindcss-C5IgPlQ0.mjs} +56 -382
- package/dist/types/index.d.ts +1 -6
- package/dist/uni-app-x/vite.d.ts +1 -1
- package/dist/{vite-fDM-UQpR.mjs → vite-BwgRVgxH.mjs} +677 -525
- package/dist/{vite-BkMGwDeH.js → vite-DyZuiyap.js} +704 -552
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +10 -1
- package/dist/{webpack-CICGEKT9.js → webpack-CNV2dx3Q.js} +72 -37
- package/dist/{webpack-D2Wdk28V.mjs → webpack-CT6EEENx.mjs} +58 -23
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +6 -9
- package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
- 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/js/syntax.d.ts +0 -10
- package/dist/patcher-options-DnqazL9E.js +0 -34
- package/dist/patcher-options-GuOwX0-k.mjs +0 -17
- 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/version-CWBxRFPB.js +0 -56
- package/dist/version-WNz3MwRv.mjs +0 -49
- /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
- /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
- /package/dist/{run-tasks-Cq5A5nVD.js → run-tasks-B50A3pxt.js} +0 -0
- /package/dist/{run-tasks-DUVrDJGl.mjs → run-tasks-DdNi-hkk.mjs} +0 -0
- /package/dist/{utils-DmC9_In3.js → utils-BiShvil9.js} +0 -0
- /package/dist/{utils-7DUGTFED.mjs → utils-Btw1iOVV.mjs} +0 -0
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
require("./
|
|
2
|
+
const require_cache = require("./cache-BVAiJV3J.js");
|
|
3
|
+
const require_runtime_patch = require("./runtime-patch-D6mBo_KB.js");
|
|
4
|
+
require("./utils-BiShvil9.js");
|
|
3
5
|
const require_defaults = require("./defaults.js");
|
|
4
|
-
const
|
|
5
|
-
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-Bu-RWIHx.js");
|
|
6
7
|
let node_path = require("node:path");
|
|
7
8
|
node_path = require_chunk.__toESM(node_path);
|
|
8
9
|
let node_process = require("node:process");
|
|
9
10
|
node_process = require_chunk.__toESM(node_process);
|
|
11
|
+
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
12
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
10
13
|
let node_buffer = require("node:buffer");
|
|
11
|
-
let node_fs = require("node:fs");
|
|
12
14
|
let node_fs_promises = require("node:fs/promises");
|
|
13
|
-
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
14
15
|
let lru_cache = require("lru-cache");
|
|
15
16
|
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
16
17
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
17
|
-
let debug = require("debug");
|
|
18
|
-
debug = require_chunk.__toESM(debug);
|
|
19
18
|
let _babel_traverse = require("@babel/traverse");
|
|
20
19
|
_babel_traverse = require_chunk.__toESM(_babel_traverse);
|
|
21
20
|
let _babel_parser = require("@babel/parser");
|
|
@@ -110,33 +109,13 @@ function initializeCache(cacheConfig) {
|
|
|
110
109
|
return cacheConfig;
|
|
111
110
|
}
|
|
112
111
|
//#endregion
|
|
113
|
-
//#region src/debug/index.ts
|
|
114
|
-
const _debug = (0, debug.default)("weapp-tw");
|
|
115
|
-
function createDebug(prefix) {
|
|
116
|
-
const debug$3 = ((formatter, ...args) => {
|
|
117
|
-
return _debug((prefix ?? "") + formatter, ...args);
|
|
118
|
-
});
|
|
119
|
-
Object.defineProperty(debug$3, "enabled", {
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: false,
|
|
122
|
-
get() {
|
|
123
|
-
return _debug.enabled;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return debug$3;
|
|
127
|
-
}
|
|
128
|
-
//#endregion
|
|
129
112
|
//#region src/tailwindcss/runtime.ts
|
|
130
|
-
const debug$
|
|
113
|
+
const debug$1 = require_runtime_patch.createDebug("[tailwindcss:runtime] ");
|
|
131
114
|
const refreshTailwindcssPatcherSymbol = Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
|
|
132
|
-
function
|
|
133
|
-
return Promise.resolve(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
await onPatched();
|
|
137
|
-
} catch (error) {
|
|
138
|
-
debug$2("failed to persist patch target after patch(): %O", error);
|
|
139
|
-
}
|
|
115
|
+
function createTailwindRuntimeReadyPromise(twPatcher) {
|
|
116
|
+
return Promise.resolve().then(async () => {
|
|
117
|
+
await require_runtime_patch.ensureTailwindcssRuntimePatch(twPatcher);
|
|
118
|
+
require_cache.invalidateRuntimeClassSet(twPatcher);
|
|
140
119
|
});
|
|
141
120
|
}
|
|
142
121
|
const runtimeClassSetStateCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -153,16 +132,16 @@ async function refreshTailwindRuntimeState(state, forceOrOptions) {
|
|
|
153
132
|
const force = normalizedOptions.force;
|
|
154
133
|
const clearCache = normalizedOptions.clearCache === true;
|
|
155
134
|
if (!force) return false;
|
|
156
|
-
debug$
|
|
157
|
-
await state.
|
|
135
|
+
debug$1("refresh runtime state start, clearCache=%s major=%s", clearCache, state.twPatcher.majorVersion ?? "unknown");
|
|
136
|
+
await state.readyPromise;
|
|
158
137
|
let refreshed = false;
|
|
159
138
|
if (typeof state.refreshTailwindcssPatcher === "function") {
|
|
160
139
|
const next = await state.refreshTailwindcssPatcher({ clearCache });
|
|
161
140
|
if (next !== state.twPatcher) state.twPatcher = next;
|
|
162
141
|
refreshed = true;
|
|
163
142
|
}
|
|
164
|
-
if (refreshed) state.
|
|
165
|
-
debug$
|
|
143
|
+
if (refreshed) state.readyPromise = createTailwindRuntimeReadyPromise(state.twPatcher);
|
|
144
|
+
debug$1("refresh runtime state end, refreshed=%s major=%s", refreshed, state.twPatcher.majorVersion ?? "unknown");
|
|
166
145
|
return refreshed;
|
|
167
146
|
}
|
|
168
147
|
async function ensureRuntimeClassSet(state, options = {}) {
|
|
@@ -174,9 +153,9 @@ async function ensureRuntimeClassSet(state, options = {}) {
|
|
|
174
153
|
force: true,
|
|
175
154
|
clearCache
|
|
176
155
|
});
|
|
177
|
-
await state.
|
|
156
|
+
await state.readyPromise;
|
|
178
157
|
const entry = getRuntimeClassSetStateEntry(state);
|
|
179
|
-
const signature =
|
|
158
|
+
const signature = require_cache.getRuntimeClassSetSignature(state.twPatcher);
|
|
180
159
|
const signatureChanged = entry.signature !== signature;
|
|
181
160
|
const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
|
|
182
161
|
if (!shouldForceCollect) {
|
|
@@ -194,7 +173,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
|
|
|
194
173
|
force: true,
|
|
195
174
|
clearCache: true
|
|
196
175
|
});
|
|
197
|
-
await state.
|
|
176
|
+
await state.readyPromise;
|
|
198
177
|
return collectRuntimeClassSet(state.twPatcher, {
|
|
199
178
|
force: true,
|
|
200
179
|
skipRefresh: true,
|
|
@@ -205,7 +184,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
|
|
|
205
184
|
try {
|
|
206
185
|
const runtimeSet = await task;
|
|
207
186
|
entry.value = runtimeSet;
|
|
208
|
-
entry.signature =
|
|
187
|
+
entry.signature = require_cache.getRuntimeClassSetSignature(state.twPatcher);
|
|
209
188
|
return runtimeSet;
|
|
210
189
|
} finally {
|
|
211
190
|
if (entry.promise === task) entry.promise = void 0;
|
|
@@ -225,8 +204,8 @@ function tryGetRuntimeClassSetSync(twPatcher) {
|
|
|
225
204
|
if (set && set.size === 0) return;
|
|
226
205
|
return set;
|
|
227
206
|
} catch (error) {
|
|
228
|
-
if (twPatcher.majorVersion === 4) debug$
|
|
229
|
-
else debug$
|
|
207
|
+
if (twPatcher.majorVersion === 4) debug$1("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
|
|
208
|
+
else debug$1("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
|
|
230
209
|
return;
|
|
231
210
|
}
|
|
232
211
|
}
|
|
@@ -238,49 +217,50 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
|
238
217
|
const refreshed = await refresh({ clearCache: options.clearCache === true });
|
|
239
218
|
if (refreshed) activePatcher = refreshed;
|
|
240
219
|
} catch (error) {
|
|
241
|
-
debug$
|
|
220
|
+
debug$1("refreshTailwindcssPatcher failed, continuing with existing patcher: %O", error);
|
|
242
221
|
}
|
|
243
222
|
}
|
|
244
|
-
const entry =
|
|
245
|
-
const signature =
|
|
223
|
+
const entry = require_cache.getRuntimeClassSetCacheEntry(activePatcher);
|
|
224
|
+
const signature = require_cache.getRuntimeClassSetSignature(activePatcher);
|
|
246
225
|
if (!options.force) {
|
|
247
226
|
if (entry.value && entry.signature === signature) return entry.value;
|
|
248
227
|
if (entry.promise) return entry.promise;
|
|
249
228
|
} else entry.value = void 0;
|
|
250
229
|
const task = (async () => {
|
|
230
|
+
await require_runtime_patch.ensureTailwindcssRuntimePatch(activePatcher);
|
|
251
231
|
const preExtractSyncSet = options.force ? tryGetRuntimeClassSetSync(activePatcher) : void 0;
|
|
252
|
-
if (preExtractSyncSet) debug$
|
|
232
|
+
if (preExtractSyncSet) debug$1("runtime class set snapshot via getClassSetSync() before extract(), size=%d", preExtractSyncSet.size);
|
|
253
233
|
const preferExtract = options.force === true;
|
|
254
234
|
try {
|
|
255
235
|
const result = await activePatcher.extract({ write: false });
|
|
256
236
|
if (result?.classSet) {
|
|
257
237
|
if (result.classSet.size > 0) {
|
|
258
|
-
debug$
|
|
238
|
+
debug$1("runtime class set resolved via extract(), size=%d", result.classSet.size);
|
|
259
239
|
return result.classSet;
|
|
260
240
|
}
|
|
261
|
-
if (preferExtract) debug$
|
|
262
|
-
else debug$
|
|
241
|
+
if (preferExtract) debug$1("runtime class set from extract() is empty on force collect, fallback to sync/async class set");
|
|
242
|
+
else debug$1("runtime class set from extract() is empty, fallback to sync/async class set");
|
|
263
243
|
}
|
|
264
244
|
} catch (error) {
|
|
265
|
-
debug$
|
|
245
|
+
debug$1("extract() failed, fallback to getClassSet(): %O", error);
|
|
266
246
|
}
|
|
267
247
|
if (preExtractSyncSet) {
|
|
268
|
-
debug$
|
|
248
|
+
debug$1("runtime class set fallback to pre-extract sync snapshot, size=%d", preExtractSyncSet.size);
|
|
269
249
|
return preExtractSyncSet;
|
|
270
250
|
}
|
|
271
251
|
const syncSet = tryGetRuntimeClassSetSync(activePatcher);
|
|
272
252
|
if (syncSet) {
|
|
273
|
-
debug$
|
|
253
|
+
debug$1("runtime class set resolved via getClassSetSync(), size=%d", syncSet.size);
|
|
274
254
|
return syncSet;
|
|
275
255
|
}
|
|
276
256
|
try {
|
|
277
257
|
const fallbackSet = await Promise.resolve(activePatcher.getClassSet());
|
|
278
258
|
if (fallbackSet) {
|
|
279
|
-
debug$
|
|
259
|
+
debug$1("runtime class set resolved via getClassSet(), size=%d", fallbackSet.size);
|
|
280
260
|
return fallbackSet;
|
|
281
261
|
}
|
|
282
262
|
} catch (error) {
|
|
283
|
-
debug$
|
|
263
|
+
debug$1("getClassSet() failed, returning empty set: %O", error);
|
|
284
264
|
}
|
|
285
265
|
return /* @__PURE__ */ new Set();
|
|
286
266
|
})();
|
|
@@ -327,197 +307,29 @@ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
|
|
|
327
307
|
return;
|
|
328
308
|
}
|
|
329
309
|
if (!markRuntimeLog("missing", baseDir, rootPath, version)) return;
|
|
330
|
-
_weapp_tailwindcss_logger.logger.warn(`${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")}
|
|
310
|
+
_weapp_tailwindcss_logger.logger.warn(`${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")} 未安装,已跳过版本检测与运行时初始化。`);
|
|
331
311
|
}
|
|
332
312
|
//#endregion
|
|
333
|
-
//#region src/tailwindcss/targets
|
|
334
|
-
const PATCH_INFO_FILENAME = "tailwindcss-target.json";
|
|
335
|
-
const PATCH_INFO_CACHE_RELATIVE_PATH = node_path.default.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
|
|
336
|
-
const PATCH_INFO_LEGACY_RELATIVE_PATH = node_path.default.join(".tw-patch", PATCH_INFO_FILENAME);
|
|
337
|
-
function toDisplayPath(value) {
|
|
338
|
-
return node_path.default.normalize(value).replace(/\\/g, "/");
|
|
339
|
-
}
|
|
313
|
+
//#region src/tailwindcss/targets.ts
|
|
340
314
|
function formatRelativeToBase(targetPath, baseDir) {
|
|
341
|
-
|
|
342
|
-
|
|
315
|
+
const normalized = node_path.default.normalize(targetPath);
|
|
316
|
+
if (!baseDir) return normalized.replace(/\\/g, "/");
|
|
317
|
+
const relative = node_path.default.relative(baseDir, normalized);
|
|
343
318
|
if (!relative || relative === ".") return ".";
|
|
344
|
-
if (relative.startsWith("..")) return
|
|
345
|
-
return
|
|
346
|
-
}
|
|
347
|
-
function resolveRecordLocation(baseDir) {
|
|
348
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
349
|
-
const packageRoot = require_logger.findNearestPackageRoot(normalizedBase) ?? normalizedBase;
|
|
350
|
-
const packageJsonPath = node_path.default.join(packageRoot, "package.json");
|
|
351
|
-
const hasPackageJson = (0, node_fs.existsSync)(packageJsonPath);
|
|
352
|
-
const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
|
|
353
|
-
const recordKey = (0, _weapp_tailwindcss_shared_node.md5)(node_path.default.normalize(recordKeySource));
|
|
354
|
-
const recordDir = node_path.default.join(packageRoot, "node_modules", ".cache", "weapp-tailwindcss", recordKey);
|
|
355
|
-
return {
|
|
356
|
-
normalizedBase,
|
|
357
|
-
packageRoot,
|
|
358
|
-
recordDir,
|
|
359
|
-
recordKey,
|
|
360
|
-
recordPath: node_path.default.join(recordDir, PATCH_INFO_FILENAME),
|
|
361
|
-
packageJsonPath: hasPackageJson ? packageJsonPath : void 0
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
function getRecordFileCandidates(baseDir) {
|
|
365
|
-
const { normalizedBase, packageRoot, recordPath } = resolveRecordLocation(baseDir);
|
|
366
|
-
return [...new Set([
|
|
367
|
-
recordPath,
|
|
368
|
-
node_path.default.join(packageRoot, PATCH_INFO_CACHE_RELATIVE_PATH),
|
|
369
|
-
node_path.default.join(normalizedBase, PATCH_INFO_CACHE_RELATIVE_PATH),
|
|
370
|
-
node_path.default.join(normalizedBase, PATCH_INFO_LEGACY_RELATIVE_PATH)
|
|
371
|
-
])];
|
|
319
|
+
if (relative.startsWith("..")) return normalized.replace(/\\/g, "/");
|
|
320
|
+
return node_path.default.join(".", relative).replace(/\\/g, "/");
|
|
372
321
|
}
|
|
373
|
-
|
|
374
|
-
//#region package.json
|
|
375
|
-
var version = "5.0.0-next.5";
|
|
376
|
-
//#endregion
|
|
377
|
-
//#region src/constants.ts
|
|
378
|
-
const pluginName = "weapp-tailwindcss";
|
|
379
|
-
const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
380
|
-
const WEAPP_TW_VERSION = version;
|
|
381
|
-
const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
382
|
-
"tailwind-merge": "@weapp-tailwindcss/merge",
|
|
383
|
-
"class-variance-authority": "@weapp-tailwindcss/cva",
|
|
384
|
-
"tailwind-variants": "@weapp-tailwindcss/variants"
|
|
385
|
-
};
|
|
386
|
-
//#endregion
|
|
387
|
-
//#region src/tailwindcss/targets/record-io.ts
|
|
388
|
-
const loggedInvalidPatchRecords = /* @__PURE__ */ new Set();
|
|
389
|
-
function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
|
|
390
|
-
const normalizedPath = node_path.default.normalize(recordPath);
|
|
391
|
-
if (loggedInvalidPatchRecords.has(normalizedPath)) return;
|
|
392
|
-
loggedInvalidPatchRecords.add(normalizedPath);
|
|
393
|
-
const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
|
|
394
|
-
const baseDisplay = formatRelativeToBase(node_path.default.normalize(baseDir), node_process.default.cwd());
|
|
395
|
-
const reasonMessage = reason ? `:${reason}` : "";
|
|
396
|
-
_weapp_tailwindcss_logger.logger.warn(`检测到损坏的 Tailwind CSS 目标记录 ${fileDisplay}${reasonMessage}。请在 ${baseDisplay} 重新执行 "weapp-tw patch --record-target" 或删除该文件后再运行。`);
|
|
397
|
-
}
|
|
398
|
-
function readPatchTargetRecord(baseDir) {
|
|
399
|
-
if (!baseDir) return;
|
|
400
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
401
|
-
for (const recordPath of getRecordFileCandidates(normalizedBase)) {
|
|
402
|
-
if (!(0, node_fs.existsSync)(recordPath)) continue;
|
|
403
|
-
try {
|
|
404
|
-
const content = (0, node_fs.readFileSync)(recordPath, "utf8");
|
|
405
|
-
const parsed = JSON.parse(content);
|
|
406
|
-
if (!parsed || typeof parsed.tailwindPackagePath !== "string") {
|
|
407
|
-
warnInvalidPatchTargetRecord(normalizedBase, recordPath, "缺少 tailwindPackagePath 字段");
|
|
408
|
-
continue;
|
|
409
|
-
}
|
|
410
|
-
return {
|
|
411
|
-
baseDir: normalizedBase,
|
|
412
|
-
path: recordPath,
|
|
413
|
-
record: parsed
|
|
414
|
-
};
|
|
415
|
-
} catch (error) {
|
|
416
|
-
warnInvalidPatchTargetRecord(normalizedBase, recordPath, error instanceof Error ? error.message : String(error));
|
|
417
|
-
continue;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
async function saveCliPatchTargetRecord(baseDir, patcher, options) {
|
|
422
|
-
if (!baseDir || !patcher?.packageInfo?.rootPath) return;
|
|
423
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
424
|
-
const location = resolveRecordLocation(normalizedBase);
|
|
425
|
-
const recordPath = options?.recordPath ? node_path.default.normalize(options.recordPath) : location.recordPath;
|
|
426
|
-
const record = {
|
|
427
|
-
tailwindPackagePath: node_path.default.normalize(patcher.packageInfo.rootPath),
|
|
428
|
-
packageVersion: patcher.packageInfo.version,
|
|
429
|
-
recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
430
|
-
source: options?.source ?? "cli",
|
|
431
|
-
tailwindcssBasedir: normalizedBase,
|
|
432
|
-
cwd: options?.cwd ? node_path.default.normalize(options.cwd) : normalizedBase,
|
|
433
|
-
patchVersion: WEAPP_TW_VERSION,
|
|
434
|
-
packageJsonPath: options?.packageJsonPath ?? location.packageJsonPath,
|
|
435
|
-
recordKey: options?.recordKey ?? location.recordKey
|
|
436
|
-
};
|
|
437
|
-
try {
|
|
438
|
-
await (0, node_fs_promises.mkdir)(node_path.default.dirname(recordPath), { recursive: true });
|
|
439
|
-
await (0, node_fs_promises.writeFile)(recordPath, `${JSON.stringify(record, null, 2)}\n`, "utf8");
|
|
440
|
-
return recordPath;
|
|
441
|
-
} catch (error) {
|
|
442
|
-
const baseDisplay = formatRelativeToBase(normalizedBase, node_process.default.cwd());
|
|
443
|
-
_weapp_tailwindcss_logger.logger.warn("自动更新 Tailwind CSS 补丁记录失败,请在 %s 运行 \"weapp-tw patch --cwd %s\"。", baseDisplay, normalizedBase);
|
|
444
|
-
_weapp_tailwindcss_logger.logger.debug("failed to persist patch target record %s: %O", recordPath, error);
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/tailwindcss/targets/recorder.ts
|
|
450
|
-
function findPatchTargetRecord(baseDir) {
|
|
451
|
-
const visited = /* @__PURE__ */ new Set();
|
|
452
|
-
const fallback = baseDir ?? node_process.default.cwd();
|
|
453
|
-
let current = node_path.default.resolve(fallback);
|
|
454
|
-
while (!visited.has(current)) {
|
|
455
|
-
const record = readPatchTargetRecord(current);
|
|
456
|
-
if (record) return record;
|
|
457
|
-
const parent = node_path.default.dirname(current);
|
|
458
|
-
if (parent === current) break;
|
|
459
|
-
visited.add(current);
|
|
460
|
-
current = parent;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
function createPatchTargetRecorder(baseDir, patcher, options) {
|
|
464
|
-
if (!baseDir || !patcher?.packageInfo?.rootPath || options?.recordTarget === false) return;
|
|
465
|
-
const normalizedBase = node_path.default.normalize(baseDir);
|
|
466
|
-
const recorded = findPatchTargetRecord(normalizedBase);
|
|
467
|
-
const location = resolveRecordLocation(normalizedBase);
|
|
468
|
-
const expectedPath = node_path.default.normalize(patcher.packageInfo.rootPath);
|
|
469
|
-
let reason;
|
|
470
|
-
if (!recorded) reason = "missing";
|
|
471
|
-
else if (node_path.default.normalize(recorded.record.tailwindPackagePath) !== expectedPath) reason = "mismatch";
|
|
472
|
-
else if (node_path.default.normalize(recorded.path) !== node_path.default.normalize(location.recordPath) || !recorded.record.recordKey || recorded.record.recordKey !== location.recordKey) reason = "migrate";
|
|
473
|
-
else if (!recorded.record.patchVersion || recorded.record.patchVersion !== WEAPP_TW_VERSION) reason = "stale";
|
|
474
|
-
else if (options?.cwd && recorded.record.cwd && node_path.default.normalize(recorded.record.cwd) !== node_path.default.normalize(options.cwd)) reason = "metadata";
|
|
475
|
-
else if (!recorded.record.cwd && options?.cwd) reason = "metadata";
|
|
476
|
-
if (!(options?.alwaysRecord || !recorded || Boolean(reason))) return;
|
|
477
|
-
let message;
|
|
478
|
-
switch (reason) {
|
|
479
|
-
case "mismatch":
|
|
480
|
-
message = "检测到 Tailwind CSS 目标记录与当前解析结果不一致,正在自动重新 patch 并刷新缓存。";
|
|
481
|
-
break;
|
|
482
|
-
case "migrate":
|
|
483
|
-
case "stale":
|
|
484
|
-
message = "正在刷新当前子包的 Tailwind CSS 补丁记录,确保缓存隔离。";
|
|
485
|
-
break;
|
|
486
|
-
case "missing":
|
|
487
|
-
message = "未找到当前子包的 Tailwind CSS 目标记录,正在生成。";
|
|
488
|
-
break;
|
|
489
|
-
default: break;
|
|
490
|
-
}
|
|
491
|
-
const onPatched = async () => saveCliPatchTargetRecord(normalizedBase, patcher, {
|
|
492
|
-
cwd: options?.cwd ?? normalizedBase,
|
|
493
|
-
source: options?.source ?? "cli",
|
|
494
|
-
recordPath: location.recordPath,
|
|
495
|
-
recordKey: location.recordKey,
|
|
496
|
-
packageJsonPath: location.packageJsonPath
|
|
497
|
-
});
|
|
498
|
-
return {
|
|
499
|
-
recordPath: location.recordPath,
|
|
500
|
-
message,
|
|
501
|
-
reason,
|
|
502
|
-
onPatched
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
//#endregion
|
|
506
|
-
//#region src/tailwindcss/targets.ts
|
|
507
|
-
function logTailwindcssTarget(kind, patcher, baseDir) {
|
|
322
|
+
function logTailwindcssTarget(patcher, baseDir) {
|
|
508
323
|
const packageInfo = patcher?.packageInfo;
|
|
509
|
-
const label =
|
|
324
|
+
const label = "Weapp-tailwindcss";
|
|
510
325
|
if (!packageInfo?.rootPath) {
|
|
511
326
|
_weapp_tailwindcss_logger.logger.warn("%s 未找到 Tailwind CSS 依赖,请检查在 %s 是否已安装 tailwindcss", label, baseDir ?? node_process.default.cwd());
|
|
512
327
|
return;
|
|
513
328
|
}
|
|
514
329
|
const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
|
|
515
330
|
const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
_weapp_tailwindcss_logger.logger.info("%s 绑定 Tailwind CSS -> %s%s", label, displayPath, version);
|
|
331
|
+
logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
|
|
332
|
+
_weapp_tailwindcss_logger.logger.debug("%s 解析 Tailwind CSS -> %s%s", label, displayPath, version);
|
|
521
333
|
}
|
|
522
334
|
//#endregion
|
|
523
335
|
//#region src/context/compiler-context-cache.ts
|
|
@@ -722,6 +534,15 @@ function toCustomAttributesEntities(customAttributes) {
|
|
|
722
534
|
return Object.entries(customAttributes);
|
|
723
535
|
}
|
|
724
536
|
//#endregion
|
|
537
|
+
//#region src/constants.ts
|
|
538
|
+
const pluginName = "weapp-tailwindcss";
|
|
539
|
+
const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
540
|
+
const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
541
|
+
"tailwind-merge": "@weapp-tailwindcss/merge",
|
|
542
|
+
"class-variance-authority": "@weapp-tailwindcss/cva",
|
|
543
|
+
"tailwind-variants": "@weapp-tailwindcss/variants"
|
|
544
|
+
};
|
|
545
|
+
//#endregion
|
|
725
546
|
//#region src/babel/index.ts
|
|
726
547
|
function _interopDefaultCompat(e) {
|
|
727
548
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
@@ -1012,7 +833,7 @@ function isClassContextLiteralPath(path) {
|
|
|
1012
833
|
}
|
|
1013
834
|
//#endregion
|
|
1014
835
|
//#region src/js/handlers.ts
|
|
1015
|
-
const debug
|
|
836
|
+
const debug = require_runtime_patch.createDebug("[js:handlers] ");
|
|
1016
837
|
const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
|
|
1017
838
|
const defaultReplacementCache = /* @__PURE__ */ new Map();
|
|
1018
839
|
const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
|
|
@@ -1113,7 +934,7 @@ function replaceHandleValue(path, options) {
|
|
|
1113
934
|
const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
|
|
1114
935
|
const candidates = (0, _weapp_tailwindcss_shared_extractors.splitCode)(literal, allowDoubleQuotes);
|
|
1115
936
|
if (candidates.length === 0) return;
|
|
1116
|
-
const debugEnabled = debug
|
|
937
|
+
const debugEnabled = debug.enabled;
|
|
1117
938
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path);
|
|
1118
939
|
let transformed = literal;
|
|
1119
940
|
let mutated = false;
|
|
@@ -1149,7 +970,7 @@ function replaceHandleValue(path, options) {
|
|
|
1149
970
|
}
|
|
1150
971
|
const node = path.node;
|
|
1151
972
|
if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") return;
|
|
1152
|
-
if (debugEnabled) debug
|
|
973
|
+
if (debugEnabled) debug("runtimeSet size=%d fallbackTriggered=%s candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, fallbackDecisionCount > 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
|
|
1153
974
|
const start = node.start + offset;
|
|
1154
975
|
const end = node.end - offset;
|
|
1155
976
|
if (start >= end || transformed === original) return;
|
|
@@ -1353,6 +1174,44 @@ function walkEvalExpression(path, options, updater, handler) {
|
|
|
1353
1174
|
}
|
|
1354
1175
|
}
|
|
1355
1176
|
//#endregion
|
|
1177
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
|
|
1178
|
+
function _typeof(o) {
|
|
1179
|
+
"@babel/helpers - typeof";
|
|
1180
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
1181
|
+
return typeof o;
|
|
1182
|
+
} : function(o) {
|
|
1183
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1184
|
+
}, _typeof(o);
|
|
1185
|
+
}
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
|
|
1188
|
+
function toPrimitive(t, r) {
|
|
1189
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1190
|
+
var e = t[Symbol.toPrimitive];
|
|
1191
|
+
if (void 0 !== e) {
|
|
1192
|
+
var i = e.call(t, r || "default");
|
|
1193
|
+
if ("object" != _typeof(i)) return i;
|
|
1194
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1195
|
+
}
|
|
1196
|
+
return ("string" === r ? String : Number)(t);
|
|
1197
|
+
}
|
|
1198
|
+
//#endregion
|
|
1199
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
|
|
1200
|
+
function toPropertyKey(t) {
|
|
1201
|
+
var i = toPrimitive(t, "string");
|
|
1202
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1203
|
+
}
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
|
|
1206
|
+
function _defineProperty(e, r, t) {
|
|
1207
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1208
|
+
value: t,
|
|
1209
|
+
enumerable: !0,
|
|
1210
|
+
configurable: !0,
|
|
1211
|
+
writable: !0
|
|
1212
|
+
}) : e[r] = t, e;
|
|
1213
|
+
}
|
|
1214
|
+
//#endregion
|
|
1356
1215
|
//#region src/js/JsTokenUpdater.ts
|
|
1357
1216
|
/**
|
|
1358
1217
|
* Lightweight helper that batches updates to {@link MagicString}.
|
|
@@ -1361,6 +1220,7 @@ function walkEvalExpression(path, options, updater, handler) {
|
|
|
1361
1220
|
*/
|
|
1362
1221
|
var JsTokenUpdater = class {
|
|
1363
1222
|
constructor({ value } = {}) {
|
|
1223
|
+
_defineProperty(this, "tokens", void 0);
|
|
1364
1224
|
this.tokens = value ? [...value] : [];
|
|
1365
1225
|
}
|
|
1366
1226
|
addToken(token) {
|
|
@@ -1394,7 +1254,7 @@ var JsTokenUpdater = class {
|
|
|
1394
1254
|
var IgnoredExportsTracker = class {
|
|
1395
1255
|
constructor(options) {
|
|
1396
1256
|
this.options = options;
|
|
1397
|
-
this
|
|
1257
|
+
_defineProperty(this, "ignoredExportNames", /* @__PURE__ */ new Map());
|
|
1398
1258
|
}
|
|
1399
1259
|
addIgnoredExport(filename, exportName) {
|
|
1400
1260
|
if (!exportName) return;
|
|
@@ -1513,8 +1373,16 @@ var IgnoredExportsTracker = class {
|
|
|
1513
1373
|
//#region src/js/ModuleGraph.ts
|
|
1514
1374
|
var JsModuleGraph = class {
|
|
1515
1375
|
constructor(entry, graphOptions) {
|
|
1516
|
-
this
|
|
1517
|
-
this
|
|
1376
|
+
_defineProperty(this, "modules", /* @__PURE__ */ new Map());
|
|
1377
|
+
_defineProperty(this, "queue", []);
|
|
1378
|
+
_defineProperty(this, "resolve", void 0);
|
|
1379
|
+
_defineProperty(this, "load", void 0);
|
|
1380
|
+
_defineProperty(this, "filter", void 0);
|
|
1381
|
+
_defineProperty(this, "maxDepth", void 0);
|
|
1382
|
+
_defineProperty(this, "baseOptions", void 0);
|
|
1383
|
+
_defineProperty(this, "parserOptions", void 0);
|
|
1384
|
+
_defineProperty(this, "rootFilename", void 0);
|
|
1385
|
+
_defineProperty(this, "ignoredExports", void 0);
|
|
1518
1386
|
this.resolve = graphOptions.resolve;
|
|
1519
1387
|
this.load = graphOptions.load;
|
|
1520
1388
|
this.filter = graphOptions.filter;
|
|
@@ -1686,6 +1554,12 @@ const NEVER_MATCH_NAME = () => false;
|
|
|
1686
1554
|
*/
|
|
1687
1555
|
var NodePathWalker = class {
|
|
1688
1556
|
constructor({ ignoreCallExpressionIdentifiers, callback } = {}) {
|
|
1557
|
+
_defineProperty(this, "ignoreCallExpressionIdentifiers", void 0);
|
|
1558
|
+
_defineProperty(this, "callback", void 0);
|
|
1559
|
+
_defineProperty(this, "isIgnoredCallIdentifier", void 0);
|
|
1560
|
+
_defineProperty(this, "hasIgnoredCallIdentifiers", void 0);
|
|
1561
|
+
_defineProperty(this, "importsStore", void 0);
|
|
1562
|
+
_defineProperty(this, "visitedStore", void 0);
|
|
1689
1563
|
this.hasIgnoredCallIdentifiers = Boolean(ignoreCallExpressionIdentifiers && ignoreCallExpressionIdentifiers.length > 0);
|
|
1690
1564
|
this.ignoreCallExpressionIdentifiers = ignoreCallExpressionIdentifiers ?? EMPTY_IGNORE_CALL_EXPRESSION_IDENTIFIERS;
|
|
1691
1565
|
this.callback = callback ?? NOOP_STRING_PATH_CALLBACK;
|
|
@@ -2325,6 +2199,13 @@ function isAllWhitespace(value) {
|
|
|
2325
2199
|
//#region src/wxml/Tokenizer.ts
|
|
2326
2200
|
var Tokenizer = class {
|
|
2327
2201
|
constructor() {
|
|
2202
|
+
_defineProperty(this, "state", void 0);
|
|
2203
|
+
_defineProperty(this, "buffer", void 0);
|
|
2204
|
+
_defineProperty(this, "tokens", void 0);
|
|
2205
|
+
_defineProperty(this, "bufferStartIndex", void 0);
|
|
2206
|
+
_defineProperty(this, "expressionStartIndex", void 0);
|
|
2207
|
+
_defineProperty(this, "expressionBuffer", void 0);
|
|
2208
|
+
_defineProperty(this, "expressions", void 0);
|
|
2328
2209
|
this.reset();
|
|
2329
2210
|
}
|
|
2330
2211
|
processChar(char, index) {
|
|
@@ -2591,8 +2472,8 @@ function resolveRuntimePackageReplacements(option) {
|
|
|
2591
2472
|
}
|
|
2592
2473
|
function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
|
|
2593
2474
|
const { cssPreflight, cssPreflightRange, escapeMap, cssChildCombinatorReplaceValue, injectAdditionalCssVarScope, cssSelectorReplacement, rem2rpx, postcssOptions, cssRemoveProperty, cssRemoveHoverPseudoClass, cssPresetEnv, autoprefixer, uniAppX, px2rpx, unitsToPx, arbitraryValues, jsPreserveClass, jsArbitraryValueFallback, babelParserOptions, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
|
|
2594
|
-
const uniAppXEnabled =
|
|
2595
|
-
const resolvedUniAppXOptions =
|
|
2475
|
+
const uniAppXEnabled = require_tailwindcss.isUniAppXEnabled(uniAppX);
|
|
2476
|
+
const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(uniAppX);
|
|
2596
2477
|
const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
|
|
2597
2478
|
const styleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
2598
2479
|
cssPreflight,
|
|
@@ -2684,11 +2565,12 @@ function createInternalCompilerContext(opts) {
|
|
|
2684
2565
|
const ctx = (0, _weapp_tailwindcss_shared.defuOverrideArray)(opts, require_defaults.getDefaultOptions(), {});
|
|
2685
2566
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
2686
2567
|
applyLoggerLevel(ctx.logLevel);
|
|
2687
|
-
const twPatcher =
|
|
2688
|
-
logTailwindcssTarget(
|
|
2568
|
+
const twPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
|
|
2569
|
+
logTailwindcssTarget(twPatcher, ctx.tailwindcssBasedir);
|
|
2689
2570
|
logRuntimeTailwindcssVersion(ctx.tailwindcssBasedir, twPatcher.packageInfo?.rootPath, twPatcher.packageInfo?.version);
|
|
2690
|
-
|
|
2691
|
-
|
|
2571
|
+
if (opts?.__internalDeferMissingCssEntriesWarning !== true) require_tailwindcss.warnMissingCssEntries(ctx, twPatcher);
|
|
2572
|
+
ctx.cssPreflight = require_defaults.resolveDefaultCssPreflight(opts?.cssPreflight, twPatcher.majorVersion);
|
|
2573
|
+
const cssCalcOptions = require_tailwindcss.applyV4CssCalcDefaults(ctx.cssCalc, twPatcher);
|
|
2692
2574
|
ctx.cssCalc = cssCalcOptions;
|
|
2693
2575
|
const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, toCustomAttributesEntities(ctx.customAttributes), cssCalcOptions, twPatcher.majorVersion);
|
|
2694
2576
|
ctx.styleHandler = styleHandler;
|
|
@@ -2699,8 +2581,8 @@ function createInternalCompilerContext(opts) {
|
|
|
2699
2581
|
const refreshTailwindcssPatcher = async (options) => {
|
|
2700
2582
|
const previousPatcher = ctx.twPatcher;
|
|
2701
2583
|
if (options?.clearCache !== false) await clearTailwindcssPatcherCache(previousPatcher);
|
|
2702
|
-
|
|
2703
|
-
const nextPatcher =
|
|
2584
|
+
require_cache.invalidateRuntimeClassSet(previousPatcher);
|
|
2585
|
+
const nextPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
|
|
2704
2586
|
Object.assign(previousPatcher, nextPatcher);
|
|
2705
2587
|
ctx.twPatcher = previousPatcher;
|
|
2706
2588
|
return previousPatcher;
|
|
@@ -2713,9 +2595,9 @@ function createInternalCompilerContext(opts) {
|
|
|
2713
2595
|
return ctx;
|
|
2714
2596
|
}
|
|
2715
2597
|
/**
|
|
2716
|
-
*
|
|
2598
|
+
* 获取用户定义选项的内部表示,并初始化相关的处理程序和 Tailwind 运行时。
|
|
2717
2599
|
* @param opts - 用户定义的选项,可选。
|
|
2718
|
-
* @returns 返回一个包含内部用户定义选项的对象,包括样式、JS和模板处理程序,以及Tailwind CSS
|
|
2600
|
+
* @returns 返回一个包含内部用户定义选项的对象,包括样式、JS 和模板处理程序,以及 Tailwind CSS 运行时。
|
|
2719
2601
|
*/
|
|
2720
2602
|
function getCompilerContext(opts) {
|
|
2721
2603
|
return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
|
|
@@ -2744,29 +2626,18 @@ function shouldSkipJsTransform(rawSource, options) {
|
|
|
2744
2626
|
return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
|
|
2745
2627
|
}
|
|
2746
2628
|
//#endregion
|
|
2747
|
-
//#region src/tailwindcss/recorder.ts
|
|
2748
|
-
function setupPatchRecorder(patcher, baseDir, options) {
|
|
2749
|
-
const recorder = createPatchTargetRecorder(baseDir, patcher, options);
|
|
2750
|
-
if (recorder?.message && options?.logMessage !== false) {
|
|
2751
|
-
const prefix = options?.messagePrefix ? `${options.messagePrefix} ` : "";
|
|
2752
|
-
_weapp_tailwindcss_logger.logger.info("%s%s", prefix, recorder.message);
|
|
2753
|
-
}
|
|
2754
|
-
const onPatchCompleted = recorder?.onPatched ? async () => {
|
|
2755
|
-
await recorder.onPatched();
|
|
2756
|
-
} : void 0;
|
|
2757
|
-
return {
|
|
2758
|
-
recorder,
|
|
2759
|
-
patchPromise: patcher ? createTailwindPatchPromise(patcher, onPatchCompleted) : Promise.resolve(),
|
|
2760
|
-
onPatchCompleted
|
|
2761
|
-
};
|
|
2762
|
-
}
|
|
2763
|
-
//#endregion
|
|
2764
2629
|
Object.defineProperty(exports, "JsTokenUpdater", {
|
|
2765
2630
|
enumerable: true,
|
|
2766
2631
|
get: function() {
|
|
2767
2632
|
return JsTokenUpdater;
|
|
2768
2633
|
}
|
|
2769
2634
|
});
|
|
2635
|
+
Object.defineProperty(exports, "_defineProperty", {
|
|
2636
|
+
enumerable: true,
|
|
2637
|
+
get: function() {
|
|
2638
|
+
return _defineProperty;
|
|
2639
|
+
}
|
|
2640
|
+
});
|
|
2770
2641
|
Object.defineProperty(exports, "analyzeSource", {
|
|
2771
2642
|
enumerable: true,
|
|
2772
2643
|
get: function() {
|
|
@@ -2791,10 +2662,10 @@ Object.defineProperty(exports, "createAttributeMatcher", {
|
|
|
2791
2662
|
return createAttributeMatcher;
|
|
2792
2663
|
}
|
|
2793
2664
|
});
|
|
2794
|
-
Object.defineProperty(exports, "
|
|
2665
|
+
Object.defineProperty(exports, "createTailwindRuntimeReadyPromise", {
|
|
2795
2666
|
enumerable: true,
|
|
2796
2667
|
get: function() {
|
|
2797
|
-
return
|
|
2668
|
+
return createTailwindRuntimeReadyPromise;
|
|
2798
2669
|
}
|
|
2799
2670
|
});
|
|
2800
2671
|
Object.defineProperty(exports, "ensureRuntimeClassSet", {
|
|
@@ -2839,12 +2710,6 @@ Object.defineProperty(exports, "replaceWxml", {
|
|
|
2839
2710
|
return replaceWxml;
|
|
2840
2711
|
}
|
|
2841
2712
|
});
|
|
2842
|
-
Object.defineProperty(exports, "setupPatchRecorder", {
|
|
2843
|
-
enumerable: true,
|
|
2844
|
-
get: function() {
|
|
2845
|
-
return setupPatchRecorder;
|
|
2846
|
-
}
|
|
2847
|
-
});
|
|
2848
2713
|
Object.defineProperty(exports, "shouldSkipJsTransform", {
|
|
2849
2714
|
enumerable: true,
|
|
2850
2715
|
get: function() {
|