weapp-tailwindcss 2.8.0 → 2.8.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 +5 -4
- package/dist/cli.mjs +5 -4
- package/dist/{defaults-c6437917.js → defaults-263271f9.js} +6 -1
- package/dist/{defaults-72ea9566.mjs → defaults-dc8a0e3d.mjs} +6 -1
- package/dist/defaults.js +2 -1
- package/dist/defaults.mjs +2 -1
- package/dist/escape.d.ts +1 -0
- package/dist/gulp.js +5 -4
- package/dist/gulp.mjs +5 -4
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/dist/js/index.d.ts +3 -7
- package/dist/{options-7b804be0.js → options-50d69eba.js} +124 -67
- package/dist/{options-70759e98.mjs → options-8a945166.mjs} +122 -65
- package/dist/{postcss-a551ddc0.mjs → postcss-55ed4d42.mjs} +23 -6
- package/dist/{postcss-4e99a8e8.js → postcss-8d7f67b4.js} +23 -6
- package/dist/postcss.js +3 -2
- package/dist/postcss.mjs +3 -2
- package/dist/replace.js +2 -1
- package/dist/replace.mjs +2 -1
- package/dist/{shared-fd149084.mjs → shared-283aac78.mjs} +1 -0
- package/dist/{shared-df9de23f.js → shared-8b9be5f0.js} +1 -0
- package/dist/types.d.ts +19 -11
- package/dist/vite.js +13 -5
- package/dist/vite.mjs +13 -5
- package/dist/webpack.js +17 -8
- package/dist/webpack.mjs +17 -8
- package/package.json +32 -29
package/dist/cli.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-50d69eba.js');
|
|
4
4
|
require('micromatch');
|
|
5
5
|
require('magic-string');
|
|
6
6
|
require('./replace.js');
|
|
7
7
|
require('@weapp-core/escape');
|
|
8
|
-
require('
|
|
8
|
+
require('@ast-core/escape');
|
|
9
|
+
require('./shared-8b9be5f0.js');
|
|
9
10
|
require('@weapp-core/regex');
|
|
10
11
|
require('@babel/generator');
|
|
11
12
|
require('@babel/parser');
|
|
12
13
|
require('@babel/traverse');
|
|
13
|
-
require('./defaults-
|
|
14
|
+
require('./defaults-263271f9.js');
|
|
14
15
|
require('@babel/types');
|
|
15
16
|
require('htmlparser2');
|
|
16
17
|
require('postcss');
|
|
17
|
-
require('./postcss-
|
|
18
|
+
require('./postcss-8d7f67b4.js');
|
|
18
19
|
require('postcss-selector-parser');
|
|
19
20
|
require('@csstools/postcss-is-pseudo-class');
|
|
20
21
|
require('node:path');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-8a945166.mjs';
|
|
2
2
|
import 'micromatch';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
5
5
|
import '@weapp-core/escape';
|
|
6
|
-
import '
|
|
6
|
+
import '@ast-core/escape';
|
|
7
|
+
import './shared-283aac78.mjs';
|
|
7
8
|
import '@weapp-core/regex';
|
|
8
9
|
import '@babel/generator';
|
|
9
10
|
import '@babel/parser';
|
|
10
11
|
import '@babel/traverse';
|
|
11
|
-
import './defaults-
|
|
12
|
+
import './defaults-dc8a0e3d.mjs';
|
|
12
13
|
import '@babel/types';
|
|
13
14
|
import 'htmlparser2';
|
|
14
15
|
import 'postcss';
|
|
15
|
-
import './postcss-
|
|
16
|
+
import './postcss-55ed4d42.mjs';
|
|
16
17
|
import 'postcss-selector-parser';
|
|
17
18
|
import '@csstools/postcss-is-pseudo-class';
|
|
18
19
|
import 'node:path';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var escape = require('@weapp-core/escape');
|
|
4
|
+
require('@ast-core/escape');
|
|
4
5
|
|
|
5
6
|
function isMap(value) {
|
|
6
7
|
return Object.prototype.toString.call(value) === '[object Map]';
|
|
@@ -128,7 +129,11 @@ const defaultOptions = {
|
|
|
128
129
|
return false;
|
|
129
130
|
},
|
|
130
131
|
disabledDefaultTemplateHandler: false,
|
|
131
|
-
jsEscapeStrategy: 'replace'
|
|
132
|
+
jsEscapeStrategy: 'replace',
|
|
133
|
+
cssSelectorReplacement: {
|
|
134
|
+
root: 'page',
|
|
135
|
+
universal: 'view'
|
|
136
|
+
}
|
|
132
137
|
};
|
|
133
138
|
|
|
134
139
|
exports.defaultOptions = defaultOptions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SimpleMappingChars2String } from '@weapp-core/escape';
|
|
2
|
+
import '@ast-core/escape';
|
|
2
3
|
|
|
3
4
|
function isMap(value) {
|
|
4
5
|
return Object.prototype.toString.call(value) === '[object Map]';
|
|
@@ -126,7 +127,11 @@ const defaultOptions = {
|
|
|
126
127
|
return false;
|
|
127
128
|
},
|
|
128
129
|
disabledDefaultTemplateHandler: false,
|
|
129
|
-
jsEscapeStrategy: 'replace'
|
|
130
|
+
jsEscapeStrategy: 'replace',
|
|
131
|
+
cssSelectorReplacement: {
|
|
132
|
+
root: 'page',
|
|
133
|
+
universal: 'view'
|
|
134
|
+
}
|
|
130
135
|
};
|
|
131
136
|
|
|
132
137
|
export { defaultOptions as d, getGroupedEntries as g, isMap as i, noop as n };
|
package/dist/defaults.js
CHANGED
package/dist/defaults.mjs
CHANGED
package/dist/escape.d.ts
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -3,21 +3,22 @@
|
|
|
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-50d69eba.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('magic-string');
|
|
9
9
|
require('./replace.js');
|
|
10
10
|
require('@weapp-core/escape');
|
|
11
|
-
require('
|
|
11
|
+
require('@ast-core/escape');
|
|
12
|
+
require('./shared-8b9be5f0.js');
|
|
12
13
|
require('@weapp-core/regex');
|
|
13
14
|
require('@babel/generator');
|
|
14
15
|
require('@babel/parser');
|
|
15
16
|
require('@babel/traverse');
|
|
16
|
-
require('./defaults-
|
|
17
|
+
require('./defaults-263271f9.js');
|
|
17
18
|
require('@babel/types');
|
|
18
19
|
require('htmlparser2');
|
|
19
20
|
require('postcss');
|
|
20
|
-
require('./postcss-
|
|
21
|
+
require('./postcss-8d7f67b4.js');
|
|
21
22
|
require('postcss-selector-parser');
|
|
22
23
|
require('@csstools/postcss-is-pseudo-class');
|
|
23
24
|
require('node:path');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
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-8a945166.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import 'magic-string';
|
|
5
5
|
import './replace.mjs';
|
|
6
6
|
import '@weapp-core/escape';
|
|
7
|
-
import '
|
|
7
|
+
import '@ast-core/escape';
|
|
8
|
+
import './shared-283aac78.mjs';
|
|
8
9
|
import '@weapp-core/regex';
|
|
9
10
|
import '@babel/generator';
|
|
10
11
|
import '@babel/parser';
|
|
11
12
|
import '@babel/traverse';
|
|
12
|
-
import './defaults-
|
|
13
|
+
import './defaults-dc8a0e3d.mjs';
|
|
13
14
|
import '@babel/types';
|
|
14
15
|
import 'htmlparser2';
|
|
15
16
|
import 'postcss';
|
|
16
|
-
import './postcss-
|
|
17
|
+
import './postcss-55ed4d42.mjs';
|
|
17
18
|
import 'postcss-selector-parser';
|
|
18
19
|
import '@csstools/postcss-is-pseudo-class';
|
|
19
20
|
import 'node:path';
|
package/dist/index.js
CHANGED
|
@@ -7,21 +7,22 @@ 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-50d69eba.js');
|
|
11
11
|
require('micromatch');
|
|
12
12
|
require('magic-string');
|
|
13
13
|
require('./replace.js');
|
|
14
14
|
require('@weapp-core/escape');
|
|
15
|
-
require('
|
|
15
|
+
require('@ast-core/escape');
|
|
16
|
+
require('./shared-8b9be5f0.js');
|
|
16
17
|
require('@weapp-core/regex');
|
|
17
18
|
require('@babel/generator');
|
|
18
19
|
require('@babel/parser');
|
|
19
20
|
require('@babel/traverse');
|
|
20
|
-
require('./defaults-
|
|
21
|
+
require('./defaults-263271f9.js');
|
|
21
22
|
require('@babel/types');
|
|
22
23
|
require('htmlparser2');
|
|
23
24
|
require('postcss');
|
|
24
|
-
require('./postcss-
|
|
25
|
+
require('./postcss-8d7f67b4.js');
|
|
25
26
|
require('postcss-selector-parser');
|
|
26
27
|
require('@csstools/postcss-is-pseudo-class');
|
|
27
28
|
require('semver');
|
package/dist/index.mjs
CHANGED
|
@@ -3,21 +3,22 @@ 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-8a945166.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
8
|
import 'magic-string';
|
|
9
9
|
import './replace.mjs';
|
|
10
10
|
import '@weapp-core/escape';
|
|
11
|
-
import '
|
|
11
|
+
import '@ast-core/escape';
|
|
12
|
+
import './shared-283aac78.mjs';
|
|
12
13
|
import '@weapp-core/regex';
|
|
13
14
|
import '@babel/generator';
|
|
14
15
|
import '@babel/parser';
|
|
15
16
|
import '@babel/traverse';
|
|
16
|
-
import './defaults-
|
|
17
|
+
import './defaults-dc8a0e3d.mjs';
|
|
17
18
|
import '@babel/types';
|
|
18
19
|
import 'htmlparser2';
|
|
19
20
|
import 'postcss';
|
|
20
|
-
import './postcss-
|
|
21
|
+
import './postcss-55ed4d42.mjs';
|
|
21
22
|
import 'postcss-selector-parser';
|
|
22
23
|
import '@csstools/postcss-is-pseudo-class';
|
|
23
24
|
import 'semver';
|
package/dist/js/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import type { IJsHandlerOptions } from "../types";
|
|
2
|
-
export declare function jsHandler(rawSource: string, options: IJsHandlerOptions):
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
export declare function createjsHandler(options: Omit<IJsHandlerOptions, 'classNameSet'>): (rawSource: string, set: Set<string>) => import("@babel/generator").GeneratorResult | {
|
|
6
|
-
code: string;
|
|
7
|
-
};
|
|
1
|
+
import type { CreateJsHandlerOptions, IJsHandlerOptions, JsHandlerResult } from "../types";
|
|
2
|
+
export declare function jsHandler(rawSource: string, options: IJsHandlerOptions): JsHandlerResult;
|
|
3
|
+
export declare function createJsHandler(options: CreateJsHandlerOptions): (rawSource: string, set: Set<string>, options?: CreateJsHandlerOptions) => JsHandlerResult;
|
|
@@ -4,15 +4,16 @@ var micromatch = require('micromatch');
|
|
|
4
4
|
var MagicString = require('magic-string');
|
|
5
5
|
var replace = require('./replace.js');
|
|
6
6
|
var regex = require('@weapp-core/regex');
|
|
7
|
-
var escape = require('@weapp-core/escape');
|
|
7
|
+
var escape$1 = require('@weapp-core/escape');
|
|
8
|
+
var escape = require('@ast-core/escape');
|
|
8
9
|
var generate = require('@babel/generator');
|
|
9
10
|
var parser = require('@babel/parser');
|
|
10
11
|
var traverse = require('@babel/traverse');
|
|
11
|
-
var defaults = require('./defaults-
|
|
12
|
+
var defaults = require('./defaults-263271f9.js');
|
|
12
13
|
var t = require('@babel/types');
|
|
13
14
|
var htmlparser2 = require('htmlparser2');
|
|
14
15
|
var postcss = require('postcss');
|
|
15
|
-
var postcss$1 = require('./postcss-
|
|
16
|
+
var postcss$1 = require('./postcss-8d7f67b4.js');
|
|
16
17
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
17
18
|
var path = require('node:path');
|
|
18
19
|
var fs = require('node:fs');
|
|
@@ -113,8 +114,9 @@ function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = fa
|
|
|
113
114
|
if (typeof node.start === 'number' && typeof node.end === 'number') {
|
|
114
115
|
const start = node.start + offset;
|
|
115
116
|
const end = node.end - offset;
|
|
116
|
-
if (start < end) {
|
|
117
|
-
|
|
117
|
+
if (start < end && str !== rawStr) {
|
|
118
|
+
const content = needEscaped ? escape.jsStringEscape(rawStr) : rawStr;
|
|
119
|
+
ms.update(start, end, content);
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
return rawStr;
|
|
@@ -122,6 +124,55 @@ function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = fa
|
|
|
122
124
|
|
|
123
125
|
const isProd = () => process.env.NODE_ENV === 'production';
|
|
124
126
|
|
|
127
|
+
function isObject(value) {
|
|
128
|
+
return value !== null && typeof value === "object";
|
|
129
|
+
}
|
|
130
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
131
|
+
if (!isObject(defaults)) {
|
|
132
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
133
|
+
}
|
|
134
|
+
const object = Object.assign({}, defaults);
|
|
135
|
+
for (const key in baseObject) {
|
|
136
|
+
if (key === "__proto__" || key === "constructor") {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const value = baseObject[key];
|
|
140
|
+
if (value === null || value === void 0) {
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
147
|
+
object[key] = [...value, ...object[key]];
|
|
148
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
149
|
+
object[key] = _defu(
|
|
150
|
+
value,
|
|
151
|
+
object[key],
|
|
152
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
153
|
+
merger
|
|
154
|
+
);
|
|
155
|
+
} else {
|
|
156
|
+
object[key] = value;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return object;
|
|
160
|
+
}
|
|
161
|
+
function createDefu(merger) {
|
|
162
|
+
return (...arguments_) => (
|
|
163
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
164
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
const defu = createDefu();
|
|
168
|
+
|
|
169
|
+
function isEvalPath(p) {
|
|
170
|
+
if (p.isCallExpression()) {
|
|
171
|
+
const calleePath = p.get('callee');
|
|
172
|
+
return calleePath.isIdentifier() && calleePath.node.name === 'eval';
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
125
176
|
function jsHandler(rawSource, options) {
|
|
126
177
|
var _a;
|
|
127
178
|
const ast = parser.parse(rawSource, {
|
|
@@ -132,26 +183,56 @@ function jsHandler(rawSource, options) {
|
|
|
132
183
|
const ropt = {
|
|
133
184
|
StringLiteral: {
|
|
134
185
|
enter(p) {
|
|
186
|
+
var _a;
|
|
187
|
+
if (isEvalPath(p.parentPath)) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
135
190
|
const n = p.node;
|
|
136
|
-
replaceHandleValue(n.value, n, options, ms, 1, true);
|
|
191
|
+
replaceHandleValue(n.value, n, options, ms, 1, (_a = options.needEscaped) !== null && _a !== void 0 ? _a : true);
|
|
137
192
|
}
|
|
138
193
|
},
|
|
139
194
|
TemplateElement: {
|
|
140
195
|
enter(p) {
|
|
196
|
+
if (p.parentPath.isTemplateLiteral() && isEvalPath(p.parentPath.parentPath)) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
141
199
|
const n = p.node;
|
|
142
200
|
replaceHandleValue(n.value.raw, n, options, ms, 0, false);
|
|
143
201
|
}
|
|
144
202
|
},
|
|
145
203
|
CallExpression: {
|
|
146
204
|
enter(p) {
|
|
147
|
-
|
|
148
|
-
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
205
|
+
if (isEvalPath(p)) {
|
|
149
206
|
p.traverse({
|
|
150
207
|
StringLiteral: {
|
|
151
208
|
enter(s) {
|
|
152
|
-
const res = jsHandler(s.node.value, options);
|
|
209
|
+
const res = jsHandler(s.node.value, Object.assign(Object.assign({}, options), { needEscaped: false, generateMap: false }));
|
|
153
210
|
if (res.code) {
|
|
154
|
-
|
|
211
|
+
const node = s.node;
|
|
212
|
+
if (typeof node.start === 'number' && typeof node.end === 'number') {
|
|
213
|
+
const start = node.start + 1;
|
|
214
|
+
const end = node.end - 1;
|
|
215
|
+
if (start < end && s.node.value !== res.code) {
|
|
216
|
+
ms.update(start, end, escape.jsStringEscape(res.code));
|
|
217
|
+
node.value = res.code;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
TemplateElement: {
|
|
224
|
+
enter(s) {
|
|
225
|
+
const res = jsHandler(s.node.value.raw, Object.assign(Object.assign({}, options), { generateMap: false }));
|
|
226
|
+
if (res.code) {
|
|
227
|
+
const node = s.node;
|
|
228
|
+
if (typeof node.start === 'number' && typeof node.end === 'number') {
|
|
229
|
+
const start = node.start;
|
|
230
|
+
const end = node.end;
|
|
231
|
+
if (start < end && s.node.value.raw !== res.code) {
|
|
232
|
+
ms.update(start, end, res.code);
|
|
233
|
+
s.node.value.raw = res.code;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
155
236
|
}
|
|
156
237
|
}
|
|
157
238
|
}
|
|
@@ -161,28 +242,34 @@ function jsHandler(rawSource, options) {
|
|
|
161
242
|
}
|
|
162
243
|
};
|
|
163
244
|
traverse__default["default"](ast, ropt);
|
|
164
|
-
|
|
245
|
+
const result = {
|
|
165
246
|
code: ms.toString()
|
|
166
247
|
};
|
|
248
|
+
return result;
|
|
167
249
|
}
|
|
168
250
|
else {
|
|
169
251
|
const gopt = {
|
|
170
252
|
StringLiteral: {
|
|
171
253
|
enter(p) {
|
|
254
|
+
if (isEvalPath(p.parentPath)) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
172
257
|
const n = p.node;
|
|
173
258
|
n.value = regenerateHandleValue(n.value, n, options);
|
|
174
259
|
}
|
|
175
260
|
},
|
|
176
261
|
TemplateElement: {
|
|
177
262
|
enter(p) {
|
|
263
|
+
if (p.parentPath.isTemplateLiteral() && isEvalPath(p.parentPath.parentPath)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
178
266
|
const n = p.node;
|
|
179
267
|
n.value.raw = regenerateHandleValue(n.value.raw, n, options);
|
|
180
268
|
}
|
|
181
269
|
},
|
|
182
270
|
CallExpression: {
|
|
183
271
|
enter(p) {
|
|
184
|
-
|
|
185
|
-
if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
|
|
272
|
+
if (isEvalPath(p)) {
|
|
186
273
|
p.traverse({
|
|
187
274
|
StringLiteral: {
|
|
188
275
|
enter(s) {
|
|
@@ -191,6 +278,14 @@ function jsHandler(rawSource, options) {
|
|
|
191
278
|
s.node.value = res.code;
|
|
192
279
|
}
|
|
193
280
|
}
|
|
281
|
+
},
|
|
282
|
+
TemplateElement: {
|
|
283
|
+
enter(s) {
|
|
284
|
+
const res = jsHandler(s.node.value.raw, options);
|
|
285
|
+
if (res.code) {
|
|
286
|
+
s.node.value.raw = res.code;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
194
289
|
}
|
|
195
290
|
});
|
|
196
291
|
}
|
|
@@ -203,63 +298,23 @@ function jsHandler(rawSource, options) {
|
|
|
203
298
|
});
|
|
204
299
|
}
|
|
205
300
|
}
|
|
206
|
-
function
|
|
207
|
-
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy } = options;
|
|
208
|
-
return (rawSource, set) => {
|
|
209
|
-
|
|
301
|
+
function createJsHandler(options) {
|
|
302
|
+
const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy, generateMap } = options;
|
|
303
|
+
return (rawSource, set, options) => {
|
|
304
|
+
const opts = defu(options, {
|
|
210
305
|
classNameSet: set,
|
|
211
306
|
minifiedJs,
|
|
212
307
|
escapeMap,
|
|
213
308
|
arbitraryValues,
|
|
214
309
|
mangleContext,
|
|
215
310
|
jsPreserveClass,
|
|
216
|
-
strategy
|
|
311
|
+
strategy,
|
|
312
|
+
generateMap
|
|
217
313
|
});
|
|
314
|
+
return jsHandler(rawSource, opts);
|
|
218
315
|
};
|
|
219
316
|
}
|
|
220
317
|
|
|
221
|
-
function isObject(value) {
|
|
222
|
-
return value !== null && typeof value === "object";
|
|
223
|
-
}
|
|
224
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
225
|
-
if (!isObject(defaults)) {
|
|
226
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
227
|
-
}
|
|
228
|
-
const object = Object.assign({}, defaults);
|
|
229
|
-
for (const key in baseObject) {
|
|
230
|
-
if (key === "__proto__" || key === "constructor") {
|
|
231
|
-
continue;
|
|
232
|
-
}
|
|
233
|
-
const value = baseObject[key];
|
|
234
|
-
if (value === null || value === void 0) {
|
|
235
|
-
continue;
|
|
236
|
-
}
|
|
237
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
241
|
-
object[key] = [...value, ...object[key]];
|
|
242
|
-
} else if (isObject(value) && isObject(object[key])) {
|
|
243
|
-
object[key] = _defu(
|
|
244
|
-
value,
|
|
245
|
-
object[key],
|
|
246
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
247
|
-
merger
|
|
248
|
-
);
|
|
249
|
-
} else {
|
|
250
|
-
object[key] = value;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return object;
|
|
254
|
-
}
|
|
255
|
-
function createDefu(merger) {
|
|
256
|
-
return (...arguments_) => (
|
|
257
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
258
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
const defu = createDefu();
|
|
262
|
-
|
|
263
318
|
function generateCode(match, options = {}) {
|
|
264
319
|
const ast = parser.parseExpression(match);
|
|
265
320
|
traverse__default["default"](ast, {
|
|
@@ -425,7 +480,7 @@ function createTemplateHandler(options = {}) {
|
|
|
425
480
|
}
|
|
426
481
|
|
|
427
482
|
function styleHandler(rawSource, options) {
|
|
428
|
-
return postcss__default["default"]([postcss$1.postcssWeappTailwindcss(options)
|
|
483
|
+
return postcss__default["default"]([postcssIsPseudoClass__default["default"](), postcss$1.postcssWeappTailwindcss(options)]).process(rawSource).css;
|
|
429
484
|
}
|
|
430
485
|
function createStyleHandler(options) {
|
|
431
486
|
return (rawSource, opt) => {
|
|
@@ -649,10 +704,10 @@ function getOptions(options = {}) {
|
|
|
649
704
|
options.supportCustomLengthUnitsPatch = undefined;
|
|
650
705
|
}
|
|
651
706
|
if (options.customReplaceDictionary === 'simple') {
|
|
652
|
-
options.customReplaceDictionary = escape.SimpleMappingChars2String;
|
|
707
|
+
options.customReplaceDictionary = escape$1.SimpleMappingChars2String;
|
|
653
708
|
}
|
|
654
709
|
else if (options.customReplaceDictionary === 'complex') {
|
|
655
|
-
options.customReplaceDictionary = escape.MappingChars2String;
|
|
710
|
+
options.customReplaceDictionary = escape$1.MappingChars2String;
|
|
656
711
|
}
|
|
657
712
|
normalizeMatcher(options, 'cssMatcher');
|
|
658
713
|
normalizeMatcher(options, 'htmlMatcher');
|
|
@@ -662,7 +717,7 @@ function getOptions(options = {}) {
|
|
|
662
717
|
const result = defu(options, defaults.defaultOptions, {
|
|
663
718
|
minifiedJs: isProd()
|
|
664
719
|
});
|
|
665
|
-
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy } = result;
|
|
720
|
+
const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy, cssSelectorReplacement } = result;
|
|
666
721
|
result.escapeMap = customReplaceDictionary;
|
|
667
722
|
const cssInjectPreflight = createInjectPreflight(cssPreflight);
|
|
668
723
|
const customAttributesEntities = defaults.isMap(options.customAttributes)
|
|
@@ -679,16 +734,18 @@ function getOptions(options = {}) {
|
|
|
679
734
|
escapeMap,
|
|
680
735
|
mangleContext,
|
|
681
736
|
cssChildCombinatorReplaceValue,
|
|
682
|
-
injectAdditionalCssVarScope
|
|
737
|
+
injectAdditionalCssVarScope,
|
|
738
|
+
cssSelectorReplacement
|
|
683
739
|
});
|
|
684
740
|
result.styleHandler = styleHandler;
|
|
685
|
-
const jsHandler =
|
|
741
|
+
const jsHandler = createJsHandler({
|
|
686
742
|
minifiedJs,
|
|
687
743
|
escapeMap,
|
|
688
744
|
mangleContext,
|
|
689
745
|
arbitraryValues,
|
|
690
746
|
jsPreserveClass,
|
|
691
|
-
strategy: jsEscapeStrategy
|
|
747
|
+
strategy: jsEscapeStrategy,
|
|
748
|
+
generateMap: true
|
|
692
749
|
});
|
|
693
750
|
result.jsHandler = jsHandler;
|
|
694
751
|
const templateHandler = createTemplateHandler({
|