weapp-tailwindcss 3.2.0 → 3.3.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 (60) hide show
  1. package/README.md +16 -18
  2. package/dist/bundlers/vite/index.d.ts +1 -1
  3. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +1 -1
  4. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  5. package/dist/cli.js +12 -11
  6. package/dist/cli.mjs +6 -6
  7. package/dist/{constants-D-YMDg7M.js → constants-CFM1J-h1.js} +3 -3
  8. package/dist/{constants-CcqTvLgQ.mjs → constants-Dy2Dd3Fz.mjs} +3 -3
  9. package/dist/core.d.ts +1 -1
  10. package/dist/core.js +12 -13
  11. package/dist/core.mjs +12 -13
  12. package/dist/css-macro/index.js +2 -2
  13. package/dist/css-macro/index.mjs +2 -2
  14. package/dist/css-macro/postcss.js +8 -8
  15. package/dist/css-macro/postcss.mjs +8 -8
  16. package/dist/{defaults-Cpt1fUNP.mjs → defaults-BDivGN-J.mjs} +11 -10
  17. package/dist/{defaults-Mf4eWves.js → defaults-z7wUEh47.js} +11 -10
  18. package/dist/defaults.js +1 -1
  19. package/dist/defaults.mjs +1 -1
  20. package/dist/extractors/split.d.ts +1 -1
  21. package/dist/gulp.js +7 -5
  22. package/dist/gulp.mjs +7 -5
  23. package/dist/{index-BUSWfTII.mjs → index-BMv1aBKz.mjs} +13 -19
  24. package/dist/{index-Br8RI9kF.mjs → index-BPzIdybK.mjs} +96 -87
  25. package/dist/{index-DTZy_RpB.mjs → index-Bm-88xa7.mjs} +14 -16
  26. package/dist/{index-D39btBag.js → index-CeRMFNvT.js} +13 -19
  27. package/dist/{index-DCE5ieKW.js → index-DwZHOkK3.js} +96 -87
  28. package/dist/{index-BVkWxeac.js → index-oneQz6yy.js} +20 -22
  29. package/dist/index.js +9 -7
  30. package/dist/index.mjs +9 -7
  31. package/dist/js/handlers.d.ts +1 -1
  32. package/dist/mangle/index.d.ts +1 -1
  33. package/dist/{options-D_WlG4zX.js → options-DCor-e5I.js} +90 -83
  34. package/dist/{options-Bx4whTEl.mjs → options-SmfRHxH0.mjs} +92 -84
  35. package/dist/options.d.ts +1 -1
  36. package/dist/postcss/plugins/index.d.ts +2 -2
  37. package/dist/postcss/preflight.d.ts +1 -1
  38. package/dist/postcss/selectorParser.d.ts +1 -1
  39. package/dist/postcss/shared.d.ts +1 -1
  40. package/dist/postcss.js +2 -2
  41. package/dist/postcss.mjs +2 -2
  42. package/dist/replace.d.ts +1 -1
  43. package/dist/replace.js +3 -3
  44. package/dist/replace.mjs +3 -3
  45. package/dist/{shared-BX0VV-pr.mjs → shared-DbJl6i6a.mjs} +2 -2
  46. package/dist/{shared-BDew1Ric.js → shared-hzYeE1wX.js} +2 -2
  47. package/dist/tailwindcss/patcher.d.ts +4 -3
  48. package/dist/types.d.ts +10 -6
  49. package/dist/utils.d.ts +1 -1
  50. package/dist/{v5-CFnJIK3x.mjs → v5-CQUeTJ2W.mjs} +16 -22
  51. package/dist/{v5-8gu_iMbg.js → v5-ea_QoULz.js} +16 -22
  52. package/dist/vite.js +6 -5
  53. package/dist/vite.mjs +6 -5
  54. package/dist/webpack.js +6 -5
  55. package/dist/webpack.mjs +6 -5
  56. package/dist/webpack4.js +17 -22
  57. package/dist/webpack4.mjs +17 -22
  58. package/dist/wxml/shared.d.ts +1 -1
  59. package/dist/wxml/utils.d.ts +2 -2
  60. package/package.json +84 -82
package/dist/webpack4.mjs CHANGED
@@ -1,15 +1,15 @@
1
- import { g as getOptions, c as createTailwindcssPatcher, _ as __awaiter } from './options-Bx4whTEl.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-Br8RI9kF.mjs';
6
- import { g as getGroupedEntries, r as removeExt } from './defaults-Cpt1fUNP.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';
@@ -31,23 +32,17 @@ import 'debug';
31
32
  const debug = createDebug();
