weapp-tailwindcss 2.6.3 → 2.7.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/README.md +3 -2
- package/dist/cli.js +8 -7
- package/dist/cli.mjs +8 -7
- package/dist/{defaults-702719e1.mjs → defaults-0743f523.mjs} +2 -1
- package/dist/{defaults-28cfeec8.js → defaults-344ba6d9.js} +2 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +8 -7
- package/dist/gulp.mjs +8 -7
- package/dist/index.js +8 -7
- package/dist/index.mjs +8 -7
- package/dist/js/handlers.d.ts +5 -0
- package/dist/js/index.d.ts +6 -4
- package/dist/{options-d8cb9e14.mjs → options-5a3070c1.mjs} +121 -38
- package/dist/{options-43afee21.js → options-7a4ffa6a.js} +128 -44
- package/dist/types.d.ts +9 -4
- package/dist/vite.js +8 -7
- package/dist/vite.mjs +8 -7
- package/dist/webpack.js +8 -7
- package/dist/webpack.mjs +8 -7
- package/package.json +25 -21
package/README.md
CHANGED
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
[](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
|
|
22
22
|
[](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
|
|
23
23
|
|
|
24
|
-
> `小程序` + `tailwindcss` 全方面解决方案
|
|
24
|
+
> `小程序` + `tailwindcss` 全方面解决方案
|
|
25
|
+
> 想试试在小程序里使用 `CSS-in-JS` 思想? 👉🏻👉🏻试试 [`weapp-pandacss`](https://github.com/sonofmagic/weapp-pandacss)
|
|
25
26
|
|
|
26
27
|
\[[国内部署的文档地址](https://weapp-tw.icebreaker.top)\] \| \[[备用Github Page](https://sonofmagic.github.io/weapp-tailwindcss/)\] \| \[[1.x文档]('./v1.md')\]
|
|
27
28
|
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
|
|
71
72
|
目前,这些插件支持最新版本的 `tailwindcss v3.x.x` 版本和 `webpack5`,`vite` 和 `gulp`。
|
|
72
73
|
|
|
73
|
-
> 如果你还在使用 `tailwindcss@2` 版本,那你应该使用本插件的 `1.x` 版本。另外请确保你的 `nodejs` 版本 `>=16`。目前低于 `16` 的长期维护版本(`偶数版本`) 都已经结束了生命周期,建议安装 `nodejs` 的 `LTS`版本,详见 [nodejs/release](https://github.com/nodejs/release)
|
|
74
|
+
> 如果你还在使用 `tailwindcss@2` 版本,那你应该使用本插件的 `1.x` 版本。另外请确保你的 `nodejs` 版本 `>=16.6.0`。目前低于 `16` 的长期维护版本(`偶数版本`) 都已经结束了生命周期,建议安装 `nodejs` 的 `LTS`版本,详见 [nodejs/release](https://github.com/nodejs/release)
|
|
74
75
|
|
|
75
76
|
## [安装与使用方式](https://weapp-tw.icebreaker.top/docs/quick-start/install)
|
|
76
77
|
|
package/dist/cli.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-7a4ffa6a.js');
|
|
4
4
|
require('micromatch');
|
|
5
|
-
require('
|
|
6
|
-
require('@babel/generator');
|
|
7
|
-
require('@babel/parser');
|
|
8
|
-
require('@babel/traverse');
|
|
5
|
+
require('magic-string');
|
|
9
6
|
require('./replace.js');
|
|
10
7
|
require('@weapp-core/escape');
|
|
11
8
|
require('./shared-df9de23f.js');
|
|
12
9
|
require('@weapp-core/regex');
|
|
13
|
-
require('
|
|
10
|
+
require('@babel/generator');
|
|
11
|
+
require('@babel/parser');
|
|
12
|
+
require('@babel/traverse');
|
|
13
|
+
require('./defaults-344ba6d9.js');
|
|
14
|
+
require('@babel/types');
|
|
14
15
|
require('postcss');
|
|
15
16
|
require('./postcss-4e99a8e8.js');
|
|
16
17
|
require('postcss-selector-parser');
|
|
@@ -19,7 +20,7 @@ require('node:path');
|
|
|
19
20
|
require('node:fs');
|
|
20
21
|
require('semver');
|
|
21
22
|
require('tailwindcss-patch');
|
|
22
|
-
require('tailwindcss-mangle
|
|
23
|
+
require('@tailwindcss-mangle/shared');
|
|
23
24
|
|
|
24
25
|
const args = process.argv.slice(2);
|
|
25
26
|
if (args[0] === 'patch') {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-5a3070c1.mjs';
|
|
2
2
|
import 'micromatch';
|
|
3
|
-
import '
|
|
4
|
-
import '@babel/generator';
|
|
5
|
-
import '@babel/parser';
|
|
6
|
-
import '@babel/traverse';
|
|
3
|
+
import 'magic-string';
|
|
7
4
|
import './replace.mjs';
|
|
8
5
|
import '@weapp-core/escape';
|
|
9
6
|
import './shared-fd149084.mjs';
|
|
10
7
|
import '@weapp-core/regex';
|
|
11
|
-
import '
|
|
8
|
+
import '@babel/generator';
|
|
9
|
+
import '@babel/parser';
|
|
10
|
+
import '@babel/traverse';
|
|
11
|
+
import './defaults-0743f523.mjs';
|
|
12
|
+
import '@babel/types';
|
|
12
13
|
import 'postcss';
|
|
13
14
|
import './postcss-a551ddc0.mjs';
|
|
14
15
|
import 'postcss-selector-parser';
|
|
@@ -17,7 +18,7 @@ import 'node:path';
|
|
|
17
18
|
import 'node:fs';
|
|
18
19
|
import 'semver';
|
|
19
20
|
import 'tailwindcss-patch';
|
|
20
|
-
import 'tailwindcss-mangle
|
|
21
|
+
import '@tailwindcss-mangle/shared';
|
|
21
22
|
|
|
22
23
|
const args = process.argv.slice(2);
|
|
23
24
|
if (args[0] === 'patch') {
|
|
@@ -125,7 +125,8 @@ const defaultOptions = {
|
|
|
125
125
|
}
|
|
126
126
|
return false;
|
|
127
127
|
},
|
|
128
|
-
disabledDefaultTemplateHandler: false
|
|
128
|
+
disabledDefaultTemplateHandler: false,
|
|
129
|
+
jsEscapeStrategy: 'regenerate'
|
|
129
130
|
};
|
|
130
131
|
|
|
131
132
|
export { defaultOptions as d, getGroupedEntries as g, isMap as i, noop as n };
|
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { d as defaultOptions } from './defaults-
|
|
1
|
+
export { d as defaultOptions } from './defaults-0743f523.mjs';
|
|
2
2
|
import '@weapp-core/escape';
|
package/dist/gulp.js
CHANGED
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var stream = require('node:stream');
|
|
6
|
-
var options = require('./options-
|
|
6
|
+
var options = require('./options-7a4ffa6a.js');
|
|
7
7
|
require('micromatch');
|
|
8
|
-
require('
|
|
9
|
-
require('@babel/generator');
|
|
10
|
-
require('@babel/parser');
|
|
11
|
-
require('@babel/traverse');
|
|
8
|
+
require('magic-string');
|
|
12
9
|
require('./replace.js');
|
|
13
10
|
require('@weapp-core/escape');
|
|
14
11
|
require('./shared-df9de23f.js');
|
|
15
12
|
require('@weapp-core/regex');
|
|
16
|
-
require('
|
|
13
|
+
require('@babel/generator');
|
|
14
|
+
require('@babel/parser');
|
|
15
|
+
require('@babel/traverse');
|
|
16
|
+
require('./defaults-344ba6d9.js');
|
|
17
|
+
require('@babel/types');
|
|
17
18
|
require('postcss');
|
|
18
19
|
require('./postcss-4e99a8e8.js');
|
|
19
20
|
require('postcss-selector-parser');
|
|
@@ -22,7 +23,7 @@ require('node:path');
|
|
|
22
23
|
require('node:fs');
|
|
23
24
|
require('semver');
|
|
24
25
|
require('tailwindcss-patch');
|
|
25
|
-
require('tailwindcss-mangle
|
|
26
|
+
require('@tailwindcss-mangle/shared');
|
|
26
27
|
|
|
27
28
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
29
|
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import stream from 'node:stream';
|
|
2
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
2
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-5a3070c1.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
|
-
import '
|
|
5
|
-
import '@babel/generator';
|
|
6
|
-
import '@babel/parser';
|
|
7
|
-
import '@babel/traverse';
|
|
4
|
+
import 'magic-string';
|
|
8
5
|
import './replace.mjs';
|
|
9
6
|
import '@weapp-core/escape';
|
|
10
7
|
import './shared-fd149084.mjs';
|
|
11
8
|
import '@weapp-core/regex';
|
|
12
|
-
import '
|
|
9
|
+
import '@babel/generator';
|
|
10
|
+
import '@babel/parser';
|
|
11
|
+
import '@babel/traverse';
|
|
12
|
+
import './defaults-0743f523.mjs';
|
|
13
|
+
import '@babel/types';
|
|
13
14
|
import 'postcss';
|
|
14
15
|
import './postcss-a551ddc0.mjs';
|
|
15
16
|
import 'postcss-selector-parser';
|
|
@@ -18,7 +19,7 @@ import 'node:path';
|
|
|
18
19
|
import 'node:fs';
|
|
19
20
|
import 'semver';
|
|
20
21
|
import 'tailwindcss-patch';
|
|
21
|
-
import 'tailwindcss-mangle
|
|
22
|
+
import '@tailwindcss-mangle/shared';
|
|
22
23
|
|
|
23
24
|
const Transform = stream.Transform;
|
|
24
25
|
function createPlugins(options = {}) {
|
package/dist/index.js
CHANGED
|
@@ -7,24 +7,25 @@ var vite = require('./vite.js');
|
|
|
7
7
|
var gulp = require('./gulp.js');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:fs');
|
|
10
|
-
require('./options-
|
|
10
|
+
require('./options-7a4ffa6a.js');
|
|
11
11
|
require('micromatch');
|
|
12
|
-
require('
|
|
13
|
-
require('@babel/generator');
|
|
14
|
-
require('@babel/parser');
|
|
15
|
-
require('@babel/traverse');
|
|
12
|
+
require('magic-string');
|
|
16
13
|
require('./replace.js');
|
|
17
14
|
require('@weapp-core/escape');
|
|
18
15
|
require('./shared-df9de23f.js');
|
|
19
16
|
require('@weapp-core/regex');
|
|
20
|
-
require('
|
|
17
|
+
require('@babel/generator');
|
|
18
|
+
require('@babel/parser');
|
|
19
|
+
require('@babel/traverse');
|
|
20
|
+
require('./defaults-344ba6d9.js');
|
|
21
|
+
require('@babel/types');
|
|
21
22
|
require('postcss');
|
|
22
23
|
require('./postcss-4e99a8e8.js');
|
|
23
24
|
require('postcss-selector-parser');
|
|
24
25
|
require('@csstools/postcss-is-pseudo-class');
|
|
25
26
|
require('semver');
|
|
26
27
|
require('tailwindcss-patch');
|
|
27
|
-
require('tailwindcss-mangle
|
|
28
|
+
require('@tailwindcss-mangle/shared');
|
|
28
29
|
require('node:stream');
|
|
29
30
|
|
|
30
31
|
|
package/dist/index.mjs
CHANGED
|
@@ -3,22 +3,23 @@ export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
|
3
3
|
export { createPlugins } from './gulp.mjs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:fs';
|
|
6
|
-
import './options-
|
|
6
|
+
import './options-5a3070c1.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
|
-
import '
|
|
9
|
-
import '@babel/generator';
|
|
10
|
-
import '@babel/parser';
|
|
11
|
-
import '@babel/traverse';
|
|
8
|
+
import 'magic-string';
|
|
12
9
|
import './replace.mjs';
|
|
13
10
|
import '@weapp-core/escape';
|
|
14
11
|
import './shared-fd149084.mjs';
|
|
15
12
|
import '@weapp-core/regex';
|
|
16
|
-
import '
|
|
13
|
+
import '@babel/generator';
|
|
14
|
+
import '@babel/parser';
|
|
15
|
+
import '@babel/traverse';
|
|
16
|
+
import './defaults-0743f523.mjs';
|
|
17
|
+
import '@babel/types';
|
|
17
18
|
import 'postcss';
|
|
18
19
|
import './postcss-a551ddc0.mjs';
|
|
19
20
|
import 'postcss-selector-parser';
|
|
20
21
|
import '@csstools/postcss-is-pseudo-class';
|
|
21
22
|
import 'semver';
|
|
22
23
|
import 'tailwindcss-patch';
|
|
23
|
-
import 'tailwindcss-mangle
|
|
24
|
+
import '@tailwindcss-mangle/shared';
|
|
24
25
|
import 'node:stream';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StringLiteral, TemplateElement } from '@babel/types';
|
|
2
|
+
import MagicString from 'magic-string';
|
|
3
|
+
import type { IJsHandlerOptions } from "../types";
|
|
4
|
+
export declare function regenerateHandleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions): string;
|
|
5
|
+
export declare function replaceHandleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions, ms: MagicString, offset?: number): string;
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { StringLiteral, TemplateElement } from '@babel/types';
|
|
2
1
|
import type { IJsHandlerOptions } from "../types";
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
export declare function jsHandler(rawSource: string, options: IJsHandlerOptions): import("@babel/generator").GeneratorResult | {
|
|
3
|
+
code: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function createjsHandler(options: Omit<IJsHandlerOptions, 'classNameSet'>): (rawSource: string, set: Set<string>) => import("@babel/generator").GeneratorResult | {
|
|
6
|
+
code: string;
|
|
7
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { isMatch } from 'micromatch';
|
|
2
|
-
import
|
|
2
|
+
import MagicString from 'magic-string';
|
|
3
|
+
import { replaceJs as replaceWxml } from './replace.mjs';
|
|
4
|
+
import { escapeStringRegexp, makeCustomAttributes, tagWithEitherClassAndHoverClassRegexp, templateClassExactRegexp, wxsTagRegexp, variableRegExp } from '@weapp-core/regex';
|
|
3
5
|
import generate from '@babel/generator';
|
|
4
6
|
import { parse, parseExpression } from '@babel/parser';
|
|
5
7
|
import traverse from '@babel/traverse';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import { n as noop, d as defaultOptions, i as isMap } from './defaults-702719e1.mjs';
|
|
8
|
+
import { n as noop, d as defaultOptions, i as isMap } from './defaults-0743f523.mjs';
|
|
9
|
+
import * as t from '@babel/types';
|
|
9
10
|
import postcss from 'postcss';
|
|
10
11
|
import { p as postcssWeappTailwindcss } from './postcss-a551ddc0.mjs';
|
|
11
12
|
import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
|
|
@@ -14,7 +15,7 @@ import path from 'node:path';
|
|
|
14
15
|
import fs from 'node:fs';
|
|
15
16
|
import { gte } from 'semver';
|
|
16
17
|
import { monkeyPatchForExposingContext, requireResolve, TailwindcssPatcher } from 'tailwindcss-patch';
|
|
17
|
-
import { ClassGenerator, defaultMangleClassFilter } from 'tailwindcss-mangle
|
|
18
|
+
import { ClassGenerator, defaultMangleClassFilter } from '@tailwindcss-mangle/shared';
|
|
18
19
|
|
|
19
20
|
const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
|
|
20
21
|
function isValidSelector(selector = '') {
|
|
@@ -25,9 +26,34 @@ const splitCode = (code, allowDoubleQuotes = false) => {
|
|
|
25
26
|
return code.split(splitter).filter((element) => isValidSelector(element));
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
function regenerateHandleValue(str, node, options) {
|
|
30
|
+
var _a;
|
|
31
|
+
const set = options.classNameSet;
|
|
32
|
+
const escapeMap = options.escapeMap;
|
|
33
|
+
const allowDoubleQuotes = (_a = options.arbitraryValues) === null || _a === void 0 ? void 0 : _a.allowDoubleQuotes;
|
|
34
|
+
const ctx = options.mangleContext;
|
|
35
|
+
const jsPreserveClass = options.jsPreserveClass;
|
|
36
|
+
const arr = splitCode(str, allowDoubleQuotes);
|
|
37
|
+
let rawStr = str;
|
|
38
|
+
for (const v of arr) {
|
|
39
|
+
if (set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v))) {
|
|
40
|
+
let ignoreFlag = false;
|
|
41
|
+
if (Array.isArray(node.leadingComments)) {
|
|
42
|
+
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
43
|
+
}
|
|
44
|
+
if (!ignoreFlag) {
|
|
45
|
+
if (ctx) {
|
|
46
|
+
rawStr = ctx.jsHandler(rawStr);
|
|
47
|
+
}
|
|
48
|
+
rawStr = rawStr.replaceAll(new RegExp(escapeStringRegexp(v), 'g'), replaceWxml(v, {
|
|
49
|
+
escapeMap
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return rawStr;
|
|
55
|
+
}
|
|
56
|
+
function replaceHandleValue(str, node, options, ms, offset = 1) {
|
|
31
57
|
var _a;
|
|
32
58
|
const set = options.classNameSet;
|
|
33
59
|
const escapeMap = options.escapeMap;
|
|
@@ -52,46 +78,101 @@ function handleValue(str, node, options) {
|
|
|
52
78
|
}
|
|
53
79
|
}
|
|
54
80
|
}
|
|
81
|
+
if (typeof node.start === 'number' && typeof node.end === 'number') {
|
|
82
|
+
const start = node.start + offset;
|
|
83
|
+
const end = node.end - offset;
|
|
84
|
+
if (start < end) {
|
|
85
|
+
ms.update(node.start + offset, node.end - offset, rawStr);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
55
88
|
return rawStr;
|
|
56
89
|
}
|
|
90
|
+
|
|
91
|
+
const isProd = () => process.env.NODE_ENV === 'production';
|
|
92
|
+
|
|
57
93
|
function jsHandler(rawSource, options) {
|
|
58
94
|
var _a;
|
|
59
95
|
const ast = parse(rawSource, {
|
|
60
96
|
sourceType: 'unambiguous'
|
|
61
97
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
98
|
+
if (options.strategy === 'replace') {
|
|
99
|
+
const ms = new MagicString(rawSource);
|
|
100
|
+
const ropt = {
|
|
101
|
+
StringLiteral: {
|
|
102
|
+
enter(p) {
|
|
103
|
+
const n = p.node;
|
|
104
|
+
replaceHandleValue(n.value, n, options, ms);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
TemplateElement: {
|
|
108
|
+
enter(p) {
|
|
109
|
+
const n = p.node;
|
|
110
|
+
replaceHandleValue(n.value.raw, n, options, ms, 0);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
CallExpression: {
|
|
114
|
+
enter(p) {
|
|
115
|
+
const calleePath = p.get('callee');
|
|
116
|
+
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
117
|
+
p.traverse({
|
|
118
|
+
StringLiteral: {
|
|
119
|
+
enter(s) {
|
|
120
|
+
const res = jsHandler(s.node.value, options);
|
|
121
|
+
if (res.code) {
|
|
122
|
+
s.node.value = res.code;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
73
129
|
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
130
|
+
};
|
|
131
|
+
traverse(ast, ropt);
|
|
132
|
+
return {
|
|
133
|
+
code: ms.toString()
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
const gopt = {
|
|
138
|
+
StringLiteral: {
|
|
139
|
+
enter(p) {
|
|
140
|
+
const n = p.node;
|
|
141
|
+
n.value = regenerateHandleValue(n.value, n, options);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
TemplateElement: {
|
|
145
|
+
enter(p) {
|
|
146
|
+
const n = p.node;
|
|
147
|
+
n.value.raw = regenerateHandleValue(n.value.raw, n, options);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
CallExpression: {
|
|
151
|
+
enter(p) {
|
|
152
|
+
const calleePath = p.get('callee');
|
|
153
|
+
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
154
|
+
p.traverse({
|
|
155
|
+
StringLiteral: {
|
|
156
|
+
enter(s) {
|
|
157
|
+
const res = jsHandler(s.node.value, options);
|
|
158
|
+
if (res.code) {
|
|
159
|
+
s.node.value = res.code;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
});
|
|
82
164
|
}
|
|
83
165
|
}
|
|
84
166
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
});
|
|
167
|
+
};
|
|
168
|
+
traverse(ast, gopt);
|
|
169
|
+
return generate(ast, {
|
|
170
|
+
minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
|
|
171
|
+
});
|
|
172
|
+
}
|
|
92
173
|
}
|
|
93
174
|
function createjsHandler(options) {
|
|
94
|
-
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass } = options;
|
|
175
|
+
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy } = options;
|
|
95
176
|
return (rawSource, set) => {
|
|
96
177
|
return jsHandler(rawSource, {
|
|
97
178
|
classNameSet: set,
|
|
@@ -99,7 +180,8 @@ function createjsHandler(options) {
|
|
|
99
180
|
escapeMap,
|
|
100
181
|
arbitraryValues,
|
|
101
182
|
mangleContext,
|
|
102
|
-
jsPreserveClass
|
|
183
|
+
jsPreserveClass,
|
|
184
|
+
strategy
|
|
103
185
|
});
|
|
104
186
|
};
|
|
105
187
|
}
|
|
@@ -508,7 +590,7 @@ function getOptions(options = {}) {
|
|
|
508
590
|
const result = defu(options, defaultOptions, {
|
|
509
591
|
minifiedJs: isProd()
|
|
510
592
|
});
|
|
511
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler } = result;
|
|
593
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy } = result;
|
|
512
594
|
result.escapeMap = customReplaceDictionary;
|
|
513
595
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
514
596
|
const customAttributesEntities = isMap(options.customAttributes)
|
|
@@ -533,7 +615,8 @@ function getOptions(options = {}) {
|
|
|
533
615
|
escapeMap,
|
|
534
616
|
mangleContext,
|
|
535
617
|
arbitraryValues,
|
|
536
|
-
jsPreserveClass
|
|
618
|
+
jsPreserveClass,
|
|
619
|
+
strategy: jsEscapeStrategy
|
|
537
620
|
});
|
|
538
621
|
result.jsHandler = jsHandler;
|
|
539
622
|
const templateHandler = createTemplateHandler({
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var micromatch = require('micromatch');
|
|
4
|
-
var
|
|
4
|
+
var MagicString = require('magic-string');
|
|
5
|
+
var replace = require('./replace.js');
|
|
6
|
+
var regex = require('@weapp-core/regex');
|
|
5
7
|
var generate = require('@babel/generator');
|
|
6
8
|
var parser = require('@babel/parser');
|
|
7
9
|
var traverse = require('@babel/traverse');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var defaults = require('./defaults-28cfeec8.js');
|
|
10
|
+
var defaults = require('./defaults-344ba6d9.js');
|
|
11
|
+
var t = require('@babel/types');
|
|
11
12
|
var postcss = require('postcss');
|
|
12
13
|
var postcss$1 = require('./postcss-4e99a8e8.js');
|
|
13
14
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
@@ -16,7 +17,7 @@ var path = require('node:path');
|
|
|
16
17
|
var fs = require('node:fs');
|
|
17
18
|
var semver = require('semver');
|
|
18
19
|
var tailwindcssPatch = require('tailwindcss-patch');
|
|
19
|
-
var
|
|
20
|
+
var shared = require('@tailwindcss-mangle/shared');
|
|
20
21
|
|
|
21
22
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
23
|
|
|
@@ -38,9 +39,10 @@ function _interopNamespaceCompat(e) {
|
|
|
38
39
|
return Object.freeze(n);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
var
|
|
42
|
+
var MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
42
43
|
var generate__default = /*#__PURE__*/_interopDefaultCompat(generate);
|
|
43
44
|
var traverse__default = /*#__PURE__*/_interopDefaultCompat(traverse);
|
|
45
|
+
var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
|
|
44
46
|
var postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
|
|
45
47
|
var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
|
|
46
48
|
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
@@ -55,9 +57,34 @@ const splitCode = (code, allowDoubleQuotes = false) => {
|
|
|
55
57
|
return code.split(splitter).filter((element) => isValidSelector(element));
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
function regenerateHandleValue(str, node, options) {
|
|
61
|
+
var _a;
|
|
62
|
+
const set = options.classNameSet;
|
|
63
|
+
const escapeMap = options.escapeMap;
|
|
64
|
+
const allowDoubleQuotes = (_a = options.arbitraryValues) === null || _a === void 0 ? void 0 : _a.allowDoubleQuotes;
|
|
65
|
+
const ctx = options.mangleContext;
|
|
66
|
+
const jsPreserveClass = options.jsPreserveClass;
|
|
67
|
+
const arr = splitCode(str, allowDoubleQuotes);
|
|
68
|
+
let rawStr = str;
|
|
69
|
+
for (const v of arr) {
|
|
70
|
+
if (set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v))) {
|
|
71
|
+
let ignoreFlag = false;
|
|
72
|
+
if (Array.isArray(node.leadingComments)) {
|
|
73
|
+
ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
|
|
74
|
+
}
|
|
75
|
+
if (!ignoreFlag) {
|
|
76
|
+
if (ctx) {
|
|
77
|
+
rawStr = ctx.jsHandler(rawStr);
|
|
78
|
+
}
|
|
79
|
+
rawStr = rawStr.replaceAll(new RegExp(regex.escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
|
|
80
|
+
escapeMap
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return rawStr;
|
|
86
|
+
}
|
|
87
|
+
function replaceHandleValue(str, node, options, ms, offset = 1) {
|
|
61
88
|
var _a;
|
|
62
89
|
const set = options.classNameSet;
|
|
63
90
|
const escapeMap = options.escapeMap;
|
|
@@ -82,46 +109,101 @@ function handleValue(str, node, options) {
|
|
|
82
109
|
}
|
|
83
110
|
}
|
|
84
111
|
}
|
|
112
|
+
if (typeof node.start === 'number' && typeof node.end === 'number') {
|
|
113
|
+
const start = node.start + offset;
|
|
114
|
+
const end = node.end - offset;
|
|
115
|
+
if (start < end) {
|
|
116
|
+
ms.update(node.start + offset, node.end - offset, rawStr);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
85
119
|
return rawStr;
|
|
86
120
|
}
|
|
121
|
+
|
|
122
|
+
const isProd = () => process.env.NODE_ENV === 'production';
|
|
123
|
+
|
|
87
124
|
function jsHandler(rawSource, options) {
|
|
88
125
|
var _a;
|
|
89
126
|
const ast = parser.parse(rawSource, {
|
|
90
127
|
sourceType: 'unambiguous'
|
|
91
128
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
129
|
+
if (options.strategy === 'replace') {
|
|
130
|
+
const ms = new MagicString__default["default"](rawSource);
|
|
131
|
+
const ropt = {
|
|
132
|
+
StringLiteral: {
|
|
133
|
+
enter(p) {
|
|
134
|
+
const n = p.node;
|
|
135
|
+
replaceHandleValue(n.value, n, options, ms);
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
TemplateElement: {
|
|
139
|
+
enter(p) {
|
|
140
|
+
const n = p.node;
|
|
141
|
+
replaceHandleValue(n.value.raw, n, options, ms, 0);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
CallExpression: {
|
|
145
|
+
enter(p) {
|
|
146
|
+
const calleePath = p.get('callee');
|
|
147
|
+
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
148
|
+
p.traverse({
|
|
149
|
+
StringLiteral: {
|
|
150
|
+
enter(s) {
|
|
151
|
+
const res = jsHandler(s.node.value, options);
|
|
152
|
+
if (res.code) {
|
|
153
|
+
s.node.value = res.code;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
103
160
|
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
161
|
+
};
|
|
162
|
+
traverse__default["default"](ast, ropt);
|
|
163
|
+
return {
|
|
164
|
+
code: ms.toString()
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const gopt = {
|
|
169
|
+
StringLiteral: {
|
|
170
|
+
enter(p) {
|
|
171
|
+
const n = p.node;
|
|
172
|
+
n.value = regenerateHandleValue(n.value, n, options);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
TemplateElement: {
|
|
176
|
+
enter(p) {
|
|
177
|
+
const n = p.node;
|
|
178
|
+
n.value.raw = regenerateHandleValue(n.value.raw, n, options);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
CallExpression: {
|
|
182
|
+
enter(p) {
|
|
183
|
+
const calleePath = p.get('callee');
|
|
184
|
+
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
185
|
+
p.traverse({
|
|
186
|
+
StringLiteral: {
|
|
187
|
+
enter(s) {
|
|
188
|
+
const res = jsHandler(s.node.value, options);
|
|
189
|
+
if (res.code) {
|
|
190
|
+
s.node.value = res.code;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
});
|
|
112
195
|
}
|
|
113
196
|
}
|
|
114
197
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
198
|
+
};
|
|
199
|
+
traverse__default["default"](ast, gopt);
|
|
200
|
+
return generate__default["default"](ast, {
|
|
201
|
+
minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
|
|
202
|
+
});
|
|
203
|
+
}
|
|
122
204
|
}
|
|
123
205
|
function createjsHandler(options) {
|
|
124
|
-
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass } = options;
|
|
206
|
+
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy } = options;
|
|
125
207
|
return (rawSource, set) => {
|
|
126
208
|
return jsHandler(rawSource, {
|
|
127
209
|
classNameSet: set,
|
|
@@ -129,7 +211,8 @@ function createjsHandler(options) {
|
|
|
129
211
|
escapeMap,
|
|
130
212
|
arbitraryValues,
|
|
131
213
|
mangleContext,
|
|
132
|
-
jsPreserveClass
|
|
214
|
+
jsPreserveClass,
|
|
215
|
+
strategy
|
|
133
216
|
});
|
|
134
217
|
};
|
|
135
218
|
}
|
|
@@ -450,8 +533,8 @@ function getSelf(x) {
|
|
|
450
533
|
const defaultMangleContext = {
|
|
451
534
|
rawOptions: false,
|
|
452
535
|
runtimeSet: new Set(),
|
|
453
|
-
classGenerator: new
|
|
454
|
-
filter:
|
|
536
|
+
classGenerator: new shared.ClassGenerator(),
|
|
537
|
+
filter: shared.defaultMangleClassFilter,
|
|
455
538
|
cssHandler: getSelf,
|
|
456
539
|
jsHandler: getSelf,
|
|
457
540
|
wxmlHandler: getSelf
|
|
@@ -477,11 +560,11 @@ function useMangleStore() {
|
|
|
477
560
|
if (options === true) {
|
|
478
561
|
options = {
|
|
479
562
|
classGenerator: {},
|
|
480
|
-
mangleClassFilter:
|
|
563
|
+
mangleClassFilter: shared.defaultMangleClassFilter
|
|
481
564
|
};
|
|
482
565
|
}
|
|
483
|
-
ctx.classGenerator = new
|
|
484
|
-
ctx.filter = (_a = options.mangleClassFilter) !== null && _a !== void 0 ? _a :
|
|
566
|
+
ctx.classGenerator = new shared.ClassGenerator(options.classGenerator);
|
|
567
|
+
ctx.filter = (_a = options.mangleClassFilter) !== null && _a !== void 0 ? _a : shared.defaultMangleClassFilter;
|
|
485
568
|
ctx.jsHandler = (rawSource) => {
|
|
486
569
|
return handleValue(rawSource);
|
|
487
570
|
};
|
|
@@ -538,7 +621,7 @@ function getOptions(options = {}) {
|
|
|
538
621
|
const result = defu(options, defaults.defaultOptions, {
|
|
539
622
|
minifiedJs: isProd()
|
|
540
623
|
});
|
|
541
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler } = result;
|
|
624
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy } = result;
|
|
542
625
|
result.escapeMap = customReplaceDictionary;
|
|
543
626
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
544
627
|
const customAttributesEntities = defaults.isMap(options.customAttributes)
|
|
@@ -563,7 +646,8 @@ function getOptions(options = {}) {
|
|
|
563
646
|
escapeMap,
|
|
564
647
|
mangleContext,
|
|
565
648
|
arbitraryValues,
|
|
566
|
-
jsPreserveClass
|
|
649
|
+
jsPreserveClass,
|
|
650
|
+
strategy: jsEscapeStrategy
|
|
567
651
|
});
|
|
568
652
|
result.jsHandler = jsHandler;
|
|
569
653
|
const templateHandler = createTemplateHandler({
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Rule } from 'postcss';
|
|
2
|
-
import type { IClassGeneratorOptions, ClassGenerator } from 'tailwindcss-mangle
|
|
3
|
-
import type { GeneratorResult } from '@babel/generator';
|
|
2
|
+
import type { IClassGeneratorOptions, ClassGenerator } from '@tailwindcss-mangle/shared';
|
|
4
3
|
import type { InjectPreflight } from './postcss/preflight';
|
|
5
4
|
export type ItemOrItemArray<T> = T | T[];
|
|
6
5
|
export type AppType = 'uni-app' | 'uni-app-vite' | 'taro' | 'remax' | 'rax' | 'native' | 'kbone' | 'mpx';
|
|
@@ -39,6 +38,7 @@ export type IJsHandlerOptions = {
|
|
|
39
38
|
arbitraryValues?: IArbitraryValues;
|
|
40
39
|
mangleContext?: IMangleScopeContext;
|
|
41
40
|
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
41
|
+
strategy?: UserDefinedOptions['jsEscapeStrategy'];
|
|
42
42
|
};
|
|
43
43
|
export interface RawSource {
|
|
44
44
|
start: number;
|
|
@@ -94,6 +94,7 @@ export interface UserDefinedOptions {
|
|
|
94
94
|
injectAdditionalCssVarScope?: boolean;
|
|
95
95
|
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
96
96
|
disabledDefaultTemplateHandler?: boolean;
|
|
97
|
+
jsEscapeStrategy?: 'regenerate' | 'replace';
|
|
97
98
|
}
|
|
98
99
|
export interface IMangleScopeContext {
|
|
99
100
|
rawOptions: UserDefinedOptions['mangle'];
|
|
@@ -113,7 +114,9 @@ export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
|
113
114
|
escapeMap?: Record<string, string>;
|
|
114
115
|
mangleContext?: IMangleScopeContext;
|
|
115
116
|
inlineWxs?: boolean;
|
|
116
|
-
jsHandler?: (rawSource: string, set: Set<string>) =>
|
|
117
|
+
jsHandler?: (rawSource: string, set: Set<string>) => {
|
|
118
|
+
code: string;
|
|
119
|
+
};
|
|
117
120
|
runtimeSet?: Set<string>;
|
|
118
121
|
disabledDefaultTemplateHandler?: boolean;
|
|
119
122
|
}
|
|
@@ -124,7 +127,9 @@ export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, GlobO
|
|
|
124
127
|
supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | false;
|
|
125
128
|
templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => string;
|
|
126
129
|
styleHandler: (rawSource: string, options: IStyleHandlerOptions) => string;
|
|
127
|
-
jsHandler: (rawSource: string, set: Set<string>) =>
|
|
130
|
+
jsHandler: (rawSource: string, set: Set<string>) => {
|
|
131
|
+
code: string;
|
|
132
|
+
};
|
|
128
133
|
escapeMap: Record<string, string>;
|
|
129
134
|
patch: () => void;
|
|
130
135
|
customReplaceDictionary: Record<string, string>;
|
package/dist/vite.js
CHANGED
|
@@ -2,25 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-7a4ffa6a.js');
|
|
6
6
|
var postcss = require('./postcss-4e99a8e8.js');
|
|
7
|
-
var defaults = require('./defaults-
|
|
7
|
+
var defaults = require('./defaults-344ba6d9.js');
|
|
8
8
|
require('micromatch');
|
|
9
|
-
require('
|
|
10
|
-
require('@babel/generator');
|
|
11
|
-
require('@babel/parser');
|
|
12
|
-
require('@babel/traverse');
|
|
9
|
+
require('magic-string');
|
|
13
10
|
require('./replace.js');
|
|
14
11
|
require('@weapp-core/escape');
|
|
15
12
|
require('./shared-df9de23f.js');
|
|
16
13
|
require('@weapp-core/regex');
|
|
14
|
+
require('@babel/generator');
|
|
15
|
+
require('@babel/parser');
|
|
16
|
+
require('@babel/traverse');
|
|
17
|
+
require('@babel/types');
|
|
17
18
|
require('postcss');
|
|
18
19
|
require('@csstools/postcss-is-pseudo-class');
|
|
19
20
|
require('node:path');
|
|
20
21
|
require('node:fs');
|
|
21
22
|
require('semver');
|
|
22
23
|
require('tailwindcss-patch');
|
|
23
|
-
require('tailwindcss-mangle
|
|
24
|
+
require('@tailwindcss-mangle/shared');
|
|
24
25
|
require('postcss-selector-parser');
|
|
25
26
|
|
|
26
27
|
function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
package/dist/vite.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-5a3070c1.mjs';
|
|
2
2
|
import { v as vitePluginName } from './postcss-a551ddc0.mjs';
|
|
3
|
-
import { g as getGroupedEntries } from './defaults-
|
|
3
|
+
import { g as getGroupedEntries } from './defaults-0743f523.mjs';
|
|
4
4
|
import 'micromatch';
|
|
5
|
-
import '
|
|
6
|
-
import '@babel/generator';
|
|
7
|
-
import '@babel/parser';
|
|
8
|
-
import '@babel/traverse';
|
|
5
|
+
import 'magic-string';
|
|
9
6
|
import './replace.mjs';
|
|
10
7
|
import '@weapp-core/escape';
|
|
11
8
|
import './shared-fd149084.mjs';
|
|
12
9
|
import '@weapp-core/regex';
|
|
10
|
+
import '@babel/generator';
|
|
11
|
+
import '@babel/parser';
|
|
12
|
+
import '@babel/traverse';
|
|
13
|
+
import '@babel/types';
|
|
13
14
|
import 'postcss';
|
|
14
15
|
import '@csstools/postcss-is-pseudo-class';
|
|
15
16
|
import 'node:path';
|
|
16
17
|
import 'node:fs';
|
|
17
18
|
import 'semver';
|
|
18
19
|
import 'tailwindcss-patch';
|
|
19
|
-
import 'tailwindcss-mangle
|
|
20
|
+
import '@tailwindcss-mangle/shared';
|
|
20
21
|
import 'postcss-selector-parser';
|
|
21
22
|
|
|
22
23
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
package/dist/webpack.js
CHANGED
|
@@ -4,23 +4,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
|
-
var options = require('./options-
|
|
7
|
+
var options = require('./options-7a4ffa6a.js');
|
|
8
8
|
var postcss = require('./postcss-4e99a8e8.js');
|
|
9
|
-
var defaults = require('./defaults-
|
|
9
|
+
var defaults = require('./defaults-344ba6d9.js');
|
|
10
10
|
require('micromatch');
|
|
11
|
-
require('
|
|
12
|
-
require('@babel/generator');
|
|
13
|
-
require('@babel/parser');
|
|
14
|
-
require('@babel/traverse');
|
|
11
|
+
require('magic-string');
|
|
15
12
|
require('./replace.js');
|
|
16
13
|
require('@weapp-core/escape');
|
|
17
14
|
require('./shared-df9de23f.js');
|
|
18
15
|
require('@weapp-core/regex');
|
|
16
|
+
require('@babel/generator');
|
|
17
|
+
require('@babel/parser');
|
|
18
|
+
require('@babel/traverse');
|
|
19
|
+
require('@babel/types');
|
|
19
20
|
require('postcss');
|
|
20
21
|
require('@csstools/postcss-is-pseudo-class');
|
|
21
22
|
require('semver');
|
|
22
23
|
require('tailwindcss-patch');
|
|
23
|
-
require('tailwindcss-mangle
|
|
24
|
+
require('@tailwindcss-mangle/shared');
|
|
24
25
|
require('postcss-selector-parser');
|
|
25
26
|
|
|
26
27
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
3
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-5a3070c1.mjs';
|
|
4
4
|
import { a as pluginName } from './postcss-a551ddc0.mjs';
|
|
5
|
-
import { g as getGroupedEntries } from './defaults-
|
|
5
|
+
import { g as getGroupedEntries } from './defaults-0743f523.mjs';
|
|
6
6
|
import 'micromatch';
|
|
7
|
-
import '
|
|
8
|
-
import '@babel/generator';
|
|
9
|
-
import '@babel/parser';
|
|
10
|
-
import '@babel/traverse';
|
|
7
|
+
import 'magic-string';
|
|
11
8
|
import './replace.mjs';
|
|
12
9
|
import '@weapp-core/escape';
|
|
13
10
|
import './shared-fd149084.mjs';
|
|
14
11
|
import '@weapp-core/regex';
|
|
12
|
+
import '@babel/generator';
|
|
13
|
+
import '@babel/parser';
|
|
14
|
+
import '@babel/traverse';
|
|
15
|
+
import '@babel/types';
|
|
15
16
|
import 'postcss';
|
|
16
17
|
import '@csstools/postcss-is-pseudo-class';
|
|
17
18
|
import 'semver';
|
|
18
19
|
import 'tailwindcss-patch';
|
|
19
|
-
import 'tailwindcss-mangle
|
|
20
|
+
import '@tailwindcss-mangle/shared';
|
|
20
21
|
import 'postcss-selector-parser';
|
|
21
22
|
|
|
22
23
|
class UnifiedWebpackPluginV5 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "把tailwindcss jit引擎,带给小程序开发者们\nbring tailwindcss jit engine to our miniprogram developers!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
},
|
|
103
103
|
"homepage": "https://weapp-tw.icebreaker.top",
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@babel/core": "^7.22.
|
|
106
|
-
"@icebreakers/cli": "
|
|
105
|
+
"@babel/core": "^7.22.10",
|
|
106
|
+
"@icebreakers/cli": "0.1.1",
|
|
107
107
|
"@icebreakers/readme": "0.1.0",
|
|
108
108
|
"@rollup/plugin-alias": "^5.0.0",
|
|
109
109
|
"@rollup/plugin-commonjs": "^25.0.3",
|
|
@@ -118,46 +118,49 @@
|
|
|
118
118
|
"@types/gulp": "^4.0.13",
|
|
119
119
|
"@types/gulp-postcss": "^8.0.3",
|
|
120
120
|
"@types/jest": "^29.5.3",
|
|
121
|
+
"@types/js-beautify": "^1.14.0",
|
|
121
122
|
"@types/klaw": "^3.0.3",
|
|
122
123
|
"@types/loader-utils": "^2.0.3",
|
|
123
|
-
"@types/lodash": "^4.14.
|
|
124
|
+
"@types/lodash": "^4.14.197",
|
|
124
125
|
"@types/micromatch": "^4.0.2",
|
|
125
|
-
"@types/node": "^20.4.
|
|
126
|
+
"@types/node": "^20.4.9",
|
|
126
127
|
"@types/semver": "^7.5.0",
|
|
127
128
|
"@types/vinyl": "^2.0.7",
|
|
128
129
|
"@types/webpack": "^5.28.1",
|
|
129
130
|
"@types/webpack-sources": "^3.2.0",
|
|
130
|
-
"@vitest/coverage-v8": "^0.
|
|
131
|
+
"@vitest/coverage-v8": "^0.34.1",
|
|
131
132
|
"autoprefixer": "^10.4.14",
|
|
132
133
|
"babel-loader": "^9.1.3",
|
|
133
134
|
"bumpp": "^9.1.1",
|
|
134
135
|
"colorette": "^2.0.20",
|
|
135
136
|
"cross-env": "^7.0.3",
|
|
136
137
|
"css-loader": "^6.8.1",
|
|
138
|
+
"dedent": "^1.5.1",
|
|
137
139
|
"defu": "6.1.2",
|
|
138
140
|
"del": "^7.0.0",
|
|
139
|
-
"eslint": "8.
|
|
141
|
+
"eslint": "8.46.0",
|
|
140
142
|
"eslint-config-icebreaker": "^1.2.2",
|
|
141
|
-
"eslint-config-prettier": "^
|
|
142
|
-
"eslint-plugin-prettier": "^
|
|
143
|
+
"eslint-config-prettier": "^9.0.0",
|
|
144
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
145
|
+
"execa": "^7.2.0",
|
|
143
146
|
"fast-glob": "^3.3.1",
|
|
144
147
|
"fs-extra": "^11.1.1",
|
|
145
148
|
"gulp": "^4.0.2",
|
|
146
149
|
"gulp-postcss": "^9.0.1",
|
|
147
150
|
"html-loader": "^4.2.0",
|
|
148
|
-
"jest": "^29.6.
|
|
151
|
+
"jest": "^29.6.2",
|
|
152
|
+
"js-beautify": "^1.14.9",
|
|
149
153
|
"klaw": "^4.1.0",
|
|
150
154
|
"lodash": "^4.17.21",
|
|
151
|
-
"magic-string": "^0.30.1",
|
|
152
155
|
"mini-css-extract-plugin": "^2.7.6",
|
|
153
156
|
"miniprogram-automator": "^0.12.0",
|
|
154
157
|
"pkg-types": "^1.0.3",
|
|
155
158
|
"postcss-load-config": "^4.0.1",
|
|
156
159
|
"postcss-loader": "^7.3.3",
|
|
157
160
|
"postcss-rem-to-responsive-pixel": "^5.1.3",
|
|
158
|
-
"prettier": "^
|
|
161
|
+
"prettier": "^3.0.1",
|
|
159
162
|
"promisify-loader-runner": "^1.0.0",
|
|
160
|
-
"rollup": "^3.
|
|
163
|
+
"rollup": "^3.28.0",
|
|
161
164
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
162
165
|
"style-loader": "^3.3.3",
|
|
163
166
|
"tailwind-children": "^0.5.0",
|
|
@@ -170,27 +173,28 @@
|
|
|
170
173
|
"typescript": "^5.1.6",
|
|
171
174
|
"typescript-transform-paths": "^3.4.6",
|
|
172
175
|
"vinyl": "^3.0.0",
|
|
173
|
-
"vite": "^4.4.
|
|
174
|
-
"vitest": "^0.
|
|
176
|
+
"vite": "^4.4.9",
|
|
177
|
+
"vitest": "^0.34.1",
|
|
175
178
|
"weapp-tailwindcss-children": "^0.1.0",
|
|
176
179
|
"webpack": "^5.88.2",
|
|
177
180
|
"webpack-build-utils": "^0.0.4"
|
|
178
181
|
},
|
|
179
182
|
"dependencies": {
|
|
180
|
-
"@babel/generator": "^7.22.
|
|
181
|
-
"@babel/parser": "^7.22.
|
|
182
|
-
"@babel/traverse": "^7.22.
|
|
183
|
-
"@babel/types": "^7.22.
|
|
183
|
+
"@babel/generator": "^7.22.10",
|
|
184
|
+
"@babel/parser": "^7.22.10",
|
|
185
|
+
"@babel/traverse": "^7.22.10",
|
|
186
|
+
"@babel/types": "^7.22.10",
|
|
184
187
|
"@csstools/postcss-is-pseudo-class": "^4.0.0",
|
|
188
|
+
"@tailwindcss-mangle/shared": "^2.0.4",
|
|
185
189
|
"@weapp-core/escape": "^1.0.0",
|
|
186
190
|
"@weapp-core/regex": "^1.0.0",
|
|
187
191
|
"loader-utils": "^2.0.3",
|
|
192
|
+
"magic-string": "^0.30.2",
|
|
188
193
|
"micromatch": "^4.0.5",
|
|
189
194
|
"postcss": "8.4.27",
|
|
190
195
|
"postcss-selector-parser": "^6.0.13",
|
|
191
196
|
"semver": "^7.5.4",
|
|
192
|
-
"tailwindcss-
|
|
193
|
-
"tailwindcss-patch": "^1.2.7"
|
|
197
|
+
"tailwindcss-patch": "^2.0.4"
|
|
194
198
|
},
|
|
195
199
|
"packageManager": "pnpm@8.6.9",
|
|
196
200
|
"scripts": {
|