prettier
Advanced tools
+27
-21
@@ -1099,6 +1099,9 @@ (function (factory) { | ||
| }]; | ||
| let out = []; | ||
| let output = ""; | ||
| let shouldRemeasure = false; | ||
| const lineSuffix2 = []; | ||
| const cursorPositions = []; | ||
| const settledOutput = []; | ||
| const settledCursorPositions = []; | ||
| let settledTextLength = 0; | ||
| propagateBreaks(doc); | ||
@@ -1121,3 +1124,3 @@ while (commands.length > 0) { | ||
| if (formatted2) { | ||
| out.push(formatted2); | ||
| output += formatted2; | ||
| if (commands.length > 0) { | ||
@@ -1138,11 +1141,8 @@ position += get_string_width_default(formatted2); | ||
| break; | ||
| case DOC_TYPE_CURSOR: { | ||
| case DOC_TYPE_CURSOR: | ||
| if (cursorPositions.length >= 2) { | ||
| throw new Error("There are too many 'cursor' in doc."); | ||
| } | ||
| const text = out.join(""); | ||
| out = [text]; | ||
| cursorPositions.push(text.length - 1); | ||
| cursorPositions.push(settledTextLength + output.length); | ||
| break; | ||
| } | ||
| case DOC_TYPE_INDENT: | ||
@@ -1386,3 +1386,3 @@ commands.push({ | ||
| if (!doc2.soft) { | ||
| out.push(" "); | ||
| output += " "; | ||
| position += 1; | ||
@@ -1406,7 +1406,7 @@ } | ||
| if (doc2.literal) { | ||
| out.push(newLine); | ||
| output += newLine; | ||
| position = 0; | ||
| if (indent2.root) { | ||
| if (indent2.root.value) { | ||
| out.push(indent2.root.value); | ||
| output += indent2.root.value; | ||
| } | ||
@@ -1417,3 +1417,3 @@ position = indent2.root.length; | ||
| trim2(); | ||
| out.push(newLine + indent2.value); | ||
| output += newLine + indent2.value; | ||
| position = indent2.length; | ||
@@ -1441,4 +1441,5 @@ } | ||
| } | ||
| const formatted = out.join(""); | ||
| if (cursorPositions.length !== 2) { | ||
| const formatted = settledOutput.join("") + output; | ||
| const finalCursorPositions = [...settledCursorPositions, ...cursorPositions]; | ||
| if (finalCursorPositions.length !== 2) { | ||
| return { | ||
@@ -1448,3 +1449,3 @@ formatted | ||
| } | ||
| const cursorNodeStart = cursorPositions[0] + 1; | ||
| const cursorNodeStart = finalCursorPositions[0]; | ||
| return { | ||
@@ -1456,15 +1457,20 @@ formatted, | ||
| 0, | ||
| cursorPositions, | ||
| finalCursorPositions, | ||
| -1 | ||
| ) + 1) | ||
| )) | ||
| }; | ||
| function trim2() { | ||
| const { | ||
| text, | ||
| text: trimmed, | ||
| count | ||
| } = trimIndentation(out.join("")); | ||
| out = [text]; | ||
| } = trimIndentation(output); | ||
| if (trimmed) { | ||
| settledOutput.push(trimmed); | ||
| settledTextLength += trimmed.length; | ||
| } | ||
| output = ""; | ||
| position -= count; | ||
| for (let index = 0; index < cursorPositions.length; index++) { | ||
| cursorPositions[index] = Math.min(cursorPositions[index], text.length - 1); | ||
| if (cursorPositions.length > 0) { | ||
| settledCursorPositions.push(...cursorPositions.map((position2) => Math.min(position2, settledTextLength))); | ||
| cursorPositions.length = 0; | ||
| } | ||
@@ -1471,0 +1477,0 @@ } |
+27
-21
@@ -1064,6 +1064,9 @@ var __defProp = Object.defineProperty; | ||
| }]; | ||
| let out = []; | ||
| let output = ""; | ||
| let shouldRemeasure = false; | ||
| const lineSuffix2 = []; | ||
| const cursorPositions = []; | ||
| const settledOutput = []; | ||
| const settledCursorPositions = []; | ||
| let settledTextLength = 0; | ||
| propagateBreaks(doc); | ||
@@ -1086,3 +1089,3 @@ while (commands.length > 0) { | ||
| if (formatted2) { | ||
| out.push(formatted2); | ||
| output += formatted2; | ||
| if (commands.length > 0) { | ||
@@ -1103,11 +1106,8 @@ position += get_string_width_default(formatted2); | ||
| break; | ||
| case DOC_TYPE_CURSOR: { | ||
| case DOC_TYPE_CURSOR: | ||
| if (cursorPositions.length >= 2) { | ||
| throw new Error("There are too many 'cursor' in doc."); | ||
| } | ||
| const text = out.join(""); | ||
| out = [text]; | ||
| cursorPositions.push(text.length - 1); | ||
| cursorPositions.push(settledTextLength + output.length); | ||
| break; | ||
| } | ||
| case DOC_TYPE_INDENT: | ||
@@ -1351,3 +1351,3 @@ commands.push({ | ||
| if (!doc2.soft) { | ||
| out.push(" "); | ||
| output += " "; | ||
| position += 1; | ||
@@ -1371,7 +1371,7 @@ } | ||
| if (doc2.literal) { | ||
| out.push(newLine); | ||
| output += newLine; | ||
| position = 0; | ||
| if (indent2.root) { | ||
| if (indent2.root.value) { | ||
| out.push(indent2.root.value); | ||
| output += indent2.root.value; | ||
| } | ||
@@ -1382,3 +1382,3 @@ position = indent2.root.length; | ||
| trim2(); | ||
| out.push(newLine + indent2.value); | ||
| output += newLine + indent2.value; | ||
| position = indent2.length; | ||
@@ -1406,4 +1406,5 @@ } | ||
| } | ||
| const formatted = out.join(""); | ||
| if (cursorPositions.length !== 2) { | ||
| const formatted = settledOutput.join("") + output; | ||
| const finalCursorPositions = [...settledCursorPositions, ...cursorPositions]; | ||
| if (finalCursorPositions.length !== 2) { | ||
| return { | ||
@@ -1413,3 +1414,3 @@ formatted | ||
| } | ||
| const cursorNodeStart = cursorPositions[0] + 1; | ||
| const cursorNodeStart = finalCursorPositions[0]; | ||
| return { | ||
@@ -1421,15 +1422,20 @@ formatted, | ||
| 0, | ||
| cursorPositions, | ||
| finalCursorPositions, | ||
| -1 | ||
| ) + 1) | ||
| )) | ||
| }; | ||
| function trim2() { | ||
| const { | ||
| text, | ||
| text: trimmed, | ||
| count | ||
| } = trimIndentation(out.join("")); | ||
| out = [text]; | ||
| } = trimIndentation(output); | ||
| if (trimmed) { | ||
| settledOutput.push(trimmed); | ||
| settledTextLength += trimmed.length; | ||
| } | ||
| output = ""; | ||
| position -= count; | ||
| for (let index = 0; index < cursorPositions.length; index++) { | ||
| cursorPositions[index] = Math.min(cursorPositions[index], text.length - 1); | ||
| if (cursorPositions.length > 0) { | ||
| settledCursorPositions.push(...cursorPositions.map((position2) => Math.min(position2, settledTextLength))); | ||
| cursorPositions.length = 0; | ||
| } | ||
@@ -1436,0 +1442,0 @@ } |
+1
-1
@@ -634,3 +634,3 @@ "use strict"; | ||
| "src/main/version.evaluate.js"() { | ||
| version_evaluate_default = "3.7.0"; | ||
| version_evaluate_default = "3.7.1"; | ||
| } | ||
@@ -637,0 +637,0 @@ }); |
+4
-4
@@ -769,4 +769,3 @@ // Copied from `@types/prettier` | ||
| export interface BooleanArraySupportOption | ||
| extends BaseSupportOption<"boolean"> { | ||
| export interface BooleanArraySupportOption extends BaseSupportOption<"boolean"> { | ||
| default?: Array<{ value: boolean[] }> | undefined; | ||
@@ -776,4 +775,5 @@ array: true; | ||
| export interface ChoiceSupportOption<Value = any> | ||
| extends BaseSupportOption<"choice"> { | ||
| export interface ChoiceSupportOption< | ||
| Value = any, | ||
| > extends BaseSupportOption<"choice"> { | ||
| default?: Value | Array<{ value: Value }> | undefined; | ||
@@ -780,0 +780,0 @@ description: string; |
+1
-1
| { | ||
| "name": "prettier", | ||
| "version": "3.7.0", | ||
| "version": "3.7.1", | ||
| "description": "Prettier is an opinionated code formatter", | ||
@@ -5,0 +5,0 @@ "bin": "./bin/prettier.cjs", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
8586817
0.01%70438
0.02%