weapp-tailwindcss 4.0.2 → 4.0.3-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 (56) hide show
  1. package/dist/chunk-2XGDXMFW.mjs +144 -0
  2. package/dist/{chunk-75EWCRQW.mjs → chunk-3AUX4FGE.mjs} +1 -1
  3. package/dist/{chunk-FHP2IWTD.mjs → chunk-5VREU6OZ.mjs} +189 -199
  4. package/dist/{chunk-YUXG2EJF.js → chunk-7FQEXXKJ.js} +6 -6
  5. package/dist/{chunk-RHTRRSP3.mjs → chunk-AFETST4F.mjs} +1 -1
  6. package/dist/{chunk-3HOCRXDT.mjs → chunk-E6GMQWXH.mjs} +22 -22
  7. package/dist/chunk-GXHC2INT.mjs +167 -0
  8. package/dist/chunk-IH4SPSSD.js +7 -0
  9. package/dist/chunk-INPHAJ2H.js +144 -0
  10. package/dist/{chunk-XKF5XSEO.js → chunk-KEPAORFQ.js} +28 -31
  11. package/dist/{chunk-HBQASQKY.js → chunk-LSSLYD6B.js} +2 -2
  12. package/dist/{chunk-NSZPW6UU.js → chunk-MCXEMTT6.js} +201 -208
  13. package/dist/{chunk-6Z776ZWK.js → chunk-NS3NEDWD.js} +1 -1
  14. package/dist/{chunk-AB467PG7.mjs → chunk-RGXLY3HG.mjs} +1 -1
  15. package/dist/chunk-UZEAMGMU.js +167 -0
  16. package/dist/chunk-X5LVW3JI.mjs +10 -0
  17. package/dist/cli.js +10 -10
  18. package/dist/cli.mjs +6 -6
  19. package/dist/core.js +9 -13
  20. package/dist/core.mjs +8 -12
  21. package/dist/css-macro/postcss.js +6 -7
  22. package/dist/css-macro/postcss.mjs +3 -4
  23. package/dist/css-macro.js +8 -8
  24. package/dist/css-macro.mjs +3 -3
  25. package/dist/defaults.js +4 -4
  26. package/dist/defaults.mjs +3 -3
  27. package/dist/escape.js +3 -3
  28. package/dist/escape.mjs +2 -2
  29. package/dist/gulp.js +8 -8
  30. package/dist/gulp.mjs +7 -7
  31. package/dist/index.js +12 -12
  32. package/dist/index.mjs +11 -11
  33. package/dist/types.js +2 -1
  34. package/dist/types.mjs +2 -1
  35. package/dist/vite.js +9 -9
  36. package/dist/vite.mjs +8 -8
  37. package/dist/weapp-tw-runtime-loader.js +28 -5
  38. package/dist/webpack.js +9 -9
  39. package/dist/webpack.mjs +8 -8
  40. package/dist/webpack4.js +30 -32
  41. package/dist/webpack4.mjs +24 -24
  42. package/package.json +4 -4
  43. package/dist/chunk-6FNC3XMI.js +0 -45
  44. package/dist/chunk-AXBFBHS2.mjs +0 -45
  45. package/dist/chunk-D6FTUNLD.mjs +0 -172
  46. package/dist/chunk-G63AWKPG.js +0 -172
  47. package/dist/chunk-MGGYACFY.js +0 -152
  48. package/dist/chunk-TFTD2FWQ.mjs +0 -152
  49. /package/dist/{chunk-N62XM3T3.js → chunk-EHEK77RO.js} +0 -0
  50. /package/dist/{chunk-MUJ65IQ3.mjs → chunk-L4LCKH3T.mjs} +0 -0
  51. /package/dist/{chunk-HL6Y5PYZ.mjs → chunk-L7PW3J3N.mjs} +0 -0
  52. /package/dist/{chunk-FXPGR372.js → chunk-O2IOQ3BD.js} +0 -0
  53. /package/dist/{chunk-WGQLZ5K4.js → chunk-PLMJW644.js} +0 -0
  54. /package/dist/{chunk-PCBSAFQF.mjs → chunk-Q67IXIAH.mjs} +0 -0
  55. /package/dist/{chunk-35CYTBPM.js → chunk-SUFSR3LY.js} +0 -0
  56. /package/dist/{chunk-LOLJLZCX.mjs → chunk-YAN7TO2B.mjs} +0 -0
