weapp-tailwindcss 4.8.12 → 4.8.14

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/{chunk-WILVISNS.js → chunk-2AWOAQD3.js} +34 -32
  2. package/dist/{chunk-4H3RCNUP.mjs → chunk-2HIXWVX2.mjs} +50 -47
  3. package/dist/{chunk-HXYNNE6Q.mjs → chunk-3SKEY32E.mjs} +18 -119
  4. package/dist/{chunk-HHSKDU3Z.mjs → chunk-3VIPMWAG.mjs} +22 -24
  5. package/dist/{chunk-WIET7TXZ.js → chunk-477TX4LM.js} +5 -5
  6. package/dist/{chunk-243FNJFQ.js → chunk-63LJ4WHF.js} +7 -7
  7. package/dist/chunk-6VSFN3NA.js +251 -0
  8. package/dist/{chunk-XSRP6OF5.mjs → chunk-7UAU27KZ.mjs} +2 -2
  9. package/dist/{chunk-HMFOJPZG.mjs → chunk-EKF3ABRO.mjs} +2 -2
  10. package/dist/chunk-FSI2IWUY.mjs +251 -0
  11. package/dist/{chunk-AVUQQ4GH.mjs → chunk-HJWY5Y6L.mjs} +15 -13
  12. package/dist/{chunk-ZADOXTZC.js → chunk-J4MI4EJO.js} +16 -18
  13. package/dist/{chunk-AVR4TFX3.js → chunk-L3AOBWDW.js} +7 -7
  14. package/dist/{chunk-A5JYBYB2.js → chunk-MB4BR57E.js} +1 -1
  15. package/dist/{chunk-ZSI6C3R4.js → chunk-ML4F4ZPY.js} +66 -63
  16. package/dist/{chunk-3DQN7M5U.js → chunk-ORSWL3MI.js} +20 -121
  17. package/dist/{chunk-MDZGOZZP.mjs → chunk-SM5V25IN.mjs} +1 -1
  18. package/dist/{chunk-K2Y3FXU7.mjs → chunk-ZC5JYOAR.mjs} +2 -2
  19. package/dist/cli.js +39 -39
  20. package/dist/cli.mjs +3 -3
  21. package/dist/core.js +10 -10
  22. package/dist/core.mjs +4 -4
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.js +1 -1
  28. package/dist/defaults.mjs +1 -1
  29. package/dist/gulp.js +6 -6
  30. package/dist/gulp.mjs +5 -5
  31. package/dist/index.d.mts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +10 -10
  34. package/dist/index.mjs +9 -9
  35. package/dist/postcss-html-transform.js +1 -1
  36. package/dist/postcss-html-transform.mjs +1 -1
  37. package/dist/presets.d.mts +14 -10
  38. package/dist/presets.d.ts +14 -10
  39. package/dist/presets.js +68 -64
  40. package/dist/presets.mjs +69 -65
  41. package/dist/reset.js +1 -1
  42. package/dist/reset.mjs +1 -1
  43. package/dist/types.d.mts +24 -2
  44. package/dist/types.d.ts +24 -2
  45. package/dist/types.js +1 -1
  46. package/dist/types.mjs +1 -1
  47. package/dist/vite.js +7 -7
  48. package/dist/vite.mjs +6 -6
  49. package/dist/weapp-tw-css-import-rewrite-loader.js +2 -18
  50. package/dist/weapp-tw-runtime-classset-loader.js +1 -3
  51. package/dist/webpack.js +8 -8
  52. package/dist/webpack.mjs +7 -7
  53. package/dist/webpack4.js +37 -35
  54. package/dist/webpack4.mjs +16 -14
  55. package/package.json +4 -4
  56. package/dist/chunk-6LYLDH5F.mjs +0 -136
  57. package/dist/chunk-BYXBJQAS.js +0 -1
  58. package/dist/chunk-CGCWO2U6.js +0 -136
package/dist/webpack4.js CHANGED
@@ -4,48 +4,49 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkCGCWO2U6js = require('./chunk-CGCWO2U6.js');
8
7
 
9
8
 
10
9
 
11
10
 
12
11
 
12
+ var _chunk6VSFN3NAjs = require('./chunk-6VSFN3NA.js');
13
13
 
