weapp-tailwindcss 2.9.2 → 2.10.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 (42) hide show
  1. package/README.md +13 -9
  2. package/dist/cache/index.d.ts +5 -2
  3. package/dist/cli.js +5 -4
  4. package/dist/cli.mjs +5 -4
  5. package/dist/constants--OCCPvZ8.mjs +36 -0
  6. package/dist/constants-9jsALkux.js +42 -0
  7. package/dist/css-macro/constants.d.ts +14 -0
  8. package/dist/css-macro/index.d.ts +15 -0
  9. package/dist/css-macro/index.js +36 -0
  10. package/dist/css-macro/index.mjs +30 -0
  11. package/dist/css-macro/postcss.d.ts +5 -0
  12. package/dist/css-macro/postcss.js +35 -0
  13. package/dist/css-macro/postcss.mjs +33 -0
  14. package/dist/defaults.js +1 -1
  15. package/dist/defaults.mjs +1 -1
  16. package/dist/defu-R3SAEzGq.mjs +43 -0
  17. package/dist/defu-d2wgbAKv.js +45 -0
  18. package/dist/gulp.js +19 -14
  19. package/dist/gulp.mjs +19 -14
  20. package/dist/index.js +8 -7
  21. package/dist/index.mjs +8 -7
  22. package/dist/{options-e1a9fdd3.mjs → options-1ejnE5kK.mjs} +53 -56
  23. package/dist/{options-9dd8de2e.js → options-jeQuZCU1.js} +57 -59
  24. package/dist/postcss/index.d.ts +2 -2
  25. package/dist/{postcss-8d7f67b4.js → postcss-03jfy6ZA.js} +1 -1
  26. package/dist/{postcss-55ed4d42.mjs → postcss-GEOOjC-4.mjs} +1 -1
  27. package/dist/postcss.js +2 -2
  28. package/dist/postcss.mjs +2 -2
  29. package/dist/replace.js +1 -1
  30. package/dist/replace.mjs +1 -1
  31. package/dist/types.d.ts +2 -1
  32. package/dist/vite.js +115 -110
  33. package/dist/vite.mjs +115 -110
  34. package/dist/webpack.js +20 -17
  35. package/dist/webpack.mjs +20 -17
  36. package/package.json +51 -37
  37. /package/dist/{defaults-b7341550.js → defaults-0O-zKoXE.js} +0 -0
  38. /package/dist/{defaults-d2c66d23.mjs → defaults-dz6xGhOP.mjs} +0 -0
  39. /package/dist/{index-84c7aa87.mjs → index-06BoOZig.mjs} +0 -0
  40. /package/dist/{index-aede98ce.js → index-z25r_Htj.js} +0 -0
  41. /package/dist/{shared-283aac78.mjs → shared-S0v7ZvWs.mjs} +0 -0
  42. /package/dist/{shared-8b9be5f0.js → shared-nXoJWFdz.js} +0 -0
package/dist/webpack.js CHANGED
@@ -2,22 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var options = require('./options-jeQuZCU1.js');
5
6
  var path = require('node:path');
6
7
  var fs = require('node:fs');
7
- var options = require('./options-9dd8de2e.js');
8
- var postcss = require('./postcss-8d7f67b4.js');
9
- var defaults = require('./defaults-b7341550.js');
10
- var index = require('./index-aede98ce.js');
8
+ var postcss = require('./postcss-03jfy6ZA.js');
9
+ var defaults = require('./defaults-0O-zKoXE.js');
10
+ var index = require('./index-z25r_Htj.js');
11
11
  require('micromatch');
12
12
  require('magic-string');
13
13
  require('./replace.js');
14
14
  require('@weapp-core/escape');
15
15
  require('@ast-core/escape');
16
- require('./shared-8b9be5f0.js');
16
+ require('./shared-nXoJWFdz.js');
17
17
  require('@weapp-core/regex');
18
18
  require('@babel/generator');
19
19
  require('@babel/parser');
20
20
  require('@babel/traverse');
21
+ require('./defu-d2wgbAKv.js');
21
22
  require('@babel/types');
22
23
  require('htmlparser2');
23
24
  require('postcss');
@@ -35,7 +36,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
35
36
  var path__default = /*#__PURE__*/_interopDefaultCompat(path);
36
37
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
37
38
 
