weapp-tailwindcss 3.3.7 → 3.4.0-alpha.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.
Files changed (138) hide show
  1. package/dist/chunk-23B34GUU.js +126 -0
  2. package/dist/chunk-33GCHXV2.js +953 -0
  3. package/dist/chunk-556KTBON.js +31 -0
  4. package/dist/chunk-6Z776ZWK.js +43 -0
  5. package/dist/chunk-75EWCRQW.mjs +13 -0
  6. package/dist/chunk-76AXDOI5.js +173 -0
  7. package/dist/chunk-77FRX3XG.js +30 -0
  8. package/dist/chunk-AB467PG7.mjs +43 -0
  9. package/dist/chunk-D7TNNBED.js +95 -0
  10. package/dist/chunk-E7XGHGC7.mjs +62 -0
  11. package/dist/chunk-F7IR3ASC.mjs +152 -0
  12. package/dist/chunk-GUE4UCRJ.mjs +126 -0
  13. package/dist/chunk-H62TECOL.js +216 -0
  14. package/dist/chunk-HBQASQKY.js +13 -0
  15. package/dist/chunk-IOYI6MSW.mjs +533 -0
  16. package/dist/chunk-JMMU4NZL.mjs +173 -0
  17. package/dist/chunk-KR2M4GD3.mjs +953 -0
  18. package/dist/chunk-LYLCSEZ7.js +152 -0
  19. package/dist/chunk-NVFWRLOI.mjs +27 -0
  20. package/dist/chunk-ODCGCGWM.js +533 -0
  21. package/dist/chunk-ORMKM6ZA.mjs +30 -0
  22. package/dist/chunk-S2GPPMOJ.js +27 -0
  23. package/dist/chunk-SRLZU2YE.mjs +95 -0
  24. package/dist/chunk-U2UGOG3R.js +62 -0
  25. package/dist/chunk-VECXHWWG.mjs +31 -0
  26. package/dist/chunk-Z3EH2XYL.mjs +216 -0
  27. package/dist/cli.d.mts +2 -0
  28. package/dist/cli.d.ts +2 -1
  29. package/dist/cli.js +32 -51
  30. package/dist/cli.mjs +34 -46
  31. package/dist/core.d.mts +22 -0
  32. package/dist/core.d.ts +16 -2
  33. package/dist/core.js +43 -63
  34. package/dist/core.mjs +46 -62
  35. package/dist/css-macro/index.d.mts +18 -0
  36. package/dist/css-macro/index.d.ts +7 -4
  37. package/dist/css-macro/index.js +37 -34
  38. package/dist/css-macro/index.mjs +35 -28
  39. package/dist/css-macro/postcss.d.mts +7 -0
  40. package/dist/css-macro/postcss.d.ts +5 -3
  41. package/dist/css-macro/postcss.js +54 -45
  42. package/dist/css-macro/postcss.mjs +54 -45
  43. package/dist/defaults.d.mts +16 -0
  44. package/dist/defaults.d.ts +16 -2
  45. package/dist/defaults.js +6 -9
  46. package/dist/defaults.mjs +9 -4
  47. package/dist/gulp.d.mts +26 -0
  48. package/dist/gulp.d.ts +26 -1
  49. package/dist/gulp.js +12 -37
  50. package/dist/gulp.mjs +15 -32
  51. package/dist/index.d.mts +17 -0
  52. package/dist/index.d.ts +17 -4
  53. package/dist/index.js +23 -44
  54. package/dist/index.mjs +23 -34
  55. package/dist/postcss.d.mts +23 -0
  56. package/dist/postcss.d.ts +23 -1
  57. package/dist/postcss.js +10 -24
  58. package/dist/postcss.mjs +17 -8
  59. package/dist/replace.d.mts +19 -0
  60. package/dist/replace.d.ts +19 -3
  61. package/dist/replace.js +30 -50
  62. package/dist/replace.mjs +30 -26
  63. package/dist/types-DSNuiOhH.d.mts +519 -0
  64. package/dist/types-DSNuiOhH.d.ts +519 -0
  65. package/dist/vite.d.mts +22 -0
  66. package/dist/vite.d.ts +22 -1
  67. package/dist/vite.js +12 -35
  68. package/dist/vite.mjs +15 -30
  69. package/dist/weapp-tw-runtime-loader.d.mts +7 -0
  70. package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
  71. package/dist/weapp-tw-runtime-loader.js +12 -12
  72. package/dist/weapp-tw-runtime-loader.mjs +12 -8
  73. package/dist/webpack.d.mts +26 -0
  74. package/dist/webpack.d.ts +26 -1
  75. package/dist/webpack.js +12 -35
  76. package/dist/webpack.mjs +15 -30
  77. package/dist/webpack4.d.mts +27 -0
  78. package/dist/webpack4.d.ts +27 -1
  79. package/dist/webpack4.js +205 -192
  80. package/dist/webpack4.mjs +211 -189
  81. package/package.json +18 -19
  82. package/dist/babel/index.d.ts +0 -16
  83. package/dist/bundlers/gulp/index.d.ts +0 -8
  84. package/dist/bundlers/vite/index.d.ts +0 -3
  85. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
  86. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
  87. package/dist/bundlers/webpack/index.d.ts +0 -1
  88. package/dist/cache/index.d.ts +0 -32
  89. package/dist/constants-CFM1J-h1.js +0 -42
  90. package/dist/constants-Dy2Dd3Fz.mjs +0 -36
  91. package/dist/constants.d.ts +0 -7
  92. package/dist/css-macro/constants.d.ts +0 -14
  93. package/dist/debug/index.d.ts +0 -2
  94. package/dist/defaults-DUZZvtdg.mjs +0 -149
  95. package/dist/defaults-syv_N3uk.js +0 -156
  96. package/dist/defu-Cdz2PomB.js +0 -60
  97. package/dist/defu-n46TJT6t.mjs +0 -57
  98. package/dist/env.d.ts +0 -2
  99. package/dist/escape.d.ts +0 -4
  100. package/dist/extractors/split.d.ts +0 -3
  101. package/dist/index-B8TOcVAt.js +0 -130
  102. package/dist/index-BEIjgKpF.mjs +0 -11
  103. package/dist/index-BKZH-Gxq.mjs +0 -134
  104. package/dist/index-BPzIdybK.mjs +0 -513
  105. package/dist/index-Bc61v7B0.mjs +0 -124
  106. package/dist/index-DXeB6ex8.js +0 -136
  107. package/dist/index-DwZHOkK3.js +0 -526
  108. package/dist/index-HC-Qkn0i.js +0 -17
  109. package/dist/js/handlers.d.ts +0 -13
  110. package/dist/js/index.d.ts +0 -7
  111. package/dist/mangle/index.d.ts +0 -8
  112. package/dist/options-BHJnjA_a.mjs +0 -981
  113. package/dist/options-DAp5AdGz.js +0 -1014
  114. package/dist/options.d.ts +0 -2
  115. package/dist/postcss/cssVars.d.ts +0 -5
  116. package/dist/postcss/index.d.ts +0 -3
  117. package/dist/postcss/mp.d.ts +0 -8
  118. package/dist/postcss/plugins/ctx.d.ts +0 -6
  119. package/dist/postcss/plugins/index.d.ts +0 -7
  120. package/dist/postcss/plugins/post.d.ts +0 -5
  121. package/dist/postcss/plugins/pre.d.ts +0 -5
  122. package/dist/postcss/preflight.d.ts +0 -3
  123. package/dist/postcss/selectorParser.d.ts +0 -6
  124. package/dist/postcss/shared.d.ts +0 -3
  125. package/dist/postcss/symbols.d.ts +0 -1
  126. package/dist/reg.d.ts +0 -1
  127. package/dist/shared-DbJl6i6a.mjs +0 -25
  128. package/dist/shared-hzYeE1wX.js +0 -28
  129. package/dist/tailwindcss/patcher.d.ts +0 -8
  130. package/dist/tailwindcss/supportCustomUnit.d.ts +0 -6
  131. package/dist/types.d.ts +0 -179
  132. package/dist/utils.d.ts +0 -18
  133. package/dist/v5-B9S3lBOs.mjs +0 -174
  134. package/dist/v5-QURRYPNk.js +0 -181
  135. package/dist/wxml/Tokenizer.d.ts +0 -31
  136. package/dist/wxml/index.d.ts +0 -2
  137. package/dist/wxml/shared.d.ts +0 -2
  138. package/dist/wxml/utils.d.ts +0 -9
