pickier 0.1.33 → 0.1.34
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/bin/cli.js +54 -11
- package/dist/src/index.js +53 -10
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -614,6 +614,45 @@ function hasIndentIssue(leading, indentSize, indentStyle = "spaces", lineContent
|
|
|
614
614
|
}
|
|
615
615
|
return spaces % indentSize !== 0;
|
|
616
616
|
}
|
|
617
|
+
function skipTemplate(input, start) {
|
|
618
|
+
let i = start + 1;
|
|
619
|
+
while (i < input.length) {
|
|
620
|
+
const c = input[i];
|
|
621
|
+
if (c === "\\") {
|
|
622
|
+
i += 2;
|
|
623
|
+
continue;
|
|
624
|
+
}
|
|
625
|
+
if (c === "`")
|
|
626
|
+
return i + 1;
|
|
627
|
+
if (c === "$" && input[i + 1] === "{") {
|
|
628
|
+
i += 2;
|
|
629
|
+
let depth = 1;
|
|
630
|
+
while (i < input.length && depth > 0) {
|
|
631
|
+
const d = input[i];
|
|
632
|
+
if (d === "\\") {
|
|
633
|
+
i += 2;
|
|
634
|
+
continue;
|
|
635
|
+
}
|
|
636
|
+
if (d === "`") {
|
|
637
|
+
i = skipTemplate(input, i);
|
|
638
|
+
continue;
|
|
639
|
+
}
|
|
640
|
+
if (d === "'" || d === '"') {
|
|
641
|
+
i = skipQuoted(input, i, d);
|
|
642
|
+
continue;
|
|
643
|
+
}
|
|
644
|
+
if (d === "{")
|
|
645
|
+
depth++;
|
|
646
|
+
else if (d === "}")
|
|
647
|
+
depth--;
|
|
648
|
+
i++;
|
|
649
|
+
}
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
i++;
|
|
653
|
+
}
|
|
654
|
+
return i;
|
|
655
|
+
}
|
|
617
656
|
function maskStrings(input) {
|
|
618
657
|
if (!input.includes("'") && !input.includes('"') && !input.includes("`"))
|
|
619
658
|
return { text: input, strings: [] };
|
|
@@ -627,18 +666,22 @@ function maskStrings(input) {
|
|
|
627
666
|
if (i > segStart)
|
|
628
667
|
parts.push(input.slice(segStart, i));
|
|
629
668
|
const start = i;
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
669
|
+
if (ch === "`") {
|
|
670
|
+
i = skipTemplate(input, i);
|
|
671
|
+
} else {
|
|
672
|
+
const close = ch;
|
|
673
|
+
i++;
|
|
674
|
+
while (i < input.length) {
|
|
675
|
+
if (input[i] === "\\") {
|
|
676
|
+
i += 2;
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
if (input[i] === close) {
|
|
680
|
+
i++;
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
638
683
|
i++;
|
|
639
|
-
break;
|
|
640
684
|
}
|
|
641
|
-
i++;
|
|
642
685
|
}
|
|
643
686
|
strings.push(input.slice(start, i));
|
|
644
687
|
parts.push(`@@S${strings.length - 1}@@`);
|
|
@@ -43647,7 +43690,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
43647
43690
|
module.exports = {
|
|
43648
43691
|
name: "pickier",
|
|
43649
43692
|
type: "module",
|
|
43650
|
-
version: "0.1.
|
|
43693
|
+
version: "0.1.34",
|
|
43651
43694
|
description: "Format, lint and more in a fraction of seconds.",
|
|
43652
43695
|
author: "Chris Breuer <chris@stacksjs.org>",
|
|
43653
43696
|
license: "MIT",
|
package/dist/src/index.js
CHANGED
|
@@ -9448,6 +9448,45 @@ function hasIndentIssue(leading, indentSize, indentStyle = "spaces", lineContent
|
|
|
9448
9448
|
}
|
|
9449
9449
|
return spaces % indentSize !== 0;
|
|
9450
9450
|
}
|
|
9451
|
+
function skipTemplate(input, start) {
|
|
9452
|
+
let i = start + 1;
|
|
9453
|
+
while (i < input.length) {
|
|
9454
|
+
const c = input[i];
|
|
9455
|
+
if (c === "\\") {
|
|
9456
|
+
i += 2;
|
|
9457
|
+
continue;
|
|
9458
|
+
}
|
|
9459
|
+
if (c === "`")
|
|
9460
|
+
return i + 1;
|
|
9461
|
+
if (c === "$" && input[i + 1] === "{") {
|
|
9462
|
+
i += 2;
|
|
9463
|
+
let depth = 1;
|
|
9464
|
+
while (i < input.length && depth > 0) {
|
|
9465
|
+
const d = input[i];
|
|
9466
|
+
if (d === "\\") {
|
|
9467
|
+
i += 2;
|
|
9468
|
+
continue;
|
|
9469
|
+
}
|
|
9470
|
+
if (d === "`") {
|
|
9471
|
+
i = skipTemplate(input, i);
|
|
9472
|
+
continue;
|
|
9473
|
+
}
|
|
9474
|
+
if (d === "'" || d === '"') {
|
|
9475
|
+
i = skipQuoted(input, i, d);
|
|
9476
|
+
continue;
|
|
9477
|
+
}
|
|
9478
|
+
if (d === "{")
|
|
9479
|
+
depth++;
|
|
9480
|
+
else if (d === "}")
|
|
9481
|
+
depth--;
|
|
9482
|
+
i++;
|
|
9483
|
+
}
|
|
9484
|
+
continue;
|
|
9485
|
+
}
|
|
9486
|
+
i++;
|
|
9487
|
+
}
|
|
9488
|
+
return i;
|
|
9489
|
+
}
|
|
9451
9490
|
function maskStrings(input) {
|
|
9452
9491
|
if (!input.includes("'") && !input.includes('"') && !input.includes("`"))
|
|
9453
9492
|
return { text: input, strings: [] };
|
|
@@ -9461,18 +9500,22 @@ function maskStrings(input) {
|
|
|
9461
9500
|
if (i > segStart)
|
|
9462
9501
|
parts.push(input.slice(segStart, i));
|
|
9463
9502
|
const start = i;
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9503
|
+
if (ch === "`") {
|
|
9504
|
+
i = skipTemplate(input, i);
|
|
9505
|
+
} else {
|
|
9506
|
+
const close = ch;
|
|
9507
|
+
i++;
|
|
9508
|
+
while (i < input.length) {
|
|
9509
|
+
if (input[i] === "\\") {
|
|
9510
|
+
i += 2;
|
|
9511
|
+
continue;
|
|
9512
|
+
}
|
|
9513
|
+
if (input[i] === close) {
|
|
9514
|
+
i++;
|
|
9515
|
+
break;
|
|
9516
|
+
}
|
|
9472
9517
|
i++;
|
|
9473
|
-
break;
|
|
9474
9518
|
}
|
|
9475
|
-
i++;
|
|
9476
9519
|
}
|
|
9477
9520
|
strings.push(input.slice(start, i));
|
|
9478
9521
|
parts.push(`@@S${strings.length - 1}@@`);
|