weapp-tailwindcss 4.7.2 → 4.7.3

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 (44) hide show
  1. package/dist/{chunk-QZRXYCOQ.js → chunk-2AAEKHNR.js} +5 -5
  2. package/dist/{chunk-5BW6X6AJ.mjs → chunk-CIBW3DQO.mjs} +2 -2
  3. package/dist/{chunk-JYCQWWYU.mjs → chunk-DXFNC4BP.mjs} +21 -4
  4. package/dist/{chunk-FPDJ3BCM.js → chunk-JTGVWJ3Z.js} +23 -6
  5. package/dist/{chunk-GNWJEIZZ.js → chunk-L2CHPESJ.js} +6 -5
  6. package/dist/{chunk-Z2H7M33Z.mjs → chunk-O3TOCTXE.mjs} +3 -2
  7. package/dist/chunk-R7GWRQDJ.js +15 -0
  8. package/dist/chunk-SCOGAO45.mjs +18 -0
  9. package/dist/{chunk-OPTIAB5G.js → chunk-SIZNRUIV.js} +4 -4
  10. package/dist/{chunk-2SI3KT2H.js → chunk-UAU6XVAY.js} +2 -2
  11. package/dist/{chunk-Q6PLZCM6.mjs → chunk-XFYWHJEU.mjs} +1 -1
  12. package/dist/cli.js +383 -15
  13. package/dist/cli.mjs +382 -15
  14. package/dist/core.js +4 -4
  15. package/dist/core.mjs +2 -2
  16. package/dist/css-macro/postcss.js +1 -1
  17. package/dist/css-macro/postcss.mjs +1 -1
  18. package/dist/css-macro.js +1 -1
  19. package/dist/css-macro.mjs +1 -1
  20. package/dist/defaults.js +1 -1
  21. package/dist/defaults.mjs +1 -1
  22. package/dist/escape.js +1 -1
  23. package/dist/escape.mjs +1 -1
  24. package/dist/gulp.js +5 -5
  25. package/dist/gulp.mjs +3 -3
  26. package/dist/index.js +7 -7
  27. package/dist/index.mjs +5 -5
  28. package/dist/postcss-html-transform.js +1 -1
  29. package/dist/postcss-html-transform.mjs +1 -1
  30. package/dist/presets.js +3 -3
  31. package/dist/presets.mjs +1 -1
  32. package/dist/types.d.mts +6 -0
  33. package/dist/types.d.ts +6 -0
  34. package/dist/types.js +1 -1
  35. package/dist/types.mjs +1 -1
  36. package/dist/vite.js +5 -5
  37. package/dist/vite.mjs +3 -3
  38. package/dist/webpack.js +5 -5
  39. package/dist/webpack.mjs +3 -3
  40. package/dist/webpack4.js +7 -7
  41. package/dist/webpack4.mjs +2 -2
  42. package/package.json +6 -4
  43. package/dist/chunk-4EUTRMUC.mjs +0 -10
  44. package/dist/chunk-QXSBMK2W.js +0 -7
@@ -17,7 +17,7 @@ var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
17
17
 
18
18
 
19
19
 
20
- var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
20
+ var _chunkJTGVWJ3Zjs = require('./chunk-JTGVWJ3Z.js');
21
21
 
22
22
 
23
23
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
@@ -29,7 +29,7 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
29
29
  var debug = _chunkBUMQQPAOjs.createDebug.call(void 0, );