package/dist/webpack4.mjs CHANGED
@@ -1,194 +1,216 @@
1
- import { g as getOptions, _ as __awaiter } from './options-BHJnjA_a.mjs';
2
- import path from 'node:path';
3
- import fs from 'node:fs';
4
- import { ConcatSource, RawSource } from 'webpack-sources';
5
- import { b as pluginName } from './index-BPzIdybK.mjs';
6
- import { g as getGroupedEntries, r as removeExt } from './defaults-DUZZvtdg.mjs';
7
- import { c as createDebug } from './index-BEIjgKpF.mjs';
8
- import 'magic-string';
9
- import './replace.mjs';
10
- import '@weapp-core/escape';
11
- import '@ast-core/escape';
12
- import './shared-DbJl6i6a.mjs';
13
- import '@weapp-core/regex';
14
- import '@babel/generator';
15
- import '@babel/traverse';
16
- import '@babel/parser';
17
- import '@babel/types';
18
- import 'htmlparser2';
19
- import 'postcss';
20
- import 'node:process';
21
- import 'semver';
22
- import 'tailwindcss-patch';
23
- import '@tailwindcss-mangle/shared';
24
- import 'lru-cache';
25
- import 'md5';
26
- import '@csstools/postcss-is-pseudo-class';
27
- import 'postcss-rem-to-responsive-pixel';
28
- import 'postcss-selector-parser';
29
- import './defu-n46TJT6t.mjs';
30
- import 'debug';
1
+ import {
2
+ createDebug
3
+ } from "./chunk-75EWCRQW.mjs";
4
+ import {
5
+ getOptions
6
+ } from "./chunk-KR2M4GD3.mjs";
7
+ import "./chunk-SRLZU2YE.mjs";
8
+ import {
9
+ getGroupedEntries,
10
+ removeExt
11
+ } from "./chunk-GUE4UCRJ.mjs";
12
+ import {
13
+ pluginName
14
+ } from "./chunk-IOYI6MSW.mjs";
15
+ import "./chunk-NVFWRLOI.mjs";
16
+ import "./chunk-ORMKM6ZA.mjs";
17
+ import "./chunk-VECXHWWG.mjs";
18
+ import {
19
+ __async
20
+ } from "./chunk-E7XGHGC7.mjs";
31
21
 
