weapp-tailwindcss 3.2.1 → 3.3.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 (58) hide show
  1. package/dist/bundlers/vite/index.d.ts +1 -1
  2. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +1 -1
  3. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  4. package/dist/cli.js +12 -11
  5. package/dist/cli.mjs +6 -6
  6. package/dist/{constants-D-YMDg7M.js → constants-CFM1J-h1.js} +3 -3
  7. package/dist/{constants-CcqTvLgQ.mjs → constants-Dy2Dd3Fz.mjs} +3 -3
  8. package/dist/core.d.ts +1 -1
  9. package/dist/core.js +12 -13
  10. package/dist/core.mjs +12 -13
  11. package/dist/css-macro/index.js +2 -2
  12. package/dist/css-macro/index.mjs +2 -2
  13. package/dist/css-macro/postcss.js +8 -8
  14. package/dist/css-macro/postcss.mjs +8 -8
  15. package/dist/{defaults-DOGbAFEj.mjs → defaults-BDivGN-J.mjs} +10 -10
  16. package/dist/{defaults-CGBcgdIr.js → defaults-z7wUEh47.js} +10 -10
  17. package/dist/defaults.js +1 -1
  18. package/dist/defaults.mjs +1 -1
  19. package/dist/extractors/split.d.ts +1 -1
  20. package/dist/gulp.js +7 -5
  21. package/dist/gulp.mjs +7 -5
  22. package/dist/{index-UGtfFwsf.mjs → index-BMv1aBKz.mjs} +13 -16
  23. package/dist/{index-DC60ES8u.mjs → index-BPzIdybK.mjs} +91 -91
  24. package/dist/{index-EnQF5WiI.mjs → index-Bm-88xa7.mjs} +14 -16
  25. package/dist/{index-iiM-deHl.js → index-CeRMFNvT.js} +13 -16
  26. package/dist/{index-6BUjj8Rl.js → index-DwZHOkK3.js} +91 -91
  27. package/dist/{index-BpY7tq3j.js → index-oneQz6yy.js} +20 -22
  28. package/dist/index.js +9 -7
  29. package/dist/index.mjs +9 -7
  30. package/dist/js/handlers.d.ts +1 -1
  31. package/dist/mangle/index.d.ts +1 -1
  32. package/dist/{options-BjZGMFOk.js → options-DCor-e5I.js} +80 -74
  33. package/dist/{options-D1IYbX_E.mjs → options-SmfRHxH0.mjs} +82 -75
  34. package/dist/postcss/plugins/index.d.ts +2 -2
  35. package/dist/postcss/preflight.d.ts +1 -1
  36. package/dist/postcss/selectorParser.d.ts +1 -1
  37. package/dist/postcss/shared.d.ts +1 -1
  38. package/dist/postcss.js +2 -2
  39. package/dist/postcss.mjs +2 -2
  40. package/dist/replace.d.ts +1 -1
  41. package/dist/replace.js +3 -3
  42. package/dist/replace.mjs +3 -3
  43. package/dist/{shared-BX0VV-pr.mjs → shared-DbJl6i6a.mjs} +2 -2
  44. package/dist/{shared-BDew1Ric.js → shared-hzYeE1wX.js} +2 -2
  45. package/dist/tailwindcss/patcher.d.ts +4 -3
  46. package/dist/types.d.ts +7 -5
  47. package/dist/utils.d.ts +1 -1
  48. package/dist/{v5-C6FTqEeL.mjs → v5-CQUeTJ2W.mjs} +16 -19
  49. package/dist/{v5-DA4DSMKO.js → v5-ea_QoULz.js} +16 -19
  50. package/dist/vite.js +6 -5
  51. package/dist/vite.mjs +6 -5
  52. package/dist/webpack.js +6 -5
  53. package/dist/webpack.mjs +6 -5
  54. package/dist/webpack4.js +17 -19
  55. package/dist/webpack4.mjs +17 -19
  56. package/dist/wxml/shared.d.ts +1 -1
  57. package/dist/wxml/utils.d.ts +2 -2
  58. package/package.json +80 -78
package/dist/webpack4.mjs CHANGED
@@ -1,15 +1,15 @@
1
- import { g as getOptions, c as createTailwindcssPatcher, _ as __awaiter } from './options-D1IYbX_E.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-SmfRHxH0.mjs';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import { ConcatSource, RawSource } from 'webpack-sources';
5
- import { b as pluginName } from './index-DC60ES8u.mjs';
6
- import { g as getGroupedEntries, r as removeExt } from './defaults-DOGbAFEj.mjs';
5
+ import { b as pluginName } from './index-BPzIdybK.mjs';
6
+ import { g as getGroupedEntries, r as removeExt } from './defaults-BDivGN-J.mjs';
7
7
  import { c as createDebug } from './index-BEIjgKpF.mjs';
