weapp-tailwindcss 4.7.4 → 4.7.5-alpha.1
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/{chunk-T5BSWDY2.js → chunk-24ADBRZN.js} +25 -15
- package/dist/{chunk-FPX2BD2A.mjs → chunk-42FXROX4.mjs} +23 -13
- package/dist/{chunk-QA6SPWSQ.js → chunk-E5LRICST.js} +253 -25
- package/dist/{chunk-SIZNRUIV.js → chunk-GGD75A34.js} +8 -0
- package/dist/{chunk-6IYMPBCH.mjs → chunk-PUFKPENL.mjs} +56 -14
- package/dist/{chunk-I6FBWASF.js → chunk-RLWIDWTA.js} +59 -17
- package/dist/{chunk-3ARXMTWC.mjs → chunk-SHMBWMDV.mjs} +8 -0
- package/dist/{chunk-HMTZ4JJN.js → chunk-SJV6DCNZ.js} +22 -15
- package/dist/{chunk-JII7EQ6K.mjs → chunk-TK5LOBHZ.mjs} +23 -16
- package/dist/{chunk-V35QS2PT.mjs → chunk-XEQBYGBX.mjs} +229 -1
- package/dist/cli.js +5 -5
- package/dist/cli.mjs +2 -2
- package/dist/core.js +29 -13
- package/dist/core.mjs +30 -14
- package/dist/gulp.js +4 -5
- package/dist/gulp.mjs +3 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/index.mjs +5 -6
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +1 -1
- package/dist/types.d.mts +11 -1
- package/dist/types.d.ts +11 -1
- package/dist/vite.js +4 -5
- package/dist/vite.mjs +3 -4
- package/dist/webpack.js +4 -5
- package/dist/webpack.mjs +3 -4
- package/dist/webpack4.js +26 -16
- package/dist/webpack4.mjs +24 -14
- package/package.json +1 -1
- package/dist/chunk-667CYXAH.mjs +0 -133
- package/dist/chunk-BUMQQPAO.js +0 -133
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-VSRDBMDB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createTailwindcssPatcherFromContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SHMBWMDV.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getDefaultOptions
|
|
9
9
|
} from "./chunk-KZJLIZIK.mjs";
|
|
@@ -12,6 +12,191 @@ import {
|
|
|
12
12
|
isMap
|
|
13
13
|
} from "./chunk-ZNKIYZRQ.mjs";
|
|
14
14
|
|
|
15
|
+
// src/tailwindcss/runtime.ts
|
|
16
|
+
import { statSync } from "fs";
|
|
17
|
+
|
|
18
|
+
// src/debug/index.ts
|
|
19
|
+
import _createDebug from "debug";
|
|
20
|
+
var _debug = _createDebug("weapp-tw");
|
|
21
|
+
function createDebug(prefix) {
|
|
22
|
+
function debug2(formatter, ...args) {
|
|
23
|
+
return _debug((prefix ?? "") + formatter, ...args);
|
|
24
|
+
}
|
|
25
|
+
return debug2;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/tailwindcss/runtime.ts
|
|
29
|
+
var debug = createDebug("[tailwindcss:runtime] ");
|
|
30
|
+
var refreshTailwindcssPatcherSymbol = Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
|
|
31
|
+
var runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
32
|
+
function getCacheEntry(twPatcher) {
|
|
33
|
+
let entry = runtimeClassSetCache.get(twPatcher);
|
|
34
|
+
if (!entry) {
|
|
35
|
+
entry = {};
|
|
36
|
+
runtimeClassSetCache.set(twPatcher, entry);
|
|
37
|
+
}
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
function getTailwindConfigSignature(twPatcher) {
|
|
41
|
+
const configPath = twPatcher.options?.tailwind?.config;
|
|
42
|
+
if (typeof configPath !== "string" || configPath.length === 0) {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const stats = statSync(configPath);
|
|
47
|
+
return `${configPath}:${stats.size}:${stats.mtimeMs}`;
|
|
48
|
+
} catch {
|
|
49
|
+
return `${configPath}:missing`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function invalidateRuntimeClassSet(twPatcher) {
|
|
53
|
+
if (!twPatcher) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
runtimeClassSetCache.delete(twPatcher);
|
|
57
|
+
}
|
|
58
|
+
function createTailwindPatchPromise(twPatcher) {
|
|
59
|
+
return Promise.resolve(twPatcher.patch()).then((result) => {
|
|
60
|
+
invalidateRuntimeClassSet(twPatcher);
|
|
61
|
+
return result;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function refreshTailwindRuntimeState(state, force) {
|
|
65
|
+
if (!force) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
await state.patchPromise;
|
|
69
|
+
let refreshed = false;
|
|
70
|
+
if (typeof state.refreshTailwindcssPatcher === "function") {
|
|
71
|
+
const next = await state.refreshTailwindcssPatcher({ clearCache: true });
|
|
72
|
+
if (next !== state.twPatcher) {
|
|
73
|
+
state.twPatcher = next;
|
|
74
|
+
}
|
|
75
|
+
refreshed = true;
|
|
76
|
+
}
|
|
77
|
+
if (refreshed) {
|
|
78
|
+
state.patchPromise = createTailwindPatchPromise(state.twPatcher);
|
|
79
|
+
}
|
|
80
|
+
return refreshed;
|
|
81
|
+
}
|
|
82
|
+
function shouldPreferSync(majorVersion) {
|
|
83
|
+
if (majorVersion == null) {
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
if (majorVersion === 3) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (majorVersion === 4) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function tryGetRuntimeClassSetSync(twPatcher) {
|
|
95
|
+
if (typeof twPatcher.getClassSetSync !== "function") {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
if (!shouldPreferSync(twPatcher.majorVersion)) {
|
|
99
|
+
return void 0;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
return twPatcher.getClassSetSync();
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (twPatcher.majorVersion === 4) {
|
|
105
|
+
debug("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
|
|
106
|
+
} else {
|
|
107
|
+
debug("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
|
|
108
|
+
}
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function mergeContentTokensIntoSet(twPatcher, target) {
|
|
113
|
+
if (typeof twPatcher.collectContentTokens !== "function") {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
const report = await twPatcher.collectContentTokens();
|
|
118
|
+
const entries = report?.entries;
|
|
119
|
+
if (!Array.isArray(entries)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const candidate = entry?.rawCandidate;
|
|
124
|
+
if (typeof candidate === "string" && candidate.length > 0) {
|
|
125
|
+
target.add(candidate);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
} catch (error) {
|
|
129
|
+
debug("collectContentTokens() failed, continuing without merged tokens: %O", error);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
133
|
+
let activePatcher = twPatcher;
|
|
134
|
+
if (options.force && !options.skipRefresh) {
|
|
135
|
+
const refresh = activePatcher[refreshTailwindcssPatcherSymbol];
|
|
136
|
+
if (typeof refresh === "function") {
|
|
137
|
+
try {
|
|
138
|
+
const refreshed = await refresh({ clearCache: true });
|
|
139
|
+
if (refreshed) {
|
|
140
|
+
activePatcher = refreshed;
|
|
141
|
+
}
|
|
142
|
+
} catch (error) {
|
|
143
|
+
debug("refreshTailwindcssPatcher failed, continuing with existing patcher: %O", error);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const entry = getCacheEntry(activePatcher);
|
|
148
|
+
const signature = getTailwindConfigSignature(activePatcher);
|
|
149
|
+
const shouldAugmentWithTokens = options.force || !entry.value;
|
|
150
|
+
if (!options.force) {
|
|
151
|
+
if (entry.value && entry.signature === signature) {
|
|
152
|
+
return entry.value;
|
|
153
|
+
}
|
|
154
|
+
if (entry.promise) {
|
|
155
|
+
return entry.promise;
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
entry.value = void 0;
|
|
159
|
+
}
|
|
160
|
+
const task = (async () => {
|
|
161
|
+
const syncSet = tryGetRuntimeClassSetSync(activePatcher);
|
|
162
|
+
if (syncSet) {
|
|
163
|
+
return syncSet;
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
const result = await activePatcher.extract({ write: false });
|
|
167
|
+
if (result?.classSet) {
|
|
168
|
+
return result.classSet;
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
debug("extract() failed, fallback to getClassSet(): %O", error);
|
|
172
|
+
}
|
|
173
|
+
try {
|
|
174
|
+
const fallbackSet = await Promise.resolve(activePatcher.getClassSet());
|
|
175
|
+
if (fallbackSet) {
|
|
176
|
+
return fallbackSet;
|
|
177
|
+
}
|
|
178
|
+
} catch (error) {
|
|
179
|
+
debug("getClassSet() failed, returning empty set: %O", error);
|
|
180
|
+
}
|
|
181
|
+
return /* @__PURE__ */ new Set();
|
|
182
|
+
})();
|
|
183
|
+
entry.promise = task;
|
|
184
|
+
entry.signature = signature;
|
|
185
|
+
try {
|
|
186
|
+
const resolved = await task;
|
|
187
|
+
if (shouldAugmentWithTokens) {
|
|
188
|
+
await mergeContentTokensIntoSet(activePatcher, resolved);
|
|
189
|
+
}
|
|
190
|
+
entry.value = resolved;
|
|
191
|
+
entry.promise = void 0;
|
|
192
|
+
entry.signature = signature;
|
|
193
|
+
return resolved;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
entry.promise = void 0;
|
|
196
|
+
throw error;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
15
200
|
// src/constants.ts
|
|
16
201
|
var pluginName = "weapp-tailwindcss-webpack-plugin";
|
|
17
202
|
var vitePluginName = "weapp-tailwindcss:adaptor";
|
|
@@ -23,6 +208,7 @@ var DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
|
23
208
|
};
|
|
24
209
|
|
|
25
210
|
// src/context/index.ts
|
|
211
|
+
import { rm } from "fs/promises";
|
|
26
212
|
import { logger as logger2, pc } from "@weapp-tailwindcss/logger";
|
|
27
213
|
|
|
28
214
|
// src/cache/index.ts
|
|
@@ -1915,6 +2101,28 @@ function ensureDefaultsIncluded(value) {
|
|
|
1915
2101
|
}
|
|
1916
2102
|
return value;
|
|
1917
2103
|
}
|
|
2104
|
+
async function clearTailwindcssPatcherCache(patcher) {
|
|
2105
|
+
if (!patcher) {
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
const cacheOptions = patcher.options?.cache;
|
|
2109
|
+
if (!cacheOptions || cacheOptions.enabled === false) {
|
|
2110
|
+
return;
|
|
2111
|
+
}
|
|
2112
|
+
const cachePath = cacheOptions.path ?? patcher.cacheStore?.options?.path;
|
|
2113
|
+
if (!cachePath) {
|
|
2114
|
+
return;
|
|
2115
|
+
}
|
|
2116
|
+
try {
|
|
2117
|
+
await rm(cachePath, { force: true });
|
|
2118
|
+
} catch (error) {
|
|
2119
|
+
const err = error;
|
|
2120
|
+
if (err?.code === "ENOENT") {
|
|
2121
|
+
return;
|
|
2122
|
+
}
|
|
2123
|
+
logger2.debug("failed to clear tailwindcss patcher cache: %s %O", cachePath, err);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
1918
2126
|
function getCompilerContext(opts) {
|
|
1919
2127
|
const ctx = defuOverrideArray(
|
|
1920
2128
|
opts,
|
|
@@ -1945,10 +2153,30 @@ function getCompilerContext(opts) {
|
|
|
1945
2153
|
ctx.templateHandler = templateHandler;
|
|
1946
2154
|
ctx.cache = initializeCache(ctx.cache);
|
|
1947
2155
|
ctx.twPatcher = twPatcher;
|
|
2156
|
+
const refreshTailwindcssPatcher = async (options) => {
|
|
2157
|
+
const previousPatcher = ctx.twPatcher;
|
|
2158
|
+
if (options?.clearCache !== false) {
|
|
2159
|
+
await clearTailwindcssPatcherCache(previousPatcher);
|
|
2160
|
+
}
|
|
2161
|
+
invalidateRuntimeClassSet(previousPatcher);
|
|
2162
|
+
const nextPatcher = createTailwindcssPatcherFromContext(ctx);
|
|
2163
|
+
Object.assign(previousPatcher, nextPatcher);
|
|
2164
|
+
ctx.twPatcher = previousPatcher;
|
|
2165
|
+
return previousPatcher;
|
|
2166
|
+
};
|
|
2167
|
+
ctx.refreshTailwindcssPatcher = refreshTailwindcssPatcher;
|
|
2168
|
+
Object.defineProperty(ctx.twPatcher, refreshTailwindcssPatcherSymbol, {
|
|
2169
|
+
value: refreshTailwindcssPatcher,
|
|
2170
|
+
configurable: true
|
|
2171
|
+
});
|
|
1948
2172
|
return ctx;
|
|
1949
2173
|
}
|
|
1950
2174
|
|
|
1951
2175
|
export {
|
|
2176
|
+
createDebug,
|
|
2177
|
+
createTailwindPatchPromise,
|
|
2178
|
+
refreshTailwindRuntimeState,
|
|
2179
|
+
collectRuntimeClassSet,
|
|
1952
2180
|
toCustomAttributesEntities,
|
|
1953
2181
|
pluginName,
|
|
1954
2182
|
vitePluginName,
|
package/dist/cli.js
CHANGED
|
@@ -4,9 +4,9 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkE5LRICSTjs = require('./chunk-E5LRICST.js');
|
|
8
8
|
require('./chunk-DWAEHRHN.js');
|
|
9
|
-
require('./chunk-
|
|
9
|
+
require('./chunk-GGD75A34.js');
|
|
10
10
|
require('./chunk-WXBFAARR.js');
|
|
11
11
|
|
|
12
12
|
|
|
@@ -122,7 +122,7 @@ function createCliContext(overrides, resolvedCwd) {
|
|
|
122
122
|
current
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
return
|
|
125
|
+
return _chunkE5LRICSTjs.getCompilerContext.call(void 0, userOptions);
|
|
126
126
|
}
|
|
127
127
|
function formatOutputPath(target, baseDir) {
|
|
128
128
|
const root = _nullishCoalesce(baseDir, () => ( _process2.default.cwd()));
|
|
@@ -287,9 +287,9 @@ function logTokenPreview(report, format, groupKey) {
|
|
|
287
287
|
|
|
288
288
|
// src/cli.ts
|
|
289
289
|
_process2.default.title = "node (weapp-tailwindcss)";
|
|
290
|
-
if (_semver2.default.lt(_process2.default.versions.node,
|
|
290
|
+
if (_semver2.default.lt(_process2.default.versions.node, _chunkE5LRICSTjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
291
291
|
_chunkOXASK55Qjs.logger.warn(
|
|
292
|
-
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${
|
|
292
|
+
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkE5LRICSTjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
293
293
|
);
|
|
294
294
|
}
|
|
295
295
|
var cli = _cac2.default.call(void 0, "weapp-tailwindcss");
|
package/dist/cli.mjs
CHANGED
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
WEAPP_TW_REQUIRED_NODE_VERSION,
|
|
6
6
|
getCompilerContext
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XEQBYGBX.mjs";
|
|
8
8
|
import "./chunk-VSRDBMDB.mjs";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
10
10
|
import "./chunk-KZJLIZIK.mjs";
|
|
11
11
|
import {
|
|
12
12
|
defuOverrideArray
|
package/dist/core.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
var
|
|
6
|
+
var _chunkE5LRICSTjs = require('./chunk-E5LRICST.js');
|
|
8
7
|
require('./chunk-DWAEHRHN.js');
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-GGD75A34.js');
|
|
10
9
|
require('./chunk-WXBFAARR.js');
|
|
11
10
|
require('./chunk-UW3WHSZ5.js');
|
|
12
11
|
require('./chunk-R7GWRQDJ.js');
|
|
@@ -14,27 +13,44 @@ require('./chunk-R7GWRQDJ.js');
|
|
|
14
13
|
// src/core.ts
|
|
15
14
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
16
15
|
function createContext(options = {}) {
|
|
17
|
-
const opts =
|
|
18
|
-
const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
|
|
16
|
+
const opts = _chunkE5LRICSTjs.getCompilerContext.call(void 0, options);
|
|
17
|
+
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
19
18
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
20
|
-
const
|
|
19
|
+
const runtimeState = {
|
|
20
|
+
twPatcher: initialTwPatcher,
|
|
21
|
+
patchPromise: _chunkE5LRICSTjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
22
|
+
refreshTailwindcssPatcher
|
|
23
|
+
};
|
|
24
|
+
async function refreshRuntimeState(force) {
|
|
25
|
+
await _chunkE5LRICSTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
26
|
+
}
|
|
21
27
|
async function transformWxss(rawCss, options2) {
|
|
22
|
-
await patchPromise;
|
|
28
|
+
await runtimeState.patchPromise;
|
|
23
29
|
const result = await styleHandler(rawCss, _shared.defuOverrideArray.call(void 0, options2, {
|
|
24
30
|
isMainChunk: true
|
|
25
31
|
}));
|
|
26
|
-
|
|
32
|
+
await refreshRuntimeState(true);
|
|
33
|
+
await runtimeState.patchPromise;
|
|
34
|
+
runtimeSet = await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
27
35
|
return result;
|
|
28
36
|
}
|
|
29
37
|
async function transformJs(rawJs, options2 = {}) {
|
|
30
|
-
await patchPromise;
|
|
31
|
-
|
|
38
|
+
await runtimeState.patchPromise;
|
|
39
|
+
if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
|
|
40
|
+
runtimeSet = options2.runtimeSet;
|
|
41
|
+
} else {
|
|
42
|
+
await refreshRuntimeState(true);
|
|
43
|
+
await runtimeState.patchPromise;
|
|
44
|
+
runtimeSet = await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
45
|
+
}
|
|
32
46
|
return await jsHandler(rawJs, runtimeSet, options2);
|
|
33
47
|
}
|
|
34
48
|
async function transformWxml(rawWxml, options2) {
|
|
35
|
-
await patchPromise;
|
|
36
|
-
if (!_optionalChain([options2, 'optionalAccess',
|
|
37
|
-
|
|
49
|
+
await runtimeState.patchPromise;
|
|
50
|
+
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
51
|
+
await refreshRuntimeState(true);
|
|
52
|
+
await runtimeState.patchPromise;
|
|
53
|
+
runtimeSet = await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
38
54
|
}
|
|
39
55
|
return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
|
|
40
56
|
runtimeSet
|
package/dist/core.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
collectRuntimeClassSet,
|
|
3
|
-
createTailwindPatchPromise
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./chunk-V35QS2PT.mjs";
|
|
3
|
+
createTailwindPatchPromise,
|
|
4
|
+
getCompilerContext,
|
|
5
|
+
refreshTailwindRuntimeState
|
|
6
|
+
} from "./chunk-XEQBYGBX.mjs";
|
|
8
7
|
import "./chunk-VSRDBMDB.mjs";
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
10
9
|
import "./chunk-KZJLIZIK.mjs";
|
|
11
10
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
12
11
|
import "./chunk-SCOGAO45.mjs";
|
|
@@ -15,26 +14,43 @@ import "./chunk-SCOGAO45.mjs";
|
|
|
15
14
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
16
15
|
function createContext(options = {}) {
|
|
17
16
|
const opts = getCompilerContext(options);
|
|
18
|
-
const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
|
|
17
|
+
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
19
18
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
20
|
-
const
|
|
19
|
+
const runtimeState = {
|
|
20
|
+
twPatcher: initialTwPatcher,
|
|
21
|
+
patchPromise: createTailwindPatchPromise(initialTwPatcher),
|
|
22
|
+
refreshTailwindcssPatcher
|
|
23
|
+
};
|
|
24
|
+
async function refreshRuntimeState(force) {
|
|
25
|
+
await refreshTailwindRuntimeState(runtimeState, force);
|
|
26
|
+
}
|
|
21
27
|
async function transformWxss(rawCss, options2) {
|
|
22
|
-
await patchPromise;
|
|
28
|
+
await runtimeState.patchPromise;
|
|
23
29
|
const result = await styleHandler(rawCss, defuOverrideArray(options2, {
|
|
24
30
|
isMainChunk: true
|
|
25
31
|
}));
|
|
26
|
-
|
|
32
|
+
await refreshRuntimeState(true);
|
|
33
|
+
await runtimeState.patchPromise;
|
|
34
|
+
runtimeSet = await collectRuntimeClassSet(runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
27
35
|
return result;
|
|
28
36
|
}
|
|
29
37
|
async function transformJs(rawJs, options2 = {}) {
|
|
30
|
-
await patchPromise;
|
|
31
|
-
|
|
38
|
+
await runtimeState.patchPromise;
|
|
39
|
+
if (options2?.runtimeSet) {
|
|
40
|
+
runtimeSet = options2.runtimeSet;
|
|
41
|
+
} else {
|
|
42
|
+
await refreshRuntimeState(true);
|
|
43
|
+
await runtimeState.patchPromise;
|
|
44
|
+
runtimeSet = await collectRuntimeClassSet(runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
45
|
+
}
|
|
32
46
|
return await jsHandler(rawJs, runtimeSet, options2);
|
|
33
47
|
}
|
|
34
48
|
async function transformWxml(rawWxml, options2) {
|
|
35
|
-
await patchPromise;
|
|
49
|
+
await runtimeState.patchPromise;
|
|
36
50
|
if (!options2?.runtimeSet && runtimeSet.size === 0) {
|
|
37
|
-
|
|
51
|
+
await refreshRuntimeState(true);
|
|
52
|
+
await runtimeState.patchPromise;
|
|
53
|
+
runtimeSet = await collectRuntimeClassSet(runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
38
54
|
}
|
|
39
55
|
return templateHandler(rawWxml, defuOverrideArray(options2, {
|
|
40
56
|
runtimeSet
|
package/dist/gulp.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSJV6DCNZjs = require('./chunk-SJV6DCNZ.js');
|
|
4
4
|
require('./chunk-LTJQUORK.js');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-QA6SPWSQ.js');
|
|
5
|
+
require('./chunk-E5LRICST.js');
|
|
7
6
|
require('./chunk-DWAEHRHN.js');
|
|
8
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-GGD75A34.js');
|
|
9
8
|
require('./chunk-WXBFAARR.js');
|
|
10
9
|
require('./chunk-UW3WHSZ5.js');
|
|
11
10
|
require('./chunk-R7GWRQDJ.js');
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
exports.createPlugins =
|
|
13
|
+
exports.createPlugins = _chunkSJV6DCNZjs.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugins
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TK5LOBHZ.mjs";
|
|
4
4
|
import "./chunk-RRHPTTCP.mjs";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-V35QS2PT.mjs";
|
|
5
|
+
import "./chunk-XEQBYGBX.mjs";
|
|
7
6
|
import "./chunk-VSRDBMDB.mjs";
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
9
8
|
import "./chunk-KZJLIZIK.mjs";
|
|
10
9
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
11
10
|
import "./chunk-SCOGAO45.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPlugins } from './gulp.mjs';
|
|
2
|
-
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions } from './types.mjs';
|
|
2
|
+
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike, UserDefinedOptions } from './types.mjs';
|
|
3
3
|
export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
4
4
|
export { UnifiedWebpackPluginV5 } from './webpack.mjs';
|
|
5
5
|
export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createPlugins } from './gulp.js';
|
|
2
|
-
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions } from './types.js';
|
|
2
|
+
export { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike, UserDefinedOptions } from './types.js';
|
|
3
3
|
export { UnifiedViteWeappTailwindcssPlugin } from './vite.js';
|
|
4
4
|
export { UnifiedWebpackPluginV5 } from './webpack.js';
|
|
5
5
|
export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-O2IOQ3BD.js');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk24ADBRZNjs = require('./chunk-24ADBRZN.js');
|
|
5
5
|
require('./chunk-6GP37C26.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkSJV6DCNZjs = require('./chunk-SJV6DCNZ.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkRLWIDWTAjs = require('./chunk-RLWIDWTA.js');
|
|
12
12
|
require('./chunk-W7BVY5S5.js');
|
|
13
13
|
require('./chunk-LTJQUORK.js');
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-QA6SPWSQ.js');
|
|
14
|
+
require('./chunk-E5LRICST.js');
|
|
16
15
|
require('./chunk-DWAEHRHN.js');
|
|
17
|
-
require('./chunk-
|
|
16
|
+
require('./chunk-GGD75A34.js');
|
|
18
17
|
require('./chunk-WXBFAARR.js');
|
|
19
18
|
require('./chunk-UW3WHSZ5.js');
|
|
20
19
|
require('./chunk-R7GWRQDJ.js');
|
|
@@ -22,4 +21,4 @@ require('./chunk-R7GWRQDJ.js');
|
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
|
|
25
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
24
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkRLWIDWTAjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunk24ADBRZNjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkSJV6DCNZjs.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import "./chunk-YAN7TO2B.mjs";
|
|
2
2
|
import {
|
|
3
3
|
UnifiedWebpackPluginV5
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-42FXROX4.mjs";
|
|
5
5
|
import "./chunk-2F7HOQQY.mjs";
|
|
6
6
|
import {
|
|
7
7
|
createPlugins
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TK5LOBHZ.mjs";
|
|
9
9
|
import {
|
|
10
10
|
UnifiedViteWeappTailwindcssPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PUFKPENL.mjs";
|
|
12
12
|
import "./chunk-KZUIVLPP.mjs";
|
|
13
13
|
import "./chunk-RRHPTTCP.mjs";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-V35QS2PT.mjs";
|
|
14
|
+
import "./chunk-XEQBYGBX.mjs";
|
|
16
15
|
import "./chunk-VSRDBMDB.mjs";
|
|
17
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
18
17
|
import "./chunk-KZJLIZIK.mjs";
|
|
19
18
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
20
19
|
import "./chunk-SCOGAO45.mjs";
|
package/dist/presets.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkGGD75A34js = require('./chunk-GGD75A34.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -57,7 +57,7 @@ function toCssEntries(entries) {
|
|
|
57
57
|
return Array.isArray(entries) ? entries : [entries];
|
|
58
58
|
}
|
|
59
59
|
function hbuilderx(options = {}) {
|
|
60
|
-
const baseDir =
|
|
60
|
+
const baseDir = _chunkGGD75A34js.resolveTailwindcssBasedir.call(void 0, options.base);
|
|
61
61
|
const cssEntries = toCssEntries(options.cssEntries);
|
|
62
62
|
const tailwindConfig = {
|
|
63
63
|
v2: {
|
package/dist/presets.mjs
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -539,7 +539,16 @@ interface TailwindcssPatcherLike {
|
|
|
539
539
|
getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
|
|
540
540
|
getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
|
|
541
541
|
extract: TailwindcssPatcher['extract'];
|
|
542
|
+
collectContentTokens?: TailwindcssPatcher['collectContentTokens'];
|
|
542
543
|
options?: TailwindcssPatcher['options'];
|
|
544
|
+
cacheStore?: {
|
|
545
|
+
options?: {
|
|
546
|
+
path?: string;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
interface RefreshTailwindcssPatcherOptions {
|
|
551
|
+
clearCache?: boolean;
|
|
543
552
|
}
|
|
544
553
|
interface IJsHandlerOptions {
|
|
545
554
|
escapeMap?: Record<string, string>;
|
|
@@ -614,6 +623,7 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
|
|
|
614
623
|
customReplaceDictionary: Record<string, string>;
|
|
615
624
|
cache: ICreateCacheReturnType;
|
|
616
625
|
twPatcher: TailwindcssPatcherLike;
|
|
626
|
+
refreshTailwindcssPatcher: (options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>;
|
|
617
627
|
}>;
|
|
618
628
|
type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'disabled'>;
|
|
619
629
|
interface IBaseWebpackPlugin {
|
|
@@ -649,4 +659,4 @@ interface JsModuleGraphOptions {
|
|
|
649
659
|
maxDepth?: number;
|
|
650
660
|
}
|
|
651
661
|
|
|
652
|
-
export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
|
|
662
|
+
export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike, UserDefinedOptions };
|
package/dist/types.d.ts
CHANGED
|
@@ -539,7 +539,16 @@ interface TailwindcssPatcherLike {
|
|
|
539
539
|
getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
|
|
540
540
|
getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
|
|
541
541
|
extract: TailwindcssPatcher['extract'];
|
|
542
|
+
collectContentTokens?: TailwindcssPatcher['collectContentTokens'];
|
|
542
543
|
options?: TailwindcssPatcher['options'];
|
|
544
|
+
cacheStore?: {
|
|
545
|
+
options?: {
|
|
546
|
+
path?: string;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
interface RefreshTailwindcssPatcherOptions {
|
|
551
|
+
clearCache?: boolean;
|
|
543
552
|
}
|
|
544
553
|
interface IJsHandlerOptions {
|
|
545
554
|
escapeMap?: Record<string, string>;
|
|
@@ -614,6 +623,7 @@ type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCust
|
|
|
614
623
|
customReplaceDictionary: Record<string, string>;
|
|
615
624
|
cache: ICreateCacheReturnType;
|
|
616
625
|
twPatcher: TailwindcssPatcherLike;
|
|
626
|
+
refreshTailwindcssPatcher: (options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>;
|
|
617
627
|
}>;
|
|
618
628
|
type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'disabled'>;
|
|
619
629
|
interface IBaseWebpackPlugin {
|
|
@@ -649,4 +659,4 @@ interface JsModuleGraphOptions {
|
|
|
649
659
|
maxDepth?: number;
|
|
650
660
|
}
|
|
651
661
|
|
|
652
|
-
export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, TailwindcssPatcherLike, UserDefinedOptions };
|
|
662
|
+
export type { AppType, CreateJsHandlerOptions, IArbitraryValues, IBaseWebpackPlugin, ICommonReplaceOptions, ICustomAttributes, ICustomAttributesEntities, IJsHandlerOptions, ITemplateHandlerOptions, InternalPatchResult, InternalPostcssOptions, InternalUserDefinedOptions, ItemOrItemArray, JsHandler, JsHandlerResult, JsModuleGraphOptions, LinkedJsModuleResult, RefreshTailwindcssPatcherOptions, TailwindcssPatcherLike, UserDefinedOptions };
|