prettier 3.2.2 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -2
- data/README.md +23 -59
- data/lib/prettier.rb +7 -5
- data/node_modules/prettier/LICENSE +5205 -0
- data/node_modules/prettier/README.md +109 -0
- data/node_modules/prettier/{bin-prettier.js → bin/prettier.cjs} +10 -5
- data/node_modules/prettier/doc.d.ts +240 -0
- data/node_modules/prettier/doc.js +1257 -1309
- data/node_modules/prettier/doc.mjs +1312 -0
- data/node_modules/prettier/index.cjs +655 -0
- data/node_modules/prettier/index.d.ts +915 -0
- data/node_modules/prettier/index.mjs +21845 -0
- data/node_modules/prettier/internal/cli.mjs +6978 -0
- data/node_modules/prettier/internal/internal.mjs +6531 -0
- data/node_modules/prettier/package.json +179 -6
- data/node_modules/prettier/plugins/acorn.d.ts +6 -0
- data/node_modules/prettier/plugins/acorn.js +13 -0
- data/node_modules/prettier/plugins/acorn.mjs +13 -0
- data/node_modules/prettier/plugins/angular.d.ts +8 -0
- data/node_modules/prettier/plugins/angular.js +2 -0
- data/node_modules/prettier/plugins/angular.mjs +2 -0
- data/node_modules/prettier/plugins/babel.d.ts +17 -0
- data/node_modules/prettier/plugins/babel.js +16 -0
- data/node_modules/prettier/plugins/babel.mjs +16 -0
- data/node_modules/prettier/plugins/estree.d.ts +0 -0
- data/node_modules/prettier/plugins/estree.js +35 -0
- data/node_modules/prettier/plugins/estree.mjs +35 -0
- data/node_modules/prettier/plugins/flow.d.ts +5 -0
- data/node_modules/prettier/plugins/flow.js +21 -0
- data/node_modules/prettier/plugins/flow.mjs +21 -0
- data/node_modules/prettier/plugins/glimmer.d.ts +5 -0
- data/node_modules/prettier/plugins/glimmer.js +30 -0
- data/node_modules/prettier/plugins/glimmer.mjs +30 -0
- data/node_modules/prettier/plugins/graphql.d.ts +5 -0
- data/node_modules/prettier/plugins/graphql.js +29 -0
- data/node_modules/prettier/plugins/graphql.mjs +29 -0
- data/node_modules/prettier/plugins/html.d.ts +8 -0
- data/node_modules/prettier/plugins/html.js +19 -0
- data/node_modules/prettier/plugins/html.mjs +19 -0
- data/node_modules/prettier/plugins/markdown.d.ts +7 -0
- data/node_modules/prettier/plugins/markdown.js +59 -0
- data/node_modules/prettier/plugins/markdown.mjs +59 -0
- data/node_modules/prettier/plugins/meriyah.d.ts +5 -0
- data/node_modules/prettier/plugins/meriyah.js +5 -0
- data/node_modules/prettier/plugins/meriyah.mjs +5 -0
- data/node_modules/prettier/plugins/postcss.d.ts +7 -0
- data/node_modules/prettier/plugins/postcss.js +52 -0
- data/node_modules/prettier/plugins/postcss.mjs +52 -0
- data/node_modules/prettier/plugins/typescript.d.ts +5 -0
- data/node_modules/prettier/plugins/typescript.js +27 -0
- data/node_modules/prettier/plugins/typescript.mjs +27 -0
- data/node_modules/prettier/plugins/yaml.d.ts +5 -0
- data/node_modules/prettier/plugins/yaml.js +161 -0
- data/node_modules/prettier/plugins/yaml.mjs +161 -0
- data/node_modules/prettier/standalone.d.ts +33 -0
- data/node_modules/prettier/standalone.js +34 -0
- data/node_modules/prettier/standalone.mjs +34 -0
- data/package.json +15 -10
- data/src/plugin.js +210 -14
- data/src/server.rb +50 -87
- metadata +60 -28
- data/CONTRIBUTING.md +0 -185
- data/node_modules/prettier/cli.js +0 -15085
- data/node_modules/prettier/index.js +0 -37282
- data/node_modules/prettier/parser-angular.js +0 -2
- data/node_modules/prettier/parser-babel.js +0 -27
- data/node_modules/prettier/parser-espree.js +0 -26
- data/node_modules/prettier/parser-flow.js +0 -35
- data/node_modules/prettier/parser-glimmer.js +0 -27
- data/node_modules/prettier/parser-graphql.js +0 -15
- data/node_modules/prettier/parser-html.js +0 -36
- data/node_modules/prettier/parser-markdown.js +0 -76
- data/node_modules/prettier/parser-meriyah.js +0 -19
- data/node_modules/prettier/parser-postcss.js +0 -76
- data/node_modules/prettier/parser-typescript.js +0 -280
- data/node_modules/prettier/parser-yaml.js +0 -150
- data/node_modules/prettier/third-party.js +0 -8978
- data/src/getInfo.js +0 -23
- data/src/netcat.js +0 -13
- data/src/parseSync.js +0 -236
@@ -0,0 +1,655 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __esm = (fn, res) => function __init() {
|
9
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
10
|
+
};
|
11
|
+
var __commonJS = (cb, mod) => function __require() {
|
12
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
13
|
+
};
|
14
|
+
var __export = (target, all) => {
|
15
|
+
for (var name in all)
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
17
|
+
};
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
20
|
+
for (let key of __getOwnPropNames(from))
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
23
|
+
}
|
24
|
+
return to;
|
25
|
+
};
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
27
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
28
|
+
// file that has been converted to a CommonJS file using a Babel-
|
29
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
30
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
31
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
32
|
+
mod
|
33
|
+
));
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
35
|
+
|
36
|
+
// src/utils/skip-inline-comment.js
|
37
|
+
function skipInlineComment(text, startIndex) {
|
38
|
+
if (startIndex === false) {
|
39
|
+
return false;
|
40
|
+
}
|
41
|
+
if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "*") {
|
42
|
+
for (let i = startIndex + 2; i < text.length; ++i) {
|
43
|
+
if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
|
44
|
+
return i + 2;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return startIndex;
|
49
|
+
}
|
50
|
+
var skip_inline_comment_default;
|
51
|
+
var init_skip_inline_comment = __esm({
|
52
|
+
"src/utils/skip-inline-comment.js"() {
|
53
|
+
skip_inline_comment_default = skipInlineComment;
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// src/utils/skip-newline.js
|
58
|
+
function skipNewline(text, startIndex, options) {
|
59
|
+
const backwards = Boolean(options == null ? void 0 : options.backwards);
|
60
|
+
if (startIndex === false) {
|
61
|
+
return false;
|
62
|
+
}
|
63
|
+
const character = text.charAt(startIndex);
|
64
|
+
if (backwards) {
|
65
|
+
if (text.charAt(startIndex - 1) === "\r" && character === "\n") {
|
66
|
+
return startIndex - 2;
|
67
|
+
}
|
68
|
+
if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
|
69
|
+
return startIndex - 1;
|
70
|
+
}
|
71
|
+
} else {
|
72
|
+
if (character === "\r" && text.charAt(startIndex + 1) === "\n") {
|
73
|
+
return startIndex + 2;
|
74
|
+
}
|
75
|
+
if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
|
76
|
+
return startIndex + 1;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return startIndex;
|
80
|
+
}
|
81
|
+
var skip_newline_default;
|
82
|
+
var init_skip_newline = __esm({
|
83
|
+
"src/utils/skip-newline.js"() {
|
84
|
+
skip_newline_default = skipNewline;
|
85
|
+
}
|
86
|
+
});
|
87
|
+
|
88
|
+
// src/utils/skip.js
|
89
|
+
function skip(characters) {
|
90
|
+
return (text, startIndex, options) => {
|
91
|
+
const backwards = Boolean(options == null ? void 0 : options.backwards);
|
92
|
+
if (startIndex === false) {
|
93
|
+
return false;
|
94
|
+
}
|
95
|
+
const { length } = text;
|
96
|
+
let cursor = startIndex;
|
97
|
+
while (cursor >= 0 && cursor < length) {
|
98
|
+
const character = text.charAt(cursor);
|
99
|
+
if (characters instanceof RegExp) {
|
100
|
+
if (!characters.test(character)) {
|
101
|
+
return cursor;
|
102
|
+
}
|
103
|
+
} else if (!characters.includes(character)) {
|
104
|
+
return cursor;
|
105
|
+
}
|
106
|
+
backwards ? cursor-- : cursor++;
|
107
|
+
}
|
108
|
+
if (cursor === -1 || cursor === length) {
|
109
|
+
return cursor;
|
110
|
+
}
|
111
|
+
return false;
|
112
|
+
};
|
113
|
+
}
|
114
|
+
var skipWhitespace, skipSpaces, skipToLineEnd, skipEverythingButNewLine;
|
115
|
+
var init_skip = __esm({
|
116
|
+
"src/utils/skip.js"() {
|
117
|
+
skipWhitespace = skip(/\s/);
|
118
|
+
skipSpaces = skip(" ");
|
119
|
+
skipToLineEnd = skip(",; ");
|
120
|
+
skipEverythingButNewLine = skip(/[^\n\r]/);
|
121
|
+
}
|
122
|
+
});
|
123
|
+
|
124
|
+
// src/utils/skip-trailing-comment.js
|
125
|
+
function skipTrailingComment(text, startIndex) {
|
126
|
+
if (startIndex === false) {
|
127
|
+
return false;
|
128
|
+
}
|
129
|
+
if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "/") {
|
130
|
+
return skipEverythingButNewLine(text, startIndex);
|
131
|
+
}
|
132
|
+
return startIndex;
|
133
|
+
}
|
134
|
+
var skip_trailing_comment_default;
|
135
|
+
var init_skip_trailing_comment = __esm({
|
136
|
+
"src/utils/skip-trailing-comment.js"() {
|
137
|
+
init_skip();
|
138
|
+
skip_trailing_comment_default = skipTrailingComment;
|
139
|
+
}
|
140
|
+
});
|
141
|
+
|
142
|
+
// src/utils/get-next-non-space-non-comment-character-index.js
|
143
|
+
function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
|
144
|
+
let oldIdx = null;
|
145
|
+
let nextIdx = startIndex;
|
146
|
+
while (nextIdx !== oldIdx) {
|
147
|
+
oldIdx = nextIdx;
|
148
|
+
nextIdx = skipSpaces(text, nextIdx);
|
149
|
+
nextIdx = skip_inline_comment_default(text, nextIdx);
|
150
|
+
nextIdx = skip_trailing_comment_default(text, nextIdx);
|
151
|
+
nextIdx = skip_newline_default(text, nextIdx);
|
152
|
+
}
|
153
|
+
return nextIdx;
|
154
|
+
}
|
155
|
+
var get_next_non_space_non_comment_character_index_default;
|
156
|
+
var init_get_next_non_space_non_comment_character_index = __esm({
|
157
|
+
"src/utils/get-next-non-space-non-comment-character-index.js"() {
|
158
|
+
init_skip_inline_comment();
|
159
|
+
init_skip_newline();
|
160
|
+
init_skip_trailing_comment();
|
161
|
+
init_skip();
|
162
|
+
get_next_non_space_non_comment_character_index_default = getNextNonSpaceNonCommentCharacterIndex;
|
163
|
+
}
|
164
|
+
});
|
165
|
+
|
166
|
+
// src/utils/is-previous-line-empty.js
|
167
|
+
function isPreviousLineEmpty(text, startIndex) {
|
168
|
+
let idx = startIndex - 1;
|
169
|
+
idx = skipSpaces(text, idx, { backwards: true });
|
170
|
+
idx = skip_newline_default(text, idx, { backwards: true });
|
171
|
+
idx = skipSpaces(text, idx, { backwards: true });
|
172
|
+
const idx2 = skip_newline_default(text, idx, { backwards: true });
|
173
|
+
return idx !== idx2;
|
174
|
+
}
|
175
|
+
var is_previous_line_empty_default;
|
176
|
+
var init_is_previous_line_empty = __esm({
|
177
|
+
"src/utils/is-previous-line-empty.js"() {
|
178
|
+
init_skip_newline();
|
179
|
+
init_skip();
|
180
|
+
is_previous_line_empty_default = isPreviousLineEmpty;
|
181
|
+
}
|
182
|
+
});
|
183
|
+
|
184
|
+
// src/utils/has-newline.js
|
185
|
+
function hasNewline(text, startIndex, options = {}) {
|
186
|
+
const idx = skipSpaces(
|
187
|
+
text,
|
188
|
+
options.backwards ? startIndex - 1 : startIndex,
|
189
|
+
options
|
190
|
+
);
|
191
|
+
const idx2 = skip_newline_default(text, idx, options);
|
192
|
+
return idx !== idx2;
|
193
|
+
}
|
194
|
+
var has_newline_default;
|
195
|
+
var init_has_newline = __esm({
|
196
|
+
"src/utils/has-newline.js"() {
|
197
|
+
init_skip();
|
198
|
+
init_skip_newline();
|
199
|
+
has_newline_default = hasNewline;
|
200
|
+
}
|
201
|
+
});
|
202
|
+
|
203
|
+
// src/utils/is-next-line-empty.js
|
204
|
+
function isNextLineEmpty(text, startIndex) {
|
205
|
+
let oldIdx = null;
|
206
|
+
let idx = startIndex;
|
207
|
+
while (idx !== oldIdx) {
|
208
|
+
oldIdx = idx;
|
209
|
+
idx = skipToLineEnd(text, idx);
|
210
|
+
idx = skip_inline_comment_default(text, idx);
|
211
|
+
idx = skipSpaces(text, idx);
|
212
|
+
}
|
213
|
+
idx = skip_trailing_comment_default(text, idx);
|
214
|
+
idx = skip_newline_default(text, idx);
|
215
|
+
return idx !== false && has_newline_default(text, idx);
|
216
|
+
}
|
217
|
+
var is_next_line_empty_default;
|
218
|
+
var init_is_next_line_empty = __esm({
|
219
|
+
"src/utils/is-next-line-empty.js"() {
|
220
|
+
init_skip_newline();
|
221
|
+
init_skip();
|
222
|
+
init_skip_inline_comment();
|
223
|
+
init_skip_trailing_comment();
|
224
|
+
init_has_newline();
|
225
|
+
is_next_line_empty_default = isNextLineEmpty;
|
226
|
+
}
|
227
|
+
});
|
228
|
+
|
229
|
+
// node_modules/escape-string-regexp/index.js
|
230
|
+
function escapeStringRegexp(string) {
|
231
|
+
if (typeof string !== "string") {
|
232
|
+
throw new TypeError("Expected a string");
|
233
|
+
}
|
234
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
235
|
+
}
|
236
|
+
var init_escape_string_regexp = __esm({
|
237
|
+
"node_modules/escape-string-regexp/index.js"() {
|
238
|
+
}
|
239
|
+
});
|
240
|
+
|
241
|
+
// src/utils/get-max-continuous-count.js
|
242
|
+
function getMaxContinuousCount(text, searchString) {
|
243
|
+
const results = text.match(
|
244
|
+
new RegExp(`(${escapeStringRegexp(searchString)})+`, "g")
|
245
|
+
);
|
246
|
+
if (results === null) {
|
247
|
+
return 0;
|
248
|
+
}
|
249
|
+
return results.reduce(
|
250
|
+
(maxCount, result) => Math.max(maxCount, result.length / searchString.length),
|
251
|
+
0
|
252
|
+
);
|
253
|
+
}
|
254
|
+
var get_max_continuous_count_default;
|
255
|
+
var init_get_max_continuous_count = __esm({
|
256
|
+
"src/utils/get-max-continuous-count.js"() {
|
257
|
+
init_escape_string_regexp();
|
258
|
+
get_max_continuous_count_default = getMaxContinuousCount;
|
259
|
+
}
|
260
|
+
});
|
261
|
+
|
262
|
+
// node_modules/emoji-regex/index.mjs
|
263
|
+
var emoji_regex_default;
|
264
|
+
var init_emoji_regex = __esm({
|
265
|
+
"node_modules/emoji-regex/index.mjs"() {
|
266
|
+
emoji_regex_default = () => {
|
267
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
268
|
+
};
|
269
|
+
}
|
270
|
+
});
|
271
|
+
|
272
|
+
// node_modules/eastasianwidth/eastasianwidth.js
|
273
|
+
var eastasianwidth_default;
|
274
|
+
var init_eastasianwidth = __esm({
|
275
|
+
"node_modules/eastasianwidth/eastasianwidth.js"() {
|
276
|
+
eastasianwidth_default = {
|
277
|
+
eastAsianWidth(character) {
|
278
|
+
var x = character.charCodeAt(0);
|
279
|
+
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
280
|
+
var codePoint = x;
|
281
|
+
if (55296 <= x && x <= 56319 && 56320 <= y && y <= 57343) {
|
282
|
+
x &= 1023;
|
283
|
+
y &= 1023;
|
284
|
+
codePoint = x << 10 | y;
|
285
|
+
codePoint += 65536;
|
286
|
+
}
|
287
|
+
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
|
288
|
+
return "F";
|
289
|
+
}
|
290
|
+
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
|
291
|
+
return "W";
|
292
|
+
}
|
293
|
+
return "N";
|
294
|
+
}
|
295
|
+
};
|
296
|
+
}
|
297
|
+
});
|
298
|
+
|
299
|
+
// src/utils/get-string-width.js
|
300
|
+
function getStringWidth(text) {
|
301
|
+
if (!text) {
|
302
|
+
return 0;
|
303
|
+
}
|
304
|
+
if (!notAsciiRegex.test(text)) {
|
305
|
+
return text.length;
|
306
|
+
}
|
307
|
+
text = text.replace(emoji_regex_default(), " ");
|
308
|
+
let width = 0;
|
309
|
+
for (const character of text) {
|
310
|
+
const codePoint = character.codePointAt(0);
|
311
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
312
|
+
continue;
|
313
|
+
}
|
314
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
315
|
+
continue;
|
316
|
+
}
|
317
|
+
const code = eastasianwidth_default.eastAsianWidth(character);
|
318
|
+
width += code === "F" || code === "W" ? 2 : 1;
|
319
|
+
}
|
320
|
+
return width;
|
321
|
+
}
|
322
|
+
var notAsciiRegex, get_string_width_default;
|
323
|
+
var init_get_string_width = __esm({
|
324
|
+
"src/utils/get-string-width.js"() {
|
325
|
+
init_emoji_regex();
|
326
|
+
init_eastasianwidth();
|
327
|
+
notAsciiRegex = /[^\x20-\x7F]/;
|
328
|
+
get_string_width_default = getStringWidth;
|
329
|
+
}
|
330
|
+
});
|
331
|
+
|
332
|
+
// src/utils/get-alignment-size.js
|
333
|
+
function getAlignmentSize(text, tabWidth, startIndex = 0) {
|
334
|
+
let size = 0;
|
335
|
+
for (let i = startIndex; i < text.length; ++i) {
|
336
|
+
if (text[i] === " ") {
|
337
|
+
size = size + tabWidth - size % tabWidth;
|
338
|
+
} else {
|
339
|
+
size++;
|
340
|
+
}
|
341
|
+
}
|
342
|
+
return size;
|
343
|
+
}
|
344
|
+
var get_alignment_size_default;
|
345
|
+
var init_get_alignment_size = __esm({
|
346
|
+
"src/utils/get-alignment-size.js"() {
|
347
|
+
get_alignment_size_default = getAlignmentSize;
|
348
|
+
}
|
349
|
+
});
|
350
|
+
|
351
|
+
// src/utils/get-indent-size.js
|
352
|
+
function getIndentSize(value, tabWidth) {
|
353
|
+
const lastNewlineIndex = value.lastIndexOf("\n");
|
354
|
+
if (lastNewlineIndex === -1) {
|
355
|
+
return 0;
|
356
|
+
}
|
357
|
+
return get_alignment_size_default(
|
358
|
+
// All the leading whitespaces
|
359
|
+
value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0],
|
360
|
+
tabWidth
|
361
|
+
);
|
362
|
+
}
|
363
|
+
var get_indent_size_default;
|
364
|
+
var init_get_indent_size = __esm({
|
365
|
+
"src/utils/get-indent-size.js"() {
|
366
|
+
init_get_alignment_size();
|
367
|
+
get_indent_size_default = getIndentSize;
|
368
|
+
}
|
369
|
+
});
|
370
|
+
|
371
|
+
// src/utils/has-newline-in-range.js
|
372
|
+
function hasNewlineInRange(text, startIndex, endIndex) {
|
373
|
+
for (let i = startIndex; i < endIndex; ++i) {
|
374
|
+
if (text.charAt(i) === "\n") {
|
375
|
+
return true;
|
376
|
+
}
|
377
|
+
}
|
378
|
+
return false;
|
379
|
+
}
|
380
|
+
var has_newline_in_range_default;
|
381
|
+
var init_has_newline_in_range = __esm({
|
382
|
+
"src/utils/has-newline-in-range.js"() {
|
383
|
+
has_newline_in_range_default = hasNewlineInRange;
|
384
|
+
}
|
385
|
+
});
|
386
|
+
|
387
|
+
// src/utils/has-spaces.js
|
388
|
+
function hasSpaces(text, startIndex, options = {}) {
|
389
|
+
const idx = skipSpaces(
|
390
|
+
text,
|
391
|
+
options.backwards ? startIndex - 1 : startIndex,
|
392
|
+
options
|
393
|
+
);
|
394
|
+
return idx !== startIndex;
|
395
|
+
}
|
396
|
+
var has_spaces_default;
|
397
|
+
var init_has_spaces = __esm({
|
398
|
+
"src/utils/has-spaces.js"() {
|
399
|
+
init_skip();
|
400
|
+
has_spaces_default = hasSpaces;
|
401
|
+
}
|
402
|
+
});
|
403
|
+
|
404
|
+
// src/utils/get-next-non-space-non-comment-character.js
|
405
|
+
function getNextNonSpaceNonCommentCharacter(text, startIndex) {
|
406
|
+
const index = get_next_non_space_non_comment_character_index_default(text, startIndex);
|
407
|
+
return index === false ? "" : text.charAt(index);
|
408
|
+
}
|
409
|
+
var get_next_non_space_non_comment_character_default;
|
410
|
+
var init_get_next_non_space_non_comment_character = __esm({
|
411
|
+
"src/utils/get-next-non-space-non-comment-character.js"() {
|
412
|
+
init_get_next_non_space_non_comment_character_index();
|
413
|
+
get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter;
|
414
|
+
}
|
415
|
+
});
|
416
|
+
|
417
|
+
// scripts/build/shims/string-replace-all.js
|
418
|
+
var stringReplaceAll, string_replace_all_default;
|
419
|
+
var init_string_replace_all = __esm({
|
420
|
+
"scripts/build/shims/string-replace-all.js"() {
|
421
|
+
stringReplaceAll = (isOptionalObject, original, pattern, replacement) => {
|
422
|
+
if (isOptionalObject && (original === void 0 || original === null)) {
|
423
|
+
return;
|
424
|
+
}
|
425
|
+
if (original.replaceAll) {
|
426
|
+
return original.replaceAll(pattern, replacement);
|
427
|
+
}
|
428
|
+
if (pattern.global) {
|
429
|
+
return original.replace(pattern, replacement);
|
430
|
+
}
|
431
|
+
return original.split(pattern).join(replacement);
|
432
|
+
};
|
433
|
+
string_replace_all_default = stringReplaceAll;
|
434
|
+
}
|
435
|
+
});
|
436
|
+
|
437
|
+
// src/utils/make-string.js
|
438
|
+
function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
439
|
+
const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
440
|
+
const regex = /\\(.)|(["'])/gs;
|
441
|
+
const raw = string_replace_all_default(
|
442
|
+
/* isOptionalObject*/
|
443
|
+
false,
|
444
|
+
rawText,
|
445
|
+
regex,
|
446
|
+
(match, escaped, quote) => {
|
447
|
+
if (escaped === otherQuote) {
|
448
|
+
return escaped;
|
449
|
+
}
|
450
|
+
if (quote === enclosingQuote) {
|
451
|
+
return "\\" + quote;
|
452
|
+
}
|
453
|
+
if (quote) {
|
454
|
+
return quote;
|
455
|
+
}
|
456
|
+
return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
|
457
|
+
}
|
458
|
+
);
|
459
|
+
return enclosingQuote + raw + enclosingQuote;
|
460
|
+
}
|
461
|
+
var make_string_default;
|
462
|
+
var init_make_string = __esm({
|
463
|
+
"src/utils/make-string.js"() {
|
464
|
+
init_string_replace_all();
|
465
|
+
make_string_default = makeString;
|
466
|
+
}
|
467
|
+
});
|
468
|
+
|
469
|
+
// src/main/comments/utils.js
|
470
|
+
function describeNodeForDebugging(node) {
|
471
|
+
const nodeType = node.type || node.kind || "(unknown type)";
|
472
|
+
let nodeName = String(
|
473
|
+
node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || ""
|
474
|
+
);
|
475
|
+
if (nodeName.length > 20) {
|
476
|
+
nodeName = nodeName.slice(0, 19) + "\u2026";
|
477
|
+
}
|
478
|
+
return nodeType + (nodeName ? " " + nodeName : "");
|
479
|
+
}
|
480
|
+
function addCommentHelper(node, comment) {
|
481
|
+
const comments = node.comments ?? (node.comments = []);
|
482
|
+
comments.push(comment);
|
483
|
+
comment.printed = false;
|
484
|
+
comment.nodeDescription = describeNodeForDebugging(node);
|
485
|
+
}
|
486
|
+
function addLeadingComment(node, comment) {
|
487
|
+
comment.leading = true;
|
488
|
+
comment.trailing = false;
|
489
|
+
addCommentHelper(node, comment);
|
490
|
+
}
|
491
|
+
function addDanglingComment(node, comment, marker) {
|
492
|
+
comment.leading = false;
|
493
|
+
comment.trailing = false;
|
494
|
+
if (marker) {
|
495
|
+
comment.marker = marker;
|
496
|
+
}
|
497
|
+
addCommentHelper(node, comment);
|
498
|
+
}
|
499
|
+
function addTrailingComment(node, comment) {
|
500
|
+
comment.leading = false;
|
501
|
+
comment.trailing = true;
|
502
|
+
addCommentHelper(node, comment);
|
503
|
+
}
|
504
|
+
var init_utils = __esm({
|
505
|
+
"src/main/comments/utils.js"() {
|
506
|
+
}
|
507
|
+
});
|
508
|
+
|
509
|
+
// src/utils/public.js
|
510
|
+
var public_exports = {};
|
511
|
+
__export(public_exports, {
|
512
|
+
addDanglingComment: () => addDanglingComment,
|
513
|
+
addLeadingComment: () => addLeadingComment,
|
514
|
+
addTrailingComment: () => addTrailingComment,
|
515
|
+
getAlignmentSize: () => get_alignment_size_default,
|
516
|
+
getIndentSize: () => get_indent_size_default,
|
517
|
+
getMaxContinuousCount: () => get_max_continuous_count_default,
|
518
|
+
getNextNonSpaceNonCommentCharacter: () => get_next_non_space_non_comment_character_default,
|
519
|
+
getNextNonSpaceNonCommentCharacterIndex: () => getNextNonSpaceNonCommentCharacterIndex2,
|
520
|
+
getStringWidth: () => get_string_width_default,
|
521
|
+
hasNewline: () => has_newline_default,
|
522
|
+
hasNewlineInRange: () => has_newline_in_range_default,
|
523
|
+
hasSpaces: () => has_spaces_default,
|
524
|
+
isNextLineEmpty: () => isNextLineEmpty2,
|
525
|
+
isNextLineEmptyAfterIndex: () => is_next_line_empty_default,
|
526
|
+
isPreviousLineEmpty: () => isPreviousLineEmpty2,
|
527
|
+
makeString: () => make_string_default,
|
528
|
+
skip: () => skip,
|
529
|
+
skipEverythingButNewLine: () => skipEverythingButNewLine,
|
530
|
+
skipInlineComment: () => skip_inline_comment_default,
|
531
|
+
skipNewline: () => skip_newline_default,
|
532
|
+
skipSpaces: () => skipSpaces,
|
533
|
+
skipToLineEnd: () => skipToLineEnd,
|
534
|
+
skipTrailingComment: () => skip_trailing_comment_default,
|
535
|
+
skipWhitespace: () => skipWhitespace
|
536
|
+
});
|
537
|
+
function legacyGetNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
|
538
|
+
return get_next_non_space_non_comment_character_index_default(
|
539
|
+
text,
|
540
|
+
locEnd(node)
|
541
|
+
);
|
542
|
+
}
|
543
|
+
function getNextNonSpaceNonCommentCharacterIndex2(text, startIndex) {
|
544
|
+
return arguments.length === 2 || typeof startIndex === "number" ? get_next_non_space_non_comment_character_index_default(text, startIndex) : (
|
545
|
+
// @ts-expect-error -- expected
|
546
|
+
// eslint-disable-next-line prefer-rest-params
|
547
|
+
legacyGetNextNonSpaceNonCommentCharacterIndex(...arguments)
|
548
|
+
);
|
549
|
+
}
|
550
|
+
function legacyIsPreviousLineEmpty(text, node, locStart) {
|
551
|
+
return is_previous_line_empty_default(text, locStart(node));
|
552
|
+
}
|
553
|
+
function isPreviousLineEmpty2(text, startIndex) {
|
554
|
+
return arguments.length === 2 || typeof startIndex === "number" ? is_previous_line_empty_default(text, startIndex) : (
|
555
|
+
// @ts-expect-error -- expected
|
556
|
+
// eslint-disable-next-line prefer-rest-params
|
557
|
+
legacyIsPreviousLineEmpty(...arguments)
|
558
|
+
);
|
559
|
+
}
|
560
|
+
function legacyIsNextLineEmpty(text, node, locEnd) {
|
561
|
+
return is_next_line_empty_default(text, locEnd(node));
|
562
|
+
}
|
563
|
+
function isNextLineEmpty2(text, startIndex) {
|
564
|
+
return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
|
565
|
+
// @ts-expect-error -- expected
|
566
|
+
// eslint-disable-next-line prefer-rest-params
|
567
|
+
legacyIsNextLineEmpty(...arguments)
|
568
|
+
);
|
569
|
+
}
|
570
|
+
var init_public = __esm({
|
571
|
+
"src/utils/public.js"() {
|
572
|
+
init_get_next_non_space_non_comment_character_index();
|
573
|
+
init_is_previous_line_empty();
|
574
|
+
init_is_next_line_empty();
|
575
|
+
init_get_max_continuous_count();
|
576
|
+
init_get_string_width();
|
577
|
+
init_get_alignment_size();
|
578
|
+
init_get_indent_size();
|
579
|
+
init_skip_newline();
|
580
|
+
init_skip_inline_comment();
|
581
|
+
init_skip_trailing_comment();
|
582
|
+
init_has_newline();
|
583
|
+
init_has_newline_in_range();
|
584
|
+
init_has_spaces();
|
585
|
+
init_get_next_non_space_non_comment_character();
|
586
|
+
init_make_string();
|
587
|
+
init_skip();
|
588
|
+
init_utils();
|
589
|
+
}
|
590
|
+
});
|
591
|
+
|
592
|
+
// src/main/version.evaluate.cjs
|
593
|
+
var require_version_evaluate = __commonJS({
|
594
|
+
"src/main/version.evaluate.cjs"(exports2, module2) {
|
595
|
+
module2.exports = "3.0.0";
|
596
|
+
}
|
597
|
+
});
|
598
|
+
|
599
|
+
// src/index.cjs
|
600
|
+
var prettierPromise = import("./index.mjs");
|
601
|
+
var functionNames = [
|
602
|
+
"formatWithCursor",
|
603
|
+
"format",
|
604
|
+
"check",
|
605
|
+
"resolveConfig",
|
606
|
+
"resolveConfigFile",
|
607
|
+
"clearConfigCache",
|
608
|
+
"getFileInfo",
|
609
|
+
"getSupportInfo"
|
610
|
+
];
|
611
|
+
var prettier = /* @__PURE__ */ Object.create(null);
|
612
|
+
for (const name of functionNames) {
|
613
|
+
prettier[name] = async (...args) => {
|
614
|
+
const prettier2 = await prettierPromise;
|
615
|
+
return prettier2[name](...args);
|
616
|
+
};
|
617
|
+
}
|
618
|
+
var debugApiFunctionNames = [
|
619
|
+
"parse",
|
620
|
+
"formatAST",
|
621
|
+
"formatDoc",
|
622
|
+
"printToDoc",
|
623
|
+
"printDocToString"
|
624
|
+
];
|
625
|
+
var debugApis = /* @__PURE__ */ Object.create(null);
|
626
|
+
for (const name of debugApiFunctionNames) {
|
627
|
+
debugApis[name] = async (...args) => {
|
628
|
+
const prettier2 = await prettierPromise;
|
629
|
+
return prettier2.__debug[name](...args);
|
630
|
+
};
|
631
|
+
}
|
632
|
+
prettier.__debug = debugApis;
|
633
|
+
if (true) {
|
634
|
+
prettier.util = (init_public(), __toCommonJS(public_exports));
|
635
|
+
prettier.doc = require("./doc.js");
|
636
|
+
} else {
|
637
|
+
Object.defineProperties(prettier, {
|
638
|
+
util: {
|
639
|
+
get() {
|
640
|
+
throw new Error(
|
641
|
+
"prettier.util is not available in development CommonJS version"
|
642
|
+
);
|
643
|
+
}
|
644
|
+
},
|
645
|
+
doc: {
|
646
|
+
get() {
|
647
|
+
throw new Error(
|
648
|
+
"prettier.doc is not available in development CommonJS version"
|
649
|
+
);
|
650
|
+
}
|
651
|
+
}
|
652
|
+
});
|
653
|
+
}
|
654
|
+
prettier.version = require_version_evaluate();
|
655
|
+
module.exports = prettier;
|