weapp-tailwindcss 4.3.3 → 4.4.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 (53) hide show
  1. package/dist/chunk-2NRTWL47.js +43 -0
  2. package/dist/{chunk-GFQ2R7SX.mjs → chunk-3MSGCIVH.mjs} +127 -129
  3. package/dist/{chunk-3KMEJ2LM.js → chunk-AEJDBNAX.js} +540 -315
  4. package/dist/{chunk-M7PVNKCH.mjs → chunk-AXYGCCZW.mjs} +45 -57
  5. package/dist/chunk-E2LRXNZ3.js +122 -0
  6. package/dist/{chunk-L36QGA7Y.mjs → chunk-FBGUUXQV.mjs} +1 -1
  7. package/dist/{chunk-A75TB5TE.js → chunk-FOSGDQZ7.js} +34 -43
  8. package/dist/chunk-H4JTYYOI.mjs +43 -0
  9. package/dist/{chunk-5BTC4YQI.mjs → chunk-IHKVNALD.mjs} +29 -38
  10. package/dist/chunk-KAKRCCPX.mjs +122 -0
  11. package/dist/{chunk-L7VNJFIK.js → chunk-NZ7VALIM.js} +129 -131
  12. package/dist/{chunk-JDLLZFZX.js → chunk-PPTSD6TQ.js} +46 -58
  13. package/dist/{chunk-O3G5TVND.js → chunk-RBRSMHFS.js} +1 -1
  14. package/dist/chunk-UW3WHSZ5.js +39 -0
  15. package/dist/{chunk-3KXFKRIX.mjs → chunk-WCIVXE2D.mjs} +539 -314
  16. package/dist/chunk-ZNKIYZRQ.mjs +39 -0
  17. package/dist/cli.js +5 -8
  18. package/dist/cli.mjs +4 -7
  19. package/dist/core.js +5 -5
  20. package/dist/core.mjs +4 -4
  21. package/dist/css-macro/postcss.js +1 -1
  22. package/dist/css-macro/postcss.mjs +1 -1
  23. package/dist/css-macro.js +3 -3
  24. package/dist/css-macro.mjs +2 -2
  25. package/dist/defaults.js +4 -4
  26. package/dist/defaults.mjs +3 -3
  27. package/dist/escape.js +1 -1
  28. package/dist/escape.mjs +1 -1
  29. package/dist/gulp.js +7 -7
  30. package/dist/gulp.mjs +6 -6
  31. package/dist/index.js +9 -9
  32. package/dist/index.mjs +8 -8
  33. package/dist/postcss-html-transform.js +1 -1
  34. package/dist/postcss-html-transform.mjs +1 -1
  35. package/dist/presets.js +3 -3
  36. package/dist/presets.mjs +2 -2
  37. package/dist/types.d.mts +247 -246
  38. package/dist/types.d.ts +247 -246
  39. package/dist/types.js +1 -1
  40. package/dist/types.mjs +1 -1
  41. package/dist/vite.js +7 -7
  42. package/dist/vite.mjs +6 -6
  43. package/dist/webpack.js +7 -7
  44. package/dist/webpack.mjs +6 -6
  45. package/dist/webpack4.js +48 -63
  46. package/dist/webpack4.mjs +46 -61
  47. package/package.json +4 -5
  48. package/dist/chunk-3AUX4FGE.mjs +0 -13
  49. package/dist/chunk-GEUHO2UC.mjs +0 -141
  50. package/dist/chunk-LSSLYD6B.js +0 -13
  51. package/dist/chunk-QXQOYYCR.js +0 -26
  52. package/dist/chunk-TI4R65TB.js +0 -141
  53. package/dist/chunk-Y5AFAYKI.mjs +0 -26