38
- const debug = index.createDebug('');
39
+ const debug = index.createDebug('processAssets: ');
39
40
  class UnifiedWebpackPluginV5 {
40
41
  constructor(options$1 = {}) {
41
42
  if (options$1.customReplaceDictionary === undefined) {
@@ -45,7 +46,7 @@ class UnifiedWebpackPluginV5 {
45
46
  this.appType = this.options.appType;
46
47
  }
47
48
  apply(compiler) {
48
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache } = this.options;
49
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
49
50
  if (disabled) {
50
51
  return;
51
52
  }
@@ -54,7 +55,9 @@ class UnifiedWebpackPluginV5 {
54
55
  const { ConcatSource, RawSource } = sources;
55
56
  const twPatcher = options.createTailwindcssPatcher();
56
57
  function getClassSet() {
57
- return twPatcher.getClassSet();
58
+ return twPatcher.getClassSet({
59
+ basedir: tailwindcssBasedir
60
+ });
58
61
  }
59
62
  onLoad();
60
63
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -76,10 +79,10 @@ class UnifiedWebpackPluginV5 {
76
79
  }
77
80
  }
78
81
  });
79
- compilation.hooks.processAssets.tap({
82
+ compilation.hooks.processAssets.tapPromise({
80
83
  name: postcss.pluginName,
81
84
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
82
- }, (assets) => {
85
+ }, (assets) => options.__awaiter(this, void 0, void 0, function* () {
83
86
  onStart();
84
87
  debug('start');
85
88
  for (const chunk of compilation.chunks) {
@@ -100,7 +103,7 @@ class UnifiedWebpackPluginV5 {
100
103
  const hash = cache.computeHash(rawSource);
101
104
  const cacheKey = file;
102
105
  cache.calcHashValueChanged(cacheKey, hash);
103
- cache.process(cacheKey, () => {
106
+ yield cache.process(cacheKey, () => {
104
107
  const source = cache.get(cacheKey);
105
108
  if (source) {
106
109
  compilation.updateAsset(file, source);
@@ -131,7 +134,7 @@ class UnifiedWebpackPluginV5 {
131
134
  for (let i = 0; i < groupedEntries.js.length; i++) {
132
135
  const [file, originalSource] = groupedEntries.js[i];
133
136
  const cacheKey = defaults.removeExt(file);
134
- cache.process(cacheKey, () => {
137
+ yield cache.process(cacheKey, () => {
135
138
  const source = cache.get(cacheKey);
136
139
  if (source) {
137
140
  compilation.updateAsset(file, source);
@@ -172,7 +175,7 @@ class UnifiedWebpackPluginV5 {
172
175
  const hash = cache.computeHash(rawSource);
173
176
  const cacheKey = file;
174
177
  cache.calcHashValueChanged(cacheKey, hash);
175
- cache.process(cacheKey, () => {
178
+ yield cache.process(cacheKey, () => {
176
179
  const source = cache.get(cacheKey);
177
180
  if (source) {
178
181
  compilation.updateAsset(file, source);
@@ -181,8 +184,8 @@ class UnifiedWebpackPluginV5 {
181
184
  else {
182
185
  return false;
183
186
  }
184
- }, () => {
185
- const css = styleHandler(rawSource, {
187
+ }, () => options.__awaiter(this, void 0, void 0, function* () {
188
+ const css = yield styleHandler(rawSource, {
186
189
  isMainChunk: mainCssChunkMatcher(file, this.appType)
187
190
  });
188
191
  const source = new ConcatSource(css);
@@ -194,13 +197,13 @@ class UnifiedWebpackPluginV5 {
194
197
  key: cacheKey,
195
198
  source
196
199
  };
197
- });
200
+ }));
198
201
  }
199
202
  debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
200
203
  }
201
204
  debug('end');
202
205
  onEnd();
203
- });
206
+ }));
204
207
  });
205
208
  }
206
209
  }
package/dist/webpack.mjs CHANGED
@@ -1,19 +1,20 @@
1
+ import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-1ejnE5kK.mjs';
1
2
  import path from 'node:path';
2
3
  import fs from 'node:fs';
3
- import { g as getOptions, a as createTailwindcssPatcher } from './options-e1a9fdd3.mjs';
4
- import { a as pluginName } from './postcss-55ed4d42.mjs';
5
- import { g as getGroupedEntries, r as removeExt } from './defaults-d2c66d23.mjs';
6
- import { c as createDebug } from './index-84c7aa87.mjs';
4
+ import { a as pluginName } from './postcss-GEOOjC-4.mjs';
5
+ import { g as getGroupedEntries, r as removeExt } from './defaults-dz6xGhOP.mjs';
6
+ import { c as createDebug } from './index-06BoOZig.mjs';
7
7
  import 'micromatch';
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-283aac78.mjs';
12
+ import './shared-S0v7ZvWs.mjs';
13
13
  import '@weapp-core/regex';
14
14
  import '@babel/generator';
15
15
  import '@babel/parser';
16
16
  import '@babel/traverse';
17
+ import './defu-R3SAEzGq.mjs';
17
18
  import '@babel/types';
18
19
  import 'htmlparser2';
19
20
  import 'postcss';
@@ -26,7 +27,7 @@ import 'md5';
26
27
  import 'postcss-selector-parser';
27
28
  import 'debug';
28
29
 
29
- const debug = createDebug('');
30
+ const debug = createDebug('processAssets: ');
30
31
  class UnifiedWebpackPluginV5 {
31
32
  constructor(options = {}) {
32
33
  if (options.customReplaceDictionary === undefined) {
@@ -36,7 +37,7 @@ class UnifiedWebpackPluginV5 {
36
37
  this.appType = this.options.appType;
37
38
  }
38
39
  apply(compiler) {
39
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache } = this.options;
40
+ const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, tailwindcssBasedir } = this.options;
40
41
  if (disabled) {
41
42
  return;
42
43
  }
@@ -45,7 +46,9 @@ class UnifiedWebpackPluginV5 {
45
46
  const { ConcatSource, RawSource } = sources;
46
47
  const twPatcher = createTailwindcssPatcher();
47
48
  function getClassSet() {
48
- return twPatcher.getClassSet();
49
+ return twPatcher.getClassSet({
50
+ basedir: tailwindcssBasedir
51
+ });
49
52
  }
50
53
  onLoad();
51
54
  const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
@@ -67,10 +70,10 @@ class UnifiedWebpackPluginV5 {
67
70
  }
68
71
  }
69
72
  });
70
- compilation.hooks.processAssets.tap({
73
+ compilation.hooks.processAssets.tapPromise({
71
74
  name: pluginName,
72
75
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
73
- }, (assets) => {
76
+ }, (assets) => __awaiter(this, void 0, void 0, function* () {
74
77
  onStart();
75
78
  debug('start');
76
79
  for (const chunk of compilation.chunks) {
@@ -91,7 +94,7 @@ class UnifiedWebpackPluginV5 {
91
94
  const hash = cache.computeHash(rawSource);
92
95
  const cacheKey = file;
93
96
  cache.calcHashValueChanged(cacheKey, hash);
94
- cache.process(cacheKey, () => {
97
+ yield cache.process(cacheKey, () => {
95
98
  const source = cache.get(cacheKey);
96
99
  if (source) {
97
100
  compilation.updateAsset(file, source);
@@ -122,7 +125,7 @@ class UnifiedWebpackPluginV5 {
122
125
  for (let i = 0; i < groupedEntries.js.length; i++) {
123
126
  const [file, originalSource] = groupedEntries.js[i];
124
127
  const cacheKey = removeExt(file);
125
- cache.process(cacheKey, () => {
128
+ yield cache.process(cacheKey, () => {
126
129
  const source = cache.get(cacheKey);
127
130
  if (source) {
128
131
  compilation.updateAsset(file, source);
@@ -163,7 +166,7 @@ class UnifiedWebpackPluginV5 {
163
166
  const hash = cache.computeHash(rawSource);
164
167
  const cacheKey = file;
165
168
  cache.calcHashValueChanged(cacheKey, hash);
166
- cache.process(cacheKey, () => {
169
+ yield cache.process(cacheKey, () => {
167
170
  const source = cache.get(cacheKey);
168
171
  if (source) {
169
172
  compilation.updateAsset(file, source);
@@ -172,8 +175,8 @@ class UnifiedWebpackPluginV5 {
172
175
  else {
173
176
  return false;
174
177
  }
175
- }, () => {
176
- const css = styleHandler(rawSource, {
178
+ }, () => __awaiter(this, void 0, void 0, function* () {
179
+ const css = yield styleHandler(rawSource, {
177
180
  isMainChunk: mainCssChunkMatcher(file, this.appType)
178
181
  });
179
182
  const source = new ConcatSource(css);
@@ -185,13 +188,13 @@ class UnifiedWebpackPluginV5 {
185
188
  key: cacheKey,
186
189
  source
187
190
  };
188
- });
191
+ }));
189
192
  }
190
193
  debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
191
194
  }
192
195
  debug('end');
193
196
  onEnd();
194
- });
197
+ }));
195
198
  });
196
199
  }
197
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "2.9.2",
3
+ "version": "2.10.0",
4
4
  "description": "把tailwindcss jit引擎,带给小程序开发者们! bring tailwindcss jit engine to miniprogram developers!",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -41,6 +41,16 @@
41
41
  "require": "./dist/defaults.js",
42
42
  "import": "./dist/defaults.mjs"
43
43
  },
44
+ "./css-macro/postcss": {
45
+ "types": "./dist/css-macro/postcss.d.ts",
46
+ "require": "./dist/css-macro/postcss.js",
47
+ "import": "./dist/css-macro/postcss.mjs"
48
+ },
49
+ "./css-macro": {
50
+ "types": "./dist/css-macro/index.d.ts",
51
+ "require": "./dist/css-macro/index.js",
52
+ "import": "./dist/css-macro/index.mjs"
53
+ },
44
54
  "./*": "./*"
45
55
  },
46
56
  "typesVersions": {
@@ -102,51 +112,52 @@
102
112
  },
103
113
  "homepage": "https://weapp-tw.icebreaker.top",
104
114
  "devDependencies": {
105
- "@babel/core": "^7.22.20",
115
+ "@babel/core": "^7.23.2",
106
116
  "@icebreakers/cli": "0.1.1",
107
117
  "@icebreakers/readme": "0.1.0",
108
- "@rollup/plugin-alias": "^5.0.0",
109
- "@rollup/plugin-commonjs": "^25.0.4",
110
- "@rollup/plugin-json": "^6.0.0",
111
- "@rollup/plugin-node-resolve": "^15.2.1",
112
- "@rollup/plugin-terser": "^0.4.3",
113
- "@rollup/plugin-typescript": "^11.1.3",
118
+ "@rollup/plugin-alias": "^5.0.1",
119
+ "@rollup/plugin-commonjs": "^25.0.7",
120
+ "@rollup/plugin-json": "^6.0.1",
121
+ "@rollup/plugin-node-resolve": "^15.2.3",
122
+ "@rollup/plugin-terser": "^0.4.4",
123
+ "@rollup/plugin-typescript": "^11.1.5",
114
124
  "@tsconfig/recommended": "^1.0.3",
115
125
  "@types/babel__generator": "^7.6.5",
116
126
  "@types/babel__traverse": "^7.20.2",
117
- "@types/debug": "^4.1.8",
118
- "@types/diff": "^5.0.4",
127
+ "@types/debug": "^4.1.9",
128
+ "@types/diff": "^5.0.6",
119
129
  "@types/fs-extra": "^11.0.2",
120
- "@types/gulp": "^4.0.13",
121
- "@types/gulp-postcss": "^8.0.3",
130
+ "@types/gulp": "^4.0.15",
131
+ "@types/gulp-postcss": "^8.0.4",
122
132
  "@types/jest": "^29.5.5",
123
133
  "@types/js-beautify": "^1.14.1",
124
134
  "@types/klaw": "^3.0.4",
125
135
  "@types/loader-utils": "^2.0.4",
126
- "@types/lodash": "^4.14.198",
127
- "@types/md5": "^2.3.2",
128
- "@types/micromatch": "^4.0.2",
129
- "@types/node": "^20.6.2",
130
- "@types/semver": "^7.5.2",
131
- "@types/vinyl": "^2.0.7",
132
- "@types/webpack": "^5.28.2",
133
- "@types/webpack-sources": "^3.2.0",
134
- "@vitest/coverage-v8": "^0.34.4",
135
- "autoprefixer": "^10.4.15",
136
+ "@types/lodash": "^4.14.199",
137
+ "@types/md5": "^2.3.3",
138
+ "@types/micromatch": "^4.0.3",
139
+ "@types/node": "^20.8.6",
140
+ "@types/semver": "^7.5.3",
141
+ "@types/vinyl": "^2.0.8",
142
+ "@types/webpack": "^5.28.3",
143
+ "@types/webpack-sources": "^3.2.1",
144
+ "@vitest/coverage-v8": "^0.34.6",
145
+ "autoprefixer": "^10.4.16",
136
146
  "babel-loader": "^9.1.3",
137
147
  "bumpp": "^9.2.0",
138
148
  "colorette": "^2.0.20",
139
149
  "cross-env": "^7.0.3",
140
150
  "css-loader": "^6.8.1",
151
+ "css-to-tailwindcss-plugin": "^0.2.5",
141
152
  "dedent": "^1.5.1",
142
153
  "defu": "6.1.2",
143
154
  "del": "^7.1.0",
144
155
  "diff": "^5.1.0",
145
156
  "domhandler": "^5.0.3",
146
- "eslint": "8.49.0",
157
+ "eslint": "8.51.0",
147
158
  "eslint-config-icebreaker": "^1.2.2",
148
159
  "eslint-config-prettier": "^9.0.0",
149
- "eslint-plugin-prettier": "^5.0.0",
160
+ "eslint-plugin-prettier": "^5.0.1",
150
161
  "execa": "^7.2.0",
151
162
  "fast-glob": "^3.3.1",
152
163
  "fs-extra": "^11.1.1",
@@ -165,8 +176,9 @@
165
176
  "postcss-rem-to-responsive-pixel": "^5.1.3",
166
177
  "prettier": "^3.0.3",
167
178
  "promisify-loader-runner": "^1.0.0",
168
- "rollup": "^3.29.2",
179
+ "rollup": "^4.1.4",
169
180
  "rollup-plugin-visualizer": "^5.9.2",
181
+ "sass": "^1.69.3",
170
182
  "style-loader": "^3.3.3",
171
183
  "tailwind-children": "^0.5.0",
172
184
  "tailwindcss": "^3.3.3",
@@ -178,33 +190,33 @@
178
190
  "typescript": "^5.2.2",
179
191
  "typescript-transform-paths": "^3.4.6",
180
192
  "vinyl": "^3.0.0",
181
- "vite": "^4.4.9",
182
- "vitest": "^0.34.4",
193
+ "vite": "^4.4.11",
194
+ "vitest": "^0.34.6",
183
195
  "weapp-tailwindcss-children": "^0.1.0",
184
- "webpack": "^5.88.2",
196
+ "webpack": "^5.89.0",
185
197
  "webpack-build-utils": "^0.0.4"
186
198
  },
187
199
  "dependencies": {
188
200
  "@ast-core/escape": "^1.0.1",
189
- "@babel/generator": "^7.22.15",
190
- "@babel/parser": "^7.22.16",
191
- "@babel/traverse": "^7.22.20",
192
- "@babel/types": "^7.22.19",
193
- "@csstools/postcss-is-pseudo-class": "^4.0.2",
194
- "@tailwindcss-mangle/shared": "^2.2.1",
201
+ "@babel/generator": "^7.23.0",
202
+ "@babel/parser": "^7.23.0",
203
+ "@babel/traverse": "^7.23.2",
204
+ "@babel/types": "^7.23.0",
205
+ "@csstools/postcss-is-pseudo-class": "^4.0.3",
206
+ "@tailwindcss-mangle/shared": "^2.2.2",
195
207
  "@weapp-core/escape": "^2.0.0",
196
208
  "@weapp-core/regex": "^1.0.1",
197
209
  "debug": "^4.3.4",
198
210
  "htmlparser2": "^9.0.0",
199
211
  "loader-utils": "^2.0.3",
200
212
  "lru-cache": "^10.0.1",
201
- "magic-string": "^0.30.3",
213
+ "magic-string": "^0.30.5",
202
214
  "md5": "^2.3.0",
203
215
  "micromatch": "^4.0.5",
204
- "postcss": "8.4.30",
216
+ "postcss": "8.4.31",
205
217
  "postcss-selector-parser": "^6.0.13",
206
218
  "semver": "^7.5.4",
207
- "tailwindcss-patch": "^2.2.1"
219
+ "tailwindcss-patch": "^2.2.2"
208
220
  },
209
221
  "packageManager": "pnpm@8.7.4",
210
222
  "engines": {
@@ -247,6 +259,8 @@
247
259
  "ls:pack": "npm pack --dry-run",
248
260
  "cli:patch": "node bin/weapp-tailwindcss.js patch",
249
261
  "release": "bumpp",
262
+ "css-build": "css2plugin build css-plugin.css css-plugin-scss.scss --cwd test/fixtures/css",
263
+ "css-build-out": "css2plugin build css-plugin.css css-plugin-scss.scss --cwd test/fixtures/css --out tw-plugins",
250
264
  "-------": "-----------",
251
265
  "postinstall": "node bin/weapp-tailwindcss.js patch"
252
266
  }
File without changes
File without changes
File without changes