@@ -0,0 +1,144 @@
1
+ import {
2
+ createDebug
3
+ } from "./chunk-3AUX4FGE.mjs";
4
+ import {
5
+ getCompilerContext
6
+ } from "./chunk-5VREU6OZ.mjs";
7
+
8
+ // src/bundlers/gulp/index.ts
9
+ import { Buffer } from "node:buffer";
10
+ import stream from "node: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
+ ...options2
44
+ });
45
+ file.contents = Buffer.from(css);
46
+ debug("css handle: %s", file.path);
47
+ return {
48
+ key: file.path,
49
+ source: css
50
+ };
51
+ }
52
+ );
53
+ }
54
+ callback(error, file);
55
+ }
56
+ // construct(callback) {
57
+ // debug('transformWxss start')
58
+ // callback()
59
+ // }
60
+ });
61
+ }
62
+ function transformJs(options2 = {}) {
63
+ return new Transform({
64
+ objectMode: true,
65
+ async transform(file, _encoding, callback) {
66
+ const error = null;
67
+ if (file.contents) {
68
+ const rawSource = file.contents.toString();
69
+ const hash = cache.computeHash(rawSource);
70
+ cache.calcHashValueChanged(file.path, hash);
71
+ await cache.process(
72
+ file.path,
73
+ () => {
74
+ const source = cache.get(file.path);
75
+ if (source) {
76
+ file.contents = Buffer.from(source);
77
+ debug("js cache hit: %s", file.path);
78
+ } else {
79
+ return false;
80
+ }
81
+ },
82
+ async () => {
83
+ const { code } = await jsHandler(rawSource, runtimeSet, options2);
84
+ file.contents = Buffer.from(code);
85
+ debug("js handle: %s", file.path);
86
+ return {
87
+ key: file.path,
88
+ source: code
89
+ };
90
+ }
91
+ );
92
+ }
93
+ callback(error, file);
94
+ }
95
+ });
96
+ }
97
+ function transformWxml(options2 = {}) {
98
+ return new Transform({
99
+ objectMode: true,
100
+ async transform(file, _encoding, callback) {
101
+ const error = null;
102
+ if (file.contents) {
103
+ const rawSource = file.contents.toString();
104
+ const hash = cache.computeHash(rawSource);
105
+ cache.calcHashValueChanged(file.path, hash);
106
+ await cache.process(
107
+ file.path,
108
+ () => {
109
+ const source = cache.get(file.path);
110
+ if (source) {
111
+ file.contents = Buffer.from(source);
112
+ debug("html cache hit: %s", file.path);
113
+ } else {
114
+ return false;
115
+ }
116
+ },
117
+ async () => {
118
+ const code = await templateHandler(rawSource, {
119
+ runtimeSet,
120
+ ...options2
121
+ });
122
+ file.contents = Buffer.from(code);
123
+ debug("html handle: %s", file.path);
124
+ return {
125
+ key: file.path,
126
+ source: code
127
+ };
128
+ }
129
+ );
130
+ }
131
+ callback(error, file);
132
+ }
133
+ });
134
+ }
135
+ return {
136
+ transformWxss,
137
+ transformWxml,
138
+ transformJs
139
+ };
140
+ }
141
+
142
+ export {
143
+ createPlugins
144
+ };
@@ -3,7 +3,7 @@ import _createDebug from "debug";
3
3
  var _debug = _createDebug("weapp-tw");
4
4
  function createDebug(prefix) {
5
5
  function debug(formatter, ...args) {
6
- return _debug((prefix != null ? prefix : "") + formatter, ...args);
6
+ return _debug((prefix ?? "") + formatter, ...args);
7
7
  }
8
8
  return debug;
9
9
  }