8
8
  import 'magic-string';
9
9
  import './replace.mjs';
10
10
  import '@weapp-core/escape';
11
11
  import '@ast-core/escape';
12
- import './shared-BX0VV-pr.mjs';
12
+ import './shared-DbJl6i6a.mjs';
13
13
  import '@weapp-core/regex';
14
14
  import '@babel/generator';
15
15
  import '@babel/traverse';
@@ -17,6 +17,7 @@ import '@babel/parser';
17
17
  import '@babel/types';
18
18
  import 'htmlparser2';
19
19
  import 'postcss';
20
+ import 'node:process';
20
21
  import 'semver';
21
22
  import 'tailwindcss-patch';
22
23
  import '@tailwindcss-mangle/shared';
@@ -35,16 +36,13 @@ class UnifiedWebpackPluginV4 {
35
36
  this.appType = this.options.appType;
36
37
  }
37
38
  apply(compiler) {
38
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
39
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
39
40
  if (disabled) {
40
41
  return;
41
42
  }
42
43
  patch === null || patch === void 0 ? void 0 : patch();
43
- const twPatcher = createTailwindcssPatcher();
44
44
  function getClassSet() {
45
- return twPatcher.getClassSet({
46
- basedir: tailwindcssBasedir
47
- });
45
+ return twPatcher.getClassSet();
48
46
  }
49
47
  onLoad();
50
48
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -52,15 +50,15 @@ class UnifiedWebpackPluginV4 {
52
50
  const WeappTwRuntimeAopLoader = {
53
51
  loader,
54
52
  options: {
55
- getClassSet
53
+ getClassSet,
56
54
  },
57
55
  ident: null,
58
- type: null
56
+ type: null,
59
57
  };
60
58
  compiler.hooks.compilation.tap(pluginName, (compilation) => {
61
59
  compilation.hooks.normalModuleLoader.tap(pluginName, (loaderContext, module) => {
62
60
  if (isExisted) {
63
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
61
+ const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
64
62
  if (idx > -1) {
65
63
  module.loaders.unshift(WeappTwRuntimeAopLoader);
66
64
  }
@@ -100,7 +98,7 @@ class UnifiedWebpackPluginV4 {
100
98
  }
101
99
  }, () => __awaiter(this, void 0, void 0, function* () {
102
100
  const wxml = yield templateHandler(rawSource, {
103
- runtimeSet
101
+ runtimeSet,
104
102
  });
105
103
  const source = new ConcatSource(wxml);
106
104
  compilation.updateAsset(file, source);
@@ -109,7 +107,7 @@ class UnifiedWebpackPluginV4 {
109
107
  noCachedCount++;
110
108
  return {
111
109
  key: cacheKey,
112
- source
110
+ source,
113
111
  };
114
112
  }));
115
113
  }
@@ -131,10 +129,10 @@ class UnifiedWebpackPluginV4 {
131
129
  }
132
130
  }, () => __awaiter(this, void 0, void 0, function* () {
133
131
  const rawSource = originalSource.source().toString();
134
- const mapFilename = file + '.map';
132
+ const mapFilename = `${file}.map`;
135
133
  const hasMap = Boolean(assets[mapFilename]);
136
134
  const { code, map } = yield jsHandler(rawSource, runtimeSet, {
137
- generateMap: hasMap
135
+ generateMap: hasMap,
138
136
  });
139
137
  const source = new ConcatSource(code);
140
138
  compilation.updateAsset(file, source);
@@ -147,7 +145,7 @@ class UnifiedWebpackPluginV4 {
147
145
  }
148
146
  return {
149
147
  key: cacheKey,
150
- source
148
+ source,
151
149
  };
152
150
  }));
153
151
  }
@@ -172,7 +170,7 @@ class UnifiedWebpackPluginV4 {
172
170
  }
173
171
  }, () => __awaiter(this, void 0, void 0, function* () {
174
172
  const css = yield styleHandler(rawSource, {
175
- isMainChunk: mainCssChunkMatcher(file, this.appType)
173
+ isMainChunk: mainCssChunkMatcher(file, this.appType),
176
174
  });
177
175
  const source = new ConcatSource(css);
178
176
  compilation.updateAsset(file, source);
@@ -181,7 +179,7 @@ class UnifiedWebpackPluginV4 {
181
179
  noCachedCount++;
182
180
  return {
183
181
  key: cacheKey,
184
- source
182
+ source,
185
183
  };
186
184
  }));
187
185
  }
@@ -1,2 +1,2 @@
1
- import { ITemplateHandlerOptions } from "../types";
1
+ import type { ITemplateHandlerOptions } from "../types";
2
2
  export declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
