weapp-tailwindcss 2.6.2 → 2.6.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.
- package/dist/cli.js +6 -5
- package/dist/cli.mjs +6 -5
- package/dist/{defaults-d79e9245.js → defaults-28cfeec8.js} +3 -7
- package/dist/{defaults-c397b5f9.mjs → defaults-702719e1.mjs} +3 -6
- package/dist/defaults.js +2 -2
- package/dist/defaults.mjs +2 -2
- package/dist/escape.d.ts +1 -3
- package/dist/gulp.js +6 -5
- package/dist/gulp.mjs +6 -5
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -5
- package/dist/{options-c5e1d1b4.js → options-43afee21.js} +69 -148
- package/dist/{options-244dcceb.mjs → options-d8cb9e14.mjs} +46 -125
- package/dist/{postcss-4c88cd6d.js → postcss-4e99a8e8.js} +1 -1
- package/dist/{postcss-99efb521.mjs → postcss-a551ddc0.mjs} +1 -1
- package/dist/postcss.js +3 -3
- package/dist/postcss.mjs +3 -3
- package/dist/reg.d.ts +1 -16
- package/dist/replace.d.ts +1 -1
- package/dist/replace.js +24 -9
- package/dist/replace.mjs +4 -5
- package/dist/shared-df9de23f.js +17 -0
- package/dist/shared-fd149084.mjs +15 -0
- package/dist/types.d.ts +0 -6
- package/dist/vite.js +6 -5
- package/dist/vite.mjs +6 -5
- package/dist/webpack.js +6 -5
- package/dist/webpack.mjs +6 -5
- package/package.json +16 -14
- package/dist/dic-05980807.js +0 -111
- package/dist/dic-3790a3a4.mjs +0 -105
- package/dist/dic.d.ts +0 -44
- package/dist/shared-4eed0e5c.js +0 -62
- package/dist/shared-686bfc32.mjs +0 -59
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-43afee21.js');
|
|
4
4
|
require('micromatch');
|
|
5
5
|
require('@babel/types');
|
|
6
6
|
require('@babel/generator');
|
|
7
7
|
require('@babel/parser');
|
|
8
8
|
require('@babel/traverse');
|
|
9
9
|
require('./replace.js');
|
|
10
|
-
require('
|
|
11
|
-
require('./shared-
|
|
12
|
-
require('
|
|
10
|
+
require('@weapp-core/escape');
|
|
11
|
+
require('./shared-df9de23f.js');
|
|
12
|
+
require('@weapp-core/regex');
|
|
13
|
+
require('./defaults-28cfeec8.js');
|
|
13
14
|
require('postcss');
|
|
14
|
-
require('./postcss-
|
|
15
|
+
require('./postcss-4e99a8e8.js');
|
|
15
16
|
require('postcss-selector-parser');
|
|
16
17
|
require('@csstools/postcss-is-pseudo-class');
|
|
17
18
|
require('node:path');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-d8cb9e14.mjs';
|
|
2
2
|
import 'micromatch';
|
|
3
3
|
import '@babel/types';
|
|
4
4
|
import '@babel/generator';
|
|
5
5
|
import '@babel/parser';
|
|
6
6
|
import '@babel/traverse';
|
|
7
7
|
import './replace.mjs';
|
|
8
|
-
import '
|
|
9
|
-
import './shared-
|
|
10
|
-
import '
|
|
8
|
+
import '@weapp-core/escape';
|
|
9
|
+
import './shared-fd149084.mjs';
|
|
10
|
+
import '@weapp-core/regex';
|
|
11
|
+
import './defaults-702719e1.mjs';
|
|
11
12
|
import 'postcss';
|
|
12
|
-
import './postcss-
|
|
13
|
+
import './postcss-a551ddc0.mjs';
|
|
13
14
|
import 'postcss-selector-parser';
|
|
14
15
|
import '@csstools/postcss-is-pseudo-class';
|
|
15
16
|
import 'node:path';
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var escape = require('@weapp-core/escape');
|
|
4
4
|
|
|
5
|
-
function isRegexp(value) {
|
|
6
|
-
return Object.prototype.toString.call(value) === '[object RegExp]';
|
|
7
|
-
}
|
|
8
5
|
function isMap(value) {
|
|
9
6
|
return Object.prototype.toString.call(value) === '[object Map]';
|
|
10
7
|
}
|
|
@@ -88,7 +85,7 @@ const defaultOptions = {
|
|
|
88
85
|
}
|
|
89
86
|
}
|
|
90
87
|
},
|
|
91
|
-
wxsMatcher: (
|
|
88
|
+
wxsMatcher: () => {
|
|
92
89
|
return false;
|
|
93
90
|
},
|
|
94
91
|
cssPreflight: {
|
|
@@ -106,7 +103,7 @@ const defaultOptions = {
|
|
|
106
103
|
onEnd: noop,
|
|
107
104
|
onUpdate: noop,
|
|
108
105
|
customAttributes: {},
|
|
109
|
-
customReplaceDictionary:
|
|
106
|
+
customReplaceDictionary: escape.SimpleMappingChars2String,
|
|
110
107
|
supportCustomLengthUnitsPatch: {
|
|
111
108
|
units: ['rpx'],
|
|
112
109
|
dangerousOptions: {
|
|
@@ -136,5 +133,4 @@ const defaultOptions = {
|
|
|
136
133
|
exports.defaultOptions = defaultOptions;
|
|
137
134
|
exports.getGroupedEntries = getGroupedEntries;
|
|
138
135
|
exports.isMap = isMap;
|
|
139
|
-
exports.isRegexp = isRegexp;
|
|
140
136
|
exports.noop = noop;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SimpleMappingChars2String } from '@weapp-core/escape';
|
|
2
2
|
|
|
3
|
-
function isRegexp(value) {
|
|
4
|
-
return Object.prototype.toString.call(value) === '[object RegExp]';
|
|
5
|
-
}
|
|
6
3
|
function isMap(value) {
|
|
7
4
|
return Object.prototype.toString.call(value) === '[object Map]';
|
|
8
5
|
}
|
|
@@ -86,7 +83,7 @@ const defaultOptions = {
|
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
},
|
|
89
|
-
wxsMatcher: (
|
|
86
|
+
wxsMatcher: () => {
|
|
90
87
|
return false;
|
|
91
88
|
},
|
|
92
89
|
cssPreflight: {
|
|
@@ -131,4 +128,4 @@ const defaultOptions = {
|
|
|
131
128
|
disabledDefaultTemplateHandler: false
|
|
132
129
|
};
|
|
133
130
|
|
|
134
|
-
export {
|
|
131
|
+
export { defaultOptions as d, getGroupedEntries as g, isMap as i, noop as n };
|
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { d as defaultOptions } from './defaults-
|
|
2
|
-
import '
|
|
1
|
+
export { d as defaultOptions } from './defaults-702719e1.mjs';
|
|
2
|
+
import '@weapp-core/escape';
|
package/dist/escape.d.ts
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
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-43afee21.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('@babel/types');
|
|
9
9
|
require('@babel/generator');
|
|
10
10
|
require('@babel/parser');
|
|
11
11
|
require('@babel/traverse');
|
|
12
12
|
require('./replace.js');
|
|
13
|
-
require('
|
|
14
|
-
require('./shared-
|
|
15
|
-
require('
|
|
13
|
+
require('@weapp-core/escape');
|
|
14
|
+
require('./shared-df9de23f.js');
|
|
15
|
+
require('@weapp-core/regex');
|
|
16
|
+
require('./defaults-28cfeec8.js');
|
|
16
17
|
require('postcss');
|
|
17
|
-
require('./postcss-
|
|
18
|
+
require('./postcss-4e99a8e8.js');
|
|
18
19
|
require('postcss-selector-parser');
|
|
19
20
|
require('@csstools/postcss-is-pseudo-class');
|
|
20
21
|
require('node:path');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
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-d8cb9e14.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import '@babel/types';
|
|
5
5
|
import '@babel/generator';
|
|
6
6
|
import '@babel/parser';
|
|
7
7
|
import '@babel/traverse';
|
|
8
8
|
import './replace.mjs';
|
|
9
|
-
import '
|
|
10
|
-
import './shared-
|
|
11
|
-
import '
|
|
9
|
+
import '@weapp-core/escape';
|
|
10
|
+
import './shared-fd149084.mjs';
|
|
11
|
+
import '@weapp-core/regex';
|
|
12
|
+
import './defaults-702719e1.mjs';
|
|
12
13
|
import 'postcss';
|
|
13
|
-
import './postcss-
|
|
14
|
+
import './postcss-a551ddc0.mjs';
|
|
14
15
|
import 'postcss-selector-parser';
|
|
15
16
|
import '@csstools/postcss-is-pseudo-class';
|
|
16
17
|
import 'node:path';
|
package/dist/index.js
CHANGED
|
@@ -7,18 +7,19 @@ 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-43afee21.js');
|
|
11
11
|
require('micromatch');
|
|
12
12
|
require('@babel/types');
|
|
13
13
|
require('@babel/generator');
|
|
14
14
|
require('@babel/parser');
|
|
15
15
|
require('@babel/traverse');
|
|
16
16
|
require('./replace.js');
|
|
17
|
-
require('
|
|
18
|
-
require('./shared-
|
|
19
|
-
require('
|
|
17
|
+
require('@weapp-core/escape');
|
|
18
|
+
require('./shared-df9de23f.js');
|
|
19
|
+
require('@weapp-core/regex');
|
|
20
|
+
require('./defaults-28cfeec8.js');
|
|
20
21
|
require('postcss');
|
|
21
|
-
require('./postcss-
|
|
22
|
+
require('./postcss-4e99a8e8.js');
|
|
22
23
|
require('postcss-selector-parser');
|
|
23
24
|
require('@csstools/postcss-is-pseudo-class');
|
|
24
25
|
require('semver');
|
package/dist/index.mjs
CHANGED
|
@@ -3,18 +3,19 @@ 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-d8cb9e14.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
8
|
import '@babel/types';
|
|
9
9
|
import '@babel/generator';
|
|
10
10
|
import '@babel/parser';
|
|
11
11
|
import '@babel/traverse';
|
|
12
12
|
import './replace.mjs';
|
|
13
|
-
import '
|
|
14
|
-
import './shared-
|
|
15
|
-
import '
|
|
13
|
+
import '@weapp-core/escape';
|
|
14
|
+
import './shared-fd149084.mjs';
|
|
15
|
+
import '@weapp-core/regex';
|
|
16
|
+
import './defaults-702719e1.mjs';
|
|
16
17
|
import 'postcss';
|
|
17
|
-
import './postcss-
|
|
18
|
+
import './postcss-a551ddc0.mjs';
|
|
18
19
|
import 'postcss-selector-parser';
|
|
19
20
|
import '@csstools/postcss-is-pseudo-class';
|
|
20
21
|
import 'semver';
|
|
@@ -6,11 +6,12 @@ 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
|
|
9
|
+
var regex = require('@weapp-core/regex');
|
|
10
|
+
var defaults = require('./defaults-28cfeec8.js');
|
|
10
11
|
var postcss = require('postcss');
|
|
11
|
-
var postcss$1 = require('./postcss-
|
|
12
|
+
var postcss$1 = require('./postcss-4e99a8e8.js');
|
|
12
13
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
13
|
-
var
|
|
14
|
+
var escape = require('@weapp-core/escape');
|
|
14
15
|
var path = require('node:path');
|
|
15
16
|
var fs = require('node:fs');
|
|
16
17
|
var semver = require('semver');
|
|
@@ -20,21 +21,21 @@ var tailwindcssMangleShared = require('tailwindcss-mangle-shared');
|
|
|
20
21
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
22
|
|
|
22
23
|
function _interopNamespaceCompat(e) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
25
|
+
var n = Object.create(null);
|
|
26
|
+
if (e) {
|
|
27
|
+
Object.keys(e).forEach(function (k) {
|
|
28
|
+
if (k !== 'default') {
|
|
29
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
30
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return e[k]; }
|
|
33
|
+
});
|
|
34
|
+
}
|
|
32
35
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
n["default"] = e;
|
|
37
|
-
return Object.freeze(n);
|
|
36
|
+
}
|
|
37
|
+
n["default"] = e;
|
|
38
|
+
return Object.freeze(n);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
|
|
@@ -45,128 +46,6 @@ var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIs
|
|
|
45
46
|
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
46
47
|
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
47
48
|
|
|
48
|
-
function isObject(value) {
|
|
49
|
-
return value !== null && typeof value === "object";
|
|
50
|
-
}
|
|
51
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
52
|
-
if (!isObject(defaults)) {
|
|
53
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
54
|
-
}
|
|
55
|
-
const object = Object.assign({}, defaults);
|
|
56
|
-
for (const key in baseObject) {
|
|
57
|
-
if (key === "__proto__" || key === "constructor") {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
const value = baseObject[key];
|
|
61
|
-
if (value === null || value === void 0) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
68
|
-
object[key] = [...value, ...object[key]];
|
|
69
|
-
} else if (isObject(value) && isObject(object[key])) {
|
|
70
|
-
object[key] = _defu(
|
|
71
|
-
value,
|
|
72
|
-
object[key],
|
|
73
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
74
|
-
merger
|
|
75
|
-
);
|
|
76
|
-
} else {
|
|
77
|
-
object[key] = value;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return object;
|
|
81
|
-
}
|
|
82
|
-
function createDefu(merger) {
|
|
83
|
-
return (...arguments_) => (
|
|
84
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
85
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
const defu = createDefu();
|
|
89
|
-
|
|
90
|
-
function escapeStringRegexp(str) {
|
|
91
|
-
if (typeof str !== 'string') {
|
|
92
|
-
throw new TypeError('Expected a string');
|
|
93
|
-
}
|
|
94
|
-
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, '\\$&').replaceAll('-', '\\x2d');
|
|
95
|
-
}
|
|
96
|
-
const templateClassExactRegexp = /(?<=^|\s)(?:hover-)?class=(?:["']\W+\s*\w+\()?["']([^"]+)["']/gs;
|
|
97
|
-
const tagWithEitherClassAndHoverClassRegexp = /<[a-z][a-z-]*[a-z]*\s+[^>]*?(?:hover-)?class="[^"]*"[^>]*?\/?>/g;
|
|
98
|
-
function handleRegexp(reg) {
|
|
99
|
-
return `(?:${reg.source})`;
|
|
100
|
-
}
|
|
101
|
-
function getSourceString(input) {
|
|
102
|
-
let result;
|
|
103
|
-
if (typeof input === 'string') {
|
|
104
|
-
result = input;
|
|
105
|
-
}
|
|
106
|
-
else if (defaults.isRegexp(input)) {
|
|
107
|
-
result = input.source;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
result = input.toString();
|
|
111
|
-
}
|
|
112
|
-
return result;
|
|
113
|
-
}
|
|
114
|
-
function makePattern(arr) {
|
|
115
|
-
let pattern = '';
|
|
116
|
-
if (Array.isArray(arr)) {
|
|
117
|
-
pattern = arr
|
|
118
|
-
.reduce((acc, cur) => {
|
|
119
|
-
if (typeof cur === 'string') {
|
|
120
|
-
acc.push(cur);
|
|
121
|
-
}
|
|
122
|
-
else if (defaults.isRegexp(cur)) {
|
|
123
|
-
acc.push(handleRegexp(cur));
|
|
124
|
-
}
|
|
125
|
-
return acc;
|
|
126
|
-
}, [])
|
|
127
|
-
.join('|');
|
|
128
|
-
}
|
|
129
|
-
else if (typeof arr === 'string') {
|
|
130
|
-
pattern = arr;
|
|
131
|
-
}
|
|
132
|
-
else if (defaults.isRegexp(arr)) {
|
|
133
|
-
pattern = handleRegexp(arr);
|
|
134
|
-
}
|
|
135
|
-
return pattern;
|
|
136
|
-
}
|
|
137
|
-
function createTemplateHandlerMatchRegexp(tag, attrs, options = {}) {
|
|
138
|
-
const { exact = true } = options;
|
|
139
|
-
const prefix = exact ? '(?<=^|\\s)' : '';
|
|
140
|
-
const pattern = makePattern(attrs);
|
|
141
|
-
let tagPattern = getSourceString(tag);
|
|
142
|
-
if (tagPattern === '*') {
|
|
143
|
-
tagPattern = '[a-z][-a-z]*[a-z]*';
|
|
144
|
-
}
|
|
145
|
-
const source = `<(${tagPattern})\\s+[^>]*?(?:${prefix}(${pattern})="(?:[^"]*)")[^>]*?\\/?>`;
|
|
146
|
-
return new RegExp(source, 'g');
|
|
147
|
-
}
|
|
148
|
-
function createTemplateClassRegexp(attrs, options = {}) {
|
|
149
|
-
const { exact = true } = options;
|
|
150
|
-
const prefix = exact ? '(?<=^|\\s)' : '';
|
|
151
|
-
const pattern = makePattern(attrs);
|
|
152
|
-
const source = `(?:${prefix}${pattern})=(?:["']\\W+\\s*(?:\\w+)\\()?["']([^"]+)['"]`;
|
|
153
|
-
return new RegExp(source, 'gs');
|
|
154
|
-
}
|
|
155
|
-
function makeCustomAttributes(entries) {
|
|
156
|
-
if (Array.isArray(entries)) {
|
|
157
|
-
return entries.map(([k, v]) => {
|
|
158
|
-
return {
|
|
159
|
-
tagRegexp: createTemplateHandlerMatchRegexp(k, v),
|
|
160
|
-
attrRegexp: createTemplateClassRegexp(v),
|
|
161
|
-
tag: getSourceString(k),
|
|
162
|
-
attrs: v
|
|
163
|
-
};
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const variableRegExp = /{{(.*?)}}/gs;
|
|
168
|
-
const wxsTagRegexp = /<wxs\s*(?:[a-z][a-z-]*[a-z]*(?:\s*=\s*".*?")?)*\s*>(.*?)<\/wxs>/gs;
|
|
169
|
-
|
|
170
49
|
const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
|
|
171
50
|
function isValidSelector(selector = '') {
|
|
172
51
|
return validateFilterRE.test(selector);
|
|
@@ -197,7 +76,7 @@ function handleValue(str, node, options) {
|
|
|
197
76
|
if (ctx) {
|
|
198
77
|
rawStr = ctx.jsHandler(rawStr);
|
|
199
78
|
}
|
|
200
|
-
rawStr = rawStr.replaceAll(new RegExp(escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
|
|
79
|
+
rawStr = rawStr.replaceAll(new RegExp(regex.escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
|
|
201
80
|
escapeMap
|
|
202
81
|
}));
|
|
203
82
|
}
|
|
@@ -255,6 +134,48 @@ function createjsHandler(options) {
|
|
|
255
134
|
};
|
|
256
135
|
}
|
|
257
136
|
|
|
137
|
+
function isObject(value) {
|
|
138
|
+
return value !== null && typeof value === "object";
|
|
139
|
+
}
|
|
140
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
141
|
+
if (!isObject(defaults)) {
|
|
142
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
143
|
+
}
|
|
144
|
+
const object = Object.assign({}, defaults);
|
|
145
|
+
for (const key in baseObject) {
|
|
146
|
+
if (key === "__proto__" || key === "constructor") {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
const value = baseObject[key];
|
|
150
|
+
if (value === null || value === void 0) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
157
|
+
object[key] = [...value, ...object[key]];
|
|
158
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
159
|
+
object[key] = _defu(
|
|
160
|
+
value,
|
|
161
|
+
object[key],
|
|
162
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
163
|
+
merger
|
|
164
|
+
);
|
|
165
|
+
} else {
|
|
166
|
+
object[key] = value;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return object;
|
|
170
|
+
}
|
|
171
|
+
function createDefu(merger) {
|
|
172
|
+
return (...arguments_) => (
|
|
173
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
174
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
const defu = createDefu();
|
|
178
|
+
|
|
258
179
|
function generateCode(match, options = {}) {
|
|
259
180
|
const ast = parser.parseExpression(match);
|
|
260
181
|
traverse__default["default"](ast, {
|
|
@@ -296,7 +217,7 @@ function extract(original, reg) {
|
|
|
296
217
|
return sources;
|
|
297
218
|
}
|
|
298
219
|
function extractSource(original) {
|
|
299
|
-
return extract(original, variableRegExp);
|
|
220
|
+
return extract(original, regex.variableRegExp);
|
|
300
221
|
}
|
|
301
222
|
function templateReplacer(original, options = {}) {
|
|
302
223
|
const sources = extractSource(original);
|
|
@@ -345,8 +266,8 @@ function templateHandler(rawSource, options = {}) {
|
|
|
345
266
|
if (options.disabledDefaultTemplateHandler) {
|
|
346
267
|
return rawSource;
|
|
347
268
|
}
|
|
348
|
-
return rawSource.replace(tagWithEitherClassAndHoverClassRegexp, (m0) => {
|
|
349
|
-
return m0.replace(templateClassExactRegexp, (m1, className) => {
|
|
269
|
+
return rawSource.replace(regex.tagWithEitherClassAndHoverClassRegexp, (m0) => {
|
|
270
|
+
return m0.replace(regex.templateClassExactRegexp, (m1, className) => {
|
|
350
271
|
return m1.replace(className, templateReplacer(className, options));
|
|
351
272
|
});
|
|
352
273
|
});
|
|
@@ -354,7 +275,7 @@ function templateHandler(rawSource, options = {}) {
|
|
|
354
275
|
function customTemplateHandler(rawSource, options) {
|
|
355
276
|
const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
|
|
356
277
|
let source = templateHandler(rawSource, options);
|
|
357
|
-
const regexps = makeCustomAttributes(customAttributesEntities);
|
|
278
|
+
const regexps = regex.makeCustomAttributes(customAttributesEntities);
|
|
358
279
|
if (regexps && Array.isArray(regexps)) {
|
|
359
280
|
for (const regexp of regexps) {
|
|
360
281
|
source = source.replace(regexp.tagRegexp, (m0) => {
|
|
@@ -365,7 +286,7 @@ function customTemplateHandler(rawSource, options) {
|
|
|
365
286
|
}
|
|
366
287
|
}
|
|
367
288
|
if (inlineWxs) {
|
|
368
|
-
const wxsTags = extract(source, wxsTagRegexp);
|
|
289
|
+
const wxsTags = extract(source, regex.wxsTagRegexp);
|
|
369
290
|
for (const x of wxsTags) {
|
|
370
291
|
const code = jsHandler(x.raw, runtimeSet).code;
|
|
371
292
|
source = source.replaceAll(x.raw, code);
|
|
@@ -544,7 +465,7 @@ function useMangleStore() {
|
|
|
544
465
|
const arr = splitCode(rawSource);
|
|
545
466
|
for (const x of arr) {
|
|
546
467
|
if (ctx.runtimeSet.has(x)) {
|
|
547
|
-
rawSource = rawSource.replaceAll(new RegExp(escapeStringRegexp(x), 'g'), ctx.classGenerator.generateClassName(x).name);
|
|
468
|
+
rawSource = rawSource.replaceAll(new RegExp(regex.escapeStringRegexp(x), 'g'), ctx.classGenerator.generateClassName(x).name);
|
|
548
469
|
}
|
|
549
470
|
}
|
|
550
471
|
return rawSource;
|
|
@@ -604,10 +525,10 @@ function getOptions(options = {}) {
|
|
|
604
525
|
options.supportCustomLengthUnitsPatch = undefined;
|
|
605
526
|
}
|
|
606
527
|
if (options.customReplaceDictionary === 'simple') {
|
|
607
|
-
options.customReplaceDictionary =
|
|
528
|
+
options.customReplaceDictionary = escape.SimpleMappingChars2String;
|
|
608
529
|
}
|
|
609
530
|
else if (options.customReplaceDictionary === 'complex') {
|
|
610
|
-
options.customReplaceDictionary =
|
|
531
|
+
options.customReplaceDictionary = escape.MappingChars2String;
|
|
611
532
|
}
|
|
612
533
|
normalizeMatcher(options, 'cssMatcher');
|
|
613
534
|
normalizeMatcher(options, 'htmlMatcher');
|