14
14
 
15
15
 
16
16
 
17
17
 
18
- var _chunk3DQN7M5Ujs = require('./chunk-3DQN7M5U.js');
18
+
19
+ var _chunkORSWL3MIjs = require('./chunk-ORSWL3MI.js');
19
20
 
20
21
 
21
22
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
22
23
 
23
24
 
24
- var _chunkWIET7TXZjs = require('./chunk-WIET7TXZ.js');
25
+ var _chunk477TX4LMjs = require('./chunk-477TX4LM.js');
25
26
 
26
27
 
27
28
 
28
29
 
29
30
 
30
31
 
31
- var _chunk243FNJFQjs = require('./chunk-243FNJFQ.js');
32
- require('./chunk-ZADOXTZC.js');
32
+ var _chunk63LJ4WHFjs = require('./chunk-63LJ4WHF.js');
33
+ require('./chunk-J4MI4EJO.js');
33
34
  require('./chunk-3URI7W6X.js');
34
35
 
35
36
 
36
37
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
37
- require('./chunk-A5JYBYB2.js');
38
+ require('./chunk-MB4BR57E.js');
38
39
 
39
40
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
40
41
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
41
42
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
42
43
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
43
44
  var _webpacksources = require('webpack-sources');
44
- var debug = _chunk243FNJFQjs.createDebug.call(void 0, );
45
- var weappTailwindcssPackageDir = _chunk3DQN7M5Ujs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
45
+ var debug = _chunk63LJ4WHFjs.createDebug.call(void 0, );
46
+ var weappTailwindcssPackageDir = _chunkORSWL3MIjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
46
47
  var UnifiedWebpackPluginV4 = class {
47
48
  constructor(options = {}) {
48
- this.options = _chunk243FNJFQjs.getCompilerContext.call(void 0, options);
49
+ this.options = _chunk63LJ4WHFjs.getCompilerContext.call(void 0, options);
49
50
  this.appType = this.options.appType;
50
51
  }
51
52
  apply(compiler) {
@@ -66,21 +67,22 @@ var UnifiedWebpackPluginV4 = class {
66
67
  twPatcher: initialTwPatcher,
67
68
  refreshTailwindcssPatcher
68
69
  } = this.options;
69
- if (disabled) {
70
- return;
71
- }
70
+ const disabledOptions = _chunkORSWL3MIjs.resolveDisabledOptions.call(void 0, disabled);
72
71
  const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
73
- const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false;
74
- const isMpxApp = _chunk3DQN7M5Ujs.isMpx.call(void 0, this.appType);
72
+ const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
73
+ const isMpxApp = _chunk6VSFN3NAjs.isMpx.call(void 0, this.appType);
75
74
  if (shouldRewriteCssImports) {
76
- _chunkCGCWO2U6js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
75
+ _chunk6VSFN3NAjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
77
76
  pkgDir: weappTailwindcssPackageDir,
78
77
  enabled: true,
79
78
  appType: this.appType
80
79
  });
81
- _chunk3DQN7M5Ujs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
80
+ _chunk6VSFN3NAjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
81
+ }
82
+ if (disabledOptions.plugin) {
83
+ return;
82
84
  }
83
- const patchRecorderState = _chunkWIET7TXZjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
85
+ const patchRecorderState = _chunk477TX4LMjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
84
86
  source: "runtime",
85
87
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
86
88
  });
@@ -91,12 +93,12 @@ var UnifiedWebpackPluginV4 = class {
91
93
  onPatchCompleted: patchRecorderState.onPatchCompleted
92
94
  };
93
95
  const refreshRuntimeState = async (force) => {
94
- await _chunk243FNJFQjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
96
+ await _chunk63LJ4WHFjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
95
97
  };
96
98
  async function getClassSetInLoader() {
97
99
  await refreshRuntimeState(true);
98
100
  await runtimeState.patchPromise;
99
- await _chunk243FNJFQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
101
+ await _chunk63LJ4WHFjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
100
102
  }
