weapp-tailwindcss 2.6.1 → 2.6.2
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/dist/cli.js +3 -3
- package/dist/cli.mjs +3 -3
- package/dist/{defaults-c7f00aae.mjs → defaults-c397b5f9.mjs} +2 -1
- package/dist/{defaults-0d9846f4.js → defaults-d79e9245.js} +2 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/dist/{options-800ea85a.mjs → options-244dcceb.mjs} +25 -19
- package/dist/{options-6a265426.js → options-c5e1d1b4.js} +25 -19
- package/dist/postcss/shared.d.ts +0 -1
- package/dist/{postcss-cf8b998a.js → postcss-4c88cd6d.js} +34 -34
- package/dist/{postcss-53e2ad95.mjs → postcss-99efb521.mjs} +34 -34
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/reg.d.ts +1 -11
- package/dist/types.d.ts +4 -2
- package/dist/vite.js +5 -5
- package/dist/vite.mjs +5 -5
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +5 -5
- package/dist/wxml/index.d.ts +1 -1
- package/dist/wxml/shared.d.ts +2 -2
- package/dist/wxml/utils.d.ts +6 -6
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-c5e1d1b4.js');
|
|
4
4
|
require('micromatch');
|
|
5
5
|
require('@babel/types');
|
|
6
6
|
require('@babel/generator');
|
|
@@ -9,9 +9,9 @@ require('@babel/traverse');
|
|
|
9
9
|
require('./replace.js');
|
|
10
10
|
require('./dic-05980807.js');
|
|
11
11
|
require('./shared-4eed0e5c.js');
|
|
12
|
-
require('./defaults-
|
|
12
|
+
require('./defaults-d79e9245.js');
|
|
13
13
|
require('postcss');
|
|
14
|
-
require('./postcss-
|
|
14
|
+
require('./postcss-4c88cd6d.js');
|
|
15
15
|
require('postcss-selector-parser');
|
|
16
16
|
require('@csstools/postcss-is-pseudo-class');
|
|
17
17
|
require('node:path');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-244dcceb.mjs';
|
|
2
2
|
import 'micromatch';
|
|
3
3
|
import '@babel/types';
|
|
4
4
|
import '@babel/generator';
|
|
@@ -7,9 +7,9 @@ import '@babel/traverse';
|
|
|
7
7
|
import './replace.mjs';
|
|
8
8
|
import './dic-3790a3a4.mjs';
|
|
9
9
|
import './shared-686bfc32.mjs';
|
|
10
|
-
import './defaults-
|
|
10
|
+
import './defaults-c397b5f9.mjs';
|
|
11
11
|
import 'postcss';
|
|
12
|
-
import './postcss-
|
|
12
|
+
import './postcss-99efb521.mjs';
|
|
13
13
|
import 'postcss-selector-parser';
|
|
14
14
|
import '@csstools/postcss-is-pseudo-class';
|
|
15
15
|
import 'node:path';
|
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { d as defaultOptions } from './defaults-
|
|
1
|
+
export { d as defaultOptions } from './defaults-c397b5f9.mjs';
|
|
2
2
|
import './dic-3790a3a4.mjs';
|
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-
|
|
6
|
+
var options = require('./options-c5e1d1b4.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('@babel/types');
|
|
9
9
|
require('@babel/generator');
|
|
@@ -12,9 +12,9 @@ require('@babel/traverse');
|
|
|
12
12
|
require('./replace.js');
|
|
13
13
|
require('./dic-05980807.js');
|
|
14
14
|
require('./shared-4eed0e5c.js');
|
|
15
|
-
require('./defaults-
|
|
15
|
+
require('./defaults-d79e9245.js');
|
|
16
16
|
require('postcss');
|
|
17
|
-
require('./postcss-
|
|
17
|
+
require('./postcss-4c88cd6d.js');
|
|
18
18
|
require('postcss-selector-parser');
|
|
19
19
|
require('@csstools/postcss-is-pseudo-class');
|
|
20
20
|
require('node:path');
|
|
@@ -33,7 +33,7 @@ function createPlugins(options$1 = {}) {
|
|
|
33
33
|
options$1.customReplaceDictionary = 'simple';
|
|
34
34
|
}
|
|
35
35
|
const opts = options.getOptions(options$1);
|
|
36
|
-
const {
|
|
36
|
+
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
|
|
37
37
|
let runtimeSet = new Set();
|
|
38
38
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
39
39
|
const twPatcher = options.createTailwindcssPatcher();
|
|
@@ -70,7 +70,7 @@ function createPlugins(options$1 = {}) {
|
|
|
70
70
|
transformStream._transform = function (file, encoding, callback) {
|
|
71
71
|
const error = null;
|
|
72
72
|
if (file.contents) {
|
|
73
|
-
const code =
|
|
73
|
+
const code = templateHandler(file.contents.toString(), {
|
|
74
74
|
runtimeSet
|
|
75
75
|
});
|
|
76
76
|
file.contents = Buffer.from(code);
|
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-
|
|
2
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-244dcceb.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import '@babel/types';
|
|
5
5
|
import '@babel/generator';
|
|
@@ -8,9 +8,9 @@ import '@babel/traverse';
|
|
|
8
8
|
import './replace.mjs';
|
|
9
9
|
import './dic-3790a3a4.mjs';
|
|
10
10
|
import './shared-686bfc32.mjs';
|
|
11
|
-
import './defaults-
|
|
11
|
+
import './defaults-c397b5f9.mjs';
|
|
12
12
|
import 'postcss';
|
|
13
|
-
import './postcss-
|
|
13
|
+
import './postcss-99efb521.mjs';
|
|
14
14
|
import 'postcss-selector-parser';
|
|
15
15
|
import '@csstools/postcss-is-pseudo-class';
|
|
16
16
|
import 'node:path';
|
|
@@ -25,7 +25,7 @@ function createPlugins(options = {}) {
|
|
|
25
25
|
options.customReplaceDictionary = 'simple';
|
|
26
26
|
}
|
|
27
27
|
const opts = getOptions(options);
|
|
28
|
-
const {
|
|
28
|
+
const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet } = opts;
|
|
29
29
|
let runtimeSet = new Set();
|
|
30
30
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
31
31
|
const twPatcher = createTailwindcssPatcher();
|
|
@@ -62,7 +62,7 @@ function createPlugins(options = {}) {
|
|
|
62
62
|
transformStream._transform = function (file, encoding, callback) {
|
|
63
63
|
const error = null;
|
|
64
64
|
if (file.contents) {
|
|
65
|
-
const code =
|
|
65
|
+
const code = templateHandler(file.contents.toString(), {
|
|
66
66
|
runtimeSet
|
|
67
67
|
});
|
|
68
68
|
file.contents = Buffer.from(code);
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var vite = require('./vite.js');
|
|
|
7
7
|
var gulp = require('./gulp.js');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:fs');
|
|
10
|
-
require('./options-
|
|
10
|
+
require('./options-c5e1d1b4.js');
|
|
11
11
|
require('micromatch');
|
|
12
12
|
require('@babel/types');
|
|
13
13
|
require('@babel/generator');
|
|
@@ -16,9 +16,9 @@ require('@babel/traverse');
|
|
|
16
16
|
require('./replace.js');
|
|
17
17
|
require('./dic-05980807.js');
|
|
18
18
|
require('./shared-4eed0e5c.js');
|
|
19
|
-
require('./defaults-
|
|
19
|
+
require('./defaults-d79e9245.js');
|
|
20
20
|
require('postcss');
|
|
21
|
-
require('./postcss-
|
|
21
|
+
require('./postcss-4c88cd6d.js');
|
|
22
22
|
require('postcss-selector-parser');
|
|
23
23
|
require('@csstools/postcss-is-pseudo-class');
|
|
24
24
|
require('semver');
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
|
3
3
|
export { createPlugins } from './gulp.mjs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:fs';
|
|
6
|
-
import './options-
|
|
6
|
+
import './options-244dcceb.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
8
|
import '@babel/types';
|
|
9
9
|
import '@babel/generator';
|
|
@@ -12,9 +12,9 @@ import '@babel/traverse';
|
|
|
12
12
|
import './replace.mjs';
|
|
13
13
|
import './dic-3790a3a4.mjs';
|
|
14
14
|
import './shared-686bfc32.mjs';
|
|
15
|
-
import './defaults-
|
|
15
|
+
import './defaults-c397b5f9.mjs';
|
|
16
16
|
import 'postcss';
|
|
17
|
-
import './postcss-
|
|
17
|
+
import './postcss-99efb521.mjs';
|
|
18
18
|
import 'postcss-selector-parser';
|
|
19
19
|
import '@csstools/postcss-is-pseudo-class';
|
|
20
20
|
import 'semver';
|
|
@@ -4,9 +4,9 @@ import generate from '@babel/generator';
|
|
|
4
4
|
import { parse, parseExpression } from '@babel/parser';
|
|
5
5
|
import traverse from '@babel/traverse';
|
|
6
6
|
import { replaceJs as replaceWxml } from './replace.mjs';
|
|
7
|
-
import { i as isRegexp, n as noop, d as defaultOptions, a as isMap } from './defaults-
|
|
7
|
+
import { i as isRegexp, n as noop, d as defaultOptions, a as isMap } from './defaults-c397b5f9.mjs';
|
|
8
8
|
import postcss from 'postcss';
|
|
9
|
-
import { p as postcssWeappTailwindcss } from './postcss-
|
|
9
|
+
import { p as postcssWeappTailwindcss } from './postcss-99efb521.mjs';
|
|
10
10
|
import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
|
|
11
11
|
import { S as SimpleMappingChars2String, M as MappingChars2String } from './dic-3790a3a4.mjs';
|
|
12
12
|
import path from 'node:path';
|
|
@@ -64,7 +64,7 @@ function escapeStringRegexp(str) {
|
|
|
64
64
|
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&').replaceAll('-', '\\x2d');
|
|
65
65
|
}
|
|
66
66
|
const templateClassExactRegexp = /(?<=^|\s)(?:hover-)?class=(?:["']\W+\s*\w+\()?["']([^"]+)["']/gs;
|
|
67
|
-
const tagWithEitherClassAndHoverClassRegexp = /<[a-z][a-z-]*[a-z]*\s+[^>]*?(?:hover-)?
|
|
67
|
+
const tagWithEitherClassAndHoverClassRegexp = /<[a-z][a-z-]*[a-z]*\s+[^>]*?(?:hover-)?class="[^"]*"[^>]*?\/?>/g;
|
|
68
68
|
function handleRegexp(reg) {
|
|
69
69
|
return `(?:${reg.source})`;
|
|
70
70
|
}
|
|
@@ -104,7 +104,7 @@ function makePattern(arr) {
|
|
|
104
104
|
}
|
|
105
105
|
return pattern;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function createTemplateHandlerMatchRegexp(tag, attrs, options = {}) {
|
|
108
108
|
const { exact = true } = options;
|
|
109
109
|
const prefix = exact ? '(?<=^|\\s)' : '';
|
|
110
110
|
const pattern = makePattern(attrs);
|
|
@@ -126,7 +126,7 @@ function makeCustomAttributes(entries) {
|
|
|
126
126
|
if (Array.isArray(entries)) {
|
|
127
127
|
return entries.map(([k, v]) => {
|
|
128
128
|
return {
|
|
129
|
-
tagRegexp:
|
|
129
|
+
tagRegexp: createTemplateHandlerMatchRegexp(k, v),
|
|
130
130
|
attrRegexp: createTemplateClassRegexp(v),
|
|
131
131
|
tag: getSourceString(k),
|
|
132
132
|
attrs: v
|
|
@@ -268,7 +268,7 @@ function extract(original, reg) {
|
|
|
268
268
|
function extractSource(original) {
|
|
269
269
|
return extract(original, variableRegExp);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function templateReplacer(original, options = {}) {
|
|
272
272
|
const sources = extractSource(original);
|
|
273
273
|
if (sources.length > 0) {
|
|
274
274
|
const resultArray = [];
|
|
@@ -311,22 +311,25 @@ function templeteReplacer(original, options = {}) {
|
|
|
311
311
|
});
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function templateHandler(rawSource, options = {}) {
|
|
315
|
+
if (options.disabledDefaultTemplateHandler) {
|
|
316
|
+
return rawSource;
|
|
317
|
+
}
|
|
315
318
|
return rawSource.replace(tagWithEitherClassAndHoverClassRegexp, (m0) => {
|
|
316
319
|
return m0.replace(templateClassExactRegexp, (m1, className) => {
|
|
317
|
-
return m1.replace(className,
|
|
320
|
+
return m1.replace(className, templateReplacer(className, options));
|
|
318
321
|
});
|
|
319
322
|
});
|
|
320
323
|
}
|
|
321
|
-
function
|
|
324
|
+
function customTemplateHandler(rawSource, options) {
|
|
322
325
|
const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
|
|
323
|
-
let source =
|
|
326
|
+
let source = templateHandler(rawSource, options);
|
|
324
327
|
const regexps = makeCustomAttributes(customAttributesEntities);
|
|
325
328
|
if (regexps && Array.isArray(regexps)) {
|
|
326
329
|
for (const regexp of regexps) {
|
|
327
330
|
source = source.replace(regexp.tagRegexp, (m0) => {
|
|
328
331
|
return m0.replace(regexp.attrRegexp, (m1, className) => {
|
|
329
|
-
return m1.replace(className,
|
|
332
|
+
return m1.replace(className, templateReplacer(className, options));
|
|
330
333
|
});
|
|
331
334
|
});
|
|
332
335
|
}
|
|
@@ -340,9 +343,9 @@ function customTempleteHandler(rawSource, options) {
|
|
|
340
343
|
}
|
|
341
344
|
return source;
|
|
342
345
|
}
|
|
343
|
-
function
|
|
346
|
+
function createTemplateHandler(options = {}) {
|
|
344
347
|
return (rawSource, opt = {}) => {
|
|
345
|
-
return
|
|
348
|
+
return customTemplateHandler(rawSource, defu(opt, options));
|
|
346
349
|
};
|
|
347
350
|
}
|
|
348
351
|
|
|
@@ -472,11 +475,13 @@ function internalPatch(pkgJsonPath, options, overwrite = true) {
|
|
|
472
475
|
if (pkgJsonPath) {
|
|
473
476
|
const pkgJson = require(pkgJsonPath);
|
|
474
477
|
const dangerousOptions = options.dangerousOptions;
|
|
475
|
-
|
|
478
|
+
const version = pkgJson.version;
|
|
479
|
+
if (gte(version, dangerousOptions.gteVersion)) {
|
|
476
480
|
const rootDir = path.dirname(pkgJsonPath);
|
|
477
481
|
const dataTypes = monkeyPatchForSupportingCustomUnit(rootDir, options);
|
|
478
482
|
const result = monkeyPatchForExposingContext(rootDir, {
|
|
479
|
-
overwrite
|
|
483
|
+
overwrite,
|
|
484
|
+
version
|
|
480
485
|
});
|
|
481
486
|
return Object.assign(Object.assign({}, result), { dataTypes });
|
|
482
487
|
}
|
|
@@ -582,7 +587,7 @@ function getOptions(options = {}) {
|
|
|
582
587
|
const result = defu(options, defaultOptions, {
|
|
583
588
|
minifiedJs: isProd()
|
|
584
589
|
});
|
|
585
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass } = result;
|
|
590
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler } = result;
|
|
586
591
|
result.escapeMap = customReplaceDictionary;
|
|
587
592
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
588
593
|
const customAttributesEntities = isMap(options.customAttributes)
|
|
@@ -610,14 +615,15 @@ function getOptions(options = {}) {
|
|
|
610
615
|
jsPreserveClass
|
|
611
616
|
});
|
|
612
617
|
result.jsHandler = jsHandler;
|
|
613
|
-
const
|
|
618
|
+
const templateHandler = createTemplateHandler({
|
|
614
619
|
customAttributesEntities,
|
|
615
620
|
escapeMap,
|
|
616
621
|
mangleContext,
|
|
617
622
|
inlineWxs,
|
|
618
|
-
jsHandler
|
|
623
|
+
jsHandler,
|
|
624
|
+
disabledDefaultTemplateHandler
|
|
619
625
|
});
|
|
620
|
-
result.
|
|
626
|
+
result.templateHandler = templateHandler;
|
|
621
627
|
result.patch = createPatch(supportCustomLengthUnitsPatch);
|
|
622
628
|
result.setMangleRuntimeSet = setMangleRuntimeSet;
|
|
623
629
|
return result;
|
|
@@ -6,9 +6,9 @@ var generate = require('@babel/generator');
|
|
|
6
6
|
var parser = require('@babel/parser');
|
|
7
7
|
var traverse = require('@babel/traverse');
|
|
8
8
|
var replace = require('./replace.js');
|
|
9
|
-
var defaults = require('./defaults-
|
|
9
|
+
var defaults = require('./defaults-d79e9245.js');
|
|
10
10
|
var postcss = require('postcss');
|
|
11
|
-
var postcss$1 = require('./postcss-
|
|
11
|
+
var postcss$1 = require('./postcss-4c88cd6d.js');
|
|
12
12
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
13
13
|
var dic = require('./dic-05980807.js');
|
|
14
14
|
var path = require('node:path');
|
|
@@ -94,7 +94,7 @@ function escapeStringRegexp(str) {
|
|
|
94
94
|
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&').replaceAll('-', '\\x2d');
|
|
95
95
|
}
|
|
96
96
|
const templateClassExactRegexp = /(?<=^|\s)(?:hover-)?class=(?:["']\W+\s*\w+\()?["']([^"]+)["']/gs;
|
|
97
|
-
const tagWithEitherClassAndHoverClassRegexp = /<[a-z][a-z-]*[a-z]*\s+[^>]*?(?:hover-)?
|
|
97
|
+
const tagWithEitherClassAndHoverClassRegexp = /<[a-z][a-z-]*[a-z]*\s+[^>]*?(?:hover-)?class="[^"]*"[^>]*?\/?>/g;
|
|
98
98
|
function handleRegexp(reg) {
|
|
99
99
|
return `(?:${reg.source})`;
|
|
100
100
|
}
|
|
@@ -134,7 +134,7 @@ function makePattern(arr) {
|
|
|
134
134
|
}
|
|
135
135
|
return pattern;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function createTemplateHandlerMatchRegexp(tag, attrs, options = {}) {
|
|
138
138
|
const { exact = true } = options;
|
|
139
139
|
const prefix = exact ? '(?<=^|\\s)' : '';
|
|
140
140
|
const pattern = makePattern(attrs);
|
|
@@ -156,7 +156,7 @@ function makeCustomAttributes(entries) {
|
|
|
156
156
|
if (Array.isArray(entries)) {
|
|
157
157
|
return entries.map(([k, v]) => {
|
|
158
158
|
return {
|
|
159
|
-
tagRegexp:
|
|
159
|
+
tagRegexp: createTemplateHandlerMatchRegexp(k, v),
|
|
160
160
|
attrRegexp: createTemplateClassRegexp(v),
|
|
161
161
|
tag: getSourceString(k),
|
|
162
162
|
attrs: v
|
|
@@ -298,7 +298,7 @@ function extract(original, reg) {
|
|
|
298
298
|
function extractSource(original) {
|
|
299
299
|
return extract(original, variableRegExp);
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function templateReplacer(original, options = {}) {
|
|
302
302
|
const sources = extractSource(original);
|
|
303
303
|
if (sources.length > 0) {
|
|
304
304
|
const resultArray = [];
|
|
@@ -341,22 +341,25 @@ function templeteReplacer(original, options = {}) {
|
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function templateHandler(rawSource, options = {}) {
|
|
345
|
+
if (options.disabledDefaultTemplateHandler) {
|
|
346
|
+
return rawSource;
|
|
347
|
+
}
|
|
345
348
|
return rawSource.replace(tagWithEitherClassAndHoverClassRegexp, (m0) => {
|
|
346
349
|
return m0.replace(templateClassExactRegexp, (m1, className) => {
|
|
347
|
-
return m1.replace(className,
|
|
350
|
+
return m1.replace(className, templateReplacer(className, options));
|
|
348
351
|
});
|
|
349
352
|
});
|
|
350
353
|
}
|
|
351
|
-
function
|
|
354
|
+
function customTemplateHandler(rawSource, options) {
|
|
352
355
|
const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
|
|
353
|
-
let source =
|
|
356
|
+
let source = templateHandler(rawSource, options);
|
|
354
357
|
const regexps = makeCustomAttributes(customAttributesEntities);
|
|
355
358
|
if (regexps && Array.isArray(regexps)) {
|
|
356
359
|
for (const regexp of regexps) {
|
|
357
360
|
source = source.replace(regexp.tagRegexp, (m0) => {
|
|
358
361
|
return m0.replace(regexp.attrRegexp, (m1, className) => {
|
|
359
|
-
return m1.replace(className,
|
|
362
|
+
return m1.replace(className, templateReplacer(className, options));
|
|
360
363
|
});
|
|
361
364
|
});
|
|
362
365
|
}
|
|
@@ -370,9 +373,9 @@ function customTempleteHandler(rawSource, options) {
|
|
|
370
373
|
}
|
|
371
374
|
return source;
|
|
372
375
|
}
|
|
373
|
-
function
|
|
376
|
+
function createTemplateHandler(options = {}) {
|
|
374
377
|
return (rawSource, opt = {}) => {
|
|
375
|
-
return
|
|
378
|
+
return customTemplateHandler(rawSource, defu(opt, options));
|
|
376
379
|
};
|
|
377
380
|
}
|
|
378
381
|
|
|
@@ -502,11 +505,13 @@ function internalPatch(pkgJsonPath, options, overwrite = true) {
|
|
|
502
505
|
if (pkgJsonPath) {
|
|
503
506
|
const pkgJson = require(pkgJsonPath);
|
|
504
507
|
const dangerousOptions = options.dangerousOptions;
|
|
505
|
-
|
|
508
|
+
const version = pkgJson.version;
|
|
509
|
+
if (semver.gte(version, dangerousOptions.gteVersion)) {
|
|
506
510
|
const rootDir = path__default["default"].dirname(pkgJsonPath);
|
|
507
511
|
const dataTypes = monkeyPatchForSupportingCustomUnit(rootDir, options);
|
|
508
512
|
const result = tailwindcssPatch.monkeyPatchForExposingContext(rootDir, {
|
|
509
|
-
overwrite
|
|
513
|
+
overwrite,
|
|
514
|
+
version
|
|
510
515
|
});
|
|
511
516
|
return Object.assign(Object.assign({}, result), { dataTypes });
|
|
512
517
|
}
|
|
@@ -612,7 +617,7 @@ function getOptions(options = {}) {
|
|
|
612
617
|
const result = defu(options, defaults.defaultOptions, {
|
|
613
618
|
minifiedJs: isProd()
|
|
614
619
|
});
|
|
615
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass } = result;
|
|
620
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler } = result;
|
|
616
621
|
result.escapeMap = customReplaceDictionary;
|
|
617
622
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
618
623
|
const customAttributesEntities = defaults.isMap(options.customAttributes)
|
|
@@ -640,14 +645,15 @@ function getOptions(options = {}) {
|
|
|
640
645
|
jsPreserveClass
|
|
641
646
|
});
|
|
642
647
|
result.jsHandler = jsHandler;
|
|
643
|
-
const
|
|
648
|
+
const templateHandler = createTemplateHandler({
|
|
644
649
|
customAttributesEntities,
|
|
645
650
|
escapeMap,
|
|
646
651
|
mangleContext,
|
|
647
652
|
inlineWxs,
|
|
648
|
-
jsHandler
|
|
653
|
+
jsHandler,
|
|
654
|
+
disabledDefaultTemplateHandler
|
|
649
655
|
});
|
|
650
|
-
result.
|
|
656
|
+
result.templateHandler = templateHandler;
|
|
651
657
|
result.patch = createPatch(supportCustomLengthUnitsPatch);
|
|
652
658
|
result.setMangleRuntimeSet = setMangleRuntimeSet;
|
|
653
659
|
return result;
|
package/dist/postcss/shared.d.ts
CHANGED
|
@@ -84,15 +84,15 @@ var cssVars = [
|
|
|
84
84
|
},
|
|
85
85
|
{
|
|
86
86
|
prop: '--tw-pan-x',
|
|
87
|
-
value: '
|
|
87
|
+
value: ' '
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
prop: '--tw-pan-y',
|
|
91
|
-
value: '
|
|
91
|
+
value: ' '
|
|
92
92
|
},
|
|
93
93
|
{
|
|
94
94
|
prop: '--tw-pinch-zoom',
|
|
95
|
-
value: '
|
|
95
|
+
value: ' '
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
prop: '--tw-scroll-snap-strictness',
|
|
@@ -100,43 +100,43 @@ var cssVars = [
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
prop: '--tw-gradient-from-position',
|
|
103
|
-
value: '
|
|
103
|
+
value: ' '
|
|
104
104
|
},
|
|
105
105
|
{
|
|
106
106
|
prop: '--tw-gradient-via-position',
|
|
107
|
-
value: '
|
|
107
|
+
value: ' '
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
prop: '--tw-gradient-to-position',
|
|
111
|
-
value: '
|
|
111
|
+
value: ' '
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
prop: '--tw-ordinal',
|
|
115
|
-
value: '
|
|
115
|
+
value: ' '
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
prop: '--tw-slashed-zero',
|
|
119
|
-
value: '
|
|
119
|
+
value: ' '
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
122
|
prop: '--tw-numeric-figure',
|
|
123
|
-
value: '
|
|
123
|
+
value: ' '
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
prop: '--tw-numeric-spacing',
|
|
127
|
-
value: '
|
|
127
|
+
value: ' '
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
prop: '--tw-numeric-fraction',
|
|
131
|
-
value: '
|
|
131
|
+
value: ' '
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
prop: '--tw-ring-inset',
|
|
135
|
-
value: '
|
|
135
|
+
value: ' '
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
prop: '--tw-ring-offset-width',
|
|
139
|
-
value: '
|
|
139
|
+
value: '0px'
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
prop: '--tw-ring-offset-color',
|
|
@@ -144,7 +144,7 @@ var cssVars = [
|
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
146
|
prop: '--tw-ring-color',
|
|
147
|
-
value: '
|
|
147
|
+
value: 'rgb(59 130 246 / 0.5)'
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
prop: '--tw-ring-offset-shadow',
|
|
@@ -164,75 +164,75 @@ var cssVars = [
|
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
166
|
prop: '--tw-blur',
|
|
167
|
-
value: '
|
|
167
|
+
value: ' '
|
|
168
168
|
},
|
|
169
169
|
{
|
|
170
170
|
prop: '--tw-brightness',
|
|
171
|
-
value: '
|
|
171
|
+
value: ' '
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
174
|
prop: '--tw-contrast',
|
|
175
|
-
value: '
|
|
175
|
+
value: ' '
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
prop: '--tw-grayscale',
|
|
179
|
-
value: '
|
|
179
|
+
value: ' '
|
|
180
180
|
},
|
|
181
181
|
{
|
|
182
182
|
prop: '--tw-hue-rotate',
|
|
183
|
-
value: '
|
|
183
|
+
value: ' '
|
|
184
184
|
},
|
|
185
185
|
{
|
|
186
186
|
prop: '--tw-invert',
|
|
187
|
-
value: '
|
|
187
|
+
value: ' '
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
prop: '--tw-saturate',
|
|
191
|
-
value: '
|
|
191
|
+
value: ' '
|
|
192
192
|
},
|
|
193
193
|
{
|
|
194
194
|
prop: '--tw-sepia',
|
|
195
|
-
value: '
|
|
195
|
+
value: ' '
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
198
|
prop: '--tw-drop-shadow',
|
|
199
|
-
value: '
|
|
199
|
+
value: ' '
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
prop: '--tw-backdrop-blur',
|
|
203
|
-
value: '
|
|
203
|
+
value: ' '
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
206
|
prop: '--tw-backdrop-brightness',
|
|
207
|
-
value: '
|
|
207
|
+
value: ' '
|
|
208
208
|
},
|
|
209
209
|
{
|
|
210
210
|
prop: '--tw-backdrop-contrast',
|
|
211
|
-
value: '
|
|
211
|
+
value: ' '
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
prop: '--tw-backdrop-grayscale',
|
|
215
|
-
value: '
|
|
215
|
+
value: ' '
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
prop: '--tw-backdrop-hue-rotate',
|
|
219
|
-
value: '
|
|
219
|
+
value: ' '
|
|
220
220
|
},
|
|
221
221
|
{
|
|
222
222
|
prop: '--tw-backdrop-invert',
|
|
223
|
-
value: '
|
|
223
|
+
value: ' '
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
prop: '--tw-backdrop-opacity',
|
|
227
|
-
value: '
|
|
227
|
+
value: ' '
|
|
228
228
|
},
|
|
229
229
|
{
|
|
230
230
|
prop: '--tw-backdrop-saturate',
|
|
231
|
-
value: '
|
|
231
|
+
value: ' '
|
|
232
232
|
},
|
|
233
233
|
{
|
|
234
234
|
prop: '--tw-backdrop-sepia',
|
|
235
|
-
value: '
|
|
235
|
+
value: ' '
|
|
236
236
|
}
|
|
237
237
|
];
|
|
238
238
|
|
|
@@ -340,14 +340,14 @@ const postcssWeappTailwindcss = (options = {
|
|
|
340
340
|
isMainChunk: true
|
|
341
341
|
}) => {
|
|
342
342
|
const { customRuleCallback, isMainChunk } = options;
|
|
343
|
-
const
|
|
343
|
+
const isCustomRuleCallbackFn = typeof customRuleCallback === 'function';
|
|
344
344
|
return {
|
|
345
345
|
postcssPlugin,
|
|
346
346
|
Once(css) {
|
|
347
347
|
css.walkRules((rule) => {
|
|
348
348
|
transformSync(rule, options);
|
|
349
349
|
isMainChunk && commonChunkPreflight(rule, options);
|
|
350
|
-
|
|
350
|
+
isCustomRuleCallbackFn && customRuleCallback(rule, options);
|
|
351
351
|
});
|
|
352
352
|
}
|
|
353
353
|
};
|
|
@@ -78,15 +78,15 @@ var cssVars = [
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
prop: '--tw-pan-x',
|
|
81
|
-
value: '
|
|
81
|
+
value: ' '
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
prop: '--tw-pan-y',
|
|
85
|
-
value: '
|
|
85
|
+
value: ' '
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
prop: '--tw-pinch-zoom',
|
|
89
|
-
value: '
|
|
89
|
+
value: ' '
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
prop: '--tw-scroll-snap-strictness',
|
|
@@ -94,43 +94,43 @@ var cssVars = [
|
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
prop: '--tw-gradient-from-position',
|
|
97
|
-
value: '
|
|
97
|
+
value: ' '
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
prop: '--tw-gradient-via-position',
|
|
101
|
-
value: '
|
|
101
|
+
value: ' '
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
104
|
prop: '--tw-gradient-to-position',
|
|
105
|
-
value: '
|
|
105
|
+
value: ' '
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
prop: '--tw-ordinal',
|
|
109
|
-
value: '
|
|
109
|
+
value: ' '
|
|
110
110
|
},
|
|
111
111
|
{
|
|
112
112
|
prop: '--tw-slashed-zero',
|
|
113
|
-
value: '
|
|
113
|
+
value: ' '
|
|
114
114
|
},
|
|
115
115
|
{
|
|
116
116
|
prop: '--tw-numeric-figure',
|
|
117
|
-
value: '
|
|
117
|
+
value: ' '
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
prop: '--tw-numeric-spacing',
|
|
121
|
-
value: '
|
|
121
|
+
value: ' '
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
prop: '--tw-numeric-fraction',
|
|
125
|
-
value: '
|
|
125
|
+
value: ' '
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
prop: '--tw-ring-inset',
|
|
129
|
-
value: '
|
|
129
|
+
value: ' '
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
prop: '--tw-ring-offset-width',
|
|
133
|
-
value: '
|
|
133
|
+
value: '0px'
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
prop: '--tw-ring-offset-color',
|
|
@@ -138,7 +138,7 @@ var cssVars = [
|
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
prop: '--tw-ring-color',
|
|
141
|
-
value: '
|
|
141
|
+
value: 'rgb(59 130 246 / 0.5)'
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
prop: '--tw-ring-offset-shadow',
|
|
@@ -158,75 +158,75 @@ var cssVars = [
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
prop: '--tw-blur',
|
|
161
|
-
value: '
|
|
161
|
+
value: ' '
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
164
|
prop: '--tw-brightness',
|
|
165
|
-
value: '
|
|
165
|
+
value: ' '
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
168
|
prop: '--tw-contrast',
|
|
169
|
-
value: '
|
|
169
|
+
value: ' '
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
prop: '--tw-grayscale',
|
|
173
|
-
value: '
|
|
173
|
+
value: ' '
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
176
|
prop: '--tw-hue-rotate',
|
|
177
|
-
value: '
|
|
177
|
+
value: ' '
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
prop: '--tw-invert',
|
|
181
|
-
value: '
|
|
181
|
+
value: ' '
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
prop: '--tw-saturate',
|
|
185
|
-
value: '
|
|
185
|
+
value: ' '
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
prop: '--tw-sepia',
|
|
189
|
-
value: '
|
|
189
|
+
value: ' '
|
|
190
190
|
},
|
|
191
191
|
{
|
|
192
192
|
prop: '--tw-drop-shadow',
|
|
193
|
-
value: '
|
|
193
|
+
value: ' '
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
196
|
prop: '--tw-backdrop-blur',
|
|
197
|
-
value: '
|
|
197
|
+
value: ' '
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
200
|
prop: '--tw-backdrop-brightness',
|
|
201
|
-
value: '
|
|
201
|
+
value: ' '
|
|
202
202
|
},
|
|
203
203
|
{
|
|
204
204
|
prop: '--tw-backdrop-contrast',
|
|
205
|
-
value: '
|
|
205
|
+
value: ' '
|
|
206
206
|
},
|
|
207
207
|
{
|
|
208
208
|
prop: '--tw-backdrop-grayscale',
|
|
209
|
-
value: '
|
|
209
|
+
value: ' '
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
prop: '--tw-backdrop-hue-rotate',
|
|
213
|
-
value: '
|
|
213
|
+
value: ' '
|
|
214
214
|
},
|
|
215
215
|
{
|
|
216
216
|
prop: '--tw-backdrop-invert',
|
|
217
|
-
value: '
|
|
217
|
+
value: ' '
|
|
218
218
|
},
|
|
219
219
|
{
|
|
220
220
|
prop: '--tw-backdrop-opacity',
|
|
221
|
-
value: '
|
|
221
|
+
value: ' '
|
|
222
222
|
},
|
|
223
223
|
{
|
|
224
224
|
prop: '--tw-backdrop-saturate',
|
|
225
|
-
value: '
|
|
225
|
+
value: ' '
|
|
226
226
|
},
|
|
227
227
|
{
|
|
228
228
|
prop: '--tw-backdrop-sepia',
|
|
229
|
-
value: '
|
|
229
|
+
value: ' '
|
|
230
230
|
}
|
|
231
231
|
];
|
|
232
232
|
|
|
@@ -334,14 +334,14 @@ const postcssWeappTailwindcss = (options = {
|
|
|
334
334
|
isMainChunk: true
|
|
335
335
|
}) => {
|
|
336
336
|
const { customRuleCallback, isMainChunk } = options;
|
|
337
|
-
const
|
|
337
|
+
const isCustomRuleCallbackFn = typeof customRuleCallback === 'function';
|
|
338
338
|
return {
|
|
339
339
|
postcssPlugin,
|
|
340
340
|
Once(css) {
|
|
341
341
|
css.walkRules((rule) => {
|
|
342
342
|
transformSync(rule, options);
|
|
343
343
|
isMainChunk && commonChunkPreflight(rule, options);
|
|
344
|
-
|
|
344
|
+
isCustomRuleCallbackFn && customRuleCallback(rule, options);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
347
|
};
|
package/dist/postcss.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var postcss = require('./postcss-
|
|
5
|
+
var postcss = require('./postcss-4c88cd6d.js');
|
|
6
6
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
7
7
|
require('postcss-selector-parser');
|
|
8
8
|
require('./shared-4eed0e5c.js');
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { p as postcssWeappTailwindcss } from './postcss-
|
|
1
|
+
export { p as postcssWeappTailwindcss } from './postcss-99efb521.mjs';
|
|
2
2
|
export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
|
|
3
3
|
import 'postcss-selector-parser';
|
|
4
4
|
import './shared-686bfc32.mjs';
|
package/dist/reg.d.ts
CHANGED
|
@@ -8,19 +8,9 @@ interface ICreateRegexpOptions {
|
|
|
8
8
|
export declare function handleRegexp(reg: RegExp): string;
|
|
9
9
|
export declare function getSourceString(input: string | RegExp): string;
|
|
10
10
|
export declare function makePattern(arr: ItemOrItemArray<string | RegExp>): string;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function createTemplateHandlerMatchRegexp(tag: string | RegExp, attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
|
|
12
12
|
export declare function createTemplateClassRegexp(attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
|
|
13
13
|
export declare function makeCustomAttributes(entries?: [string | RegExp, ItemOrItemArray<string | RegExp>][]): ICustomRegexp[] | undefined;
|
|
14
14
|
export declare const variableRegExp: RegExp;
|
|
15
|
-
export declare const classRegexp: RegExp;
|
|
16
|
-
export declare const vueTemplateClassRegexp: RegExp;
|
|
17
|
-
export declare const tagRegexp: RegExp;
|
|
18
|
-
export declare const tagWithClassRegexp: RegExp;
|
|
19
|
-
export declare function classStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
|
|
20
|
-
export declare function tagStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
|
|
21
15
|
export declare const wxsTagRegexp: RegExp;
|
|
22
|
-
export declare const wxmlAllowClassCharsRegExp: RegExp;
|
|
23
|
-
export declare function createWxmlAllowClassCharsRegExp(): RegExp;
|
|
24
|
-
export declare const doubleQuoteRegexp: RegExp;
|
|
25
|
-
export declare function doubleQuoteStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
|
|
26
16
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export interface UserDefinedOptions {
|
|
|
93
93
|
inlineWxs?: boolean;
|
|
94
94
|
injectAdditionalCssVarScope?: boolean;
|
|
95
95
|
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
96
|
+
disabledDefaultTemplateHandler?: boolean;
|
|
96
97
|
}
|
|
97
98
|
export interface IMangleScopeContext {
|
|
98
99
|
rawOptions: UserDefinedOptions['mangle'];
|
|
@@ -113,20 +114,21 @@ export type ICustomRegexp = {
|
|
|
113
114
|
tag: string;
|
|
114
115
|
attrs: ItemOrItemArray<string | RegExp>;
|
|
115
116
|
};
|
|
116
|
-
export interface
|
|
117
|
+
export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
117
118
|
customAttributesEntities?: ICustomAttributesEntities;
|
|
118
119
|
escapeMap?: Record<string, string>;
|
|
119
120
|
mangleContext?: IMangleScopeContext;
|
|
120
121
|
inlineWxs?: boolean;
|
|
121
122
|
jsHandler?: (rawSource: string, set: Set<string>) => GeneratorResult;
|
|
122
123
|
runtimeSet?: Set<string>;
|
|
124
|
+
disabledDefaultTemplateHandler?: boolean;
|
|
123
125
|
}
|
|
124
126
|
export type GlobOrFunctionMatchers = 'htmlMatcher' | 'cssMatcher' | 'jsMatcher' | 'mainCssChunkMatcher' | 'wxsMatcher';
|
|
125
127
|
export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, GlobOrFunctionMatchers | 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary'> & {
|
|
126
128
|
[K in GlobOrFunctionMatchers]: K extends 'mainCssChunkMatcher' ? (name: string, appType?: AppType) => boolean : (name: string) => boolean;
|
|
127
129
|
} & {
|
|
128
130
|
supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | false;
|
|
129
|
-
|
|
131
|
+
templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => string;
|
|
130
132
|
styleHandler: (rawSource: string, options: IStyleHandlerOptions) => string;
|
|
131
133
|
jsHandler: (rawSource: string, set: Set<string>) => GeneratorResult;
|
|
132
134
|
escapeMap: Record<string, string>;
|
package/dist/vite.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
6
|
-
var postcss = require('./postcss-
|
|
7
|
-
var defaults = require('./defaults-
|
|
5
|
+
var options = require('./options-c5e1d1b4.js');
|
|
6
|
+
var postcss = require('./postcss-4c88cd6d.js');
|
|
7
|
+
var defaults = require('./defaults-d79e9245.js');
|
|
8
8
|
require('micromatch');
|
|
9
9
|
require('@babel/types');
|
|
10
10
|
require('@babel/generator');
|
|
@@ -27,7 +27,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
27
27
|
options$1.customReplaceDictionary = 'simple';
|
|
28
28
|
}
|
|
29
29
|
const opts = options.getOptions(options$1);
|
|
30
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate,
|
|
30
|
+
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet } = opts;
|
|
31
31
|
if (disabled) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -49,7 +49,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
49
49
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
50
50
|
const [file, originalSource] = groupedEntries.html[i];
|
|
51
51
|
const oldVal = originalSource.source.toString();
|
|
52
|
-
originalSource.source =
|
|
52
|
+
originalSource.source = templateHandler(oldVal, {
|
|
53
53
|
runtimeSet
|
|
54
54
|
});
|
|
55
55
|
onUpdate(file, oldVal, originalSource.source);
|
package/dist/vite.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
2
|
-
import { v as vitePluginName } from './postcss-
|
|
3
|
-
import { g as getGroupedEntries } from './defaults-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-244dcceb.mjs';
|
|
2
|
+
import { v as vitePluginName } from './postcss-99efb521.mjs';
|
|
3
|
+
import { g as getGroupedEntries } from './defaults-c397b5f9.mjs';
|
|
4
4
|
import 'micromatch';
|
|
5
5
|
import '@babel/types';
|
|
6
6
|
import '@babel/generator';
|
|
@@ -23,7 +23,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
23
23
|
options.customReplaceDictionary = 'simple';
|
|
24
24
|
}
|
|
25
25
|
const opts = getOptions(options);
|
|
26
|
-
const { disabled, onEnd, onLoad, onStart, onUpdate,
|
|
26
|
+
const { disabled, onEnd, onLoad, onStart, onUpdate, templateHandler, styleHandler, patch, jsHandler, mainCssChunkMatcher, appType, setMangleRuntimeSet } = opts;
|
|
27
27
|
if (disabled) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -45,7 +45,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
45
45
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
46
46
|
const [file, originalSource] = groupedEntries.html[i];
|
|
47
47
|
const oldVal = originalSource.source.toString();
|
|
48
|
-
originalSource.source =
|
|
48
|
+
originalSource.source = templateHandler(oldVal, {
|
|
49
49
|
runtimeSet
|
|
50
50
|
});
|
|
51
51
|
onUpdate(file, oldVal, originalSource.source);
|
package/dist/webpack.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
|
-
var options = require('./options-
|
|
8
|
-
var postcss = require('./postcss-
|
|
9
|
-
var defaults = require('./defaults-
|
|
7
|
+
var options = require('./options-c5e1d1b4.js');
|
|
8
|
+
var postcss = require('./postcss-4c88cd6d.js');
|
|
9
|
+
var defaults = require('./defaults-d79e9245.js');
|
|
10
10
|
require('micromatch');
|
|
11
11
|
require('@babel/types');
|
|
12
12
|
require('@babel/generator');
|
|
@@ -36,7 +36,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
36
36
|
this.appType = this.options.appType;
|
|
37
37
|
}
|
|
38
38
|
apply(compiler) {
|
|
39
|
-
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch,
|
|
39
|
+
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet } = this.options;
|
|
40
40
|
if (disabled) {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
@@ -80,7 +80,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
80
80
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
81
81
|
const [file, originalSource] = groupedEntries.html[i];
|
|
82
82
|
const rawSource = originalSource.source().toString();
|
|
83
|
-
const wxml =
|
|
83
|
+
const wxml = templateHandler(rawSource, {
|
|
84
84
|
runtimeSet
|
|
85
85
|
});
|
|
86
86
|
const source = new ConcatSource(wxml);
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
4
|
-
import { a as pluginName } from './postcss-
|
|
5
|
-
import { g as getGroupedEntries } from './defaults-
|
|
3
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-244dcceb.mjs';
|
|
4
|
+
import { a as pluginName } from './postcss-99efb521.mjs';
|
|
5
|
+
import { g as getGroupedEntries } from './defaults-c397b5f9.mjs';
|
|
6
6
|
import 'micromatch';
|
|
7
7
|
import '@babel/types';
|
|
8
8
|
import '@babel/generator';
|
|
@@ -27,7 +27,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
27
27
|
this.appType = this.options.appType;
|
|
28
28
|
}
|
|
29
29
|
apply(compiler) {
|
|
30
|
-
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch,
|
|
30
|
+
const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet } = this.options;
|
|
31
31
|
if (disabled) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
@@ -71,7 +71,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
71
71
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
72
72
|
const [file, originalSource] = groupedEntries.html[i];
|
|
73
73
|
const rawSource = originalSource.source().toString();
|
|
74
|
-
const wxml =
|
|
74
|
+
const wxml = templateHandler(rawSource, {
|
|
75
75
|
runtimeSet
|
|
76
76
|
});
|
|
77
77
|
const source = new ConcatSource(wxml);
|
package/dist/wxml/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { replaceWxml } from './shared';
|
|
2
|
-
export { generateCode,
|
|
2
|
+
export { generateCode, templateHandler, templateReplacer, customTemplateHandler, createTemplateHandler, extractSource } from './utils';
|
package/dist/wxml/shared.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function replaceWxml(original: string, options?:
|
|
1
|
+
import { ITemplateHandlerOptions } from "../types";
|
|
2
|
+
export declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
|
package/dist/wxml/utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { RawSource,
|
|
2
|
-
export declare function generateCode(match: string, options?:
|
|
1
|
+
import type { RawSource, ITemplateHandlerOptions } from "../types";
|
|
2
|
+
export declare function generateCode(match: string, options?: ITemplateHandlerOptions): string;
|
|
3
3
|
export declare function extractSource(original: string): RawSource[];
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
4
|
+
export declare function templateReplacer(original: string, options?: ITemplateHandlerOptions): string;
|
|
5
|
+
export declare function templateHandler(rawSource: string, options?: ITemplateHandlerOptions): string;
|
|
6
|
+
export declare function customTemplateHandler(rawSource: string, options: Required<ITemplateHandlerOptions>): string;
|
|
7
|
+
export declare function createTemplateHandler(options?: Omit<ITemplateHandlerOptions, 'runtimeSet'>): (rawSource: string, opt?: Pick<ITemplateHandlerOptions, 'runtimeSet'>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "把tailwindcss jit引擎,带给小程序开发者们\nbring tailwindcss jit engine to our miniprogram developers!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"postcss-rem-to-responsive-pixel": "^5.1.3",
|
|
158
158
|
"prettier": "^2.8.8",
|
|
159
159
|
"promisify-loader-runner": "^1.0.0",
|
|
160
|
-
"rollup": "^3.26.
|
|
160
|
+
"rollup": "^3.26.3",
|
|
161
161
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
162
162
|
"style-loader": "^3.3.3",
|
|
163
163
|
"tailwind-children": "^0.5.0",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"vite": "^4.4.4",
|
|
174
174
|
"vitest": "^0.33.0",
|
|
175
175
|
"weapp-tailwindcss-children": "^0.1.0",
|
|
176
|
-
"webpack": "^5.88.
|
|
176
|
+
"webpack": "^5.88.2",
|
|
177
177
|
"webpack-build-utils": "^0.0.4"
|
|
178
178
|
},
|
|
179
179
|
"dependencies": {
|
|
@@ -187,8 +187,8 @@
|
|
|
187
187
|
"postcss": "8.4.26",
|
|
188
188
|
"postcss-selector-parser": "^6.0.13",
|
|
189
189
|
"semver": "^7.5.4",
|
|
190
|
-
"tailwindcss-mangle-shared": "^1.2.
|
|
191
|
-
"tailwindcss-patch": "^1.2.
|
|
190
|
+
"tailwindcss-mangle-shared": "^1.2.7",
|
|
191
|
+
"tailwindcss-patch": "^1.2.7"
|
|
192
192
|
},
|
|
193
193
|
"packageManager": "pnpm@8.6.3",
|
|
194
194
|
"scripts": {
|