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.
Files changed (149) hide show
  1. package/README.md +1 -23
  2. package/dist/chunk-35CYTBPM.js +26 -0
  3. package/dist/chunk-6FNC3XMI.js +45 -0
  4. package/dist/chunk-6Z776ZWK.js +43 -0
  5. package/dist/chunk-75EWCRQW.mjs +13 -0
  6. package/dist/chunk-7J6ZENMS.js +216 -0
  7. package/dist/chunk-A2EDVNQK.mjs +173 -0
  8. package/dist/chunk-AB467PG7.mjs +43 -0
  9. package/dist/chunk-AXBFBHS2.mjs +45 -0
  10. package/dist/chunk-C7DFN4K3.js +152 -0
  11. package/dist/chunk-FYOOMUKL.js +115 -0
  12. package/dist/chunk-HBQASQKY.js +13 -0
  13. package/dist/chunk-JVPRWRPJ.mjs +115 -0
  14. package/dist/chunk-K7CL4YBQ.mjs +216 -0
  15. package/dist/chunk-KE7J6XFD.mjs +537 -0
  16. package/dist/chunk-LQN2VTMU.js +537 -0
  17. package/dist/chunk-MUJ65IQ3.mjs +26 -0
  18. package/dist/chunk-QJPVKPQS.js +1003 -0
  19. package/dist/chunk-RFNUATFD.js +24 -0
  20. package/dist/chunk-T4A3DCFN.mjs +152 -0
  21. package/dist/chunk-U7O2XXYR.mjs +24 -0
  22. package/dist/chunk-VFCTLSC3.mjs +1003 -0
  23. package/dist/chunk-VKSQ6BRD.mjs +27 -0
  24. package/dist/chunk-WMQLIT4T.js +173 -0
  25. package/dist/chunk-XSZXPWWL.js +27 -0
  26. package/dist/cli.d.mts +2 -0
  27. package/dist/cli.d.ts +2 -1
  28. package/dist/cli.js +23 -3400
  29. package/dist/cli.mjs +28 -3392
  30. package/dist/core.d.mts +27 -0
  31. package/dist/core.d.ts +23 -4
  32. package/dist/core.js +34 -56
  33. package/dist/core.mjs +36 -54
  34. package/dist/css-macro/postcss.d.mts +7 -0
  35. package/dist/css-macro/postcss.d.ts +5 -3
  36. package/dist/css-macro/postcss.js +54 -45
  37. package/dist/css-macro/postcss.mjs +54 -45
  38. package/dist/css-macro.d.mts +18 -0
  39. package/dist/css-macro.d.ts +18 -0
  40. package/dist/css-macro.js +40 -0
  41. package/dist/css-macro.mjs +38 -0
  42. package/dist/defaults.d.mts +16 -0
  43. package/dist/defaults.d.ts +16 -2
  44. package/dist/defaults.js +5 -9
  45. package/dist/defaults.mjs +8 -4
  46. package/dist/escape.d.mts +19 -0
  47. package/dist/escape.d.ts +19 -4
  48. package/dist/escape.js +11 -0
  49. package/dist/escape.mjs +11 -0
  50. package/dist/gulp.d.mts +26 -0
  51. package/dist/gulp.d.ts +26 -1
  52. package/dist/gulp.js +11 -36
  53. package/dist/gulp.mjs +14 -31
  54. package/dist/index-g4epDIUu.d.mts +534 -0
  55. package/dist/index-g4epDIUu.d.ts +534 -0
  56. package/dist/index.d.mts +17 -0
  57. package/dist/index.d.ts +17 -4
  58. package/dist/index.js +22 -44
  59. package/dist/index.mjs +22 -34
  60. package/dist/postcss.d.mts +28 -0
  61. package/dist/postcss.d.ts +28 -1
  62. package/dist/postcss.js +9 -24
  63. package/dist/postcss.mjs +16 -8
  64. package/dist/replace.d.mts +22 -0
  65. package/dist/replace.d.ts +22 -3
  66. package/dist/replace.js +33 -50
  67. package/dist/replace.mjs +32 -25
  68. package/dist/shared-5ArEo9kL.d.mts +5 -0
  69. package/dist/shared-DI2Qz1ou.d.ts +5 -0
  70. package/dist/vite.d.mts +22 -0
  71. package/dist/vite.d.ts +22 -1
  72. package/dist/vite.js +11 -34
  73. package/dist/vite.mjs +14 -29
  74. package/dist/weapp-tw-runtime-loader.d.mts +7 -0
  75. package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
  76. package/dist/weapp-tw-runtime-loader.js +12 -12
  77. package/dist/weapp-tw-runtime-loader.mjs +12 -8
  78. package/dist/webpack.d.mts +26 -0
  79. package/dist/webpack.d.ts +26 -1
  80. package/dist/webpack.js +11 -35
  81. package/dist/webpack.mjs +14 -30
  82. package/dist/webpack4.d.mts +27 -0
  83. package/dist/webpack4.d.ts +27 -1
  84. package/dist/webpack4.js +204 -192
  85. package/dist/webpack4.mjs +210 -189
  86. package/package.json +26 -19
  87. package/dist/babel/index.d.ts +0 -5
  88. package/dist/bundlers/gulp/index.d.ts +0 -7
  89. package/dist/bundlers/vite/index.d.ts +0 -3
  90. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
  91. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
  92. package/dist/bundlers/webpack/index.d.ts +0 -1
  93. package/dist/cache/index.d.ts +0 -31
  94. package/dist/constants-CFM1J-h1.js +0 -42
  95. package/dist/constants-Dy2Dd3Fz.mjs +0 -36
  96. package/dist/constants.d.ts +0 -7
  97. package/dist/css-macro/constants.d.ts +0 -14
  98. package/dist/css-macro/index.d.ts +0 -15
  99. package/dist/css-macro/index.js +0 -36
  100. package/dist/css-macro/index.mjs +0 -30
  101. package/dist/debug/index.d.ts +0 -2
  102. package/dist/defaults-5A8JI2hW.mjs +0 -139
  103. package/dist/defaults-CdqzSWsR.js +0 -145
  104. package/dist/defu-Cdz2PomB.js +0 -60
  105. package/dist/defu-n46TJT6t.mjs +0 -57
  106. package/dist/env.d.ts +0 -2
  107. package/dist/extractors/split.d.ts +0 -3
  108. package/dist/index-BEIjgKpF.mjs +0 -11
  109. package/dist/index-BF8k8rHr.mjs +0 -517
  110. package/dist/index-BTXkyxen.js +0 -136
  111. package/dist/index-C0QsyqD6.mjs +0 -134
  112. package/dist/index-ClSBbhnm.js +0 -130
  113. package/dist/index-DoMb0-xW.mjs +0 -124
  114. package/dist/index-HC-Qkn0i.js +0 -17
  115. package/dist/index-h2-ZMO3S.js +0 -530
  116. package/dist/init.d.ts +0 -34
  117. package/dist/js/ast-grep.d.ts +0 -1
  118. package/dist/js/babel.d.ts +0 -3
  119. package/dist/js/handlers.d.ts +0 -11
  120. package/dist/js/index.d.ts +0 -7
  121. package/dist/logger.d.ts +0 -1
  122. package/dist/mangle/index.d.ts +0 -8
  123. package/dist/npm.d.ts +0 -22
  124. package/dist/options-Bv-1GQJY.js +0 -891
  125. package/dist/options-yXyCFCtr.mjs +0 -858
  126. package/dist/options.d.ts +0 -2
  127. package/dist/postcss/cssVars.d.ts +0 -5
  128. package/dist/postcss/index.d.ts +0 -4
  129. package/dist/postcss/mp.d.ts +0 -8
  130. package/dist/postcss/plugins/ctx.d.ts +0 -6
  131. package/dist/postcss/plugins/index.d.ts +0 -7
  132. package/dist/postcss/plugins/post.d.ts +0 -5
  133. package/dist/postcss/plugins/pre.d.ts +0 -5
  134. package/dist/postcss/preflight.d.ts +0 -3
  135. package/dist/postcss/selectorParser.d.ts +0 -6
  136. package/dist/postcss/shared.d.ts +0 -3
  137. package/dist/postcss/symbols.d.ts +0 -1
  138. package/dist/reg.d.ts +0 -1
  139. package/dist/shared-COWjpokr.mjs +0 -25
  140. package/dist/shared-r_GpWheO.js +0 -28
  141. package/dist/tailwindcss/patcher.d.ts +0 -3
  142. package/dist/types.d.ts +0 -165
  143. package/dist/utils.d.ts +0 -18
  144. package/dist/v5-DwFXG7m_.js +0 -181
  145. package/dist/v5-N5BYJ5JY.mjs +0 -174
  146. package/dist/wxml/Tokenizer.d.ts +0 -31
  147. package/dist/wxml/index.d.ts +0 -2
  148. package/dist/wxml/shared.d.ts +0 -2
  149. package/dist/wxml/utils.d.ts +0 -10