@@ -1,5 +1,5 @@
1
- import { ItemOrItemArray } from "../reg";
2
- import type { RawSource, ITemplateHandlerOptions } from "../types";
1
+ import type { ItemOrItemArray } from "../reg";
2
+ import type { ITemplateHandlerOptions, RawSource } from "../types";
3
3
  export declare function generateCode(match: string, options?: ITemplateHandlerOptions): string;
4
4
  export declare function extractSource(original: string): RawSource[];
5
5
  export declare function templateReplacer(original: string, options?: ITemplateHandlerOptions): string;
package/package.json CHANGED
@@ -1,68 +1,105 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "description": "把tailwindcss jit引擎,带给小程序开发者们! bring tailwindcss jit engine to miniprogram developers!",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
5
+ "author": "SonOfMagic <qq1324318532@gmail.com>",
6
+ "license": "MIT",
7
+ "homepage": "https://weapp-tw.icebreaker.top",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/sonofmagic/weapp-tailwindcss.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/sonofmagic/weapp-tailwindcss/issues"
14
+ },
15
+ "keywords": [
16
+ "tailwindcss",
17
+ "weapp",
18
+ "wechat",
19
+ "mini",
20
+ "miniprogram",
21
+ "mini app",
22
+ "weapp-tw",
23
+ "weapp-tailwindcss",
24
+ "taro",
25
+ "uni-app",
26
+ "remax",
27
+ "rax",
28
+ "mpx",
29
+ "jit",
30
+ "mp",
31
+ "android",
32
+ "ios",
33
+ "小程序",
34
+ "vite",
35
+ "postcss",
36
+ "webpack",
37
+ "webpack-plugin",
38
+ "gulp",
39
+ "gulp-plugin"
40
+ ],
41
+ "sideEffects": false,
8
42
  "exports": {
9
43
  ".": {
10
44
  "types": "./dist/index.d.ts",
11
- "require": "./dist/index.js",
12
- "import": "./dist/index.mjs"
45
+ "import": "./dist/index.mjs",
46
+ "require": "./dist/index.js"
13
47
  },
14
48
  "./replace": {
15
49
  "types": "./dist/replace.d.ts",
16
- "require": "./dist/replace.js",
17
- "import": "./dist/replace.mjs"
50
+ "import": "./dist/replace.mjs",
51
+ "require": "./dist/replace.js"
18
52
  },
19
53
  "./postcss": {
20
54
  "types": "./dist/postcss.d.ts",
21
- "require": "./dist/postcss.js",
22
- "import": "./dist/postcss.mjs"
55
+ "import": "./dist/postcss.mjs",
56
+ "require": "./dist/postcss.js"
23
57
  },
24
58
  "./vite": {
25
59
  "types": "./dist/vite.d.ts",
26
- "require": "./dist/vite.js",
27
- "import": "./dist/vite.mjs"
60
+ "import": "./dist/vite.mjs",
61
+ "require": "./dist/vite.js"
28
62
  },
29
63
  "./webpack": {
30
64
  "types": "./dist/webpack.d.ts",
31
- "require": "./dist/webpack.js",
32
- "import": "./dist/webpack.mjs"
65
+ "import": "./dist/webpack.mjs",
66
+ "require": "./dist/webpack.js"
33
67
  },
34
68
  "./webpack4": {
35
69
  "types": "./dist/webpack4.d.ts",
36
- "require": "./dist/webpack4.js",
37
- "import": "./dist/webpack4.mjs"
70
+ "import": "./dist/webpack4.mjs",
71
+ "require": "./dist/webpack4.js"
38
72
  },
39
73
  "./core": {
40
74
  "types": "./dist/core.d.ts",
41
- "require": "./dist/core.js",
42
- "import": "./dist/core.mjs"
75
+ "import": "./dist/core.mjs",
76
+ "require": "./dist/core.js"
43
77
  },
44
78
  "./gulp": {
45
79
  "types": "./dist/gulp.d.ts",
46
- "require": "./dist/gulp.js",
47
- "import": "./dist/gulp.mjs"
80
+ "import": "./dist/gulp.mjs",
81
+ "require": "./dist/gulp.js"
48
82
  },
49
83
  "./defaults": {
50
84
  "types": "./dist/defaults.d.ts",
51
- "require": "./dist/defaults.js",
52
- "import": "./dist/defaults.mjs"
85
+ "import": "./dist/defaults.mjs",
86
+ "require": "./dist/defaults.js"
53
87
  },
54
88
  "./css-macro/postcss": {
55
89
  "types": "./dist/css-macro/postcss.d.ts",
56
- "require": "./dist/css-macro/postcss.js",
57
- "import": "./dist/css-macro/postcss.mjs"
90
+ "import": "./dist/css-macro/postcss.mjs",
91
+ "require": "./dist/css-macro/postcss.js"
58
92
  },
59
93
  "./css-macro": {
60
94
  "types": "./dist/css-macro/index.d.ts",
61
- "require": "./dist/css-macro/index.js",
62
- "import": "./dist/css-macro/index.mjs"
95
+ "import": "./dist/css-macro/index.mjs",
96
+ "require": "./dist/css-macro/index.js"
63
97
  },
64
98
  "./*": "./*"
65
99
  },