package/dist/types.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use strict";require('./chunk-O2IOQ3BD.js');
2
- require('./chunk-O3G5TVND.js');
2
+ require('./chunk-RBRSMHFS.js');
package/dist/types.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  import "./chunk-YAN7TO2B.mjs";
2
- import "./chunk-L36QGA7Y.mjs";
2
+ import "./chunk-FBGUUXQV.mjs";
package/dist/vite.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkL7VNJFIKjs = require('./chunk-L7VNJFIK.js');
4
- require('./chunk-LSSLYD6B.js');
3
+ var _chunkNZ7VALIMjs = require('./chunk-NZ7VALIM.js');
4
+ require('./chunk-2NRTWL47.js');
5
5
  require('./chunk-OGROHM4L.js');
6
- require('./chunk-3KMEJ2LM.js');
6
+ require('./chunk-AEJDBNAX.js');
7
7
  require('./chunk-PLMJW644.js');
8
- require('./chunk-A75TB5TE.js');
9
- require('./chunk-QXQOYYCR.js');
10
- require('./chunk-O3G5TVND.js');
8
+ require('./chunk-FOSGDQZ7.js');
9
+ require('./chunk-UW3WHSZ5.js');
10
+ require('./chunk-RBRSMHFS.js');
11
11
 
12
12
 
13
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkL7VNJFIKjs.UnifiedViteWeappTailwindcssPlugin;
13
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunkNZ7VALIMjs.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-GFQ2R7SX.mjs";
4
- import "./chunk-3AUX4FGE.mjs";
3
+ } from "./chunk-3MSGCIVH.mjs";
4
+ import "./chunk-H4JTYYOI.mjs";
5
5
  import "./chunk-CMUA5KCO.mjs";
6
- import "./chunk-3KXFKRIX.mjs";
6
+ import "./chunk-WCIVXE2D.mjs";
7
7
  import "./chunk-Q67IXIAH.mjs";
8
- import "./chunk-5BTC4YQI.mjs";
9
- import "./chunk-Y5AFAYKI.mjs";
10
- import "./chunk-L36QGA7Y.mjs";
8
+ import "./chunk-IHKVNALD.mjs";
9
+ import "./chunk-ZNKIYZRQ.mjs";
10
+ import "./chunk-FBGUUXQV.mjs";
11
11
  export {
12
12
  UnifiedViteWeappTailwindcssPlugin
13
13
  };
package/dist/webpack.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkJDLLZFZXjs = require('./chunk-JDLLZFZX.js');
3
+ var _chunkPPTSD6TQjs = require('./chunk-PPTSD6TQ.js');
4
4
  require('./chunk-6GP37C26.js');
5
- require('./chunk-LSSLYD6B.js');
5
+ require('./chunk-2NRTWL47.js');
6
6
  require('./chunk-OGROHM4L.js');
7
- require('./chunk-3KMEJ2LM.js');
7
+ require('./chunk-AEJDBNAX.js');
8
8
  require('./chunk-PLMJW644.js');
9
- require('./chunk-A75TB5TE.js');
10
- require('./chunk-QXQOYYCR.js');
11
- require('./chunk-O3G5TVND.js');
9
+ require('./chunk-FOSGDQZ7.js');
10
+ require('./chunk-UW3WHSZ5.js');
11
+ require('./chunk-RBRSMHFS.js');
12
12
 
13
13
 
14
- exports.UnifiedWebpackPluginV5 = _chunkJDLLZFZXjs.UnifiedWebpackPluginV5;
14
+ exports.UnifiedWebpackPluginV5 = _chunkPPTSD6TQjs.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5
3
- } from "./chunk-M7PVNKCH.mjs";
3
+ } from "./chunk-AXYGCCZW.mjs";
4
4
  import "./chunk-2F7HOQQY.mjs";
5
- import "./chunk-3AUX4FGE.mjs";
5
+ import "./chunk-H4JTYYOI.mjs";
6
6
  import "./chunk-CMUA5KCO.mjs";
7
- import "./chunk-3KXFKRIX.mjs";
7
+ import "./chunk-WCIVXE2D.mjs";
8
8
  import "./chunk-Q67IXIAH.mjs";
