weapp-tailwindcss 2.3.3 → 2.4.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,15 +1,15 @@
1
- import { m as makeCustomAttributes, t as tagWithEitherClassAndHoverClassRegexp, a as templateClassExactRegexp, v as variableMatch, b as variableRegExp, n as noop, s as splitCode, e as escapeStringRegexp, u as useStore, S as SimpleMappingChars2String, M as MappingChars2String, i as isMap } from './shared-eae1dc7a.mjs';
2
1
  import { isMatch } from 'micromatch';
2
+ import * as t from '@babel/types';
3
3
  import generate from '@babel/generator';
4
- import { parseExpression, parse } from '@babel/parser';
4
+ import { parse, parseExpression } from '@babel/parser';
5
5
  import traverse from '@babel/traverse';
6
6
  import { replaceJs as replaceWxml } from './replace.mjs';
7
- import * as t from '@babel/types';
7
+ import { s as splitCode, e as escapeStringRegexp, u as useStore, n as noop, S as SimpleMappingChars2String, m as makeCustomAttributes, t as tagWithEitherClassAndHoverClassRegexp, a as templateClassExactRegexp, v as variableMatch, b as variableRegExp, M as MappingChars2String, i as isMap } from './shared-89ea7f77.mjs';
8
8
  import postcss from 'postcss';
9
- import { p as postcssWeappTailwindcss } from './postcss-1f9a5153.mjs';
9
+ import { p as postcssWeappTailwindcss } from './postcss-e3fcf6f1.mjs';
10
10
  import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
11
- import path from 'path';
12
- import fs from 'fs';
11
+ import path from 'node:path';
12
+ import fs from 'node:fs';
13
13
  import { gte } from 'semver';
14
14
  import { monkeyPatchForExposingContext, requireResolve, TailwindcssPatcher } from 'tailwindcss-patch';
15
15
 
@@ -55,6 +55,145 @@ function createDefu(merger) {
55
55
  }
56
56
  const defu = createDefu();
57
57
 
