release: WRNexusJS 0.2.27
This commit is contained in:
@@ -46,8 +46,7 @@ function findOpeningTagEnd(value) {
|
||||
|
||||
function parseAttributes(value) {
|
||||
const attributes = [];
|
||||
const pattern =
|
||||
/[^\s"'=<>`]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/g;
|
||||
const pattern = /[^\s"'=<>`]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/g;
|
||||
|
||||
let match;
|
||||
|
||||
@@ -121,9 +120,7 @@ function formatOpeningTag(value, unit, depth, printWidth = 100) {
|
||||
|
||||
const lines = [
|
||||
`${baseIndent}<${parsed.tagName}`,
|
||||
...parsed.attributes.map(
|
||||
(attribute) => `${attributeIndent}${attribute}`,
|
||||
),
|
||||
...parsed.attributes.map((attribute) => `${attributeIndent}${attribute}`),
|
||||
];
|
||||
|
||||
if (parsed.inlineClosing) {
|
||||
@@ -182,10 +179,7 @@ function isWrnBlockOpening(value) {
|
||||
}
|
||||
|
||||
function formatWrn(source, options = {}) {
|
||||
const unit =
|
||||
options.insertSpaces === false
|
||||
? "\t"
|
||||
: " ".repeat(options.tabSize || 4);
|
||||
const unit = options.insertSpaces === false ? "\t" : " ".repeat(options.tabSize || 4);
|
||||
|
||||
const printWidth = options.printWidth || 100;
|
||||
const inputLines = source.replace(/\r\n/g, "\n").split("\n");
|
||||
@@ -251,12 +245,7 @@ function formatWrn(source, options = {}) {
|
||||
!value.startsWith("<!--") &&
|
||||
!isInlineElement(value)
|
||||
) {
|
||||
const formattedTag = formatOpeningTag(
|
||||
value,
|
||||
unit,
|
||||
depth,
|
||||
printWidth,
|
||||
);
|
||||
const formattedTag = formatOpeningTag(value, unit, depth, printWidth);
|
||||
|
||||
output.push(...formattedTag.lines);
|
||||
|
||||
@@ -284,4 +273,4 @@ function formatWrn(source, options = {}) {
|
||||
module.exports = {
|
||||
formatOpeningTag,
|
||||
formatWrn,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user