Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

prettier

Package Overview
Dependencies
Maintainers
11
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier - npm Package Compare versions

Comparing version
3.7.0
to
3.7.1
+27
-21
doc.js

@@ -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 @@ }

@@ -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 @@ });

@@ -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;

{
"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