weapp-tailwindcss 2.4.4 → 2.6.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.
package/README.md CHANGED
@@ -11,14 +11,8 @@
11
11
  <h1 align="center">weapp-tailwindcss</h1>
12
12
 
13
13
  </p>
14
- <!-- <p align="center">
15
- <a href="https://weapp-tw.icebreaker.top#gh-light-mode-only">
16
- <img src="./assets/logo-text-light.png#gh-light-mode-only" alt="weapp-tailwindcss-logo" width="300">
17
- </a>
18
- <a href="https://weapp-tw.icebreaker.top#gh-dark-mode-only">
19
- <img src="./assets/logo-text-dark.png#gh-dark-mode-only" alt="weapp-tailwindcss-logo" width="300">
20
- </a>
21
- <br> -->
14
+
15
+ > 简体中文(zh-cn) | [English](./README_en.md)
22
16
 
23
17
  ![star](https://badgen.net/github/stars/sonofmagic/weapp-tailwindcss)
24
18
  ![dm0](https://badgen.net/npm/dm/weapp-tailwindcss)
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-887b74ca.js');
3
+ var options = require('./options-487394fa.js');
4
4
  require('micromatch');
5
5
  require('@babel/types');
6
6
  require('@babel/generator');
@@ -9,7 +9,7 @@ require('@babel/traverse');
9
9
  require('./replace.js');
10
10
  require('./shared-ae7dd073.js');
11
11
  require('postcss');
12
- require('./postcss-33ef0bd0.js');
12
+ require('./postcss-b53e9504.js');
13
13
  require('postcss-selector-parser');
14
14
  require('@csstools/postcss-is-pseudo-class');
15
15
  require('node:path');
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { g as getOptions, c as createPatch } from './options-879de0a2.mjs';
1
+ import { g as getOptions, c as createPatch } from './options-f7b71f03.mjs';
2
2
  import 'micromatch';
3
3
  import '@babel/types';
4
4
  import '@babel/generator';
@@ -7,7 +7,7 @@ import '@babel/traverse';
7
7
  import './replace.mjs';
8
8
  import './shared-7c88fb94.mjs';
9
9
  import 'postcss';
10
- import './postcss-ea625621.mjs';
10
+ import './postcss-760298ba.mjs';
11
11
  import 'postcss-selector-parser';
12
12
  import '@csstools/postcss-is-pseudo-class';
13
13
  import 'node:path';
@@ -1,4 +1,4 @@
1
- export declare const NS = "jsx-rename-loader";
1
+ export declare const runtimeAopLoader = "weapp-tw-runtime-aop-loader";
2
2
  export declare const postcssPlugin = "postcss-weapp-tailwindcss-rename-plugin";
3
3
  export declare const ManglePluginHooks = "ManglePluginHooks";
4
4
  export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
package/dist/gulp.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var stream = require('node:stream');
6
- var options = require('./options-887b74ca.js');
6
+ var options = require('./options-487394fa.js');
7
7
  require('micromatch');
8
8
  require('@babel/types');
9
9
  require('@babel/generator');
@@ -12,7 +12,7 @@ require('@babel/traverse');
12
12
  require('./replace.js');
13
13
  require('./shared-ae7dd073.js');
14
14
  require('postcss');
15
- require('./postcss-33ef0bd0.js');
15
+ require('./postcss-b53e9504.js');
16
16
  require('postcss-selector-parser');
17
17
  require('@csstools/postcss-is-pseudo-class');
18
18
  require('node:path');
@@ -32,14 +32,14 @@ function createPlugins(options$1 = {}) {
32
32
  }
33
33
  const opts = options.getOptions(options$1);
34
34
  const { templeteHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
35
- let set = new Set();
35
+ let runtimeSet = new Set();
36
36
  patch === null || patch === void 0 ? void 0 : patch();
37
37
  const twPatcher = options.createTailwindcssPatcher();
38
38
  function transformWxss() {
39
39
  const transformStream = new Transform({ objectMode: true });
40
40
  transformStream._transform = function (file, encoding, callback) {
41
- set = twPatcher.getClassSet();
42
- setMangleRuntimeSet(set);
41
+ runtimeSet = twPatcher.getClassSet();
42
+ setMangleRuntimeSet(runtimeSet);
43
43
  const error = null;
44
44
  if (file.contents) {
45
45
  const code = styleHandler(file.contents.toString(), {
@@ -56,7 +56,7 @@ function createPlugins(options$1 = {}) {
56
56
  transformStream._transform = function (file, encoding, callback) {
57
57
  const error = null;
58
58
  if (file.contents) {
59
- const { code } = jsHandler(file.contents.toString(), set);
59
+ const { code } = jsHandler(file.contents.toString(), runtimeSet);
60
60
  file.contents = Buffer.from(code);
61
61
  }
62
62
  callback(error, file);
@@ -68,7 +68,9 @@ function createPlugins(options$1 = {}) {
68
68
  transformStream._transform = function (file, encoding, callback) {
69
69
  const error = null;
70
70
  if (file.contents) {
71
- const code = templeteHandler(file.contents.toString());
71
+ const code = templeteHandler(file.contents.toString(), {
72
+ runtimeSet
73
+ });
72
74
  file.contents = Buffer.from(code);
73
75
  }
74
76
  callback(error, file);
package/dist/gulp.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import stream from 'node:stream';
2
- import { g as getOptions, a as createTailwindcssPatcher } from './options-879de0a2.mjs';
2
+ import { g as getOptions, a as createTailwindcssPatcher } from './options-f7b71f03.mjs';
3
3
  import 'micromatch';
4
4
  import '@babel/types';
5
5
  import '@babel/generator';
@@ -8,7 +8,7 @@ import '@babel/traverse';
8
8
  import './replace.mjs';
9
9
  import './shared-7c88fb94.mjs';
10
10
  import 'postcss';
11
- import './postcss-ea625621.mjs';
11
+ import './postcss-760298ba.mjs';
12
12
  import 'postcss-selector-parser';
13
13
  import '@csstools/postcss-is-pseudo-class';
14
14
  import 'node:path';
@@ -24,14 +24,14 @@ function createPlugins(options = {}) {
24
24
  }
25
25
  const opts = getOptions(options);
26
26
  const { templeteHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
27
- let set = new Set();
27
+ let runtimeSet = new Set();
28
28
  patch === null || patch === void 0 ? void 0 : patch();
29
29
  const twPatcher = createTailwindcssPatcher();
30
30
  function transformWxss() {
31
31
  const transformStream = new Transform({ objectMode: true });
32
32
  transformStream._transform = function (file, encoding, callback) {
33
- set = twPatcher.getClassSet();
34
- setMangleRuntimeSet(set);
33
+ runtimeSet = twPatcher.getClassSet();
34
+ setMangleRuntimeSet(runtimeSet);
35
35
  const error = null;
36
36
  if (file.contents) {
37
37
  const code = styleHandler(file.contents.toString(), {
@@ -48,7 +48,7 @@ function createPlugins(options = {}) {
48
48
  transformStream._transform = function (file, encoding, callback) {
49
49
  const error = null;
50
50
  if (file.contents) {
51
- const { code } = jsHandler(file.contents.toString(), set);
51
+ const { code } = jsHandler(file.contents.toString(), runtimeSet);
52
52
  file.contents = Buffer.from(code);
53
53
  }
54
54
  callback(error, file);
@@ -60,7 +60,9 @@ function createPlugins(options = {}) {
60
60
  transformStream._transform = function (file, encoding, callback) {
61
61
  const error = null;
62
62
  if (file.contents) {
63
- const code = templeteHandler(file.contents.toString());
63
+ const code = templeteHandler(file.contents.toString(), {
64
+ runtimeSet
65
+ });
64
66
  file.contents = Buffer.from(code);
65
67
  }
66
68
  callback(error, file);
package/dist/index.js CHANGED
@@ -5,7 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var webpack = require('./webpack.js');
6
6
  var vite = require('./vite.js');
7
7
  var gulp = require('./gulp.js');
8
- require('./options-887b74ca.js');
8
+ require('node:path');
9
+ require('node:fs');
10
+ require('./options-487394fa.js');
9
11
  require('micromatch');
10
12
  require('@babel/types');
11
13
  require('@babel/generator');
@@ -14,11 +16,9 @@ require('@babel/traverse');
14
16
  require('./replace.js');
15
17
  require('./shared-ae7dd073.js');
16
18
  require('postcss');
17
- require('./postcss-33ef0bd0.js');
19
+ require('./postcss-b53e9504.js');
18
20
  require('postcss-selector-parser');
19
21
  require('@csstools/postcss-is-pseudo-class');
20
- require('node:path');
21
- require('node:fs');
22
22
  require('semver');
23
23
  require('tailwindcss-patch');
24
24
  require('tailwindcss-mangle-shared');
package/dist/index.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  export { UnifiedWebpackPluginV5 } from './webpack.mjs';
2
2
  export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
3
3
  export { createPlugins } from './gulp.mjs';
4
- import './options-879de0a2.mjs';
4
+ import 'node:path';
5
+ import 'node:fs';
6
+ import './options-f7b71f03.mjs';
5
7
  import 'micromatch';
6
8
  import '@babel/types';
7
9
  import '@babel/generator';
@@ -10,11 +12,9 @@ import '@babel/traverse';
10
12
  import './replace.mjs';
11
13
  import './shared-7c88fb94.mjs';
12
14
  import 'postcss';
13
- import './postcss-ea625621.mjs';
15
+ import './postcss-760298ba.mjs';
14
16
  import 'postcss-selector-parser';
15
17
  import '@csstools/postcss-is-pseudo-class';
16
- import 'node:path';
17
- import 'node:fs';
18
18
  import 'semver';
19
19
  import 'tailwindcss-patch';
20
20
  import 'tailwindcss-mangle-shared';
@@ -8,7 +8,7 @@ var traverse = require('@babel/traverse');
8
8
  var replace = require('./replace.js');
9
9
  var shared = require('./shared-ae7dd073.js');
10
10
  var postcss = require('postcss');
11
- var postcss$1 = require('./postcss-33ef0bd0.js');
11
+ var postcss$1 = require('./postcss-b53e9504.js');
12
12
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
13
13
  var path = require('node:path');
14
14
  var fs = require('node:fs');
@@ -114,7 +114,7 @@ function groupBy(arr, cb) {
114
114
  return result;
115
115
  }
116
116
  function getGroupedEntries(entries, options) {
117
- const { cssMatcher, htmlMatcher, jsMatcher } = options;
117
+ const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
118
118
  const groupedEntries = groupBy(entries, ([file]) => {
119
119
  if (cssMatcher(file)) {
120
120
  return 'css';
@@ -122,7 +122,7 @@ function getGroupedEntries(entries, options) {
122
122
  else if (htmlMatcher(file)) {
123
123
  return 'html';
124
124
  }
125
- else if (jsMatcher(file)) {
125
+ else if (jsMatcher(file) || wxsMatcher(file)) {
126
126
  return 'js';
127
127
  }
128
128
  else {
@@ -210,9 +210,7 @@ function makeCustomAttributes(entries) {
210
210
  }
211
211
  }
212
212
  const variableRegExp = /{{(.*?)}}/gs;
213
- function variableMatch(original) {
214
- return variableRegExp.exec(original);
215
- }
213
+ const wxsTagRegexp = /<wxs\s*(?:[a-z][a-z-]*[a-z]*(?:\s*=\s*".*?")?)*\s*>(.*?)<\/wxs>/gs;
216
214
 
217
215
  const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
218
216
  function isValidSelector(selector = '') {
@@ -340,6 +338,9 @@ const defaultOptions = {
340
338
  }
341
339
  }
342
340
  },
341
+ wxsMatcher: (file) => {
342
+ return false;
343
+ },
343
344
  cssPreflight: {
344
345
  'box-sizing': 'border-box',
345
346
  'border-width': '0',
@@ -370,7 +371,9 @@ const defaultOptions = {
370
371
  arbitraryValues: {
371
372
  allowDoubleQuotes: false
372
373
  },
373
- cssChildCombinatorReplaceValue: 'view + view'
374
+ cssChildCombinatorReplaceValue: 'view + view',
375
+ inlineWxs: false,
376
+ injectAdditionalCssVarScope: false
374
377
  };
375
378
 
376
379
  function generateCode(match, options = {}) {
@@ -398,23 +401,24 @@ function generateCode(match, options = {}) {
398
401
  });
399
402
  return code;
400
403
  }
401
- function extractSource(original) {
402
- let match = variableMatch(original);
404
+ function extract(original, reg) {
405
+ let match = reg.exec(original);
403
406
  const sources = [];
404
407
  while (match !== null) {
405
408
  const start = match.index;
406
- const end = variableRegExp.lastIndex;
409
+ const end = reg.lastIndex;
407
410
  sources.push({
408
411
  start,
409
412
  end,
410
- raw: match[1],
411
- prevConcatenated: !/\s/.test(original[start - 1]),
412
- nextConcatenated: !/\s/.test(original[end])
413
+ raw: match[1]
413
414
  });
414
- match = variableMatch(original);
415
+ match = reg.exec(original);
415
416
  }
416
417
  return sources;
417
418
  }
419
+ function extractSource(original) {
420
+ return extract(original, variableRegExp);
421
+ }
418
422
  function templeteReplacer(original, options = {}) {
419
423
  const sources = extractSource(original);
420
424
  if (sources.length > 0) {
@@ -465,24 +469,27 @@ function templeteHandler(rawSource, options = {}) {
465
469
  });
466
470
  });
467
471
  }
468
- function customTempleteHandler(rawSource, options = {}) {
472
+ function customTempleteHandler(rawSource, options) {
473
+ const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
469
474
  let source = templeteHandler(rawSource, options);
470
- const regexps = makeCustomAttributes(options.customAttributesEntities);
471
- if (regexps) {
472
- if (Array.isArray(regexps)) {
473
- for (const regexp of regexps) {
474
- source = source.replace(regexp.tagRegexp, (m0) => {
475
- return m0.replace(regexp.attrRegexp, (m1, className) => {
476
- return m1.replace(className, templeteReplacer(className, options));
477
- });
475
+ const regexps = makeCustomAttributes(customAttributesEntities);
476
+ if (regexps && Array.isArray(regexps)) {
477
+ for (const regexp of regexps) {
478
+ source = source.replace(regexp.tagRegexp, (m0) => {
479
+ return m0.replace(regexp.attrRegexp, (m1, className) => {
480
+ return m1.replace(className, templeteReplacer(className, options));
478
481
  });
479
- }
482
+ });
480
483
  }
481
- return source;
482
484
  }
483
- else {
484
- return source;
485
+ if (inlineWxs) {
486
+ const wxsTags = extract(source, wxsTagRegexp);
487
+ for (const x of wxsTags) {
488
+ const code = jsHandler(x.raw, runtimeSet).code;
489
+ source = source.replaceAll(x.raw, code);
490
+ }
485
491
  }
492
+ return source;
486
493
  }
487
494
  function createTempleteHandler(options = {}) {
488
495
  return (rawSource, opt = {}) => {
@@ -721,11 +728,12 @@ function getOptions(options = {}) {
721
728
  normalizeMatcher(options, 'cssMatcher');
722
729
  normalizeMatcher(options, 'htmlMatcher');
723
730
  normalizeMatcher(options, 'jsMatcher');
731
+ normalizeMatcher(options, 'wxsMatcher');
724
732
  normalizeMatcher(options, 'mainCssChunkMatcher');
725
733
  const result = defu(options, defaultOptions, {
726
734
  minifiedJs: isProd()
727
735
  });
728
- const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue } = result;
736
+ const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope } = result;
729
737
  result.escapeMap = customReplaceDictionary;
730
738
  const cssInjectPreflight = createInjectPreflight(cssPreflight);
731
739
  const customAttributesEntities = isMap(options.customAttributes)
@@ -734,26 +742,32 @@ function getOptions(options = {}) {
734
742
  const { escapeMap, minifiedJs } = result;
735
743
  const { initMangle, mangleContext, setMangleRuntimeSet } = useMangleStore();
736
744
  initMangle(options.mangle);
737
- result.templeteHandler = createTempleteHandler({
738
- customAttributesEntities,
739
- escapeMap,
740
- mangleContext
741
- });
742
- result.styleHandler = createStyleHandler({
745
+ const styleHandler = createStyleHandler({
743
746
  cssInjectPreflight,
744
747
  customRuleCallback,
745
748
  cssPreflightRange,
746
749
  replaceUniversalSelectorWith,
747
750
  escapeMap,
748
751
  mangleContext,
749
- cssChildCombinatorReplaceValue
752
+ cssChildCombinatorReplaceValue,
753
+ injectAdditionalCssVarScope
750
754
  });
751
- result.jsHandler = createjsHandler({
755
+ result.styleHandler = styleHandler;
756
+ const jsHandler = createjsHandler({
752
757
  minifiedJs,
753
758
  escapeMap,
754
759
  mangleContext,
755
760
  arbitraryValues
756
761
  });
762
+ result.jsHandler = jsHandler;
763
+ const templeteHandler = createTempleteHandler({
764
+ customAttributesEntities,
765
+ escapeMap,
766
+ mangleContext,
767
+ inlineWxs,
768
+ jsHandler
769
+ });
770
+ result.templeteHandler = templeteHandler;
757
771
  result.patch = createPatch(supportCustomLengthUnitsPatch);
758
772
  result.setMangleRuntimeSet = setMangleRuntimeSet;
759
773
  return result;
@@ -6,7 +6,7 @@ import traverse from '@babel/traverse';
6
6
  import { replaceJs as replaceWxml } from './replace.mjs';
7
7
  import { S as SimpleMappingChars2String, M as MappingChars2String } from './shared-7c88fb94.mjs';
8
8
  import postcss from 'postcss';
9
- import { p as postcssWeappTailwindcss } from './postcss-ea625621.mjs';
9
+ import { p as postcssWeappTailwindcss } from './postcss-760298ba.mjs';
10
10
  import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
11
11
  import path from 'node:path';
12
12
  import fs from 'node:fs';
@@ -84,7 +84,7 @@ function groupBy(arr, cb) {
84
84
  return result;
85
85
  }
86
86
  function getGroupedEntries(entries, options) {
87
- const { cssMatcher, htmlMatcher, jsMatcher } = options;
87
+ const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
88
88
  const groupedEntries = groupBy(entries, ([file]) => {
89
89
  if (cssMatcher(file)) {
90
90
  return 'css';
@@ -92,7 +92,7 @@ function getGroupedEntries(entries, options) {
92
92
  else if (htmlMatcher(file)) {
93
93
  return 'html';
94
94
  }
95
- else if (jsMatcher(file)) {
95
+ else if (jsMatcher(file) || wxsMatcher(file)) {
96
96
  return 'js';
97
97
  }
98
98
  else {
@@ -180,9 +180,7 @@ function makeCustomAttributes(entries) {
180
180
  }
181
181
  }
182
182
  const variableRegExp = /{{(.*?)}}/gs;
183
- function variableMatch(original) {
184
- return variableRegExp.exec(original);
185
- }
183
+ const wxsTagRegexp = /<wxs\s*(?:[a-z][a-z-]*[a-z]*(?:\s*=\s*".*?")?)*\s*>(.*?)<\/wxs>/gs;
186
184
 
187
185
  const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
188
186
  function isValidSelector(selector = '') {
@@ -310,6 +308,9 @@ const defaultOptions = {
310
308
  }
311
309
  }
312
310
  },
311
+ wxsMatcher: (file) => {
312
+ return false;
313
+ },
313
314
  cssPreflight: {
314
315
  'box-sizing': 'border-box',
315
316
  'border-width': '0',
@@ -340,7 +341,9 @@ const defaultOptions = {
340
341
  arbitraryValues: {
341
342
  allowDoubleQuotes: false
342
343
  },
343
- cssChildCombinatorReplaceValue: 'view + view'
344
+ cssChildCombinatorReplaceValue: 'view + view',
345
+ inlineWxs: false,
346
+ injectAdditionalCssVarScope: false
344
347
  };
345
348
 
346
349
  function generateCode(match, options = {}) {
@@ -368,23 +371,24 @@ function generateCode(match, options = {}) {
368
371
  });
369
372
  return code;
370
373
  }
371
- function extractSource(original) {
372
- let match = variableMatch(original);
374
+ function extract(original, reg) {
375
+ let match = reg.exec(original);
373
376
  const sources = [];
374
377
  while (match !== null) {
375
378
  const start = match.index;
376
- const end = variableRegExp.lastIndex;
379
+ const end = reg.lastIndex;
377
380
  sources.push({
378
381
  start,
379
382
  end,
380
- raw: match[1],
381
- prevConcatenated: !/\s/.test(original[start - 1]),
382
- nextConcatenated: !/\s/.test(original[end])
383
+ raw: match[1]
383
384
  });
384
- match = variableMatch(original);
385
+ match = reg.exec(original);
385
386
  }
386
387
  return sources;
387
388
  }
389
+ function extractSource(original) {
390
+ return extract(original, variableRegExp);
391
+ }
388
392
  function templeteReplacer(original, options = {}) {
389
393
  const sources = extractSource(original);
390
394
  if (sources.length > 0) {
@@ -435,24 +439,27 @@ function templeteHandler(rawSource, options = {}) {
435
439
  });
436
440
  });
437
441
  }
438
- function customTempleteHandler(rawSource, options = {}) {
442
+ function customTempleteHandler(rawSource, options) {
443
+ const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
439
444
  let source = templeteHandler(rawSource, options);
440
- const regexps = makeCustomAttributes(options.customAttributesEntities);
441
- if (regexps) {
442
- if (Array.isArray(regexps)) {
443
- for (const regexp of regexps) {
444
- source = source.replace(regexp.tagRegexp, (m0) => {
445
- return m0.replace(regexp.attrRegexp, (m1, className) => {
446
- return m1.replace(className, templeteReplacer(className, options));
447
- });
445
+ const regexps = makeCustomAttributes(customAttributesEntities);
446
+ if (regexps && Array.isArray(regexps)) {
447
+ for (const regexp of regexps) {
448
+ source = source.replace(regexp.tagRegexp, (m0) => {
449
+ return m0.replace(regexp.attrRegexp, (m1, className) => {
450
+ return m1.replace(className, templeteReplacer(className, options));
448
451
  });
449
- }
452
+ });
450
453
  }
451
- return source;
452
454
  }
453
- else {
454
- return source;
455
+ if (inlineWxs) {
456
+ const wxsTags = extract(source, wxsTagRegexp);
457
+ for (const x of wxsTags) {
458
+ const code = jsHandler(x.raw, runtimeSet).code;
459
+ source = source.replaceAll(x.raw, code);
460
+ }
455
461
  }
462
+ return source;
456
463
  }
457
464
  function createTempleteHandler(options = {}) {
458
465
  return (rawSource, opt = {}) => {
@@ -691,11 +698,12 @@ function getOptions(options = {}) {
691
698
  normalizeMatcher(options, 'cssMatcher');
692
699
  normalizeMatcher(options, 'htmlMatcher');
693
700
  normalizeMatcher(options, 'jsMatcher');
701
+ normalizeMatcher(options, 'wxsMatcher');
694
702
  normalizeMatcher(options, 'mainCssChunkMatcher');
695
703
  const result = defu(options, defaultOptions, {
696
704
  minifiedJs: isProd()
697
705
  });
698
- const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue } = result;
706
+ const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope } = result;
699
707
  result.escapeMap = customReplaceDictionary;
700
708
  const cssInjectPreflight = createInjectPreflight(cssPreflight);
701
709
  const customAttributesEntities = isMap(options.customAttributes)
@@ -704,26 +712,32 @@ function getOptions(options = {}) {
704
712
  const { escapeMap, minifiedJs } = result;
705
713
  const { initMangle, mangleContext, setMangleRuntimeSet } = useMangleStore();
706
714
  initMangle(options.mangle);
707
- result.templeteHandler = createTempleteHandler({
708
- customAttributesEntities,
709
- escapeMap,
710
- mangleContext
711
- });
712
- result.styleHandler = createStyleHandler({
715
+ const styleHandler = createStyleHandler({
713
716
  cssInjectPreflight,
714
717
  customRuleCallback,
715
718
  cssPreflightRange,
716
719
  replaceUniversalSelectorWith,
717
720
  escapeMap,
718
721
  mangleContext,
719
- cssChildCombinatorReplaceValue
722
+ cssChildCombinatorReplaceValue,
723
+ injectAdditionalCssVarScope
720
724
  });
721
- result.jsHandler = createjsHandler({
725
+ result.styleHandler = styleHandler;
726
+ const jsHandler = createjsHandler({
722
727
  minifiedJs,
723
728
  escapeMap,
724
729
  mangleContext,
725
730
  arbitraryValues
726
731
  });
732
+ result.jsHandler = jsHandler;
733
+ const templeteHandler = createTempleteHandler({
734
+ customAttributesEntities,
735
+ escapeMap,
736
+ mangleContext,
737
+ inlineWxs,
738
+ jsHandler
739
+ });
740
+ result.templeteHandler = templeteHandler;
727
741
  result.patch = createPatch(supportCustomLengthUnitsPatch);
728
742
  result.setMangleRuntimeSet = setMangleRuntimeSet;
729
743
  return result;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ prop: string;
3
+ value: string;
4
+ }[];
5
+ export default _default;
@@ -1,4 +1,8 @@
1
1
  import { Rule } from 'postcss';
2
2
  import type { IStyleHandlerOptions } from "../types";
3
3
  export declare function testIfVariablesScope(node: Rule, count?: number): boolean;
4
+ export declare function testIfTwBackdrop(node: Rule, count?: number): boolean;
5
+ export declare function makePseudoVarRule(): Rule;
6
+ export declare function remakeCssVarSelector(selectors: string[], cssPreflightRange: IStyleHandlerOptions['cssPreflightRange']): string[];
7
+ export declare function remakeCombinatorSelector(selector: string, cssChildCombinatorReplaceValue: IStyleHandlerOptions['cssChildCombinatorReplaceValue']): string;
4
8
  export declare function commonChunkPreflight(node: Rule, options: IStyleHandlerOptions): void;