weapp-tailwindcss 4.3.3 → 4.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 (55) hide show
  1. package/dist/chunk-2NRTWL47.js +43 -0
  2. package/dist/{chunk-3KXFKRIX.mjs → chunk-D25XJJMP.mjs} +593 -316
  3. package/dist/chunk-D2AKCBDU.mjs +122 -0
  4. package/dist/{chunk-L36QGA7Y.mjs → chunk-FBGUUXQV.mjs} +1 -1
  5. package/dist/{chunk-A75TB5TE.js → chunk-FOSGDQZ7.js} +34 -43
  6. package/dist/{chunk-3KMEJ2LM.js → chunk-GQAB52GE.js} +594 -317
  7. package/dist/chunk-H2Y5VNOJ.js +122 -0
  8. package/dist/chunk-H4JTYYOI.mjs +43 -0
  9. package/dist/{chunk-5BTC4YQI.mjs → chunk-IHKVNALD.mjs} +29 -38
  10. package/dist/{chunk-M7PVNKCH.mjs → chunk-L3HOZDIV.mjs} +45 -57
  11. package/dist/{chunk-GFQ2R7SX.mjs → chunk-NDHL3P32.mjs} +127 -129
  12. package/dist/{chunk-JDLLZFZX.js → chunk-QXCC745G.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-L7VNJFIK.js → chunk-VN2BU7ON.js} +129 -131
  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.d.mts +1 -1
  24. package/dist/css-macro.d.ts +1 -1
  25. package/dist/css-macro.js +31 -19
  26. package/dist/css-macro.mjs +30 -18
  27. package/dist/defaults.js +4 -4
  28. package/dist/defaults.mjs +3 -3
  29. package/dist/escape.js +1 -1
  30. package/dist/escape.mjs +1 -1
  31. package/dist/gulp.js +7 -7
  32. package/dist/gulp.mjs +6 -6
  33. package/dist/index.js +9 -9
  34. package/dist/index.mjs +8 -8
  35. package/dist/postcss-html-transform.js +1 -1
  36. package/dist/postcss-html-transform.mjs +1 -1
  37. package/dist/presets.js +3 -3
  38. package/dist/presets.mjs +2 -2
  39. package/dist/types.d.mts +247 -246
  40. package/dist/types.d.ts +247 -246
  41. package/dist/types.js +1 -1
  42. package/dist/types.mjs +1 -1
  43. package/dist/vite.js +7 -7
  44. package/dist/vite.mjs +6 -6
  45. package/dist/webpack.js +7 -7
  46. package/dist/webpack.mjs +6 -6
  47. package/dist/webpack4.js +48 -63
  48. package/dist/webpack4.mjs +46 -61
  49. package/package.json +5 -6
  50. package/dist/chunk-3AUX4FGE.mjs +0 -13
  51. package/dist/chunk-GEUHO2UC.mjs +0 -141
  52. package/dist/chunk-LSSLYD6B.js +0 -13
  53. package/dist/chunk-QXQOYYCR.js +0 -26
  54. package/dist/chunk-TI4R65TB.js +0 -141
  55. package/dist/chunk-Y5AFAYKI.mjs +0 -26
