weapp-tailwindcss 2.6.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,172 +1,53 @@
1
1
  'use strict';
2
2
 
3
3
  var micromatch = require('micromatch');
4
- var t = require('@babel/types');
4
+ var MagicString = require('magic-string');
5
+ var replace = require('./replace.js');
6
+ var regex = require('@weapp-core/regex');
5
7
  var generate = require('@babel/generator');
6
8
  var parser = require('@babel/parser');
7
9
  var traverse = require('@babel/traverse');
8
- var replace = require('./replace.js');
9
- var defaults = require('./defaults-d79e9245.js');
10
+ var defaults = require('./defaults-344ba6d9.js');
11
+ var t = require('@babel/types');
10
12
  var postcss = require('postcss');
11
- var postcss$1 = require('./postcss-4c88cd6d.js');
13
+ var postcss$1 = require('./postcss-4e99a8e8.js');
12
14
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
13
- var dic = require('./dic-05980807.js');
15
+ var escape = require('@weapp-core/escape');
14
16
  var path = require('node:path');
15
17
  var fs = require('node:fs');
16
18
  var semver = require('semver');
17
19
  var tailwindcssPatch = require('tailwindcss-patch');
18
- var tailwindcssMangleShared = require('tailwindcss-mangle-shared');
20
+ var shared = require('@tailwindcss-mangle/shared');
19
21
 
20
22
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
23
 