32
- const debug = createDebug();
33
- class UnifiedWebpackPluginV4 {
34
- constructor(options = {}) {
35
- this.options = getOptions(options);
36
- this.appType = this.options.appType;
22
+ // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
23
+ import path from "path";
24
+ import fs from "fs";
25
+ import { ConcatSource, RawSource } from "webpack-sources";
26
+ var debug = createDebug();
27
+ var UnifiedWebpackPluginV4 = class {
28
+ constructor(options = {}) {
29
+ this.options = getOptions(options);
30
+ this.appType = this.options.appType;
31
+ }
32
+ apply(compiler) {
33
+ const {
34
+ mainCssChunkMatcher,
35
+ disabled,
36
+ onLoad,
37
+ onUpdate,
38
+ onEnd,
39
+ onStart,
40
+ styleHandler,
41
+ patch,
42
+ templateHandler,
43
+ jsHandler,
44
+ setMangleRuntimeSet,
45
+ runtimeLoaderPath,
46
+ cache,
47
+ twPatcher
48
+ } = this.options;
49
+ if (disabled) {
50
+ return;
37
51
  }
38
- apply(compiler) {
39
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
40
- if (disabled) {
41
- return;
52
+ patch == null ? void 0 : patch();
53
+ function getClassSet() {
54
+ return twPatcher.getClassSet();
55
+ }
56
+ onLoad();
57
+ const loader = runtimeLoaderPath != null ? runtimeLoaderPath : path.resolve(__dirname, "./weapp-tw-runtime-loader.js");
58
+ const isExisted = fs.existsSync(loader);
59
+ const WeappTwRuntimeAopLoader = {
60
+ loader,
61
+ options: {
62
+ getClassSet
63
+ },
64
+ ident: null,
65
+ type: null
66
+ };
67
+ compiler.hooks.compilation.tap(pluginName, (compilation) => {
68
+ compilation.hooks.normalModuleLoader.tap(pluginName, (_loaderContext, module) => {
69
+ if (isExisted) {
70
+ const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
71
+ if (idx > -1) {
72
+ module.loaders.unshift(WeappTwRuntimeAopLoader);
73
+ }
42
74
  }
43
- patch === null || patch === void 0 ? void 0 : patch();
44
- function getClassSet() {
45
- return twPatcher.getClassSet();
75
+ });
76
+ });
77
+ compiler.hooks.emit.tapPromise(pluginName, (compilation) => __async(this, null, function* () {
78
+ onStart();
79
+ debug("start");
80
+ for (const chunk of compilation.chunks) {
81
+ if (chunk.id && chunk.hash) {
82
+ cache.calcHashValueChanged(chunk.id, chunk.hash);
46
83
  }
47
- onLoad();
48
- const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
49
- const isExisted = fs.existsSync(loader);
50
- const WeappTwRuntimeAopLoader = {
51
- loader,
52
- options: {
53
- getClassSet,
84
+ }
85
+ const assets = compilation.assets;
86
+ const entries = Object.entries(assets);
87
+ const groupedEntries = getGroupedEntries(entries, this.options);
88
+ const runtimeSet = getClassSet();
89
+ setMangleRuntimeSet(runtimeSet);
90
+ debug("get runtimeSet, class count: %d", runtimeSet.size);
91
+ if (Array.isArray(groupedEntries.html)) {
92
+ let noCachedCount = 0;
93
+ for (let i = 0; i < groupedEntries.html.length; i++) {
94
+ const [file, originalSource] = groupedEntries.html[i];
95
+ const rawSource = originalSource.source().toString();
96
+ const hash = cache.computeHash(rawSource);
97
+ const cacheKey = file;
98
+ cache.calcHashValueChanged(cacheKey, hash);
99
+ yield cache.process(
100
+ cacheKey,
101
+ () => {
102
+ const source = cache.get(cacheKey);
103
+ if (source) {
104
+ compilation.updateAsset(file, source);
105
+ debug("html cache hit: %s", file);
106
+ } else {
107
+ return false;
108
+ }
54
109
  },
55
- ident: null,
56
- type: null,
57
- };
58
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
59
- compilation.hooks.normalModuleLoader.tap(pluginName, (_loaderContext, module) => {
60
- if (isExisted) {
61
- const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
62
- if (idx > -1) {
63
- module.loaders.unshift(WeappTwRuntimeAopLoader);
64
- }
65
- }
66
- });
67
- });
68
- compiler.hooks.emit.tapPromise(pluginName, (compilation) => __awaiter(this, void 0, void 0, function* () {
69
- onStart();
70
- debug('start');
71
- for (const chunk of compilation.chunks) {
72
- if (chunk.id && chunk.hash) {
73
- cache.calcHashValueChanged(chunk.id, chunk.hash);
74
- }
75
- }
76
- const assets = compilation.assets;
77
- const entries = Object.entries(assets);
78
- const groupedEntries = getGroupedEntries(entries, this.options);
79
- const runtimeSet = getClassSet();
80
- setMangleRuntimeSet(runtimeSet);
81
- debug('get runtimeSet, class count: %d', runtimeSet.size);
82
- if (Array.isArray(groupedEntries.html)) {
83
- let noCachedCount = 0;
84
- for (let i = 0; i < groupedEntries.html.length; i++) {
85
- const [file, originalSource] = groupedEntries.html[i];
86
- const rawSource = originalSource.source().toString();
87
- const hash = cache.computeHash(rawSource);
88
- const cacheKey = file;
89
- cache.calcHashValueChanged(cacheKey, hash);
90
- yield cache.process(cacheKey, () => {
91
- const source = cache.get(cacheKey);
92
- if (source) {
93
- compilation.updateAsset(file, source);
94
- debug('html cache hit: %s', file);
95
- }
96
- else {
97
- return false;
98
- }
99
- }, () => __awaiter(this, void 0, void 0, function* () {
100
- const wxml = yield templateHandler(rawSource, {
101
- runtimeSet,
102
- });
103
- const source = new ConcatSource(wxml);
104
- compilation.updateAsset(file, source);
105
- onUpdate(file, rawSource, wxml);
106
- debug('html handle: %s', file);
107
- noCachedCount++;
108
- return {
109
- key: cacheKey,
110
- source,
111
- };
112
- }));
113
- }
114
- debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
115
- }
116
- if (Array.isArray(groupedEntries.js)) {
117
- let noCachedCount = 0;
118
- for (let i = 0; i < groupedEntries.js.length; i++) {
119
- const [file, originalSource] = groupedEntries.js[i];
120
- const cacheKey = removeExt(file);
121
- yield cache.process(cacheKey, () => {
122
- const source = cache.get(cacheKey);
123
- if (source) {
124
- compilation.updateAsset(file, source);
125
- debug('js cache hit: %s', file);
126
- }
127
- else {
128
- return false;
129
- }
130
- }, () => __awaiter(this, void 0, void 0, function* () {
131
- const rawSource = originalSource.source().toString();
132
- const mapFilename = `${file}.map`;
133
- const hasMap = Boolean(assets[mapFilename]);
134
- const { code, map } = yield jsHandler(rawSource, runtimeSet, {
135
- generateMap: hasMap,
136
- });
137
- const source = new ConcatSource(code);
138
- compilation.updateAsset(file, source);
139
- onUpdate(file, rawSource, code);
140
- debug('js handle: %s', file);
141
- noCachedCount++;
142
- if (hasMap && map) {
143
- const source = new RawSource(map.toString());
144
- compilation.updateAsset(mapFilename, source);
145
- }
146
- return {
147
- key: cacheKey,
148
- source,
149
- };
150
- }));
151
- }
152
- debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
153
- }
154
- if (Array.isArray(groupedEntries.css)) {
155
- let noCachedCount = 0;
156
- for (let i = 0; i < groupedEntries.css.length; i++) {
157
- const [file, originalSource] = groupedEntries.css[i];
158
- const rawSource = originalSource.source().toString();
159
- const hash = cache.computeHash(rawSource);
160
- const cacheKey = file;
161
- cache.calcHashValueChanged(cacheKey, hash);
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 };
110
+ // @ts-ignore
111
+ () => __async(this, null, function* () {
112
+ const wxml = yield templateHandler(rawSource, {
113
+ runtimeSet
114
+ });
115
+ const source = new ConcatSource(wxml);
116
+ compilation.updateAsset(file, source);
117
+ onUpdate(file, rawSource, wxml);
118
+ debug("html handle: %s", file);
119
+ noCachedCount++;
120
+ return {
121
+ key: cacheKey,
122
+ source
123
+ };
124
+ })
125
+ );
126
+ }
127
+ debug("html handle finish, total: %d, no-cached: %d", groupedEntries.html.length, noCachedCount);
128
+ }
129
+ if (Array.isArray(groupedEntries.js)) {
130
+ let noCachedCount = 0;
131
+ for (let i = 0; i < groupedEntries.js.length; i++) {
132
+ const [file, originalSource] = groupedEntries.js[i];
133
+ const cacheKey = removeExt(file);
134
+ yield cache.process(
135
+ cacheKey,
136
+ () => {
137
+ const source = cache.get(cacheKey);
138
+ if (source) {
139
+ compilation.updateAsset(file, source);
140
+ debug("js cache hit: %s", file);
141
+ } else {
142
+ return false;
143
+ }
144
+ },
145
+ // @ts-ignore
146
+ () => __async(this, null, function* () {
147
+ const rawSource = originalSource.source().toString();
148
+ const mapFilename = `${file}.map`;
149
+ const hasMap = Boolean(assets[mapFilename]);
150
+ const { code, map } = yield jsHandler(rawSource, runtimeSet, {
151
+ generateMap: hasMap
152
+ });
153
+ const source = new ConcatSource(code);
154
+ compilation.updateAsset(file, source);
155
+ onUpdate(file, rawSource, code);
156
+ debug("js handle: %s", file);
157
+ noCachedCount++;
158
+ if (hasMap && map) {
159
+ const source2 = new RawSource(map.toString());
160
+ compilation.updateAsset(mapFilename, source2);
161
+ }
162
+ return {
163
+ key: cacheKey,
164
+ source
165
+ };
166
+ })
167
+ );
168
+ }
169
+ debug("js handle finish, total: %d, no-cached: %d", groupedEntries.js.length, noCachedCount);
170
+ }
171
+ if (Array.isArray(groupedEntries.css)) {
172
+ let noCachedCount = 0;
173
+ for (let i = 0; i < groupedEntries.css.length; i++) {
174
+ const [file, originalSource] = groupedEntries.css[i];
175
+ const rawSource = originalSource.source().toString();
176
+ const hash = cache.computeHash(rawSource);
177
+ const cacheKey = file;
178
+ cache.calcHashValueChanged(cacheKey, hash);
179
+ yield cache.process(
180
+ cacheKey,
181
+ () => {
182
+ const source = cache.get(cacheKey);
183
+ if (source) {
184
+ compilation.updateAsset(file, source);
185
+ debug("css cache hit: %s", file);
186
+ } else {
187
+ return false;
188
+ }
189
+ },
190
+ // @ts-ignore
191
+ () => __async(this, null, function* () {
192
+ const css = yield styleHandler(rawSource, {
193
+ isMainChunk: mainCssChunkMatcher(file, this.appType)
194
+ });
195
+ const source = new ConcatSource(css);
196
+ compilation.updateAsset(file, source);
197
+ onUpdate(file, rawSource, css);
198
+ debug("css handle: %s", file);
199
+ noCachedCount++;
200
+ return {
201
+ key: cacheKey,
202
+ source
203
+ };
204
+ })
205
+ );
206
+ }
207
+ debug("css handle finish, total: %d, no-cached: %d", groupedEntries.css.length, noCachedCount);
208
+ }
209
+ debug("end");
210
+ onEnd();
211
+ }));
212
+ }
213
+ };
214
+ export {
215
+ UnifiedWebpackPluginV4
216
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "3.3.7",
3
+ "version": "3.4.0-alpha.1",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "SonOfMagic <qq1324318532@gmail.com>",
6
6
  "license": "MIT",
@@ -125,31 +125,31 @@
125
125
  "registry": "https://registry.npmjs.org"
126
126
  },
127
127
  "dependencies": {
128
- "@ast-core/escape": "^1.0.1",
129
- "@babel/generator": "7.24.7",
130
- "@babel/parser": "7.24.7",
131
- "@babel/traverse": "7.24.7",
132
- "@babel/types": "7.24.7",
133
- "@csstools/postcss-is-pseudo-class": "4.0.8",
134
- "@tailwindcss-mangle/shared": "^3.0.0",
135
- "@weapp-core/escape": "^2.1.0",
136
- "@weapp-core/regex": "^1.0.1",
137
- "debug": "4.3.5",
128
+ "@ast-core/escape": "~1.0.1",
129
+ "@babel/generator": "~7.24.8",
130
+ "@babel/parser": "~7.24.8",
131
+ "@babel/traverse": "~7.24.8",
132
+ "@babel/types": "~7.24.8",
133
+ "@csstools/postcss-is-pseudo-class": "~4.0.8",
134
+ "@tailwindcss-mangle/shared": "~3.0.0",
135
+ "@weapp-core/escape": "~2.1.0",
136
+ "@weapp-core/regex": "~1.0.1",
137
+ "debug": "~4.3.5",
138
138
  "htmlparser2": "9.1.0",
139
139
  "loader-utils": "2.0.4",
140
140
  "lru-cache": "10.4.3",
141
141
  "magic-string": "0.30.10",
142
142
  "md5": "2.3.0",
143
- "postcss": "8.4.39",
144
- "postcss-rem-to-responsive-pixel": "^6.0.1",
145
- "postcss-selector-parser": "6.1.0",
146
- "semver": "7.6.2",
147
- "tailwindcss-patch": "^3.0.2",
143
+ "postcss": "~8.4.39",
144
+ "postcss-rem-to-responsive-pixel": "~6.0.1",
145
+ "postcss-selector-parser": "~6.1.1",
146
+ "semver": "~7.6.2",
147
+ "tailwindcss-patch": "4.0.0-alpha.1",
148
148
  "webpack-sources": "3.2.3"
149
149
  },
150
150
  "scripts": {
151
- "dev": "pnpm clean && pnpm dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
152
- "build": "pnpm clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && pnpm dts",
151
+ "dev": "tsup --watch --sourcemap",
152
+ "build": "pnpm clean && tsup",
153
153
  "build:tsc": "cross-env NODE_ENV=development tsc --build tsconfig.json",
154
154
  "build:cli": "cd plugins/cli && pnpm run build",
155
155
  "dts": "tsc --emitDeclarationOnly -p tsconfig.dts.json",
@@ -162,7 +162,6 @@
162
162
  "sync": "cnpm sync weapp-tailwindcss-webpack-plugin weapp-tailwindcss weapp-tw",
163
163
  "ls:pack": "npm pack --dry-run",
164
164
  "cli:patch": "node bin/weapp-tailwindcss.js patch",
165
- "bump": "bumpp",
166
165
  "release": "node scripts/release.js",
167
166
  "generate:readme": "tsx scripts/readme/write.ts",
168
167
  "lint": "eslint .",
@@ -1,16 +0,0 @@
1
- import _babelGenerate from '@babel/generator';
2
- export { parse, parseExpression } from '@babel/parser';
3
- export declare const generate: typeof _babelGenerate;
4
- export declare const traverse: {
5
- <S>(parent: import("@babel/types").Node, opts: import("@babel/traverse").TraverseOptions<S>, scope: import("@babel/traverse").Scope | undefined, state: S, parentPath?: import("@babel/traverse").NodePath<import("@babel/types").Node> | undefined): void;
6
- (parent: import("@babel/types").Node, opts?: import("@babel/traverse").TraverseOptions<import("@babel/types").Node> | undefined, scope?: import("@babel/traverse").Scope | undefined, state?: any, parentPath?: import("@babel/traverse").NodePath<import("@babel/types").Node> | undefined): void;
7
- visitors: typeof import("@babel/traverse").visitors;
8
- verify: typeof import("@babel/traverse").visitors.verify;
9
- explode: typeof import("@babel/traverse").visitors.explode;
10
- cheap: (node: import("@babel/types").Node, enter: (node: import("@babel/types").Node) => void) => void;
11
- node: (node: import("@babel/types").Node, opts: import("@babel/traverse").TraverseOptions<import("@babel/types").Node>, scope?: import("@babel/traverse").Scope | undefined, state?: any, path?: import("@babel/traverse").NodePath<import("@babel/types").Node> | undefined, skipKeys?: Record<string, boolean> | undefined) => void;
12
- clearNode: (node: import("@babel/types").Node, opts?: import("@babel/types").RemovePropertiesOptions | undefined) => void;
13
- removeProperties: (tree: import("@babel/types").Node, opts?: import("@babel/types").RemovePropertiesOptions | undefined) => import("@babel/types").Node;
14
- hasType: (tree: import("@babel/types").Node, type: "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayExpression" | "ArrayPattern" | "ArrayTypeAnnotation" | "ArrowFunctionExpression" | "AssignmentExpression" | "AssignmentPattern" | "AwaitExpression" | "BigIntLiteral" | "BinaryExpression" | "BindExpression" | "BlockStatement" | "BooleanLiteral" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "BreakStatement" | "CallExpression" | "CatchClause" | "ClassAccessorProperty" | "ClassBody" | "ClassDeclaration" | "ClassExpression" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "ConditionalExpression" | "ContinueStatement" | "DebuggerStatement" | "DecimalLiteral" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoExpression" | "DoWhileStatement" | "EmptyStatement" | "EmptyTypeAnnotation" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistsTypeAnnotation" | "ExportAllDeclaration" | "ExportDefaultDeclaration" | "ExportDefaultSpecifier" | "ExportNamedDeclaration" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "ExpressionStatement" | "File" | "ForInStatement" | "ForOfStatement" | "ForStatement" | "FunctionDeclaration" | "FunctionExpression" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "GenericTypeAnnotation" | "Identifier" | "IfStatement" | "Import" | "ImportAttribute" | "ImportDeclaration" | "ImportDefaultSpecifier" | "ImportExpression" | "ImportNamespaceSpecifier" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXElement" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXFragment" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "LabeledStatement" | "LogicalExpression" | "MemberExpression" | "MetaProperty" | "MixedTypeAnnotation" | "ModuleExpression" | "NewExpression" | "Noop" | "NullLiteral" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "NumericLiteral" | "ObjectExpression" | "ObjectMethod" | "ObjectPattern" | "ObjectProperty" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalCallExpression" | "OptionalIndexedAccessType" | "OptionalMemberExpression" | "ParenthesizedExpression" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "PipelineTopicExpression" | "Placeholder" | "PrivateName" | "Program" | "QualifiedTypeIdentifier" | "RecordExpression" | "RegExpLiteral" | "RegexLiteral" | "RestElement" | "RestProperty" | "ReturnStatement" | "SequenceExpression" | "SpreadElement" | "SpreadProperty" | "StaticBlock" | "StringLiteral" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "Super" | "SwitchCase" | "SwitchStatement" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSAsExpression" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInstantiationExpression" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNonNullExpression" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParameterProperty" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSSatisfiesExpression" | "TSStringKeyword" | "TSSymbolKeyword" | "TSThisType" | "TSTupleType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeAssertion" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "TaggedTemplateExpression" | "TemplateElement" | "TemplateLiteral" | "ThisExpression" | "ThisTypeAnnotation" | "ThrowStatement" | "TopicReference" | "TryStatement" | "TupleExpression" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeCastExpression" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeofTypeAnnotation" | "UnaryExpression" | "UnionTypeAnnotation" | "UpdateExpression" | "V8IntrinsicIdentifier" | "VariableDeclaration" | "VariableDeclarator" | "Variance" | "VoidTypeAnnotation" | "WhileStatement" | "WithStatement" | "YieldExpression", denylistTypes?: string[] | undefined) => boolean;
15
- cache: typeof import("@babel/traverse").cache;
16
- };
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- import stream from 'node:stream';
3
- import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from "../../types";
4
- export declare function createPlugins(options?: UserDefinedOptions): {
5
- transformWxss: (options?: Partial<IStyleHandlerOptions>) => stream.Transform;
6
- transformWxml: (options?: Partial<ITemplateHandlerOptions>) => stream.Transform;
7
- transformJs: (options?: Partial<CreateJsHandlerOptions>) => stream.Transform;
8
- };
@@ -1,3 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- import type { UserDefinedOptions } from "../../types";
3
- export declare function UnifiedViteWeappTailwindcssPlugin(options?: UserDefinedOptions): Plugin | undefined;
@@ -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';
@@ -1,32 +0,0 @@
1
- /// <reference types="node" />
2
- import type { Buffer } from 'node:buffer';
3
- import { LRUCache } from 'lru-cache';
4
- import type { sources } from 'webpack';
5
- export interface HashMapValue {
6
- hash: string;
7
- changed: boolean;
8
- }
9
- export type HashMapKey = string | number;
10
- export type CacheValue = sources.Source | string;
11
- export interface ICreateCacheReturnType {
12
- hashMap: Map<HashMapKey, HashMapValue>;
13
- instance: LRUCache<string, CacheValue>;
14
- hasHashKey: (key: HashMapKey) => boolean;
15
- getHashValue: (key: HashMapKey) => HashMapValue | undefined;
16
- setHashValue: (key: HashMapKey, value: HashMapValue) => this['hashMap'];
17
- computeHash: (message: string | Buffer) => string;
18
- get: <V extends CacheValue = sources.Source>(key: string) => V | undefined;
19
- set: <V extends CacheValue = sources.Source>(key: string, value: V) => this['instance'];
20
- has: (key: string) => boolean;
21
- calcHashValueChanged: (key: HashMapKey, hash: string) => this;
22
- process: (key: string, callback: () => void | false | Promise<void | false>, fallback: () => void | {
23
- key: string;
24
- source: CacheValue;
25
- } | Promise<void | {
26
- key: string;
27
- source: CacheValue;
28
- }>) => void | Promise<void>;
29
- }
30
- export type ICreateCacheOptions = boolean;
31
- declare function createCache(options?: ICreateCacheOptions): ICreateCacheReturnType;
32
- 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;