58
+ const isProd = () => process.env.NODE_ENV === 'production';
59
+
60
+ function handleValue(str, node, options) {
61
+ const set = options.classNameSet;
62
+ const escapeMap = options.escapeMap;
63
+ const arr = splitCode(str);
64
+ let rawStr = str;
65
+ for (const v of arr) {
66
+ if (set.has(v)) {
67
+ let ignoreFlag = false;
68
+ if (Array.isArray(node.leadingComments)) {
69
+ ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
70
+ }
71
+ if (!ignoreFlag) {
72
+ const { jsHandler } = useStore();
73
+ rawStr = jsHandler(rawStr);
74
+ rawStr = rawStr.replaceAll(new RegExp(escapeStringRegexp(v), 'g'), replaceWxml(v, {
75
+ escapeMap
76
+ }));
77
+ }
78
+ }
79
+ }
80
+ return rawStr;
81
+ }
82
+ function jsHandler(rawSource, options) {
83
+ var _a;
84
+ const ast = parse(rawSource, {
85
+ sourceType: 'unambiguous'
86
+ });
87
+ const topt = {
88
+ StringLiteral: {
89
+ enter(p) {
90
+ const n = p.node;
91
+ n.value = handleValue(n.value, n, options);
92
+ }
93
+ },
94
+ TemplateElement: {
95
+ enter(p) {
96
+ const n = p.node;
97
+ n.value.raw = handleValue(n.value.raw, n, options);
98
+ }
99
+ },
100
+ CallExpression: {
101
+ enter(p) {
102
+ const n = p.node;
103
+ if (t.isIdentifier(n.callee) && n.callee.name === 'eval' && t.isStringLiteral(n.arguments[0])) {
104
+ const res = jsHandler(n.arguments[0].value, options);
105
+ if (res.code) {
106
+ n.arguments[0].value = res.code;
107
+ }
108
+ }
109
+ }
110
+ },
111
+ noScope: true
112
+ };
113
+ traverse(ast, topt);
114
+ return generate(ast, {
115
+ minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
116
+ });
117
+ }
118
+ function createjsHandler(options) {
119
+ return (rawSource, set) => {
120
+ return jsHandler(rawSource, {
121
+ classNameSet: set,
122
+ minifiedJs: options.minifiedJs,
123
+ escapeMap: options.escapeMap
124
+ });
125
+ };
126
+ }
127
+
128
+ const defaultOptions = {
129
+ cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
130
+ htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
131
+ jsMatcher: (file) => {
132
+ if (file.includes('node_modules')) {
133
+ return false;
134
+ }
135
+ return /.+\.[cm]?js?$/.test(file);
136
+ },
137
+ mainCssChunkMatcher: (file, appType) => {
138
+ switch (appType) {
139
+ case 'uni-app': {
140
+ return /^common\/main/.test(file);
141
+ }
142
+ case 'uni-app-vite': {
143
+ return file.startsWith('app') || /^common\/main/.test(file);
144
+ }
145
+ case 'mpx': {
146
+ return file.startsWith('app');
147
+ }
148
+ case 'taro': {
149
+ return file.startsWith('app');
150
+ }
151
+ case 'remax': {
152
+ return file.startsWith('app');
153
+ }
154
+ case 'rax': {
155
+ return file.startsWith('bundle');
156
+ }
157
+ case 'native': {
158
+ return file.startsWith('app');
159
+ }
160
+ case 'kbone': {
161
+ return /^(?:common\/)?miniprogram-app/.test(file);
162
+ }
163
+ default: {
164
+ return true;
165
+ }
166
+ }
167
+ },
168
+ cssPreflight: {
169
+ 'box-sizing': 'border-box',
170
+ 'border-width': '0',
171
+ 'border-style': 'solid',
172
+ 'border-color': 'currentColor'
173
+ },
174
+ cssPreflightRange: 'view',
175
+ replaceUniversalSelectorWith: 'view',
176
+ disabled: false,
177
+ customRuleCallback: noop,
178
+ onLoad: noop,
179
+ onStart: noop,
180
+ onEnd: noop,
181
+ onUpdate: noop,
182
+ customAttributes: {},
183
+ customReplaceDictionary: SimpleMappingChars2String,
184
+ supportCustomLengthUnitsPatch: {
185
+ units: ['rpx'],
186
+ dangerousOptions: {
187
+ gteVersion: '3.0.0',
188
+ lengthUnitsFilePath: 'lib/util/dataTypes.js',
189
+ packageName: 'tailwindcss',
190
+ variableName: 'lengthUnits',
191
+ overwrite: true
192
+ }
193
+ },
194
+ appType: undefined
195
+ };
196
+
58
197
  function generateCode(match, options = {}) {
59
198
  const ast = parseExpression(match);
60
199
  traverse(ast, {
@@ -63,10 +202,8 @@ function generateCode(match, options = {}) {
63
202
  if (t.isMemberExpression(path.parent)) {
64
203
  return;
65
204
  }
66
- if (t.isBinaryExpression(path.parent)) {
67
- if (t.isConditionalExpression((_a = path.parentPath) === null || _a === void 0 ? void 0 : _a.parent)) {
68
- return;
69
- }
205
+ if (t.isBinaryExpression(path.parent) && t.isConditionalExpression((_a = path.parentPath) === null || _a === void 0 ? void 0 : _a.parent)) {
206
+ return;
70
207
  }
71
208
  path.node.value = replaceWxml(path.node.value, options);
72
209
  },
@@ -101,7 +238,7 @@ function extractSource(original) {
101
238
  }
102
239
  function templeteReplacer(original, options = {}) {
103
240
  const sources = extractSource(original);
104
- if (sources.length) {
241
+ if (sources.length > 0) {
105
242
  const resultArray = [];
106
243
  let p = 0;
107
244
  for (let i = 0; i < sources.length; i++) {
@@ -112,7 +249,7 @@ function templeteReplacer(original, options = {}) {
112
249
  escapeMap: options.escapeMap
113
250
  }));
114
251
  p = m.start;
115
- if (m.raw.trim().length) {
252
+ if (m.raw.trim().length > 0) {
116
253
  const code = generateCode(m.raw, options);
117
254
  const source = `{{${code}}}`;
118
255
  m.source = source;
@@ -131,7 +268,7 @@ function templeteReplacer(original, options = {}) {
131
268
  }
132
269
  }
133
270
  return resultArray
134
- .filter((x) => x)
271
+ .filter(Boolean)
135
272
  .join('')
136
273
  .trim();
137
274
  }
@@ -154,8 +291,7 @@ function customTempleteHandler(rawSource, options = {}) {
154
291
  const regexps = makeCustomAttributes(options.customAttributesEntities);
155
292
  if (regexps) {
156
293
  if (Array.isArray(regexps)) {
157
- for (let i = 0; i < regexps.length; i++) {
158
- const regexp = regexps[i];
294
+ for (const regexp of regexps) {
159
295
  source = source.replace(regexp.tagRegexp, (m0) => {
160
296
  return m0.replace(regexp.attrRegexp, (m1, className) => {
161
297
  return m1.replace(className, templeteReplacer(className, options));
@@ -188,8 +324,7 @@ const createInjectPreflight = (options) => {
188
324
  const result = [];
189
325
  if (options && typeof options === 'object') {
190
326
  const entries = Object.entries(options);
191
- for (let i = 0; i < entries.length; i++) {
192
- const [prop, value] = entries[i];
327
+ for (const [prop, value] of entries) {
193
328
  if (value !== false) {
194
329
  result.push({
195
330
  prop,
@@ -210,30 +345,26 @@ function findAstNode(content, options) {
210
345
  let changed = false;
211
346
  traverse(ast, {
212
347
  Identifier(path) {
213
- if (path.node.name === DOPTS.variableName) {
214
- if (t.isVariableDeclarator(path.parent)) {
215
- if (t.isArrayExpression(path.parent.init)) {
216
- arrayRef = path.parent.init;
217
- const set = new Set(path.parent.init.elements.map((x) => x.value));
218
- for (let i = 0; i < options.units.length; i++) {
219
- const unit = options.units[i];
220
- if (!set.has(unit)) {
221
- path.parent.init.elements = path.parent.init.elements.map((x) => {
222
- if (t.isStringLiteral(x)) {
223
- return {
224
- type: x === null || x === void 0 ? void 0 : x.type,
225
- value: x === null || x === void 0 ? void 0 : x.value
226
- };
227
- }
228
- return x;
229
- });
230
- path.parent.init.elements.push({
231
- type: 'StringLiteral',
232
- value: unit
233
- });
234
- changed = true;
348
+ if (path.node.name === DOPTS.variableName && t.isVariableDeclarator(path.parent) && t.isArrayExpression(path.parent.init)) {
349
+ arrayRef = path.parent.init;
350
+ const set = new Set(path.parent.init.elements.map((x) => x.value));
351
+ for (let i = 0; i < options.units.length; i++) {
352
+ const unit = options.units[i];
353
+ if (!set.has(unit)) {
354
+ path.parent.init.elements = path.parent.init.elements.map((x) => {
355
+ if (t.isStringLiteral(x)) {
356
+ return {
357
+ type: x === null || x === void 0 ? void 0 : x.type,
358
+ value: x === null || x === void 0 ? void 0 : x.value
359
+ };
235
360
  }
236
- }
361
+ return x;
362
+ });
363
+ path.parent.init.elements.push({
364
+ type: 'StringLiteral',
365
+ value: unit
366
+ });
367
+ changed = true;
237
368
  }
238
369
  }
239
370
  }
@@ -279,7 +410,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
279
410
  const DOPTS = dangerousOptions;
280
411
  const dataTypesFilePath = path.resolve(rootDir, DOPTS.lengthUnitsFilePath);
281
412
  const dataTypesFileContent = fs.readFileSync(dataTypesFilePath, {
282
- encoding: 'utf-8'
413
+ encoding: 'utf8'
283
414
  });
284
415
  const { arrayRef, changed } = findAstNode(dataTypesFileContent, options);
285
416
  if (arrayRef && changed) {
@@ -294,7 +425,7 @@ function monkeyPatchForSupportingCustomUnit(rootDir, options) {
294
425
  const newCode = prev + code + next;
295
426
  if (DOPTS.overwrite) {
296
427
  fs.writeFileSync((_a = DOPTS.destPath) !== null && _a !== void 0 ? _a : dataTypesFilePath, newCode, {
297
- encoding: 'utf-8'
428
+ encoding: 'utf8'
298
429
  });
299
430
  console.log('patch tailwindcss for custom length unit successfully!');
300
431
  }
@@ -322,148 +453,6 @@ function createTailwindcssPatcher() {
322
453
  });
323
454
  }
324
455
 
325
- const isProd = () => process.env.NODE_ENV === 'production';
326
-
327
- function handleValue(str, node, options) {
328
- const set = options.classNameSet;
329
- const escapeMap = options.escapeMap;
330
- const arr = splitCode(str);
331
- let rawStr = str;
332
- for (let i = 0; i < arr.length; i++) {
333
- const v = arr[i];
334
- if (set.has(v)) {
335
- let ignoreFlag = false;
336
- if (Array.isArray(node.leadingComments)) {
337
- ignoreFlag = node.leadingComments.findIndex((x) => x.value.includes('weapp-tw') && x.value.includes('ignore')) > -1;
338
- }
339
- if (!ignoreFlag) {
340
- const { jsHandler } = useStore();
341
- rawStr = jsHandler(rawStr);
342
- rawStr = rawStr.replace(new RegExp(escapeStringRegexp(v), 'g'), replaceWxml(v, {
343
- escapeMap
344
- }));
345
- }
346
- }
347
- }
348
- return rawStr;
349
- }
350
- function jsHandler(rawSource, options) {
351
- var _a;
352
- const ast = parse(rawSource, {
353
- sourceType: 'unambiguous'
354
- });
355
- const topt = {
356
- StringLiteral: {
357
- enter(p) {
358
- const n = p.node;
359
- n.value = handleValue(n.value, n, options);
360
- }
361
- },
362
- TemplateElement: {
363
- enter(p) {
364
- const n = p.node;
365
- n.value.raw = handleValue(n.value.raw, n, options);
366
- }
367
- },
368
- CallExpression: {
369
- enter(p) {
370
- const n = p.node;
371
- if (t.isIdentifier(n.callee) && n.callee.name === 'eval') {
372
- if (t.isStringLiteral(n.arguments[0])) {
373
- const res = jsHandler(n.arguments[0].value, options);
374
- if (res.code) {
375
- n.arguments[0].value = res.code;
376
- }
377
- }
378
- }
379
- }
380
- },
381
- noScope: true
382
- };
383
- traverse(ast, topt);
384
- return generate(ast, {
385
- minified: (_a = options.minifiedJs) !== null && _a !== void 0 ? _a : isProd()
386
- });
387
- }
388
- function createjsHandler(options) {
389
- return (rawSource, set) => {
390
- return jsHandler(rawSource, {
391
- classNameSet: set,
392
- minifiedJs: options.minifiedJs,
393
- escapeMap: options.escapeMap
394
- });
395
- };
396
- }
397
-
398
- const defaultOptions = {
399
- cssMatcher: (file) => /.+\.(?:wx|ac|jx|tt|q|c)ss$/.test(file),
400
- htmlMatcher: (file) => /.+\.(?:(?:(?:wx|ax|jx|ks|tt|q)ml)|swan)$/.test(file),
401
- jsMatcher: (file) => {
402
- if (file.includes('node_modules')) {
403
- return false;
404
- }
405
- return /.+\.[cm]?[jt]sx?$/.test(file);
406
- },
407
- mainCssChunkMatcher: (file, appType) => {
408
- switch (appType) {
409
- case 'uni-app': {
410
- return /^common\/main/.test(file);
411
- }
412
- case 'uni-app-vite': {
413
- return /^app/.test(file) || /^common\/main/.test(file);
414
- }
415
- case 'mpx': {
416
- return /^app/.test(file);
417
- }
418
- case 'taro': {
419
- return /^app/.test(file);
420
- }
421
- case 'remax': {
422
- return /^app/.test(file);
423
- }
424
- case 'rax': {
425
- return /^bundle/.test(file);
426
- }
427
- case 'native': {
428
- return /^app/.test(file);
429
- }
430
- case 'kbone': {
431
- return /^(?:common\/)?miniprogram-app/.test(file);
432
- }
433
- default: {
434
- return true;
435
- }
436
- }
437
- },
438
- cssPreflight: {
439
- 'box-sizing': 'border-box',
440
- 'border-width': '0',
441
- 'border-style': 'solid',
442
- 'border-color': 'currentColor'
443
- },
444
- cssPreflightRange: 'view',
445
- replaceUniversalSelectorWith: 'view',
446
- disabled: false,
447
- customRuleCallback: noop,
448
- onLoad: noop,
449
- onStart: noop,
450
- onEnd: noop,
451
- onUpdate: noop,
452
- customAttributes: {},
453
- customReplaceDictionary: SimpleMappingChars2String,
454
- supportCustomLengthUnitsPatch: {
455
- units: ['rpx'],
456
- dangerousOptions: {
457
- gteVersion: '3.0.0',
458
- lengthUnitsFilePath: 'lib/util/dataTypes.js',
459
- packageName: 'tailwindcss',
460
- variableName: 'lengthUnits',
461
- overwrite: true
462
- }
463
- },
464
- appType: undefined
465
- };
466
-
467
456
  function createGlobMatcher(pattern) {
468
457
  return function (file) {
469
458
  return isMatch(file, pattern);
@@ -505,17 +494,12 @@ function getOptions(options = {}, modules = ['style', 'templete', 'patch', 'js']
505
494
  const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch } = result;
506
495
  result.escapeMap = customReplaceDictionary;
507
496
  const cssInjectPreflight = createInjectPreflight(cssPreflight);
508
- let customAttributesEntities;
509
- if (isMap(options.customAttributes)) {
510
- customAttributesEntities = Array.from(options.customAttributes.entries());
511
- }
512
- else {
513
- customAttributesEntities = Object.entries(customAttributes);
514
- }
497
+ const customAttributesEntities = isMap(options.customAttributes) ? [...options.customAttributes.entries()] : Object.entries(customAttributes);
498
+ const { escapeMap, minifiedJs } = result;
515
499
  if (registerModules.templete) {
516
500
  result.templeteHandler = createTempleteHandler({
517
501
  customAttributesEntities,
518
- escapeMap: result.escapeMap
502
+ escapeMap
519
503
  });
520
504
  }
521
505
  if (registerModules.style) {
@@ -524,13 +508,13 @@ function getOptions(options = {}, modules = ['style', 'templete', 'patch', 'js']
524
508
  customRuleCallback,
525
509
  cssPreflightRange,
526
510
  replaceUniversalSelectorWith,
527
- escapeMap: result.escapeMap
511
+ escapeMap
528
512
  });
529
513
  }
530
514
  if (registerModules.js) {
531
515
  result.jsHandler = createjsHandler({
532
- minifiedJs: result.minifiedJs,
533
- escapeMap: result.escapeMap
516
+ minifiedJs,
517
+ escapeMap
534
518
  });
535
519
  }
536
520
  if (registerModules.patch) {
@@ -1,6 +1,6 @@
1
1
  import type { PluginCreator } from 'postcss';
2
2
  import type { IStyleHandlerOptions } from "../types";
3
- import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
4
3
  export type PostcssWeappTailwindcssRenamePlugin = PluginCreator<IStyleHandlerOptions>;
5
4
  declare const postcssWeappTailwindcss: PostcssWeappTailwindcssRenamePlugin;
6
- export { postcssWeappTailwindcss, postcssIsPseudoClass };
5
+ export { postcssWeappTailwindcss, };
6
+ export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var selectorParser = require('postcss-selector-parser');
4
- var shared = require('./shared-c2953d9d.js');
4
+ var shared = require('./shared-9744fdd1.js');
5
5
  var postcss = require('postcss');
6
6
  require('@csstools/postcss-is-pseudo-class');
7
7
 
@@ -59,16 +59,15 @@ function testIfVariablesScope(node, count = 1) {
59
59
  return false;
60
60
  }
61
61
  function commonChunkPreflight(node, options) {
62
- node.selector = node.selector.replace(BROAD_MATCH_GLOBAL_REGEXP, 'view + view');
62
+ node.selector = node.selector.replaceAll(BROAD_MATCH_GLOBAL_REGEXP, 'view + view');
63
63
  if (testIfVariablesScope(node)) {
64
64
  const selectorParts = node.selector.split(',');
65
65
  if (!selectorParts.includes('view')) {
66
66
  selectorParts.push('view');
67
67
  }
68
- if (options.cssPreflightRange === 'all') {
69
- if (!selectorParts.includes(':not(not)')) {
70
- selectorParts.push(':not(not)');
71
- }
68
+ if (options.cssPreflightRange === 'all' &&
69
+ !selectorParts.includes(':not(not)')) {
70
+ selectorParts.push(':not(not)');
72
71
  }
73
72
  node.selector = selectorParts.join(',');
74
73
  if (typeof options.cssInjectPreflight === 'function') {
@@ -1,5 +1,5 @@
1
1
  import selectorParser from 'postcss-selector-parser';
2
- import { f as internalCssSelectorReplacer } from './shared-eae1dc7a.mjs';
2
+ import { f as internalCssSelectorReplacer } from './shared-89ea7f77.mjs';
3
3
  import { Rule, Declaration } from 'postcss';
4
4
  import '@csstools/postcss-is-pseudo-class';
5
5
 
@@ -53,16 +53,15 @@ function testIfVariablesScope(node, count = 1) {
53
53
  return false;
54
54
  }
55
55
  function commonChunkPreflight(node, options) {
56
- node.selector = node.selector.replace(BROAD_MATCH_GLOBAL_REGEXP, 'view + view');
56
+ node.selector = node.selector.replaceAll(BROAD_MATCH_GLOBAL_REGEXP, 'view + view');
57
57
  if (testIfVariablesScope(node)) {
58
58
  const selectorParts = node.selector.split(',');
59
59
  if (!selectorParts.includes('view')) {
60
60
  selectorParts.push('view');
61
61
  }
62
- if (options.cssPreflightRange === 'all') {
63
- if (!selectorParts.includes(':not(not)')) {
64
- selectorParts.push(':not(not)');
65
- }
62
+ if (options.cssPreflightRange === 'all' &&
63
+ !selectorParts.includes(':not(not)')) {
64
+ selectorParts.push(':not(not)');
66
65
  }
67
66
  node.selector = selectorParts.join(',');
68
67
  if (typeof options.cssInjectPreflight === 'function') {
package/dist/postcss.js CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var postcss = require('./postcss-dc9eeafc.js');
5
+ var postcss = require('./postcss-0c103b15.js');
6
6
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
7
7
  require('postcss-selector-parser');
8
- require('./shared-c2953d9d.js');
8
+ require('./shared-9744fdd1.js');
9
9
  require('tailwindcss-mangle-shared');
10
10
  require('postcss');
11
11
 
package/dist/postcss.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { p as postcssWeappTailwindcss } from './postcss-1f9a5153.mjs';
1
+ export { p as postcssWeappTailwindcss } from './postcss-e3fcf6f1.mjs';
2
2
  export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
3
3
  import 'postcss-selector-parser';
4
- import './shared-eae1dc7a.mjs';
4
+ import './shared-89ea7f77.mjs';
5
5
  import 'tailwindcss-mangle-shared';
6
6
  import 'postcss';
package/dist/replace.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { replaceWxml as replaceJs } from './wxml/shared';
2
- import { internalCssSelectorReplacer as replaceCss } from './postcss/shared';
3
1
  export * from './dic';
4
- export { replaceJs, replaceCss };
2
+ export { replaceWxml as replaceJs } from './wxml/shared';
3
+ export { internalCssSelectorReplacer as replaceCss } from './postcss/shared';
package/dist/replace.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var shared = require('./shared-c2953d9d.js');
5
+ var shared = require('./shared-9744fdd1.js');
6
6
  require('tailwindcss-mangle-shared');
7
7
 
8
8
  function replaceWxml(original, options = {
@@ -17,7 +17,7 @@ function replaceWxml(original, options = {
17
17
  let res = original;
18
18
  if (!options.keepEOL) {
19
19
  res = res
20
- .replace(/[\r\n]+/g, '');
20
+ .replaceAll(/[\n\r]+/g, '');
21
21
  }
22
22
  const { wxmlHandler } = shared.useStore();
23
23
  res = wxmlHandler(res);
package/dist/replace.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { h as escape, S as SimpleMappingChars2String, u as useStore } from './shared-eae1dc7a.mjs';
2
- export { M as MappingChars2String, k as MappingChars2StringEntries, j as SYMBOL_TABLE, l as SimpleMappingChars2StringEntries, f as replaceCss } from './shared-eae1dc7a.mjs';
1
+ import { h as escape, S as SimpleMappingChars2String, u as useStore } from './shared-89ea7f77.mjs';
2
+ export { M as MappingChars2String, k as MappingChars2StringEntries, j as SYMBOL_TABLE, l as SimpleMappingChars2StringEntries, f as replaceCss } from './shared-89ea7f77.mjs';
3
3
  import 'tailwindcss-mangle-shared';
4
4
 
5
5
  function replaceWxml(original, options = {
@@ -14,7 +14,7 @@ function replaceWxml(original, options = {
14
14
  let res = original;
15
15
  if (!options.keepEOL) {
16
16
  res = res
17
- .replace(/[\r\n]+/g, '');
17
+ .replaceAll(/[\n\r]+/g, '');
18
18
  }
19
19
  const { wxmlHandler } = useStore();
20
20
  res = wxmlHandler(res);