22
24
  function _interopNamespaceCompat(e) {
23
- if (e && typeof e === 'object' && 'default' in e) return e;
24
- var n = Object.create(null);
25
- if (e) {
26
- Object.keys(e).forEach(function (k) {
27
- if (k !== 'default') {
28
- var d = Object.getOwnPropertyDescriptor(e, k);
29
- Object.defineProperty(n, k, d.get ? d : {
30
- enumerable: true,
31
- get: function () { return e[k]; }
25
+ if (e && typeof e === 'object' && 'default' in e) return e;
26
+ var n = Object.create(null);
27
+ if (e) {
28
+ Object.keys(e).forEach(function (k) {
29
+ if (k !== 'default') {
30
+ var d = Object.getOwnPropertyDescriptor(e, k);
31
+ Object.defineProperty(n, k, d.get ? d : {
32
+ enumerable: true,
33
+ get: function () { return e[k]; }
34
+ });
35
+ }
32
36
  });
33
- }
34
- });
35
- }
36
- n["default"] = e;
37
- return Object.freeze(n);
37
+ }
38
+ n["default"] = e;
39
+ return Object.freeze(n);
38
40
  }
39
41
 
40
- var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
42
+ var MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
41
43
  var generate__default = /*#__PURE__*/_interopDefaultCompat(generate);
42
44
  var traverse__default = /*#__PURE__*/_interopDefaultCompat(traverse);
45
+ var t__namespace = /*#__PURE__*/_interopNamespaceCompat(t);
43
46
  var postcss__default = /*#__PURE__*/_interopDefaultCompat(postcss);
44
47
  var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
45
48
  var path__default = /*#__PURE__*/_interopDefaultCompat(path);
46
49
  var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
47
50
 
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
51
  const validateFilterRE = /[\w%-?\u00A0-\uFFFF-]/;
171
52
  function isValidSelector(selector = '') {
172
53
  return validateFilterRE.test(selector);
@@ -176,9 +57,7 @@ const splitCode = (code, allowDoubleQuotes = false) => {
176
57
  return code.split(splitter).filter((element) => isValidSelector(element));
177
58
  };
178
59
 
179
- const isProd = () => process.env.NODE_ENV === 'production';
180
-
181
- function handleValue(str, node, options) {
60
+ function regenerateHandleValue(str, node, options) {
182
61
  var _a;
183
62
  const set = options.classNameSet;
184
63
  const escapeMap = options.escapeMap;
@@ -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
  }
@@ -205,44 +84,126 @@ function handleValue(str, node, options) {
205
84
  }
206
85
  return rawStr;
207
86
  }
87
+ function replaceHandleValue(str, node, options, ms, offset = 1) {
88
+ var _a;
89
+ const set = options.classNameSet;
90
+ const escapeMap = options.escapeMap;
91
+ const allowDoubleQuotes = (_a = options.arbitraryValues) === null || _a === void 0 ? void 0 : _a.allowDoubleQuotes;
92
+ const ctx = options.mangleContext;
93
+ const jsPreserveClass = options.jsPreserveClass;
94
+ const arr = splitCode(str, allowDoubleQuotes);
95
+ let rawStr = str;
96
+ for (const v of arr) {
97
+ if (set.has(v) && !(jsPreserveClass === null || jsPreserveClass === void 0 ? void 0 : jsPreserveClass(v))) {
98
+ let ignoreFlag = false;
99
+ if (Array.isArray(node.leadingComments)) {
100
+ ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
101
+ }
102
+ if (!ignoreFlag) {
103
+ if (ctx) {
104
+ rawStr = ctx.jsHandler(rawStr);
105
+ }
106
+ rawStr = rawStr.replaceAll(new RegExp(regex.escapeStringRegexp(v), 'g'), replace.replaceJs(v, {
107
+ escapeMap
108
+ }));
109
+ }
110
+ }
111
+ }
112
+ if (typeof node.start === 'number' && typeof node.end === 'number') {
113
+ const start = node.start + offset;
114
+ const end = node.end - offset;
115
+ if (start < end) {
116
+ ms.update(node.start + offset, node.end - offset, rawStr);
117
+ }
118
+ }
119
+ return rawStr;
120
+ }
121
+
122
+ const isProd = () => process.env.NODE_ENV === 'production';
123
+
208
124
  function jsHandler(rawSource, options) {
209
125
  var _a;
210
126
  const ast = parser.parse(rawSource, {
211
127
  sourceType: 'unambiguous'
212
128
  });
213
- const topt = {
214
- StringLiteral: {
215
- enter(p) {
216
- const n = p.node;
217
- n.value = handleValue(n.value, n, options);
218
- }
219
- },
220
- TemplateElement: {
221
- enter(p) {
222
- const n = p.node;
223
- n.value.raw = handleValue(n.value.raw, n, options);
129
+ if (options.strategy === 'replace') {
130
+ const ms = new MagicString__default["default"](rawSource);
131
+ const ropt = {
132
+ StringLiteral: {
133
+ enter(p) {
134
+ const n = p.node;
135
+ replaceHandleValue(n.value, n, options, ms);
136
+ }
137
+ },
138
+ TemplateElement: {
139
+ enter(p) {
140
+ const n = p.node;
141
+ replaceHandleValue(n.value.raw, n, options, ms, 0);
142
+ }
143
+ },
144
+ CallExpression: {
145
+ enter(p) {
146
+ const calleePath = p.get('callee');
147
+ if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
148
+ p.traverse({
149
+ StringLiteral: {
150
+ enter(s) {
151
+ const res = jsHandler(s.node.value, options);
152
+ if (res.code) {
153
+ s.node.value = res.code;
154
+ }
155
+ }
156
+ }
157
+ });
158
+ }
159
+ }
224
160
  }
225
- },
226
- CallExpression: {
227
- enter(p) {
228
- const n = p.node;
229
- if (t__namespace.isIdentifier(n.callee) && n.callee.name === 'eval' && t__namespace.isStringLiteral(n.arguments[0])) {
230
- const res = jsHandler(n.arguments[0].value, options);
231
- if (res.code) {
232
- n.arguments[0].value = res.code;
161
+ };
162
+ traverse__default["default"](ast, ropt);
163
+ return {
164
+ code: ms.toString()
165
+ };
166
+ }
167
+ else {
168
+ const gopt = {
169
+ StringLiteral: {
170
+ enter(p) {
171
+ const n = p.node;
172
+ n.value = regenerateHandleValue(n.value, n, options);
173
+ }
174
+ },
175
+ TemplateElement: {
176
+ enter(p) {
177
+ const n = p.node;
178
+ n.value.raw = regenerateHandleValue(n.value.raw, n, options);
179
+ }
180
+ },
181
+ CallExpression: {
182
+ enter(p) {
183
+ const calleePath = p.get('callee');
184
+ if (calleePath.isIdentifier() && calleePath.node.name === 'eval') {
185
+ p.traverse({
186
+ StringLiteral: {
187
+ enter(s) {
188
+ const res = jsHandler(s.node.value, options);
189
+ if (res.code) {
190
+ s.node.value = res.code;
191
+ }
192
+ }
193
+ }
194
+ });
233
195
  }
234
196
  }
235
197
  }
236
- },
237
- noScope: true
238
- };
239
- traverse__default["default"](ast, topt);
240
- return generate__default["default"](ast, {
241
- minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
242
- });
198
+ };
199
+ traverse__default["default"](ast, gopt);
200
+ return generate__default["default"](ast, {
201
+ minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
202
+ });
203
+ }
243
204
  }
244
205
  function createjsHandler(options) {
245
- const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass } = options;
206
+ const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy } = options;
246
207
  return (rawSource, set) => {
247
208
  return jsHandler(rawSource, {
248
209
  classNameSet: set,
@@ -250,11 +211,54 @@ function createjsHandler(options) {
250
211
  escapeMap,
251
212
  arbitraryValues,
252
213
  mangleContext,
253
- jsPreserveClass
214
+ jsPreserveClass,
215
+ strategy
254
216
  });
255
217
  };
256
218
  }
257
219
 
220
+ function isObject(value) {
221
+ return value !== null && typeof value === "object";
222
+ }
223
+ function _defu(baseObject, defaults, namespace = ".", merger) {
224
+ if (!isObject(defaults)) {
225
+ return _defu(baseObject, {}, namespace, merger);
226
+ }
227
+ const object = Object.assign({}, defaults);
228
+ for (const key in baseObject) {
229
+ if (key === "__proto__" || key === "constructor") {
230
+ continue;
231
+ }
232
+ const value = baseObject[key];
233
+ if (value === null || value === void 0) {
234
+ continue;
235
+ }
236
+ if (merger && merger(object, key, value, namespace)) {
237
+ continue;
238
+ }
239
+ if (Array.isArray(value) && Array.isArray(object[key])) {
240
+ object[key] = [...value, ...object[key]];
241
+ } else if (isObject(value) && isObject(object[key])) {
242
+ object[key] = _defu(
243
+ value,
244
+ object[key],
245
+ (namespace ? `${namespace}.` : "") + key.toString(),
246
+ merger
247
+ );
248
+ } else {
249
+ object[key] = value;
250
+ }
251
+ }
252
+ return object;
253
+ }
254
+ function createDefu(merger) {
255
+ return (...arguments_) => (
256
+ // eslint-disable-next-line unicorn/no-array-reduce
257
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
258
+ );
259
+ }
260
+ const defu = createDefu();
261
+
258
262
  function generateCode(match, options = {}) {
259
263
  const ast = parser.parseExpression(match);
260
264
  traverse__default["default"](ast, {
@@ -296,7 +300,7 @@ function extract(original, reg) {
296
300
  return sources;
297
301
  }
298
302
  function extractSource(original) {
299
- return extract(original, variableRegExp);
303
+ return extract(original, regex.variableRegExp);
300
304
  }
301
305
  function templateReplacer(original, options = {}) {
302
306
  const sources = extractSource(original);
@@ -345,8 +349,8 @@ function templateHandler(rawSource, options = {}) {
345
349
  if (options.disabledDefaultTemplateHandler) {
346
350
  return rawSource;
347
351
  }
348
- return rawSource.replace(tagWithEitherClassAndHoverClassRegexp, (m0) => {
349
- return m0.replace(templateClassExactRegexp, (m1, className) => {
352
+ return rawSource.replace(regex.tagWithEitherClassAndHoverClassRegexp, (m0) => {
353
+ return m0.replace(regex.templateClassExactRegexp, (m1, className) => {
350
354
  return m1.replace(className, templateReplacer(className, options));
351
355
  });
352
356
  });
@@ -354,7 +358,7 @@ function templateHandler(rawSource, options = {}) {
354
358
  function customTemplateHandler(rawSource, options) {
355
359
  const { customAttributesEntities, inlineWxs, runtimeSet, jsHandler } = options;
356
360
  let source = templateHandler(rawSource, options);
357
- const regexps = makeCustomAttributes(customAttributesEntities);
361
+ const regexps = regex.makeCustomAttributes(customAttributesEntities);
358
362
  if (regexps && Array.isArray(regexps)) {
359
363
  for (const regexp of regexps) {
360
364
  source = source.replace(regexp.tagRegexp, (m0) => {
@@ -365,7 +369,7 @@ function customTemplateHandler(rawSource, options) {
365
369
  }
366
370
  }
367
371
  if (inlineWxs) {
368
- const wxsTags = extract(source, wxsTagRegexp);
372
+ const wxsTags = extract(source, regex.wxsTagRegexp);
369
373
  for (const x of wxsTags) {
370
374
  const code = jsHandler(x.raw, runtimeSet).code;
371
375
  source = source.replaceAll(x.raw, code);
@@ -529,8 +533,8 @@ function getSelf(x) {
529
533
  const defaultMangleContext = {
530
534
  rawOptions: false,
531
535
  runtimeSet: new Set(),
532
- classGenerator: new tailwindcssMangleShared.ClassGenerator(),
533
- filter: tailwindcssMangleShared.defaultMangleClassFilter,
536
+ classGenerator: new shared.ClassGenerator(),
537
+ filter: shared.defaultMangleClassFilter,
534
538
  cssHandler: getSelf,
535
539
  jsHandler: getSelf,
536
540
  wxmlHandler: getSelf
@@ -544,7 +548,7 @@ function useMangleStore() {
544
548
  const arr = splitCode(rawSource);
545
549
  for (const x of arr) {
546
550
  if (ctx.runtimeSet.has(x)) {
547
- rawSource = rawSource.replaceAll(new RegExp(escapeStringRegexp(x), 'g'), ctx.classGenerator.generateClassName(x).name);
551
+ rawSource = rawSource.replaceAll(new RegExp(regex.escapeStringRegexp(x), 'g'), ctx.classGenerator.generateClassName(x).name);
548
552
  }
549
553
  }
550
554
  return rawSource;
@@ -556,11 +560,11 @@ function useMangleStore() {
556
560
  if (options === true) {
557
561
  options = {
558
562
  classGenerator: {},
559
- mangleClassFilter: tailwindcssMangleShared.defaultMangleClassFilter
563
+ mangleClassFilter: shared.defaultMangleClassFilter
560
564
  };
561
565
  }
562
- ctx.classGenerator = new tailwindcssMangleShared.ClassGenerator(options.classGenerator);
563
- ctx.filter = (_a = options.mangleClassFilter) !== null && _a !== void 0 ? _a : tailwindcssMangleShared.defaultMangleClassFilter;
566
+ ctx.classGenerator = new shared.ClassGenerator(options.classGenerator);
567
+ ctx.filter = (_a = options.mangleClassFilter) !== null && _a !== void 0 ? _a : shared.defaultMangleClassFilter;
564
568
  ctx.jsHandler = (rawSource) => {
565
569
  return handleValue(rawSource);
566
570
  };
@@ -604,10 +608,10 @@ function getOptions(options = {}) {
604
608
  options.supportCustomLengthUnitsPatch = undefined;
605
609
  }
606
610
  if (options.customReplaceDictionary === 'simple') {
607
- options.customReplaceDictionary = dic.SimpleMappingChars2String;
611
+ options.customReplaceDictionary = escape.SimpleMappingChars2String;
608
612
  }
609
613
  else if (options.customReplaceDictionary === 'complex') {
610
- options.customReplaceDictionary = dic.MappingChars2String;
614
+ options.customReplaceDictionary = escape.MappingChars2String;
611
615
  }
612
616
  normalizeMatcher(options, 'cssMatcher');
613
617
  normalizeMatcher(options, 'htmlMatcher');
@@ -617,7 +621,7 @@ function getOptions(options = {}) {
617
621
  const result = defu(options, defaults.defaultOptions, {
618
622
  minifiedJs: isProd()
619
623
  });
620
- const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler } = result;
624
+ const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy } = result;
621
625
  result.escapeMap = customReplaceDictionary;
622
626
  const cssInjectPreflight = createInjectPreflight(cssPreflight);
623
627
  const customAttributesEntities = defaults.isMap(options.customAttributes)
@@ -642,7 +646,8 @@ function getOptions(options = {}) {
642
646
  escapeMap,
643
647
  mangleContext,
644
648
  arbitraryValues,
645
- jsPreserveClass
649
+ jsPreserveClass,
650
+ strategy: jsEscapeStrategy
646
651
  });
647
652
  result.jsHandler = jsHandler;
648
653
  const templateHandler = createTemplateHandler({
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var selectorParser = require('postcss-selector-parser');
4
- var shared = require('./shared-4eed0e5c.js');
4
+ var shared = require('./shared-df9de23f.js');
5
5
  var postcss = require('postcss');
6
6
  require('@csstools/postcss-is-pseudo-class');
7
7
 
@@ -1,5 +1,5 @@
1
1
  import selectorParser from 'postcss-selector-parser';
2
- import { i as internalCssSelectorReplacer } from './shared-686bfc32.mjs';
2
+ import { i as internalCssSelectorReplacer } from './shared-fd149084.mjs';
3
3
  import { Declaration, Rule } from 'postcss';
4
4
  import '@csstools/postcss-is-pseudo-class';
5
5
 
package/dist/postcss.js CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var postcss = require('./postcss-4c88cd6d.js');
5
+ var postcss = require('./postcss-4e99a8e8.js');
6
6
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
7
7
  require('postcss-selector-parser');
8
- require('./shared-4eed0e5c.js');
9
- require('./dic-05980807.js');
8
+ require('./shared-df9de23f.js');
9
+ require('@weapp-core/escape');
10
10
  require('postcss');
11
11
 
12
12
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
package/dist/postcss.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { p as postcssWeappTailwindcss } from './postcss-99efb521.mjs';
1
+ export { p as postcssWeappTailwindcss } from './postcss-a551ddc0.mjs';
2
2
  export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
3
3
  import 'postcss-selector-parser';
4
- import './shared-686bfc32.mjs';
5
- import './dic-3790a3a4.mjs';
4
+ import './shared-fd149084.mjs';
5
+ import '@weapp-core/escape';
6
6
  import 'postcss';
package/dist/reg.d.ts CHANGED
@@ -1,16 +1 @@
1
- import type { ICustomRegexp, ItemOrItemArray } from "./types";
2
- export declare function escapeStringRegexp(str: string): string;
3
- export declare const templateClassExactRegexp: RegExp;
4
- export declare const tagWithEitherClassAndHoverClassRegexp: RegExp;
5
- interface ICreateRegexpOptions {
6
- exact?: boolean;
7
- }
8
- export declare function handleRegexp(reg: RegExp): string;
9
- export declare function getSourceString(input: string | RegExp): string;
10
- export declare function makePattern(arr: ItemOrItemArray<string | RegExp>): string;
11
- export declare function createTemplateHandlerMatchRegexp(tag: string | RegExp, attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
12
- export declare function createTemplateClassRegexp(attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
13
- export declare function makeCustomAttributes(entries?: [string | RegExp, ItemOrItemArray<string | RegExp>][]): ICustomRegexp[] | undefined;
14
- export declare const variableRegExp: RegExp;
15
- export declare const wxsTagRegexp: RegExp;
16
- export {};
1
+ export * from '@weapp-core/regex';
package/dist/replace.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './dic';
1
+ export { MappingChars2String, MappingChars2StringEntries, MappingStringDictionary, SYMBOL_TABLE, SYMBOL_TABLE_TYPE, SYMBOL_TABLE_TYPE_VALUES, SimpleMappingChars2String, SimpleMappingChars2StringEntries } from './escape';
2
2
  export { replaceWxml as replaceJs } from './wxml/shared';
3
3
  export { internalCssSelectorReplacer as replaceCss } from './postcss/shared';
package/dist/replace.js CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dic = require('./dic-05980807.js');
6
- var shared = require('./shared-4eed0e5c.js');
5
+ var escape = require('@weapp-core/escape');
6
+ var shared = require('./shared-df9de23f.js');
7
7
 
8
8
  function replaceWxml(original, options = {
9
9
  keepEOL: false,
10
- escapeMap: dic.SimpleMappingChars2String
10
+ escapeMap: escape.SimpleMappingChars2String
11
11
  }) {
12
12
  const { keepEOL, escapeMap, mangleContext } = options;
13
13
  let res = original;
@@ -18,16 +18,31 @@ function replaceWxml(original, options = {
18
18
  if (mangleContext) {
19
19
  res = mangleContext.wxmlHandler(res);
20
20
  }
21
- res = shared.escape(res, {
21
+ res = escape.escape(res, {
22
22
  map: escapeMap
23
23
  });
24
24
  return res;
25
25
  }
26
26
 
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;
27
+ Object.defineProperty(exports, 'MappingChars2String', {
28
+ enumerable: true,
29
+ get: function () { return escape.MappingChars2String; }
30
+ });
31
+ Object.defineProperty(exports, 'MappingChars2StringEntries', {
32
+ enumerable: true,
33
+ get: function () { return escape.MappingChars2StringEntries; }
34
+ });
35
+ Object.defineProperty(exports, 'SYMBOL_TABLE', {
36
+ enumerable: true,
37
+ get: function () { return escape.SYMBOL_TABLE; }
38
+ });
39
+ Object.defineProperty(exports, 'SimpleMappingChars2String', {
40
+ enumerable: true,
41
+ get: function () { return escape.SimpleMappingChars2String; }
42
+ });
43
+ Object.defineProperty(exports, 'SimpleMappingChars2StringEntries', {
44
+ enumerable: true,
45
+ get: function () { return escape.SimpleMappingChars2StringEntries; }
46
+ });
32
47
  exports.replaceCss = shared.internalCssSelectorReplacer;
33
48
  exports.replaceJs = replaceWxml;
package/dist/replace.mjs CHANGED
@@ -1,7 +1,6 @@
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';
1
+ import { escape, SimpleMappingChars2String } from '@weapp-core/escape';
2
+ export { MappingChars2String, MappingChars2StringEntries, SYMBOL_TABLE, SimpleMappingChars2String, SimpleMappingChars2StringEntries } from '@weapp-core/escape';
3
+ export { i as replaceCss } from './shared-fd149084.mjs';
5
4
 
6
5
  function replaceWxml(original, options = {
7
6
  keepEOL: false,
@@ -22,4 +21,4 @@ function replaceWxml(original, options = {
22
21
  return res;
23
22
  }
24
23
 
25
- export { SimpleMappingChars2String, replaceWxml as replaceJs };
24
+ export { replaceWxml as replaceJs };