weapp-tailwindcss 4.5.2 → 4.6.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-FOUWGCIJ.js → chunk-7CGHD2TI.js} +17 -15
- package/dist/{chunk-L4AXTSIM.mjs → chunk-7PGHZOTU.mjs} +10 -30
- package/dist/chunk-AXLRUW5H.js +776 -0
- package/dist/{chunk-PLMJW644.js → chunk-DWAEHRHN.js} +1 -4
- package/dist/{chunk-NHB7NFQC.js → chunk-E5PXIHDN.js} +1 -1
- package/dist/chunk-FB5P4TRH.js +70 -0
- package/dist/{chunk-ZUH5ZA7D.js → chunk-FVA7Y2YU.js} +21 -19
- package/dist/{chunk-FOSGDQZ7.js → chunk-I7FYDXN6.js} +3 -5
- package/dist/chunk-IY2OKZE6.mjs +773 -0
- package/dist/{chunk-CKTI35D3.mjs → chunk-JG5LBGLH.mjs} +27 -7
- package/dist/{chunk-FWIGQ4RY.mjs → chunk-KHILYAA4.mjs} +1 -1
- package/dist/chunk-LTJQUORK.js +32 -0
- package/dist/{chunk-TGTFIOJU.js → chunk-M6DWZX4H.js} +31 -11
- package/dist/{chunk-GGIH6WLF.mjs → chunk-MXVUK23K.mjs} +14 -12
- package/dist/{chunk-A3TJT6B6.js → chunk-OVDIACVK.js} +19 -39
- package/dist/{chunk-H4JTYYOI.mjs → chunk-RRHPTTCP.mjs} +0 -11
- package/dist/{chunk-WFZ73Q6S.mjs → chunk-TTDQ4TK2.mjs} +14 -12
- package/dist/{chunk-Q67IXIAH.mjs → chunk-VSRDBMDB.mjs} +1 -4
- package/dist/{chunk-IHKVNALD.mjs → chunk-YLNOOPZL.mjs} +3 -5
- package/dist/chunk-YPBRGP6K.mjs +70 -0
- package/dist/cli.js +11 -8
- package/dist/cli.mjs +11 -8
- package/dist/core.d.mts +0 -1
- package/dist/core.d.ts +0 -1
- package/dist/core.js +23 -12
- package/dist/core.mjs +21 -10
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.d.mts +0 -1
- package/dist/defaults.d.ts +0 -1
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/escape.d.mts +0 -1
- package/dist/escape.d.ts +0 -1
- package/dist/escape.js +3 -3
- package/dist/escape.mjs +2 -2
- package/dist/gulp.d.mts +0 -1
- package/dist/gulp.d.ts +0 -1
- package/dist/gulp.js +9 -8
- package/dist/gulp.mjs +8 -7
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +11 -10
- package/dist/index.mjs +10 -9
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +0 -1
- package/dist/presets.d.ts +0 -1
- package/dist/presets.js +17 -23
- package/dist/presets.mjs +16 -22
- package/dist/types.d.mts +10 -30
- package/dist/types.d.ts +10 -30
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +0 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +9 -8
- package/dist/vite.mjs +8 -7
- package/dist/weapp-tw-runtime-loader.js +4 -1
- package/dist/webpack.d.mts +0 -1
- package/dist/webpack.d.ts +0 -1
- package/dist/webpack.js +9 -8
- package/dist/webpack.mjs +8 -7
- package/dist/webpack4.d.mts +0 -1
- package/dist/webpack4.d.ts +0 -1
- package/dist/webpack4.js +21 -19
- package/dist/webpack4.mjs +17 -15
- package/package.json +8 -9
- package/dist/chunk-2NRTWL47.js +0 -43
- package/dist/chunk-KBR4YB6N.js +0 -178
- package/dist/chunk-S2WEN6NJ.mjs +0 -175
|
@@ -4,14 +4,11 @@ function replaceWxml(original, options = {
|
|
|
4
4
|
keepEOL: false,
|
|
5
5
|
escapeMap: _escape.MappingChars2String
|
|
6
6
|
}) {
|
|
7
|
-
const { keepEOL, escapeMap,
|
|
7
|
+
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
8
8
|
let res = original;
|
|
9
9
|
if (!keepEOL) {
|
|
10
10
|
res = res.replaceAll(/[\n\r]+/g, "");
|
|
11
11
|
}
|
|
12
|
-
if (mangleContext) {
|
|
13
|
-
res = mangleContext.wxmlHandler(res);
|
|
14
|
-
}
|
|
15
12
|
res = _escape.escape.call(void 0, res, {
|
|
16
13
|
map: escapeMap,
|
|
17
14
|
ignoreHead
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.9.1__@swc+core@1.13.5_@swc+he_98381cc53e0855b33bb51e41d0f2099f/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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; }// src/debug/index.ts
|
|
2
|
+
var _debug2 = require('debug'); var _debug3 = _interopRequireDefault(_debug2);
|
|
3
|
+
var _debug = _debug3.default.call(void 0, "weapp-tw");
|
|
4
|
+
function createDebug(prefix) {
|
|
5
|
+
function debug2(formatter, ...args) {
|
|
6
|
+
return _debug((_nullishCoalesce(prefix, () => ( ""))) + formatter, ...args);
|
|
7
|
+
}
|
|
8
|
+
return debug2;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/tailwindcss/runtime.ts
|
|
12
|
+
var debug = createDebug("[tailwindcss:runtime] ");
|
|
13
|
+
function shouldPreferSync(majorVersion) {
|
|
14
|
+
if (majorVersion == null) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (majorVersion === 3) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
if (majorVersion === 4) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
function tryGetRuntimeClassSetSync(twPatcher) {
|
|
26
|
+
if (typeof twPatcher.getClassSetSync !== "function") {
|
|
27
|
+
return void 0;
|
|
28
|
+
}
|
|
29
|
+
if (!shouldPreferSync(twPatcher.majorVersion)) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
return twPatcher.getClassSetSync();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (twPatcher.majorVersion === 4) {
|
|
36
|
+
debug("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
|
|
37
|
+
} else {
|
|
38
|
+
debug("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
|
|
39
|
+
}
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function collectRuntimeClassSet(twPatcher) {
|
|
44
|
+
const syncSet = tryGetRuntimeClassSetSync(twPatcher);
|
|
45
|
+
if (syncSet) {
|
|
46
|
+
return syncSet;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const result = await twPatcher.extract({ write: false });
|
|
50
|
+
if (_optionalChain([result, 'optionalAccess', _ => _.classSet])) {
|
|
51
|
+
return result.classSet;
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
debug("extract() failed, fallback to getClassSet(): %O", error);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const fallbackSet = await Promise.resolve(twPatcher.getClassSet());
|
|
58
|
+
if (fallbackSet) {
|
|
59
|
+
return fallbackSet;
|
|
60
|
+
}
|
|
61
|
+
} catch (error) {
|
|
62
|
+
debug("getClassSet() failed, returning empty set: %O", error);
|
|
63
|
+
}
|
|
64
|
+
return /* @__PURE__ */ new Set();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
exports.createDebug = createDebug; exports.collectRuntimeClassSet = collectRuntimeClassSet;
|
|
@@ -4,18 +4,21 @@
|
|
|
4
4
|
var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkFB5P4TRHjs = require('./chunk-FB5P4TRH.js');
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
|
|
15
|
-
var
|
|
18
|
+
var _chunkOVDIACVKjs = require('./chunk-OVDIACVK.js');
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
var
|
|
21
|
+
var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -43,14 +46,14 @@ function traverse(node, visitor) {
|
|
|
43
46
|
function createClassAttributeUpdater(ms) {
|
|
44
47
|
return (prop) => {
|
|
45
48
|
if (prop.value) {
|
|
46
|
-
ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1,
|
|
49
|
+
ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, _chunkDWAEHRHNjs.replaceWxml.call(void 0, prop.value.content));
|
|
47
50
|
}
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
53
|
function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
|
|
51
54
|
return (prop) => {
|
|
52
55
|
if (_optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
|
|
53
|
-
const generated =
|
|
56
|
+
const generated = _chunkOVDIACVKjs.generateCode.call(void 0, prop.exp.content, {
|
|
54
57
|
jsHandler,
|
|
55
58
|
runtimeSet
|
|
56
59
|
});
|
|
@@ -170,7 +173,7 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
170
173
|
}
|
|
171
174
|
|
|
172
175
|
// src/bundlers/vite/index.ts
|
|
173
|
-
var debug =
|
|
176
|
+
var debug = _chunkFB5P4TRHjs.createDebug.call(void 0, );
|
|
174
177
|
function readOutputEntry(entry) {
|
|
175
178
|
if (entry.output.type === "chunk") {
|
|
176
179
|
return entry.output.code;
|
|
@@ -236,7 +239,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate) {
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
239
|
-
const opts =
|
|
242
|
+
const opts = _chunkOVDIACVKjs.getCompilerContext.call(void 0, options);
|
|
240
243
|
const {
|
|
241
244
|
disabled,
|
|
242
245
|
onEnd,
|
|
@@ -248,7 +251,6 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
248
251
|
jsHandler,
|
|
249
252
|
mainCssChunkMatcher,
|
|
250
253
|
appType,
|
|
251
|
-
setMangleRuntimeSet,
|
|
252
254
|
cache,
|
|
253
255
|
twPatcher,
|
|
254
256
|
uniAppX
|
|
@@ -256,7 +258,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
256
258
|
if (disabled) {
|
|
257
259
|
return;
|
|
258
260
|
}
|
|
259
|
-
twPatcher.patch();
|
|
261
|
+
const patchPromise = Promise.resolve(twPatcher.patch());
|
|
260
262
|
let runtimeSet;
|
|
261
263
|
let resolvedConfig;
|
|
262
264
|
onLoad();
|
|
@@ -278,6 +280,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
278
280
|
}
|
|
279
281
|
},
|
|
280
282
|
async generateBundle(_opt, bundle) {
|
|
283
|
+
await patchPromise;
|
|
281
284
|
debug("start");
|
|
282
285
|
onStart();
|
|
283
286
|
const entries = Object.entries(bundle);
|
|
@@ -293,8 +296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
293
296
|
}
|
|
294
297
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
295
298
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
|
|
296
|
-
runtimeSet = await
|
|
297
|
-
setMangleRuntimeSet(runtimeSet);
|
|
299
|
+
runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
|
|
298
300
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
299
301
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
300
302
|
onUpdate(fileName, previous, next);
|
|
@@ -314,7 +316,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
314
316
|
for (const [file, originalSource] of groupedEntries.html) {
|
|
315
317
|
const rawSource = originalSource.source.toString();
|
|
316
318
|
tasks.push(
|
|
317
|
-
|
|
319
|
+
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
318
320
|
cache,
|
|
319
321
|
cacheKey: file,
|
|
320
322
|
rawSource,
|
|
@@ -345,7 +347,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
345
347
|
}
|
|
346
348
|
const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
347
349
|
const initialRawSource = originalSource.code;
|
|
348
|
-
await
|
|
350
|
+
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
349
351
|
cache,
|
|
350
352
|
cacheKey: file,
|
|
351
353
|
rawSource: initialRawSource,
|
|
@@ -374,7 +376,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
374
376
|
}
|
|
375
377
|
const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
376
378
|
const rawSource = originalSource.source.toString();
|
|
377
|
-
await
|
|
379
|
+
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
378
380
|
cache,
|
|
379
381
|
cacheKey: file,
|
|
380
382
|
rawSource,
|
|
@@ -410,7 +412,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
410
412
|
for (const [file, originalSource] of groupedEntries.css) {
|
|
411
413
|
const rawSource = originalSource.source.toString();
|
|
412
414
|
tasks.push(
|
|
413
|
-
|
|
415
|
+
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
414
416
|
cache,
|
|
415
417
|
cacheKey: file,
|
|
416
418
|
rawSource,
|
|
@@ -421,6 +423,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
421
423
|
debug("css cache hit: %s", file);
|
|
422
424
|
},
|
|
423
425
|
async transform() {
|
|
426
|
+
await patchPromise;
|
|
424
427
|
const { css } = await styleHandler(rawSource, {
|
|
425
428
|
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
426
429
|
postcssOptions: {
|
|
@@ -454,6 +457,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
454
457
|
name: `weapp-tailwindcss:uni-app-x:css${enforce ? `:${enforce}` : ""}`,
|
|
455
458
|
enforce,
|
|
456
459
|
async transform(code, id) {
|
|
460
|
+
await patchPromise;
|
|
457
461
|
const { query } = parseVueRequest(id);
|
|
458
462
|
if (isCSSRequest(id) || query.vue && query.type === "style") {
|
|
459
463
|
const postcssResult = await styleHandler(code, {
|
|
@@ -493,10 +497,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
493
497
|
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
494
498
|
enforce: "pre",
|
|
495
499
|
async buildStart() {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
runtimeSet = res.classSet;
|
|
499
|
-
}
|
|
500
|
+
await patchPromise;
|
|
501
|
+
runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
|
|
500
502
|
},
|
|
501
503
|
transform(code, id) {
|
|
502
504
|
return transformUVue(code, id, jsHandler, runtimeSet);
|
|
@@ -90,7 +90,7 @@ function getDefaultOptions() {
|
|
|
90
90
|
},
|
|
91
91
|
disabledDefaultTemplateHandler: false,
|
|
92
92
|
cssSelectorReplacement: {
|
|
93
|
-
root: "page",
|
|
93
|
+
root: ["page", ".tw-root"],
|
|
94
94
|
universal: ["view", "text"]
|
|
95
95
|
},
|
|
96
96
|
babelParserOptions: {
|
|
@@ -106,10 +106,8 @@ function getDefaultOptions() {
|
|
|
106
106
|
ignoreCallExpressionIdentifiers: _localpkg.isPackageExists.call(void 0, "@weapp-tailwindcss/merge") ? ["twMerge", "twJoin", "cva", "tv"] : [],
|
|
107
107
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
108
108
|
tailwindcssPatcherOptions: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return !_escape.isAllowedClassName.call(void 0, className);
|
|
112
|
-
}
|
|
109
|
+
filter(className) {
|
|
110
|
+
return !_escape.isAllowedClassName.call(void 0, className);
|
|
113
111
|
}
|
|
114
112
|
},
|
|
115
113
|
logLevel: "info"
|