weapp-tailwindcss 2.6.0 → 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 +5 -3
- package/dist/cli.mjs +5 -3
- package/dist/defaults-c397b5f9.mjs +134 -0
- package/dist/defaults-d79e9245.js +140 -0
- package/dist/defaults.js +10 -0
- package/dist/defaults.mjs +2 -0
- package/dist/{shared-ae7dd073.js → dic-05980807.js} +0 -58
- package/dist/{shared-7c88fb94.mjs → dic-3790a3a4.mjs} +1 -57
- package/dist/gulp.js +7 -5
- package/dist/gulp.mjs +7 -5
- package/dist/index.js +5 -3
- package/dist/index.mjs +5 -3
- package/dist/{options-f7b71f03.mjs → options-244dcceb.mjs} +34 -148
- package/dist/{options-487394fa.js → options-c5e1d1b4.js} +41 -156
- package/dist/postcss/shared.d.ts +0 -1
- package/dist/{postcss-b53e9504.js → postcss-4c88cd6d.js} +35 -35
- package/dist/{postcss-760298ba.mjs → postcss-99efb521.mjs} +35 -35
- package/dist/postcss.js +3 -2
- package/dist/postcss.mjs +3 -2
- package/dist/reg.d.ts +1 -11
- package/dist/replace.js +8 -7
- package/dist/replace.mjs +4 -2
- package/dist/shared-4eed0e5c.js +62 -0
- package/dist/shared-686bfc32.mjs +59 -0
- package/dist/types.d.ts +6 -2
- package/dist/vite.js +8 -6
- package/dist/vite.mjs +7 -5
- package/dist/webpack.js +8 -6
- package/dist/webpack.mjs +7 -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 +19 -14
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var selectorParser = require('postcss-selector-parser');
|
|
4
|
-
var shared = require('./shared-
|
|
4
|
+
var shared = require('./shared-4eed0e5c.js');
|
|
5
5
|
var postcss = require('postcss');
|
|
6
6
|
require('@csstools/postcss-is-pseudo-class');
|
|
7
7
|
|
|
@@ -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
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import selectorParser from 'postcss-selector-parser';
|
|
2
|
-
import { i as internalCssSelectorReplacer } from './shared-
|
|
2
|
+
import { i as internalCssSelectorReplacer } from './shared-686bfc32.mjs';
|
|
3
3
|
import { Declaration, Rule } from 'postcss';
|
|
4
4
|
import '@csstools/postcss-is-pseudo-class';
|
|
5
5
|
|
|
@@ -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,10 +2,11 @@
|
|
|
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
|
-
require('./shared-
|
|
8
|
+
require('./shared-4eed0e5c.js');
|
|
9
|
+
require('./dic-05980807.js');
|
|
9
10
|
require('postcss');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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
|
-
import './shared-
|
|
4
|
+
import './shared-686bfc32.mjs';
|
|
5
|
+
import './dic-3790a3a4.mjs';
|
|
5
6
|
import 'postcss';
|
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/replace.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var dic = require('./dic-05980807.js');
|
|
6
|
+
var shared = require('./shared-4eed0e5c.js');
|
|
6
7
|
|
|
7
8
|
function replaceWxml(original, options = {
|
|
8
9
|
keepEOL: false,
|
|
9
|
-
escapeMap:
|
|
10
|
+
escapeMap: dic.SimpleMappingChars2String
|
|
10
11
|
}) {
|
|
11
12
|
const { keepEOL, escapeMap, mangleContext } = options;
|
|
12
13
|
let res = original;
|
|
@@ -23,10 +24,10 @@ function replaceWxml(original, options = {
|
|
|
23
24
|
return res;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
exports.MappingChars2String =
|
|
27
|
-
exports.MappingChars2StringEntries =
|
|
28
|
-
exports.SYMBOL_TABLE =
|
|
29
|
-
exports.SimpleMappingChars2String =
|
|
30
|
-
exports.SimpleMappingChars2StringEntries =
|
|
27
|
+
exports.MappingChars2String = dic.MappingChars2String;
|
|
28
|
+
exports.MappingChars2StringEntries = dic.MappingChars2StringEntries;
|
|
29
|
+
exports.SYMBOL_TABLE = dic.SYMBOL_TABLE;
|
|
30
|
+
exports.SimpleMappingChars2String = dic.SimpleMappingChars2String;
|
|
31
|
+
exports.SimpleMappingChars2StringEntries = dic.SimpleMappingChars2StringEntries;
|
|
31
32
|
exports.replaceCss = shared.internalCssSelectorReplacer;
|
|
32
33
|
exports.replaceJs = replaceWxml;
|
package/dist/replace.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { M as MappingChars2String, b as MappingChars2StringEntries, a as SYMBOL_TABLE, c as SimpleMappingChars2StringEntries
|
|
1
|
+
import { S as SimpleMappingChars2String } from './dic-3790a3a4.mjs';
|
|
2
|
+
export { M as MappingChars2String, b as MappingChars2StringEntries, a as SYMBOL_TABLE, c as SimpleMappingChars2StringEntries } from './dic-3790a3a4.mjs';
|
|
3
|
+
import { e as escape } from './shared-686bfc32.mjs';
|
|
4
|
+
export { i as replaceCss } from './shared-686bfc32.mjs';
|
|
3
5
|
|
|
4
6
|
function replaceWxml(original, options = {
|
|
5
7
|
keepEOL: false,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var dic = require('./dic-05980807.js');
|
|
4
|
+
|
|
5
|
+
const MAX_ASCII_CHAR_CODE = 127;
|
|
6
|
+
function isAsciiNumber(code) {
|
|
7
|
+
return code >= 48 && code <= 57;
|
|
8
|
+
}
|
|
9
|
+
function escape(selectors, options = {
|
|
10
|
+
map: dic.SimpleMappingChars2String
|
|
11
|
+
}) {
|
|
12
|
+
const { map = dic.SimpleMappingChars2String } = options;
|
|
13
|
+
const sb = [...selectors];
|
|
14
|
+
for (let i = 0; i < sb.length; i++) {
|
|
15
|
+
const char = sb[i];
|
|
16
|
+
const code = char.codePointAt(0);
|
|
17
|
+
const isCodeExisted = code !== undefined;
|
|
18
|
+
const hit = map[char];
|
|
19
|
+
if (isCodeExisted) {
|
|
20
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
21
|
+
sb[i] = 'u' + Number(code).toString(16);
|
|
22
|
+
}
|
|
23
|
+
else if (hit) {
|
|
24
|
+
sb[i] = hit;
|
|
25
|
+
}
|
|
26
|
+
else if (i === 0) {
|
|
27
|
+
if (isAsciiNumber(code)) {
|
|
28
|
+
sb[i] = '_' + char;
|
|
29
|
+
}
|
|
30
|
+
else if (char === '-') {
|
|
31
|
+
const nextChar = sb[i + 1];
|
|
32
|
+
if (nextChar) {
|
|
33
|
+
const nextCharCode = nextChar.codePointAt(0);
|
|
34
|
+
if (nextCharCode && isAsciiNumber(nextCharCode)) {
|
|
35
|
+
sb[i] = '_' + char;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (nextChar === undefined) {
|
|
39
|
+
sb[i] = '_' + char;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const res = sb.join('');
|
|
46
|
+
return res;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function internalCssSelectorReplacer(selectors, options = {
|
|
50
|
+
escapeMap: dic.SimpleMappingChars2String
|
|
51
|
+
}) {
|
|
52
|
+
const { mangleContext, escapeMap } = options;
|
|
53
|
+
if (mangleContext) {
|
|
54
|
+
selectors = mangleContext.cssHandler(selectors);
|
|
55
|
+
}
|
|
56
|
+
return escape(selectors, {
|
|
57
|
+
map: escapeMap
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.escape = escape;
|
|
62
|
+
exports.internalCssSelectorReplacer = internalCssSelectorReplacer;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { S as SimpleMappingChars2String } from './dic-3790a3a4.mjs';
|
|
2
|
+
|
|
3
|
+
const MAX_ASCII_CHAR_CODE = 127;
|
|
4
|
+
function isAsciiNumber(code) {
|
|
5
|
+
return code >= 48 && code <= 57;
|
|
6
|
+
}
|
|
7
|
+
function escape(selectors, options = {
|
|
8
|
+
map: SimpleMappingChars2String
|
|
9
|
+
}) {
|
|
10
|
+
const { map = SimpleMappingChars2String } = options;
|
|
11
|
+
const sb = [...selectors];
|
|
12
|
+
for (let i = 0; i < sb.length; i++) {
|
|
13
|
+
const char = sb[i];
|
|
14
|
+
const code = char.codePointAt(0);
|
|
15
|
+
const isCodeExisted = code !== undefined;
|
|
16
|
+
const hit = map[char];
|
|
17
|
+
if (isCodeExisted) {
|
|
18
|
+
if (code > MAX_ASCII_CHAR_CODE) {
|
|
19
|
+
sb[i] = 'u' + Number(code).toString(16);
|
|
20
|
+
}
|
|
21
|
+
else if (hit) {
|
|
22
|
+
sb[i] = hit;
|
|
23
|
+
}
|
|
24
|
+
else if (i === 0) {
|
|
25
|
+
if (isAsciiNumber(code)) {
|
|
26
|
+
sb[i] = '_' + char;
|
|
27
|
+
}
|
|
28
|
+
else if (char === '-') {
|
|
29
|
+
const nextChar = sb[i + 1];
|
|
30
|
+
if (nextChar) {
|
|
31
|
+
const nextCharCode = nextChar.codePointAt(0);
|
|
32
|
+
if (nextCharCode && isAsciiNumber(nextCharCode)) {
|
|
33
|
+
sb[i] = '_' + char;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (nextChar === undefined) {
|
|
37
|
+
sb[i] = '_' + char;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const res = sb.join('');
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function internalCssSelectorReplacer(selectors, options = {
|
|
48
|
+
escapeMap: SimpleMappingChars2String
|
|
49
|
+
}) {
|
|
50
|
+
const { mangleContext, escapeMap } = options;
|
|
51
|
+
if (mangleContext) {
|
|
52
|
+
selectors = mangleContext.cssHandler(selectors);
|
|
53
|
+
}
|
|
54
|
+
return escape(selectors, {
|
|
55
|
+
map: escapeMap
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { escape as e, internalCssSelectorReplacer as i };
|
package/dist/types.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type IJsHandlerOptions = {
|
|
|
38
38
|
minifiedJs?: boolean;
|
|
39
39
|
arbitraryValues?: IArbitraryValues;
|
|
40
40
|
mangleContext?: IMangleScopeContext;
|
|
41
|
+
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
41
42
|
};
|
|
42
43
|
export interface RawSource {
|
|
43
44
|
start: number;
|
|
@@ -91,6 +92,8 @@ export interface UserDefinedOptions {
|
|
|
91
92
|
wxsMatcher?: ((name: string) => boolean) | string | string[];
|
|
92
93
|
inlineWxs?: boolean;
|
|
93
94
|
injectAdditionalCssVarScope?: boolean;
|
|
95
|
+
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
96
|
+
disabledDefaultTemplateHandler?: boolean;
|
|
94
97
|
}
|
|
95
98
|
export interface IMangleScopeContext {
|
|
96
99
|
rawOptions: UserDefinedOptions['mangle'];
|
|
@@ -111,20 +114,21 @@ export type ICustomRegexp = {
|
|
|
111
114
|
tag: string;
|
|
112
115
|
attrs: ItemOrItemArray<string | RegExp>;
|
|
113
116
|
};
|
|
114
|
-
export interface
|
|
117
|
+
export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
115
118
|
customAttributesEntities?: ICustomAttributesEntities;
|
|
116
119
|
escapeMap?: Record<string, string>;
|
|
117
120
|
mangleContext?: IMangleScopeContext;
|
|
118
121
|
inlineWxs?: boolean;
|
|
119
122
|
jsHandler?: (rawSource: string, set: Set<string>) => GeneratorResult;
|
|
120
123
|
runtimeSet?: Set<string>;
|
|
124
|
+
disabledDefaultTemplateHandler?: boolean;
|
|
121
125
|
}
|
|
122
126
|
export type GlobOrFunctionMatchers = 'htmlMatcher' | 'cssMatcher' | 'jsMatcher' | 'mainCssChunkMatcher' | 'wxsMatcher';
|
|
123
127
|
export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, GlobOrFunctionMatchers | 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary'> & {
|
|
124
128
|
[K in GlobOrFunctionMatchers]: K extends 'mainCssChunkMatcher' ? (name: string, appType?: AppType) => boolean : (name: string) => boolean;
|
|
125
129
|
} & {
|
|
126
130
|
supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | false;
|
|
127
|
-
|
|
131
|
+
templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => string;
|
|
128
132
|
styleHandler: (rawSource: string, options: IStyleHandlerOptions) => string;
|
|
129
133
|
jsHandler: (rawSource: string, set: Set<string>) => GeneratorResult;
|
|
130
134
|
escapeMap: Record<string, string>;
|