prettier 3.7.3 → 3.8.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.
- package/THIRD-PARTY-NOTICES.md +4 -4
- package/doc.js +12 -13
- package/doc.mjs +12 -13
- package/index.cjs +65 -48
- package/index.d.ts +1 -1
- package/index.mjs +94 -85
- package/internal/experimental-cli.mjs +1 -1
- package/internal/legacy-cli.mjs +4 -4
- package/package.json +1 -1
- package/plugins/acorn.js +12 -12
- package/plugins/acorn.mjs +12 -12
- package/plugins/angular.js +4 -4
- package/plugins/angular.mjs +4 -4
- package/plugins/babel.js +12 -12
- package/plugins/babel.mjs +12 -12
- package/plugins/estree.js +36 -36
- package/plugins/estree.mjs +36 -36
- package/plugins/flow.js +15 -15
- package/plugins/flow.mjs +15 -15
- package/plugins/glimmer.js +20 -20
- package/plugins/glimmer.mjs +26 -26
- package/plugins/html.js +15 -15
- package/plugins/html.mjs +15 -15
- package/plugins/markdown.js +51 -51
- package/plugins/markdown.mjs +51 -51
- package/plugins/meriyah.js +4 -4
- package/plugins/meriyah.mjs +4 -4
- package/plugins/postcss.js +34 -34
- package/plugins/postcss.mjs +34 -34
- package/plugins/typescript.js +15 -15
- package/plugins/typescript.mjs +15 -15
- package/plugins/yaml.js +80 -80
- package/plugins/yaml.mjs +80 -80
- package/standalone.js +23 -27
- package/standalone.mjs +23 -27
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The published Prettier artifact additionally contains code with the following licenses:
|
|
4
4
|
MIT, ISC, BSD-3-Clause, BSD-2-Clause, and Apache-2.0.
|
|
5
5
|
|
|
6
|
-
## @angular/compiler@v21.0
|
|
6
|
+
## @angular/compiler@v21.1.0
|
|
7
7
|
|
|
8
8
|
> Angular - the compiler library
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ Author: angular
|
|
|
13
13
|
|
|
14
14
|
> The MIT License
|
|
15
15
|
>
|
|
16
|
-
> Copyright (c) 2010-
|
|
16
|
+
> Copyright (c) 2010-2026 Google LLC. https://angular.dev/license
|
|
17
17
|
>
|
|
18
18
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
19
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -616,7 +616,7 @@ Repository: <https://github.com/acornjs/acorn-jsx>
|
|
|
616
616
|
|
|
617
617
|
----------------------------------------
|
|
618
618
|
|
|
619
|
-
## angular-estree-parser@
|
|
619
|
+
## angular-estree-parser@v15.3.0
|
|
620
620
|
|
|
621
621
|
> A parser that converts Angular source code into an ESTree-compatible form
|
|
622
622
|
|
|
@@ -648,7 +648,7 @@ Author: Ika <ikatyang@gmail.com> (https://github.com/ikatyang)
|
|
|
648
648
|
|
|
649
649
|
----------------------------------------
|
|
650
650
|
|
|
651
|
-
## angular-html-parser@v10.
|
|
651
|
+
## angular-html-parser@v10.3.0
|
|
652
652
|
|
|
653
653
|
> A HTML parser extracted from Angular with some modifications
|
|
654
654
|
|
package/doc.js
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
});
|
|
69
69
|
var method_at_default = at;
|
|
70
70
|
|
|
71
|
-
// src/
|
|
71
|
+
// src/utilities/noop.js
|
|
72
72
|
var noop = () => {
|
|
73
73
|
};
|
|
74
74
|
var noop_default = noop;
|
|
@@ -785,15 +785,14 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
785
785
|
var method_replace_all_default = replaceAll;
|
|
786
786
|
|
|
787
787
|
// src/common/end-of-line.js
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
}
|
|
788
|
+
var OPTION_CR = "cr";
|
|
789
|
+
var OPTION_CRLF = "crlf";
|
|
790
|
+
var CHARACTER_CR = "\r";
|
|
791
|
+
var CHARACTER_CRLF = "\r\n";
|
|
792
|
+
var CHARACTER_LF = "\n";
|
|
793
|
+
var DEFAULT_EOL = CHARACTER_LF;
|
|
794
|
+
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
795
|
+
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
797
796
|
}
|
|
798
797
|
|
|
799
798
|
// node_modules/emoji-regex/index.mjs
|
|
@@ -809,10 +808,10 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
809
808
|
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
810
809
|
}
|
|
811
810
|
|
|
812
|
-
// src/
|
|
811
|
+
// src/utilities/narrow-emojis.evaluate.js
|
|
813
812
|
var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
814
813
|
|
|
815
|
-
// src/
|
|
814
|
+
// src/utilities/get-string-width.js
|
|
816
815
|
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
817
816
|
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
818
817
|
function getStringWidth(text) {
|
|
@@ -1089,7 +1088,7 @@ Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
|
|
1089
1088
|
function printDocToString(doc, options) {
|
|
1090
1089
|
const groupModeMap = /* @__PURE__ */ Object.create(null);
|
|
1091
1090
|
const width = options.printWidth;
|
|
1092
|
-
const newLine =
|
|
1091
|
+
const newLine = convertEndOfLineOptionToCharacter(options.endOfLine);
|
|
1093
1092
|
let position = 0;
|
|
1094
1093
|
const commands = [{
|
|
1095
1094
|
indent: ROOT_INDENT,
|
package/doc.mjs
CHANGED
|
@@ -33,7 +33,7 @@ var at = createMethodShim("at", function() {
|
|
|
33
33
|
});
|
|
34
34
|
var method_at_default = at;
|
|
35
35
|
|
|
36
|
-
// src/
|
|
36
|
+
// src/utilities/noop.js
|
|
37
37
|
var noop = () => {
|
|
38
38
|
};
|
|
39
39
|
var noop_default = noop;
|
|
@@ -750,15 +750,14 @@ var replaceAll = createMethodShim("replaceAll", function() {
|
|
|
750
750
|
var method_replace_all_default = replaceAll;
|
|
751
751
|
|
|
752
752
|
// src/common/end-of-line.js
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
}
|
|
753
|
+
var OPTION_CR = "cr";
|
|
754
|
+
var OPTION_CRLF = "crlf";
|
|
755
|
+
var CHARACTER_CR = "\r";
|
|
756
|
+
var CHARACTER_CRLF = "\r\n";
|
|
757
|
+
var CHARACTER_LF = "\n";
|
|
758
|
+
var DEFAULT_EOL = CHARACTER_LF;
|
|
759
|
+
function convertEndOfLineOptionToCharacter(endOfLineOption) {
|
|
760
|
+
return endOfLineOption === OPTION_CR ? CHARACTER_CR : endOfLineOption === OPTION_CRLF ? CHARACTER_CRLF : DEFAULT_EOL;
|
|
762
761
|
}
|
|
763
762
|
|
|
764
763
|
// node_modules/emoji-regex/index.mjs
|
|
@@ -774,10 +773,10 @@ function isWide(x) {
|
|
|
774
773
|
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x >= 94192 && x <= 94198 || x >= 94208 && x <= 101589 || x >= 101631 && x <= 101662 || x >= 101760 && x <= 101874 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128728 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129674 || x >= 129678 && x <= 129734 || x === 129736 || x >= 129741 && x <= 129756 || x >= 129759 && x <= 129770 || x >= 129775 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
775
774
|
}
|
|
776
775
|
|
|
777
|
-
// src/
|
|
776
|
+
// src/utilities/narrow-emojis.evaluate.js
|
|
778
777
|
var narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
779
778
|
|
|
780
|
-
// src/
|
|
779
|
+
// src/utilities/get-string-width.js
|
|
781
780
|
var notAsciiRegex = /[^\x20-\x7F]/u;
|
|
782
781
|
var narrowEmojisSet = new Set(narrow_emojis_evaluate_default);
|
|
783
782
|
function getStringWidth(text) {
|
|
@@ -1054,7 +1053,7 @@ function fits(next, restCommands, remainingWidth, hasLineSuffix, groupModeMap, m
|
|
|
1054
1053
|
function printDocToString(doc, options) {
|
|
1055
1054
|
const groupModeMap = /* @__PURE__ */ Object.create(null);
|
|
1056
1055
|
const width = options.printWidth;
|
|
1057
|
-
const newLine =
|
|
1056
|
+
const newLine = convertEndOfLineOptionToCharacter(options.endOfLine);
|
|
1058
1057
|
let position = 0;
|
|
1059
1058
|
const commands = [{
|
|
1060
1059
|
indent: ROOT_INDENT,
|
package/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@ var init_method_replace_all = __esm({
|
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
// src/
|
|
68
|
+
// src/utilities/skip.js
|
|
69
69
|
function skip(characters) {
|
|
70
70
|
return (text, startIndex, options) => {
|
|
71
71
|
const backwards = Boolean(options?.backwards);
|
|
@@ -93,7 +93,7 @@ function skip(characters) {
|
|
|
93
93
|
}
|
|
94
94
|
var skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine;
|
|
95
95
|
var init_skip = __esm({
|
|
96
|
-
"src/
|
|
96
|
+
"src/utilities/skip.js"() {
|
|
97
97
|
skipWhitespace = skip(/\s/u);
|
|
98
98
|
skipSpaces = skip(" ");
|
|
99
99
|
skipToLineEnd = skip(",; ");
|
|
@@ -101,7 +101,7 @@ var init_skip = __esm({
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
// src/
|
|
104
|
+
// src/utilities/skip-inline-comment.js
|
|
105
105
|
function skipInlineComment(text, startIndex) {
|
|
106
106
|
if (startIndex === false) {
|
|
107
107
|
return false;
|
|
@@ -117,12 +117,12 @@ function skipInlineComment(text, startIndex) {
|
|
|
117
117
|
}
|
|
118
118
|
var skip_inline_comment_default;
|
|
119
119
|
var init_skip_inline_comment = __esm({
|
|
120
|
-
"src/
|
|
120
|
+
"src/utilities/skip-inline-comment.js"() {
|
|
121
121
|
skip_inline_comment_default = skipInlineComment;
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
// src/
|
|
125
|
+
// src/utilities/skip-newline.js
|
|
126
126
|
function skipNewline(text, startIndex, options) {
|
|
127
127
|
const backwards = Boolean(options?.backwards);
|
|
128
128
|
if (startIndex === false) {
|
|
@@ -148,13 +148,13 @@ function skipNewline(text, startIndex, options) {
|
|
|
148
148
|
}
|
|
149
149
|
var isNewlineCharacter, skip_newline_default;
|
|
150
150
|
var init_skip_newline = __esm({
|
|
151
|
-
"src/
|
|
151
|
+
"src/utilities/skip-newline.js"() {
|
|
152
152
|
isNewlineCharacter = (character) => character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029";
|
|
153
153
|
skip_newline_default = skipNewline;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
// src/
|
|
157
|
+
// src/utilities/skip-trailing-comment.js
|
|
158
158
|
function skipTrailingComment(text, startIndex) {
|
|
159
159
|
if (startIndex === false) {
|
|
160
160
|
return false;
|
|
@@ -166,13 +166,13 @@ function skipTrailingComment(text, startIndex) {
|
|
|
166
166
|
}
|
|
167
167
|
var skip_trailing_comment_default;
|
|
168
168
|
var init_skip_trailing_comment = __esm({
|
|
169
|
-
"src/
|
|
169
|
+
"src/utilities/skip-trailing-comment.js"() {
|
|
170
170
|
init_skip();
|
|
171
171
|
skip_trailing_comment_default = skipTrailingComment;
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
-
// src/
|
|
175
|
+
// src/utilities/get-next-non-space-non-comment-character-index.js
|
|
176
176
|
function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
|
|
177
177
|
let oldIdx = null;
|
|
178
178
|
let nextIdx = startIndex;
|
|
@@ -187,7 +187,7 @@ function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
|
|
|
187
187
|
}
|
|
188
188
|
var get_next_non_space_non_comment_character_index_default;
|
|
189
189
|
var init_get_next_non_space_non_comment_character_index = __esm({
|
|
190
|
-
"src/
|
|
190
|
+
"src/utilities/get-next-non-space-non-comment-character-index.js"() {
|
|
191
191
|
init_skip();
|
|
192
192
|
init_skip_inline_comment();
|
|
193
193
|
init_skip_newline();
|
|
@@ -196,7 +196,7 @@ var init_get_next_non_space_non_comment_character_index = __esm({
|
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
198
|
|
|
199
|
-
// src/
|
|
199
|
+
// src/utilities/has-newline.js
|
|
200
200
|
function hasNewline(text, startIndex, options = {}) {
|
|
201
201
|
const idx = skipSpaces(
|
|
202
202
|
text,
|
|
@@ -208,14 +208,14 @@ function hasNewline(text, startIndex, options = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
var has_newline_default;
|
|
210
210
|
var init_has_newline = __esm({
|
|
211
|
-
"src/
|
|
211
|
+
"src/utilities/has-newline.js"() {
|
|
212
212
|
init_skip();
|
|
213
213
|
init_skip_newline();
|
|
214
214
|
has_newline_default = hasNewline;
|
|
215
215
|
}
|
|
216
216
|
});
|
|
217
217
|
|
|
218
|
-
// src/
|
|
218
|
+
// src/utilities/is-next-line-empty.js
|
|
219
219
|
function isNextLineEmpty(text, startIndex) {
|
|
220
220
|
let oldIdx = null;
|
|
221
221
|
let idx = startIndex;
|
|
@@ -231,7 +231,7 @@ function isNextLineEmpty(text, startIndex) {
|
|
|
231
231
|
}
|
|
232
232
|
var is_next_line_empty_default;
|
|
233
233
|
var init_is_next_line_empty = __esm({
|
|
234
|
-
"src/
|
|
234
|
+
"src/utilities/is-next-line-empty.js"() {
|
|
235
235
|
init_has_newline();
|
|
236
236
|
init_skip();
|
|
237
237
|
init_skip_inline_comment();
|
|
@@ -241,7 +241,7 @@ var init_is_next_line_empty = __esm({
|
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
|
|
244
|
-
// src/
|
|
244
|
+
// src/utilities/is-previous-line-empty.js
|
|
245
245
|
function isPreviousLineEmpty(text, startIndex) {
|
|
246
246
|
let idx = startIndex - 1;
|
|
247
247
|
idx = skipSpaces(text, idx, { backwards: true });
|
|
@@ -252,14 +252,14 @@ function isPreviousLineEmpty(text, startIndex) {
|
|
|
252
252
|
}
|
|
253
253
|
var is_previous_line_empty_default;
|
|
254
254
|
var init_is_previous_line_empty = __esm({
|
|
255
|
-
"src/
|
|
255
|
+
"src/utilities/is-previous-line-empty.js"() {
|
|
256
256
|
init_skip();
|
|
257
257
|
init_skip_newline();
|
|
258
258
|
is_previous_line_empty_default = isPreviousLineEmpty;
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
// src/main/comments/
|
|
262
|
+
// src/main/comments/utilities.js
|
|
263
263
|
function describeNodeForDebugging(node) {
|
|
264
264
|
const nodeType = node.type || node.kind || "(unknown type)";
|
|
265
265
|
let nodeName = String(
|
|
@@ -294,12 +294,12 @@ function addTrailingComment(node, comment) {
|
|
|
294
294
|
comment.trailing = true;
|
|
295
295
|
addCommentHelper(node, comment);
|
|
296
296
|
}
|
|
297
|
-
var
|
|
298
|
-
"src/main/comments/
|
|
297
|
+
var init_utilities = __esm({
|
|
298
|
+
"src/main/comments/utilities.js"() {
|
|
299
299
|
}
|
|
300
300
|
});
|
|
301
301
|
|
|
302
|
-
// src/
|
|
302
|
+
// src/utilities/get-alignment-size.js
|
|
303
303
|
function getAlignmentSize(text, tabWidth, startIndex = 0) {
|
|
304
304
|
let size = 0;
|
|
305
305
|
for (let i = startIndex; i < text.length; ++i) {
|
|
@@ -313,12 +313,12 @@ function getAlignmentSize(text, tabWidth, startIndex = 0) {
|
|
|
313
313
|
}
|
|
314
314
|
var get_alignment_size_default;
|
|
315
315
|
var init_get_alignment_size = __esm({
|
|
316
|
-
"src/
|
|
316
|
+
"src/utilities/get-alignment-size.js"() {
|
|
317
317
|
get_alignment_size_default = getAlignmentSize;
|
|
318
318
|
}
|
|
319
319
|
});
|
|
320
320
|
|
|
321
|
-
// src/
|
|
321
|
+
// src/utilities/get-indent-size.js
|
|
322
322
|
function getIndentSize(value, tabWidth) {
|
|
323
323
|
const lastNewlineIndex = value.lastIndexOf("\n");
|
|
324
324
|
if (lastNewlineIndex === -1) {
|
|
@@ -332,7 +332,7 @@ function getIndentSize(value, tabWidth) {
|
|
|
332
332
|
}
|
|
333
333
|
var get_indent_size_default;
|
|
334
334
|
var init_get_indent_size = __esm({
|
|
335
|
-
"src/
|
|
335
|
+
"src/utilities/get-indent-size.js"() {
|
|
336
336
|
init_get_alignment_size();
|
|
337
337
|
get_indent_size_default = getIndentSize;
|
|
338
338
|
}
|
|
@@ -350,7 +350,7 @@ var init_escape_string_regexp = __esm({
|
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
|
|
353
|
-
// src/
|
|
353
|
+
// src/utilities/get-max-continuous-count.js
|
|
354
354
|
function getMaxContinuousCount(text, searchString) {
|
|
355
355
|
let results = text.matchAll(
|
|
356
356
|
new RegExp(`(?:${escapeStringRegexp(searchString)})+`, "gu")
|
|
@@ -365,45 +365,62 @@ function getMaxContinuousCount(text, searchString) {
|
|
|
365
365
|
}
|
|
366
366
|
var get_max_continuous_count_default;
|
|
367
367
|
var init_get_max_continuous_count = __esm({
|
|
368
|
-
"src/
|
|
368
|
+
"src/utilities/get-max-continuous-count.js"() {
|
|
369
369
|
init_escape_string_regexp();
|
|
370
370
|
get_max_continuous_count_default = getMaxContinuousCount;
|
|
371
371
|
}
|
|
372
372
|
});
|
|
373
373
|
|
|
374
|
-
// src/
|
|
374
|
+
// src/utilities/get-next-non-space-non-comment-character.js
|
|
375
375
|
function getNextNonSpaceNonCommentCharacter(text, startIndex) {
|
|
376
376
|
const index = get_next_non_space_non_comment_character_index_default(text, startIndex);
|
|
377
377
|
return index === false ? "" : text.charAt(index);
|
|
378
378
|
}
|
|
379
379
|
var get_next_non_space_non_comment_character_default;
|
|
380
380
|
var init_get_next_non_space_non_comment_character = __esm({
|
|
381
|
-
"src/
|
|
381
|
+
"src/utilities/get-next-non-space-non-comment-character.js"() {
|
|
382
382
|
init_get_next_non_space_non_comment_character_index();
|
|
383
383
|
get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter;
|
|
384
384
|
}
|
|
385
385
|
});
|
|
386
386
|
|
|
387
|
-
// src/
|
|
387
|
+
// src/utilities/get-preferred-quote.js
|
|
388
388
|
function getPreferredQuote(text, preferredQuoteOrPreferSingleQuote) {
|
|
389
|
-
const preferred = preferredQuoteOrPreferSingleQuote === true || preferredQuoteOrPreferSingleQuote === SINGLE_QUOTE ?
|
|
390
|
-
const
|
|
389
|
+
const { preferred, alternate } = preferredQuoteOrPreferSingleQuote === true || preferredQuoteOrPreferSingleQuote === SINGLE_QUOTE ? SINGLE_QUOTE_SETTINGS : DOUBLE_QUOTE_SETTINGS;
|
|
390
|
+
const { length } = text;
|
|
391
391
|
let preferredQuoteCount = 0;
|
|
392
392
|
let alternateQuoteCount = 0;
|
|
393
|
-
for (
|
|
394
|
-
|
|
393
|
+
for (let index = 0; index < length; index++) {
|
|
394
|
+
const codePoint = text.charCodeAt(index);
|
|
395
|
+
if (codePoint === preferred.codePoint) {
|
|
395
396
|
preferredQuoteCount++;
|
|
396
|
-
} else if (
|
|
397
|
+
} else if (codePoint === alternate.codePoint) {
|
|
397
398
|
alternateQuoteCount++;
|
|
398
399
|
}
|
|
399
400
|
}
|
|
400
|
-
return preferredQuoteCount > alternateQuoteCount ? alternate : preferred;
|
|
401
|
+
return (preferredQuoteCount > alternateQuoteCount ? alternate : preferred).character;
|
|
401
402
|
}
|
|
402
|
-
var SINGLE_QUOTE, DOUBLE_QUOTE, get_preferred_quote_default;
|
|
403
|
+
var SINGLE_QUOTE, DOUBLE_QUOTE, SINGLE_QUOTE_DATA, DOUBLE_QUOTE_DATA, SINGLE_QUOTE_SETTINGS, DOUBLE_QUOTE_SETTINGS, get_preferred_quote_default;
|
|
403
404
|
var init_get_preferred_quote = __esm({
|
|
404
|
-
"src/
|
|
405
|
+
"src/utilities/get-preferred-quote.js"() {
|
|
405
406
|
SINGLE_QUOTE = "'";
|
|
406
407
|
DOUBLE_QUOTE = '"';
|
|
408
|
+
SINGLE_QUOTE_DATA = Object.freeze({
|
|
409
|
+
character: SINGLE_QUOTE,
|
|
410
|
+
codePoint: 39
|
|
411
|
+
});
|
|
412
|
+
DOUBLE_QUOTE_DATA = Object.freeze({
|
|
413
|
+
character: DOUBLE_QUOTE,
|
|
414
|
+
codePoint: 34
|
|
415
|
+
});
|
|
416
|
+
SINGLE_QUOTE_SETTINGS = Object.freeze({
|
|
417
|
+
preferred: SINGLE_QUOTE_DATA,
|
|
418
|
+
alternate: DOUBLE_QUOTE_DATA
|
|
419
|
+
});
|
|
420
|
+
DOUBLE_QUOTE_SETTINGS = Object.freeze({
|
|
421
|
+
preferred: DOUBLE_QUOTE_DATA,
|
|
422
|
+
alternate: SINGLE_QUOTE_DATA
|
|
423
|
+
});
|
|
407
424
|
get_preferred_quote_default = getPreferredQuote;
|
|
408
425
|
}
|
|
409
426
|
});
|
|
@@ -437,15 +454,15 @@ var init_get_east_asian_width = __esm({
|
|
|
437
454
|
}
|
|
438
455
|
});
|
|
439
456
|
|
|
440
|
-
// src/
|
|
457
|
+
// src/utilities/narrow-emojis.evaluate.js
|
|
441
458
|
var narrow_emojis_evaluate_default;
|
|
442
459
|
var init_narrow_emojis_evaluate = __esm({
|
|
443
|
-
"src/
|
|
460
|
+
"src/utilities/narrow-emojis.evaluate.js"() {
|
|
444
461
|
narrow_emojis_evaluate_default = "\xA9\xAE\u203C\u2049\u2122\u2139\u2194\u2195\u2196\u2197\u2198\u2199\u21A9\u21AA\u2328\u23CF\u23F1\u23F2\u23F8\u23F9\u23FA\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600\u2601\u2602\u2603\u2604\u260E\u2611\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638\u2639\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694\u2695\u2696\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F1\u26F7\u26F8\u26F9\u2702\u2708\u2709\u270C\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u2764\u27A1\u2934\u2935\u2B05\u2B06\u2B07";
|
|
445
462
|
}
|
|
446
463
|
});
|
|
447
464
|
|
|
448
|
-
// src/
|
|
465
|
+
// src/utilities/get-string-width.js
|
|
449
466
|
function getStringWidth(text) {
|
|
450
467
|
if (!text) {
|
|
451
468
|
return 0;
|
|
@@ -475,7 +492,7 @@ function getStringWidth(text) {
|
|
|
475
492
|
}
|
|
476
493
|
var notAsciiRegex, narrowEmojisSet, get_string_width_default;
|
|
477
494
|
var init_get_string_width = __esm({
|
|
478
|
-
"src/
|
|
495
|
+
"src/utilities/get-string-width.js"() {
|
|
479
496
|
init_emoji_regex();
|
|
480
497
|
init_get_east_asian_width();
|
|
481
498
|
init_narrow_emojis_evaluate();
|
|
@@ -485,7 +502,7 @@ var init_get_string_width = __esm({
|
|
|
485
502
|
}
|
|
486
503
|
});
|
|
487
504
|
|
|
488
|
-
// src/
|
|
505
|
+
// src/utilities/has-newline-in-range.js
|
|
489
506
|
function hasNewlineInRange(text, startIndex, endIndex) {
|
|
490
507
|
for (let i = startIndex; i < endIndex; ++i) {
|
|
491
508
|
if (text.charAt(i) === "\n") {
|
|
@@ -496,12 +513,12 @@ function hasNewlineInRange(text, startIndex, endIndex) {
|
|
|
496
513
|
}
|
|
497
514
|
var has_newline_in_range_default;
|
|
498
515
|
var init_has_newline_in_range = __esm({
|
|
499
|
-
"src/
|
|
516
|
+
"src/utilities/has-newline-in-range.js"() {
|
|
500
517
|
has_newline_in_range_default = hasNewlineInRange;
|
|
501
518
|
}
|
|
502
519
|
});
|
|
503
520
|
|
|
504
|
-
// src/
|
|
521
|
+
// src/utilities/has-spaces.js
|
|
505
522
|
function hasSpaces(text, startIndex, options = {}) {
|
|
506
523
|
const idx = skipSpaces(
|
|
507
524
|
text,
|
|
@@ -512,13 +529,13 @@ function hasSpaces(text, startIndex, options = {}) {
|
|
|
512
529
|
}
|
|
513
530
|
var has_spaces_default;
|
|
514
531
|
var init_has_spaces = __esm({
|
|
515
|
-
"src/
|
|
532
|
+
"src/utilities/has-spaces.js"() {
|
|
516
533
|
init_skip();
|
|
517
534
|
has_spaces_default = hasSpaces;
|
|
518
535
|
}
|
|
519
536
|
});
|
|
520
537
|
|
|
521
|
-
// src/
|
|
538
|
+
// src/utilities/public.js
|
|
522
539
|
var public_exports = {};
|
|
523
540
|
__export(public_exports, {
|
|
524
541
|
addDanglingComment: () => addDanglingComment,
|
|
@@ -601,12 +618,12 @@ function isNextLineEmpty2(text, startIndex) {
|
|
|
601
618
|
);
|
|
602
619
|
}
|
|
603
620
|
var init_public = __esm({
|
|
604
|
-
"src/
|
|
621
|
+
"src/utilities/public.js"() {
|
|
605
622
|
init_method_replace_all();
|
|
606
623
|
init_get_next_non_space_non_comment_character_index();
|
|
607
624
|
init_is_next_line_empty();
|
|
608
625
|
init_is_previous_line_empty();
|
|
609
|
-
|
|
626
|
+
init_utilities();
|
|
610
627
|
init_get_alignment_size();
|
|
611
628
|
init_get_indent_size();
|
|
612
629
|
init_get_max_continuous_count();
|
|
@@ -631,7 +648,7 @@ __export(version_evaluate_exports, {
|
|
|
631
648
|
var version_evaluate_default;
|
|
632
649
|
var init_version_evaluate = __esm({
|
|
633
650
|
"src/main/version.evaluate.js"() {
|
|
634
|
-
version_evaluate_default = "3.
|
|
651
|
+
version_evaluate_default = "3.8.0";
|
|
635
652
|
}
|
|
636
653
|
});
|
|
637
654
|
|
package/index.d.ts
CHANGED
|
@@ -844,7 +844,7 @@ export function getSupportInfo(
|
|
|
844
844
|
*/
|
|
845
845
|
export const version: string;
|
|
846
846
|
|
|
847
|
-
// https://github.com/prettier/prettier/blob/
|
|
847
|
+
// https://github.com/prettier/prettier/blob/main/src/utilities/public.js
|
|
848
848
|
export namespace util {
|
|
849
849
|
interface SkipOptions {
|
|
850
850
|
backwards?: boolean | undefined;
|