100
+ "main": "dist/index.js",
101
+ "module": "dist/index.mjs",
102
+ "types": "dist/index.d.ts",
66
103
  "typesVersions": {
67
104
  "*": {
68
105
  "*": [
@@ -71,67 +108,33 @@
71
108
  ]
72
109
  }
73
110
  },
74
- "sideEffects": false,
75
- "repository": {
76
- "type": "git",
77
- "url": "git+https://github.com/sonofmagic/weapp-tailwindcss.git"
111
+ "bin": {
112
+ "weapp-tailwindcss-webpack-plugin": "bin/weapp-tailwindcss.js",
113
+ "weapp-tailwindcss": "bin/weapp-tailwindcss.js",
114
+ "weapp-tw": "bin/weapp-tailwindcss.js"
78
115
  },
79
116
  "files": [
80
117
  "bin",
81
118
  "dist"
82
119
  ],
83
- "bin": {
84
- "weapp-tailwindcss-webpack-plugin": "bin/weapp-tailwindcss.js",
85
- "weapp-tailwindcss": "bin/weapp-tailwindcss.js",
86
- "weapp-tw": "bin/weapp-tailwindcss.js"
120
+ "engines": {
121
+ "node": ">=16.6.0"
87
122
  },
88
123
  "publishConfig": {
89
124
  "access": "public",
90
125
  "registry": "https://registry.npmjs.org"
91
126
  },
92
- "keywords": [
93
- "tailwindcss",
94
- "weapp",
95
- "wechat",
96
- "mini",
97
- "miniprogram",
98
- "mini app",
99
- "weapp-tw",
100
- "weapp-tailwindcss",
101
- "taro",
102
- "uni-app",
103
- "remax",
104
- "rax",
105
- "mpx",
106
- "jit",
107
- "mp",
108
- "android",
109
- "ios",
110
- "小程序",
111
- "vite",
112
- "postcss",
113
- "webpack",
114
- "webpack-plugin",
115
- "gulp",
116
- "gulp-plugin"
117
- ],
118
- "author": "SonOfMagic <qq1324318532@gmail.com>",
119
- "license": "MIT",
120
- "bugs": {
121
- "url": "https://github.com/sonofmagic/weapp-tailwindcss/issues"
122
- },
123
- "homepage": "https://weapp-tw.icebreaker.top",
124
127
  "dependencies": {
125
128
  "@ast-core/escape": "^1.0.1",
126
- "@babel/generator": "7.24.5",
127
- "@babel/parser": "7.24.5",
128
- "@babel/traverse": "7.24.5",
129
- "@babel/types": "7.24.5",
130
- "@csstools/postcss-is-pseudo-class": "4.0.6",
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",
131
134
  "@tailwindcss-mangle/shared": "^2.2.2",
132
135
  "@weapp-core/escape": "^2.0.0",
133
136
  "@weapp-core/regex": "^1.0.1",
134
- "debug": "4.3.4",
137
+ "debug": "4.3.5",
135
138
  "htmlparser2": "9.1.0",
136
139
  "loader-utils": "2.0.4",
137
140
  "lru-cache": "10.2.2",
@@ -139,14 +142,11 @@
139
142
  "md5": "2.3.0",
140
143
  "postcss": "8.4.38",
141
144
  "postcss-rem-to-responsive-pixel": "^6.0.1",
142
- "postcss-selector-parser": "6.0.16",
143
- "semver": "7.6.1",
144
- "tailwindcss-patch": "^2.2.3",
145
+ "postcss-selector-parser": "6.1.0",
146
+ "semver": "7.6.2",
147
+ "tailwindcss-patch": "^3.0.0",
145
148
  "webpack-sources": "3.2.3"
146
149
  },
147
- "engines": {
148
- "node": ">=16.6.0"
149
- },
150
150
  "scripts": {
151
151
  "dev": "pnpm clean && pnpm dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
152
152
  "build": "pnpm clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && pnpm dts",
@@ -168,6 +168,8 @@
168
168
  "bump": "bumpp",
169
169
  "release": "node scripts/release.js",
170
170
  "generate:readme": "ts-node scripts/readme/write.ts",
171
+ "lint": "eslint .",
172
+ "lint:fix": "eslint ./test --fix",
171
173
  "-------": "-----------",
172
174
  "postinstall": "node bin/weapp-tailwindcss.js patch"
173
175
  }