weapp-tailwindcss 2.5.2 → 2.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/README.md +2 -8
- package/dist/cli.js +5 -3
- package/dist/cli.mjs +5 -3
- package/dist/defaults-0d9846f4.js +139 -0
- package/dist/defaults-c7f00aae.mjs +133 -0
- package/dist/defaults.js +10 -0
- package/dist/defaults.mjs +2 -0
- package/dist/{shared-ae7dd073.js → dic-05980807.js} +0 -58
- package/dist/{shared-7c88fb94.mjs → dic-3790a3a4.mjs} +1 -57
- package/dist/gulp.js +5 -3
- package/dist/gulp.mjs +5 -3
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/dist/{options-ad127e0c.js → options-6a265426.js} +21 -140
- package/dist/{options-1e3a224a.mjs → options-800ea85a.mjs} +14 -132
- package/dist/postcss/cssVars.d.ts +5 -0
- package/dist/postcss/mp.d.ts +4 -0
- package/dist/postcss-53e2ad95.mjs +351 -0
- package/dist/postcss-cf8b998a.js +359 -0
- package/dist/postcss.js +3 -2
- package/dist/postcss.mjs +3 -2
- package/dist/replace.js +8 -7
- package/dist/replace.mjs +4 -2
- package/dist/shared-4eed0e5c.js +62 -0
- package/dist/shared-686bfc32.mjs +59 -0
- package/dist/types.d.ts +4 -0
- package/dist/vite.js +6 -4
- package/dist/vite.mjs +5 -3
- package/dist/webpack.js +6 -4
- package/dist/webpack.mjs +5 -3
- package/package.json +37 -31
- package/dist/postcss-9a63df9d.mjs +0 -115
- package/dist/postcss-fbdc673b.js +0 -123
package/dist/postcss.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { p as postcssWeappTailwindcss } from './postcss-
|
|
1
|
+
export { p as postcssWeappTailwindcss } from './postcss-53e2ad95.mjs';
|
|
2
2
|
export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
|
|
3
3
|
import 'postcss-selector-parser';
|
|
4
|
-
import './shared-
|
|
4
|
+
import './shared-686bfc32.mjs';
|
|
5
|
+
import './dic-3790a3a4.mjs';
|
|
5
6
|
import 'postcss';
|
package/dist/replace.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var dic = require('./dic-05980807.js');
|
|
6
|
+
var shared = require('./shared-4eed0e5c.js');
|
|
6
7
|
|
|
7
8
|
function replaceWxml(original, options = {
|
|
8
9
|
keepEOL: false,
|
|
9
|
-
escapeMap:
|
|
10
|
+
escapeMap: dic.SimpleMappingChars2String
|
|
10
11
|
}) {
|
|
11
12
|
const { keepEOL, escapeMap, mangleContext } = options;
|
|
12
13
|
let res = original;
|
|
@@ -23,10 +24,10 @@ function replaceWxml(original, options = {
|
|
|
23
24
|
return res;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
exports.MappingChars2String =
|
|
27
|
-
exports.MappingChars2StringEntries =
|
|
28
|
-
exports.SYMBOL_TABLE =
|
|
29
|
-
exports.SimpleMappingChars2String =
|
|
30
|
-
exports.SimpleMappingChars2StringEntries =
|
|
27
|
+
exports.MappingChars2String = dic.MappingChars2String;
|
|
28
|
+
exports.MappingChars2StringEntries = dic.MappingChars2StringEntries;
|
|
29
|
+
exports.SYMBOL_TABLE = dic.SYMBOL_TABLE;
|
|
30
|
+
exports.SimpleMappingChars2String = dic.SimpleMappingChars2String;
|
|
31
|
+
exports.SimpleMappingChars2StringEntries = dic.SimpleMappingChars2StringEntries;
|
|
31
32
|
exports.replaceCss = shared.internalCssSelectorReplacer;
|
|
32
33
|
exports.replaceJs = replaceWxml;
|
package/dist/replace.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { M as MappingChars2String, b as MappingChars2StringEntries, a as SYMBOL_TABLE, c as SimpleMappingChars2StringEntries
|
|
1
|
+
import { S as SimpleMappingChars2String } from './dic-3790a3a4.mjs';
|
|
2
|
+
export { M as MappingChars2String, b as MappingChars2StringEntries, a as SYMBOL_TABLE, c as SimpleMappingChars2StringEntries } from './dic-3790a3a4.mjs';
|
|
3
|
+
import { e as escape } from './shared-686bfc32.mjs';
|
|
4
|
+
export { i as replaceCss } from './shared-686bfc32.mjs';
|
|
3
5
|
|
|
4
6
|
function replaceWxml(original, options = {
|
|
5
7
|
keepEOL: false,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dic = require('./dic-05980807.js');
|
|
4
|
+
|
|
5
|
+
const MAX_ASCII_CHAR_CODE = 127;
|
|
6
|
+
function isAsciiNumber(code) {
|
|
7
|
+
return code >= 48 && code <= 57;
|
|
8
|
+
}
|
|
9
|
+
function escape(selectors, options = {
|
|
10
|
+
map: dic.SimpleMappingChars2String
|
|
11
|
+
}) {
|
|
12
|
+
const { map = dic.SimpleMappingChars2String } = options;
|
|
13
|
+
const sb = [...selectors];
|
|
14
|
+
for (let i = 0; i < sb.length; i++) {
|
|
15
|
+
const char = sb[i];
|
|
16
|
+
const code = char.codePointAt(0);
|
|
17
|
+
const isCodeExisted = code !== undefined;
|
|
18
|
+
const hit = map[char];
|
|
19
|
+
if (isCodeExisted) {
|
|
20
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
21
|
+
sb[i] = 'u' + Number(code).toString(16);
|
|
22
|
+
}
|
|
23
|
+
else if (hit) {
|
|
24
|
+
sb[i] = hit;
|
|
25
|
+
}
|
|
26
|
+
else if (i === 0) {
|
|
27
|
+
if (isAsciiNumber(code)) {
|
|
28
|
+
sb[i] = '_' + char;
|
|
29
|
+
}
|
|
30
|
+
else if (char === '-') {
|
|
31
|
+
const nextChar = sb[i + 1];
|
|
32
|
+
if (nextChar) {
|
|
33
|
+
const nextCharCode = nextChar.codePointAt(0);
|
|
34
|
+
if (nextCharCode && isAsciiNumber(nextCharCode)) {
|
|
35
|
+
sb[i] = '_' + char;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (nextChar === undefined) {
|
|
39
|
+
sb[i] = '_' + char;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const res = sb.join('');
|
|
46
|
+
return res;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function internalCssSelectorReplacer(selectors, options = {
|
|
50
|
+
escapeMap: dic.SimpleMappingChars2String
|
|
51
|
+
}) {
|
|
52
|
+
const { mangleContext, escapeMap } = options;
|
|
53
|
+
if (mangleContext) {
|
|
54
|
+
selectors = mangleContext.cssHandler(selectors);
|
|
55
|
+
}
|
|
56
|
+
return escape(selectors, {
|
|
57
|
+
map: escapeMap
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.escape = escape;
|
|
62
|
+
exports.internalCssSelectorReplacer = internalCssSelectorReplacer;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { S as SimpleMappingChars2String } from './dic-3790a3a4.mjs';
|
|
2
|
+
|
|
3
|
+
const MAX_ASCII_CHAR_CODE = 127;
|
|
4
|
+
function isAsciiNumber(code) {
|
|
5
|
+
return code >= 48 && code <= 57;
|
|
6
|
+
}
|
|
7
|
+
function escape(selectors, options = {
|
|
8
|
+
map: SimpleMappingChars2String
|
|
9
|
+
}) {
|
|
10
|
+
const { map = SimpleMappingChars2String } = options;
|
|
11
|
+
const sb = [...selectors];
|
|
12
|
+
for (let i = 0; i < sb.length; i++) {
|
|
13
|
+
const char = sb[i];
|
|
14
|
+
const code = char.codePointAt(0);
|
|
15
|
+
const isCodeExisted = code !== undefined;
|
|
16
|
+
const hit = map[char];
|
|
17
|
+
if (isCodeExisted) {
|
|
18
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
19
|
+
sb[i] = 'u' + Number(code).toString(16);
|
|
20
|
+
}
|
|
21
|
+
else if (hit) {
|
|
22
|
+
sb[i] = hit;
|
|
23
|
+
}
|
|
24
|
+
else if (i === 0) {
|
|
25
|
+
if (isAsciiNumber(code)) {
|
|
26
|
+
sb[i] = '_' + char;
|
|
27
|
+
}
|
|
28
|
+
else if (char === '-') {
|
|
29
|
+
const nextChar = sb[i + 1];
|
|
30
|
+
if (nextChar) {
|
|
31
|
+
const nextCharCode = nextChar.codePointAt(0);
|
|
32
|
+
if (nextCharCode && isAsciiNumber(nextCharCode)) {
|
|
33
|
+
sb[i] = '_' + char;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (nextChar === undefined) {
|
|
37
|
+
sb[i] = '_' + char;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const res = sb.join('');
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function internalCssSelectorReplacer(selectors, options = {
|
|
48
|
+
escapeMap: SimpleMappingChars2String
|
|
49
|
+
}) {
|
|
50
|
+
const { mangleContext, escapeMap } = options;
|
|
51
|
+
if (mangleContext) {
|
|
52
|
+
selectors = mangleContext.cssHandler(selectors);
|
|
53
|
+
}
|
|
54
|
+
return escape(selectors, {
|
|
55
|
+
map: escapeMap
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { escape as e, internalCssSelectorReplacer as i };
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type RequiredStyleHandlerOptions = {
|
|
|
19
19
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
20
20
|
replaceUniversalSelectorWith?: string | false;
|
|
21
21
|
escapeMap?: Record<string, string>;
|
|
22
|
+
injectAdditionalCssVarScope?: boolean;
|
|
22
23
|
};
|
|
23
24
|
export type CustomRuleCallback = (node: Rule, options: Readonly<RequiredStyleHandlerOptions>) => void;
|
|
24
25
|
export interface InternalCssSelectorReplacerOptions {
|
|
@@ -37,6 +38,7 @@ export type IJsHandlerOptions = {
|
|
|
37
38
|
minifiedJs?: boolean;
|
|
38
39
|
arbitraryValues?: IArbitraryValues;
|
|
39
40
|
mangleContext?: IMangleScopeContext;
|
|
41
|
+
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
40
42
|
};
|
|
41
43
|
export interface RawSource {
|
|
42
44
|
start: number;
|
|
@@ -89,6 +91,8 @@ export interface UserDefinedOptions {
|
|
|
89
91
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
90
92
|
wxsMatcher?: ((name: string) => boolean) | string | string[];
|
|
91
93
|
inlineWxs?: boolean;
|
|
94
|
+
injectAdditionalCssVarScope?: boolean;
|
|
95
|
+
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
92
96
|
}
|
|
93
97
|
export interface IMangleScopeContext {
|
|
94
98
|
rawOptions: UserDefinedOptions['mangle'];
|
package/dist/vite.js
CHANGED
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
6
|
-
var postcss = require('./postcss-
|
|
5
|
+
var options = require('./options-6a265426.js');
|
|
6
|
+
var postcss = require('./postcss-cf8b998a.js');
|
|
7
|
+
var defaults = require('./defaults-0d9846f4.js');
|
|
7
8
|
require('micromatch');
|
|
8
9
|
require('@babel/types');
|
|
9
10
|
require('@babel/generator');
|
|
10
11
|
require('@babel/parser');
|
|
11
12
|
require('@babel/traverse');
|
|
12
13
|
require('./replace.js');
|
|
13
|
-
require('./
|
|
14
|
+
require('./dic-05980807.js');
|
|
15
|
+
require('./shared-4eed0e5c.js');
|
|
14
16
|
require('postcss');
|
|
15
17
|
require('@csstools/postcss-is-pseudo-class');
|
|
16
18
|
require('node:path');
|
|
@@ -40,7 +42,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
40
42
|
},
|
|
41
43
|
generateBundle(opt, bundle, isWrite) {
|
|
42
44
|
const entries = Object.entries(bundle);
|
|
43
|
-
const groupedEntries =
|
|
45
|
+
const groupedEntries = defaults.getGroupedEntries(entries, opts);
|
|
44
46
|
const runtimeSet = twPatcher.getClassSet();
|
|
45
47
|
setMangleRuntimeSet(runtimeSet);
|
|
46
48
|
if (Array.isArray(groupedEntries.html)) {
|
package/dist/vite.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher
|
|
2
|
-
import { v as vitePluginName } from './postcss-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-800ea85a.mjs';
|
|
2
|
+
import { v as vitePluginName } from './postcss-53e2ad95.mjs';
|
|
3
|
+
import { g as getGroupedEntries } from './defaults-c7f00aae.mjs';
|
|
3
4
|
import 'micromatch';
|
|
4
5
|
import '@babel/types';
|
|
5
6
|
import '@babel/generator';
|
|
6
7
|
import '@babel/parser';
|
|
7
8
|
import '@babel/traverse';
|
|
8
9
|
import './replace.mjs';
|
|
9
|
-
import './
|
|
10
|
+
import './dic-3790a3a4.mjs';
|
|
11
|
+
import './shared-686bfc32.mjs';
|
|
10
12
|
import 'postcss';
|
|
11
13
|
import '@csstools/postcss-is-pseudo-class';
|
|
12
14
|
import 'node:path';
|
package/dist/webpack.js
CHANGED
|
@@ -4,15 +4,17 @@ 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-
|
|
8
|
-
var postcss = require('./postcss-
|
|
7
|
+
var options = require('./options-6a265426.js');
|
|
8
|
+
var postcss = require('./postcss-cf8b998a.js');
|
|
9
|
+
var defaults = require('./defaults-0d9846f4.js');
|
|
9
10
|
require('micromatch');
|
|
10
11
|
require('@babel/types');
|
|
11
12
|
require('@babel/generator');
|
|
12
13
|
require('@babel/parser');
|
|
13
14
|
require('@babel/traverse');
|
|
14
15
|
require('./replace.js');
|
|
15
|
-
require('./
|
|
16
|
+
require('./dic-05980807.js');
|
|
17
|
+
require('./shared-4eed0e5c.js');
|
|
16
18
|
require('postcss');
|
|
17
19
|
require('@csstools/postcss-is-pseudo-class');
|
|
18
20
|
require('semver');
|
|
@@ -71,7 +73,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
71
73
|
}, (assets) => {
|
|
72
74
|
onStart();
|
|
73
75
|
const entries = Object.entries(assets);
|
|
74
|
-
const groupedEntries =
|
|
76
|
+
const groupedEntries = defaults.getGroupedEntries(entries, this.options);
|
|
75
77
|
const runtimeSet = getClassSet();
|
|
76
78
|
setMangleRuntimeSet(runtimeSet);
|
|
77
79
|
if (Array.isArray(groupedEntries.html)) {
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { g as getOptions, a as createTailwindcssPatcher
|
|
4
|
-
import { a as pluginName } from './postcss-
|
|
3
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-800ea85a.mjs';
|
|
4
|
+
import { a as pluginName } from './postcss-53e2ad95.mjs';
|
|
5
|
+
import { g as getGroupedEntries } from './defaults-c7f00aae.mjs';
|
|
5
6
|
import 'micromatch';
|
|
6
7
|
import '@babel/types';
|
|
7
8
|
import '@babel/generator';
|
|
8
9
|
import '@babel/parser';
|
|
9
10
|
import '@babel/traverse';
|
|
10
11
|
import './replace.mjs';
|
|
11
|
-
import './
|
|
12
|
+
import './dic-3790a3a4.mjs';
|
|
13
|
+
import './shared-686bfc32.mjs';
|
|
12
14
|
import 'postcss';
|
|
13
15
|
import '@csstools/postcss-is-pseudo-class';
|
|
14
16
|
import 'semver';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
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",
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"require": "./dist/gulp.js",
|
|
37
37
|
"import": "./dist/gulp.mjs"
|
|
38
38
|
},
|
|
39
|
+
"./defaults": {
|
|
40
|
+
"types": "./dist/defaults.d.ts",
|
|
41
|
+
"require": "./dist/defaults.js",
|
|
42
|
+
"import": "./dist/defaults.mjs"
|
|
43
|
+
},
|
|
39
44
|
"./*": "./*"
|
|
40
45
|
},
|
|
41
46
|
"typesVersions": {
|
|
@@ -96,54 +101,54 @@
|
|
|
96
101
|
},
|
|
97
102
|
"homepage": "https://weapp-tw.icebreaker.top",
|
|
98
103
|
"devDependencies": {
|
|
99
|
-
"@babel/core": "^7.
|
|
104
|
+
"@babel/core": "^7.22.9",
|
|
100
105
|
"@icebreakers/cli": "^0.1.1",
|
|
101
106
|
"@icebreakers/readme": "0.1.0",
|
|
102
107
|
"@rollup/plugin-alias": "^5.0.0",
|
|
103
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
108
|
+
"@rollup/plugin-commonjs": "^25.0.3",
|
|
104
109
|
"@rollup/plugin-json": "^6.0.0",
|
|
105
110
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
106
111
|
"@rollup/plugin-terser": "^0.4.3",
|
|
107
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
112
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
108
113
|
"@tsconfig/recommended": "^1.0.2",
|
|
109
114
|
"@types/babel__generator": "^7.6.4",
|
|
110
|
-
"@types/babel__traverse": "^7.
|
|
115
|
+
"@types/babel__traverse": "^7.20.1",
|
|
111
116
|
"@types/fs-extra": "^11.0.1",
|
|
112
|
-
"@types/gulp": "^4.0.
|
|
117
|
+
"@types/gulp": "^4.0.13",
|
|
113
118
|
"@types/gulp-postcss": "^8.0.3",
|
|
114
|
-
"@types/jest": "^29.5.
|
|
119
|
+
"@types/jest": "^29.5.3",
|
|
115
120
|
"@types/klaw": "^3.0.3",
|
|
116
121
|
"@types/loader-utils": "^2.0.3",
|
|
117
122
|
"@types/lodash": "^4.14.195",
|
|
118
123
|
"@types/micromatch": "^4.0.2",
|
|
119
|
-
"@types/node": "^20.
|
|
124
|
+
"@types/node": "^20.4.2",
|
|
120
125
|
"@types/semver": "^7.5.0",
|
|
121
126
|
"@types/vinyl": "^2.0.7",
|
|
122
127
|
"@types/webpack": "^5.28.1",
|
|
123
128
|
"@types/webpack-sources": "^3.2.0",
|
|
124
|
-
"@vitest/coverage-v8": "^0.
|
|
129
|
+
"@vitest/coverage-v8": "^0.33.0",
|
|
125
130
|
"autoprefixer": "^10.4.14",
|
|
126
|
-
"babel-loader": "^9.1.
|
|
131
|
+
"babel-loader": "^9.1.3",
|
|
127
132
|
"bumpp": "^9.1.1",
|
|
128
133
|
"chalk": "4.1.2",
|
|
129
134
|
"cross-env": "^7.0.3",
|
|
130
135
|
"css-loader": "^6.8.1",
|
|
131
136
|
"defu": "6.1.2",
|
|
132
137
|
"del": "^6.1.1",
|
|
133
|
-
"eslint": "8.
|
|
138
|
+
"eslint": "8.45.0",
|
|
134
139
|
"eslint-config-icebreaker": "^1.1.0",
|
|
135
140
|
"eslint-config-prettier": "^8.8.0",
|
|
136
141
|
"eslint-plugin-prettier": "^4.2.1",
|
|
137
142
|
"execa": "5",
|
|
138
|
-
"fast-glob": "^3.
|
|
143
|
+
"fast-glob": "^3.3.0",
|
|
139
144
|
"fs-extra": "^11.1.1",
|
|
140
145
|
"gulp": "^4.0.2",
|
|
141
146
|
"gulp-postcss": "^9.0.1",
|
|
142
147
|
"html-loader": "^4.2.0",
|
|
143
|
-
"jest": "^29.
|
|
148
|
+
"jest": "^29.6.1",
|
|
144
149
|
"klaw": "^4.1.0",
|
|
145
150
|
"lodash": "^4.17.21",
|
|
146
|
-
"magic-string": "^0.30.
|
|
151
|
+
"magic-string": "^0.30.1",
|
|
147
152
|
"mini-css-extract-plugin": "^2.7.6",
|
|
148
153
|
"miniprogram-automator": "^0.12.0",
|
|
149
154
|
"pkg-types": "^1.0.3",
|
|
@@ -152,40 +157,40 @@
|
|
|
152
157
|
"postcss-rem-to-responsive-pixel": "^5.1.3",
|
|
153
158
|
"prettier": "^2.8.8",
|
|
154
159
|
"promisify-loader-runner": "^1.0.0",
|
|
155
|
-
"rollup": "^3.
|
|
160
|
+
"rollup": "^3.26.2",
|
|
156
161
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
157
162
|
"style-loader": "^3.3.3",
|
|
158
163
|
"tailwind-children": "^0.5.0",
|
|
159
|
-
"tailwindcss": "^3.3.
|
|
160
|
-
"ts-jest": "^29.1.
|
|
164
|
+
"tailwindcss": "^3.3.3",
|
|
165
|
+
"ts-jest": "^29.1.1",
|
|
161
166
|
"ts-node": "^10.9.1",
|
|
162
|
-
"ts-patch": "^3.0.
|
|
167
|
+
"ts-patch": "^3.0.1",
|
|
163
168
|
"tsd": "^0.28.1",
|
|
164
|
-
"tslib": "^2.
|
|
165
|
-
"typescript": "^5.1.
|
|
169
|
+
"tslib": "^2.6.0",
|
|
170
|
+
"typescript": "^5.1.6",
|
|
166
171
|
"typescript-transform-paths": "^3.4.6",
|
|
167
172
|
"vinyl": "^3.0.0",
|
|
168
|
-
"vite": "^4.
|
|
169
|
-
"vitest": "^0.
|
|
173
|
+
"vite": "^4.4.4",
|
|
174
|
+
"vitest": "^0.33.0",
|
|
170
175
|
"weapp-tailwindcss-children": "^0.1.0",
|
|
171
|
-
"webpack": "^5.
|
|
176
|
+
"webpack": "^5.88.1",
|
|
172
177
|
"webpack-build-utils": "^0.0.4"
|
|
173
178
|
},
|
|
174
179
|
"dependencies": {
|
|
175
|
-
"@babel/generator": "^7.
|
|
176
|
-
"@babel/parser": "^7.
|
|
177
|
-
"@babel/traverse": "^7.
|
|
178
|
-
"@babel/types": "^7.
|
|
179
|
-
"@csstools/postcss-is-pseudo-class": "^
|
|
180
|
+
"@babel/generator": "^7.22.9",
|
|
181
|
+
"@babel/parser": "^7.22.7",
|
|
182
|
+
"@babel/traverse": "^7.22.8",
|
|
183
|
+
"@babel/types": "^7.22.5",
|
|
184
|
+
"@csstools/postcss-is-pseudo-class": "^4.0.0",
|
|
180
185
|
"loader-utils": "^2.0.3",
|
|
181
186
|
"micromatch": "^4.0.5",
|
|
182
|
-
"postcss": "8.4.
|
|
187
|
+
"postcss": "8.4.26",
|
|
183
188
|
"postcss-selector-parser": "^6.0.13",
|
|
184
|
-
"semver": "^7.5.
|
|
189
|
+
"semver": "^7.5.4",
|
|
185
190
|
"tailwindcss-mangle-shared": "^1.2.6",
|
|
186
191
|
"tailwindcss-patch": "^1.2.6"
|
|
187
192
|
},
|
|
188
|
-
"packageManager": "pnpm@8.6.
|
|
193
|
+
"packageManager": "pnpm@8.6.3",
|
|
189
194
|
"scripts": {
|
|
190
195
|
"dev": "yarn clean && yarn dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
|
|
191
196
|
"build": "yarn clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && yarn dts",
|
|
@@ -205,6 +210,7 @@
|
|
|
205
210
|
"clean": "node scripts/clean.js",
|
|
206
211
|
"debug:web": "cd demo/web && yarn dev",
|
|
207
212
|
"raw": "ts-node scripts/raw",
|
|
213
|
+
"get-decl": "ts-node scripts/get-decl.ts",
|
|
208
214
|
"demo:dev": "node scripts/demo/dev.js",
|
|
209
215
|
"demo:build": "node scripts/demo/build.js",
|
|
210
216
|
"demo:build:local": "node scripts/demo/build.js --local",
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import selectorParser from 'postcss-selector-parser';
|
|
2
|
-
import { i as internalCssSelectorReplacer } from './shared-7c88fb94.mjs';
|
|
3
|
-
import { Rule, Declaration } from 'postcss';
|
|
4
|
-
import '@csstools/postcss-is-pseudo-class';
|
|
5
|
-
|
|
6
|
-
const createTransform = (rule, options) => {
|
|
7
|
-
const { replaceUniversalSelectorWith, escapeMap, mangleContext } = options;
|
|
8
|
-
const replaceFlag = replaceUniversalSelectorWith !== false;
|
|
9
|
-
const transform = (selectors) => {
|
|
10
|
-
selectors.walk((selector) => {
|
|
11
|
-
if (selector.type === 'universal' && replaceFlag) {
|
|
12
|
-
selector.value = replaceUniversalSelectorWith;
|
|
13
|
-
}
|
|
14
|
-
if (selector.type === 'selector') {
|
|
15
|
-
const node = selector.nodes.find((x) => x.type === 'pseudo' && x.value === ':hover');
|
|
16
|
-
node && selector.remove();
|
|
17
|
-
}
|
|
18
|
-
if (selector.type === 'class') {
|
|
19
|
-
selector.value = internalCssSelectorReplacer(selector.value, {
|
|
20
|
-
escapeMap,
|
|
21
|
-
mangleContext
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
if (selectors.length === 0) {
|
|
26
|
-
rule.remove();
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
return transform;
|
|
30
|
-
};
|
|
31
|
-
const getTransformer = (rule, options) => {
|
|
32
|
-
return selectorParser(createTransform(rule, options));
|
|
33
|
-
};
|
|
34
|
-
const transformSync = (rule, options) => {
|
|
35
|
-
const transformer = getTransformer(rule, options);
|
|
36
|
-
return transformer.transformSync(rule, {
|
|
37
|
-
lossless: false,
|
|
38
|
-
updateSelector: true
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const PATTERNS = [/:not\(template\)\s*~\s*:not\(template\)/.source, /:not\(\[hidden\]\)\s*~\s*:not\(\[hidden\]\)/.source].join('|');
|
|
43
|
-
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
|
|
44
|
-
function testIfVariablesScope(node, count = 1) {
|
|
45
|
-
if (/:?:before/.test(node.selector) && /:?:after/.test(node.selector)) {
|
|
46
|
-
for (let i = 0; i < count; i++) {
|
|
47
|
-
const tryTestDecl = node.nodes[i];
|
|
48
|
-
if (tryTestDecl && tryTestDecl.type === 'decl' && tryTestDecl.prop.startsWith('--tw-')) {
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
return false;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
function commonChunkPreflight(node, options) {
|
|
60
|
-
let childCombinatorReplaceValue = 'view + view';
|
|
61
|
-
if (Array.isArray(options.cssChildCombinatorReplaceValue)) {
|
|
62
|
-
const part = options.cssChildCombinatorReplaceValue.join(',');
|
|
63
|
-
childCombinatorReplaceValue = [part, ' + ', part].join('');
|
|
64
|
-
}
|
|
65
|
-
else if (typeof options.cssChildCombinatorReplaceValue === 'string') {
|
|
66
|
-
childCombinatorReplaceValue = options.cssChildCombinatorReplaceValue;
|
|
67
|
-
}
|
|
68
|
-
node.selector = node.selector.replaceAll(BROAD_MATCH_GLOBAL_REGEXP, childCombinatorReplaceValue);
|
|
69
|
-
if (testIfVariablesScope(node)) {
|
|
70
|
-
const selectorParts = node.selector.split(',');
|
|
71
|
-
if (!selectorParts.includes('view')) {
|
|
72
|
-
selectorParts.push('view');
|
|
73
|
-
}
|
|
74
|
-
if (options.cssPreflightRange === 'all' &&
|
|
75
|
-
!selectorParts.includes(':not(not)')) {
|
|
76
|
-
selectorParts.push(':not(not)');
|
|
77
|
-
}
|
|
78
|
-
node.selector = selectorParts.join(',');
|
|
79
|
-
if (typeof options.cssInjectPreflight === 'function') {
|
|
80
|
-
node.append(...options.cssInjectPreflight());
|
|
81
|
-
}
|
|
82
|
-
const pseudoVarRule = new Rule({
|
|
83
|
-
selector: '::before,::after'
|
|
84
|
-
});
|
|
85
|
-
pseudoVarRule.append(new Declaration({
|
|
86
|
-
prop: '--tw-content',
|
|
87
|
-
value: '""'
|
|
88
|
-
}));
|
|
89
|
-
node.before(pseudoVarRule);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
|
|
94
|
-
const pluginName = 'weapp-tailwindcss-webpack-plugin';
|
|
95
|
-
const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
|
|
96
|
-
|
|
97
|
-
const postcssWeappTailwindcss = (options = {
|
|
98
|
-
isMainChunk: true
|
|
99
|
-
}) => {
|
|
100
|
-
const { customRuleCallback, isMainChunk } = options;
|
|
101
|
-
const flag = typeof customRuleCallback === 'function';
|
|
102
|
-
return {
|
|
103
|
-
postcssPlugin,
|
|
104
|
-
Once(css) {
|
|
105
|
-
css.walkRules((rule) => {
|
|
106
|
-
transformSync(rule, options);
|
|
107
|
-
isMainChunk && commonChunkPreflight(rule, options);
|
|
108
|
-
flag && customRuleCallback(rule, options);
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
postcssWeappTailwindcss.postcss = true;
|
|
114
|
-
|
|
115
|
-
export { pluginName as a, postcssWeappTailwindcss as p, vitePluginName as v };
|