package/dist/webpack4.mjs CHANGED
@@ -1,194 +1,215 @@
1
- import { g as getOptions, _ as __awaiter } from './options-yXyCFCtr.mjs';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { ConcatSource, RawSource } from 'webpack-sources';
5
- import { b as pluginName } from './index-BF8k8rHr.mjs';
6
- import { c as createDebug } from './index-BEIjgKpF.mjs';
7
- import { g as getGroupedEntries, r as removeExt } from './defaults-5A8JI2hW.mjs';
8
- import 'lru-cache';
9
- import 'md5';
10
- import 'magic-string';
11
- import '@babel/generator';
12
- import '@babel/traverse';
13
- import '@babel/parser';
14
- import '@ast-core/escape';
15
- import '@weapp-core/escape';
16
- import 'consola';
17
- import '@weapp-core/regex';
18
- import './replace.mjs';
19
- import './shared-COWjpokr.mjs';
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
- const debug = createDebug();
33
- class UnifiedWebpackPluginV4 {
34
- constructor(options = {}) {
35
- this.options = getOptions(options);
36
- this.appType = this.options.appType;
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
- 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;
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
- patch === null || patch === void 0 ? void 0 : patch();
44
- function getClassSet() {
45
- return twPatcher.getClassSet();
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
- 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,
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
- 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 };
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.7.0",
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/index.d.ts",
96
- "import": "./dist/css-macro/index.mjs",
97
- "require": "./dist/css-macro/index.js"
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.2",
131
- "@babel/parser": "~7.26.2",
132
- "@babel/traverse": "~7.25.9",
133
- "@babel/types": "~7.26.0",
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": "~2.1.0",
140
+ "@weapp-core/escape": "~3.0.2",
137
141
  "@weapp-core/regex": "~1.0.1",
138
- "consola": "^3.2.3",
139
- "debug": "~4.3.7",
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.12",
146
+ "magic-string": "0.30.17",
144
147
  "md5": "2.3.0",
145
- "npm-registry-fetch": "^18.0.2",
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": "pnpm clean && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
155
- "build": "pnpm clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript",
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",
@@ -1,5 +0,0 @@
1
- import _babelGenerate from '@babel/generator';
2
- import _babelTraverse from '@babel/traverse';
3
- export { parse, parseExpression } from '@babel/parser';
4
- export declare const generate: typeof _babelGenerate;
5
- export declare const traverse: typeof _babelTraverse;
@@ -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,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,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 };