release: WRNexusJS 0.3.0

This commit is contained in:
2026-07-22 17:29:08 +05:30
parent 13dfa31d19
commit 07d8fb59d6
145 changed files with 9664 additions and 3881 deletions
+12 -2
View File
@@ -179,11 +179,14 @@ function parseOpeningTag(value) {
const inlineClosing = remainder === `</${tagName}>`;
const closesInRemainder = remainder.startsWith(`</${tagName}>`);
return {
tagName,
attributes,
selfClosing,
inlineClosing,
closesInRemainder,
remainder,
};
}
@@ -202,7 +205,11 @@ function formatOpeningTag(value, unit, depth, printWidth = 100) {
const attributeIndent = unit.repeat(depth + 1);
const normalizedSingleLine = value.replace(/\s+/g, " ").trim();
const normalizedOpening = `<${parsed.tagName}${
parsed.attributes.length ? ` ${parsed.attributes.join(" ")}` : ""
}${parsed.selfClosing ? " /" : ""}>`;
const normalizedSingleLine = `${normalizedOpening}${parsed.remainder}`;
const shouldBreak =
parsed.attributes.length > 1 ||
@@ -212,6 +219,7 @@ function formatOpeningTag(value, unit, depth, printWidth = 100) {
const opensElement =
!parsed.selfClosing &&
!parsed.inlineClosing &&
!parsed.closesInRemainder &&
!VOID_ELEMENTS.has(parsed.tagName.toLowerCase());
if (!shouldBreak) {
@@ -375,7 +383,9 @@ function collectOpeningTag(inputLines, startIndex) {
}
return {
value: collected.join(" "),
// Preserve the fact that the opening tag was already multiline so a
// second formatter pass cannot collapse it back to one line.
value: collected.join("\n"),
endIndex: index,
};
}