101
103
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
102
104
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -109,16 +111,16 @@ var UnifiedWebpackPluginV4 = class {
109
111
  const classSetLoaderOptions = {
110
112
  getClassSet: getClassSetInLoader
111
113
  };
112
- const { findRewriteAnchor, findClassSetAnchor } = _chunkCGCWO2U6js.createLoaderAnchorFinders.call(void 0, this.appType);
114
+ const { findRewriteAnchor, findClassSetAnchor } = _chunk6VSFN3NAjs.createLoaderAnchorFinders.call(void 0, this.appType);
113
115
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
114
116
  rewriteCssImports: runtimeLoaderRewriteOptions
115
117
  } : void 0;
116
118
  onLoad();
117
119
  if (shouldRewriteCssImports && isMpxApp) {
118
- _chunk3DQN7M5Ujs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir);
120
+ _chunk6VSFN3NAjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir);
119
121
  }
120
122
  if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
121
- _chunk3DQN7M5Ujs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
123
+ _chunk6VSFN3NAjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
122
124
  }
123
125
  const createRuntimeClassSetLoaderEntry = () => ({
124
126
  loader: runtimeClassSetLoader,
@@ -137,19 +139,19 @@ var UnifiedWebpackPluginV4 = class {
137
139
  type: null
138
140
  };
139
141
  };
140
- compiler.hooks.compilation.tap(_chunk243FNJFQjs.pluginName, (compilation) => {
141
- compilation.hooks.normalModuleLoader.tap(_chunk243FNJFQjs.pluginName, (_loaderContext, module) => {
142
+ compiler.hooks.compilation.tap(_chunk63LJ4WHFjs.pluginName, (compilation) => {
143
+ compilation.hooks.normalModuleLoader.tap(_chunk63LJ4WHFjs.pluginName, (_loaderContext, module) => {
142
144
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
143
145
  if (!hasRuntimeLoader) {
144
146
  return;
145
147
  }
146
- if (shouldRewriteCssImports && _chunk3DQN7M5Ujs.isMpx.call(void 0, this.appType) && typeof _loaderContext.resolve === "function") {
147
- _chunk3DQN7M5Ujs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir, true);
148
+ if (shouldRewriteCssImports && _chunk6VSFN3NAjs.isMpx.call(void 0, this.appType) && typeof _loaderContext.resolve === "function") {
149
+ _chunk6VSFN3NAjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir, true);
148
150
  }
149
151
  const loaderEntries = module.loaders || [];
150
152
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
151
153
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
152
- const isCssModule = _chunkCGCWO2U6js.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
154
+ const isCssModule = _chunk6VSFN3NAjs.isCssLikeModuleResource.call(void 0, module.resource, this.options.cssMatcher, this.appType);
153
155
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
154
156
  debug("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
155
157
  }
@@ -183,7 +185,7 @@ var UnifiedWebpackPluginV4 = class {
183
185
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
184
186
  }
185
187
  }
186
- if (runtimeClassSetLoaderExists && !_chunkCGCWO2U6js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
188
+ if (runtimeClassSetLoaderExists && !_chunk6VSFN3NAjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
187
189
  const anchorIndex = findClassSetAnchor(loaderEntries);
188
190
  if (anchorIndex === -1) {
189
191
  anchorlessInsert(createRuntimeClassSetLoaderEntry(), "before");
@@ -194,7 +196,7 @@ var UnifiedWebpackPluginV4 = class {
194
196
  }
195
197
  });
196
198
  });
197
- compiler.hooks.emit.tapPromise(_chunk243FNJFQjs.pluginName, async (compilation) => {
199
+ compiler.hooks.emit.tapPromise(_chunk63LJ4WHFjs.pluginName, async (compilation) => {
198
200
  await runtimeState.patchPromise;
199
201
  onStart();
200
202
  debug("start");
@@ -209,13 +211,13 @@ var UnifiedWebpackPluginV4 = class {
209
211
  const jsAssets = /* @__PURE__ */ new Map();
210
212
  for (const [file] of entries) {
211
213
  if (this.options.jsMatcher(file) || this.options.wxsMatcher(file)) {
212
- const absolute = _chunk3DQN7M5Ujs.toAbsoluteOutputPath.call(void 0, file, outputDir);
214
+ const absolute = _chunkORSWL3MIjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
213
215
  jsAssets.set(absolute, file);
214
216
  }
215
217
  }
216
218
  const moduleGraphOptions = {
217
219
  resolve(specifier, importer) {
218
- return _chunk3DQN7M5Ujs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
220
+ return _chunkORSWL3MIjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
219
221
  },
220
222
  load: (id) => {
221
223
  const assetName = jsAssets.get(id);
@@ -260,7 +262,7 @@ var UnifiedWebpackPluginV4 = class {
260
262
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
261
263
  await refreshRuntimeState(true);
262
264
  await runtimeState.patchPromise;
263
- const runtimeSet = await _chunk243FNJFQjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
265
+ const runtimeSet = await _chunk63LJ4WHFjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
264
266
  debug("get runtimeSet, class count: %d", runtimeSet.size);
265
267
  const tasks = [];
266
268
  if (Array.isArray(groupedEntries.html)) {
@@ -297,14 +299,14 @@ var UnifiedWebpackPluginV4 = class {
297
299
  const jsTaskFactories = [];
298
300
  if (Array.isArray(groupedEntries.js)) {
299
301
  for (const [file] of groupedEntries.js) {
300
- const cacheKey = _chunkCGCWO2U6js.getCacheKey.call(void 0, file);
302
+ const cacheKey = _chunk6VSFN3NAjs.getCacheKey.call(void 0, file);
301
303
  const assetSource = compilation.assets[file];
302
304
  if (!assetSource) {
303
305
  continue;
304
306
  }
305
307
  const initialValue = assetSource.source();
306
308
  const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
307
- const absoluteFile = _chunk3DQN7M5Ujs.toAbsoluteOutputPath.call(void 0, file, outputDir);
309
+ const absoluteFile = _chunkORSWL3MIjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
308
310
  jsTaskFactories.push(async () => {
309
311
  await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
310
312
  cache,
@@ -377,7 +379,7 @@ var UnifiedWebpackPluginV4 = class {
377
379
  );
378
380
  }
379
381
  }
380
- _chunk3DQN7M5Ujs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
382
+ _chunkORSWL3MIjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
381
383
  await Promise.all(tasks);
382
384
  debug("end");
383
385
  onEnd();
package/dist/webpack4.mjs CHANGED
@@ -1,42 +1,43 @@
1
1
  import {
2
2
  applyTailwindcssCssImportRewrite,
3
3
  createLoaderAnchorFinders,
4
+ ensureMpxTailwindcssAliases,
4
5
  getCacheKey,
5
6
  hasLoaderEntry,
6
- isCssLikeModuleResource
7
- } from "./chunk-6LYLDH5F.mjs";
8
- import {
9
- ensureMpxTailwindcssAliases,
10
7
  injectMpxCssRewritePreRules,
8
+ isCssLikeModuleResource,
11
9
  isMpx,
12
10
  patchMpxLoaderResolve,
11
+ setupMpxTailwindcssRedirect
12
+ } from "./chunk-FSI2IWUY.mjs";
13
+ import {
13
14
  pushConcurrentTaskFactories,
15
+ resolveDisabledOptions,
14
16
  resolveOutputSpecifier,
15
17
  resolvePackageDir,
16
- setupMpxTailwindcssRedirect,
17
18
  toAbsoluteOutputPath
18
- } from "./chunk-HXYNNE6Q.mjs";
19
+ } from "./chunk-3SKEY32E.mjs";
19
20
  import {
20
21
  processCachedTask
21
22
  } from "./chunk-RRHPTTCP.mjs";
22
23
  import {
23
24
  setupPatchRecorder
24
- } from "./chunk-XSRP6OF5.mjs";
25
+ } from "./chunk-7UAU27KZ.mjs";
25
26
  import {
26
27
  collectRuntimeClassSet,
27
28
  createDebug,
28
29
  getCompilerContext,
29
30
  pluginName,
30
31
  refreshTailwindRuntimeState
31
- } from "./chunk-K2Y3FXU7.mjs";
32
- import "./chunk-HHSKDU3Z.mjs";
32
+ } from "./chunk-ZC5JYOAR.mjs";
33
+ import "./chunk-3VIPMWAG.mjs";
33
34
  import "./chunk-QF65JGNW.mjs";
34
35
  import {
35
36
  getGroupedEntries
36
37
  } from "./chunk-ZNKIYZRQ.mjs";
37
38
  import {
38
39
  __dirname
39
- } from "./chunk-MDZGOZZP.mjs";
40
+ } from "./chunk-SM5V25IN.mjs";
40
41
 
41
42
  // src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
42
43
  import fs from "fs";
@@ -68,11 +69,9 @@ var UnifiedWebpackPluginV4 = class {
68
69
  twPatcher: initialTwPatcher,
69
70
  refreshTailwindcssPatcher
70
71
  } = this.options;
71
- if (disabled) {
72
- return;
73
- }
72
+ const disabledOptions = resolveDisabledOptions(disabled);
74
73
  const isTailwindcssV4 = (initialTwPatcher.majorVersion ?? 0) >= 4;
75
- const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false;
74
+ const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
76
75
  const isMpxApp = isMpx(this.appType);
77
76
  if (shouldRewriteCssImports) {
78
77
  applyTailwindcssCssImportRewrite(compiler, {
@@ -82,6 +81,9 @@ var UnifiedWebpackPluginV4 = class {
82
81
  });
83
82
  setupMpxTailwindcssRedirect(weappTailwindcssPackageDir, isMpxApp);
84
83
  }
84
+ if (disabledOptions.plugin) {
85
+ return;
86
+ }
85
87
  const patchRecorderState = setupPatchRecorder(initialTwPatcher, this.options.tailwindcssBasedir, {
86
88
  source: "runtime",
87
89
  cwd: this.options.tailwindcssBasedir ?? process.cwd()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "4.8.12",
3
+ "version": "4.8.14",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -168,8 +168,8 @@
168
168
  "@babel/traverse": "~7.28.5",
169
169
  "@babel/types": "~7.28.5",
170
170
  "@tailwindcss-mangle/config": "^6.1.0",
171
- "@vue/compiler-dom": "^3.5.25",
172
- "@vue/compiler-sfc": "^3.5.25",
171
+ "@vue/compiler-dom": "^3.5.26",
172
+ "@vue/compiler-sfc": "^3.5.26",
173
173
  "@weapp-core/escape": "~6.0.1",
174
174
  "@weapp-core/regex": "~1.0.1",
175
175
  "cac": "^6.7.14",
@@ -186,7 +186,7 @@
186
186
  "yaml": "^2.8.2",
187
187
  "@weapp-tailwindcss/logger": "1.1.0",
188
188
  "@weapp-tailwindcss/shared": "1.1.1",
189
- "@weapp-tailwindcss/postcss": "2.0.8"
189
+ "@weapp-tailwindcss/postcss": "2.1.0"
190
190
  },
191
191
  "scripts": {
192
192
  "dev": "tsup --watch --sourcemap",
@@ -1,136 +0,0 @@
1
- import {
2
- isMpx,
3
- resolveTailwindcssImport
4
- } from "./chunk-HXYNNE6Q.mjs";
5
- import {
6
- pluginName
7
- } from "./chunk-K2Y3FXU7.mjs";
8
-
9
- // src/bundlers/webpack/shared/css-imports.ts
10
- var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
11
- function stripResourceQuery(file) {
12
- let idx = file.indexOf("?");
13
- if (idx === -1) {
14
- idx = file.indexOf("&");
15
- }
16
- return idx === -1 ? file : file.slice(0, idx);
17
- }
18
- function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
19
- if (!data) {
20
- return;
21
- }
22
- const request = data.request;
23
- if (!request) {
24
- return;
25
- }
26
- if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) {
27
- return;
28
- }
29
- const issuer = data.contextInfo?.issuer;
30
- if (!issuer) {
31
- return;
32
- }
33
- const normalizedIssuer = stripResourceQuery(issuer);
34
- if (!CSS_EXT_RE.test(normalizedIssuer)) {
35
- return;
36
- }
37
- const resolved = resolveTailwindcssImport(request, pkgDir, { appType });
38
- if (!resolved) {
39
- return;
40
- }
41
- data.request = resolved;
42
- }
43
- function applyTailwindcssCssImportRewrite(compiler, options) {
44
- if (!options.enabled) {
45
- return;
46
- }
47
- compiler.hooks.normalModuleFactory.tap(pluginName, (factory) => {
48
- factory.hooks.beforeResolve.tap(pluginName, (data) => {
49
- rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
50
- });
51
- });
52
- }
53
-
54
- // src/bundlers/webpack/shared/loader-anchors.ts
55
- var MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
56
- var MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
57
- var MPX_REWRITE_PRECEDENCE_LOADERS = [
58
- MPX_STYLE_COMPILER_LOADER,
59
- MPX_STRIP_CONDITIONAL_LOADER
60
- ];
61
- function createFinder(targets) {
62
- return (entries) => entries.findIndex(
63
- (entry) => targets.some((target) => entry?.loader?.includes?.(target))
64
- );
65
- }
66
- function createPrioritizedFinder(targets) {
67
- return (entries) => {
68
- for (const target of targets) {
69
- const idx = entries.findIndex((entry) => entry?.loader?.includes?.(target));
70
- if (idx !== -1) {
71
- return idx;
72
- }
73
- }
74
- return -1;
75
- };
76
- }
77
- function createLoaderAnchorFinders(appType) {
78
- if (isMpx(appType)) {
79
- return {
80
- findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
81
- findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
82
- };
83
- }
84
- const fallbackFinder = createFinder(["postcss-loader"]);
85
- return {
86
- findRewriteAnchor: fallbackFinder,
87
- findClassSetAnchor: fallbackFinder
88
- };
89
- }
90
-
91
- // src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
92
- var MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
93
- function getCacheKey(filename) {
94
- return filename;
95
- }
96
- function stripResourceQuery2(resource) {
97
- if (typeof resource !== "string") {
98
- return resource;
99
- }
100
- const queryIndex = resource.indexOf("?");
101
- if (queryIndex !== -1) {
102
- return resource.slice(0, queryIndex);
103
- }
104
- const hashIndex = resource.indexOf("#");
105
- if (hashIndex !== -1) {
106
- return resource.slice(0, hashIndex);
107
- }
108
- return resource;
109
- }
110
- function isCssLikeModuleResource(resource, cssMatcher, appType) {
111
- if (typeof resource !== "string") {
112
- return false;
113
- }
114
- const normalizedResource = stripResourceQuery2(resource);
115
- if (normalizedResource && cssMatcher(normalizedResource)) {
116
- return true;
117
- }
118
- if (appType === "mpx") {
119
- return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
120
- }
121
- return false;
122
- }
123
- function hasLoaderEntry(entries, target) {
124
- if (!target) {
125
- return false;
126
- }
127
- return entries.some((entry) => entry.loader?.includes?.(target));
128
- }
129
-
130
- export {
131
- applyTailwindcssCssImportRewrite,
132
- createLoaderAnchorFinders,
133
- getCacheKey,
134
- isCssLikeModuleResource,
135
- hasLoaderEntry
136
- };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,136 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
- var _chunk3DQN7M5Ujs = require('./chunk-3DQN7M5U.js');
5
-
6
-
7
- var _chunk243FNJFQjs = require('./chunk-243FNJFQ.js');
8
-
9
- // src/bundlers/webpack/shared/css-imports.ts
10
- var CSS_EXT_RE = /\.(?:css|scss|sass|less|styl|pcss)$/i;
11
- function stripResourceQuery(file) {
12
- let idx = file.indexOf("?");
13
- if (idx === -1) {
14
- idx = file.indexOf("&");
15
- }
16
- return idx === -1 ? file : file.slice(0, idx);
17
- }
18
- function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
19
- if (!data) {
20
- return;
21
- }
22
- const request = data.request;
23
- if (!request) {
24
- return;
25
- }
26
- if (request !== "tailwindcss" && request !== "tailwindcss$" && !request.startsWith("tailwindcss/")) {
27
- return;
28
- }
29
- const issuer = _optionalChain([data, 'access', _ => _.contextInfo, 'optionalAccess', _2 => _2.issuer]);
30
- if (!issuer) {
31
- return;
32
- }
33
- const normalizedIssuer = stripResourceQuery(issuer);
34
- if (!CSS_EXT_RE.test(normalizedIssuer)) {
35
- return;
36
- }
37
- const resolved = _chunk3DQN7M5Ujs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
38
- if (!resolved) {
39
- return;
40
- }
41
- data.request = resolved;
42
- }
43
- function applyTailwindcssCssImportRewrite(compiler, options) {
44
- if (!options.enabled) {
45
- return;
46
- }
47
- compiler.hooks.normalModuleFactory.tap(_chunk243FNJFQjs.pluginName, (factory) => {
48
- factory.hooks.beforeResolve.tap(_chunk243FNJFQjs.pluginName, (data) => {
49
- rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
50
- });
51
- });
52
- }
53
-
54
- // src/bundlers/webpack/shared/loader-anchors.ts
55
- var MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
56
- var MPX_STYLE_COMPILER_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/index";
57
- var MPX_REWRITE_PRECEDENCE_LOADERS = [
58
- MPX_STYLE_COMPILER_LOADER,
59
- MPX_STRIP_CONDITIONAL_LOADER
60
- ];
61
- function createFinder(targets) {
62
- return (entries) => entries.findIndex(
63
- (entry) => targets.some((target) => _optionalChain([entry, 'optionalAccess', _3 => _3.loader, 'optionalAccess', _4 => _4.includes, 'optionalCall', _5 => _5(target)]))
64
- );
65
- }
66
- function createPrioritizedFinder(targets) {
67
- return (entries) => {
68
- for (const target of targets) {
69
- const idx = entries.findIndex((entry) => _optionalChain([entry, 'optionalAccess', _6 => _6.loader, 'optionalAccess', _7 => _7.includes, 'optionalCall', _8 => _8(target)]));
70
- if (idx !== -1) {
71
- return idx;
72
- }
73
- }
74
- return -1;
75
- };
76
- }
77
- function createLoaderAnchorFinders(appType) {
78
- if (_chunk3DQN7M5Ujs.isMpx.call(void 0, appType)) {
79
- return {
80
- findRewriteAnchor: createPrioritizedFinder(MPX_REWRITE_PRECEDENCE_LOADERS),
81
- findClassSetAnchor: createFinder([MPX_STYLE_COMPILER_LOADER])
82
- };
83
- }
84
- const fallbackFinder = createFinder(["postcss-loader"]);
85
- return {
86
- findRewriteAnchor: fallbackFinder,
87
- findClassSetAnchor: fallbackFinder
88
- };
89
- }
90
-
91
- // src/bundlers/webpack/BaseUnifiedPlugin/shared.ts
92
- var MPX_STYLE_RESOURCE_QUERY_RE = /(?:\?|&)type=styles\b/;
93
- function getCacheKey(filename) {
94
- return filename;
95
- }
96
- function stripResourceQuery2(resource) {
97
- if (typeof resource !== "string") {
98
- return resource;
99
- }
100
- const queryIndex = resource.indexOf("?");
101
- if (queryIndex !== -1) {
102
- return resource.slice(0, queryIndex);
103
- }
104
- const hashIndex = resource.indexOf("#");
105
- if (hashIndex !== -1) {
106
- return resource.slice(0, hashIndex);
107
- }
108
- return resource;
109
- }
110
- function isCssLikeModuleResource(resource, cssMatcher, appType) {
111
- if (typeof resource !== "string") {
112
- return false;
113
- }
114
- const normalizedResource = stripResourceQuery2(resource);
115
- if (normalizedResource && cssMatcher(normalizedResource)) {
116
- return true;
117
- }
118
- if (appType === "mpx") {
119
- return MPX_STYLE_RESOURCE_QUERY_RE.test(resource);
120
- }
121
- return false;
122
- }
123
- function hasLoaderEntry(entries, target) {
124
- if (!target) {
125
- return false;
126
- }
127
- return entries.some((entry) => _optionalChain([entry, 'access', _9 => _9.loader, 'optionalAccess', _10 => _10.includes, 'optionalCall', _11 => _11(target)]));
128
- }
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
- exports.applyTailwindcssCssImportRewrite = applyTailwindcssCssImportRewrite; exports.createLoaderAnchorFinders = createLoaderAnchorFinders; exports.getCacheKey = getCacheKey; exports.isCssLikeModuleResource = isCssLikeModuleResource; exports.hasLoaderEntry = hasLoaderEntry;