prettier-plugin-marko
Advanced tools
Comparing version 1.2.2 to 1.2.3
@@ -12,3 +12,3 @@ import { types as t } from "@marko/compiler"; | ||
} | ||
export declare type MarkoEmbedNode = { | ||
export type MarkoEmbedNode = { | ||
type: "_MarkoEmbed"; | ||
@@ -19,3 +19,3 @@ mode: string; | ||
}; | ||
export declare type Node = t.Node | MarkoEmbedNode; | ||
export type Node = t.Node | MarkoEmbedNode; | ||
export declare const enclosedNodeTypeReg: RegExp; | ||
@@ -22,0 +22,0 @@ export declare const styleReg: RegExp; |
@@ -0,24 +1,8 @@ | ||
"use strict"; | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b6) => { | ||
for (var prop in b6 || (b6 = {})) | ||
if (__hasOwnProp.call(b6, prop)) | ||
__defNormalProp(a, prop, b6[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b6)) { | ||
if (__propIsEnum.call(b6, prop)) | ||
__defNormalProp(a, prop, b6[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b6) => __defProps(a, __getOwnPropDescs(b6)); | ||
var __export = (target, all) => { | ||
@@ -36,3 +20,10 @@ for (var name in all) | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -130,3 +121,6 @@ | ||
} | ||
return opts.originalText.slice(locToPos(startLoc.start, opts), locToPos(endLoc.end, opts)); | ||
return opts.originalText.slice( | ||
locToPos(startLoc.start, opts), | ||
locToPos(endLoc.end, opts) | ||
); | ||
} | ||
@@ -165,45 +159,70 @@ | ||
var enclosedPatterns = []; | ||
enclosedPatterns.push({ | ||
match: /[a-z0-9_$#@.]+/iy | ||
}, { | ||
match: /\/\/.*$/y | ||
}, { | ||
match: /\/\*.*?\*\//y | ||
}, { | ||
match: /\(/y, | ||
patterns: enclosedPatterns, | ||
until: /\)/y | ||
}, { | ||
match: /{/y, | ||
patterns: enclosedPatterns, | ||
until: /}/y | ||
}, { | ||
match: /\[/y, | ||
patterns: enclosedPatterns, | ||
until: /]/y | ||
}, { | ||
match: /'(?:\\.|[^'\\]+)*'/y | ||
}, { | ||
match: /"(?:\\.|[^"\\]+)*"/y | ||
}, { | ||
match: /`/y, | ||
patterns: [ | ||
{ | ||
match: /\\.|\$(?!{)|[^`\\$]+/y | ||
}, | ||
{ | ||
match: /\${/y, | ||
patterns: enclosedPatterns, | ||
until: /}/y | ||
} | ||
], | ||
until: /`/y | ||
}, { | ||
match: /\/(?:\\.|\[(?:\\.|[^\]\\]+)\]|[^[/\\])+\/[a-z]*/iy | ||
}); | ||
enclosedPatterns.push( | ||
{ | ||
// Ignored | ||
match: /[a-z0-9_$#@.]+/iy | ||
}, | ||
{ | ||
// Line comments | ||
match: /\/\/.*$/y | ||
}, | ||
{ | ||
// Multi line comments | ||
match: /\/\*.*?\*\//y | ||
}, | ||
{ | ||
// Parens | ||
match: /\(/y, | ||
patterns: enclosedPatterns, | ||
until: /\)/y | ||
}, | ||
{ | ||
// Braces | ||
match: /{/y, | ||
patterns: enclosedPatterns, | ||
until: /}/y | ||
}, | ||
{ | ||
// Brackets | ||
match: /\[/y, | ||
patterns: enclosedPatterns, | ||
until: /]/y | ||
}, | ||
{ | ||
// Single quote string | ||
match: /'(?:\\.|[^'\\]+)*'/y | ||
}, | ||
{ | ||
// Double quote string | ||
match: /"(?:\\.|[^"\\]+)*"/y | ||
}, | ||
{ | ||
// Template literal | ||
match: /`/y, | ||
patterns: [ | ||
{ | ||
// Content | ||
match: /\\.|\$(?!{)|[^`\\$]+/y | ||
}, | ||
{ | ||
// Expressions | ||
match: /\${/y, | ||
patterns: enclosedPatterns, | ||
until: /}/y | ||
} | ||
], | ||
until: /`/y | ||
}, | ||
{ | ||
// RegExp | ||
match: /\/(?:\\.|\[(?:\\.|[^\]\\]+)\]|[^[/\\])+\/[a-z]*/iy | ||
} | ||
); | ||
var unenclosedPatterns = [ | ||
{ | ||
// Word operators | ||
match: /(?<=\b)\s*(?:as|in(?:stanceof)?|new|void|delete|keyof|typeof)\s+/y | ||
}, | ||
{ | ||
// Symbol operators | ||
match: /\s*(?:[\^~%!]|\+{1,2}|\*{1,2}|-(?:-(?!\s))?|&{1,2}|\|{1,2}|!={0,2}|===?|<{2,3}|>{2,3}|<=?|>=)\s*/y | ||
@@ -253,5 +272,9 @@ } | ||
function withBlockIfNeeded(nodes, opts, docs) { | ||
if (nodes.length > 1 || !enclosedNodeTypeReg.test(nodes[0].type) && outerCodeMatches(import_prettier2.doc.printer.printDocToString(docs, __spreadProps(__spreadValues({}, opts), { | ||
printWidth: 0 | ||
})).formatted, /[\n\r]/y)) { | ||
if (nodes.length > 1 || !enclosedNodeTypeReg.test(nodes[0].type) && outerCodeMatches( | ||
import_prettier2.doc.printer.printDocToString(docs, { | ||
...opts, | ||
printWidth: 0 | ||
}).formatted, | ||
/[\n\r]/y | ||
)) { | ||
return [ | ||
@@ -269,5 +292,10 @@ b2.indent([b2.ifBreak(["{", b2.line]), b2.join(b2.hardline, docs)]), | ||
function withParensIfNeeded(node, opts, valDoc) { | ||
if (!enclosedNodeTypeReg.test(node.type) && outerCodeMatches(import_prettier3.doc.printer.printDocToString(valDoc, __spreadProps(__spreadValues({}, opts), { | ||
printWidth: 0 | ||
})).formatted, /\s|>/y, opts.markoAttrParen)) { | ||
if (!enclosedNodeTypeReg.test(node.type) && outerCodeMatches( | ||
import_prettier3.doc.printer.printDocToString(valDoc, { | ||
...opts, | ||
printWidth: 0 | ||
}).formatted, | ||
/\s|>/y, | ||
opts.markoAttrParen | ||
)) { | ||
return ["(", b3.indent([b3.softline, valDoc]), b3.softline, ")"]; | ||
@@ -358,3 +386,5 @@ } | ||
try { | ||
compilerRequire = (0, import_module.createRequire)(rootRequire.resolve("@marko/compiler")); | ||
compilerRequire = (0, import_module.createRequire)( | ||
rootRequire.resolve("@marko/compiler") | ||
); | ||
} catch { | ||
@@ -435,3 +465,3 @@ compilerRequire = (0, import_module.createRequire)(rootRequire.resolve("marko")); | ||
print(path, opts, print) { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
const node = path.getValue(); | ||
@@ -476,7 +506,17 @@ switch (node.type) { | ||
return asLiteralTextContent(`<?${node.value}?>`); | ||
case "MarkoComment": | ||
return asLiteralTextContent(`<!--${node.value}-->`); | ||
case "MarkoComment": { | ||
const start = (_a = node.loc) == null ? void 0 : _a.start; | ||
switch (start != null && opts.originalText[locToPos(start, opts) + 1]) { | ||
case "/": | ||
return [asLiteralTextContent(`//${node.value}`), b5.hardline]; | ||
case "*": | ||
return asLiteralTextContent(`/*${node.value}*/`); | ||
default: | ||
return asLiteralTextContent(`<!--${node.value}-->`); | ||
} | ||
} | ||
case "MarkoCDATA": | ||
return asLiteralTextContent(`<![CDATA[${node.value}]]>`); | ||
case "MarkoTag": { | ||
const tagPath = path; | ||
const groupId = Symbol(); | ||
@@ -492,3 +532,5 @@ const doc6 = [opts.markoSyntax === "html" ? "<" : ""]; | ||
} else if (literalTagName === "style") { | ||
const [startContent, lang = ".css"] = styleReg.exec(node.rawValue || literalTagName); | ||
const [startContent, lang = ".css"] = styleReg.exec( | ||
node.rawValue || literalTagName | ||
); | ||
embedMode = `style.${import_prettier5.getFileInfo.sync(opts.filepath + lang).inferredParser}`; | ||
@@ -498,3 +540,6 @@ if (startContent.endsWith("{")) { | ||
const codeEndOffset = node.rawValue.lastIndexOf("}"); | ||
const code = node.rawValue.slice(codeSartOffset, codeEndOffset); | ||
const code = node.rawValue.slice( | ||
codeSartOffset, | ||
codeEndOffset | ||
); | ||
return b5.group([ | ||
@@ -504,3 +549,6 @@ "style", | ||
" {", | ||
b5.indent([b5.line, callEmbed(print, path, embedMode, code)]), | ||
b5.indent([ | ||
b5.line, | ||
callEmbed(print, tagPath, embedMode, code) | ||
]), | ||
b5.line, | ||
@@ -513,35 +561,53 @@ "}" | ||
} else { | ||
doc6.push(b5.group([ | ||
"${", | ||
b5.indent([b5.softline, path.call(print, "name")]), | ||
b5.softline, | ||
"}" | ||
])); | ||
doc6.push( | ||
b5.group([ | ||
"${", | ||
b5.indent([b5.softline, tagPath.call(print, "name")]), | ||
b5.softline, | ||
"}" | ||
]) | ||
); | ||
} | ||
const shorthandIndex = doc6.push("") - 1; | ||
if (node.var) { | ||
doc6.push("/", callEmbed(print, path, "var", getOriginalCode(opts, node.var))); | ||
doc6.push( | ||
"/", | ||
callEmbed(print, tagPath, "var", getOriginalCode(opts, node.var)) | ||
); | ||
} | ||
if ((_a = node.arguments) == null ? void 0 : _a.length) { | ||
doc6.push(b5.group([ | ||
"(", | ||
b5.indent([ | ||
if ((_b = node.arguments) == null ? void 0 : _b.length) { | ||
doc6.push( | ||
b5.group([ | ||
"(", | ||
b5.indent([ | ||
b5.softline, | ||
b5.join([",", b5.line], tagPath.map(print, "arguments")), | ||
opts.trailingComma ? b5.ifBreak(",") : "" | ||
]), | ||
b5.softline, | ||
b5.join([",", b5.line], path.map(print, "arguments")), | ||
opts.trailingComma ? b5.ifBreak(",") : "" | ||
]), | ||
b5.softline, | ||
")" | ||
])); | ||
")" | ||
]) | ||
); | ||
} | ||
if (node.body.params.length) { | ||
doc6.push(b5.group([ | ||
"|", | ||
callEmbed(print, path, "params", getOriginalCode(opts, node.body.params[0], node.body.params[node.body.params.length - 1])), | ||
"|" | ||
])); | ||
doc6.push( | ||
b5.group([ | ||
"|", | ||
callEmbed( | ||
print, | ||
tagPath, | ||
"params", | ||
getOriginalCode( | ||
opts, | ||
node.body.params[0], | ||
node.body.params[node.body.params.length - 1] | ||
) | ||
), | ||
"|" | ||
]) | ||
); | ||
} | ||
if (node.attributes.length) { | ||
const attrsDoc = []; | ||
path.each((childPath) => { | ||
tagPath.each((childPath) => { | ||
const childNode = childPath.getValue(); | ||
@@ -561,7 +627,9 @@ if (import_compiler.types.isMarkoAttribute(childNode) && (childNode.name === "class" || childNode.name === "id") && import_compiler.types.isStringLiteral(childNode.value) && !childNode.modifier && shorthandIdOrClassReg.test(childNode.value.value)) { | ||
} else { | ||
doc6.push(b5.group([ | ||
opts.markoSyntax === "concise" ? b5.ifBreak(" [") : "", | ||
b5.indent([b5.line, b5.join(b5.line, attrsDoc)]), | ||
opts.markoSyntax === "concise" ? b5.ifBreak([b5.line, "]"]) : b5.ifBreak(b5.line) | ||
])); | ||
doc6.push( | ||
b5.group([ | ||
opts.markoSyntax === "concise" ? b5.ifBreak(" [") : "", | ||
b5.indent([b5.line, b5.join(b5.line, attrsDoc)]), | ||
opts.markoSyntax === "concise" ? b5.ifBreak([b5.line, "]"]) : b5.ifBreak(b5.line) | ||
]) | ||
); | ||
} | ||
@@ -578,28 +646,36 @@ } | ||
let textOnly = true; | ||
path.each((child, i) => { | ||
const childNode = child.getValue(); | ||
const isText2 = isTextLike(childNode, node); | ||
if (isText2) { | ||
textDocs.push(embedMode && childNode.type === "MarkoText" ? callEmbed(print, child, embedMode, childNode.value) : print(child)); | ||
if (i !== lastIndex) | ||
return; | ||
} else { | ||
textOnly = false; | ||
} | ||
if (textDocs.length) { | ||
const isFirst = !bodyDocs.length; | ||
bodyDocs.push(b5.group([ | ||
opts.markoSyntax === "html" ? "" : isFirst ? b5.ifBreak("--", " --", { groupId }) : "--", | ||
opts.markoSyntax === "html" ? preserveSpace || isFirst ? "" : b5.softline : preserveSpace ? b5.hardline : b5.line, | ||
preserveSpace ? textDocs : b5.fill(textDocs), | ||
opts.markoSyntax === "html" ? "" : b5.ifBreak([b5.softline, "--"]) | ||
])); | ||
if (!isText2) { | ||
textDocs = []; | ||
tagPath.each( | ||
(child, i) => { | ||
const childNode = child.getValue(); | ||
const isText2 = isTextLike(childNode, node); | ||
if (isText2) { | ||
textDocs.push( | ||
embedMode && childNode.type === "MarkoText" ? callEmbed(print, child, embedMode, childNode.value) : print(child) | ||
); | ||
if (i !== lastIndex) | ||
return; | ||
} else { | ||
textOnly = false; | ||
} | ||
if (textDocs.length) { | ||
const isFirst = !bodyDocs.length; | ||
bodyDocs.push( | ||
b5.group([ | ||
opts.markoSyntax === "html" ? "" : isFirst ? b5.ifBreak("--", " --", { groupId }) : "--", | ||
opts.markoSyntax === "html" ? preserveSpace || isFirst ? "" : b5.softline : preserveSpace ? b5.hardline : b5.line, | ||
preserveSpace ? textDocs : b5.fill(textDocs), | ||
opts.markoSyntax === "html" ? "" : b5.ifBreak([b5.softline, "--"]) | ||
]) | ||
); | ||
if (!isText2) { | ||
textDocs = []; | ||
bodyDocs.push(print(child)); | ||
} | ||
} else { | ||
bodyDocs.push(print(child)); | ||
} | ||
} else { | ||
bodyDocs.push(print(child)); | ||
} | ||
}, "body", "body"); | ||
}, | ||
"body", | ||
"body" | ||
); | ||
const sep = (preserveSpace || !textOnly) && (opts.markoSyntax === "concise" || forceBreakTagsReg.test(literalTagName) || node.body.body.some((child) => child.type === "MarkoScriptlet")) ? b5.hardline : preserveSpace ? "" : b5.softline; | ||
@@ -627,2 +703,3 @@ if (opts.markoSyntax === "html") { | ||
case "MarkoAttribute": { | ||
const attrPath = path; | ||
const doc6 = []; | ||
@@ -635,13 +712,15 @@ const { value } = node; | ||
} | ||
if ((_b = node.arguments) == null ? void 0 : _b.length) { | ||
doc6.push(b5.group([ | ||
"(", | ||
b5.indent([ | ||
if ((_c = node.arguments) == null ? void 0 : _c.length) { | ||
doc6.push( | ||
b5.group([ | ||
"(", | ||
b5.indent([ | ||
b5.softline, | ||
b5.join([",", b5.line], attrPath.map(print, "arguments")), | ||
opts.trailingComma ? b5.ifBreak(",") : "" | ||
]), | ||
b5.softline, | ||
b5.join([",", b5.line], path.map(print, "arguments")), | ||
opts.trailingComma ? b5.ifBreak(",") : "" | ||
]), | ||
b5.softline, | ||
")" | ||
])); | ||
")" | ||
]) | ||
); | ||
} | ||
@@ -651,17 +730,41 @@ } | ||
if (import_compiler.types.isFunctionExpression(value) && !(value.id || value.async || value.generator)) { | ||
doc6.push(b5.group([ | ||
"(", | ||
value.params.length ? callEmbed(print, path, "params", getOriginalCode(opts, value.params[0], value.params[value.params.length - 1])) : "", | ||
")" | ||
]), b5.group([ | ||
" {", | ||
b5.indent([ | ||
doc6.push( | ||
b5.group([ | ||
"(", | ||
value.params.length ? callEmbed( | ||
print, | ||
attrPath, | ||
"params", | ||
getOriginalCode( | ||
opts, | ||
value.params[0], | ||
value.params[value.params.length - 1] | ||
) | ||
) : "", | ||
")" | ||
]), | ||
b5.group([ | ||
" {", | ||
b5.indent([ | ||
b5.line, | ||
b5.join( | ||
b5.hardline, | ||
attrPath.map(print, "value", "body", "body") | ||
) | ||
]), | ||
b5.line, | ||
b5.join(b5.hardline, path.map(print, "value", "body", "body")) | ||
]), | ||
b5.line, | ||
"}" | ||
])); | ||
"}" | ||
]) | ||
); | ||
} else { | ||
doc6.push(node.bound ? ":=" : "=", b5.group(enclosedNodeTypeReg.test(node.type) ? path.call(print, "value") : withParensIfNeeded(value, opts, path.call(print, "value")))); | ||
doc6.push( | ||
node.bound ? ":=" : "=", | ||
b5.group( | ||
enclosedNodeTypeReg.test(node.type) ? attrPath.call(print, "value") : withParensIfNeeded( | ||
value, | ||
opts, | ||
attrPath.call(print, "value") | ||
) | ||
) | ||
); | ||
} | ||
@@ -672,11 +775,25 @@ } | ||
case "MarkoSpreadAttribute": { | ||
return ["..."].concat(withParensIfNeeded(node.value, opts, path.call(print, "value"))); | ||
return ["..."].concat( | ||
withParensIfNeeded( | ||
node.value, | ||
opts, | ||
path.call(print, "value") | ||
) | ||
); | ||
} | ||
case "MarkoPlaceholder": | ||
return [node.escape ? "${" : "$!{", path.call(print, "value"), "}"]; | ||
return [ | ||
node.escape ? "${" : "$!{", | ||
path.call(print, "value"), | ||
"}" | ||
]; | ||
case "MarkoScriptlet": | ||
return withLineIfNeeded(node.body[0], opts, b5.group([ | ||
node.static ? "static " : "$ ", | ||
withBlockIfNeeded(node.body, opts, path.map(print, "body")) | ||
])); | ||
return withLineIfNeeded( | ||
node.body[0], | ||
opts, | ||
b5.group([ | ||
node.static ? "static " : "$ ", | ||
withBlockIfNeeded(node.body, opts, path.map(print, "body")) | ||
]) | ||
); | ||
case "MarkoText": { | ||
@@ -693,3 +810,6 @@ const quote = opts.singleQuote ? "'" : '"'; | ||
} | ||
return b5.ifBreak(asLiteralTextContent(breakValue), asLiteralTextContent(value)); | ||
return b5.ifBreak( | ||
asLiteralTextContent(breakValue), | ||
asLiteralTextContent(value) | ||
); | ||
} | ||
@@ -706,27 +826,35 @@ default: | ||
case "var": { | ||
return tryPrintEmbed(`var ${node.code}=_`, opts.markoScriptParser, (doc6) => { | ||
const contents = doc6[0].contents[1].contents; | ||
for (let i = contents.length; i--; ) { | ||
const item = contents[i]; | ||
if (typeof item === "string") { | ||
const match = /\s*=\s*$/.exec(item); | ||
if (match) { | ||
contents[i] = item.slice(0, -match[0].length); | ||
contents.length = i + 1; | ||
break; | ||
return tryPrintEmbed( | ||
`var ${node.code}=_`, | ||
opts.markoScriptParser, | ||
(doc6) => { | ||
const contents = doc6[0].contents[1].contents; | ||
for (let i = contents.length; i--; ) { | ||
const item = contents[i]; | ||
if (typeof item === "string") { | ||
const match = /\s*=\s*$/.exec(item); | ||
if (match) { | ||
contents[i] = item.slice(0, -match[0].length); | ||
contents.length = i + 1; | ||
break; | ||
} | ||
} | ||
} | ||
return contents; | ||
} | ||
return contents; | ||
}); | ||
); | ||
} | ||
case "params": { | ||
return tryPrintEmbed(`(${node.code})=>_`, "__js_expression", (doc6) => { | ||
const { contents } = doc6.contents[0]; | ||
if (Array.isArray(contents) && contents[0].startsWith("(")) { | ||
contents[0] = contents[0].slice(1); | ||
contents[contents.length - 1] = contents[contents.length - 1].slice(0, -1); | ||
return tryPrintEmbed( | ||
`(${node.code})=>_`, | ||
"__js_expression", | ||
(doc6) => { | ||
const { contents } = doc6.contents[0]; | ||
if (Array.isArray(contents) && contents[0].startsWith("(")) { | ||
contents[0] = contents[0].slice(1); | ||
contents[contents.length - 1] = contents[contents.length - 1].slice(0, -1); | ||
} | ||
return contents; | ||
} | ||
return contents; | ||
}); | ||
); | ||
} | ||
@@ -743,3 +871,7 @@ case "script": | ||
case "MarkoClass": | ||
return toDoc(`class ${getOriginalCode(opts, node.body)}`, { parser: "__js_expression" }, { stripTrailingHardline: true }); | ||
return toDoc( | ||
`class ${getOriginalCode(opts, node.body)}`, | ||
{ parser: "__js_expression" }, | ||
{ stripTrailingHardline: true } | ||
); | ||
case "File": | ||
@@ -754,3 +886,6 @@ case "Program": | ||
if (import_compiler.types.isStatement(node)) { | ||
return tryPrintEmbed(getOriginalCode(opts, node), opts.markoScriptParser); | ||
return tryPrintEmbed( | ||
getOriginalCode(opts, node), | ||
opts.markoScriptParser | ||
); | ||
} else { | ||
@@ -761,3 +896,5 @@ return tryPrintEmbed(getOriginalCode(opts, node), "__js_expression"); | ||
try { | ||
return normalize(toDoc(code, { parser }, { stripTrailingHardline: true })); | ||
return normalize( | ||
toDoc(code, { parser }, { stripTrailingHardline: true }) | ||
); | ||
} catch { | ||
@@ -764,0 +901,0 @@ return [b5.trim, asLiteralTextContent(code)]; |
import { AstPath, Doc } from "prettier"; | ||
import { Node, MarkoEmbedNode } from "../constants"; | ||
declare type NodeWithEmbed = Node & { | ||
type NodeWithEmbed = Node & { | ||
_embed?: MarkoEmbedNode; | ||
@@ -5,0 +5,0 @@ }; |
import { types as t } from "@marko/compiler"; | ||
import { AstPath } from "prettier"; | ||
import { Node } from "../constants"; | ||
export default function getSibling(path: AstPath<Node>, direction: 1 | -1): t.MarkoTag | t.MarkoCDATA | t.MarkoComment | t.MarkoText | t.MarkoPlaceholder | t.MarkoScriptlet | null; | ||
export default function getSibling(path: AstPath<Node>, direction: 1 | -1): t.MarkoCDATA | t.MarkoComment | t.MarkoText | t.MarkoPlaceholder | t.MarkoScriptlet | t.MarkoTag | null; |
{ | ||
"name": "prettier-plugin-marko", | ||
"description": "A prettier plugin for parsing and printing Marko files", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"author": "Dylan Piercey <dpiercey@ebay.com>", | ||
"bugs": "https://github.com/marko-js/prettier/issues", | ||
"devDependencies": { | ||
"@babel/generator": "^7.18.9", | ||
"@commitlint/cli": "^16.2.3", | ||
"@commitlint/config-conventional": "^16.2.1", | ||
"@babel/generator": "^7.20.14", | ||
"@commitlint/cli": "^17.4.4", | ||
"@commitlint/config-conventional": "^17.4.4", | ||
"@istanbuljs/nyc-config-typescript": "^1.0.2", | ||
"@marko/compiler": "^5.21.4", | ||
"@marko/translator-default": "^5.20.5", | ||
"@marko/compiler": "^5.23.4", | ||
"@marko/translator-default": "^5.22.4", | ||
"@types/babel__generator": "^7.6.4", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^17.0.25", | ||
"@types/prettier": "^2.6.0", | ||
"@typescript-eslint/eslint-plugin": "^5.20.0", | ||
"@typescript-eslint/parser": "^5.20.0", | ||
"@types/mocha": "^10.0.1", | ||
"@types/node": "^18.14.0", | ||
"@types/prettier": "^2.7.2", | ||
"@typescript-eslint/eslint-plugin": "^5.52.0", | ||
"@typescript-eslint/parser": "^5.52.0", | ||
"codecov": "^3.8.3", | ||
"esbuild": "^0.14.38", | ||
"esbuild-register": "^3.3.2", | ||
"eslint": "^8.13.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"fast-glob": "^3.2.11", | ||
"esbuild": "^0.17.8", | ||
"esbuild-register": "^3.4.2", | ||
"eslint": "^8.34.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"fast-glob": "^3.2.12", | ||
"fixpack": "^4.0.0", | ||
"husky": "^7.0.4", | ||
"lint-staged": "^12.4.0", | ||
"marko": "^5.20.5", | ||
"mocha": "^9.2.2", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.1.2", | ||
"marko": "^5.22.4", | ||
"mocha": "^10.2.0", | ||
"mocha-snap": "^4.3.0", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.6.2", | ||
"semantic-release": "^19.0.2", | ||
"typescript": "^4.6.3" | ||
"prettier": "^2.8.4", | ||
"semantic-release": "^20.1.0", | ||
"typescript": "^4.9.5" | ||
}, | ||
@@ -37,0 +37,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64506
1788