weapp-tailwindcss 3.7.0 → 3.8.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/README.md +1 -23
- package/dist/chunk-35CYTBPM.js +26 -0
- package/dist/chunk-6FNC3XMI.js +45 -0
- package/dist/chunk-6Z776ZWK.js +43 -0
- package/dist/chunk-75EWCRQW.mjs +13 -0
- package/dist/chunk-7J6ZENMS.js +216 -0
- package/dist/chunk-A2EDVNQK.mjs +173 -0
- package/dist/chunk-AB467PG7.mjs +43 -0
- package/dist/chunk-AXBFBHS2.mjs +45 -0
- package/dist/chunk-C7DFN4K3.js +152 -0
- package/dist/chunk-FYOOMUKL.js +115 -0
- package/dist/chunk-HBQASQKY.js +13 -0
- package/dist/chunk-JVPRWRPJ.mjs +115 -0
- package/dist/chunk-K7CL4YBQ.mjs +216 -0
- package/dist/chunk-KE7J6XFD.mjs +537 -0
- package/dist/chunk-LQN2VTMU.js +537 -0
- package/dist/chunk-MUJ65IQ3.mjs +26 -0
- package/dist/chunk-QJPVKPQS.js +1003 -0
- package/dist/chunk-RFNUATFD.js +24 -0
- package/dist/chunk-T4A3DCFN.mjs +152 -0
- package/dist/chunk-U7O2XXYR.mjs +24 -0
- package/dist/chunk-VFCTLSC3.mjs +1003 -0
- package/dist/chunk-VKSQ6BRD.mjs +27 -0
- package/dist/chunk-WMQLIT4T.js +173 -0
- package/dist/chunk-XSZXPWWL.js +27 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +23 -3400
- package/dist/cli.mjs +28 -3392
- package/dist/core.d.mts +27 -0
- package/dist/core.d.ts +23 -4
- package/dist/core.js +34 -56
- package/dist/core.mjs +36 -54
- package/dist/css-macro/postcss.d.mts +7 -0
- package/dist/css-macro/postcss.d.ts +5 -3
- package/dist/css-macro/postcss.js +54 -45
- package/dist/css-macro/postcss.mjs +54 -45
- package/dist/css-macro.d.mts +18 -0
- package/dist/css-macro.d.ts +18 -0
- package/dist/css-macro.js +40 -0
- package/dist/css-macro.mjs +38 -0
- package/dist/defaults.d.mts +16 -0
- package/dist/defaults.d.ts +16 -2
- package/dist/defaults.js +5 -9
- package/dist/defaults.mjs +8 -4
- package/dist/escape.d.mts +19 -0
- package/dist/escape.d.ts +19 -4
- package/dist/escape.js +11 -0
- package/dist/escape.mjs +11 -0
- package/dist/gulp.d.mts +26 -0
- package/dist/gulp.d.ts +26 -1
- package/dist/gulp.js +11 -36
- package/dist/gulp.mjs +14 -31
- package/dist/index-g4epDIUu.d.mts +534 -0
- package/dist/index-g4epDIUu.d.ts +534 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +22 -44
- package/dist/index.mjs +22 -34
- package/dist/postcss.d.mts +28 -0
- package/dist/postcss.d.ts +28 -1
- package/dist/postcss.js +9 -24
- package/dist/postcss.mjs +16 -8
- package/dist/replace.d.mts +22 -0
- package/dist/replace.d.ts +22 -3
- package/dist/replace.js +33 -50
- package/dist/replace.mjs +32 -25
- package/dist/shared-5ArEo9kL.d.mts +5 -0
- package/dist/shared-DI2Qz1ou.d.ts +5 -0
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -1
- package/dist/vite.js +11 -34
- package/dist/vite.mjs +14 -29
- package/dist/weapp-tw-runtime-loader.d.mts +7 -0
- package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
- package/dist/weapp-tw-runtime-loader.js +12 -12
- package/dist/weapp-tw-runtime-loader.mjs +12 -8
- package/dist/webpack.d.mts +26 -0
- package/dist/webpack.d.ts +26 -1
- package/dist/webpack.js +11 -35
- package/dist/webpack.mjs +14 -30
- package/dist/webpack4.d.mts +27 -0
- package/dist/webpack4.d.ts +27 -1
- package/dist/webpack4.js +204 -192
- package/dist/webpack4.mjs +210 -189
- package/package.json +26 -19
- package/dist/babel/index.d.ts +0 -5
- package/dist/bundlers/gulp/index.d.ts +0 -7
- package/dist/bundlers/vite/index.d.ts +0 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
- package/dist/bundlers/webpack/index.d.ts +0 -1
- package/dist/cache/index.d.ts +0 -31
- package/dist/constants-CFM1J-h1.js +0 -42
- package/dist/constants-Dy2Dd3Fz.mjs +0 -36
- package/dist/constants.d.ts +0 -7
- package/dist/css-macro/constants.d.ts +0 -14
- package/dist/css-macro/index.d.ts +0 -15
- package/dist/css-macro/index.js +0 -36
- package/dist/css-macro/index.mjs +0 -30
- package/dist/debug/index.d.ts +0 -2
- package/dist/defaults-5A8JI2hW.mjs +0 -139
- package/dist/defaults-CdqzSWsR.js +0 -145
- package/dist/defu-Cdz2PomB.js +0 -60
- package/dist/defu-n46TJT6t.mjs +0 -57
- package/dist/env.d.ts +0 -2
- package/dist/extractors/split.d.ts +0 -3
- package/dist/index-BEIjgKpF.mjs +0 -11
- package/dist/index-BF8k8rHr.mjs +0 -517
- package/dist/index-BTXkyxen.js +0 -136
- package/dist/index-C0QsyqD6.mjs +0 -134
- package/dist/index-ClSBbhnm.js +0 -130
- package/dist/index-DoMb0-xW.mjs +0 -124
- package/dist/index-HC-Qkn0i.js +0 -17
- package/dist/index-h2-ZMO3S.js +0 -530
- package/dist/init.d.ts +0 -34
- package/dist/js/ast-grep.d.ts +0 -1
- package/dist/js/babel.d.ts +0 -3
- package/dist/js/handlers.d.ts +0 -11
- package/dist/js/index.d.ts +0 -7
- package/dist/logger.d.ts +0 -1
- package/dist/mangle/index.d.ts +0 -8
- package/dist/npm.d.ts +0 -22
- package/dist/options-Bv-1GQJY.js +0 -891
- package/dist/options-yXyCFCtr.mjs +0 -858
- package/dist/options.d.ts +0 -2
- package/dist/postcss/cssVars.d.ts +0 -5
- package/dist/postcss/index.d.ts +0 -4
- package/dist/postcss/mp.d.ts +0 -8
- package/dist/postcss/plugins/ctx.d.ts +0 -6
- package/dist/postcss/plugins/index.d.ts +0 -7
- package/dist/postcss/plugins/post.d.ts +0 -5
- package/dist/postcss/plugins/pre.d.ts +0 -5
- package/dist/postcss/preflight.d.ts +0 -3
- package/dist/postcss/selectorParser.d.ts +0 -6
- package/dist/postcss/shared.d.ts +0 -3
- package/dist/postcss/symbols.d.ts +0 -1
- package/dist/reg.d.ts +0 -1
- package/dist/shared-COWjpokr.mjs +0 -25
- package/dist/shared-r_GpWheO.js +0 -28
- package/dist/tailwindcss/patcher.d.ts +0 -3
- package/dist/types.d.ts +0 -165
- package/dist/utils.d.ts +0 -18
- package/dist/v5-DwFXG7m_.js +0 -181
- package/dist/v5-N5BYJ5JY.mjs +0 -174
- package/dist/wxml/Tokenizer.d.ts +0 -31
- package/dist/wxml/index.d.ts +0 -2
- package/dist/wxml/shared.d.ts +0 -2
- package/dist/wxml/utils.d.ts +0 -10
package/dist/webpack4.mjs
CHANGED
|
@@ -1,194 +1,215 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import '@tailwindcss-mangle/shared';
|
|
21
|
-
import 'postcss';
|
|
22
|
-
import 'node:process';
|
|
23
|
-
import 'tailwindcss-patch';
|
|
24
|
-
import '@babel/types';
|
|
25
|
-
import 'htmlparser2';
|
|
26
|
-
import '@csstools/postcss-is-pseudo-class';
|
|
27
|
-
import 'postcss-rem-to-responsive-pixel';
|
|
28
|
-
import 'postcss-selector-parser';
|
|
29
|
-
import 'debug';
|
|
30
|
-
import './defu-n46TJT6t.mjs';
|
|
1
|
+
import {
|
|
2
|
+
createDebug
|
|
3
|
+
} from "./chunk-75EWCRQW.mjs";
|
|
4
|
+
import {
|
|
5
|
+
getOptions
|
|
6
|
+
} from "./chunk-VFCTLSC3.mjs";
|
|
7
|
+
import "./chunk-JVPRWRPJ.mjs";
|
|
8
|
+
import {
|
|
9
|
+
getGroupedEntries,
|
|
10
|
+
removeExt
|
|
11
|
+
} from "./chunk-MUJ65IQ3.mjs";
|
|
12
|
+
import {
|
|
13
|
+
pluginName
|
|
14
|
+
} from "./chunk-KE7J6XFD.mjs";
|
|
15
|
+
import "./chunk-U7O2XXYR.mjs";
|
|
16
|
+
import "./chunk-VKSQ6BRD.mjs";
|
|
17
|
+
import {
|
|
18
|
+
__async
|
|
19
|
+
} from "./chunk-AXBFBHS2.mjs";
|
|
31
20
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
22
|
+
import fs from "node:fs";
|
|
23
|
+
import path from "node:path";
|
|
24
|
+
import { ConcatSource, RawSource } from "webpack-sources";
|
|
25
|
+
var debug = createDebug();
|
|
26
|
+
var UnifiedWebpackPluginV4 = class {
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.options = getOptions(options);
|
|
29
|
+
this.appType = this.options.appType;
|
|
30
|
+
}
|
|
31
|
+
apply(compiler) {
|
|
32
|
+
const {
|
|
33
|
+
mainCssChunkMatcher,
|
|
34
|
+
disabled,
|
|
35
|
+
onLoad,
|
|
36
|
+
onUpdate,
|
|
37
|
+
onEnd,
|
|
38
|
+
onStart,
|
|
39
|
+
styleHandler,
|
|
40
|
+
patch,
|
|
41
|
+
templateHandler,
|
|
42
|
+
jsHandler,
|
|
43
|
+
setMangleRuntimeSet,
|
|
44
|
+
runtimeLoaderPath,
|
|
45
|
+
cache,
|
|
46
|
+
twPatcher
|
|
47
|
+
} = this.options;
|
|
48
|
+
if (disabled) {
|
|
49
|
+
return;
|
|
37
50
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
patch == null ? void 0 : patch();
|
|
52
|
+
function getClassSet() {
|
|
53
|
+
return twPatcher.getClassSet();
|
|
54
|
+
}
|
|
55
|
+
onLoad();
|
|
56
|
+
const loader = runtimeLoaderPath != null ? runtimeLoaderPath : path.resolve(__dirname, "./weapp-tw-runtime-loader.js");
|
|
57
|
+
const isExisted = fs.existsSync(loader);
|
|
58
|
+
const WeappTwRuntimeAopLoader = {
|
|
59
|
+
loader,
|
|
60
|
+
options: {
|
|
61
|
+
getClassSet
|
|
62
|
+
},
|
|
63
|
+
ident: null,
|
|
64
|
+
type: null
|
|
65
|
+
};
|
|
66
|
+
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
67
|
+
compilation.hooks.normalModuleLoader.tap(pluginName, (_loaderContext, module) => {
|
|
68
|
+
if (isExisted) {
|
|
69
|
+
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
70
|
+
if (idx > -1) {
|
|
71
|
+
module.loaders.unshift(WeappTwRuntimeAopLoader);
|
|
72
|
+
}
|
|
42
73
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
compiler.hooks.emit.tapPromise(pluginName, (compilation) => __async(this, null, function* () {
|
|
77
|
+
onStart();
|
|
78
|
+
debug("start");
|
|
79
|
+
for (const chunk of compilation.chunks) {
|
|
80
|
+
if (chunk.id && chunk.hash) {
|
|
81
|
+
cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
46
82
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
83
|
+
}
|
|
84
|
+
const assets = compilation.assets;
|
|
85
|
+
const entries = Object.entries(assets);
|
|
86
|
+
const groupedEntries = getGroupedEntries(entries, this.options);
|
|
87
|
+
const runtimeSet = getClassSet();
|
|
88
|
+
setMangleRuntimeSet(runtimeSet);
|
|
89
|
+
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
90
|
+
if (Array.isArray(groupedEntries.html)) {
|
|
91
|
+
let noCachedCount = 0;
|
|
92
|
+
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
93
|
+
const [file, originalSource] = groupedEntries.html[i];
|
|
94
|
+
const rawSource = originalSource.source().toString();
|
|
95
|
+
const hash = cache.computeHash(rawSource);
|
|
96
|
+
const cacheKey = file;
|
|
97
|
+
cache.calcHashValueChanged(cacheKey, hash);
|
|
98
|
+
yield cache.process(
|
|
99
|
+
cacheKey,
|
|
100
|
+
() => {
|
|
101
|
+
const source = cache.get(cacheKey);
|
|
102
|
+
if (source) {
|
|
103
|
+
compilation.updateAsset(file, source);
|
|
104
|
+
debug("html cache hit: %s", file);
|
|
105
|
+
} else {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
54
108
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
yield cache.process(cacheKey, () => {
|
|
163
|
-
const source = cache.get(cacheKey);
|
|
164
|
-
if (source) {
|
|
165
|
-
compilation.updateAsset(file, source);
|
|
166
|
-
debug('css cache hit: %s', file);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
}, () => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
const { css } = yield styleHandler(rawSource, {
|
|
173
|
-
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
174
|
-
});
|
|
175
|
-
const source = new ConcatSource(css);
|
|
176
|
-
compilation.updateAsset(file, source);
|
|
177
|
-
onUpdate(file, rawSource, css);
|
|
178
|
-
debug('css handle: %s', file);
|
|
179
|
-
noCachedCount++;
|
|
180
|
-
return {
|
|
181
|
-
key: cacheKey,
|
|
182
|
-
source,
|
|
183
|
-
};
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
|
|
187
|
-
}
|
|
188
|
-
debug('end');
|
|
189
|
-
onEnd();
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export { UnifiedWebpackPluginV4 };
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
() => __async(this, null, function* () {
|
|
111
|
+
const wxml = yield templateHandler(rawSource, {
|
|
112
|
+
runtimeSet
|
|
113
|
+
});
|
|
114
|
+
const source = new ConcatSource(wxml);
|
|
115
|
+
compilation.updateAsset(file, source);
|
|
116
|
+
onUpdate(file, rawSource, wxml);
|
|
117
|
+
debug("html handle: %s", file);
|
|
118
|
+
noCachedCount++;
|
|
119
|
+
return {
|
|
120
|
+
key: cacheKey,
|
|
121
|
+
source
|
|
122
|
+
};
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
debug("html handle finish, total: %d, no-cached: %d", groupedEntries.html.length, noCachedCount);
|
|
127
|
+
}
|
|
128
|
+
if (Array.isArray(groupedEntries.js)) {
|
|
129
|
+
let noCachedCount = 0;
|
|
130
|
+
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
131
|
+
const [file, originalSource] = groupedEntries.js[i];
|
|
132
|
+
const cacheKey = removeExt(file);
|
|
133
|
+
yield cache.process(
|
|
134
|
+
cacheKey,
|
|
135
|
+
() => {
|
|
136
|
+
const source = cache.get(cacheKey);
|
|
137
|
+
if (source) {
|
|
138
|
+
compilation.updateAsset(file, source);
|
|
139
|
+
debug("js cache hit: %s", file);
|
|
140
|
+
} else {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
() => __async(this, null, function* () {
|
|
146
|
+
const rawSource = originalSource.source().toString();
|
|
147
|
+
const mapFilename = `${file}.map`;
|
|
148
|
+
const hasMap = Boolean(assets[mapFilename]);
|
|
149
|
+
const { code, map } = yield jsHandler(rawSource, runtimeSet, {
|
|
150
|
+
generateMap: hasMap
|
|
151
|
+
});
|
|
152
|
+
const source = new ConcatSource(code);
|
|
153
|
+
compilation.updateAsset(file, source);
|
|
154
|
+
onUpdate(file, rawSource, code);
|
|
155
|
+
debug("js handle: %s", file);
|
|
156
|
+
noCachedCount++;
|
|
157
|
+
if (hasMap && map) {
|
|
158
|
+
const source2 = new RawSource(map.toString());
|
|
159
|
+
compilation.updateAsset(mapFilename, source2);
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
key: cacheKey,
|
|
163
|
+
source
|
|
164
|
+
};
|
|
165
|
+
})
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
debug("js handle finish, total: %d, no-cached: %d", groupedEntries.js.length, noCachedCount);
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(groupedEntries.css)) {
|
|
171
|
+
let noCachedCount = 0;
|
|
172
|
+
for (let i = 0; i < groupedEntries.css.length; i++) {
|
|
173
|
+
const [file, originalSource] = groupedEntries.css[i];
|
|
174
|
+
const rawSource = originalSource.source().toString();
|
|
175
|
+
const hash = cache.computeHash(rawSource);
|
|
176
|
+
const cacheKey = file;
|
|
177
|
+
cache.calcHashValueChanged(cacheKey, hash);
|
|
178
|
+
yield cache.process(
|
|
179
|
+
cacheKey,
|
|
180
|
+
() => {
|
|
181
|
+
const source = cache.get(cacheKey);
|
|
182
|
+
if (source) {
|
|
183
|
+
compilation.updateAsset(file, source);
|
|
184
|
+
debug("css cache hit: %s", file);
|
|
185
|
+
} else {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
// @ts-ignore
|
|
190
|
+
() => __async(this, null, function* () {
|
|
191
|
+
const { css } = yield styleHandler(rawSource, {
|
|
192
|
+
isMainChunk: mainCssChunkMatcher(file, this.appType)
|
|
193
|
+
});
|
|
194
|
+
const source = new ConcatSource(css);
|
|
195
|
+
compilation.updateAsset(file, source);
|
|
196
|
+
onUpdate(file, rawSource, css);
|
|
197
|
+
debug("css handle: %s", file);
|
|
198
|
+
noCachedCount++;
|
|
199
|
+
return {
|
|
200
|
+
key: cacheKey,
|
|
201
|
+
source
|
|
202
|
+
};
|
|
203
|
+
})
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
debug("css handle finish, total: %d, no-cached: %d", groupedEntries.css.length, noCachedCount);
|
|
207
|
+
}
|
|
208
|
+
debug("end");
|
|
209
|
+
onEnd();
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
export {
|
|
214
|
+
UnifiedWebpackPluginV4
|
|
215
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0-alpha.0",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,13 +39,17 @@
|
|
|
39
39
|
"gulp",
|
|
40
40
|
"gulp-plugin"
|
|
41
41
|
],
|
|
42
|
-
"sideEffects": false,
|
|
43
42
|
"exports": {
|
|
44
43
|
".": {
|
|
45
44
|
"types": "./dist/index.d.ts",
|
|
46
45
|
"import": "./dist/index.mjs",
|
|
47
46
|
"require": "./dist/index.js"
|
|
48
47
|
},
|
|
48
|
+
"./escape": {
|
|
49
|
+
"types": "./dist/escape.d.ts",
|
|
50
|
+
"import": "./dist/escape.mjs",
|
|
51
|
+
"require": "./dist/escape.js"
|
|
52
|
+
},
|
|
49
53
|
"./replace": {
|
|
50
54
|
"types": "./dist/replace.d.ts",
|
|
51
55
|
"import": "./dist/replace.mjs",
|
|
@@ -92,9 +96,9 @@
|
|
|
92
96
|
"require": "./dist/css-macro/postcss.js"
|
|
93
97
|
},
|
|
94
98
|
"./css-macro": {
|
|
95
|
-
"types": "./dist/css-macro
|
|
96
|
-
"import": "./dist/css-macro
|
|
97
|
-
"require": "./dist/css-macro
|
|
99
|
+
"types": "./dist/css-macro.d.ts",
|
|
100
|
+
"import": "./dist/css-macro.mjs",
|
|
101
|
+
"require": "./dist/css-macro.js"
|
|
98
102
|
},
|
|
99
103
|
"./*": "./*"
|
|
100
104
|
},
|
|
@@ -127,32 +131,35 @@
|
|
|
127
131
|
},
|
|
128
132
|
"dependencies": {
|
|
129
133
|
"@ast-core/escape": "~1.0.1",
|
|
130
|
-
"@babel/generator": "~7.26.
|
|
131
|
-
"@babel/parser": "~7.26.
|
|
132
|
-
"@babel/traverse": "~7.
|
|
133
|
-
"@babel/types": "~7.26.
|
|
134
|
+
"@babel/generator": "~7.26.3",
|
|
135
|
+
"@babel/parser": "~7.26.3",
|
|
136
|
+
"@babel/traverse": "~7.26.4",
|
|
137
|
+
"@babel/types": "~7.26.3",
|
|
134
138
|
"@csstools/postcss-is-pseudo-class": "~5.0.1",
|
|
135
139
|
"@tailwindcss-mangle/shared": "~4.0.1",
|
|
136
|
-
"@weapp-core/escape": "~
|
|
140
|
+
"@weapp-core/escape": "~3.0.2",
|
|
137
141
|
"@weapp-core/regex": "~1.0.1",
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"htmlparser2": "9.1.0",
|
|
142
|
+
"debug": "~4.4.0",
|
|
143
|
+
"htmlparser2": "10.0.0",
|
|
141
144
|
"loader-utils": "2.0.4",
|
|
142
145
|
"lru-cache": "10.4.3",
|
|
143
|
-
"magic-string": "0.30.
|
|
146
|
+
"magic-string": "0.30.17",
|
|
144
147
|
"md5": "2.3.0",
|
|
145
|
-
"
|
|
146
|
-
"postcss": "~8.4.47",
|
|
148
|
+
"postcss": "~8.4.49",
|
|
147
149
|
"postcss-rem-to-responsive-pixel": "~6.0.2",
|
|
148
150
|
"postcss-selector-parser": "~7.0.0",
|
|
149
151
|
"semver": "~7.6.3",
|
|
150
152
|
"tailwindcss-patch": "~5.0.2",
|
|
151
|
-
"webpack-sources": "3.2.3"
|
|
153
|
+
"webpack-sources": "3.2.3",
|
|
154
|
+
"@weapp-tailwindcss/init": "0.0.1-alpha.0",
|
|
155
|
+
"@weapp-tailwindcss/logger": "0.0.0",
|
|
156
|
+
"@weapp-tailwindcss/shared": "0.0.0"
|
|
152
157
|
},
|
|
153
158
|
"scripts": {
|
|
154
|
-
"dev": "
|
|
155
|
-
"build": "
|
|
159
|
+
"dev": "tsup --watch --sourcemap",
|
|
160
|
+
"build": "tsup",
|
|
161
|
+
"_dev": "pnpm clean && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
|
|
162
|
+
"_build": "pnpm clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript",
|
|
156
163
|
"build:tsc": "cross-env NODE_ENV=development tsc --build tsconfig.json",
|
|
157
164
|
"build:cli": "cd plugins/cli && pnpm run build",
|
|
158
165
|
"test": "npm run postinstall && vitest run",
|
package/dist/babel/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from '../../types';
|
|
2
|
-
import stream from 'node:stream';
|
|
3
|
-
export declare function createPlugins(options?: UserDefinedOptions): {
|
|
4
|
-
transformWxss: (options?: Partial<IStyleHandlerOptions>) => stream.Transform;
|
|
5
|
-
transformWxml: (options?: Partial<ITemplateHandlerOptions>) => stream.Transform;
|
|
6
|
-
transformJs: (options?: Partial<CreateJsHandlerOptions>) => stream.Transform;
|
|
7
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack4';
|
|
2
|
-
import type { AppType, IBaseWebpackPlugin, InternalUserDefinedOptions, UserDefinedOptions } from '../../../types';
|
|
3
|
-
export declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
|
|
4
|
-
options: InternalUserDefinedOptions;
|
|
5
|
-
appType?: AppType;
|
|
6
|
-
constructor(options?: UserDefinedOptions);
|
|
7
|
-
apply(compiler: Compiler): void;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
|
-
import type { AppType, IBaseWebpackPlugin, InternalUserDefinedOptions, UserDefinedOptions } from '../../../types';
|
|
3
|
-
export declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
4
|
-
options: InternalUserDefinedOptions;
|
|
5
|
-
appType?: AppType;
|
|
6
|
-
constructor(options?: UserDefinedOptions);
|
|
7
|
-
apply(compiler: Compiler): void;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './BaseUnifiedPlugin/v5';
|
package/dist/cache/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Buffer } from 'node:buffer';
|
|
2
|
-
import type { sources } from 'webpack';
|
|
3
|
-
import { LRUCache } from 'lru-cache';
|
|
4
|
-
export interface HashMapValue {
|
|
5
|
-
hash: string;
|
|
6
|
-
changed: boolean;
|
|
7
|
-
}
|
|
8
|
-
export type HashMapKey = string | number;
|
|
9
|
-
export type CacheValue = sources.Source | string;
|
|
10
|
-
export interface ICreateCacheReturnType {
|
|
11
|
-
hashMap: Map<HashMapKey, HashMapValue>;
|
|
12
|
-
instance: LRUCache<string, CacheValue>;
|
|
13
|
-
hasHashKey: (key: HashMapKey) => boolean;
|
|
14
|
-
getHashValue: (key: HashMapKey) => HashMapValue | undefined;
|
|
15
|
-
setHashValue: (key: HashMapKey, value: HashMapValue) => this['hashMap'];
|
|
16
|
-
computeHash: (message: string | Buffer) => string;
|
|
17
|
-
get: <V extends CacheValue = sources.Source>(key: string) => V | undefined;
|
|
18
|
-
set: <V extends CacheValue = sources.Source>(key: string, value: V) => this['instance'];
|
|
19
|
-
has: (key: string) => boolean;
|
|
20
|
-
calcHashValueChanged: (key: HashMapKey, hash: string) => this;
|
|
21
|
-
process: (key: string, callback: () => void | false | Promise<void | false>, fallback: () => void | {
|
|
22
|
-
key: string;
|
|
23
|
-
source: CacheValue;
|
|
24
|
-
} | Promise<void | {
|
|
25
|
-
key: string;
|
|
26
|
-
source: CacheValue;
|
|
27
|
-
}>) => void | Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export type ICreateCacheOptions = boolean;
|
|
30
|
-
declare function createCache(options?: ICreateCacheOptions): ICreateCacheReturnType;
|
|
31
|
-
export { createCache };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const queryKey = 'weapp-tw-platform';
|
|
4
|
-
function createMediaQuery(value) {
|
|
5
|
-
return `@media (${queryKey}:"${value}"){&}`;
|
|
6
|
-
}
|
|
7
|
-
function createNegativeMediaQuery(value) {
|
|
8
|
-
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
9
|
-
}
|
|
10
|
-
function normalComment(text) {
|
|
11
|
-
if (typeof text === 'string') {
|
|
12
|
-
return text.replaceAll(/(?<!\\)_/g, ' ');
|
|
13
|
-
}
|
|
14
|
-
return text;
|
|
15
|
-
}
|
|
16
|
-
function ifdef(text) {
|
|
17
|
-
return {
|
|
18
|
-
start: `#ifdef ${normalComment(text)}`,
|
|
19
|
-
end: `#endif`,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function ifndef(text) {
|
|
23
|
-
return {
|
|
24
|
-
start: `#ifndef ${normalComment(text)}`,
|
|
25
|
-
end: `#endif`,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function matchCustomPropertyFromValue(str, cb) {
|
|
29
|
-
let arr;
|
|
30
|
-
let index = 0;
|
|
31
|
-
const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, 'g');
|
|
32
|
-
while ((arr = regex.exec(str)) !== null) {
|
|
33
|
-
cb(arr, index);
|
|
34
|
-
index++;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
exports.createMediaQuery = createMediaQuery;
|
|
39
|
-
exports.createNegativeMediaQuery = createNegativeMediaQuery;
|
|
40
|
-
exports.ifdef = ifdef;
|
|
41
|
-
exports.ifndef = ifndef;
|
|
42
|
-
exports.matchCustomPropertyFromValue = matchCustomPropertyFromValue;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const queryKey = 'weapp-tw-platform';
|
|
2
|
-
function createMediaQuery(value) {
|
|
3
|
-
return `@media (${queryKey}:"${value}"){&}`;
|
|
4
|
-
}
|
|
5
|
-
function createNegativeMediaQuery(value) {
|
|
6
|
-
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
7
|
-
}
|
|
8
|
-
function normalComment(text) {
|
|
9
|
-
if (typeof text === 'string') {
|
|
10
|
-
return text.replaceAll(/(?<!\\)_/g, ' ');
|
|
11
|
-
}
|
|
12
|
-
return text;
|
|
13
|
-
}
|
|
14
|
-
function ifdef(text) {
|
|
15
|
-
return {
|
|
16
|
-
start: `#ifdef ${normalComment(text)}`,
|
|
17
|
-
end: `#endif`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function ifndef(text) {
|
|
21
|
-
return {
|
|
22
|
-
start: `#ifndef ${normalComment(text)}`,
|
|
23
|
-
end: `#endif`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function matchCustomPropertyFromValue(str, cb) {
|
|
27
|
-
let arr;
|
|
28
|
-
let index = 0;
|
|
29
|
-
const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, 'g');
|
|
30
|
-
while ((arr = regex.exec(str)) !== null) {
|
|
31
|
-
cb(arr, index);
|
|
32
|
-
index++;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { createNegativeMediaQuery as a, ifdef as b, createMediaQuery as c, ifndef as i, matchCustomPropertyFromValue as m };
|