weapp-tailwindcss 4.1.10 → 4.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YWBP7AV5.mjs → chunk-ABB7LXDE.mjs} +1 -1
- package/dist/{chunk-PMBYH2X3.js → chunk-D6ERWDXU.js} +9 -8
- package/dist/{chunk-SKND75SQ.js → chunk-DSMW5REA.js} +73 -4
- package/dist/{chunk-VRWSZGXE.mjs → chunk-EYK5M7VR.mjs} +1 -1
- package/dist/{chunk-W6ESMBG5.mjs → chunk-FOPIY67W.mjs} +7 -6
- package/dist/{chunk-LNXUYCG6.js → chunk-GDMKZK55.js} +1 -1
- package/dist/{chunk-REXJEIRA.js → chunk-LXUBOXLG.js} +2 -2
- package/dist/{chunk-CRLU36U7.js → chunk-OU2F6LPR.js} +2 -2
- package/dist/{chunk-WLHVSRRP.mjs → chunk-RF63Y6B4.mjs} +1 -1
- package/dist/{chunk-4IAWLCHT.mjs → chunk-X3UI2AP2.mjs} +71 -2
- package/dist/cli.js +3 -3
- package/dist/cli.mjs +2 -2
- package/dist/core.js +3 -3
- package/dist/core.mjs +2 -2
- package/dist/defaults.js +2 -2
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/index.js +6 -6
- package/dist/index.mjs +5 -5
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.js +4 -4
- package/dist/webpack.mjs +3 -3
- package/dist/webpack4.js +3 -3
- package/dist/webpack4.mjs +2 -2
- package/package.json +9 -7
|
@@ -109,7 +109,7 @@ function getDefaultOptions() {
|
|
|
109
109
|
postcssOptions: {},
|
|
110
110
|
cssRemoveProperty: true,
|
|
111
111
|
cssRemoveHoverPseudoClass: true,
|
|
112
|
-
ignoreCallExpressionIdentifiers: isPackageExists("@weapp-tailwindcss/merge") ? ["twMerge", "twJoin", "cva"] : [],
|
|
112
|
+
ignoreCallExpressionIdentifiers: isPackageExists("@weapp-tailwindcss/merge") ? ["twMerge", "twJoin", "cva", "tv"] : [],
|
|
113
113
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
114
114
|
tailwindcssPatcherOptions: {
|
|
115
115
|
patch: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkGDMKZK55js = require('./chunk-GDMKZK55.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -107,6 +107,11 @@ function initializeCache(cacheConfig) {
|
|
|
107
107
|
return cacheConfig;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// src/js/babel.ts
|
|
111
|
+
var _escape = require('@ast-core/escape');
|
|
112
|
+
|
|
113
|
+
var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
|
|
114
|
+
|
|
110
115
|
// src/babel/index.ts
|
|
111
116
|
var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefault(_traverse);
|
|
112
117
|
var _parser = require('@babel/parser');
|
|
@@ -115,11 +120,6 @@ function _interopDefaultCompat(e) {
|
|
|
115
120
|
}
|
|
116
121
|
var traverse = _interopDefaultCompat(_traverse2.default);
|
|
117
122
|
|
|
118
|
-
// src/js/babel.ts
|
|
119
|
-
var _escape = require('@ast-core/escape');
|
|
120
|
-
|
|
121
|
-
var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
|
|
122
|
-
|
|
123
123
|
// src/js/handlers.ts
|
|
124
124
|
|
|
125
125
|
var _regex = require('@weapp-core/regex');
|
|
@@ -998,7 +998,7 @@ function createTemplateHandler(options = {}) {
|
|
|
998
998
|
function getCompilerContext(opts) {
|
|
999
999
|
const ctx = _chunkO335YLYHjs.defuOverrideArray.call(void 0,
|
|
1000
1000
|
opts,
|
|
1001
|
-
|
|
1001
|
+
_chunkGDMKZK55js.getDefaultOptions.call(void 0, ),
|
|
1002
1002
|
{}
|
|
1003
1003
|
);
|
|
1004
1004
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
@@ -1090,4 +1090,5 @@ function getCompilerContext(opts) {
|
|
|
1090
1090
|
|
|
1091
1091
|
|
|
1092
1092
|
|
|
1093
|
-
|
|
1093
|
+
|
|
1094
|
+
exports.generateCode = generateCode; exports.getCompilerContext = getCompilerContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
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; }
|
|
2
2
|
|
|
3
3
|
var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
|
|
4
4
|
|
|
@@ -6,11 +6,66 @@ var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
|
|
|
6
6
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
|
|
10
14
|
|
|
11
15
|
|
|
12
16
|
var _chunkO335YLYHjs = require('./chunk-O335YLYH.js');
|
|
13
17
|
|
|
18
|
+
// src/uni-app-x/index.ts
|
|
19
|
+
var _compilerdom = require('@vue/compiler-dom');
|
|
20
|
+
var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireDefault(_magicstring);
|
|
21
|
+
var _compilersfc = require('vue/compiler-sfc');
|
|
22
|
+
function traverse(node, visitor) {
|
|
23
|
+
visitor(node);
|
|
24
|
+
if (node.children) {
|
|
25
|
+
node.children.forEach((child) => traverse(child, visitor));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function transformUVue(code, id, jsHandler, runtimeSet) {
|
|
29
|
+
if (!id.endsWith(".uvue")) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const ms = new (0, _magicstring2.default)(code);
|
|
33
|
+
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
34
|
+
if (errors.length === 0) {
|
|
35
|
+
if (descriptor.template) {
|
|
36
|
+
let extractClassNames2 = function(node) {
|
|
37
|
+
if (node.type === _compilerdom.NodeTypes.ELEMENT) {
|
|
38
|
+
node.props.forEach((prop) => {
|
|
39
|
+
if (prop.type === _compilerdom.NodeTypes.ATTRIBUTE && prop.name === "class" && prop.value) {
|
|
40
|
+
ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, _chunkPLMJW644js.replaceWxml.call(void 0, prop.value.content));
|
|
41
|
+
}
|
|
42
|
+
if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind" && _optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class") {
|
|
43
|
+
if (_optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
|
|
44
|
+
const code2 = _chunkD6ERWDXUjs.generateCode.call(void 0, prop.exp.content, {
|
|
45
|
+
jsHandler,
|
|
46
|
+
runtimeSet
|
|
47
|
+
});
|
|
48
|
+
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, code2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var extractClassNames = extractClassNames2;
|
|
55
|
+
traverse(descriptor.template.ast, extractClassNames2);
|
|
56
|
+
}
|
|
57
|
+
if (descriptor.script) {
|
|
58
|
+
const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), {});
|
|
59
|
+
ms.update(descriptor.script.loc.start.offset, descriptor.script.loc.end.offset, code2);
|
|
60
|
+
}
|
|
61
|
+
if (descriptor.scriptSetup) {
|
|
62
|
+
const { code: code2 } = jsHandler(descriptor.scriptSetup.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), {});
|
|
63
|
+
ms.update(descriptor.scriptSetup.loc.start.offset, descriptor.scriptSetup.loc.end.offset, code2);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return ms.toString();
|
|
67
|
+
}
|
|
68
|
+
|
|
14
69
|
// src/bundlers/vite/index.ts
|
|
15
70
|
var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
|
|
16
71
|
var cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
@@ -19,7 +74,7 @@ function isCSSRequest(request) {
|
|
|
19
74
|
return cssLangRE.test(request);
|
|
20
75
|
}
|
|
21
76
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
22
|
-
const opts =
|
|
77
|
+
const opts = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, options);
|
|
23
78
|
const {
|
|
24
79
|
disabled,
|
|
25
80
|
onEnd,
|
|
@@ -40,6 +95,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
40
95
|
return;
|
|
41
96
|
}
|
|
42
97
|
twPatcher.patch();
|
|
98
|
+
let runtimeSet;
|
|
43
99
|
onLoad();
|
|
44
100
|
const plugins = [
|
|
45
101
|
// {
|
|
@@ -66,7 +122,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
66
122
|
onStart();
|
|
67
123
|
const entries = Object.entries(bundle);
|
|
68
124
|
const groupedEntries = _chunkO335YLYHjs.getGroupedEntries.call(void 0, entries, opts);
|
|
69
|
-
|
|
125
|
+
runtimeSet = await twPatcher.getClassSet();
|
|
70
126
|
setMangleRuntimeSet(runtimeSet);
|
|
71
127
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
72
128
|
const promises = [];
|
|
@@ -240,6 +296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
240
296
|
plugins.push(
|
|
241
297
|
{
|
|
242
298
|
name: "weapp-tailwindcss:uni-app-x:css",
|
|
299
|
+
enforce: "pre",
|
|
243
300
|
async transform(code, id) {
|
|
244
301
|
if (isCSSRequest(id)) {
|
|
245
302
|
const { css } = await styleHandler(code, {
|
|
@@ -258,6 +315,18 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
258
315
|
}
|
|
259
316
|
}
|
|
260
317
|
);
|
|
318
|
+
plugins.push(
|
|
319
|
+
{
|
|
320
|
+
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
321
|
+
enforce: "pre",
|
|
322
|
+
async buildStart() {
|
|
323
|
+
runtimeSet = await twPatcher.getClassSet();
|
|
324
|
+
},
|
|
325
|
+
transform(code, id) {
|
|
326
|
+
return transformUVue(code, id, jsHandler, runtimeSet);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
);
|
|
261
330
|
}
|
|
262
331
|
return plugins;
|
|
263
332
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-Q67IXIAH.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultOptions
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ABB7LXDE.mjs";
|
|
7
7
|
import {
|
|
8
8
|
defuOverrideArray,
|
|
9
9
|
isMap,
|
|
@@ -104,6 +104,11 @@ function initializeCache(cacheConfig) {
|
|
|
104
104
|
return cacheConfig;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
+
// src/js/babel.ts
|
|
108
|
+
import { jsStringEscape as jsStringEscape2 } from "@ast-core/escape";
|
|
109
|
+
import { LRUCache as LRUCache2 } from "lru-cache";
|
|
110
|
+
import MagicString from "magic-string";
|
|
111
|
+
|
|
107
112
|
// src/babel/index.ts
|
|
108
113
|
import _babelTraverse from "@babel/traverse";
|
|
109
114
|
import { parse, parseExpression } from "@babel/parser";
|
|
@@ -112,11 +117,6 @@ function _interopDefaultCompat(e) {
|
|
|
112
117
|
}
|
|
113
118
|
var traverse = _interopDefaultCompat(_babelTraverse);
|
|
114
119
|
|
|
115
|
-
// src/js/babel.ts
|
|
116
|
-
import { jsStringEscape as jsStringEscape2 } from "@ast-core/escape";
|
|
117
|
-
import { LRUCache as LRUCache2 } from "lru-cache";
|
|
118
|
-
import MagicString from "magic-string";
|
|
119
|
-
|
|
120
120
|
// src/js/handlers.ts
|
|
121
121
|
import { jsStringEscape } from "@ast-core/escape";
|
|
122
122
|
import { escapeStringRegexp } from "@weapp-core/regex";
|
|
@@ -1086,5 +1086,6 @@ function getCompilerContext(opts) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
|
|
1088
1088
|
export {
|
|
1089
|
+
generateCode,
|
|
1089
1090
|
getCompilerContext
|
|
1090
1091
|
};
|
|
@@ -109,7 +109,7 @@ function getDefaultOptions() {
|
|
|
109
109
|
postcssOptions: {},
|
|
110
110
|
cssRemoveProperty: true,
|
|
111
111
|
cssRemoveHoverPseudoClass: true,
|
|
112
|
-
ignoreCallExpressionIdentifiers: _localpkg.isPackageExists.call(void 0, "@weapp-tailwindcss/merge") ? ["twMerge", "twJoin", "cva"] : [],
|
|
112
|
+
ignoreCallExpressionIdentifiers: _localpkg.isPackageExists.call(void 0, "@weapp-tailwindcss/merge") ? ["twMerge", "twJoin", "cva", "tv"] : [],
|
|
113
113
|
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
114
114
|
tailwindcssPatcherOptions: {
|
|
115
115
|
patch: {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
7
7
|
|
|
8
8
|
// src/bundlers/gulp/index.ts
|
|
9
9
|
var _buffer = require('buffer');
|
|
@@ -11,7 +11,7 @@ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
|
11
11
|
var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
|
|
12
12
|
var Transform = _stream2.default.Transform;
|
|
13
13
|
function createPlugins(options = {}) {
|
|
14
|
-
const opts =
|
|
14
|
+
const opts = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, options);
|
|
15
15
|
const { templateHandler, styleHandler, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
|
|
16
16
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
17
17
|
twPatcher.patch();
|
|
@@ -6,7 +6,7 @@ var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
|
|
|
6
6
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
|
18
18
|
var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
|
|
19
19
|
var UnifiedWebpackPluginV5 = class {
|
|
20
20
|
constructor(options = {}) {
|
|
21
|
-
this.options =
|
|
21
|
+
this.options = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, options);
|
|
22
22
|
this.appType = this.options.appType;
|
|
23
23
|
}
|
|
24
24
|
apply(compiler) {
|
|
@@ -5,12 +5,67 @@ import {
|
|
|
5
5
|
vitePluginName
|
|
6
6
|
} from "./chunk-CMUA5KCO.mjs";
|
|
7
7
|
import {
|
|
8
|
+
generateCode,
|
|
8
9
|
getCompilerContext
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FOPIY67W.mjs";
|
|
11
|
+
import {
|
|
12
|
+
replaceWxml
|
|
13
|
+
} from "./chunk-Q67IXIAH.mjs";
|
|
10
14
|
import {
|
|
11
15
|
getGroupedEntries
|
|
12
16
|
} from "./chunk-JXBLHLFR.mjs";
|
|
13
17
|
|
|
18
|
+
// src/uni-app-x/index.ts
|
|
19
|
+
import { NodeTypes } from "@vue/compiler-dom";
|
|
20
|
+
import MagicString from "magic-string";
|
|
21
|
+
import { parse } from "vue/compiler-sfc";
|
|
22
|
+
function traverse(node, visitor) {
|
|
23
|
+
visitor(node);
|
|
24
|
+
if (node.children) {
|
|
25
|
+
node.children.forEach((child) => traverse(child, visitor));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function transformUVue(code, id, jsHandler, runtimeSet) {
|
|
29
|
+
if (!id.endsWith(".uvue")) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const ms = new MagicString(code);
|
|
33
|
+
const { descriptor, errors } = parse(code);
|
|
34
|
+
if (errors.length === 0) {
|
|
35
|
+
if (descriptor.template) {
|
|
36
|
+
let extractClassNames2 = function(node) {
|
|
37
|
+
if (node.type === NodeTypes.ELEMENT) {
|
|
38
|
+
node.props.forEach((prop) => {
|
|
39
|
+
if (prop.type === NodeTypes.ATTRIBUTE && prop.name === "class" && prop.value) {
|
|
40
|
+
ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, replaceWxml(prop.value.content));
|
|
41
|
+
}
|
|
42
|
+
if (prop.type === NodeTypes.DIRECTIVE && prop.name === "bind" && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class") {
|
|
43
|
+
if (prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION) {
|
|
44
|
+
const code2 = generateCode(prop.exp.content, {
|
|
45
|
+
jsHandler,
|
|
46
|
+
runtimeSet
|
|
47
|
+
});
|
|
48
|
+
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, code2);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var extractClassNames = extractClassNames2;
|
|
55
|
+
traverse(descriptor.template.ast, extractClassNames2);
|
|
56
|
+
}
|
|
57
|
+
if (descriptor.script) {
|
|
58
|
+
const { code: code2 } = jsHandler(descriptor.script.content, runtimeSet ?? /* @__PURE__ */ new Set(), {});
|
|
59
|
+
ms.update(descriptor.script.loc.start.offset, descriptor.script.loc.end.offset, code2);
|
|
60
|
+
}
|
|
61
|
+
if (descriptor.scriptSetup) {
|
|
62
|
+
const { code: code2 } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), {});
|
|
63
|
+
ms.update(descriptor.scriptSetup.loc.start.offset, descriptor.scriptSetup.loc.end.offset, code2);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return ms.toString();
|
|
67
|
+
}
|
|
68
|
+
|
|
14
69
|
// src/bundlers/vite/index.ts
|
|
15
70
|
var debug = createDebug();
|
|
16
71
|
var cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
@@ -40,6 +95,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
40
95
|
return;
|
|
41
96
|
}
|
|
42
97
|
twPatcher.patch();
|
|
98
|
+
let runtimeSet;
|
|
43
99
|
onLoad();
|
|
44
100
|
const plugins = [
|
|
45
101
|
// {
|
|
@@ -66,7 +122,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
66
122
|
onStart();
|
|
67
123
|
const entries = Object.entries(bundle);
|
|
68
124
|
const groupedEntries = getGroupedEntries(entries, opts);
|
|
69
|
-
|
|
125
|
+
runtimeSet = await twPatcher.getClassSet();
|
|
70
126
|
setMangleRuntimeSet(runtimeSet);
|
|
71
127
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
72
128
|
const promises = [];
|
|
@@ -240,6 +296,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
240
296
|
plugins.push(
|
|
241
297
|
{
|
|
242
298
|
name: "weapp-tailwindcss:uni-app-x:css",
|
|
299
|
+
enforce: "pre",
|
|
243
300
|
async transform(code, id) {
|
|
244
301
|
if (isCSSRequest(id)) {
|
|
245
302
|
const { css } = await styleHandler(code, {
|
|
@@ -258,6 +315,18 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
258
315
|
}
|
|
259
316
|
}
|
|
260
317
|
);
|
|
318
|
+
plugins.push(
|
|
319
|
+
{
|
|
320
|
+
name: "weapp-tailwindcss:uni-app-x:nvue",
|
|
321
|
+
enforce: "pre",
|
|
322
|
+
async buildStart() {
|
|
323
|
+
runtimeSet = await twPatcher.getClassSet();
|
|
324
|
+
},
|
|
325
|
+
transform(code, id) {
|
|
326
|
+
return transformUVue(code, id, jsHandler, runtimeSet);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
);
|
|
261
330
|
}
|
|
262
331
|
return plugins;
|
|
263
332
|
}
|
package/dist/cli.js
CHANGED
|
@@ -6,9 +6,9 @@ var _chunkOXASK55Qjs = require('./chunk-OXASK55Q.js');
|
|
|
6
6
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
10
10
|
require('./chunk-PLMJW644.js');
|
|
11
|
-
require('./chunk-
|
|
11
|
+
require('./chunk-GDMKZK55.js');
|
|
12
12
|
require('./chunk-O335YLYH.js');
|
|
13
13
|
require('./chunk-IM5UX7VP.js');
|
|
14
14
|
|
|
@@ -25,7 +25,7 @@ if (_semver2.default.lt(_process2.default.versions.node, _chunkOGROHM4Ljs.WEAPP_
|
|
|
25
25
|
}
|
|
26
26
|
var command = args[0];
|
|
27
27
|
if (command === "patch") {
|
|
28
|
-
const ctx =
|
|
28
|
+
const ctx = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, );
|
|
29
29
|
ctx.twPatcher.patch();
|
|
30
30
|
} else if (command === "init") {
|
|
31
31
|
_init.init.call(void 0, );
|
package/dist/cli.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-CMUA5KCO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getCompilerContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FOPIY67W.mjs";
|
|
10
10
|
import "./chunk-Q67IXIAH.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
12
12
|
import "./chunk-JXBLHLFR.mjs";
|
|
13
13
|
import "./chunk-PODAMYUP.mjs";
|
|
14
14
|
|
package/dist/core.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
4
4
|
require('./chunk-PLMJW644.js');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-GDMKZK55.js');
|
|
6
6
|
require('./chunk-O335YLYH.js');
|
|
7
7
|
require('./chunk-IM5UX7VP.js');
|
|
8
8
|
|
|
9
9
|
// src/core.ts
|
|
10
10
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
11
11
|
function createContext(options = {}) {
|
|
12
|
-
const opts =
|
|
12
|
+
const opts = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, options);
|
|
13
13
|
const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
|
|
14
14
|
let runtimeSet = /* @__PURE__ */ new Set();
|
|
15
15
|
twPatcher.patch();
|
package/dist/core.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FOPIY67W.mjs";
|
|
4
4
|
import "./chunk-Q67IXIAH.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
6
6
|
import "./chunk-JXBLHLFR.mjs";
|
|
7
7
|
import "./chunk-PODAMYUP.mjs";
|
|
8
8
|
|
package/dist/defaults.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGDMKZK55js = require('./chunk-GDMKZK55.js');
|
|
4
4
|
require('./chunk-O335YLYH.js');
|
|
5
5
|
require('./chunk-IM5UX7VP.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.getDefaultOptions =
|
|
8
|
+
exports.getDefaultOptions = _chunkGDMKZK55js.getDefaultOptions;
|
package/dist/defaults.mjs
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLXUBOXLGjs = require('./chunk-LXUBOXLG.js');
|
|
4
4
|
require('./chunk-LSSLYD6B.js');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-D6ERWDXU.js');
|
|
6
6
|
require('./chunk-PLMJW644.js');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-GDMKZK55.js');
|
|
8
8
|
require('./chunk-O335YLYH.js');
|
|
9
9
|
require('./chunk-IM5UX7VP.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.createPlugins =
|
|
12
|
+
exports.createPlugins = _chunkLXUBOXLGjs.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugins
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RF63Y6B4.mjs";
|
|
4
4
|
import "./chunk-3AUX4FGE.mjs";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-FOPIY67W.mjs";
|
|
6
6
|
import "./chunk-Q67IXIAH.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
8
8
|
import "./chunk-JXBLHLFR.mjs";
|
|
9
9
|
import "./chunk-PODAMYUP.mjs";
|
|
10
10
|
export {
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-O2IOQ3BD.js');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkOU2F6LPRjs = require('./chunk-OU2F6LPR.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkLXUBOXLGjs = require('./chunk-LXUBOXLG.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkDSMW5REAjs = require('./chunk-DSMW5REA.js');
|
|
13
13
|
require('./chunk-LSSLYD6B.js');
|
|
14
14
|
require('./chunk-OGROHM4L.js');
|
|
15
|
-
require('./chunk-
|
|
15
|
+
require('./chunk-D6ERWDXU.js');
|
|
16
16
|
require('./chunk-PLMJW644.js');
|
|
17
|
-
require('./chunk-
|
|
17
|
+
require('./chunk-GDMKZK55.js');
|
|
18
18
|
require('./chunk-O335YLYH.js');
|
|
19
19
|
require('./chunk-IM5UX7VP.js');
|
|
20
20
|
|
|
@@ -23,4 +23,4 @@ require('./chunk-IM5UX7VP.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
26
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkDSMW5REAjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkOU2F6LPRjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkLXUBOXLGjs.createPlugins; exports.cssLangRE = _chunkDSMW5REAjs.cssLangRE; exports.isCSSRequest = _chunkDSMW5REAjs.isCSSRequest;
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import "./chunk-YAN7TO2B.mjs";
|
|
2
2
|
import {
|
|
3
3
|
UnifiedWebpackPluginV5
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EYK5M7VR.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createPlugins
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RF63Y6B4.mjs";
|
|
8
8
|
import {
|
|
9
9
|
UnifiedViteWeappTailwindcssPlugin,
|
|
10
10
|
cssLangRE,
|
|
11
11
|
isCSSRequest
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-X3UI2AP2.mjs";
|
|
13
13
|
import "./chunk-3AUX4FGE.mjs";
|
|
14
14
|
import "./chunk-CMUA5KCO.mjs";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-FOPIY67W.mjs";
|
|
16
16
|
import "./chunk-Q67IXIAH.mjs";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
18
18
|
import "./chunk-JXBLHLFR.mjs";
|
|
19
19
|
import "./chunk-PODAMYUP.mjs";
|
|
20
20
|
export {
|
package/dist/types.d.mts
CHANGED
|
@@ -507,7 +507,7 @@ interface IArbitraryValues {
|
|
|
507
507
|
allowDoubleQuotes?: boolean;
|
|
508
508
|
}
|
|
509
509
|
interface JsHandler {
|
|
510
|
-
(rawSource: string, set
|
|
510
|
+
(rawSource: string, set?: Set<string>, options?: CreateJsHandlerOptions): JsHandlerResult;
|
|
511
511
|
}
|
|
512
512
|
interface ICommonReplaceOptions {
|
|
513
513
|
keepEOL?: boolean;
|
package/dist/types.d.ts
CHANGED
|
@@ -507,7 +507,7 @@ interface IArbitraryValues {
|
|
|
507
507
|
allowDoubleQuotes?: boolean;
|
|
508
508
|
}
|
|
509
509
|
interface JsHandler {
|
|
510
|
-
(rawSource: string, set
|
|
510
|
+
(rawSource: string, set?: Set<string>, options?: CreateJsHandlerOptions): JsHandlerResult;
|
|
511
511
|
}
|
|
512
512
|
interface ICommonReplaceOptions {
|
|
513
513
|
keepEOL?: boolean;
|
package/dist/vite.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkDSMW5REAjs = require('./chunk-DSMW5REA.js');
|
|
6
6
|
require('./chunk-LSSLYD6B.js');
|
|
7
7
|
require('./chunk-OGROHM4L.js');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-D6ERWDXU.js');
|
|
9
9
|
require('./chunk-PLMJW644.js');
|
|
10
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-GDMKZK55.js');
|
|
11
11
|
require('./chunk-O335YLYH.js');
|
|
12
12
|
require('./chunk-IM5UX7VP.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
17
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkDSMW5REAjs.UnifiedViteWeappTailwindcssPlugin; exports.cssLangRE = _chunkDSMW5REAjs.cssLangRE; exports.isCSSRequest = _chunkDSMW5REAjs.isCSSRequest;
|
package/dist/vite.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
UnifiedViteWeappTailwindcssPlugin,
|
|
3
3
|
cssLangRE,
|
|
4
4
|
isCSSRequest
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-X3UI2AP2.mjs";
|
|
6
6
|
import "./chunk-3AUX4FGE.mjs";
|
|
7
7
|
import "./chunk-CMUA5KCO.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-FOPIY67W.mjs";
|
|
9
9
|
import "./chunk-Q67IXIAH.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
11
11
|
import "./chunk-JXBLHLFR.mjs";
|
|
12
12
|
import "./chunk-PODAMYUP.mjs";
|
|
13
13
|
export {
|
package/dist/webpack.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkOU2F6LPRjs = require('./chunk-OU2F6LPR.js');
|
|
4
4
|
require('./chunk-LSSLYD6B.js');
|
|
5
5
|
require('./chunk-OGROHM4L.js');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-D6ERWDXU.js');
|
|
7
7
|
require('./chunk-PLMJW644.js');
|
|
8
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-GDMKZK55.js');
|
|
9
9
|
require('./chunk-O335YLYH.js');
|
|
10
10
|
require('./chunk-IM5UX7VP.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.UnifiedWebpackPluginV5 =
|
|
13
|
+
exports.UnifiedWebpackPluginV5 = _chunkOU2F6LPRjs.UnifiedWebpackPluginV5;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EYK5M7VR.mjs";
|
|
4
4
|
import "./chunk-3AUX4FGE.mjs";
|
|
5
5
|
import "./chunk-CMUA5KCO.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-FOPIY67W.mjs";
|
|
7
7
|
import "./chunk-Q67IXIAH.mjs";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
9
9
|
import "./chunk-JXBLHLFR.mjs";
|
|
10
10
|
import "./chunk-PODAMYUP.mjs";
|
|
11
11
|
export {
|
package/dist/webpack4.js
CHANGED
|
@@ -6,9 +6,9 @@ var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
|
|
|
6
6
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkD6ERWDXUjs = require('./chunk-D6ERWDXU.js');
|
|
10
10
|
require('./chunk-PLMJW644.js');
|
|
11
|
-
require('./chunk-
|
|
11
|
+
require('./chunk-GDMKZK55.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -22,7 +22,7 @@ var _webpacksources = require('webpack-sources');
|
|
|
22
22
|
var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
|
|
23
23
|
var UnifiedWebpackPluginV4 = class {
|
|
24
24
|
constructor(options = {}) {
|
|
25
|
-
this.options =
|
|
25
|
+
this.options = _chunkD6ERWDXUjs.getCompilerContext.call(void 0, options);
|
|
26
26
|
this.appType = this.options.appType;
|
|
27
27
|
}
|
|
28
28
|
apply(compiler) {
|
package/dist/webpack4.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-CMUA5KCO.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getCompilerContext
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FOPIY67W.mjs";
|
|
10
10
|
import "./chunk-Q67IXIAH.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-ABB7LXDE.mjs";
|
|
12
12
|
import {
|
|
13
13
|
getGroupedEntries,
|
|
14
14
|
removeExt
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0-alpha.0",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -159,9 +159,10 @@
|
|
|
159
159
|
},
|
|
160
160
|
"dependencies": {
|
|
161
161
|
"@ast-core/escape": "~1.0.1",
|
|
162
|
-
"@babel/parser": "~7.
|
|
163
|
-
"@babel/traverse": "~7.
|
|
164
|
-
"@babel/types": "~7.
|
|
162
|
+
"@babel/parser": "~7.28.0",
|
|
163
|
+
"@babel/traverse": "~7.28.0",
|
|
164
|
+
"@babel/types": "~7.28.1",
|
|
165
|
+
"@vue/compiler-dom": "^3.5.17",
|
|
165
166
|
"@weapp-core/escape": "~4.0.1",
|
|
166
167
|
"@weapp-core/regex": "~1.0.1",
|
|
167
168
|
"debug": "~4.4.1",
|
|
@@ -172,12 +173,13 @@
|
|
|
172
173
|
"magic-string": "0.30.17",
|
|
173
174
|
"semver": "~7.7.2",
|
|
174
175
|
"tailwindcss-patch": "~7.1.1",
|
|
176
|
+
"vue": "^3.5.17",
|
|
175
177
|
"webpack-sources": "3.3.3",
|
|
176
178
|
"@weapp-tailwindcss/init": "1.0.2",
|
|
177
|
-
"@weapp-tailwindcss/logger": "1.0.1",
|
|
178
179
|
"@weapp-tailwindcss/mangle": "1.0.4",
|
|
179
|
-
"@weapp-tailwindcss/
|
|
180
|
-
"@weapp-tailwindcss/
|
|
180
|
+
"@weapp-tailwindcss/shared": "1.0.2",
|
|
181
|
+
"@weapp-tailwindcss/postcss": "1.0.16",
|
|
182
|
+
"@weapp-tailwindcss/logger": "1.0.1"
|
|
181
183
|
},
|
|
182
184
|
"scripts": {
|
|
183
185
|
"dev": "tsup --watch --sourcemap",
|