vite 3.0.0-beta.1 → 3.0.0-beta.4

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.
@@ -17,7 +17,7 @@ var colon = ":".charCodeAt(0);
17
17
  var star = "*".charCodeAt(0);
18
18
  var uLower = "u".charCodeAt(0);
19
19
  var uUpper = "U".charCodeAt(0);
20
- var plus$1 = "+".charCodeAt(0);
20
+ var plus = "+".charCodeAt(0);
21
21
  var isUnicodeRange = /^[a-f0-9?-]+$/i;
22
22
 
23
23
  var parse$1 = function(input) {
@@ -298,7 +298,7 @@ var parse$1 = function(input) {
298
298
  name = token;
299
299
  } else if (
300
300
  (uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) &&
301
- plus$1 === token.charCodeAt(1) &&
301
+ plus === token.charCodeAt(1) &&
302
302
  isUnicodeRange.test(token.slice(2))
303
303
  ) {
304
304
  tokens.push({
@@ -400,127 +400,135 @@ function stringify$1(nodes, custom) {
400
400
 
401
401
  var stringify_1 = stringify$1;
402
402
 
403
- var minus = "-".charCodeAt(0);
404
- var plus = "+".charCodeAt(0);
405
- var dot = ".".charCodeAt(0);
406
- var exp = "e".charCodeAt(0);
407
- var EXP = "E".charCodeAt(0);
403
+ var unit;
404
+ var hasRequiredUnit;
408
405
 
409
- // Check if three code points would start a number
410
- // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
411
- function likeNumber(value) {
412
- var code = value.charCodeAt(0);
413
- var nextCode;
406
+ function requireUnit () {
407
+ if (hasRequiredUnit) return unit;
408
+ hasRequiredUnit = 1;
409
+ var minus = "-".charCodeAt(0);
410
+ var plus = "+".charCodeAt(0);
411
+ var dot = ".".charCodeAt(0);
412
+ var exp = "e".charCodeAt(0);
413
+ var EXP = "E".charCodeAt(0);
414
414
 
415
- if (code === plus || code === minus) {
416
- nextCode = value.charCodeAt(1);
415
+ // Check if three code points would start a number
416
+ // https://www.w3.org/TR/css-syntax-3/#starts-with-a-number
417
+ function likeNumber(value) {
418
+ var code = value.charCodeAt(0);
419
+ var nextCode;
417
420
 
418
- if (nextCode >= 48 && nextCode <= 57) {
419
- return true;
420
- }
421
+ if (code === plus || code === minus) {
422
+ nextCode = value.charCodeAt(1);
421
423
 
422
- var nextNextCode = value.charCodeAt(2);
424
+ if (nextCode >= 48 && nextCode <= 57) {
425
+ return true;
426
+ }
423
427
 
424
- if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
425
- return true;
426
- }
428
+ var nextNextCode = value.charCodeAt(2);
429
+
430
+ if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) {
431
+ return true;
432
+ }
433
+
434
+ return false;
435
+ }
436
+
437
+ if (code === dot) {
438
+ nextCode = value.charCodeAt(1);
439
+
440
+ if (nextCode >= 48 && nextCode <= 57) {
441
+ return true;
442
+ }
443
+
444
+ return false;
445
+ }
446
+
447
+ if (code >= 48 && code <= 57) {
448
+ return true;
449
+ }
450
+
451
+ return false;
452
+ }
453
+
454
+ // Consume a number
455
+ // https://www.w3.org/TR/css-syntax-3/#consume-number
456
+ unit = function(value) {
457
+ var pos = 0;
458
+ var length = value.length;
459
+ var code;
460
+ var nextCode;
461
+ var nextNextCode;
462
+
463
+ if (length === 0 || !likeNumber(value)) {
464
+ return false;
465
+ }
466
+
467
+ code = value.charCodeAt(pos);
468
+
469
+ if (code === plus || code === minus) {
470
+ pos++;
471
+ }
472
+
473
+ while (pos < length) {
474
+ code = value.charCodeAt(pos);
475
+
476
+ if (code < 48 || code > 57) {
477
+ break;
478
+ }
479
+
480
+ pos += 1;
481
+ }
482
+
483
+ code = value.charCodeAt(pos);
484
+ nextCode = value.charCodeAt(pos + 1);
485
+
486
+ if (code === dot && nextCode >= 48 && nextCode <= 57) {
487
+ pos += 2;
488
+
489
+ while (pos < length) {
490
+ code = value.charCodeAt(pos);
491
+
492
+ if (code < 48 || code > 57) {
493
+ break;
494
+ }
495
+
496
+ pos += 1;
497
+ }
498
+ }
499
+
500
+ code = value.charCodeAt(pos);
501
+ nextCode = value.charCodeAt(pos + 1);
502
+ nextNextCode = value.charCodeAt(pos + 2);
503
+
504
+ if (
505
+ (code === exp || code === EXP) &&
506
+ ((nextCode >= 48 && nextCode <= 57) ||
507
+ ((nextCode === plus || nextCode === minus) &&
508
+ nextNextCode >= 48 &&
509
+ nextNextCode <= 57))
510
+ ) {
511
+ pos += nextCode === plus || nextCode === minus ? 3 : 2;
427
512
 
428
- return false;
429
- }
513
+ while (pos < length) {
514
+ code = value.charCodeAt(pos);
430
515
 
431
- if (code === dot) {
432
- nextCode = value.charCodeAt(1);
516
+ if (code < 48 || code > 57) {
517
+ break;
518
+ }
433
519
 
434
- if (nextCode >= 48 && nextCode <= 57) {
435
- return true;
436
- }
520
+ pos += 1;
521
+ }
522
+ }
437
523
 
438
- return false;
439
- }
440
-
441
- if (code >= 48 && code <= 57) {
442
- return true;
443
- }
444
-
445
- return false;
524
+ return {
525
+ number: value.slice(0, pos),
526
+ unit: value.slice(pos)
527
+ };
528
+ };
529
+ return unit;
446
530
  }
447
531
 
448
- // Consume a number
449
- // https://www.w3.org/TR/css-syntax-3/#consume-number
450
- var unit = function(value) {
451
- var pos = 0;
452
- var length = value.length;
453
- var code;
454
- var nextCode;
455
- var nextNextCode;
456
-
457
- if (length === 0 || !likeNumber(value)) {
458
- return false;
459
- }
460
-
461
- code = value.charCodeAt(pos);
462
-
463
- if (code === plus || code === minus) {
464
- pos++;
465
- }
466
-
467
- while (pos < length) {
468
- code = value.charCodeAt(pos);
469
-
470
- if (code < 48 || code > 57) {
471
- break;
472
- }
473
-
474
- pos += 1;
475
- }
476
-
477
- code = value.charCodeAt(pos);
478
- nextCode = value.charCodeAt(pos + 1);
479
-
480
- if (code === dot && nextCode >= 48 && nextCode <= 57) {
481
- pos += 2;
482
-
483
- while (pos < length) {
484
- code = value.charCodeAt(pos);
485
-
486
- if (code < 48 || code > 57) {
487
- break;
488
- }
489
-
490
- pos += 1;
491
- }
492
- }
493
-
494
- code = value.charCodeAt(pos);
495
- nextCode = value.charCodeAt(pos + 1);
496
- nextNextCode = value.charCodeAt(pos + 2);
497
-
498
- if (
499
- (code === exp || code === EXP) &&
500
- ((nextCode >= 48 && nextCode <= 57) ||
501
- ((nextCode === plus || nextCode === minus) &&
502
- nextNextCode >= 48 &&
503
- nextNextCode <= 57))
504
- ) {
505
- pos += nextCode === plus || nextCode === minus ? 3 : 2;
506
-
507
- while (pos < length) {
508
- code = value.charCodeAt(pos);
509
-
510
- if (code < 48 || code > 57) {
511
- break;
512
- }
513
-
514
- pos += 1;
515
- }
516
- }
517
-
518
- return {
519
- number: value.slice(0, pos),
520
- unit: value.slice(pos)
521
- };
522
- };
523
-
524
532
  var parse = parse$1;
525
533
  var walk = walk$1;
526
534
  var stringify = stringify_1;
@@ -542,7 +550,7 @@ ValueParser.prototype.walk = function(cb, bubble) {
542
550
  return this;
543
551
  };
544
552
 
545
- ValueParser.unit = unit;
553
+ ValueParser.unit = requireUnit();
546
554
 
547
555
  ValueParser.walk = walk;
548
556