@@ -0,0 +1,122 @@
1
+ import {
2
+ createDebug,
3
+ processCachedTask
4
+ } from "./chunk-H4JTYYOI.mjs";
5
+ import {
6
+ getCompilerContext
7
+ } from "./chunk-D25XJJMP.mjs";
8
+
9
+ // src/bundlers/gulp/index.ts
10
+ import { Buffer } from "buffer";
11
+ import stream from "stream";
12
+ var debug = createDebug();
13
+ var Transform = stream.Transform;
14
+ function createPlugins(options = {}) {
15
+ const opts = getCompilerContext(options);
16
+ const { templateHandler, styleHandler, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
17
+ let runtimeSet = /* @__PURE__ */ new Set();
18
+ twPatcher.patch();
19
+ function createVinylTransform(handler) {
20
+ return new Transform({
21
+ objectMode: true,
22
+ async transform(file, _encoding, callback) {
23
+ try {
24
+ await handler(file);
25
+ callback(null, file);
26
+ } catch (error) {
27
+ callback(error, file);
28
+ }
29
+ }
30
+ });
31
+ }
32
+ const transformWxss = (options2 = {}) => createVinylTransform(async (file) => {
33
+ if (!file.contents) {
34
+ return;
35
+ }
36
+ runtimeSet = await twPatcher.getClassSet();
37
+ setMangleRuntimeSet(runtimeSet);
38
+ const rawSource = file.contents.toString();
39
+ await processCachedTask({
40
+ cache,
41
+ cacheKey: file.path,
42
+ rawSource,
43
+ applyResult(source) {
44
+ file.contents = Buffer.from(source);
45
+ },
46
+ onCacheHit() {
47
+ debug("css cache hit: %s", file.path);
48
+ },
49
+ async transform() {
50
+ const { css } = await styleHandler(rawSource, {
51
+ isMainChunk: true,
52
+ majorVersion: twPatcher.majorVersion,
53
+ ...options2
54
+ });
55
+ debug("css handle: %s", file.path);
56
+ return {
57
+ result: css
58
+ };
59
+ }
60
+ });
61
+ });
62
+ const transformJs = (options2 = {}) => createVinylTransform(async (file) => {
63
+ if (!file.contents) {
64
+ return;
65
+ }
66
+ const rawSource = file.contents.toString();
67
+ await processCachedTask({
68
+ cache,
69
+ cacheKey: file.path,
70
+ rawSource,
71
+ applyResult(source) {
72
+ file.contents = Buffer.from(source);
73
+ },
74
+ onCacheHit() {
75
+ debug("js cache hit: %s", file.path);
76
+ },
77
+ async transform() {
78
+ const { code } = await jsHandler(rawSource, runtimeSet, options2);
79
+ debug("js handle: %s", file.path);
80
+ return {
81
+ result: code
82
+ };
83
+ }
84
+ });
85
+ });
86
+ const transformWxml = (options2 = {}) => createVinylTransform(async (file) => {
87
+ if (!file.contents) {
88
+ return;
89
+ }
90
+ const rawSource = file.contents.toString();
91
+ await processCachedTask({
92
+ cache,
93
+ cacheKey: file.path,
94
+ rawSource,
95
+ applyResult(source) {
96
+ file.contents = Buffer.from(source);
97
+ },
98
+ onCacheHit() {
99
+ debug("html cache hit: %s", file.path);
100
+ },
101
+ async transform() {
102
+ const code = await templateHandler(rawSource, {
103
+ runtimeSet,
104
+ ...options2
105
+ });
106
+ debug("html handle: %s", file.path);
107
+ return {
108
+ result: code
109
+ };
110
+ }
111
+ });
112
+ });
113
+ return {
114
+ transformWxss,
115
+ transformWxml,
116
+ transformJs
117
+ };
118
+ }
119
+
120
+ export {
121
+ createPlugins
122
+ };
@@ -1,4 +1,4 @@
1
- // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.6.0_postcss@8.5.6_tsx@4.20.6_typescript@5.9.2_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
1
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
2
2
  import path from "path";
3
3
  import { fileURLToPath } from "url";
4
4
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -1,10 +1,33 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkQXQOYYCRjs = require('./chunk-QXQOYYCR.js');
3
+ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
4
4
 
5
5
  // src/defaults.ts
6
6
  var _escape = require('@weapp-core/escape');
7
7
  var _localpkg = require('local-pkg');
8
+ var CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
9
+ var HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
10
+ var JS_FILE_PATTERN = /.+\.[cm]?js?$/;
11
+ var MAIN_CSS_CHUNK_MATCHERS = {
12
+ "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
13
+ "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
14
+ "mpx": (file) => file.startsWith("app"),
15
+ "taro": (file) => file.startsWith("app"),
16
+ "remax": (file) => file.startsWith("app"),
17
+ "rax": (file) => file.startsWith("bundle"),
18
+ "native": (file) => file.startsWith("app"),
19
+ "kbone": (file) => /^(?:common\/)?miniprogram-app/.test(file)
20
+ };
21
+ var alwaysFalse = () => false;
22
+ function createMainCssChunkMatcher() {
23
+ return (file, appType) => {
24
+ if (!appType) {
25
+ return true;
26
+ }
27
+ const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
28
+ return matcher ? matcher(file) : true;
29
+ };
30
+ }
8
31
  function getDefaultOptions() {
9
32
  return {
10
33
  /**
@@ -16,7 +39,7 @@ function getDefaultOptions() {
16
39
  * css 最正常的样式文件
17
40
  * tyss 涂鸦小程序
18
41
  */
19
- cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/.test(file),
42
+ cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
20
43
  /**
21
44
  * wxml 微信小程序
22
45
  * axml 支付宝小程序
@@ -28,47 +51,15 @@ function getDefaultOptions() {
28
51
  * xhsml 小红书小程序
29
52
  * swan 百度小程序
30
53
  */
31
- htmlMatcher: (file) => /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/.test(file),
54
+ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
32
55
  jsMatcher: (file) => {
33
56
  if (file.includes("node_modules")) {
34
57
  return false;
35
58
  }
36
- return /.+\.[cm]?js?$/.test(file);
37
- },
38
- mainCssChunkMatcher: (file, appType) => {
39
- switch (appType) {
40
- case "uni-app": {
41
- return file.startsWith("common/main") || file.startsWith("app");
42
- }
43
- case "uni-app-vite": {
44
- return file.startsWith("app") || file.startsWith("common/main");
45
- }
46
- case "mpx": {
47
- return file.startsWith("app");
48
- }
49
- case "taro": {
50
- return file.startsWith("app");
51
- }
52
- case "remax": {
53
- return file.startsWith("app");
54
- }
55
- case "rax": {
56
- return file.startsWith("bundle");
57
- }
58
- case "native": {
59
- return file.startsWith("app");
60
- }
61
- case "kbone": {
62
- return /^(?:common\/)?miniprogram-app/.test(file);
63
- }
64
- default: {
65
- return true;
66
- }
67
- }
68
- },
69
- wxsMatcher: () => {
70
- return false;
59
+ return JS_FILE_PATTERN.test(file);
71
60
  },
61
+ mainCssChunkMatcher: createMainCssChunkMatcher(),
62
+ wxsMatcher: alwaysFalse,
72
63
  // https://tailwindcss.com/docs/preflight#border-styles-are-reset-globally
73
64
  cssPreflight: {
74
65
  "box-sizing": "border-box",
@@ -77,11 +68,11 @@ function getDefaultOptions() {
77
68
  "border-color": "currentColor"
78
69
  },
79
70
  disabled: false,
80
- customRuleCallback: _chunkQXQOYYCRjs.noop,
81
- onLoad: _chunkQXQOYYCRjs.noop,
82
- onStart: _chunkQXQOYYCRjs.noop,
83
- onEnd: _chunkQXQOYYCRjs.noop,
84
- onUpdate: _chunkQXQOYYCRjs.noop,
71
+ customRuleCallback: _chunkUW3WHSZ5js.noop,
72
+ onLoad: _chunkUW3WHSZ5js.noop,
73
+ onStart: _chunkUW3WHSZ5js.noop,
74
+ onEnd: _chunkUW3WHSZ5js.noop,
75
+ onUpdate: _chunkUW3WHSZ5js.noop,
85
76
  customAttributes: {},
86
77
  customReplaceDictionary: _escape.MappingChars2String,
87
78
  appType: void 0,