9
- import "./chunk-5BTC4YQI.mjs";
10
- import "./chunk-Y5AFAYKI.mjs";
11
- import "./chunk-L36QGA7Y.mjs";
9
+ import "./chunk-IHKVNALD.mjs";
10
+ import "./chunk-ZNKIYZRQ.mjs";
11
+ import "./chunk-FBGUUXQV.mjs";
12
12
  export {
13
13
  UnifiedWebpackPluginV5
14
14
  };
package/dist/webpack4.js CHANGED
@@ -3,28 +3,29 @@
3
3
  var _chunk6GP37C26js = require('./chunk-6GP37C26.js');
4
4
 
5
5
 
6
- var _chunkLSSLYD6Bjs = require('./chunk-LSSLYD6B.js');
6
+
7
+ var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
7
8
 
8
9
 
9
10
  var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
10
11
 
11
12
 
12
- var _chunk3KMEJ2LMjs = require('./chunk-3KMEJ2LM.js');
13
+ var _chunkAEJDBNAXjs = require('./chunk-AEJDBNAX.js');
13
14
  require('./chunk-PLMJW644.js');
14
- require('./chunk-A75TB5TE.js');
15
+ require('./chunk-FOSGDQZ7.js');
15
16
 
16
17
 
17
- var _chunkQXQOYYCRjs = require('./chunk-QXQOYYCR.js');
18
- require('./chunk-O3G5TVND.js');
18
+ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
19
+ require('./chunk-RBRSMHFS.js');
19
20
 
20
21
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
21
22
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
22
23
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
23
24
  var _webpacksources = require('webpack-sources');