30
30
  var UnifiedWebpackPluginV5 = class {
31
31
  constructor(options = {}) {
32
- this.options = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
32
+ this.options = _chunkJTGVWJ3Zjs.getCompilerContext.call(void 0, options);
33
33
  this.appType = this.options.appType;
34
34
  }
35
35
  apply(compiler) {
@@ -68,8 +68,8 @@ var UnifiedWebpackPluginV5 = class {
68
68
  ident: null,
69
69
  type: null
70
70
  };
71
- compiler.hooks.compilation.tap(_chunkFPDJ3BCMjs.pluginName, (compilation) => {
72
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkFPDJ3BCMjs.pluginName, (_loaderContext, module) => {
71
+ compiler.hooks.compilation.tap(_chunkJTGVWJ3Zjs.pluginName, (compilation) => {
72
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkJTGVWJ3Zjs.pluginName, (_loaderContext, module) => {
73
73
  if (isExisted) {
74
74
  const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
75
75
  if (idx > -1) {
@@ -79,7 +79,7 @@ var UnifiedWebpackPluginV5 = class {
79
79
  });
80
80
  compilation.hooks.processAssets.tapPromise(
81
81
  {
82
- name: _chunkFPDJ3BCMjs.pluginName,
82
+ name: _chunkJTGVWJ3Zjs.pluginName,
83
83
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
84
84
  },
85
85
  async (assets) => {
@@ -17,13 +17,13 @@ import {
17
17
  import {
18
18
  getCompilerContext,
19
19
  pluginName
20
- } from "./chunk-JYCQWWYU.mjs";
20
+ } from "./chunk-DXFNC4BP.mjs";
21
21
  import {
22
22
  getGroupedEntries
23
23
  } from "./chunk-ZNKIYZRQ.mjs";
24
24
  import {
25
25
  __dirname
26
- } from "./chunk-4EUTRMUC.mjs";
26
+ } from "./chunk-SCOGAO45.mjs";
27
27
 
28
28
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
29
29
  import fs from "fs";
@@ -1129,6 +1129,8 @@ function createTaggedTemplateIgnore({ matcher, names }) {
1129
1129
  }
1130
1130
 
1131
1131
  // src/js/babel.ts
1132
+ var EXPRESSION_WRAPPER_PREFIX = "(\n";
1133
+ var EXPRESSION_WRAPPER_SUFFIX = "\n)";
1132
1134
  var parseCache = new LRUCache2(
1133
1135
  {
1134
1136
  max: 512
@@ -1271,9 +1273,11 @@ function processUpdatedSource(rawSource, options, analysis) {
1271
1273
  return ms;
1272
1274
  }
1273
1275
  function jsHandler(rawSource, options) {
1276
+ const shouldWrapExpression = Boolean(options.wrapExpression);
1277
+ const source = shouldWrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
1274
1278
  let ast;
1275
1279
  try {
1276
- ast = babelParse(rawSource, options.babelParserOptions);
1280
+ ast = babelParse(source, options.babelParserOptions);
1277
1281
  } catch (error) {
1278
1282
  return {
1279
1283
  code: rawSource,
@@ -1281,7 +1285,15 @@ function jsHandler(rawSource, options) {
1281
1285
  };
1282
1286
  }
1283
1287
  const analysis = analyzeSource(ast, options, jsHandler);
1284
- const ms = processUpdatedSource(rawSource, options, analysis);
1288
+ const ms = processUpdatedSource(source, options, analysis);
1289
+ if (shouldWrapExpression) {
1290
+ const start = 0;
1291
+ const end = source.length;
1292
+ const prefixLength = EXPRESSION_WRAPPER_PREFIX.length;
1293
+ const suffixLength = EXPRESSION_WRAPPER_SUFFIX.length;
1294
+ ms.remove(start, start + prefixLength);
1295
+ ms.remove(end - suffixLength, end);
1296
+ }
1285
1297
  const result = {
1286
1298
  code: ms.toString(),
1287
1299
  get map() {
@@ -1511,8 +1523,13 @@ function generateCode(match, options = {}) {
1511
1523
  try {
1512
1524
  const { jsHandler: jsHandler2, runtimeSet } = options;
1513
1525
  if (jsHandler2 && runtimeSet) {
1514
- const { code } = jsHandler2(match, runtimeSet);
1515
- return code;
1526
+ const runHandler = (wrap) => jsHandler2(match, runtimeSet, wrap ? { wrapExpression: true } : void 0);
1527
+ const initial = runHandler(options.wrapExpression);
1528
+ if (!initial.error || options.wrapExpression) {
1529
+ return initial.code;
1530
+ }
1531
+ const fallback = runHandler(true);
1532
+ return fallback.code;
1516
1533
  } else {
1517
1534
  const ms = new MagicString2(match);
1518
1535
  const ast = parseExpression(match);
@@ -3,7 +3,7 @@
3
3
  var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
4
4
 
5
5
 
6
- var _chunkOPTIAB5Gjs = require('./chunk-OPTIAB5G.js');
6
+ var _chunkSIZNRUIVjs = require('./chunk-SIZNRUIV.js');
7
7
 
8
8
 
9
9
  var _chunkWXBFAARRjs = require('./chunk-WXBFAARR.js');
@@ -1129,6 +1129,8 @@ function createTaggedTemplateIgnore({ matcher, names }) {
1129
1129
  }
1130
1130
 
1131
1131
  // src/js/babel.ts
1132
+ var EXPRESSION_WRAPPER_PREFIX = "(\n";
1133
+ var EXPRESSION_WRAPPER_SUFFIX = "\n)";
1132
1134
  var parseCache = new (0, _lrucache.LRUCache)(
1133
1135
  {
1134
1136
  max: 512
@@ -1271,9 +1273,11 @@ function processUpdatedSource(rawSource, options, analysis) {
1271
1273
  return ms;
1272
1274
  }
1273
1275
  function jsHandler(rawSource, options) {
1276
+ const shouldWrapExpression = Boolean(options.wrapExpression);
1277
+ const source = shouldWrapExpression ? `${EXPRESSION_WRAPPER_PREFIX}${rawSource}${EXPRESSION_WRAPPER_SUFFIX}` : rawSource;
1274
1278
  let ast;
1275
1279
  try {
1276
- ast = babelParse(rawSource, options.babelParserOptions);
1280
+ ast = babelParse(source, options.babelParserOptions);
1277
1281
  } catch (error) {
1278
1282
  return {
1279
1283
  code: rawSource,
@@ -1281,7 +1285,15 @@ function jsHandler(rawSource, options) {
1281
1285
  };
1282
1286
  }
1283
1287
  const analysis = analyzeSource(ast, options, jsHandler);
1284
- const ms = processUpdatedSource(rawSource, options, analysis);
1288
+ const ms = processUpdatedSource(source, options, analysis);
1289
+ if (shouldWrapExpression) {
1290
+ const start = 0;
1291
+ const end = source.length;
1292
+ const prefixLength = EXPRESSION_WRAPPER_PREFIX.length;
1293
+ const suffixLength = EXPRESSION_WRAPPER_SUFFIX.length;
1294
+ ms.remove(start, start + prefixLength);
1295
+ ms.remove(end - suffixLength, end);
1296
+ }
1285
1297
  const result = {
1286
1298
  code: ms.toString(),
1287
1299
  get map() {
@@ -1511,8 +1523,13 @@ function generateCode(match, options = {}) {
1511
1523
  try {
1512
1524
  const { jsHandler: jsHandler2, runtimeSet } = options;
1513
1525
  if (jsHandler2 && runtimeSet) {
1514
- const { code } = jsHandler2(match, runtimeSet);
1515
- return code;
1526
+ const runHandler = (wrap) => jsHandler2(match, runtimeSet, wrap ? { wrapExpression: true } : void 0);
1527
+ const initial = runHandler(options.wrapExpression);
1528
+ if (!initial.error || options.wrapExpression) {
1529
+ return initial.code;
1530
+ }
1531
+ const fallback = runHandler(true);
1532
+ return fallback.code;
1516
1533
  } else {
1517
1534
  const ms = new (0, _magicstring2.default)(match);
1518
1535
  const ast = _parser.parseExpression.call(void 0, match);
@@ -1905,7 +1922,7 @@ function getCompilerContext(opts) {
1905
1922
  );
1906
1923
  ctx.escapeMap = ctx.customReplaceDictionary;
1907
1924
  applyLoggerLevel(ctx.logLevel);
1908
- const twPatcher = _chunkOPTIAB5Gjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
1925
+ const twPatcher = _chunkSIZNRUIVjs.createTailwindcssPatcherFromContext.call(void 0, ctx);
1909
1926
  if (_optionalChain([twPatcher, 'access', _32 => _32.packageInfo, 'optionalAccess', _33 => _33.version])) {
1910
1927
  _logger.logger.success(`\u5F53\u524D\u4F7F\u7528 ${_logger.pc.cyanBright("Tailwind CSS")} \u7248\u672C\u4E3A: ${_logger.pc.underline(_logger.pc.bold(_logger.pc.green(twPatcher.packageInfo.version)))}`);
1911
1928
  } else {
@@ -15,7 +15,7 @@ var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
15
15
 
16
16
 
17
17
 
18
- var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
18
+ var _chunkJTGVWJ3Zjs = require('./chunk-JTGVWJ3Z.js');
19
19
 
20
20
 
21
21
  var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
@@ -53,9 +53,10 @@ function createClassAttributeUpdater(ms) {
53
53
  function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
54
54
  return (prop) => {
55
55
  if (_optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
56
- const generated = _chunkFPDJ3BCMjs.generateCode.call(void 0, prop.exp.content, {
56
+ const generated = _chunkJTGVWJ3Zjs.generateCode.call(void 0, prop.exp.content, {
57
57
  jsHandler,
58
- runtimeSet
58
+ runtimeSet,
59
+ wrapExpression: true
59
60
  });
60
61
  ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
61
62
  }
@@ -240,7 +241,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
240
241
  }
241
242
  }
242
243
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
243
- const opts = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
244
+ const opts = _chunkJTGVWJ3Zjs.getCompilerContext.call(void 0, options);
244
245
  const {
245
246
  disabled,
246
247
  onEnd,
@@ -265,7 +266,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
265
266
  onLoad();
266
267
  const plugins = [
267
268
  {
268
- name: `${_chunkFPDJ3BCMjs.vitePluginName}:post`,
269
+ name: `${_chunkJTGVWJ3Zjs.vitePluginName}:post`,
269
270
  enforce: "post",
270
271
  configResolved(config) {
271
272
  resolvedConfig = config;
@@ -15,7 +15,7 @@ import {
15
15
  generateCode,
16
16
  getCompilerContext,
17
17
  vitePluginName
18
- } from "./chunk-JYCQWWYU.mjs";
18
+ } from "./chunk-DXFNC4BP.mjs";
19
19
  import {
20
20
  replaceWxml
21
21
  } from "./chunk-VSRDBMDB.mjs";
@@ -55,7 +55,8 @@ function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
55
55
  if (prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION) {
56
56
  const generated = generateCode(prop.exp.content, {
57
57
  jsHandler,
58
- runtimeSet
58
+ runtimeSet,
59
+ wrapExpression: true
59
60
  });
60
61
  ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
61
62
  }
@@ -0,0 +1,15 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.13.5_@swc+h_8e91b94b8823fbc789a279e500560541/node_modules/tsup/assets/cjs_shims.js
9
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
10
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
11
+
12
+
13
+
14
+
15
+ exports.__require = __require; exports.importMetaUrl = importMetaUrl;
@@ -0,0 +1,18 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.13.5_@swc+h_8e91b94b8823fbc789a279e500560541/node_modules/tsup/assets/esm_shims.js
9
+ import path from "path";
10
+ import { fileURLToPath } from "url";
11
+ var getFilename = () => fileURLToPath(import.meta.url);
12
+ var getDirname = () => path.dirname(getFilename());
13
+ var __dirname = /* @__PURE__ */ getDirname();
14
+
15
+ export {
16
+ __require,
17
+ __dirname
18
+ };
@@ -3,7 +3,7 @@
3
3
  var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
4
4
 
5
5
 
6
- var _chunkQXSBMK2Wjs = require('./chunk-QXSBMK2W.js');
6
+ var _chunkR7GWRQDJjs = require('./chunk-R7GWRQDJ.js');
7
7
 
8
8
  // src/context/tailwindcss.ts
9
9
  var _module = require('module');
@@ -46,7 +46,7 @@ function resolveModuleFromPaths(specifier, paths) {
46
46
  return void 0;
47
47
  }
48
48
  try {
49
- const req = _module.createRequire.call(void 0, _chunkQXSBMK2Wjs.importMetaUrl);
49
+ const req = _module.createRequire.call(void 0, _chunkR7GWRQDJjs.importMetaUrl);
50
50
  return req.resolve(specifier, { paths });
51
51
  } catch (e) {
52
52
  return void 0;
@@ -155,11 +155,11 @@ function createDefaultResolvePaths(basedir) {
155
155
  const cwd = _process2.default.cwd();
156
156
  appendNodeModules(paths, cwd);
157
157
  try {
158
- const modulePath = _url.fileURLToPath.call(void 0, _chunkQXSBMK2Wjs.importMetaUrl);
158
+ const modulePath = _url.fileURLToPath.call(void 0, _chunkR7GWRQDJjs.importMetaUrl);
159
159
  const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
160
160
  paths.add(candidate);
161
161
  } catch (e2) {
162
- paths.add(_chunkQXSBMK2Wjs.importMetaUrl);
162
+ paths.add(_chunkR7GWRQDJjs.importMetaUrl);
163
163
  }
164
164
  if (paths.size === 0) {
165
165
  fallbackCandidates = fallbackCandidates.filter(Boolean);
@@ -8,7 +8,7 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
8
8
  var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
9
9
 
10
10
 
11
- var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
11
+ var _chunkJTGVWJ3Zjs = require('./chunk-JTGVWJ3Z.js');
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  var _buffer = require('buffer');
@@ -19,7 +19,7 @@ var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
19
19
  var debug = _chunkBUMQQPAOjs.createDebug.call(void 0, );
20
20
  var Transform = _stream2.default.Transform;
21
21
  function createPlugins(options = {}) {
22
- const opts = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
22
+ const opts = _chunkJTGVWJ3Zjs.getCompilerContext.call(void 0, options);
23
23
  const { templateHandler, styleHandler, jsHandler, cache, twPatcher } = opts;
24
24
  let runtimeSet = /* @__PURE__ */ new Set();
25
25
  const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-667CYXAH.mjs";
9
9
  import {
10
10
  getCompilerContext
11
- } from "./chunk-JYCQWWYU.mjs";
11
+ } from "./chunk-DXFNC4BP.mjs";
12
12
 
13
13
  // src/bundlers/gulp/index.ts
14
14
  import { Buffer } from "buffer";