32
33
  class UnifiedWebpackPluginV4 {
33
34
  constructor(options = {}) {
34
- if (options.customReplaceDictionary === undefined) {
35
- options.customReplaceDictionary = 'simple';
36
- }
37
35
  this.options = getOptions(options);
38
36
  this.appType = this.options.appType;
39
37
  }
40
38
  apply(compiler) {
41
- 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;
42
40
  if (disabled) {
43
41
  return;
44
42
  }
45
43
  patch === null || patch === void 0 ? void 0 : patch();
46
- const twPatcher = createTailwindcssPatcher();
47
44
  function getClassSet() {
48
- return twPatcher.getClassSet({
49
- basedir: tailwindcssBasedir
50
- });
45
+ return twPatcher.getClassSet();
51
46
  }
52
47
  onLoad();
53
48
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -55,15 +50,15 @@ class UnifiedWebpackPluginV4 {
55
50
  const WeappTwRuntimeAopLoader = {
56
51
  loader,
57
52
  options: {
58
- getClassSet
53
+ getClassSet,
59
54
  },
60
55
  ident: null,
61
- type: null
56
+ type: null,
62
57
  };
63
58
  compiler.hooks.compilation.tap(pluginName, (compilation) => {
64
59
  compilation.hooks.normalModuleLoader.tap(pluginName, (loaderContext, module) => {
65
60
  if (isExisted) {
66
- const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
61
+ const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
67
62
  if (idx > -1) {
68
63
  module.loaders.unshift(WeappTwRuntimeAopLoader);
69
64
  }
@@ -103,7 +98,7 @@ class UnifiedWebpackPluginV4 {
103
98
  }
104
99
  }, () => __awaiter(this, void 0, void 0, function* () {
105
100
  const wxml = yield templateHandler(rawSource, {
106
- runtimeSet
101
+ runtimeSet,
107
102
  });
108
103
  const source = new ConcatSource(wxml);
109
104
  compilation.updateAsset(file, source);
@@ -112,7 +107,7 @@ class UnifiedWebpackPluginV4 {
112
107
  noCachedCount++;
113
108
  return {
114
109
  key: cacheKey,
115
- source
110
+ source,
116
111
  };
117
112
  }));
118
113
  }
@@ -134,10 +129,10 @@ class UnifiedWebpackPluginV4 {
134
129
  }
135
130
  }, () => __awaiter(this, void 0, void 0, function* () {
136
131
  const rawSource = originalSource.source().toString();
137
- const mapFilename = file + '.map';
132
+ const mapFilename = `${file}.map`;
138
133
  const hasMap = Boolean(assets[mapFilename]);
139
134
  const { code, map } = yield jsHandler(rawSource, runtimeSet, {
140
- generateMap: hasMap
135
+ generateMap: hasMap,
141
136
  });
142
137
  const source = new ConcatSource(code);
143
138
  compilation.updateAsset(file, source);
@@ -150,7 +145,7 @@ class UnifiedWebpackPluginV4 {
150
145
  }
151
146
  return {
152
147
  key: cacheKey,
153
- source
148
+ source,
154
149
  };
155
150
  }));
156
151
  }
@@ -175,7 +170,7 @@ class UnifiedWebpackPluginV4 {
175
170
  }
176
171
  }, () => __awaiter(this, void 0, void 0, function* () {
177
172
  const css = yield styleHandler(rawSource, {
178
- isMainChunk: mainCssChunkMatcher(file, this.appType)
173
+ isMainChunk: mainCssChunkMatcher(file, this.appType),
179
174
  });
180
175
  const source = new ConcatSource(css);
181
176
  compilation.updateAsset(file, source);
@@ -184,7 +179,7 @@ class UnifiedWebpackPluginV4 {
184
179
  noCachedCount++;
185
180
  return {
186
181
  key: cacheKey,
187
- source
182
+ source,
188
183
  };
189
184
  }));
190
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.0",
3
+ "version": "3.3.0-alpha.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.0",
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",
@@ -157,17 +157,19 @@
157
157
  "test:dev": "vitest",
158
158
  "test:ui": "vitest --ui",
159
159
  "vitest:coverage": "vitest run --coverage",
160
- "init:rename": "node scripts/init/rename.js",
161
160
  "clean": "node scripts/clean.js",
162
161
  "raw": "ts-node scripts/raw",
163
162
  "get-decl": "ts-node scripts/get-decl.ts",
164
- "sync": "cnpm sync weapp-tailwindcss-webpack-plugin weapp-tailwindcss",
165
- "generate:readme": "ts-node scripts/readme/write.ts",
163
+ "sync": "cnpm sync weapp-tailwindcss-webpack-plugin weapp-tailwindcss weapp-tw",
166
164
  "format": "prettier --check \"src/**/*.{ts,js}\" -w",
167
165
  "format:test": "prettier --check \"test/**/*.test.{ts,js}\" -w",
168
166
  "ls:pack": "npm pack --dry-run",
169
167
  "cli:patch": "node bin/weapp-tailwindcss.js patch",
170
- "release": "bumpp",
168
+ "bump": "bumpp",
169
+ "release": "node scripts/release.js",
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
  }