prettier-plugin-marko
Advanced tools
Comparing version 1.3.1 to 1.4.0
@@ -23,3 +23,2 @@ import { types as t } from "@marko/compiler"; | ||
export declare const shorthandIdOrClassReg: RegExp; | ||
export declare const forceBreakTagsReg: RegExp; | ||
export declare const preserveSpaceTagsReg: RegExp; |
@@ -49,3 +49,2 @@ "use strict"; | ||
var shorthandIdOrClassReg = /^[a-zA-Z0-9_$][a-zA-Z0-9_$-]*(?:\s+[a-zA-Z0-9_$][a-zA-Z0-9_$-]*)*$/; | ||
var forceBreakTagsReg = /^(?:html|head|body|script|style|for|if|else(?:-if)|while|async|set|try)$/; | ||
var preserveSpaceTagsReg = /^(?:textarea|pre)$/; | ||
@@ -478,3 +477,3 @@ | ||
print(path, opts, print) { | ||
var _a, _b, _c; | ||
var _a, _b, _c, _d; | ||
const node = path.getValue(); | ||
@@ -700,3 +699,3 @@ switch (node.type) { | ||
opts.markoSyntax === "html" ? "" : isFirst ? b5.ifBreak("--", " --", { groupId }) : "--", | ||
opts.markoSyntax === "html" ? preserveSpace || isFirst ? "" : b5.softline : preserveSpace ? b5.hardline : b5.line, | ||
opts.markoSyntax === "html" ? "" : preserveSpace ? b5.hardline : b5.line, | ||
preserveSpace ? textDocs : b5.fill(textDocs), | ||
@@ -718,10 +717,11 @@ opts.markoSyntax === "html" ? "" : b5.ifBreak([b5.softline, "--"]) | ||
} | ||
const sep = (preserveSpace || !textOnly) && (opts.markoSyntax === "concise" || forceBreakTagsReg.test(literalTagName) || node.body.body.some((child) => child.type === "MarkoScriptlet")) ? b5.hardline : preserveSpace ? "" : b5.softline; | ||
const joinSep = (preserveSpace || !textOnly) && (opts.markoSyntax === "concise" || node.body.body.some((child) => child.type === "MarkoScriptlet")) ? b5.hardline : preserveSpace ? "" : b5.softline; | ||
const wrapSep = !preserveSpace && opts.markoSyntax === "html" && (node.var || node.body.params.length || ((_c = node.arguments) == null ? void 0 : _c.length) || node.attributes.length || node.body.body.some((child) => !isTextLike(child, node))) ? b5.hardline : joinSep; | ||
if (opts.markoSyntax === "html") { | ||
doc6.push(">"); | ||
} | ||
if (sep) { | ||
doc6.push(b5.indent([sep, b5.join(sep, bodyDocs)])); | ||
if (joinSep || wrapSep) { | ||
doc6.push(b5.indent([wrapSep, b5.join(joinSep, bodyDocs)])); | ||
if (opts.markoSyntax === "html") { | ||
doc6.push(sep); | ||
doc6.push(wrapSep); | ||
} | ||
@@ -749,3 +749,3 @@ } else { | ||
} | ||
if ((_c = node.arguments) == null ? void 0 : _c.length) { | ||
if ((_d = node.arguments) == null ? void 0 : _d.length) { | ||
doc6.push( | ||
@@ -752,0 +752,0 @@ b5.group([ |
{ | ||
"name": "prettier-plugin-marko", | ||
"description": "A prettier plugin for parsing and printing Marko files", | ||
"version": "1.3.1", | ||
"version": "1.4.0", | ||
"author": "Dylan Piercey <dpiercey@ebay.com>", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/marko-js/prettier/issues", |
Sorry, the diff of this file is not supported yet
70012
1941