24
- var debug = _chunkLSSLYD6Bjs.createDebug.call(void 0, );
25
+ var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
25
26
  var UnifiedWebpackPluginV4 = class {
26
27
  constructor(options = {}) {
27
- this.options = _chunk3KMEJ2LMjs.getCompilerContext.call(void 0, options);
28
+ this.options = _chunkAEJDBNAXjs.getCompilerContext.call(void 0, options);
28
29
  this.appType = this.options.appType;
29
30
  }
30
31
  apply(compiler) {
@@ -83,45 +84,39 @@ var UnifiedWebpackPluginV4 = class {
83
84
  }
84
85
  const assets = compilation.assets;
85
86
  const entries = Object.entries(assets);
86
- const groupedEntries = _chunkQXQOYYCRjs.getGroupedEntries.call(void 0, entries, this.options);
87
+ const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
87
88
  const runtimeSet = await twPatcher.getClassSet();
88
89
  setMangleRuntimeSet(runtimeSet);
89
90
  debug("get runtimeSet, class count: %d", runtimeSet.size);
90
- const promises = [];
91
+ const tasks = [];
91
92
  if (Array.isArray(groupedEntries.html)) {
92
93
  for (const element of groupedEntries.html) {
93
94
  const [file, originalSource] = element;
94
95
  const rawSource = originalSource.source().toString();
95
- const hash = cache.computeHash(rawSource);
96
96
  const cacheKey = file;
97
- cache.calcHashValueChanged(cacheKey, hash);
98
- promises.push(
99
- cache.process(
97
+ tasks.push(
98
+ _chunk2NRTWL47js.processCachedTask.call(void 0, {
99
+ cache,
100
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
- }
101
+ rawSource,
102
+ applyResult(source) {
103
+ compilation.updateAsset(file, source);
104
+ },
105
+ onCacheHit() {
106
+ debug("html cache hit: %s", file);
109
107
  },
110
- // @ts-ignore
111
- async () => {
108
+ transform: async () => {
112
109
  const wxml = await templateHandler(rawSource, {
113
110
  runtimeSet
114
111
  });
115
112
  const source = new (0, _webpacksources.ConcatSource)(wxml);
116
- compilation.updateAsset(file, source);
117
113
  onUpdate(file, rawSource, wxml);
118
114
  debug("html handle: %s", file);
119
115
  return {
120
- key: cacheKey,
121
- source
116
+ result: source
122
117
  };
123
118
  }
124
- )
119
+ })
125
120
  );
126
121
  }
127
122
  }
@@ -129,32 +124,28 @@ var UnifiedWebpackPluginV4 = class {
129
124
  for (const element of groupedEntries.js) {
130
125
  const [file, originalSource] = element;
131
126
  const cacheKey = _chunk6GP37C26js.getCacheKey.call(void 0, file);
132
- promises.push(
133
- cache.process(
127
+ const rawSource = originalSource.source().toString();
128
+ tasks.push(
129
+ _chunk2NRTWL47js.processCachedTask.call(void 0, {
130
+ cache,
134
131
  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
- }
132
+ rawSource,
133
+ applyResult(source) {
134
+ compilation.updateAsset(file, source);
143
135
  },
144
- // @ts-ignore
145
- async () => {
146
- const rawSource = originalSource.source().toString();
136
+ onCacheHit() {
137
+ debug("js cache hit: %s", file);
138
+ },
139
+ transform: async () => {
147
140
  const { code } = await jsHandler(rawSource, runtimeSet);
148
141
  const source = new (0, _webpacksources.ConcatSource)(code);
149
- compilation.updateAsset(file, source);
150
142
  onUpdate(file, rawSource, code);
151
143
  debug("js handle: %s", file);
152
144
  return {
153
- key: cacheKey,
154
- source
145
+ result: source
155
146
  };
156
147
  }
157
- )
148
+ })
158
149
  );
159
150
  }
160
151
  }
@@ -162,23 +153,19 @@ var UnifiedWebpackPluginV4 = class {
162
153
  for (const element of groupedEntries.css) {
163
154
  const [file, originalSource] = element;
164
155
  const rawSource = originalSource.source().toString();
165
- const hash = cache.computeHash(rawSource);
166
156
  const cacheKey = file;
167
- cache.calcHashValueChanged(cacheKey, hash);
168
- promises.push(
169
- cache.process(
157
+ tasks.push(
158
+ _chunk2NRTWL47js.processCachedTask.call(void 0, {
159
+ cache,
170
160
  cacheKey,
171
- () => {
172
- const source = cache.get(cacheKey);
173
- if (source) {
174
- compilation.updateAsset(file, source);
175
- debug("css cache hit: %s", file);
176
- } else {
177
- return false;
178
- }
161
+ rawSource,
162
+ applyResult(source) {
163
+ compilation.updateAsset(file, source);
179
164
  },
180
- // @ts-ignore
181
- async () => {
165
+ onCacheHit() {
166
+ debug("css cache hit: %s", file);
167
+ },
168
+ transform: async () => {
182
169
  const { css } = await styleHandler(rawSource, {
183
170
  isMainChunk: mainCssChunkMatcher(file, this.appType),
184
171
  postcssOptions: {
@@ -189,19 +176,17 @@ var UnifiedWebpackPluginV4 = class {
189
176
  majorVersion: twPatcher.majorVersion
190
177
  });
191
178
  const source = new (0, _webpacksources.ConcatSource)(css);
192
- compilation.updateAsset(file, source);
193
179
  onUpdate(file, rawSource, css);
194
180
  debug("css handle: %s", file);
195
181
  return {
196
- key: cacheKey,
197
- source
182
+ result: source
198
183
  };
199
184
  }
200
- )
185
+ })
201
186
  );
202
187
  }
203
188
  }
204
- await Promise.all(promises);
189
+ await Promise.all(tasks);
205
190
  debug("end");
206
191
  onEnd();
207
192
  });
package/dist/webpack4.mjs CHANGED
@@ -2,22 +2,23 @@ import {
2
2
  getCacheKey
3
3
  } from "./chunk-2F7HOQQY.mjs";
4
4
  import {
5
- createDebug
6
- } from "./chunk-3AUX4FGE.mjs";
5
+ createDebug,
6
+ processCachedTask
7
+ } from "./chunk-H4JTYYOI.mjs";
7
8
  import {
8
9
  pluginName
9
10
  } from "./chunk-CMUA5KCO.mjs";
10
11
  import {
11
12
  getCompilerContext
12
- } from "./chunk-3KXFKRIX.mjs";
13
+ } from "./chunk-WCIVXE2D.mjs";
13
14
  import "./chunk-Q67IXIAH.mjs";
14
- import "./chunk-5BTC4YQI.mjs";
15
+ import "./chunk-IHKVNALD.mjs";
15
16
  import {
16
17
  getGroupedEntries
17
- } from "./chunk-Y5AFAYKI.mjs";
18
+ } from "./chunk-ZNKIYZRQ.mjs";
18
19
  import {
19
20
  __dirname
20
- } from "./chunk-L36QGA7Y.mjs";
21
+ } from "./chunk-FBGUUXQV.mjs";
21
22
 
22
23
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
23
24
  import fs from "fs";
@@ -89,41 +90,35 @@ var UnifiedWebpackPluginV4 = class {
89
90
  const runtimeSet = await twPatcher.getClassSet();
90
91
  setMangleRuntimeSet(runtimeSet);
91
92
  debug("get runtimeSet, class count: %d", runtimeSet.size);
92
- const promises = [];
93
+ const tasks = [];
93
94
  if (Array.isArray(groupedEntries.html)) {
94
95
  for (const element of groupedEntries.html) {
95
96
  const [file, originalSource] = element;
96
97
  const rawSource = originalSource.source().toString();
97
- const hash = cache.computeHash(rawSource);
98
98
  const cacheKey = file;
99
- cache.calcHashValueChanged(cacheKey, hash);
100
- promises.push(
101
- cache.process(
99
+ tasks.push(
100
+ processCachedTask({
101
+ cache,
102
102
  cacheKey,
103
- () => {
104
- const source = cache.get(cacheKey);
105
- if (source) {
106
- compilation.updateAsset(file, source);
107
- debug("html cache hit: %s", file);
108
- } else {
109
- return false;
110
- }
103
+ rawSource,
104
+ applyResult(source) {
105
+ compilation.updateAsset(file, source);
106
+ },
107
+ onCacheHit() {
108
+ debug("html cache hit: %s", file);
111
109
  },
112
- // @ts-ignore
113
- async () => {
110
+ transform: async () => {
114
111
  const wxml = await templateHandler(rawSource, {
115
112
  runtimeSet
116
113
  });
117
114
  const source = new ConcatSource(wxml);
118
- compilation.updateAsset(file, source);
119
115
  onUpdate(file, rawSource, wxml);
120
116
  debug("html handle: %s", file);
121
117
  return {
122
- key: cacheKey,
123
- source
118
+ result: source
124
119
  };
125
120
  }
126
- )
121
+ })
127
122
  );
128
123
  }
129
124
  }
@@ -131,32 +126,28 @@ var UnifiedWebpackPluginV4 = class {
131
126
  for (const element of groupedEntries.js) {
132
127
  const [file, originalSource] = element;
133
128
  const cacheKey = getCacheKey(file);
134
- promises.push(
135
- cache.process(
129
+ const rawSource = originalSource.source().toString();
130
+ tasks.push(
131
+ processCachedTask({
132
+ cache,
136
133
  cacheKey,
137
- () => {
138
- const source = cache.get(cacheKey);
139
- if (source) {
140
- compilation.updateAsset(file, source);
141
- debug("js cache hit: %s", file);
142
- } else {
143
- return false;
144
- }
134
+ rawSource,
135
+ applyResult(source) {
136
+ compilation.updateAsset(file, source);
145
137
  },
146
- // @ts-ignore
147
- async () => {
148
- const rawSource = originalSource.source().toString();
138
+ onCacheHit() {
139
+ debug("js cache hit: %s", file);
140
+ },
141
+ transform: async () => {
149
142
  const { code } = await jsHandler(rawSource, runtimeSet);
150
143
  const source = new ConcatSource(code);
151
- compilation.updateAsset(file, source);
152
144
  onUpdate(file, rawSource, code);
153
145
  debug("js handle: %s", file);
154
146
  return {
155
- key: cacheKey,
156
- source
147
+ result: source
157
148
  };
158
149
  }
159
- )
150
+ })
160
151
  );
161
152
  }
162
153
  }
@@ -164,23 +155,19 @@ var UnifiedWebpackPluginV4 = class {
164
155
  for (const element of groupedEntries.css) {
165
156
  const [file, originalSource] = element;
166
157
  const rawSource = originalSource.source().toString();
167
- const hash = cache.computeHash(rawSource);
168
158
  const cacheKey = file;
169
- cache.calcHashValueChanged(cacheKey, hash);
170
- promises.push(
171
- cache.process(
159
+ tasks.push(
160
+ processCachedTask({
161
+ cache,
172
162
  cacheKey,
173
- () => {
174
- const source = cache.get(cacheKey);
175
- if (source) {
176
- compilation.updateAsset(file, source);
177
- debug("css cache hit: %s", file);
178
- } else {
179
- return false;
180
- }
163
+ rawSource,
164
+ applyResult(source) {
165
+ compilation.updateAsset(file, source);
181
166
  },
182
- // @ts-ignore
183
- async () => {
167
+ onCacheHit() {
168
+ debug("css cache hit: %s", file);
169
+ },
170
+ transform: async () => {
184
171
  const { css } = await styleHandler(rawSource, {
185
172
  isMainChunk: mainCssChunkMatcher(file, this.appType),
186
173
  postcssOptions: {
@@ -191,19 +178,17 @@ var UnifiedWebpackPluginV4 = class {
191
178
  majorVersion: twPatcher.majorVersion
192
179
  });
193
180
  const source = new ConcatSource(css);
194
- compilation.updateAsset(file, source);
195
181
  onUpdate(file, rawSource, css);
196
182
  debug("css handle: %s", file);
197
183
  return {
198
- key: cacheKey,
199
- source
184
+ result: source
200
185
  };
201
186
  }
202
- )
187
+ })
203
188
  );
204
189
  }
205
190
  }
206
- await Promise.all(promises);
191
+ await Promise.all(tasks);
207
192
  debug("end");
208
193
  onEnd();
209
194
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "4.3.3",
3
+ "version": "4.4.0-alpha.0",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -171,21 +171,20 @@
171
171
  "local-pkg": "^1.1.2",
172
172
  "lru-cache": "10.4.3",
173
173
  "magic-string": "0.30.19",
174
- "semver": "~7.7.2",
174
+ "semver": "~7.7.3",
175
175
  "tailwindcss-patch": "~7.1.6",
176
176
  "vue": "^3.5.22",
177
177
  "webpack-sources": "3.3.3",
178
- "@weapp-tailwindcss/init": "1.0.7",
179
178
  "@weapp-tailwindcss/logger": "1.1.0",
180
179
  "@weapp-tailwindcss/mangle": "1.0.5",
181
- "@weapp-tailwindcss/postcss": "1.3.1",
180
+ "@weapp-tailwindcss/postcss": "1.3.2-alpha.0",
182
181
  "@weapp-tailwindcss/shared": "1.0.3"
183
182
  },
184
183
  "devDependencies": {
185
184
  "@ampproject/remapping": "^2.3.0",
186
185
  "@csstools/postcss-is-pseudo-class": "^5.0.3",
187
186
  "clsx": "^2.1.1",
188
- "rollup": "^4.52.3"
187
+ "rollup": "^4.52.4"
189
188
  },
190
189
  "scripts": {
191
190
  "dev": "tsup --watch --sourcemap",
@@ -1,13 +0,0 @@
1
- // src/debug/index.ts
2
- import _createDebug from "debug";
3
- var _debug = _createDebug("weapp-tw");
4
- function createDebug(prefix) {
5
- function debug(formatter, ...args) {
6
- return _debug((prefix ?? "") + formatter, ...args);
7
- }
8
- return debug;
9
- }
10
-
11
- export {
12
- createDebug
13
- };
@@ -1,141 +0,0 @@
1
- import {
2
- createDebug
3
- } from "./chunk-3AUX4FGE.mjs";
4
- import {
5
- getCompilerContext
6
- } from "./chunk-3KXFKRIX.mjs";
7
-
8
- // src/bundlers/gulp/index.ts
9
- import { Buffer } from "buffer";
10
- import stream from "stream";
11
- var debug = createDebug();
12
- var Transform = stream.Transform;
13
- function createPlugins(options = {}) {
14
- const opts = getCompilerContext(options);
15
- const { templateHandler, styleHandler, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
16
- let runtimeSet = /* @__PURE__ */ new Set();
17
- twPatcher.patch();
18
- function transformWxss(options2 = {}) {
19
- return new Transform({
20
- objectMode: true,
21
- async transform(file, _encoding, callback) {
22
- runtimeSet = await twPatcher.getClassSet();
23
- setMangleRuntimeSet(runtimeSet);
24
- const error = null;
25
- if (file.contents) {
26
- const rawSource = file.contents.toString();
27
- const hash = cache.computeHash(rawSource);
28
- cache.calcHashValueChanged(file.path, hash);
29
- await cache.process(
30
- file.path,
31
- () => {
32
- const source = cache.get(file.path);
33
- if (source) {
34
- file.contents = Buffer.from(source);
35
- debug("css cache hit: %s", file.path);
36
- } else {
37
- return false;
38
- }
39
- },
40
- async () => {
41
- const { css } = await styleHandler(rawSource, {
42
- isMainChunk: true,
43
- majorVersion: twPatcher.majorVersion,
44
- ...options2
45
- });
46
- file.contents = Buffer.from(css);
47
- debug("css handle: %s", file.path);
48
- return {
49
- key: file.path,
50
- source: css
51
- };
52
- }
53
- );
54
- }
55
- callback(error, file);
56
- }
57
- });
58
- }
59
- function transformJs(options2 = {}) {
60
- return new Transform({
61
- objectMode: true,
62
- async transform(file, _encoding, callback) {
63
- const error = null;
64
- if (file.contents) {
65
- const rawSource = file.contents.toString();
66
- const hash = cache.computeHash(rawSource);
67
- cache.calcHashValueChanged(file.path, hash);
68
- await cache.process(
69
- file.path,
70
- () => {
71
- const source = cache.get(file.path);
72
- if (source) {
73
- file.contents = Buffer.from(source);
74
- debug("js cache hit: %s", file.path);
75
- } else {
76
- return false;
77
- }
78
- },
79
- async () => {
80
- const { code } = await jsHandler(rawSource, runtimeSet, options2);
81
- file.contents = Buffer.from(code);
82
- debug("js handle: %s", file.path);
83
- return {
84
- key: file.path,
85
- source: code
86
- };
87
- }
88
- );
89
- }
90
- callback(error, file);
91
- }
92
- });
93
- }
94
- function transformWxml(options2 = {}) {
95
- return new Transform({
96
- objectMode: true,
97
- async transform(file, _encoding, callback) {
98
- const error = null;
99
- if (file.contents) {
100
- const rawSource = file.contents.toString();
101
- const hash = cache.computeHash(rawSource);
102
- cache.calcHashValueChanged(file.path, hash);
103
- await cache.process(
104
- file.path,
105
- () => {
106
- const source = cache.get(file.path);
107
- if (source) {
108
- file.contents = Buffer.from(source);
109
- debug("html cache hit: %s", file.path);
110
- } else {
111
- return false;
112
- }
113
- },
114
- async () => {
115
- const code = await templateHandler(rawSource, {
116
- runtimeSet,
117
- ...options2
118
- });
119
- file.contents = Buffer.from(code);
120
- debug("html handle: %s", file.path);
121
- return {
122
- key: file.path,
123
- source: code
124
- };
125
- }
126
- );
127
- }
128
- callback(error, file);
129
- }
130
- });
131
- }
132
- return {
133
- transformWxss,
134
- transformWxml,
135
- transformJs
136
- };
137
- }
138
-
139
- export {
140
- createPlugins
141
- };