weapp-tailwindcss 3.3.6 → 3.3.7
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 +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/gulp.js +2 -2
- package/dist/gulp.mjs +2 -2
- package/dist/{index-DB9QgUa3.js → index-B8TOcVAt.js} +1 -1
- package/dist/{index-BExhXAqi.mjs → index-BKZH-Gxq.mjs} +1 -1
- package/dist/{index-CIIWZLy7.mjs → index-Bc61v7B0.mjs} +1 -1
- package/dist/{index-o6B8-Dgr.js → index-DXeB6ex8.js} +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{options-EVe-3wGC.mjs → options-BHJnjA_a.mjs} +142 -1
- package/dist/{options-a5qXPOAM.js → options-DAp5AdGz.js} +142 -1
- package/dist/replace.js +2 -2
- package/dist/replace.mjs +2 -2
- package/dist/types.d.ts +1 -0
- package/dist/{v5-DCkl8s2F.mjs → v5-B9S3lBOs.mjs} +2 -2
- package/dist/{v5-B-T2TD9C.js → v5-QURRYPNk.js} +2 -2
- package/dist/vite.js +2 -2
- package/dist/vite.mjs +2 -2
- package/dist/webpack.js +2 -2
- package/dist/webpack.mjs +2 -2
- package/dist/webpack4.js +2 -2
- package/dist/webpack4.mjs +2 -2
- package/dist/wxml/Tokenizer.d.ts +31 -0
- package/dist/wxml/utils.d.ts +1 -0
- package/package.json +5 -8
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var process = require('node:process');
|
|
4
4
|
var semver = require('semver');
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-DAp5AdGz.js');
|
|
6
6
|
var index = require('./index-DwZHOkK3.js');
|
|
7
7
|
require('magic-string');
|
|
8
8
|
require('./replace.js');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import semver from 'semver';
|
|
3
|
-
import { g as getOptions } from './options-
|
|
3
|
+
import { g as getOptions } from './options-BHJnjA_a.mjs';
|
|
4
4
|
import { W as WEAPP_TW_REQUIRED_NODE_VERSION } from './index-BPzIdybK.mjs';
|
|
5
5
|
import 'magic-string';
|
|
6
6
|
import './replace.mjs';
|
package/dist/core.js
CHANGED
package/dist/core.mjs
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
6
|
-
require('./options-
|
|
5
|
+
var index = require('./index-B8TOcVAt.js');
|
|
6
|
+
require('./options-DAp5AdGz.js');
|
|
7
7
|
require('magic-string');
|
|
8
8
|
require('./replace.js');
|
|
9
9
|
require('@weapp-core/escape');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { c as createPlugins } from './index-
|
|
2
|
-
import './options-
|
|
1
|
+
export { c as createPlugins } from './index-Bc61v7B0.mjs';
|
|
2
|
+
import './options-BHJnjA_a.mjs';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
5
5
|
import '@weapp-core/escape';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-BHJnjA_a.mjs';
|
|
2
2
|
import { v as vitePluginName } from './index-BPzIdybK.mjs';
|
|
3
3
|
import { g as getGroupedEntries } from './defaults-DUZZvtdg.mjs';
|
|
4
4
|
import { c as createDebug } from './index-BEIjgKpF.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-BHJnjA_a.mjs';
|
|
2
2
|
import stream from 'node:stream';
|
|
3
3
|
import { Buffer } from 'node:buffer';
|
|
4
4
|
import { c as createDebug } from './index-BEIjgKpF.mjs';
|
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var v5 = require('./v5-
|
|
6
|
-
var index = require('./index-
|
|
7
|
-
var index$1 = require('./index-
|
|
8
|
-
require('./options-
|
|
5
|
+
var v5 = require('./v5-QURRYPNk.js');
|
|
6
|
+
var index = require('./index-DXeB6ex8.js');
|
|
7
|
+
var index$1 = require('./index-B8TOcVAt.js');
|
|
8
|
+
require('./options-DAp5AdGz.js');
|
|
9
9
|
require('magic-string');
|
|
10
10
|
require('./replace.js');
|
|
11
11
|
require('@weapp-core/escape');
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { U as UnifiedWebpackPluginV5 } from './v5-
|
|
2
|
-
export { U as UnifiedViteWeappTailwindcssPlugin } from './index-
|
|
3
|
-
export { c as createPlugins } from './index-
|
|
4
|
-
import './options-
|
|
1
|
+
export { U as UnifiedWebpackPluginV5 } from './v5-B9S3lBOs.mjs';
|
|
2
|
+
export { U as UnifiedViteWeappTailwindcssPlugin } from './index-BKZH-Gxq.mjs';
|
|
3
|
+
export { c as createPlugins } from './index-Bc61v7B0.mjs';
|
|
4
|
+
import './options-BHJnjA_a.mjs';
|
|
5
5
|
import 'magic-string';
|
|
6
6
|
import './replace.mjs';
|
|
7
7
|
import '@weapp-core/escape';
|
|
@@ -292,6 +292,134 @@ function createJsHandler(options) {
|
|
|
292
292
|
return _jsHandler;
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
+
var State;
|
|
296
|
+
(function (State) {
|
|
297
|
+
State[State["START"] = 0] = "START";
|
|
298
|
+
State[State["TEXT"] = 1] = "TEXT";
|
|
299
|
+
State[State["OPEN_BRACE"] = 2] = "OPEN_BRACE";
|
|
300
|
+
State[State["POTENTIAL_CLOSE"] = 3] = "POTENTIAL_CLOSE";
|
|
301
|
+
State[State["BRACES_COMPLETE"] = 4] = "BRACES_COMPLETE";
|
|
302
|
+
})(State || (State = {}));
|
|
303
|
+
class Tokenizer {
|
|
304
|
+
constructor() {
|
|
305
|
+
this.reset();
|
|
306
|
+
}
|
|
307
|
+
processChar(char, index) {
|
|
308
|
+
switch (this.state) {
|
|
309
|
+
case State.START:
|
|
310
|
+
if (char === ' ') ;
|
|
311
|
+
else if (char === '{') {
|
|
312
|
+
this.state = State.OPEN_BRACE;
|
|
313
|
+
this.bufferStartIndex = index;
|
|
314
|
+
this.buffer += char;
|
|
315
|
+
this.expressionBuffer = char;
|
|
316
|
+
this.expressionStartIndex = index;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.state = State.TEXT;
|
|
320
|
+
this.bufferStartIndex = index;
|
|
321
|
+
this.buffer += char;
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
case State.TEXT:
|
|
325
|
+
if (char === ' ') {
|
|
326
|
+
this.tokens.push({ start: this.bufferStartIndex, end: index, value: this.buffer, expressions: this.expressions });
|
|
327
|
+
this.buffer = '';
|
|
328
|
+
this.expressions = [];
|
|
329
|
+
this.state = State.START;
|
|
330
|
+
}
|
|
331
|
+
else if (char === '{') {
|
|
332
|
+
this.buffer += char;
|
|
333
|
+
this.expressionBuffer = char;
|
|
334
|
+
this.expressionStartIndex = index;
|
|
335
|
+
this.state = State.OPEN_BRACE;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
this.buffer += char;
|
|
339
|
+
}
|
|
340
|
+
break;
|
|
341
|
+
case State.OPEN_BRACE:
|
|
342
|
+
if (char === '}') {
|
|
343
|
+
this.buffer += char;
|
|
344
|
+
this.expressionBuffer += char;
|
|
345
|
+
this.state = State.POTENTIAL_CLOSE;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
this.buffer += char;
|
|
349
|
+
this.expressionBuffer += char;
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
case State.POTENTIAL_CLOSE:
|
|
353
|
+
if (char === '}') {
|
|
354
|
+
this.buffer += char;
|
|
355
|
+
this.expressionBuffer += char;
|
|
356
|
+
this.expressions.push({
|
|
357
|
+
start: this.expressionStartIndex,
|
|
358
|
+
end: index + 1,
|
|
359
|
+
value: this.expressionBuffer,
|
|
360
|
+
});
|
|
361
|
+
this.expressionBuffer = '';
|
|
362
|
+
this.state = State.BRACES_COMPLETE;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
this.buffer += char;
|
|
366
|
+
this.expressionBuffer += char;
|
|
367
|
+
this.state = State.OPEN_BRACE;
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
case State.BRACES_COMPLETE:
|
|
371
|
+
if (char === ' ') {
|
|
372
|
+
this.tokens.push({
|
|
373
|
+
start: this.bufferStartIndex,
|
|
374
|
+
end: index,
|
|
375
|
+
value: this.buffer,
|
|
376
|
+
expressions: this.expressions,
|
|
377
|
+
});
|
|
378
|
+
this.buffer = '';
|
|
379
|
+
this.expressions = [];
|
|
380
|
+
this.state = State.START;
|
|
381
|
+
}
|
|
382
|
+
else if (char === '{') {
|
|
383
|
+
this.expressionStartIndex = index;
|
|
384
|
+
this.expressionBuffer = char;
|
|
385
|
+
this.buffer += char;
|
|
386
|
+
this.state = State.OPEN_BRACE;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.buffer += char;
|
|
390
|
+
this.state = State.TEXT;
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
default:
|
|
394
|
+
throw new Error('Unexpected state');
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
run(input) {
|
|
398
|
+
for (let i = 0; i < input.length; i++) {
|
|
399
|
+
const char = input[i];
|
|
400
|
+
this.processChar(char, i);
|
|
401
|
+
}
|
|
402
|
+
if (this.buffer.length > 0) {
|
|
403
|
+
this.tokens.push({
|
|
404
|
+
start: this.bufferStartIndex,
|
|
405
|
+
end: input.length,
|
|
406
|
+
value: this.buffer,
|
|
407
|
+
expressions: this.expressions,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
return this.tokens;
|
|
411
|
+
}
|
|
412
|
+
reset() {
|
|
413
|
+
this.state = State.START;
|
|
414
|
+
this.buffer = '';
|
|
415
|
+
this.tokens = [];
|
|
416
|
+
this.bufferStartIndex = 0;
|
|
417
|
+
this.expressionBuffer = '';
|
|
418
|
+
this.expressionStartIndex = 0;
|
|
419
|
+
this.expressions = [];
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
295
423
|
function generateCode(match, options = {}) {
|
|
296
424
|
try {
|
|
297
425
|
const { jsHandler, runtimeSet } = options;
|
|
@@ -347,7 +475,7 @@ function extract(original, reg) {
|
|
|
347
475
|
function extractSource(original) {
|
|
348
476
|
return extract(original, variableRegExp);
|
|
349
477
|
}
|
|
350
|
-
function
|
|
478
|
+
function handleEachClassFragment(original, options = {}) {
|
|
351
479
|
const sources = extractSource(original);
|
|
352
480
|
if (sources.length > 0) {
|
|
353
481
|
const resultArray = [];
|
|
@@ -359,6 +487,7 @@ function templateReplacer(original, options = {}) {
|
|
|
359
487
|
keepEOL: true,
|
|
360
488
|
escapeMap: options.escapeMap,
|
|
361
489
|
mangleContext: options.mangleContext,
|
|
490
|
+
ignoreHead: p > 0,
|
|
362
491
|
}));
|
|
363
492
|
p = m.start;
|
|
364
493
|
if (m.raw.trim().length > 0) {
|
|
@@ -377,6 +506,7 @@ function templateReplacer(original, options = {}) {
|
|
|
377
506
|
keepEOL: true,
|
|
378
507
|
escapeMap: options.escapeMap,
|
|
379
508
|
mangleContext: options.mangleContext,
|
|
509
|
+
ignoreHead: true,
|
|
380
510
|
}));
|
|
381
511
|
}
|
|
382
512
|
}
|
|
@@ -387,9 +517,20 @@ function templateReplacer(original, options = {}) {
|
|
|
387
517
|
keepEOL: false,
|
|
388
518
|
escapeMap: options.escapeMap,
|
|
389
519
|
mangleContext: options.mangleContext,
|
|
520
|
+
ignoreHead: false,
|
|
390
521
|
});
|
|
391
522
|
}
|
|
392
523
|
}
|
|
524
|
+
function templateReplacer(original, options = {}) {
|
|
525
|
+
const ms = new MagicString(original);
|
|
526
|
+
const tokenizer = new Tokenizer();
|
|
527
|
+
const tokens = tokenizer.run(ms.original);
|
|
528
|
+
for (const token of tokens) {
|
|
529
|
+
const target = handleEachClassFragment(token.value, options);
|
|
530
|
+
ms.update(token.start, token.end, target);
|
|
531
|
+
}
|
|
532
|
+
return ms.toString();
|
|
533
|
+
}
|
|
393
534
|
function regTest(reg, str) {
|
|
394
535
|
reg.lastIndex = 0;
|
|
395
536
|
return reg.test(str);
|
|
@@ -324,6 +324,134 @@ function createJsHandler(options) {
|
|
|
324
324
|
return _jsHandler;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
+
var State;
|
|
328
|
+
(function (State) {
|
|
329
|
+
State[State["START"] = 0] = "START";
|
|
330
|
+
State[State["TEXT"] = 1] = "TEXT";
|
|
331
|
+
State[State["OPEN_BRACE"] = 2] = "OPEN_BRACE";
|
|
332
|
+
State[State["POTENTIAL_CLOSE"] = 3] = "POTENTIAL_CLOSE";
|
|
333
|
+
State[State["BRACES_COMPLETE"] = 4] = "BRACES_COMPLETE";
|
|
334
|
+
})(State || (State = {}));
|
|
335
|
+
class Tokenizer {
|
|
336
|
+
constructor() {
|
|
337
|
+
this.reset();
|
|
338
|
+
}
|
|
339
|
+
processChar(char, index) {
|
|
340
|
+
switch (this.state) {
|
|
341
|
+
case State.START:
|
|
342
|
+
if (char === ' ') ;
|
|
343
|
+
else if (char === '{') {
|
|
344
|
+
this.state = State.OPEN_BRACE;
|
|
345
|
+
this.bufferStartIndex = index;
|
|
346
|
+
this.buffer += char;
|
|
347
|
+
this.expressionBuffer = char;
|
|
348
|
+
this.expressionStartIndex = index;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
this.state = State.TEXT;
|
|
352
|
+
this.bufferStartIndex = index;
|
|
353
|
+
this.buffer += char;
|
|
354
|
+
}
|
|
355
|
+
break;
|
|
356
|
+
case State.TEXT:
|
|
357
|
+
if (char === ' ') {
|
|
358
|
+
this.tokens.push({ start: this.bufferStartIndex, end: index, value: this.buffer, expressions: this.expressions });
|
|
359
|
+
this.buffer = '';
|
|
360
|
+
this.expressions = [];
|
|
361
|
+
this.state = State.START;
|
|
362
|
+
}
|
|
363
|
+
else if (char === '{') {
|
|
364
|
+
this.buffer += char;
|
|
365
|
+
this.expressionBuffer = char;
|
|
366
|
+
this.expressionStartIndex = index;
|
|
367
|
+
this.state = State.OPEN_BRACE;
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
this.buffer += char;
|
|
371
|
+
}
|
|
372
|
+
break;
|
|
373
|
+
case State.OPEN_BRACE:
|
|
374
|
+
if (char === '}') {
|
|
375
|
+
this.buffer += char;
|
|
376
|
+
this.expressionBuffer += char;
|
|
377
|
+
this.state = State.POTENTIAL_CLOSE;
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
this.buffer += char;
|
|
381
|
+
this.expressionBuffer += char;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case State.POTENTIAL_CLOSE:
|
|
385
|
+
if (char === '}') {
|
|
386
|
+
this.buffer += char;
|
|
387
|
+
this.expressionBuffer += char;
|
|
388
|
+
this.expressions.push({
|
|
389
|
+
start: this.expressionStartIndex,
|
|
390
|
+
end: index + 1,
|
|
391
|
+
value: this.expressionBuffer,
|
|
392
|
+
});
|
|
393
|
+
this.expressionBuffer = '';
|
|
394
|
+
this.state = State.BRACES_COMPLETE;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
this.buffer += char;
|
|
398
|
+
this.expressionBuffer += char;
|
|
399
|
+
this.state = State.OPEN_BRACE;
|
|
400
|
+
}
|
|
401
|
+
break;
|
|
402
|
+
case State.BRACES_COMPLETE:
|
|
403
|
+
if (char === ' ') {
|
|
404
|
+
this.tokens.push({
|
|
405
|
+
start: this.bufferStartIndex,
|
|
406
|
+
end: index,
|
|
407
|
+
value: this.buffer,
|
|
408
|
+
expressions: this.expressions,
|
|
409
|
+
});
|
|
410
|
+
this.buffer = '';
|
|
411
|
+
this.expressions = [];
|
|
412
|
+
this.state = State.START;
|
|
413
|
+
}
|
|
414
|
+
else if (char === '{') {
|
|
415
|
+
this.expressionStartIndex = index;
|
|
416
|
+
this.expressionBuffer = char;
|
|
417
|
+
this.buffer += char;
|
|
418
|
+
this.state = State.OPEN_BRACE;
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
this.buffer += char;
|
|
422
|
+
this.state = State.TEXT;
|
|
423
|
+
}
|
|
424
|
+
break;
|
|
425
|
+
default:
|
|
426
|
+
throw new Error('Unexpected state');
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
run(input) {
|
|
430
|
+
for (let i = 0; i < input.length; i++) {
|
|
431
|
+
const char = input[i];
|
|
432
|
+
this.processChar(char, i);
|
|
433
|
+
}
|
|
434
|
+
if (this.buffer.length > 0) {
|
|
435
|
+
this.tokens.push({
|
|
436
|
+
start: this.bufferStartIndex,
|
|
437
|
+
end: input.length,
|
|
438
|
+
value: this.buffer,
|
|
439
|
+
expressions: this.expressions,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
return this.tokens;
|
|
443
|
+
}
|
|
444
|
+
reset() {
|
|
445
|
+
this.state = State.START;
|
|
446
|
+
this.buffer = '';
|
|
447
|
+
this.tokens = [];
|
|
448
|
+
this.bufferStartIndex = 0;
|
|
449
|
+
this.expressionBuffer = '';
|
|
450
|
+
this.expressionStartIndex = 0;
|
|
451
|
+
this.expressions = [];
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
327
455
|
function generateCode(match, options = {}) {
|
|
328
456
|
try {
|
|
329
457
|
const { jsHandler, runtimeSet } = options;
|
|
@@ -379,7 +507,7 @@ function extract(original, reg) {
|
|
|
379
507
|
function extractSource(original) {
|
|
380
508
|
return extract(original, regex.variableRegExp);
|
|
381
509
|
}
|
|
382
|
-
function
|
|
510
|
+
function handleEachClassFragment(original, options = {}) {
|
|
383
511
|
const sources = extractSource(original);
|
|
384
512
|
if (sources.length > 0) {
|
|
385
513
|
const resultArray = [];
|
|
@@ -391,6 +519,7 @@ function templateReplacer(original, options = {}) {
|
|
|
391
519
|
keepEOL: true,
|
|
392
520
|
escapeMap: options.escapeMap,
|
|
393
521
|
mangleContext: options.mangleContext,
|
|
522
|
+
ignoreHead: p > 0,
|
|
394
523
|
}));
|
|
395
524
|
p = m.start;
|
|
396
525
|
if (m.raw.trim().length > 0) {
|
|
@@ -409,6 +538,7 @@ function templateReplacer(original, options = {}) {
|
|
|
409
538
|
keepEOL: true,
|
|
410
539
|
escapeMap: options.escapeMap,
|
|
411
540
|
mangleContext: options.mangleContext,
|
|
541
|
+
ignoreHead: true,
|
|
412
542
|
}));
|
|
413
543
|
}
|
|
414
544
|
}
|
|
@@ -419,9 +549,20 @@ function templateReplacer(original, options = {}) {
|
|
|
419
549
|
keepEOL: false,
|
|
420
550
|
escapeMap: options.escapeMap,
|
|
421
551
|
mangleContext: options.mangleContext,
|
|
552
|
+
ignoreHead: false,
|
|
422
553
|
});
|
|
423
554
|
}
|
|
424
555
|
}
|
|
556
|
+
function templateReplacer(original, options = {}) {
|
|
557
|
+
const ms = new MagicString__default["default"](original);
|
|
558
|
+
const tokenizer = new Tokenizer();
|
|
559
|
+
const tokens = tokenizer.run(ms.original);
|
|
560
|
+
for (const token of tokens) {
|
|
561
|
+
const target = handleEachClassFragment(token.value, options);
|
|
562
|
+
ms.update(token.start, token.end, target);
|
|
563
|
+
}
|
|
564
|
+
return ms.toString();
|
|
565
|
+
}
|
|
425
566
|
function regTest(reg, str) {
|
|
426
567
|
reg.lastIndex = 0;
|
|
427
568
|
return reg.test(str);
|
package/dist/replace.js
CHANGED
|
@@ -10,7 +10,7 @@ function replaceWxml(original, options = {
|
|
|
10
10
|
keepEOL: false,
|
|
11
11
|
escapeMap: escape.SimpleMappingChars2String,
|
|
12
12
|
}) {
|
|
13
|
-
const { keepEOL, escapeMap, mangleContext } = options;
|
|
13
|
+
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
14
14
|
let res = original;
|
|
15
15
|
if (!keepEOL) {
|
|
16
16
|
res = res
|
|
@@ -21,7 +21,7 @@ function replaceWxml(original, options = {
|
|
|
21
21
|
}
|
|
22
22
|
res = escape.escape(res, {
|
|
23
23
|
map: escapeMap,
|
|
24
|
-
ignoreHead
|
|
24
|
+
ignoreHead,
|
|
25
25
|
});
|
|
26
26
|
return res;
|
|
27
27
|
}
|
package/dist/replace.mjs
CHANGED
|
@@ -7,7 +7,7 @@ function replaceWxml(original, options = {
|
|
|
7
7
|
keepEOL: false,
|
|
8
8
|
escapeMap: SimpleMappingChars2String,
|
|
9
9
|
}) {
|
|
10
|
-
const { keepEOL, escapeMap, mangleContext } = options;
|
|
10
|
+
const { keepEOL, escapeMap, mangleContext, ignoreHead } = options;
|
|
11
11
|
let res = original;
|
|
12
12
|
if (!keepEOL) {
|
|
13
13
|
res = res
|
|
@@ -18,7 +18,7 @@ function replaceWxml(original, options = {
|
|
|
18
18
|
}
|
|
19
19
|
res = escape(res, {
|
|
20
20
|
map: escapeMap,
|
|
21
|
-
ignoreHead
|
|
21
|
+
ignoreHead,
|
|
22
22
|
});
|
|
23
23
|
return res;
|
|
24
24
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -150,6 +150,7 @@ export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
|
150
150
|
runtimeSet?: Set<string>;
|
|
151
151
|
disabledDefaultTemplateHandler?: boolean;
|
|
152
152
|
quote?: string | null;
|
|
153
|
+
ignoreHead?: boolean;
|
|
153
154
|
}
|
|
154
155
|
export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary' | 'cache'> & {
|
|
155
156
|
supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-BHJnjA_a.mjs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { b as pluginName } from './index-BPzIdybK.mjs';
|
|
@@ -34,7 +34,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
34
34
|
type: null,
|
|
35
35
|
};
|
|
36
36
|
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
37
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (
|
|
37
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
|
|
38
38
|
if (isExisted) {
|
|
39
39
|
const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
|
|
40
40
|
if (idx > -1) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-DAp5AdGz.js');
|
|
4
4
|
var path = require('node:path');
|
|
5
5
|
var fs = require('node:fs');
|
|
6
6
|
var index = require('./index-DwZHOkK3.js');
|
|
@@ -41,7 +41,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
41
41
|
type: null,
|
|
42
42
|
};
|
|
43
43
|
compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
|
|
44
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(index.pluginName, (
|
|
44
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(index.pluginName, (_loaderContext, module) => {
|
|
45
45
|
if (isExisted) {
|
|
46
46
|
const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
|
|
47
47
|
if (idx > -1) {
|
package/dist/vite.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
6
|
-
require('./options-
|
|
5
|
+
var index = require('./index-DXeB6ex8.js');
|
|
6
|
+
require('./options-DAp5AdGz.js');
|
|
7
7
|
require('magic-string');
|
|
8
8
|
require('./replace.js');
|
|
9
9
|
require('@weapp-core/escape');
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { U as UnifiedViteWeappTailwindcssPlugin } from './index-
|
|
2
|
-
import './options-
|
|
1
|
+
export { U as UnifiedViteWeappTailwindcssPlugin } from './index-BKZH-Gxq.mjs';
|
|
2
|
+
import './options-BHJnjA_a.mjs';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
5
5
|
import '@weapp-core/escape';
|
package/dist/webpack.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var v5 = require('./v5-
|
|
6
|
-
require('./options-
|
|
5
|
+
var v5 = require('./v5-QURRYPNk.js');
|
|
6
|
+
require('./options-DAp5AdGz.js');
|
|
7
7
|
require('magic-string');
|
|
8
8
|
require('./replace.js');
|
|
9
9
|
require('@weapp-core/escape');
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { U as UnifiedWebpackPluginV5 } from './v5-
|
|
2
|
-
import './options-
|
|
1
|
+
export { U as UnifiedWebpackPluginV5 } from './v5-B9S3lBOs.mjs';
|
|
2
|
+
import './options-BHJnjA_a.mjs';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
5
5
|
import '@weapp-core/escape';
|
package/dist/webpack4.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-DAp5AdGz.js');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var fs = require('node:fs');
|
|
8
8
|
var webpackSources = require('webpack-sources');
|
|
@@ -65,7 +65,7 @@ class UnifiedWebpackPluginV4 {
|
|
|
65
65
|
type: null,
|
|
66
66
|
};
|
|
67
67
|
compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
|
|
68
|
-
compilation.hooks.normalModuleLoader.tap(index.pluginName, (
|
|
68
|
+
compilation.hooks.normalModuleLoader.tap(index.pluginName, (_loaderContext, module) => {
|
|
69
69
|
if (isExisted) {
|
|
70
70
|
const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
|
|
71
71
|
if (idx > -1) {
|
package/dist/webpack4.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-BHJnjA_a.mjs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { ConcatSource, RawSource } from 'webpack-sources';
|
|
@@ -56,7 +56,7 @@ class UnifiedWebpackPluginV4 {
|
|
|
56
56
|
type: null,
|
|
57
57
|
};
|
|
58
58
|
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
59
|
-
compilation.hooks.normalModuleLoader.tap(pluginName, (
|
|
59
|
+
compilation.hooks.normalModuleLoader.tap(pluginName, (_loaderContext, module) => {
|
|
60
60
|
if (isExisted) {
|
|
61
61
|
const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
|
|
62
62
|
if (idx > -1) {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare enum State {
|
|
2
|
+
START = 0,
|
|
3
|
+
TEXT = 1,
|
|
4
|
+
OPEN_BRACE = 2,
|
|
5
|
+
POTENTIAL_CLOSE = 3,
|
|
6
|
+
BRACES_COMPLETE = 4
|
|
7
|
+
}
|
|
8
|
+
export interface Expression {
|
|
9
|
+
start: number;
|
|
10
|
+
end: number;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Token {
|
|
14
|
+
start: number;
|
|
15
|
+
end: number;
|
|
16
|
+
value: string;
|
|
17
|
+
expressions: Expression[];
|
|
18
|
+
}
|
|
19
|
+
export declare class Tokenizer {
|
|
20
|
+
private state;
|
|
21
|
+
private buffer;
|
|
22
|
+
private tokens;
|
|
23
|
+
private bufferStartIndex;
|
|
24
|
+
private expressionStartIndex;
|
|
25
|
+
private expressionBuffer;
|
|
26
|
+
private expressions;
|
|
27
|
+
constructor();
|
|
28
|
+
private processChar;
|
|
29
|
+
run(input: string): Token[];
|
|
30
|
+
reset(): void;
|
|
31
|
+
}
|
package/dist/wxml/utils.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ItemOrItemArray } from "../reg";
|
|
|
2
2
|
import type { ITemplateHandlerOptions, RawSource } from "../types";
|
|
3
3
|
export declare function generateCode(match: string, options?: ITemplateHandlerOptions): string;
|
|
4
4
|
export declare function extractSource(original: string): RawSource[];
|
|
5
|
+
export declare function handleEachClassFragment(original: string, options?: ITemplateHandlerOptions): string;
|
|
5
6
|
export declare function templateReplacer(original: string, options?: ITemplateHandlerOptions): string;
|
|
6
7
|
export declare function isPropsMatch(props: ItemOrItemArray<string | RegExp>, attr: string): boolean;
|
|
7
8
|
export declare function customTemplateHandler(rawSource: string, options: Required<ITemplateHandlerOptions>): Promise<string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.7",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "SonOfMagic <qq1324318532@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"debug": "4.3.5",
|
|
138
138
|
"htmlparser2": "9.1.0",
|
|
139
139
|
"loader-utils": "2.0.4",
|
|
140
|
-
"lru-cache": "10.3
|
|
140
|
+
"lru-cache": "10.4.3",
|
|
141
141
|
"magic-string": "0.30.10",
|
|
142
142
|
"md5": "2.3.0",
|
|
143
143
|
"postcss": "8.4.39",
|
|
@@ -156,18 +156,15 @@
|
|
|
156
156
|
"test": "npm run postinstall && vitest run",
|
|
157
157
|
"test:dev": "vitest",
|
|
158
158
|
"test:ui": "vitest --ui",
|
|
159
|
-
"vitest:coverage": "vitest run --coverage",
|
|
160
159
|
"clean": "node scripts/clean.js",
|
|
161
|
-
"raw": "
|
|
162
|
-
"get-decl": "
|
|
160
|
+
"raw": "tsx scripts/raw",
|
|
161
|
+
"get-decl": "tsx scripts/get-decl.ts",
|
|
163
162
|
"sync": "cnpm sync weapp-tailwindcss-webpack-plugin weapp-tailwindcss weapp-tw",
|
|
164
|
-
"format": "prettier --check \"src/**/*.{ts,js}\" -w",
|
|
165
|
-
"format:test": "prettier --check \"test/**/*.test.{ts,js}\" -w",
|
|
166
163
|
"ls:pack": "npm pack --dry-run",
|
|
167
164
|
"cli:patch": "node bin/weapp-tailwindcss.js patch",
|
|
168
165
|
"bump": "bumpp",
|
|
169
166
|
"release": "node scripts/release.js",
|
|
170
|
-
"generate:readme": "
|
|
167
|
+
"generate:readme": "tsx scripts/readme/write.ts",
|
|
171
168
|
"lint": "eslint .",
|
|
172
169
|
"lint:fix": "eslint ./test --fix",
|
|
173
170
|
"-------": "-----------",
|