weapp-tailwindcss 4.0.0 → 4.0.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.
@@ -6,7 +6,7 @@ var _chunkHBQASQKYjs = require('./chunk-HBQASQKY.js');
6
6
  var _chunkN62XM3T3js = require('./chunk-N62XM3T3.js');
7
7
 
8
8
 
9
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
9
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
10
10
 
11
11
 
12
12
  var _chunk35CYTBPMjs = require('./chunk-35CYTBPM.js');
@@ -17,7 +17,7 @@ var _chunk6FNC3XMIjs = require('./chunk-6FNC3XMI.js');
17
17
  // src/bundlers/vite/index.ts
18
18
  var debug = _chunkHBQASQKYjs.createDebug.call(void 0, );
19
19
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
20
- const opts = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, options);
20
+ const opts = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, options);
21
21
  const {
22
22
  disabled,
23
23
  onEnd,
@@ -47,7 +47,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
47
47
  onStart();
48
48
  const entries = Object.entries(bundle);
49
49
  const groupedEntries = _chunk35CYTBPMjs.getGroupedEntries.call(void 0, entries, opts);
50
- const runtimeSet = twPatcher.getClassSet();
50
+ const runtimeSet = yield twPatcher.getClassSet();
51
51
  setMangleRuntimeSet(runtimeSet);
52
52
  debug("get runtimeSet, class count: %d", runtimeSet.size);
53
53
  if (Array.isArray(groupedEntries.html)) {
@@ -3,7 +3,7 @@
3
3
  var _chunkHBQASQKYjs = require('./chunk-HBQASQKY.js');
4
4
 
5
5
 
6
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
6
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
7
7
 
8
8
 
9
9
 
@@ -15,7 +15,7 @@ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
15
15
  var debug = _chunkHBQASQKYjs.createDebug.call(void 0, );
16
16
  var Transform = _stream2.default.Transform;
17
17
  function createPlugins(options = {}) {
18
- const opts = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, options);
18
+ const opts = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, options);
19
19
  const { templateHandler, styleHandler, jsHandler, setMangleRuntimeSet, cache, twPatcher } = opts;
20
20
  let runtimeSet = /* @__PURE__ */ new Set();
21
21
  twPatcher.patch();
@@ -24,7 +24,7 @@ function createPlugins(options = {}) {
24
24
  objectMode: true,
25
25
  transform(file, _encoding, callback) {
26
26
  return _chunk6FNC3XMIjs.__async.call(void 0, this, null, function* () {
27
- runtimeSet = twPatcher.getClassSet();
27
+ runtimeSet = yield twPatcher.getClassSet();
28
28
  setMangleRuntimeSet(runtimeSet);
29
29
  const error = null;
30
30
  if (file.contents) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-HL6Y5PYZ.mjs";
7
7
  import {
8
8
  getCompilerContext
9
- } from "./chunk-W3GZOMW4.mjs";
9
+ } from "./chunk-T4LGP4UP.mjs";
10
10
  import {
11
11
  getGroupedEntries
12
12
  } from "./chunk-MUJ65IQ3.mjs";
@@ -47,7 +47,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
47
47
  onStart();
48
48
  const entries = Object.entries(bundle);
49
49
  const groupedEntries = getGroupedEntries(entries, opts);
50
- const runtimeSet = twPatcher.getClassSet();
50
+ const runtimeSet = yield twPatcher.getClassSet();
51
51
  setMangleRuntimeSet(runtimeSet);
52
52
  debug("get runtimeSet, class count: %d", runtimeSet.size);
53
53
  if (Array.isArray(groupedEntries.html)) {
@@ -473,7 +473,8 @@ var _localpkg = require('local-pkg');
473
473
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
474
474
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
475
475
  var _tailwindcsspatch = require('tailwindcss-patch');
476
- function createTailwindcssPatcher(basedir, cacheDir, supportCustomLengthUnitsPatch) {
476
+ function createTailwindcssPatcher(options) {
477
+ const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss } = options || {};
477
478
  const cache = {};
478
479
  if (cacheDir) {
479
480
  if (_path2.default.isAbsolute(cacheDir)) {
@@ -491,7 +492,8 @@ function createTailwindcssPatcher(basedir, cacheDir, supportCustomLengthUnitsPat
491
492
  applyPatches: {
492
493
  exportContext: true,
493
494
  extendLengthUnits: supportCustomLengthUnitsPatch
494
- }
495
+ },
496
+ tailwindcss
495
497
  }
496
498
  });
497
499
  }
@@ -838,7 +840,8 @@ function getCompilerContext(opts) {
838
840
  appType,
839
841
  ignoreCallExpressionIdentifiers,
840
842
  ignoreTaggedTemplateExpressionIdentifiers,
841
- cssPresetEnv
843
+ cssPresetEnv,
844
+ tailwindcss
842
845
  } = ctx;
843
846
  const customAttributesEntities = _chunk35CYTBPMjs.isMap.call(void 0, customAttributes) ? [...customAttributes.entries()] : Object.entries(customAttributes);
844
847
  const { initMangle, mangleContext, setMangleRuntimeSet } = _mangle.useMangleStore.call(void 0, );
@@ -880,9 +883,12 @@ function getCompilerContext(opts) {
880
883
  ctx.jsHandler = jsHandler2;
881
884
  ctx.templateHandler = templateHandler;
882
885
  const twPatcher = createTailwindcssPatcher(
883
- tailwindcssBasedir,
884
- appType === "mpx" ? "node_modules/tailwindcss-patch/.cache" : void 0,
885
- supportCustomLengthUnitsPatch != null ? supportCustomLengthUnitsPatch : true
886
+ {
887
+ basedir: tailwindcssBasedir,
888
+ cacheDir: appType === "mpx" ? "node_modules/tailwindcss-patch/.cache" : void 0,
889
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch != null ? supportCustomLengthUnitsPatch : true,
890
+ tailwindcss
891
+ }
886
892
  );
887
893
  ctx.setMangleRuntimeSet = setMangleRuntimeSet;
888
894
  ctx.cache = initializeCache(cache);
@@ -6,7 +6,7 @@ var _chunkHBQASQKYjs = require('./chunk-HBQASQKY.js');
6
6
  var _chunkN62XM3T3js = require('./chunk-N62XM3T3.js');
7
7
 
8
8
 
9
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
9
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
10
10
 
11
11
 
12
12
 
@@ -21,7 +21,7 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
21
21
  var debug = _chunkHBQASQKYjs.createDebug.call(void 0, );
22
22
  var UnifiedWebpackPluginV5 = class {
23
23
  constructor(options = {}) {
24
- this.options = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, options);
24
+ this.options = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, options);
25
25
  this.appType = this.options.appType;
26
26
  }
27
27
  apply(compiler) {
@@ -84,7 +84,7 @@ var UnifiedWebpackPluginV5 = class {
84
84
  }
85
85
  const entries = Object.entries(assets);
86
86
  const groupedEntries = _chunk35CYTBPMjs.getGroupedEntries.call(void 0, entries, this.options);
87
- const runtimeSet = getClassSet();
87
+ const runtimeSet = yield getClassSet();
88
88
  setMangleRuntimeSet(runtimeSet);
89
89
  debug("get runtimeSet, class count: %d", runtimeSet.size);
90
90
  if (Array.isArray(groupedEntries.html)) {
@@ -473,7 +473,8 @@ import { getPackageInfoSync } from "local-pkg";
473
473
  import path from "node:path";
474
474
  import process from "node:process";
475
475
  import { TailwindcssPatcher } from "tailwindcss-patch";
476
- function createTailwindcssPatcher(basedir, cacheDir, supportCustomLengthUnitsPatch) {
476
+ function createTailwindcssPatcher(options) {
477
+ const { basedir, cacheDir, supportCustomLengthUnitsPatch, tailwindcss } = options || {};
477
478
  const cache = {};
478
479
  if (cacheDir) {
479
480
  if (path.isAbsolute(cacheDir)) {
@@ -491,7 +492,8 @@ function createTailwindcssPatcher(basedir, cacheDir, supportCustomLengthUnitsPat
491
492
  applyPatches: {
492
493
  exportContext: true,
493
494
  extendLengthUnits: supportCustomLengthUnitsPatch
494
- }
495
+ },
496
+ tailwindcss
495
497
  }
496
498
  });
497
499
  }
@@ -838,7 +840,8 @@ function getCompilerContext(opts) {
838
840
  appType,
839
841
  ignoreCallExpressionIdentifiers,
840
842
  ignoreTaggedTemplateExpressionIdentifiers,
841
- cssPresetEnv
843
+ cssPresetEnv,
844
+ tailwindcss
842
845
  } = ctx;
843
846
  const customAttributesEntities = isMap(customAttributes) ? [...customAttributes.entries()] : Object.entries(customAttributes);
844
847
  const { initMangle, mangleContext, setMangleRuntimeSet } = useMangleStore();
@@ -880,9 +883,12 @@ function getCompilerContext(opts) {
880
883
  ctx.jsHandler = jsHandler2;
881
884
  ctx.templateHandler = templateHandler;
882
885
  const twPatcher = createTailwindcssPatcher(
883
- tailwindcssBasedir,
884
- appType === "mpx" ? "node_modules/tailwindcss-patch/.cache" : void 0,
885
- supportCustomLengthUnitsPatch != null ? supportCustomLengthUnitsPatch : true
886
+ {
887
+ basedir: tailwindcssBasedir,
888
+ cacheDir: appType === "mpx" ? "node_modules/tailwindcss-patch/.cache" : void 0,
889
+ supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch != null ? supportCustomLengthUnitsPatch : true,
890
+ tailwindcss
891
+ }
886
892
  );
887
893
  ctx.setMangleRuntimeSet = setMangleRuntimeSet;
888
894
  ctx.cache = initializeCache(cache);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-75EWCRQW.mjs";
4
4
  import {
5
5
  getCompilerContext
6
- } from "./chunk-W3GZOMW4.mjs";
6
+ } from "./chunk-T4LGP4UP.mjs";
7
7
  import {
8
8
  __async,
9
9
  __spreadValues
@@ -24,7 +24,7 @@ function createPlugins(options = {}) {
24
24
  objectMode: true,
25
25
  transform(file, _encoding, callback) {
26
26
  return __async(this, null, function* () {
27
- runtimeSet = twPatcher.getClassSet();
27
+ runtimeSet = yield twPatcher.getClassSet();
28
28
  setMangleRuntimeSet(runtimeSet);
29
29
  const error = null;
30
30
  if (file.contents) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-HL6Y5PYZ.mjs";
7
7
  import {
8
8
  getCompilerContext
9
- } from "./chunk-W3GZOMW4.mjs";
9
+ } from "./chunk-T4LGP4UP.mjs";
10
10
  import {
11
11
  getGroupedEntries,
12
12
  removeExt
@@ -84,7 +84,7 @@ var UnifiedWebpackPluginV5 = class {
84
84
  }
85
85
  const entries = Object.entries(assets);
86
86
  const groupedEntries = getGroupedEntries(entries, this.options);
87
- const runtimeSet = getClassSet();
87
+ const runtimeSet = yield getClassSet();
88
88
  setMangleRuntimeSet(runtimeSet);
89
89
  debug("get runtimeSet, class count: %d", runtimeSet.size);
90
90
  if (Array.isArray(groupedEntries.html)) {
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ var _chunkN62XM3T3js = require('./chunk-N62XM3T3.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
7
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
8
8
  require('./chunk-WGQLZ5K4.js');
9
9
  require('./chunk-YUXG2EJF.js');
10
10
  require('./chunk-35CYTBPM.js');
@@ -17,13 +17,13 @@ var _semver = require('semver'); var _semver2 = _interopRequireDefault(_semver);
17
17
  _process2.default.title = "node (weapp-tailwindcss)";
18
18
  var args = _process2.default.argv.slice(2);
19
19
  if (_semver2.default.lt(_process2.default.versions.node, _chunkN62XM3T3js.WEAPP_TW_REQUIRED_NODE_VERSION)) {
20
- _chunkP3IRFH3Ejs.logger.warn(
20
+ _chunkGLN4NGPVjs.logger.warn(
21
21
  `You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkN62XM3T3js.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
22
22
  );
23
23
  }
24
24
  var command = args[0];
25
25
  if (command === "patch") {
26
- const ctx = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, );
26
+ const ctx = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, );
27
27
  ctx.twPatcher.patch();
28
28
  } else if (command === "init") {
29
29
  _init.init.call(void 0, );
package/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  getCompilerContext,
6
6
  logger
7
- } from "./chunk-W3GZOMW4.mjs";
7
+ } from "./chunk-T4LGP4UP.mjs";
8
8
  import "./chunk-PCBSAFQF.mjs";
9
9
  import "./chunk-RHTRRSP3.mjs";
10
10
  import "./chunk-MUJ65IQ3.mjs";
package/dist/core.d.mts CHANGED
@@ -20,7 +20,7 @@ declare function createContext(options?: UserDefinedOptions): {
20
20
  transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
21
21
  transformJs: (rawJs: string, options?: {
22
22
  runtimeSet?: Set<string>;
23
- } & CreateJsHandlerOptions) => JsHandlerResult | Promise<JsHandlerResult>;
23
+ } & CreateJsHandlerOptions) => Promise<JsHandlerResult>;
24
24
  };
25
25
 
26
26
  export { createContext };
package/dist/core.d.ts CHANGED
@@ -20,7 +20,7 @@ declare function createContext(options?: UserDefinedOptions): {
20
20
  transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
21
21
  transformJs: (rawJs: string, options?: {
22
22
  runtimeSet?: Set<string>;
23
- } & CreateJsHandlerOptions) => JsHandlerResult | Promise<JsHandlerResult>;
23
+ } & CreateJsHandlerOptions) => Promise<JsHandlerResult>;
24
24
  };
25
25
 
26
26
  export { createContext };
package/dist/core.js CHANGED
@@ -1,15 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
3
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
4
4
  require('./chunk-WGQLZ5K4.js');
5
5
  require('./chunk-YUXG2EJF.js');
6
6
  require('./chunk-35CYTBPM.js');
7
- require('./chunk-6FNC3XMI.js');
7
+
8
+
9
+ var _chunk6FNC3XMIjs = require('./chunk-6FNC3XMI.js');
8
10
 
9
11
  // src/core.ts
10
12
  var _shared = require('@weapp-tailwindcss/shared');
11
13
  function createContext(options = {}) {
12
- const opts = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, options);
14
+ const opts = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, options);
13
15
  const { templateHandler, styleHandler, jsHandler, twPatcher } = opts;
14
16
  let runtimeSet = /* @__PURE__ */ new Set();
15
17
  twPatcher.patch();
@@ -18,9 +20,11 @@ function createContext(options = {}) {
18
20
  isMainChunk: true
19
21
  }));
20
22
  }
21
- function transformJs(rawJs, options2 = {}) {
22
- runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : twPatcher.getClassSet();
23
- return jsHandler(rawJs, runtimeSet, options2);
23
+ function transformJs(_0) {
24
+ return _chunk6FNC3XMIjs.__async.call(void 0, this, arguments, function* (rawJs, options2 = {}) {
25
+ runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : yield twPatcher.getClassSet();
26
+ return yield jsHandler(rawJs, runtimeSet, options2);
27
+ });
24
28
  }
25
29
  function transformWxml(rawWxml, options2) {
26
30
  return templateHandler(rawWxml, _shared.defuOverrideArray.call(void 0, options2, {
package/dist/core.mjs CHANGED
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  getCompilerContext
3
- } from "./chunk-W3GZOMW4.mjs";
3
+ } from "./chunk-T4LGP4UP.mjs";
4
4
  import "./chunk-PCBSAFQF.mjs";
5
5
  import "./chunk-RHTRRSP3.mjs";
6
6
  import "./chunk-MUJ65IQ3.mjs";
7
- import "./chunk-AXBFBHS2.mjs";
7
+ import {
8
+ __async
9
+ } from "./chunk-AXBFBHS2.mjs";
8
10
 
9
11
  // src/core.ts
10
12
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
@@ -18,9 +20,11 @@ function createContext(options = {}) {
18
20
  isMainChunk: true
19
21
  }));
20
22
  }
21
- function transformJs(rawJs, options2 = {}) {
22
- runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : twPatcher.getClassSet();
23
- return jsHandler(rawJs, runtimeSet, options2);
23
+ function transformJs(_0) {
24
+ return __async(this, arguments, function* (rawJs, options2 = {}) {
25
+ runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : yield twPatcher.getClassSet();
26
+ return yield jsHandler(rawJs, runtimeSet, options2);
27
+ });
24
28
  }
25
29
  function transformWxml(rawWxml, options2) {
26
30
  return templateHandler(rawWxml, defuOverrideArray(options2, {
package/dist/gulp.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkPZFXLVE2js = require('./chunk-PZFXLVE2.js');
3
+ var _chunk4P6YCUJTjs = require('./chunk-4P6YCUJT.js');
4
4
  require('./chunk-HBQASQKY.js');
5
- require('./chunk-P3IRFH3E.js');
5
+ require('./chunk-GLN4NGPV.js');
6
6
  require('./chunk-WGQLZ5K4.js');
7
7
  require('./chunk-YUXG2EJF.js');
8
8
  require('./chunk-35CYTBPM.js');
9
9
  require('./chunk-6FNC3XMI.js');
10
10
 
11
11
 
12
- exports.createPlugins = _chunkPZFXLVE2js.createPlugins;
12
+ exports.createPlugins = _chunk4P6YCUJTjs.createPlugins;
package/dist/gulp.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createPlugins
3
- } from "./chunk-M5OLCGMK.mjs";
3
+ } from "./chunk-XSU23YPZ.mjs";
4
4
  import "./chunk-75EWCRQW.mjs";
5
- import "./chunk-W3GZOMW4.mjs";
5
+ import "./chunk-T4LGP4UP.mjs";
6
6
  import "./chunk-PCBSAFQF.mjs";
7
7
  import "./chunk-RHTRRSP3.mjs";
8
8
  import "./chunk-MUJ65IQ3.mjs";
package/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-FXPGR372.js');
2
2
 
3
3
 
4
- var _chunkDXVFKGNLjs = require('./chunk-DXVFKGNL.js');
4
+ var _chunkSAIWHQAYjs = require('./chunk-SAIWHQAY.js');
5
5
 
6
6
 
7
- var _chunkPZFXLVE2js = require('./chunk-PZFXLVE2.js');
7
+ var _chunk4P6YCUJTjs = require('./chunk-4P6YCUJT.js');
8
8
 
9
9
 
10
- var _chunkAHF73IRBjs = require('./chunk-AHF73IRB.js');
10
+ var _chunk3IIS4S3Ejs = require('./chunk-3IIS4S3E.js');
11
11
  require('./chunk-HBQASQKY.js');
12
12
  require('./chunk-N62XM3T3.js');
13
- require('./chunk-P3IRFH3E.js');
13
+ require('./chunk-GLN4NGPV.js');
14
14
  require('./chunk-WGQLZ5K4.js');
15
15
  require('./chunk-YUXG2EJF.js');
16
16
  require('./chunk-35CYTBPM.js');
@@ -19,4 +19,4 @@ require('./chunk-6FNC3XMI.js');
19
19
 
20
20
 
21
21
 
22
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkAHF73IRBjs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkDXVFKGNLjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkPZFXLVE2js.createPlugins;
22
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunk3IIS4S3Ejs.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkSAIWHQAYjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunk4P6YCUJTjs.createPlugins;
package/dist/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  import "./chunk-LOLJLZCX.mjs";
2
2
  import {
3
3
  UnifiedWebpackPluginV5
4
- } from "./chunk-UJFSOSOM.mjs";
4
+ } from "./chunk-Z4VQVB26.mjs";
5
5
  import {
6
6
  createPlugins
7
- } from "./chunk-M5OLCGMK.mjs";
7
+ } from "./chunk-XSU23YPZ.mjs";
8
8
  import {
9
9
  UnifiedViteWeappTailwindcssPlugin
10
- } from "./chunk-HI4MB6DS.mjs";
10
+ } from "./chunk-AW2WTO5D.mjs";
11
11
  import "./chunk-75EWCRQW.mjs";
12
12
  import "./chunk-HL6Y5PYZ.mjs";
13
- import "./chunk-W3GZOMW4.mjs";
13
+ import "./chunk-T4LGP4UP.mjs";
14
14
  import "./chunk-PCBSAFQF.mjs";
15
15
  import "./chunk-RHTRRSP3.mjs";
16
16
  import "./chunk-MUJ65IQ3.mjs";
package/dist/types.d.mts CHANGED
@@ -5,7 +5,7 @@ import { CssPreflightOptions, LoadedPostcssOptions, CustomRuleCallback, IStyleHa
5
5
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
6
  import { SourceMap } from 'magic-string';
7
7
  import { Result, Root, Document } from 'postcss';
8
- import { ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
8
+ import { PatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
9
9
  import { Buffer } from 'node:buffer';
10
10
  import { sources } from 'webpack';
11
11
  import { LRUCache } from 'lru-cache';
@@ -41,6 +41,22 @@ interface UserDefinedOptions {
41
41
  /**
42
42
  * @group 0.重要配置
43
43
  * @description 是否禁用此插件,一般用于构建到多平台时使用,比如小程序时不传,非小程序环境(h5,app)传入一个 `true`
44
+ * ```ts
45
+ * // 比如 uni-app vue3 vite
46
+ * import process from 'node:process'
47
+
48
+ const isH5 = process.env.UNI_PLATFORM === 'h5'
49
+ const isApp = process.env.UNI_PLATFORM === 'app'
50
+ const WeappTailwindcssDisabled = isH5 || isApp
51
+
52
+ import { UnifiedViteWeappTailwindcssPlugin as uvtw } from 'weapp-tailwindcss/vite'
53
+ // 注册插件
54
+ // highlight-start
55
+ uvtw({
56
+ disabled: WeappTailwindcssDisabled,
57
+ }),
58
+ // highlight-end
59
+ * ```
44
60
  */
45
61
  disabled?: boolean;
46
62
  /**
@@ -82,12 +98,6 @@ interface UserDefinedOptions {
82
98
  * @default MappingChars2String
83
99
  */
84
100
  customReplaceDictionary?: Record<string, string>;
85
- /**
86
- * @version `^3.1.0`
87
- * @group 0.重要配置
88
- * @description 对解析 js 使用的 ast 工具,默认情况使用 `babel`,可以通过安装 `@ast-grep/napi`,同时启用 `ast-grep` 配置项,来启用 `ast-grep` 来处理 `js`,速度会是 `babel` 的 `2` 倍左右
89
- */
90
- jsAstTool?: 'babel' | 'ast-grep';
91
101
  /**
92
102
  * @version `^4.0.0`
93
103
  * @group 0.重要配置
@@ -187,6 +197,14 @@ interface UserDefinedOptions {
187
197
  * @version `^3.0.0`
188
198
  * @group 0.重要配置
189
199
  * @description rem 转 rpx 配置,默认为 `undefined` 不开启,可传入 `true` 启用默认配置项,也可传入自定义配置项,配置项列表见 [postcss-rem-to-responsive-pixel](https://www.npmjs.com/package/postcss-rem-to-responsive-pixel)
200
+ * ```ts
201
+ * // 默认值
202
+ * {
203
+ * rootValue: 32,
204
+ * propList: ['*'],
205
+ * transformUnit: 'rpx',
206
+ * }
207
+ * ```
190
208
  */
191
209
  rem2rpx?: boolean | UserDefinedOptions;
192
210
  /**
@@ -195,6 +213,12 @@ interface UserDefinedOptions {
195
213
  * @description postcss-preset-env 的入参数
196
214
  */
197
215
  cssPresetEnv?: pluginOptions;
216
+ /**
217
+ * @version `^4.0.0`
218
+ * @group 0.重要配置
219
+ * @description 配置不同版本 tailwindcss 的行为
220
+ */
221
+ tailwindcss?: PatchOptions['tailwindcss'];
198
222
  }
199
223
  interface UserDefinedOptions {
200
224
  /**
@@ -295,12 +319,6 @@ interface UserDefinedOptions {
295
319
  * @description 使用的框架类型(uni-app,taro...),用于找到主要的 `css bundle` 进行转化,这个配置会影响默认方法 `mainCssChunkMatcher` 的行为,不传会去猜测 `tailwindcss css var inject scope` (tailwindcss 变量注入的位置) 的位置
296
320
  */
297
321
  appType?: AppType;
298
- /**
299
- * @group 3.一般配置
300
- * @description 是否压缩混淆 `wxml`,`js` 和 `wxss` 中指定范围的 `class` 以避免选择器过长问题,默认为`false`不开启,详细配置见 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle)
301
- * @url https://github.com/sonofmagic/tailwindcss-mangle
302
- */
303
- mangle?: boolean | IMangleOptions;
304
322
  /**
305
323
  * @group 3.一般配置
306
324
  * @description 针对 tailwindcss arbitrary values 的一些配置
@@ -394,6 +412,32 @@ interface UserDefinedOptions {
394
412
  */
395
413
  customRuleCallback?: CustomRuleCallback;
396
414
  }
415
+ interface UserDefinedOptions {
416
+ /**
417
+ * @group 4.即将废弃配置
418
+ * @description 对解析 js 使用的 ast 工具,默认情况使用 `babel`,可以通过安装 `@ast-grep/napi`,同时启用 `ast-grep` 配置项,来启用 `ast-grep` 来处理 `js`,速度会是 `babel` 的 `2` 倍左右
419
+ * :::danger
420
+ * 此配置即将在 `5.x` 被弃用
421
+ *
422
+ * 废弃原因:
423
+ *
424
+ * 虽然 `@ast-grep/napi` 提供了更快的速度,但是 `babel` 有更强的静态分析 `js` 能力,使得后续一些新功能的开发无法使用 `@ast-grep/napi` 实现,所以废弃只保留 `babel` 的方式
425
+ * :::
426
+ */
427
+ jsAstTool?: 'babel' | 'ast-grep';
428
+ /**
429
+ * @group 4.即将废弃配置
430
+ * @description 是否压缩混淆 `wxml`,`js` 和 `wxss` 中指定范围的 `class` 以避免选择器过长问题,默认为`false`不开启,详细配置见 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle)
431
+ * :::danger
432
+ * 此配置即将在 `5.x` 被弃用
433
+ *
434
+ * 废弃原因:
435
+ *
436
+ * mangle 相关的功能会被迁移到另外一个项目: [`tailwindcss-mangle`](https://github.com/sonofmagic/tailwindcss-mangle) 中去,还想要这个功能可以2个插件结合使用
437
+ * :::
438
+ */
439
+ mangle?: boolean | IMangleOptions;
440
+ }
397
441
 
398
442
  type ItemOrItemArray<T> = T | T[];
399
443
 
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@ import { CssPreflightOptions, LoadedPostcssOptions, CustomRuleCallback, IStyleHa
5
5
  export { CssPreflightOptions, IStyleHandlerOptions } from '@weapp-tailwindcss/postcss';
6
6
  import { SourceMap } from 'magic-string';
7
7
  import { Result, Root, Document } from 'postcss';
8
- import { ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
8
+ import { PatchOptions, ILengthUnitsPatchOptions, TailwindcssPatcher } from 'tailwindcss-patch';
9
9
  import { Buffer } from 'node:buffer';
10
10
  import { sources } from 'webpack';
11
11
  import { LRUCache } from 'lru-cache';
@@ -41,6 +41,22 @@ interface UserDefinedOptions {
41
41
  /**
42
42
  * @group 0.重要配置
43
43
  * @description 是否禁用此插件,一般用于构建到多平台时使用,比如小程序时不传,非小程序环境(h5,app)传入一个 `true`
44
+ * ```ts
45
+ * // 比如 uni-app vue3 vite
46
+ * import process from 'node:process'
47
+
48
+ const isH5 = process.env.UNI_PLATFORM === 'h5'
49
+ const isApp = process.env.UNI_PLATFORM === 'app'
50
+ const WeappTailwindcssDisabled = isH5 || isApp
51
+
52
+ import { UnifiedViteWeappTailwindcssPlugin as uvtw } from 'weapp-tailwindcss/vite'
53
+ // 注册插件
54
+ // highlight-start
55
+ uvtw({
56
+ disabled: WeappTailwindcssDisabled,
57
+ }),
58
+ // highlight-end
59
+ * ```
44
60
  */
45
61
  disabled?: boolean;
46
62
  /**
@@ -82,12 +98,6 @@ interface UserDefinedOptions {
82
98
  * @default MappingChars2String
83
99
  */
84
100
  customReplaceDictionary?: Record<string, string>;
85
- /**
86
- * @version `^3.1.0`
87
- * @group 0.重要配置
88
- * @description 对解析 js 使用的 ast 工具,默认情况使用 `babel`,可以通过安装 `@ast-grep/napi`,同时启用 `ast-grep` 配置项,来启用 `ast-grep` 来处理 `js`,速度会是 `babel` 的 `2` 倍左右
89
- */
90
- jsAstTool?: 'babel' | 'ast-grep';
91
101
  /**
92
102
  * @version `^4.0.0`
93
103
  * @group 0.重要配置
@@ -187,6 +197,14 @@ interface UserDefinedOptions {
187
197
  * @version `^3.0.0`
188
198
  * @group 0.重要配置
189
199
  * @description rem 转 rpx 配置,默认为 `undefined` 不开启,可传入 `true` 启用默认配置项,也可传入自定义配置项,配置项列表见 [postcss-rem-to-responsive-pixel](https://www.npmjs.com/package/postcss-rem-to-responsive-pixel)
200
+ * ```ts
201
+ * // 默认值
202
+ * {
203
+ * rootValue: 32,
204
+ * propList: ['*'],
205
+ * transformUnit: 'rpx',
206
+ * }
207
+ * ```
190
208
  */
191
209
  rem2rpx?: boolean | UserDefinedOptions;
192
210
  /**
@@ -195,6 +213,12 @@ interface UserDefinedOptions {
195
213
  * @description postcss-preset-env 的入参数
196
214
  */
197
215
  cssPresetEnv?: pluginOptions;
216
+ /**
217
+ * @version `^4.0.0`
218
+ * @group 0.重要配置
219
+ * @description 配置不同版本 tailwindcss 的行为
220
+ */
221
+ tailwindcss?: PatchOptions['tailwindcss'];
198
222
  }
199
223
  interface UserDefinedOptions {
200
224
  /**
@@ -295,12 +319,6 @@ interface UserDefinedOptions {
295
319
  * @description 使用的框架类型(uni-app,taro...),用于找到主要的 `css bundle` 进行转化,这个配置会影响默认方法 `mainCssChunkMatcher` 的行为,不传会去猜测 `tailwindcss css var inject scope` (tailwindcss 变量注入的位置) 的位置
296
320
  */
297
321
  appType?: AppType;
298
- /**
299
- * @group 3.一般配置
300
- * @description 是否压缩混淆 `wxml`,`js` 和 `wxss` 中指定范围的 `class` 以避免选择器过长问题,默认为`false`不开启,详细配置见 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle)
301
- * @url https://github.com/sonofmagic/tailwindcss-mangle
302
- */
303
- mangle?: boolean | IMangleOptions;
304
322
  /**
305
323
  * @group 3.一般配置
306
324
  * @description 针对 tailwindcss arbitrary values 的一些配置
@@ -394,6 +412,32 @@ interface UserDefinedOptions {
394
412
  */
395
413
  customRuleCallback?: CustomRuleCallback;
396
414
  }
415
+ interface UserDefinedOptions {
416
+ /**
417
+ * @group 4.即将废弃配置
418
+ * @description 对解析 js 使用的 ast 工具,默认情况使用 `babel`,可以通过安装 `@ast-grep/napi`,同时启用 `ast-grep` 配置项,来启用 `ast-grep` 来处理 `js`,速度会是 `babel` 的 `2` 倍左右
419
+ * :::danger
420
+ * 此配置即将在 `5.x` 被弃用
421
+ *
422
+ * 废弃原因:
423
+ *
424
+ * 虽然 `@ast-grep/napi` 提供了更快的速度,但是 `babel` 有更强的静态分析 `js` 能力,使得后续一些新功能的开发无法使用 `@ast-grep/napi` 实现,所以废弃只保留 `babel` 的方式
425
+ * :::
426
+ */
427
+ jsAstTool?: 'babel' | 'ast-grep';
428
+ /**
429
+ * @group 4.即将废弃配置
430
+ * @description 是否压缩混淆 `wxml`,`js` 和 `wxss` 中指定范围的 `class` 以避免选择器过长问题,默认为`false`不开启,详细配置见 [unplugin-tailwindcss-mangle](https://github.com/sonofmagic/tailwindcss-mangle/tree/main/packages/unplugin-tailwindcss-mangle)
431
+ * :::danger
432
+ * 此配置即将在 `5.x` 被弃用
433
+ *
434
+ * 废弃原因:
435
+ *
436
+ * mangle 相关的功能会被迁移到另外一个项目: [`tailwindcss-mangle`](https://github.com/sonofmagic/tailwindcss-mangle) 中去,还想要这个功能可以2个插件结合使用
437
+ * :::
438
+ */
439
+ mangle?: boolean | IMangleOptions;
440
+ }
397
441
 
398
442
  type ItemOrItemArray<T> = T | T[];
399
443
 
package/dist/vite.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkAHF73IRBjs = require('./chunk-AHF73IRB.js');
3
+ var _chunk3IIS4S3Ejs = require('./chunk-3IIS4S3E.js');
4
4
  require('./chunk-HBQASQKY.js');
5
5
  require('./chunk-N62XM3T3.js');
6
- require('./chunk-P3IRFH3E.js');
6
+ require('./chunk-GLN4NGPV.js');
7
7
  require('./chunk-WGQLZ5K4.js');
8
8
  require('./chunk-YUXG2EJF.js');
9
9
  require('./chunk-35CYTBPM.js');
10
10
  require('./chunk-6FNC3XMI.js');
11
11
 
12
12
 
13
- exports.UnifiedViteWeappTailwindcssPlugin = _chunkAHF73IRBjs.UnifiedViteWeappTailwindcssPlugin;
13
+ exports.UnifiedViteWeappTailwindcssPlugin = _chunk3IIS4S3Ejs.UnifiedViteWeappTailwindcssPlugin;
package/dist/vite.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UnifiedViteWeappTailwindcssPlugin
3
- } from "./chunk-HI4MB6DS.mjs";
3
+ } from "./chunk-AW2WTO5D.mjs";
4
4
  import "./chunk-75EWCRQW.mjs";
5
5
  import "./chunk-HL6Y5PYZ.mjs";
6
- import "./chunk-W3GZOMW4.mjs";
6
+ import "./chunk-T4LGP4UP.mjs";
7
7
  import "./chunk-PCBSAFQF.mjs";
8
8
  import "./chunk-RHTRRSP3.mjs";
9
9
  import "./chunk-MUJ65IQ3.mjs";
package/dist/webpack.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkDXVFKGNLjs = require('./chunk-DXVFKGNL.js');
3
+ var _chunkSAIWHQAYjs = require('./chunk-SAIWHQAY.js');
4
4
  require('./chunk-HBQASQKY.js');
5
5
  require('./chunk-N62XM3T3.js');
6
- require('./chunk-P3IRFH3E.js');
6
+ require('./chunk-GLN4NGPV.js');
7
7
  require('./chunk-WGQLZ5K4.js');
8
8
  require('./chunk-YUXG2EJF.js');
9
9
  require('./chunk-35CYTBPM.js');
10
10
  require('./chunk-6FNC3XMI.js');
11
11
 
12
12
 
13
- exports.UnifiedWebpackPluginV5 = _chunkDXVFKGNLjs.UnifiedWebpackPluginV5;
13
+ exports.UnifiedWebpackPluginV5 = _chunkSAIWHQAYjs.UnifiedWebpackPluginV5;
package/dist/webpack.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UnifiedWebpackPluginV5
3
- } from "./chunk-UJFSOSOM.mjs";
3
+ } from "./chunk-Z4VQVB26.mjs";
4
4
  import "./chunk-75EWCRQW.mjs";
5
5
  import "./chunk-HL6Y5PYZ.mjs";
6
- import "./chunk-W3GZOMW4.mjs";
6
+ import "./chunk-T4LGP4UP.mjs";
7
7
  import "./chunk-PCBSAFQF.mjs";
8
8
  import "./chunk-RHTRRSP3.mjs";
9
9
  import "./chunk-MUJ65IQ3.mjs";
package/dist/webpack4.js CHANGED
@@ -6,7 +6,7 @@ var _chunkHBQASQKYjs = require('./chunk-HBQASQKY.js');
6
6
  var _chunkN62XM3T3js = require('./chunk-N62XM3T3.js');
7
7
 
8
8
 
9
- var _chunkP3IRFH3Ejs = require('./chunk-P3IRFH3E.js');
9
+ var _chunkGLN4NGPVjs = require('./chunk-GLN4NGPV.js');
10
10
  require('./chunk-WGQLZ5K4.js');
11
11
  require('./chunk-YUXG2EJF.js');
12
12
 
@@ -24,7 +24,7 @@ var _webpacksources = require('webpack-sources');
24
24
  var debug = _chunkHBQASQKYjs.createDebug.call(void 0, );
25
25
  var UnifiedWebpackPluginV4 = class {
26
26
  constructor(options = {}) {
27
- this.options = _chunkP3IRFH3Ejs.getCompilerContext.call(void 0, options);
27
+ this.options = _chunkGLN4NGPVjs.getCompilerContext.call(void 0, options);
28
28
  this.appType = this.options.appType;
29
29
  }
30
30
  apply(compiler) {
@@ -82,7 +82,7 @@ var UnifiedWebpackPluginV4 = class {
82
82
  const assets = compilation.assets;
83
83
  const entries = Object.entries(assets);
84
84
  const groupedEntries = _chunk35CYTBPMjs.getGroupedEntries.call(void 0, entries, this.options);
85
- const runtimeSet = getClassSet();
85
+ const runtimeSet = yield getClassSet();
86
86
  setMangleRuntimeSet(runtimeSet);
87
87
  debug("get runtimeSet, class count: %d", runtimeSet.size);
88
88
  if (Array.isArray(groupedEntries.html)) {
package/dist/webpack4.mjs CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-HL6Y5PYZ.mjs";
7
7
  import {
8
8
  getCompilerContext
9
- } from "./chunk-W3GZOMW4.mjs";
9
+ } from "./chunk-T4LGP4UP.mjs";
10
10
  import "./chunk-PCBSAFQF.mjs";
11
11
  import "./chunk-RHTRRSP3.mjs";
12
12
  import {
@@ -82,7 +82,7 @@ var UnifiedWebpackPluginV4 = class {
82
82
  const assets = compilation.assets;
83
83
  const entries = Object.entries(assets);
84
84
  const groupedEntries = getGroupedEntries(entries, this.options);
85
- const runtimeSet = getClassSet();
85
+ const runtimeSet = yield getClassSet();
86
86
  setMangleRuntimeSet(runtimeSet);
87
87
  debug("get runtimeSet, class count: %d", runtimeSet.size);
88
88
  if (Array.isArray(groupedEntries.html)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -141,9 +141,9 @@
141
141
  },
142
142
  "dependencies": {
143
143
  "@ast-core/escape": "~1.0.1",
144
- "@babel/parser": "~7.26.8",
145
- "@babel/traverse": "~7.26.8",
146
- "@babel/types": "~7.26.8",
144
+ "@babel/parser": "~7.26.9",
145
+ "@babel/traverse": "~7.26.9",
146
+ "@babel/types": "~7.26.9",
147
147
  "@weapp-core/escape": "~4.0.0",
148
148
  "@weapp-core/regex": "~1.0.1",
149
149
  "debug": "~4.4.0",
@@ -154,13 +154,13 @@
154
154
  "magic-string": "0.30.17",
155
155
  "md5": "2.3.0",
156
156
  "semver": "~7.7.1",
157
- "tailwindcss-patch": "~5.0.2",
157
+ "tailwindcss-patch": "~6.0.2",
158
158
  "webpack-sources": "3.2.3",
159
159
  "@weapp-tailwindcss/init": "1.0.0",
160
160
  "@weapp-tailwindcss/logger": "1.0.0",
161
161
  "@weapp-tailwindcss/mangle": "1.0.0",
162
- "@weapp-tailwindcss/postcss": "1.0.0",
163
- "@weapp-tailwindcss/shared": "1.0.0"
162
+ "@weapp-tailwindcss/shared": "1.0.0",
163
+ "@weapp-tailwindcss/postcss": "1.0.1"
164
164
  },
165
165
  "scripts": {
166
166
  "dev": "tsup --watch --sourcemap",