@kitschpatrol/prettier-plugin-astro 0.14.1-fork.2 → 0.14.1-fork.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
- package/readme.md +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/options.ts","../src/index.ts"],"mappings":";;;UAEU,aAAA;EACT,mBAAA;EACA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/options.ts","../src/index.ts"],"mappings":";;;UAEU,aAAA;EACT,mBAAA;EACA,oBAAoB;AAAA;AAAA;EAAA,UAKV,eAAA,SAAwB,aAAa;AAAA;AAAA,cAInC,OAAA,EAAS,MAAA,OAAa,aAAA,EAAe,aAAA;;;cCFrC,SAAA,EAAW,OAAO,CAAC,eAAA;AAAA,cAUnB,OAAA,EAAS,MAAM,SAAS,MAAA;AAAA,cA0BxB,QAAA,EAAU,MAAM,SAAS,OAAA;AAAA,cAQhC,cAAA;EAEL,QAAA;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -516,7 +516,7 @@ const embed = ((path, options) => {
|
|
|
516
516
|
const parserOption = options;
|
|
517
517
|
return async (textToDoc, print) => {
|
|
518
518
|
const node = path.node;
|
|
519
|
-
if (!node) return
|
|
519
|
+
if (!node) return;
|
|
520
520
|
if (node.type === "expression") {
|
|
521
521
|
const rawTagPlaceholders = [];
|
|
522
522
|
const textContent = printRaw(makeNodeJSXCompatible(replaceRawTagChildren(node, rawTagPlaceholders)));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["stripTrailingHardline","hardline","line","join","group","indent","softline"],"sources":["../src/options.ts","../src/printer/elements.ts","../src/printer/utils.ts","../src/printer/index.ts","../src/printer/embed.ts","../src/get-visitor-keys.ts","../src/index.ts"],"sourcesContent":["import type { SupportOption } from 'prettier';\n\ninterface PluginOptions {\n\tastroAllowShorthand: boolean;\n\tastroSkipFrontmatter: boolean;\n}\n\ndeclare module 'prettier' {\n\t \n\tinterface RequiredOptions extends PluginOptions {}\n}\n\n// https://prettier.io/docs/en/plugins.html#options\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n\tastroAllowShorthand: {\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Enable/disable attribute shorthand if attribute name and expression are the same',\n\t},\n\tastroSkipFrontmatter: {\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Skips the formatting of the frontmatter.',\n\t},\n};\n","export type TagName = keyof HTMLElementTagNameMap | 'svg';\n\n// https://github.com/prettier/prettier/blob/b77d912c0c1a5df85e3e9b5b192fc92523e411ee/vendors/html-void-elements.json\nexport const selfClosingTags = [\n\t'area',\n\t'base',\n\t'basefont',\n\t'bgsound',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'frame',\n\t'hr',\n\t'image',\n\t'img',\n\t'input',\n\t'isindex',\n\t'keygen',\n\t'link',\n\t'menuitem',\n\t'meta',\n\t'nextid',\n\t'param',\n\t'slot',\n\t'source',\n\t'track',\n\t'wbr',\n];\n\n// https://web.archive.org/web/20230108213516/https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#elements\nexport const blockElements: TagName[] = [\n\t'address',\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'details',\n\t'dialog',\n\t'dd',\n\t'div',\n\t'dl',\n\t'dt',\n\t'fieldset',\n\t'figcaption',\n\t'figure',\n\t'footer',\n\t'form',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'hgroup',\n\t'hr',\n\t'li',\n\t'main',\n\t'nav',\n\t'ol',\n\t'p',\n\t'pre',\n\t'section',\n\t'table',\n\t'ul',\n\t// TODO: WIP\n\t'title',\n\t'html',\n];\n\n/**\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\n */\nexport const formattableAttributes: string[] = [\n\t// None at the moment\n\t// Prettier HTML does not format attributes at all\n\t// and to be consistent we leave this array empty for now\n];\n","import { serialize } from '@astrojs/compiler/utils';\nimport {\n\ttype AstPath as AstP,\n\ttype BuiltInParserName,\n\ttype Doc,\n\ttype ParserOptions as ParserOpts,\n} from 'prettier';\nimport { blockElements, formattableAttributes, type TagName } from './elements';\nimport type {\n\tCommentNode,\n\tExpressionNode,\n\tNode,\n\tParentLikeNode,\n\tTagLikeNode,\n\tTextNode,\n\tanyNode,\n} from './nodes';\n\nexport type printFn = (path: AstPath) => Doc;\nexport type ParserOptions = ParserOpts<anyNode>;\nexport type AstPath = AstP<anyNode>;\n\nexport const openingBracketReplace = '_Pé';\nexport const closingBracketReplace = 'èP_';\nexport const atSignReplace = 'ΩP_';\nexport const dotReplace = 'ωP_';\nexport const interrogationReplace = 'ΔP_';\n\nexport function isInlineElement(path: AstPath, opts: ParserOptions, node: anyNode): boolean {\n\treturn node && isTagLikeNode(node) && !isBlockElement(node, opts) && !isPreTagContent(path);\n}\n\nexport function isBlockElement(node: anyNode, opts: ParserOptions): boolean {\n\tif (!node) {\n\t\treturn false;\n\t}\n\n\t// All tags (element, custom-element, component, fragment) are considered\n\t// block elements when htmlWhitespaceSensitivity is set to \"ignore\".\n\tif (opts.htmlWhitespaceSensitivity === 'ignore') {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\tnode.type === 'element' &&\n\t\topts.htmlWhitespaceSensitivity !== 'strict' &&\n\t\tblockElements.includes(node.name as TagName)\n\t);\n}\n\nexport function isIgnoreDirective(node: Node): boolean {\n\treturn node.type === 'comment' && node.value.trim() === 'prettier-ignore';\n}\n\n/**\n * Returns the content of the node\n */\nexport function printRaw(node: anyNode, stripLeadingAndTrailingNewline = false): string {\n\tif (!isNodeWithChildren(node)) {\n\t\treturn '';\n\t}\n\n\tif (node.children.length === 0) {\n\t\treturn '';\n\t}\n\n\tlet raw = node.children.reduce((prev: string, curr: Node) => prev + serialize(curr), '');\n\n\tif (!stripLeadingAndTrailingNewline) {\n\t\treturn raw;\n\t}\n\n\tif (startsWithLinebreak(raw)) {\n\t\traw = raw.substring(raw.indexOf('\\n') + 1);\n\t}\n\tif (endsWithLinebreak(raw)) {\n\t\traw = raw.substring(0, raw.lastIndexOf('\\n'));\n\t\tif (raw.charAt(raw.length - 1) === '\\r') {\n\t\t\traw = raw.substring(0, raw.length - 1);\n\t\t}\n\t}\n\n\treturn raw;\n}\n\nexport function isNodeWithChildren(node: anyNode): node is anyNode & ParentLikeNode {\n\treturn node && 'children' in node && Array.isArray(node.children);\n}\n\nexport const isEmptyTextNode = (node: anyNode): boolean => {\n\treturn !!node && node.type === 'text' && getUnencodedText(node).trim() === '';\n};\n\nexport function getUnencodedText(node: TextNode | CommentNode): string {\n\treturn node.value;\n}\n\nexport function isTextNodeStartingWithLinebreak(node: TextNode, nrLines = 1): node is TextNode {\n\treturn startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\n}\n\nexport function endsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\n\treturn isTextNode(node) && /^\\s/.test(getUnencodedText(node));\n}\n\nfunction endsWithWhitespace(text: string) {\n\treturn /\\s$/.test(text);\n}\n\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\n\treturn isTextNode(node) && endsWithWhitespace(getUnencodedText(node));\n}\n\nexport function hasSetDirectives(node: TagLikeNode) {\n\tconst attributes = Array.from(node.attributes, (attr) => attr.name);\n\treturn attributes.some((attr) => ['set:html', 'set:text'].includes(attr));\n}\n\n/**\n * Check if given node's start tag should hug its first child. This is the case for inline elements when there's\n * no whitespace between the `>` and the first child.\n */\nexport function shouldHugStart(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst firstChild = children[0];\n\treturn !isTextNodeStartingWithWhitespace(firstChild);\n}\n\n/**\n * Check if given node's end tag should hug its last child. This is the case for inline elements when there's\n * no whitespace between the last child and the `</`.\n */\nexport function shouldHugEnd(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = children[children.length - 1];\n\tif (isExpressionNode(lastChild)) return true;\n\tif (isTagLikeNode(lastChild)) return true;\n\treturn !isTextNodeEndingWithWhitespace(lastChild);\n}\n\n/**\n * Returns true if the softline between `</tagName` and `>` can be omitted.\n */\nexport function canOmitSoftlineBeforeClosingTag(path: AstPath, opts: ParserOptions): boolean {\n\treturn isLastChildWithinParentBlockElement(path, opts);\n}\n\nfunction getChildren(node: anyNode): Node[] {\n\treturn isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(path: AstPath, opts: ParserOptions): boolean {\n\tconst parent = path.getParentNode();\n\tif (!parent || !isBlockElement(parent, opts)) {\n\t\treturn false;\n\t}\n\n\tconst children = getChildren(parent);\n\tconst lastChild = children[children.length - 1];\n\treturn lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n\tnode.value = node.value && node.value.trimStart();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n\tnode.value = node.value && node.value.trimEnd();\n}\n\nexport function printClassNames(value: string) {\n\tconst lines = value.trim().split(/[\\r\\n]+/);\n\tconst formattedLines = lines.map((line) => {\n\t\tconst spaces = /^\\s+/.exec(line);\n\t\treturn (spaces ? spaces[0] : '') + line.trim().split(/\\s+/).join(' ');\n\t});\n\treturn formattedLines.join('\\n');\n}\n\n/** dedent string & return tabSize (the last part is what we need) */\nexport function manualDedent(input: string): {\n\ttabSize: number;\n\tchar: string;\n\tresult: string;\n} {\n\tlet minTabSize = Infinity;\n\tlet result = input;\n\t// 1. normalize\n\tresult = result.replace(/\\r\\n/g, '\\n');\n\n\t// 2. count tabSize\n\tlet char = '';\n\tfor (const line of result.split('\\n')) {\n\t\tif (!line) continue;\n\t\t// if any line begins with a non-whitespace char, minTabSize is 0\n\t\tif (line[0] && /^\\S/.test(line[0])) {\n\t\t\tminTabSize = 0;\n\t\t\tbreak;\n\t\t}\n\t\tconst match = /^(\\s+)\\S+/.exec(line); // \\S ensures we don’t count lines of pure whitespace\n\t\tif (match) {\n\t\t\tif (match[1] && !char) char = match[1][0];\n\t\t\tif (match[1].length < minTabSize) minTabSize = match[1].length;\n\t\t}\n\t}\n\n\t// 3. reformat string\n\tif (minTabSize > 0 && Number.isFinite(minTabSize)) {\n\t\tresult = result.replace(new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'), '');\n\t}\n\n\treturn {\n\t\ttabSize: minTabSize === Infinity ? 0 : minTabSize,\n\t\tchar,\n\t\tresult,\n\t};\n}\n\n/** True if the node is of type text */\nexport function isTextNode(node: anyNode): node is TextNode {\n\treturn node.type === 'text';\n}\n\nexport function isExpressionNode(node: anyNode): node is ExpressionNode {\n\treturn node.type === 'expression';\n}\n\n/** True if the node is TagLikeNode:\n *\n * ElementNode | ComponentNode | CustomElementNode | FragmentNode */\nexport function isTagLikeNode(node: anyNode): node is TagLikeNode {\n\treturn (\n\t\tnode.type === 'element' ||\n\t\tnode.type === 'component' ||\n\t\tnode.type === 'custom-element' ||\n\t\tnode.type === 'fragment'\n\t);\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n\tconst parent = path.getParentNode();\n\tif (!parent) return [];\n\n\treturn getChildren(parent);\n}\n\nexport function getNextNode(path: AstPath): anyNode | null {\n\tconst node = path.getNode();\n\tif (node) {\n\t\tconst siblings = getSiblings(path);\n\t\tif (node.position?.start === siblings[siblings.length - 1].position?.start) return null;\n\t\tfor (let i = 0; i < siblings.length; i++) {\n\t\t\tconst sibling = siblings[i];\n\t\t\tif (sibling.position?.start === node.position?.start && i !== siblings.length - 1) {\n\t\t\t\treturn siblings[i + 1];\n\t\t\t}\n\t\t}\n\t}\n\treturn null;\n}\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n\tif (!path || !path.stack || !Array.isArray(path.stack)) return false;\n\treturn path.stack.some(\n\t\t(node: anyNode) =>\n\t\t\t(node.type === 'element' && node.name.toLowerCase() === 'pre') ||\n\t\t\t(node.type === 'attribute' && !formattableAttributes.includes(node.name)),\n\t);\n};\n\ninterface QuoteResult {\n\tquote: '\"' | \"'\";\n\tregex: RegExp;\n\tescaped: string;\n}\n\n// Adapted from Prettier's source code as it's unfortunately not exported\n// https://github.com/prettier/prettier/blob/237e681936fc533c27d7ce8577d3fc98838a3314/src/common/util.js#L238\nexport function getPreferredQuote(rawContent: string, preferredQuote: string): QuoteResult {\n\tconst double: QuoteResult = { quote: '\"', regex: /\"/g, escaped: '"' };\n\tconst single: QuoteResult = { quote: \"'\", regex: /'/g, escaped: ''' };\n\n\tconst preferred = preferredQuote === \"'\" ? single : double;\n\tconst alternate = preferred === single ? double : single;\n\n\tlet result = preferred;\n\n\t// If `rawContent` contains at least one of the quote preferred for enclosing\n\t// the string, we might want to enclose with the alternate quote instead, to\n\t// minimize the number of escaped quotes.\n\tif (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {\n\t\tconst numPreferredQuotes = (preferred.regex.exec(rawContent) || []).length;\n\t\tconst numAlternateQuotes = (alternate.regex.exec(rawContent) || []).length;\n\n\t\tresult = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;\n\t}\n\n\treturn result;\n}\n\n// Adapted from: https://github.com/prettier/prettier/blob/20ab6d6f1c5bd774621230b493a3b71d39383a2c/src/language-html/utils/index.js#LL336C1-L369C2\nexport function inferParserByTypeAttribute(type: string): BuiltInParserName {\n\tif (!type) {\n\t\treturn 'babel-ts';\n\t}\n\n\tswitch (type) {\n\t\tcase 'module':\n\t\tcase 'text/javascript':\n\t\tcase 'text/babel':\n\t\tcase 'application/javascript':\n\t\t\treturn 'babel';\n\n\t\tcase 'application/x-typescript':\n\t\t\treturn 'babel-ts';\n\n\t\tcase 'text/markdown':\n\t\t\treturn 'markdown';\n\n\t\tcase 'text/html':\n\t\t\treturn 'html';\n\n\t\tcase 'text/x-handlebars-template':\n\t\t\treturn 'glimmer';\n\n\t\tdefault:\n\t\t\tif (type.endsWith('json') || type.endsWith('importmap') || type === 'speculationrules') {\n\t\t\t\treturn 'json';\n\t\t\t}\n\t\t\treturn 'babel-ts';\n\t}\n}\n","import { type Doc } from 'prettier';\nimport { selfClosingTags } from './elements';\nimport { type TextNode } from './nodes';\nimport {\n\tcanOmitSoftlineBeforeClosingTag,\n\tendsWithLinebreak,\n\tgetNextNode,\n\tgetPreferredQuote,\n\tgetUnencodedText,\n\thasSetDirectives,\n\tisEmptyTextNode,\n\tisIgnoreDirective,\n\tisInlineElement,\n\tisPreTagContent,\n\tisTagLikeNode,\n\tisTextNode,\n\tisTextNodeEndingWithWhitespace,\n\tisTextNodeStartingWithLinebreak,\n\tisTextNodeStartingWithWhitespace,\n\tprintClassNames,\n\tprintRaw,\n\tshouldHugEnd,\n\tshouldHugStart,\n\tstartsWithLinebreak,\n\ttrimTextNodeLeft,\n\ttrimTextNodeRight,\n\ttype AstPath,\n\ttype ParserOptions,\n\ttype printFn,\n} from './utils';\n\nimport _doc from 'prettier/doc';\nconst {\n\tbuilders: {\n\t\tbreakParent,\n\t\tdedent,\n\t\tfill,\n\t\tgroup,\n\t\tindent,\n\t\tjoin,\n\t\tline,\n\t\tsoftline,\n\t\thardline,\n\t\tliteralline,\n\t},\n\tutils: { stripTrailingHardline },\n} = _doc;\n\nlet ignoreNext = false;\n\n// https://prettier.io/docs/en/plugins.html#print \nexport function print(path: AstPath, opts: ParserOptions, print: printFn): Doc {\n\tconst node = path.node;\n\n\t// 1. handle special node types\n\tif (!node) {\n\t\treturn '';\n\t}\n\n\tif (ignoreNext && !isEmptyTextNode(node)) {\n\t\tignoreNext = false;\n\t\treturn [\n\t\t\topts.originalText\n\t\t\t\t.slice(opts.locStart(node), opts.locEnd(node))\n\t\t\t\t.split('\\n')\n\t\t\t\t.map((lineContent, i) => (i == 0 ? [lineContent] : [literalline, lineContent]))\n\t\t\t\t.flat(),\n\t\t];\n\t}\n\n\tif (typeof node === 'string') {\n\t\treturn node;\n\t}\n\n\t// 2. handle printing\n\tswitch (node.type) {\n\t\tcase 'root': {\n\t\t\treturn [stripTrailingHardline(path.map(print, 'children')), hardline];\n\t\t}\n\n\t\tcase 'text': {\n\t\t\tconst rawText = getUnencodedText(node);\n\n\t\t\t// TODO: TEST PRE TAGS\n\t\t\t// if (isPreTagContent(path)) {\n\t\t\t// if (path.getParentNode()?.type === 'Attribute') {\n\t\t\t// // Direct child of attribute value -> add literallines at end of lines\n\t\t\t// // so that other things don't break in unexpected places\n\t\t\t// return replaceEndOfLineWith(rawText, literalline);\n\t\t\t// }\n\t\t\t// return rawText;\n\t\t\t// }\n\n\t\t\tif (isEmptyTextNode(node)) {\n\t\t\t\tconst hasWhiteSpace = rawText.trim().length < getUnencodedText(node).length;\n\t\t\t\tconst hasOneOrMoreNewlines = getUnencodedText(node).includes('\\n');\n\t\t\t\tconst hasTwoOrMoreNewlines = /\\n\\s*\\n\\r?/.test(getUnencodedText(node));\n\t\t\t\tif (hasTwoOrMoreNewlines) {\n\t\t\t\t\treturn [hardline, hardline];\n\t\t\t\t}\n\t\t\t\tif (hasOneOrMoreNewlines) {\n\t\t\t\t\treturn hardline;\n\t\t\t\t}\n\t\t\t\tif (hasWhiteSpace) {\n\t\t\t\t\treturn line;\n\t\t\t\t}\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n\t\t\t * each \"word\") is joined by a single `line`, which will be rendered as a single space\n\t\t\t * until this node's current line is out of room, at which `fill` will break at the\n\t\t\t * most convenient instance of `line`.\n\t\t\t */\n\t\t\treturn fill(splitTextToDocs(node));\n\t\t}\n\n\t\tcase 'component':\n\t\tcase 'fragment':\n\t\tcase 'custom-element':\n\t\tcase 'element': {\n\t\t\tlet isEmpty: boolean;\n\t\t\tif (!node.children) {\n\t\t\t\tisEmpty = true;\n\t\t\t} else {\n\t\t\t\tisEmpty = node.children.every((child) => isEmptyTextNode(child));\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * An element is allowed to self close only if:\n\t\t\t * It is empty AND\n\t\t\t * It's a component OR\n\t\t\t * It's in the HTML spec as a void element OR\n\t\t\t * It has a `set:*` directive\n\t\t\t */\n\t\t\tconst isSelfClosingTag =\n\t\t\t\tisEmpty &&\n\t\t\t\t(node.type === 'component' ||\n\t\t\t\t\tselfClosingTags.includes(node.name) ||\n\t\t\t\t\thasSetDirectives(node));\n\n\t\t\tconst isSingleLinePerAttribute = opts.singleAttributePerLine && node.attributes.length > 1;\n\t\t\tconst attributeLine = isSingleLinePerAttribute ? breakParent : '';\n\t\t\tconst attributes = join(attributeLine, path.map(print, 'attributes'));\n\n\t\t\tif (isSelfClosingTag) {\n\t\t\t\treturn group(['<', node.name, indent(attributes), line, `/>`]);\n\t\t\t}\n\n\t\t\tif (node.children) {\n\t\t\t\tconst children = node.children;\n\t\t\t\tconst firstChild = children[0];\n\t\t\t\tconst lastChild = children[children.length - 1];\n\n\t\t\t\t// No hugging of content means it's either a block element and/or there's whitespace at the start/end\n\t\t\t\tlet noHugSeparatorStart:\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| _doc.builders.Hardline\n\t\t\t\t\t| string = softline;\n\t\t\t\tlet noHugSeparatorEnd:\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| _doc.builders.Hardline\n\t\t\t\t\t| string = softline;\n\t\t\t\tconst hugStart = shouldHugStart(node, opts);\n\t\t\t\tconst hugEnd = shouldHugEnd(node, opts);\n\n\t\t\t\tlet body;\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\tbody =\n\t\t\t\t\t\tisInlineElement(path, opts, node) &&\n\t\t\t\t\t\tnode.children.length &&\n\t\t\t\t\t\tisTextNodeStartingWithWhitespace(node.children[0]) &&\n\t\t\t\t\t\t!isPreTagContent(path)\n\t\t\t\t\t\t\t? () => line\n\t\t\t\t\t\t\t: () => (node.children.length > 0 ? softline : '');\n\t\t\t\t} else if (isPreTagContent(path)) {\n\t\t\t\t\tbody = () => printRaw(node);\n\t\t\t\t} else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t} else {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t}\n\n\t\t\t\tconst openingTag = [\n\t\t\t\t\t'<',\n\t\t\t\t\tnode.name,\n\t\t\t\t\tindent(\n\t\t\t\t\t\tgroup([\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\thugStart\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: !isPreTagContent(path) && !opts.bracketSameLine\n\t\t\t\t\t\t\t\t\t? dedent(softline)\n\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t];\n\n\t\t\t\tif (hugStart && hugEnd) {\n\t\t\t\t\tconst huggedContent = [\n\t\t\t\t\t\tisSingleLinePerAttribute ? hardline : softline,\n\t\t\t\t\t\tgroup(['>', body(), `</${node.name}`]),\n\t\t\t\t\t];\n\n\t\t\t\t\tconst omitSoftlineBeforeClosingTag =\n\t\t\t\t\t\tisEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tisEmpty ? group(huggedContent) : group(indent(huggedContent)),\n\t\t\t\t\t\tomitSoftlineBeforeClosingTag ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isPreTagContent(path)) {\n\t\t\t\t\tnoHugSeparatorStart = '';\n\t\t\t\t\tnoHugSeparatorEnd = '';\n\t\t\t\t} else {\n\t\t\t\t\tlet didSetEndSeparator = false;\n\n\t\t\t\t\tif (!hugStart && firstChild && isTextNode(firstChild)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tisTextNodeStartingWithLinebreak(firstChild) &&\n\t\t\t\t\t\t\tfirstChild !== lastChild &&\n\t\t\t\t\t\t\t(!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = hardline;\n\t\t\t\t\t\t\tnoHugSeparatorEnd = hardline;\n\t\t\t\t\t\t\tdidSetEndSeparator = true;\n\t\t\t\t\t\t} else if (isInlineElement(path, opts, node)) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = line;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeLeft(firstChild);\n\t\t\t\t\t}\n\t\t\t\t\tif (!hugEnd && lastChild && isTextNode(lastChild)) {\n\t\t\t\t\t\tif (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n\t\t\t\t\t\t\tnoHugSeparatorEnd = line;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttrimTextNodeRight(lastChild);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (hugStart) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tindent([softline, group(['>', body()])]),\n\t\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (hugEnd) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t\tindent([noHugSeparatorStart, group([body(), `</${node.name}`])]),\n\t\t\t\t\t\tcanOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\treturn group([...openingTag, '>', body(), `</${node.name}>`]);\n\t\t\t\t}\n\n\t\t\t\treturn group([\n\t\t\t\t\t...openingTag,\n\t\t\t\t\t'>',\n\t\t\t\t\tindent([noHugSeparatorStart, body()]),\n\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\t// TODO: WIP\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'attribute': {\n\t\t\tconst name = node.name.trim();\n\t\t\tswitch (node.kind) {\n\t\t\t\tcase 'empty':\n\t\t\t\t\treturn [line, name];\n\t\t\t\tcase 'expression':\n\t\t\t\t\t// Handled in the `embed` function\n\t\t\t\t\t// See embed.ts\n\t\t\t\t\treturn '';\n\t\t\t\tcase 'quoted':\n\t\t\t\t\tlet value = node.value;\n\n\t\t\t\t\tif (node.name === 'class') {\n\t\t\t\t\t\tvalue = printClassNames(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst unescapedValue = value.replace(/'/g, \"'\").replace(/"/g, '\"');\n\t\t\t\t\tconst { escaped, quote, regex } = getPreferredQuote(\n\t\t\t\t\t\tunescapedValue,\n\t\t\t\t\t\topts.jsxSingleQuote ? \"'\" : '\"',\n\t\t\t\t\t);\n\n\t\t\t\t\tconst result = unescapedValue.replace(regex, escaped);\n\t\t\t\t\treturn [line, name, '=', quote, result, quote];\n\t\t\t\tcase 'shorthand':\n\t\t\t\t\treturn [line, '{', name, '}'];\n\t\t\t\tcase 'spread':\n\t\t\t\t\treturn [line, '{...', name, '}'];\n\t\t\t\tcase 'template-literal':\n\t\t\t\t\treturn [line, name, '=', '`', node.value, '`'];\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'doctype': {\n\t\t\t// https://www.w3.org/wiki/Doctypes_and_markup_styles\n\t\t\treturn ['<!doctype html>', hardline];\n\t\t}\n\n\t\tcase 'comment':\n\t\t\tif (isIgnoreDirective(node)) {\n\t\t\t\tignoreNext = true;\n\t\t\t}\n\n\t\t\tconst nextNode = getNextNode(path);\n\t\t\tlet trailingLine: string | _doc.builders.Hardline = '';\n\t\t\tif (nextNode && isTagLikeNode(nextNode)) {\n\t\t\t\ttrailingLine = hardline;\n\t\t\t}\n\t\t\treturn ['<!--', getUnencodedText(node), '-->', trailingLine];\n\n\t\tdefault: {\n\t\t\tthrow new Error(`Unhandled node type \"${node.type}\"!`);\n\t\t}\n\t}\n}\n\n/**\n * Split the text into words separated by whitespace. Replace the whitespaces by lines,\n * collapsing multiple whitespaces into a single line.\n *\n * If the text starts or ends with multiple newlines, two of those should be kept.\n */\nfunction splitTextToDocs(node: TextNode): Doc[] {\n\tconst text = getUnencodedText(node);\n\n\tconst textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n\tlet docs = join(line, textLines).filter((doc) => doc !== '');\n\n\tif (startsWithLinebreak(text)) {\n\t\tdocs[0] = hardline;\n\t}\n\tif (startsWithLinebreak(text, 2)) {\n\t\tdocs = [hardline, ...docs];\n\t}\n\n\tif (endsWithLinebreak(text)) {\n\t\tdocs[docs.length - 1] = hardline;\n\t}\n\tif (endsWithLinebreak(text, 2)) {\n\t\tdocs = [...docs, hardline];\n\t}\n\n\treturn docs;\n}\n","import { Buffer } from 'node:buffer';\nimport type { BuiltInParserName, Doc, Options } from 'prettier';\nimport _doc from 'prettier/doc';\nimport { SassFormatter, type SassFormatterConfig } from 'sass-formatter';\nimport type { AttributeNode, ExpressionNode, FragmentNode, Node } from './nodes';\nimport {\n\tatSignReplace,\n\tclosingBracketReplace,\n\tdotReplace,\n\tinferParserByTypeAttribute,\n\tinterrogationReplace,\n\tisNodeWithChildren,\n\tisTagLikeNode,\n\tisTextNode,\n\tmanualDedent,\n\topeningBracketReplace,\n\tprintRaw,\n\ttype AstPath,\n\ttype ParserOptions,\n\ttype printFn,\n} from './utils';\n\nconst {\n\tbuilders: { group, indent, join, line, softline, hardline, lineSuffixBoundary },\n\tutils: { stripTrailingHardline, mapDoc },\n} = _doc;\n\nconst supportedStyleLangValues = ['css', 'scss', 'sass', 'less'] as const;\ntype supportedStyleLang = (typeof supportedStyleLangValues)[number];\n\n// https://prettier.io/docs/en/plugins.html#optional-embed\ntype TextToDoc = (text: string, options: Options) => Promise<Doc>;\n\ntype Embed =\n\t| ((\n\t\t\tpath: AstPath,\n\t\t\toptions: Options,\n\t ) =>\n\t\t\t| ((\n\t\t\t\t\ttextToDoc: TextToDoc,\n\t\t\t\t\tprint: (selector?: string | number | Array<string | number> | AstPath) => Doc,\n\t\t\t\t\tpath: AstPath,\n\t\t\t\t\toptions: Options,\n\t\t\t ) => Promise<Doc | undefined> | Doc | undefined)\n\t\t\t| Doc\n\t\t\t| null)\n\t| undefined;\n\nexport const embed = ((path: AstPath, options: Options) => {\n\tconst parserOption = options as ParserOptions;\n\treturn async (textToDoc, print) => {\n\t\tconst node = path.node;\n\n\t\tif (!node) return undefined;\n\n\t\tif (node.type === 'expression') {\n\t\t\t// Extract script and style elements and replace with self-closing\n\t\t\t// placeholder components so Babel's JSX parser doesn't try to parse\n\t\t\t// their content as JSX.\n\t\t\t// See: https://github.com/withastro/prettier-plugin-astro/issues/452\n\t\t\t// See: https://github.com/withastro/prettier-plugin-astro/issues/454\n\t\t\tconst rawTagPlaceholders: RawTagPlaceholder[] = [];\n\t\t\tconst nodeWithPlaceholders = replaceRawTagChildren(node, rawTagPlaceholders);\n\n\t\t\tconst jsxNode = makeNodeJSXCompatible<ExpressionNode>(nodeWithPlaceholders);\n\t\t\tconst textContent = printRaw(jsxNode);\n\n\t\t\tlet content: Doc;\n\n\t\t\tcontent = await wrapParserTryCatch(textToDoc, textContent, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\tcontent = stripTrailingHardline(content);\n\n\t\t\t// Replace self-closing placeholder components with fully-rendered\n\t\t\t// script/style tags, matching the format of the top-level handlers.\n\t\t\tfor (const entry of rawTagPlaceholders) {\n\t\t\t\tlet formattedContent: Doc;\n\n\t\t\t\tif (entry.tagName === 'script') {\n\t\t\t\t\tconst parser = inferParserByTypeAttribute(entry.typeAttr || '');\n\t\t\t\t\tformattedContent = await wrapParserTryCatch(textToDoc, entry.content, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tparser,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// style tag\n\t\t\t\t\tconst langValue = entry.langAttr?.toLowerCase();\n\t\t\t\t\tif (langValue === 'sass') {\n\t\t\t\t\t\tconst lineEnding = parserOption?.endOfLine?.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\t\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\t\t\t\ttabSize: parserOption.tabWidth,\n\t\t\t\t\t\t\tinsertSpaces: !parserOption.useTabs,\n\t\t\t\t\t\t\tlineEnding,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst { result: raw } = manualDedent(entry.content);\n\t\t\t\t\t\tconst formatted = SassFormatter.Format(raw, sassOptions).trim();\n\t\t\t\t\t\tformattedContent = join(hardline, formatted.split('\\n'));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// css, scss, less, or default to css\n\t\t\t\t\t\tconst styleParser: BuiltInParserName =\n\t\t\t\t\t\t\tlangValue === 'scss' || langValue === 'less' ? langValue : 'css';\n\t\t\t\t\t\tformattedContent = await wrapParserTryCatch(textToDoc, entry.content, {\n\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t\tparser: styleParser,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tformattedContent = stripTrailingHardline(formattedContent);\n\t\t\t\tconst isEmpty = /^\\s*$/.test(entry.content);\n\n\t\t\t\t// Build the full tag Doc matching top-level script/style formatting:\n\t\t\t\t// <tag attrs>\\n content\\n</tag>\n\t\t\t\tconst fullTagDoc: Doc = [\n\t\t\t\t\tentry.openingTag,\n\t\t\t\t\tindent([isEmpty ? '' : hardline, formattedContent]),\n\t\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t\t`</${entry.tagName}>`,\n\t\t\t\t];\n\n\t\t\t\tcontent = mapDoc(content, (doc) => {\n\t\t\t\t\tif (typeof doc === 'string' && doc.includes(entry.placeholder)) {\n\t\t\t\t\t\tconst parts = doc.split(entry.placeholder);\n\t\t\t\t\t\tif (parts.length === 2) {\n\t\t\t\t\t\t\tif (entry.isDirectChild) {\n\t\t\t\t\t\t\t\t// Direct children: placeholder replaced the entire element,\n\t\t\t\t\t\t\t\t// so insert the fully-rendered tag Doc\n\t\t\t\t\t\t\t\treturn [parts[0], fullTagDoc, parts[1]];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Nested children: placeholder is inside the tag, the tag\n\t\t\t\t\t\t\t// structure is preserved in the doc. Replace content only.\n\t\t\t\t\t\t\tif (isEmpty) {\n\t\t\t\t\t\t\t\treturn [parts[0], parts[1]];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn [parts[0], indent([hardline, formattedContent]), hardline, parts[1]];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn doc;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// HACK: Bit of a weird hack to get if a document is exclusively comments\n\t\t\t// Using `mapDoc` directly to build the array for some reason caused it to always be undefined? Not sure why\n\t\t\tconst strings: string[] = [];\n\t\t\tmapDoc(content, (doc) => {\n\t\t\t\tif (typeof doc === 'string') {\n\t\t\t\t\tstrings.push(doc);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (strings.every((value) => value.startsWith('//'))) {\n\t\t\t\treturn group(['{', content, softline, lineSuffixBoundary, '}']);\n\t\t\t}\n\n\t\t\t// Create a Doc without the things we had to add to make the expression compatible with Babel\n\t\t\tconst astroDoc = mapDoc(content, (doc) => {\n\t\t\t\tif (typeof doc === 'string') {\n\t\t\t\t\tdoc = doc.replaceAll(openingBracketReplace, '{');\n\t\t\t\t\tdoc = doc.replaceAll(closingBracketReplace, '}');\n\t\t\t\t\tdoc = doc.replaceAll(atSignReplace, '@');\n\t\t\t\t\tdoc = doc.replaceAll(dotReplace, '.');\n\t\t\t\t\tdoc = doc.replaceAll(interrogationReplace, '?');\n\t\t\t\t}\n\n\t\t\t\treturn doc;\n\t\t\t});\n\n\t\t\t// Force multi-line format for expressions containing raw content tags\n\t\t\t// (script/style), since their content has hardlines that need proper\n\t\t\t// indentation context. Without this, babel may keep the expression on\n\t\t\t// one line, causing misaligned content after placeholder replacement.\n\t\t\tif (rawTagPlaceholders.length > 0) {\n\t\t\t\treturn ['{', indent([hardline, astroDoc]), hardline, lineSuffixBoundary, '}'];\n\t\t\t}\n\n\t\t\treturn group(['{', indent([softline, astroDoc]), softline, lineSuffixBoundary, '}']);\n\t\t}\n\n\t\t// Attribute using an expression as value\n\t\tif (node.type === 'attribute' && node.kind === 'expression') {\n\t\t\tconst value = node.value.trim();\n\t\t\tconst name = node.name.trim();\n\n\t\t\tconst attrNodeValue = await wrapParserTryCatch(textToDoc, value, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\tif (name === value && options.astroAllowShorthand) {\n\t\t\t\treturn [line, '{', attrNodeValue, '}'];\n\t\t\t}\n\n\t\t\treturn [line, name, '=', '{', attrNodeValue, '}'];\n\t\t}\n\n\t\tif (node.type === 'attribute' && node.kind === 'spread') {\n\t\t\tconst spreadContent = await wrapParserTryCatch(textToDoc, node.name, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\treturn [line, '{...', spreadContent, '}'];\n\t\t}\n\n\t\t// Frontmatter\n\t\tif (node.type === 'frontmatter') {\n\t\t\tif (options.astroSkipFrontmatter) {\n\t\t\t\treturn [group(['---', node.value, '---', hardline]), hardline];\n\t\t\t}\n\n\t\t\tconst frontmatterContent = await wrapParserTryCatch(textToDoc, node.value, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'babel-ts',\n\t\t\t});\n\n\t\t\treturn [group(['---', hardline, frontmatterContent, hardline, '---', hardline]), hardline];\n\t\t}\n\n\t\t// Script tags\n\t\tif (node.type === 'element' && node.name === 'script' && node.children.length) {\n\t\t\tconst typeAttribute = node.attributes.find((attr) => attr.name === 'type')?.value;\n\n\t\t\tlet parser: BuiltInParserName = 'babel-ts';\n\t\t\tif (typeAttribute) {\n\t\t\t\tparser = inferParserByTypeAttribute(typeAttribute);\n\t\t\t}\n\n\t\t\tconst scriptContent = printRaw(node);\n\t\t\tlet formattedScript = await wrapParserTryCatch(textToDoc, scriptContent, {\n\t\t\t\t...options,\n\t\t\t\tparser: parser,\n\t\t\t});\n\n\t\t\tformattedScript = stripTrailingHardline(formattedScript);\n\t\t\tconst isEmpty = /^\\s*$/.test(scriptContent);\n\n\t\t\t// print\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group([\n\t\t\t\t'<script',\n\t\t\t\tindent(group(attributes)),\n\t\t\t\toptions.bracketSameLine ? '' : softline,\n\t\t\t\t'>',\n\t\t\t]);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedScript]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</script>',\n\t\t\t];\n\t\t}\n\n\t\t// Style tags\n\t\tif (node.type === 'element' && node.name === 'style') {\n\t\t\tconst content = printRaw(node);\n\t\t\tlet parserLang: supportedStyleLang | undefined = 'css';\n\n\t\t\tif (node.attributes) {\n\t\t\t\tconst langAttribute = node.attributes.filter((x) => x.name === 'lang');\n\t\t\t\tif (langAttribute.length) {\n\t\t\t\t\tconst styleLang = langAttribute[0].value.toLowerCase() as supportedStyleLang;\n\t\t\t\t\tparserLang = supportedStyleLangValues.includes(styleLang) ? styleLang : undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn await embedStyle(parserLang, content, path, print, textToDoc, parserOption);\n\t\t}\n\n\t\treturn undefined;\n\t};\n}) satisfies Embed;\n\nasync function wrapParserTryCatch(cb: TextToDoc, text: string, options: Options) {\n\ttry {\n\t\treturn await cb(text, options);\n\t} catch (e) {\n\t\t// If we couldn't parse the expression (ex: syntax error) and we throw here, Prettier fallback to `print` and we'll\n\t\t// get a totally useless error message (ex: unhandled node type). An undocumented way to work around this is to set\n\t\t// `PRETTIER_DEBUG=1`, but nobody know that exists / want to do that just to get useful error messages. So we force it on\n\t\tprocess.env.PRETTIER_DEBUG = 'true';\n\t\tthrow e;\n\t}\n}\n\n/**\n * Due to the differences between Astro and JSX, Prettier's TypeScript parsers (be it `typescript` or `babel-ts`) are not\n * able to parse all expressions. So we need to first make the expression compatible before passing it to the parser\n *\n * A list of the difference that matters here:\n * - Astro allows a shorthand syntax for props. ex: `<Component {props} />`\n * - Astro allows multiple root elements. ex: `<div></div><div></div>`\n * - Astro allows attributes to include at signs (@) and dots (.)\n */\nfunction makeNodeJSXCompatible<T>(node: any): T {\n\tconst newNode = { ...node };\n\tconst childBundle: Node[][] = [];\n\tlet childBundleIndex = 0;\n\n\tif (isNodeWithChildren(newNode)) {\n\t\tnewNode.children = newNode.children.reduce((result: Node[], child, index) => {\n\t\t\tconst previousChildren = newNode.children[index - 1];\n\t\t\tconst nextChildren = newNode.children[index + 1];\n\t\t\tif (isTagLikeNode(child)) {\n\t\t\t\tchild.attributes = child.attributes.map(makeAttributeJSXCompatible);\n\n\t\t\t\tif (!childBundle[childBundleIndex]) {\n\t\t\t\t\tchildBundle[childBundleIndex] = [];\n\t\t\t\t}\n\n\t\t\t\tif (isNodeWithChildren(child)) {\n\t\t\t\t\tchild = makeNodeJSXCompatible<typeof child>(child);\n\t\t\t\t}\n\n\t\t\t\t// If we don't have a previous children, or it's not an element AND\n\t\t\t\t// we have a next children, and it's an element. Add the current children to the bundle\n\t\t\t\tif (\n\t\t\t\t\t(!previousChildren || isTextNode(previousChildren)) &&\n\t\t\t\t\tnextChildren &&\n\t\t\t\t\tisTagLikeNode(nextChildren)\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// If we have a previous children, and it's an element AND\n\t\t\t\t// we have a next children, and it's also an element. Add the current children to the bundle\n\t\t\t\tif (\n\t\t\t\t\tpreviousChildren &&\n\t\t\t\t\tisTagLikeNode(previousChildren) &&\n\t\t\t\t\tnextChildren &&\n\t\t\t\t\tisTagLikeNode(nextChildren)\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// If we have elements in our bundle, and there's no next children, or it's a text node\n\t\t\t\t// Create a fake parent, and add all the previous encountered elements as children of it\n\t\t\t\tif (\n\t\t\t\t\t(!nextChildren || isTextNode(nextChildren)) &&\n\t\t\t\t\tchildBundle[childBundleIndex].length > 0\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\n\t\t\t\t\tconst parentNode: FragmentNode = {\n\t\t\t\t\t\ttype: 'fragment',\n\t\t\t\t\t\tname: '',\n\t\t\t\t\t\tattributes: [],\n\t\t\t\t\t\tchildren: childBundle[childBundleIndex],\n\t\t\t\t\t};\n\n\t\t\t\t\tchildBundleIndex += 1;\n\t\t\t\t\tresult.push(parentNode);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tchildBundleIndex += 1;\n\t\t\t}\n\n\t\t\tresult.push(child);\n\t\t\treturn result;\n\t\t}, []);\n\t}\n\n\treturn newNode;\n\n\tfunction makeAttributeJSXCompatible(attr: AttributeNode): AttributeNode {\n\t\t// Transform shorthand attributes into an empty attribute, ex: `{shorthand}` becomes `shorthand` and wrap it\n\t\t// so we can transform it back into {}\n\t\tif (attr.kind === 'shorthand') {\n\t\t\tattr.kind = 'empty';\n\t\t\tattr.name = openingBracketReplace + attr.name + closingBracketReplace;\n\t\t}\n\n\t\t// For spreads, we don't need to do anything because it should already be JSX compatible\n\t\tif (attr.kind !== 'spread') {\n\t\t\tif (attr.name.includes('@')) {\n\t\t\t\tattr.name = attr.name.replaceAll('@', atSignReplace);\n\t\t\t}\n\n\t\t\tif (attr.name.includes('.')) {\n\t\t\t\tattr.name = attr.name.replaceAll('.', dotReplace);\n\t\t\t}\n\n\t\t\tif (attr.name.includes('?')) {\n\t\t\t\tattr.name = attr.name.replaceAll('?', interrogationReplace);\n\t\t\t}\n\t\t}\n\n\t\treturn attr;\n\t}\n}\n\n/** Tags whose content is raw text (not JSX) and must be extracted before Babel parsing */\nconst rawContentTags = ['script', 'style'] as const;\n\ninterface RawTagPlaceholder {\n\tplaceholder: string;\n\tcontent: string;\n\ttagName: (typeof rawContentTags)[number];\n\topeningTag: string; // the serialized opening tag, e.g. '<script is:inline>'\n\tisDirectChild: boolean; // true if direct child of expression (vs nested in fragment)\n\ttypeAttr?: string; // for script\n\tlangAttr?: string; // for style\n}\n\n/**\n * Replace the children of any raw-content elements (script, style) in an expression\n * node with placeholder text nodes. This prevents Babel's JSX parser from trying to\n * parse their content as JSX when they appear inside an expression.\n *\n * See: https://github.com/withastro/prettier-plugin-astro/issues/452\n * See: https://github.com/withastro/prettier-plugin-astro/issues/454\n */\nfunction replaceRawTagChildren(\n\tnode: any,\n\tplaceholders: RawTagPlaceholder[],\n\tisTopLevel = true,\n): any {\n\tconst newNode = { ...node };\n\tif (isNodeWithChildren(newNode)) {\n\t\tnewNode.children = newNode.children.map((child: any) => {\n\t\t\tif (\n\t\t\t\tchild.type === 'element' &&\n\t\t\t\trawContentTags.includes(child.name) &&\n\t\t\t\tchild.children.length\n\t\t\t) {\n\t\t\t\tconst placeholder = `__ASTRO_RAW_TAG_PLACEHOLDER_${placeholders.length}__`;\n\t\t\t\tconst content = printRaw(child);\n\n\t\t\t\t// Build the opening tag string from the original element\n\t\t\t\tconst attrs = (child.attributes || [])\n\t\t\t\t\t.map((a: AttributeNode) => {\n\t\t\t\t\t\tif (a.kind === 'empty') return a.name;\n\t\t\t\t\t\tif (a.kind === 'expression') return `${a.name}={${a.value}}`;\n\t\t\t\t\t\tif (a.kind === 'spread') return `{...${a.name}}`;\n\t\t\t\t\t\treturn `${a.name}=\"${a.value}\"`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(' ');\n\t\t\t\tconst openingTag = attrs ? `<${child.name} ${attrs}>` : `<${child.name}>`;\n\n\t\t\t\tplaceholders.push({\n\t\t\t\t\tplaceholder,\n\t\t\t\t\tcontent,\n\t\t\t\t\ttagName: child.name,\n\t\t\t\t\topeningTag,\n\t\t\t\t\t// Whether this tag is a direct child of the expression (not nested\n\t\t\t\t\t// inside a fragment/element). Direct children are replaced entirely\n\t\t\t\t\t// so babel formats the expression around a simple identifier. Nested\n\t\t\t\t\t// children keep their tag structure for proper fragment formatting.\n\t\t\t\t\tisDirectChild: isTopLevel,\n\t\t\t\t\ttypeAttr: child.attributes?.find((a: AttributeNode) => a.name === 'type')?.value,\n\t\t\t\t\tlangAttr: child.attributes?.find((a: AttributeNode) => a.name === 'lang')?.value,\n\t\t\t\t});\n\n\t\t\t\tif (isTopLevel) {\n\t\t\t\t\t// Replace the entire element with a text placeholder.\n\t\t\t\t\t// Babel sees it as a simple identifier, keeping it on its own\n\t\t\t\t\t// line when the expression handler forces multi-line format.\n\t\t\t\t\treturn { type: 'text', value: placeholder };\n\t\t\t\t}\n\t\t\t\t// Nested: replace only children, preserving the tag structure so\n\t\t\t\t// babel can format it properly within fragments/wrappers.\n\t\t\t\treturn {\n\t\t\t\t\t...child,\n\t\t\t\t\tchildren: [{ type: 'text', value: placeholder }],\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (isNodeWithChildren(child)) {\n\t\t\t\treturn replaceRawTagChildren(child, placeholders, false);\n\t\t\t}\n\t\t\treturn child;\n\t\t});\n\t}\n\treturn newNode;\n}\n\n/**\n * Format the content of a style tag and print the entire element\n */\nasync function embedStyle(\n\tlang: supportedStyleLang | undefined,\n\tcontent: string,\n\tpath: AstPath,\n\tprint: printFn,\n\ttextToDoc: TextToDoc,\n\toptions: ParserOptions,\n): Promise<_doc.builders.Doc | undefined> {\n\tconst isEmpty = /^\\s*$/.test(content);\n\n\tswitch (lang) {\n\t\tcase 'less':\n\t\tcase 'css':\n\t\tcase 'scss': {\n\t\t\tlet formattedStyles = await wrapParserTryCatch(textToDoc, content, {\n\t\t\t\t...options,\n\t\t\t\tparser: lang,\n\t\t\t});\n\n\t\t\t// The css parser appends an extra indented hardline, which we want outside of the `indent()`,\n\t\t\t// so we remove the last element of the array\n\t\t\tformattedStyles = stripTrailingHardline(formattedStyles);\n\n\t\t\t// print\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedStyles]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</style>',\n\t\t\t];\n\t\t}\n\t\tcase 'sass': {\n\t\t\tconst lineEnding = options?.endOfLine?.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\ttabSize: options.tabWidth,\n\t\t\t\tinsertSpaces: !options.useTabs,\n\t\t\t\tlineEnding,\n\t\t\t};\n\n\t\t\t// dedent the .sass, otherwise SassFormatter gets indentation wrong\n\t\t\tconst { result: raw } = manualDedent(content);\n\n\t\t\t// format\n\t\t\tconst formattedSassIndented = SassFormatter.Format(raw, sassOptions).trim();\n\n\t\t\t// print\n\t\t\tconst formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedSass]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</style>',\n\t\t\t];\n\t\t}\n\t\tcase undefined: {\n\t\t\tconst node = path.getNode();\n\n\t\t\tif (node) {\n\t\t\t\treturn Buffer.from(options.originalText)\n\t\t\t\t\t.subarray(options.locStart(node), options.locEnd(node))\n\t\t\t\t\t.toString();\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n","export function getVisitorKeys(node: any): string[] {\n\tif (!node || typeof node !== 'object') return [];\n\treturn Object.keys(node).filter((key) => {\n\t\tconst value = node[key];\n\t\treturn (\n\t\t\t(typeof value === 'object' &&\n\t\t\t\tvalue !== null &&\n\t\t\t\tkey !== 'position' && // skip position metadata\n\t\t\t\tkey !== 'type' && // skip node type itself\n\t\t\t\t!Array.isArray(value)) ||\n\t\t\t(Array.isArray(value) && value.length > 0 && typeof value[0] === 'object')\n\t\t);\n\t});\n}\n","import { parse } from '@astrojs/compiler/sync';\nimport type { Parser, Printer, SupportLanguage } from 'prettier';\nimport * as prettierPluginBabel from 'prettier/plugins/babel';\nimport { options } from './options';\nimport { print } from './printer';\nimport { embed } from './printer/embed';\nimport { getVisitorKeys } from './get-visitor-keys';\n\nconst babelParser = prettierPluginBabel.parsers['babel-ts'];\n\n// https://prettier.io/docs/en/plugins.html#languages\nexport const languages: Partial<SupportLanguage>[] = [\n\t{\n\t\tname: 'astro',\n\t\tparsers: ['astro'],\n\t\textensions: ['.astro'],\n\t\tvscodeLanguageIds: ['astro'],\n\t},\n];\n\n// https://prettier.io/docs/en/plugins.html#parsers\nexport const parsers: Record<string, Parser> = {\n\tastro: {\n\t\tparse: (source) => parse(source, { position: true }).ast,\n\t\tastFormat: 'astro',\n\t\tlocStart: (node) => node.position.start.offset,\n\t\tlocEnd: (node) => node.position.end?.offset,\n\t},\n\tastroExpressionParser: {\n\t\t...babelParser,\n\t\tpreprocess(text) {\n\t\t\t// note the trailing newline: if the statement ends in a // comment,\n\t\t\t// we can't add the closing bracket right afterwards\n\t\t\treturn `<>{${text}\\n}</>`;\n\t\t},\n\t\tparse(text, opts) {\n\t\t\tconst ast = babelParser.parse(text, opts);\n\n\t\t\treturn {\n\t\t\t\t...ast,\n\t\t\t\tprogram: ast.program.body[0].expression.children[0].expression,\n\t\t\t};\n\t\t},\n\t},\n};\n\n// https://prettier.io/docs/en/plugins.html#printers\nexport const printers: Record<string, Printer> = {\n\tastro: {\n\t\tprint,\n\t\tembed,\n\t\tgetVisitorKeys,\n\t},\n};\n\nconst defaultOptions = {\n\ttabWidth: 2,\n};\n\nexport { defaultOptions, options };\n"],"mappings":";;;;;;;AAaA,MAAa,UAAsD;CAClE,qBAAqB;EACpB,UAAU;EACV,MAAM;EACN,SAAS;EACT,aAAa;EACb;CACD,sBAAsB;EACrB,UAAU;EACV,MAAM;EACN,SAAS;EACT,aAAa;EACb;CACD;;;ACvBD,MAAa,kBAAkB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAGD,MAAa,gBAA2B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;;;;AAKD,MAAa,wBAAkC,EAI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AAI,QAAQ,KAAK,GAAG,WAAW,SAAS,GAAG;IACpD;;EAEF;CACD;AAGD,MAAa,WAAoC,EAChD,OAAO;CACN;CACA;CACA;CACA,EACD;AAED,MAAM,iBAAiB,EACtB,UAAU,GACV"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["stripTrailingHardline","hardline","line","join","group","indent","softline"],"sources":["../src/options.ts","../src/printer/elements.ts","../src/printer/utils.ts","../src/printer/index.ts","../src/printer/embed.ts","../src/get-visitor-keys.ts","../src/index.ts"],"sourcesContent":["import type { SupportOption } from 'prettier';\n\ninterface PluginOptions {\n\tastroAllowShorthand: boolean;\n\tastroSkipFrontmatter: boolean;\n}\n\ndeclare module 'prettier' {\n\t \n\tinterface RequiredOptions extends PluginOptions {}\n}\n\n// https://prettier.io/docs/en/plugins.html#options\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n\tastroAllowShorthand: {\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Enable/disable attribute shorthand if attribute name and expression are the same',\n\t},\n\tastroSkipFrontmatter: {\n\t\tcategory: 'Astro',\n\t\ttype: 'boolean',\n\t\tdefault: false,\n\t\tdescription: 'Skips the formatting of the frontmatter.',\n\t},\n};\n","export type TagName = keyof HTMLElementTagNameMap | 'svg';\n\n// https://github.com/prettier/prettier/blob/b77d912c0c1a5df85e3e9b5b192fc92523e411ee/vendors/html-void-elements.json\nexport const selfClosingTags = [\n\t'area',\n\t'base',\n\t'basefont',\n\t'bgsound',\n\t'br',\n\t'col',\n\t'command',\n\t'embed',\n\t'frame',\n\t'hr',\n\t'image',\n\t'img',\n\t'input',\n\t'isindex',\n\t'keygen',\n\t'link',\n\t'menuitem',\n\t'meta',\n\t'nextid',\n\t'param',\n\t'slot',\n\t'source',\n\t'track',\n\t'wbr',\n];\n\n// https://web.archive.org/web/20230108213516/https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#elements\nexport const blockElements: TagName[] = [\n\t'address',\n\t'article',\n\t'aside',\n\t'blockquote',\n\t'details',\n\t'dialog',\n\t'dd',\n\t'div',\n\t'dl',\n\t'dt',\n\t'fieldset',\n\t'figcaption',\n\t'figure',\n\t'footer',\n\t'form',\n\t'h1',\n\t'h2',\n\t'h3',\n\t'h4',\n\t'h5',\n\t'h6',\n\t'header',\n\t'hgroup',\n\t'hr',\n\t'li',\n\t'main',\n\t'nav',\n\t'ol',\n\t'p',\n\t'pre',\n\t'section',\n\t'table',\n\t'ul',\n\t// TODO: WIP\n\t'title',\n\t'html',\n];\n\n/**\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\n */\nexport const formattableAttributes: string[] = [\n\t// None at the moment\n\t// Prettier HTML does not format attributes at all\n\t// and to be consistent we leave this array empty for now\n];\n","import { serialize } from '@astrojs/compiler/utils';\nimport {\n\ttype AstPath as AstP,\n\ttype BuiltInParserName,\n\ttype Doc,\n\ttype ParserOptions as ParserOpts,\n} from 'prettier';\nimport { blockElements, formattableAttributes, type TagName } from './elements';\nimport type {\n\tCommentNode,\n\tExpressionNode,\n\tNode,\n\tParentLikeNode,\n\tTagLikeNode,\n\tTextNode,\n\tanyNode,\n} from './nodes';\n\nexport type printFn = (path: AstPath) => Doc;\nexport type ParserOptions = ParserOpts<anyNode>;\nexport type AstPath = AstP<anyNode>;\n\nexport const openingBracketReplace = '_Pé';\nexport const closingBracketReplace = 'èP_';\nexport const atSignReplace = 'ΩP_';\nexport const dotReplace = 'ωP_';\nexport const interrogationReplace = 'ΔP_';\n\nexport function isInlineElement(path: AstPath, opts: ParserOptions, node: anyNode): boolean {\n\treturn node && isTagLikeNode(node) && !isBlockElement(node, opts) && !isPreTagContent(path);\n}\n\nexport function isBlockElement(node: anyNode, opts: ParserOptions): boolean {\n\tif (!node) {\n\t\treturn false;\n\t}\n\n\t// All tags (element, custom-element, component, fragment) are considered\n\t// block elements when htmlWhitespaceSensitivity is set to \"ignore\".\n\tif (opts.htmlWhitespaceSensitivity === 'ignore') {\n\t\treturn true;\n\t}\n\n\treturn (\n\t\tnode.type === 'element' &&\n\t\topts.htmlWhitespaceSensitivity !== 'strict' &&\n\t\tblockElements.includes(node.name as TagName)\n\t);\n}\n\nexport function isIgnoreDirective(node: Node): boolean {\n\treturn node.type === 'comment' && node.value.trim() === 'prettier-ignore';\n}\n\n/**\n * Returns the content of the node\n */\nexport function printRaw(node: anyNode, stripLeadingAndTrailingNewline = false): string {\n\tif (!isNodeWithChildren(node)) {\n\t\treturn '';\n\t}\n\n\tif (node.children.length === 0) {\n\t\treturn '';\n\t}\n\n\tlet raw = node.children.reduce((prev: string, curr: Node) => prev + serialize(curr), '');\n\n\tif (!stripLeadingAndTrailingNewline) {\n\t\treturn raw;\n\t}\n\n\tif (startsWithLinebreak(raw)) {\n\t\traw = raw.substring(raw.indexOf('\\n') + 1);\n\t}\n\n\tif (endsWithLinebreak(raw)) {\n\t\traw = raw.substring(0, raw.lastIndexOf('\\n'));\n\t\tif (raw.charAt(raw.length - 1) === '\\r') {\n\t\t\traw = raw.substring(0, raw.length - 1);\n\t\t}\n\t}\n\n\treturn raw;\n}\n\nexport function isNodeWithChildren(node: anyNode): node is anyNode & ParentLikeNode {\n\treturn node && 'children' in node && Array.isArray(node.children);\n}\n\nexport const isEmptyTextNode = (node: anyNode): boolean => {\n\treturn !!node && node.type === 'text' && getUnencodedText(node).trim() === '';\n};\n\nexport function getUnencodedText(node: TextNode | CommentNode): string {\n\treturn node.value;\n}\n\nexport function isTextNodeStartingWithLinebreak(node: TextNode, nrLines = 1): node is TextNode {\n\treturn startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\n}\n\nexport function endsWithLinebreak(text: string, nrLines = 1): boolean {\n\treturn new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\n\treturn isTextNode(node) && /^\\s/.test(getUnencodedText(node));\n}\n\nfunction endsWithWhitespace(text: string) {\n\treturn /\\s$/.test(text);\n}\n\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\n\treturn isTextNode(node) && endsWithWhitespace(getUnencodedText(node));\n}\n\nexport function hasSetDirectives(node: TagLikeNode) {\n\tconst attributes = Array.from(node.attributes, (attr) => attr.name);\n\treturn attributes.some((attr) => ['set:html', 'set:text'].includes(attr));\n}\n\n/**\n * Check if given node's start tag should hug its first child. This is the case for inline elements when there's\n * no whitespace between the `>` and the first child.\n */\nexport function shouldHugStart(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst firstChild = children[0];\n\treturn !isTextNodeStartingWithWhitespace(firstChild);\n}\n\n/**\n * Check if given node's end tag should hug its last child. This is the case for inline elements when there's\n * no whitespace between the last child and the `</`.\n */\nexport function shouldHugEnd(node: anyNode, opts: ParserOptions): boolean {\n\tif (isBlockElement(node, opts)) {\n\t\treturn false;\n\t}\n\n\tif (!isNodeWithChildren(node)) {\n\t\treturn false;\n\t}\n\n\tconst children = node.children;\n\tif (children.length === 0) {\n\t\treturn true;\n\t}\n\n\tconst lastChild = children[children.length - 1];\n\tif (isExpressionNode(lastChild)) {return true;}\n\n\tif (isTagLikeNode(lastChild)) {return true;}\n\n\treturn !isTextNodeEndingWithWhitespace(lastChild);\n}\n\n/**\n * Returns true if the softline between `</tagName` and `>` can be omitted.\n */\nexport function canOmitSoftlineBeforeClosingTag(path: AstPath, opts: ParserOptions): boolean {\n\treturn isLastChildWithinParentBlockElement(path, opts);\n}\n\nfunction getChildren(node: anyNode): Node[] {\n\treturn isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(path: AstPath, opts: ParserOptions): boolean {\n\tconst parent = path.getParentNode();\n\tif (!parent || !isBlockElement(parent, opts)) {\n\t\treturn false;\n\t}\n\n\tconst children = getChildren(parent);\n\tconst lastChild = children[children.length - 1];\n\treturn lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n\tnode.value = node.value && node.value.trimStart();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n\tnode.value = node.value && node.value.trimEnd();\n}\n\nexport function printClassNames(value: string) {\n\tconst lines = value.trim().split(/[\\r\\n]+/);\n\tconst formattedLines = lines.map((line) => {\n\t\tconst spaces = /^\\s+/.exec(line);\n\t\treturn (spaces ? spaces[0] : '') + line.trim().split(/\\s+/).join(' ');\n\t});\n\treturn formattedLines.join('\\n');\n}\n\n/** dedent string & return tabSize (the last part is what we need) */\nexport function manualDedent(input: string): {\n\ttabSize: number;\n\tchar: string;\n\tresult: string;\n} {\n\tlet minTabSize = Infinity;\n\tlet result = input;\n\t// 1. normalize\n\tresult = result.replace(/\\r\\n/g, '\\n');\n\n\t// 2. count tabSize\n\tlet char = '';\n\tfor (const line of result.split('\\n')) {\n\t\tif (!line) {continue;}\n\n\t\t// if any line begins with a non-whitespace char, minTabSize is 0\n\t\tif (line[0] && /^\\S/.test(line[0])) {\n\t\t\tminTabSize = 0;\n\t\t\tbreak;\n\t\t}\n\n\t\tconst match = /^(\\s+)\\S+/.exec(line); // \\S ensures we don’t count lines of pure whitespace\n\t\tif (match) {\n\t\t\tif (match[1] && !char) {char = match[1][0];}\n\n\t\t\tif (match[1].length < minTabSize) {minTabSize = match[1].length;}\n\t\t}\n\t}\n\n\t// 3. reformat string\n\tif (minTabSize > 0 && Number.isFinite(minTabSize)) {\n\t\tresult = result.replace(new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'), '');\n\t}\n\n\treturn {\n\t\ttabSize: minTabSize === Infinity ? 0 : minTabSize,\n\t\tchar,\n\t\tresult,\n\t};\n}\n\n/** True if the node is of type text */\nexport function isTextNode(node: anyNode): node is TextNode {\n\treturn node.type === 'text';\n}\n\nexport function isExpressionNode(node: anyNode): node is ExpressionNode {\n\treturn node.type === 'expression';\n}\n\n/** True if the node is TagLikeNode:\n *\n * ElementNode | ComponentNode | CustomElementNode | FragmentNode */\nexport function isTagLikeNode(node: anyNode): node is TagLikeNode {\n\treturn (\n\t\tnode.type === 'element' ||\n\t\tnode.type === 'component' ||\n\t\tnode.type === 'custom-element' ||\n\t\tnode.type === 'fragment'\n\t);\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n\tconst parent = path.getParentNode();\n\tif (!parent) {return [];}\n\n\treturn getChildren(parent);\n}\n\nexport function getNextNode(path: AstPath): anyNode | null {\n\tconst node = path.getNode();\n\tif (node) {\n\t\tconst siblings = getSiblings(path);\n\t\tif (node.position?.start === siblings[siblings.length - 1].position?.start) {return null;}\n\n\t\tfor (let i = 0; i < siblings.length; i++) {\n\t\t\tconst sibling = siblings[i];\n\t\t\tif (sibling.position?.start === node.position?.start && i !== siblings.length - 1) {\n\t\t\t\treturn siblings[i + 1];\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n\tif (!path || !path.stack || !Array.isArray(path.stack)) {return false;}\n\n\treturn path.stack.some(\n\t\t(node: anyNode) =>\n\t\t\t(node.type === 'element' && node.name.toLowerCase() === 'pre') ||\n\t\t\t(node.type === 'attribute' && !formattableAttributes.includes(node.name)),\n\t);\n};\n\ninterface QuoteResult {\n\tquote: '\"' | \"'\";\n\tregex: RegExp;\n\tescaped: string;\n}\n\n// Adapted from Prettier's source code as it's unfortunately not exported\n// https://github.com/prettier/prettier/blob/237e681936fc533c27d7ce8577d3fc98838a3314/src/common/util.js#L238\nexport function getPreferredQuote(rawContent: string, preferredQuote: string): QuoteResult {\n\tconst double: QuoteResult = { quote: '\"', regex: /\"/g, escaped: '"' };\n\tconst single: QuoteResult = { quote: \"'\", regex: /'/g, escaped: ''' };\n\n\tconst preferred = preferredQuote === \"'\" ? single : double;\n\tconst alternate = preferred === single ? double : single;\n\n\tlet result = preferred;\n\n\t// If `rawContent` contains at least one of the quote preferred for enclosing\n\t// the string, we might want to enclose with the alternate quote instead, to\n\t// minimize the number of escaped quotes.\n\tif (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {\n\t\tconst numPreferredQuotes = (preferred.regex.exec(rawContent) || []).length;\n\t\tconst numAlternateQuotes = (alternate.regex.exec(rawContent) || []).length;\n\n\t\tresult = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;\n\t}\n\n\treturn result;\n}\n\n// Adapted from: https://github.com/prettier/prettier/blob/20ab6d6f1c5bd774621230b493a3b71d39383a2c/src/language-html/utils/index.js#LL336C1-L369C2\nexport function inferParserByTypeAttribute(type: string): BuiltInParserName {\n\tif (!type) {\n\t\treturn 'babel-ts';\n\t}\n\n\tswitch (type) {\n\t\tcase 'module':\n\t\tcase 'text/javascript':\n\t\tcase 'text/babel':\n\t\tcase 'application/javascript':\n\t\t\treturn 'babel';\n\n\t\tcase 'application/x-typescript':\n\t\t\treturn 'babel-ts';\n\n\t\tcase 'text/markdown':\n\t\t\treturn 'markdown';\n\n\t\tcase 'text/html':\n\t\t\treturn 'html';\n\n\t\tcase 'text/x-handlebars-template':\n\t\t\treturn 'glimmer';\n\n\t\tdefault:\n\t\t\tif (type.endsWith('json') || type.endsWith('importmap') || type === 'speculationrules') {\n\t\t\t\treturn 'json';\n\t\t\t}\n\n\t\t\treturn 'babel-ts';\n\t}\n}\n","import { type Doc } from 'prettier';\nimport { selfClosingTags } from './elements';\nimport { type TextNode } from './nodes';\nimport {\n\tcanOmitSoftlineBeforeClosingTag,\n\tendsWithLinebreak,\n\tgetNextNode,\n\tgetPreferredQuote,\n\tgetUnencodedText,\n\thasSetDirectives,\n\tisEmptyTextNode,\n\tisIgnoreDirective,\n\tisInlineElement,\n\tisPreTagContent,\n\tisTagLikeNode,\n\tisTextNode,\n\tisTextNodeEndingWithWhitespace,\n\tisTextNodeStartingWithLinebreak,\n\tisTextNodeStartingWithWhitespace,\n\tprintClassNames,\n\tprintRaw,\n\tshouldHugEnd,\n\tshouldHugStart,\n\tstartsWithLinebreak,\n\ttrimTextNodeLeft,\n\ttrimTextNodeRight,\n\ttype AstPath,\n\ttype ParserOptions,\n\ttype printFn,\n} from './utils';\n\nimport _doc from 'prettier/doc';\nconst {\n\tbuilders: {\n\t\tbreakParent,\n\t\tdedent,\n\t\tfill,\n\t\tgroup,\n\t\tindent,\n\t\tjoin,\n\t\tline,\n\t\tsoftline,\n\t\thardline,\n\t\tliteralline,\n\t},\n\tutils: { stripTrailingHardline },\n} = _doc;\n\nlet ignoreNext = false;\n\n// https://prettier.io/docs/en/plugins.html#print \nexport function print(path: AstPath, opts: ParserOptions, print: printFn): Doc {\n\tconst node = path.node;\n\n\t// 1. handle special node types\n\tif (!node) {\n\t\treturn '';\n\t}\n\n\tif (ignoreNext && !isEmptyTextNode(node)) {\n\t\tignoreNext = false;\n\t\treturn [\n\t\t\topts.originalText\n\t\t\t\t.slice(opts.locStart(node), opts.locEnd(node))\n\t\t\t\t.split('\\n')\n\t\t\t\t.map((lineContent, i) => (i == 0 ? [lineContent] : [literalline, lineContent]))\n\t\t\t\t.flat(),\n\t\t];\n\t}\n\n\tif (typeof node === 'string') {\n\t\treturn node;\n\t}\n\n\t// 2. handle printing\n\tswitch (node.type) {\n\t\tcase 'root': {\n\t\t\treturn [stripTrailingHardline(path.map(print, 'children')), hardline];\n\t\t}\n\n\t\tcase 'text': {\n\t\t\tconst rawText = getUnencodedText(node);\n\n\t\t\t// TODO: TEST PRE TAGS\n\t\t\t// if (isPreTagContent(path)) {\n\t\t\t// if (path.getParentNode()?.type === 'Attribute') {\n\t\t\t// // Direct child of attribute value -> add literallines at end of lines\n\t\t\t// // so that other things don't break in unexpected places\n\t\t\t// return replaceEndOfLineWith(rawText, literalline);\n\t\t\t// }\n\t\t\t// return rawText;\n\t\t\t// }\n\n\t\t\tif (isEmptyTextNode(node)) {\n\t\t\t\tconst hasWhiteSpace = rawText.trim().length < getUnencodedText(node).length;\n\t\t\t\tconst hasOneOrMoreNewlines = getUnencodedText(node).includes('\\n');\n\t\t\t\tconst hasTwoOrMoreNewlines = /\\n\\s*\\n\\r?/.test(getUnencodedText(node));\n\t\t\t\tif (hasTwoOrMoreNewlines) {\n\t\t\t\t\treturn [hardline, hardline];\n\t\t\t\t}\n\n\t\t\t\tif (hasOneOrMoreNewlines) {\n\t\t\t\t\treturn hardline;\n\t\t\t\t}\n\n\t\t\t\tif (hasWhiteSpace) {\n\t\t\t\t\treturn line;\n\t\t\t\t}\n\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n\t\t\t * each \"word\") is joined by a single `line`, which will be rendered as a single space\n\t\t\t * until this node's current line is out of room, at which `fill` will break at the\n\t\t\t * most convenient instance of `line`.\n\t\t\t */\n\t\t\treturn fill(splitTextToDocs(node));\n\t\t}\n\n\t\tcase 'component':\n\t\tcase 'fragment':\n\t\tcase 'custom-element':\n\t\tcase 'element': {\n\t\t\tlet isEmpty: boolean;\n\t\t\tif (!node.children) {\n\t\t\t\tisEmpty = true;\n\t\t\t} else {\n\t\t\t\tisEmpty = node.children.every((child) => isEmptyTextNode(child));\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * An element is allowed to self close only if:\n\t\t\t * It is empty AND\n\t\t\t * It's a component OR\n\t\t\t * It's in the HTML spec as a void element OR\n\t\t\t * It has a `set:*` directive\n\t\t\t */\n\t\t\tconst isSelfClosingTag =\n\t\t\t\tisEmpty &&\n\t\t\t\t(node.type === 'component' ||\n\t\t\t\t\tselfClosingTags.includes(node.name) ||\n\t\t\t\t\thasSetDirectives(node));\n\n\t\t\tconst isSingleLinePerAttribute = opts.singleAttributePerLine && node.attributes.length > 1;\n\t\t\tconst attributeLine = isSingleLinePerAttribute ? breakParent : '';\n\t\t\tconst attributes = join(attributeLine, path.map(print, 'attributes'));\n\n\t\t\tif (isSelfClosingTag) {\n\t\t\t\treturn group(['<', node.name, indent(attributes), line, `/>`]);\n\t\t\t}\n\n\t\t\tif (node.children) {\n\t\t\t\tconst children = node.children;\n\t\t\t\tconst firstChild = children[0];\n\t\t\t\tconst lastChild = children[children.length - 1];\n\n\t\t\t\t// No hugging of content means it's either a block element and/or there's whitespace at the start/end\n\t\t\t\tlet noHugSeparatorStart:\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| _doc.builders.Hardline\n\t\t\t\t\t| string = softline;\n\t\t\t\tlet noHugSeparatorEnd:\n\t\t\t\t\t| _doc.builders.Line\n\t\t\t\t\t| _doc.builders.Softline\n\t\t\t\t\t| _doc.builders.Hardline\n\t\t\t\t\t| string = softline;\n\t\t\t\tconst hugStart = shouldHugStart(node, opts);\n\t\t\t\tconst hugEnd = shouldHugEnd(node, opts);\n\n\t\t\t\tlet body;\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\tbody =\n\t\t\t\t\t\tisInlineElement(path, opts, node) &&\n\t\t\t\t\t\tnode.children.length &&\n\t\t\t\t\t\tisTextNodeStartingWithWhitespace(node.children[0]) &&\n\t\t\t\t\t\t!isPreTagContent(path)\n\t\t\t\t\t\t\t? () => line\n\t\t\t\t\t\t\t: () => (node.children.length > 0 ? softline : '');\n\t\t\t\t} else if (isPreTagContent(path)) {\n\t\t\t\t\tbody = () => printRaw(node);\n\t\t\t\t} else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t} else {\n\t\t\t\t\tbody = () => path.map(print, 'children');\n\t\t\t\t}\n\n\t\t\t\tconst openingTag = [\n\t\t\t\t\t'<',\n\t\t\t\t\tnode.name,\n\t\t\t\t\tindent(\n\t\t\t\t\t\tgroup([\n\t\t\t\t\t\t\tattributes,\n\t\t\t\t\t\t\thugStart\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: !isPreTagContent(path) && !opts.bracketSameLine\n\t\t\t\t\t\t\t\t\t? dedent(softline)\n\t\t\t\t\t\t\t\t\t: '',\n\t\t\t\t\t\t]),\n\t\t\t\t\t),\n\t\t\t\t];\n\n\t\t\t\tif (hugStart && hugEnd) {\n\t\t\t\t\tconst huggedContent = [\n\t\t\t\t\t\tisSingleLinePerAttribute ? hardline : softline,\n\t\t\t\t\t\tgroup(['>', body(), `</${node.name}`]),\n\t\t\t\t\t];\n\n\t\t\t\t\tconst omitSoftlineBeforeClosingTag =\n\t\t\t\t\t\tisEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tisEmpty ? group(huggedContent) : group(indent(huggedContent)),\n\t\t\t\t\t\tomitSoftlineBeforeClosingTag ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isPreTagContent(path)) {\n\t\t\t\t\tnoHugSeparatorStart = '';\n\t\t\t\t\tnoHugSeparatorEnd = '';\n\t\t\t\t} else {\n\t\t\t\t\tlet didSetEndSeparator = false;\n\n\t\t\t\t\tif (!hugStart && firstChild && isTextNode(firstChild)) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tisTextNodeStartingWithLinebreak(firstChild) &&\n\t\t\t\t\t\t\tfirstChild !== lastChild &&\n\t\t\t\t\t\t\t(!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = hardline;\n\t\t\t\t\t\t\tnoHugSeparatorEnd = hardline;\n\t\t\t\t\t\t\tdidSetEndSeparator = true;\n\t\t\t\t\t\t} else if (isInlineElement(path, opts, node)) {\n\t\t\t\t\t\t\tnoHugSeparatorStart = line;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttrimTextNodeLeft(firstChild);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!hugEnd && lastChild && isTextNode(lastChild)) {\n\t\t\t\t\t\tif (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n\t\t\t\t\t\t\tnoHugSeparatorEnd = line;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttrimTextNodeRight(lastChild);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (hugStart) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\tindent([softline, group(['>', body()])]),\n\t\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (hugEnd) {\n\t\t\t\t\treturn group([\n\t\t\t\t\t\t...openingTag,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t\tindent([noHugSeparatorStart, group([body(), `</${node.name}`])]),\n\t\t\t\t\t\tcanOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline,\n\t\t\t\t\t\t'>',\n\t\t\t\t\t]);\n\t\t\t\t}\n\n\t\t\t\tif (isEmpty) {\n\t\t\t\t\treturn group([...openingTag, '>', body(), `</${node.name}>`]);\n\t\t\t\t}\n\n\t\t\t\treturn group([\n\t\t\t\t\t...openingTag,\n\t\t\t\t\t'>',\n\t\t\t\t\tindent([noHugSeparatorStart, body()]),\n\t\t\t\t\tnoHugSeparatorEnd,\n\t\t\t\t\t`</${node.name}>`,\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\t// TODO: WIP\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'attribute': {\n\t\t\tconst name = node.name.trim();\n\t\t\tswitch (node.kind) {\n\t\t\t\tcase 'empty':\n\t\t\t\t\treturn [line, name];\n\t\t\t\tcase 'expression':\n\t\t\t\t\t// Handled in the `embed` function\n\t\t\t\t\t// See embed.ts\n\t\t\t\t\treturn '';\n\t\t\t\tcase 'quoted':\n\t\t\t\t\tlet value = node.value;\n\n\t\t\t\t\tif (node.name === 'class') {\n\t\t\t\t\t\tvalue = printClassNames(value);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst unescapedValue = value.replace(/'/g, \"'\").replace(/"/g, '\"');\n\t\t\t\t\tconst { escaped, quote, regex } = getPreferredQuote(\n\t\t\t\t\t\tunescapedValue,\n\t\t\t\t\t\topts.jsxSingleQuote ? \"'\" : '\"',\n\t\t\t\t\t);\n\n\t\t\t\t\tconst result = unescapedValue.replace(regex, escaped);\n\t\t\t\t\treturn [line, name, '=', quote, result, quote];\n\t\t\t\tcase 'shorthand':\n\t\t\t\t\treturn [line, '{', name, '}'];\n\t\t\t\tcase 'spread':\n\t\t\t\t\treturn [line, '{...', name, '}'];\n\t\t\t\tcase 'template-literal':\n\t\t\t\t\treturn [line, name, '=', '`', node.value, '`'];\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\treturn '';\n\t\t}\n\n\t\tcase 'doctype': {\n\t\t\t// https://www.w3.org/wiki/Doctypes_and_markup_styles\n\t\t\treturn ['<!doctype html>', hardline];\n\t\t}\n\n\t\tcase 'comment':\n\t\t\tif (isIgnoreDirective(node)) {\n\t\t\t\tignoreNext = true;\n\t\t\t}\n\n\t\t\tconst nextNode = getNextNode(path);\n\t\t\tlet trailingLine: string | _doc.builders.Hardline = '';\n\t\t\tif (nextNode && isTagLikeNode(nextNode)) {\n\t\t\t\ttrailingLine = hardline;\n\t\t\t}\n\n\t\t\treturn ['<!--', getUnencodedText(node), '-->', trailingLine];\n\n\t\tdefault: {\n\t\t\tthrow new Error(`Unhandled node type \"${node.type}\"!`);\n\t\t}\n\t}\n}\n\n/**\n * Split the text into words separated by whitespace. Replace the whitespaces by lines,\n * collapsing multiple whitespaces into a single line.\n *\n * If the text starts or ends with multiple newlines, two of those should be kept.\n */\nfunction splitTextToDocs(node: TextNode): Doc[] {\n\tconst text = getUnencodedText(node);\n\n\tconst textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n\tlet docs = join(line, textLines).filter((doc) => doc !== '');\n\n\tif (startsWithLinebreak(text)) {\n\t\tdocs[0] = hardline;\n\t}\n\n\tif (startsWithLinebreak(text, 2)) {\n\t\tdocs = [hardline, ...docs];\n\t}\n\n\tif (endsWithLinebreak(text)) {\n\t\tdocs[docs.length - 1] = hardline;\n\t}\n\n\tif (endsWithLinebreak(text, 2)) {\n\t\tdocs = [...docs, hardline];\n\t}\n\n\treturn docs;\n}\n","import { Buffer } from 'node:buffer';\nimport type { BuiltInParserName, Doc, Options } from 'prettier';\nimport _doc from 'prettier/doc';\nimport { SassFormatter, type SassFormatterConfig } from 'sass-formatter';\nimport type { AttributeNode, ExpressionNode, FragmentNode, Node } from './nodes';\nimport {\n\tatSignReplace,\n\tclosingBracketReplace,\n\tdotReplace,\n\tinferParserByTypeAttribute,\n\tinterrogationReplace,\n\tisNodeWithChildren,\n\tisTagLikeNode,\n\tisTextNode,\n\tmanualDedent,\n\topeningBracketReplace,\n\tprintRaw,\n\ttype AstPath,\n\ttype ParserOptions,\n\ttype printFn,\n} from './utils';\n\nconst {\n\tbuilders: { group, indent, join, line, softline, hardline, lineSuffixBoundary },\n\tutils: { stripTrailingHardline, mapDoc },\n} = _doc;\n\nconst supportedStyleLangValues = ['css', 'scss', 'sass', 'less'] as const;\ntype supportedStyleLang = (typeof supportedStyleLangValues)[number];\n\n// https://prettier.io/docs/en/plugins.html#optional-embed\ntype TextToDoc = (text: string, options: Options) => Promise<Doc>;\n\ntype Embed =\n\t| ((\n\t\t\tpath: AstPath,\n\t\t\toptions: Options,\n\t ) =>\n\t\t\t| ((\n\t\t\t\t\ttextToDoc: TextToDoc,\n\t\t\t\t\tprint: (selector?: string | number | Array<string | number> | AstPath) => Doc,\n\t\t\t\t\tpath: AstPath,\n\t\t\t\t\toptions: Options,\n\t\t\t ) => Promise<Doc | undefined> | Doc | undefined)\n\t\t\t| Doc\n\t\t\t| null)\n\t| undefined;\n\nexport const embed = ((path: AstPath, options: Options) => {\n\tconst parserOption = options as ParserOptions;\n\treturn async (textToDoc, print) => {\n\t\tconst node = path.node;\n\n\t\tif (!node) {return undefined;}\n\n\t\tif (node.type === 'expression') {\n\t\t\t// Extract script and style elements and replace with self-closing\n\t\t\t// placeholder components so Babel's JSX parser doesn't try to parse\n\t\t\t// their content as JSX.\n\t\t\t// See: https://github.com/withastro/prettier-plugin-astro/issues/452\n\t\t\t// See: https://github.com/withastro/prettier-plugin-astro/issues/454\n\t\t\tconst rawTagPlaceholders: RawTagPlaceholder[] = [];\n\t\t\tconst nodeWithPlaceholders = replaceRawTagChildren(node, rawTagPlaceholders);\n\n\t\t\tconst jsxNode = makeNodeJSXCompatible<ExpressionNode>(nodeWithPlaceholders);\n\t\t\tconst textContent = printRaw(jsxNode);\n\n\t\t\tlet content: Doc;\n\n\t\t\tcontent = await wrapParserTryCatch(textToDoc, textContent, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\tcontent = stripTrailingHardline(content);\n\n\t\t\t// Replace self-closing placeholder components with fully-rendered\n\t\t\t// script/style tags, matching the format of the top-level handlers.\n\t\t\tfor (const entry of rawTagPlaceholders) {\n\t\t\t\tlet formattedContent: Doc;\n\n\t\t\t\tif (entry.tagName === 'script') {\n\t\t\t\t\tconst parser = inferParserByTypeAttribute(entry.typeAttr || '');\n\t\t\t\t\tformattedContent = await wrapParserTryCatch(textToDoc, entry.content, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\tparser,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// style tag\n\t\t\t\t\tconst langValue = entry.langAttr?.toLowerCase();\n\t\t\t\t\tif (langValue === 'sass') {\n\t\t\t\t\t\tconst lineEnding = parserOption?.endOfLine?.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\t\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\t\t\t\ttabSize: parserOption.tabWidth,\n\t\t\t\t\t\t\tinsertSpaces: !parserOption.useTabs,\n\t\t\t\t\t\t\tlineEnding,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst { result: raw } = manualDedent(entry.content);\n\t\t\t\t\t\tconst formatted = SassFormatter.Format(raw, sassOptions).trim();\n\t\t\t\t\t\tformattedContent = join(hardline, formatted.split('\\n'));\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// css, scss, less, or default to css\n\t\t\t\t\t\tconst styleParser: BuiltInParserName =\n\t\t\t\t\t\t\tlangValue === 'scss' || langValue === 'less' ? langValue : 'css';\n\t\t\t\t\t\tformattedContent = await wrapParserTryCatch(textToDoc, entry.content, {\n\t\t\t\t\t\t\t...options,\n\t\t\t\t\t\t\tparser: styleParser,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tformattedContent = stripTrailingHardline(formattedContent);\n\t\t\t\tconst isEmpty = /^\\s*$/.test(entry.content);\n\n\t\t\t\t// Build the full tag Doc matching top-level script/style formatting:\n\t\t\t\t// <tag attrs>\\n content\\n</tag>\n\t\t\t\tconst fullTagDoc: Doc = [\n\t\t\t\t\tentry.openingTag,\n\t\t\t\t\tindent([isEmpty ? '' : hardline, formattedContent]),\n\t\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t\t`</${entry.tagName}>`,\n\t\t\t\t];\n\n\t\t\t\tcontent = mapDoc(content, (doc) => {\n\t\t\t\t\tif (typeof doc === 'string' && doc.includes(entry.placeholder)) {\n\t\t\t\t\t\tconst parts = doc.split(entry.placeholder);\n\t\t\t\t\t\tif (parts.length === 2) {\n\t\t\t\t\t\t\tif (entry.isDirectChild) {\n\t\t\t\t\t\t\t\t// Direct children: placeholder replaced the entire element,\n\t\t\t\t\t\t\t\t// so insert the fully-rendered tag Doc\n\t\t\t\t\t\t\t\treturn [parts[0], fullTagDoc, parts[1]];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Nested children: placeholder is inside the tag, the tag\n\t\t\t\t\t\t\t// structure is preserved in the doc. Replace content only.\n\t\t\t\t\t\t\tif (isEmpty) {\n\t\t\t\t\t\t\t\treturn [parts[0], parts[1]];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn [parts[0], indent([hardline, formattedContent]), hardline, parts[1]];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn doc;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// HACK: Bit of a weird hack to get if a document is exclusively comments\n\t\t\t// Using `mapDoc` directly to build the array for some reason caused it to always be undefined? Not sure why\n\t\t\tconst strings: string[] = [];\n\t\t\tmapDoc(content, (doc) => {\n\t\t\t\tif (typeof doc === 'string') {\n\t\t\t\t\tstrings.push(doc);\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tif (strings.every((value) => value.startsWith('//'))) {\n\t\t\t\treturn group(['{', content, softline, lineSuffixBoundary, '}']);\n\t\t\t}\n\n\t\t\t// Create a Doc without the things we had to add to make the expression compatible with Babel\n\t\t\tconst astroDoc = mapDoc(content, (doc) => {\n\t\t\t\tif (typeof doc === 'string') {\n\t\t\t\t\tdoc = doc.replaceAll(openingBracketReplace, '{');\n\t\t\t\t\tdoc = doc.replaceAll(closingBracketReplace, '}');\n\t\t\t\t\tdoc = doc.replaceAll(atSignReplace, '@');\n\t\t\t\t\tdoc = doc.replaceAll(dotReplace, '.');\n\t\t\t\t\tdoc = doc.replaceAll(interrogationReplace, '?');\n\t\t\t\t}\n\n\t\t\t\treturn doc;\n\t\t\t});\n\n\t\t\t// Force multi-line format for expressions containing raw content tags\n\t\t\t// (script/style), since their content has hardlines that need proper\n\t\t\t// indentation context. Without this, babel may keep the expression on\n\t\t\t// one line, causing misaligned content after placeholder replacement.\n\t\t\tif (rawTagPlaceholders.length > 0) {\n\t\t\t\treturn ['{', indent([hardline, astroDoc]), hardline, lineSuffixBoundary, '}'];\n\t\t\t}\n\n\t\t\treturn group(['{', indent([softline, astroDoc]), softline, lineSuffixBoundary, '}']);\n\t\t}\n\n\t\t// Attribute using an expression as value\n\t\tif (node.type === 'attribute' && node.kind === 'expression') {\n\t\t\tconst value = node.value.trim();\n\t\t\tconst name = node.name.trim();\n\n\t\t\tconst attrNodeValue = await wrapParserTryCatch(textToDoc, value, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\tif (name === value && options.astroAllowShorthand) {\n\t\t\t\treturn [line, '{', attrNodeValue, '}'];\n\t\t\t}\n\n\t\t\treturn [line, name, '=', '{', attrNodeValue, '}'];\n\t\t}\n\n\t\tif (node.type === 'attribute' && node.kind === 'spread') {\n\t\t\tconst spreadContent = await wrapParserTryCatch(textToDoc, node.name, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'astroExpressionParser',\n\t\t\t});\n\n\t\t\treturn [line, '{...', spreadContent, '}'];\n\t\t}\n\n\t\t// Frontmatter\n\t\tif (node.type === 'frontmatter') {\n\t\t\tif (options.astroSkipFrontmatter) {\n\t\t\t\treturn [group(['---', node.value, '---', hardline]), hardline];\n\t\t\t}\n\n\t\t\tconst frontmatterContent = await wrapParserTryCatch(textToDoc, node.value, {\n\t\t\t\t...options,\n\t\t\t\tparser: 'babel-ts',\n\t\t\t});\n\n\t\t\treturn [group(['---', hardline, frontmatterContent, hardline, '---', hardline]), hardline];\n\t\t}\n\n\t\t// Script tags\n\t\tif (node.type === 'element' && node.name === 'script' && node.children.length) {\n\t\t\tconst typeAttribute = node.attributes.find((attr) => attr.name === 'type')?.value;\n\n\t\t\tlet parser: BuiltInParserName = 'babel-ts';\n\t\t\tif (typeAttribute) {\n\t\t\t\tparser = inferParserByTypeAttribute(typeAttribute);\n\t\t\t}\n\n\t\t\tconst scriptContent = printRaw(node);\n\t\t\tlet formattedScript = await wrapParserTryCatch(textToDoc, scriptContent, {\n\t\t\t\t...options,\n\t\t\t\tparser: parser,\n\t\t\t});\n\n\t\t\tformattedScript = stripTrailingHardline(formattedScript);\n\t\t\tconst isEmpty = /^\\s*$/.test(scriptContent);\n\n\t\t\t// print\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group([\n\t\t\t\t'<script',\n\t\t\t\tindent(group(attributes)),\n\t\t\t\toptions.bracketSameLine ? '' : softline,\n\t\t\t\t'>',\n\t\t\t]);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedScript]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</script>',\n\t\t\t];\n\t\t}\n\n\t\t// Style tags\n\t\tif (node.type === 'element' && node.name === 'style') {\n\t\t\tconst content = printRaw(node);\n\t\t\tlet parserLang: supportedStyleLang | undefined = 'css';\n\n\t\t\tif (node.attributes) {\n\t\t\t\tconst langAttribute = node.attributes.filter((x) => x.name === 'lang');\n\t\t\t\tif (langAttribute.length) {\n\t\t\t\t\tconst styleLang = langAttribute[0].value.toLowerCase() as supportedStyleLang;\n\t\t\t\t\tparserLang = supportedStyleLangValues.includes(styleLang) ? styleLang : undefined;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn await embedStyle(parserLang, content, path, print, textToDoc, parserOption);\n\t\t}\n\n\t\treturn undefined;\n\t};\n}) satisfies Embed;\n\nasync function wrapParserTryCatch(cb: TextToDoc, text: string, options: Options) {\n\ttry {\n\t\treturn await cb(text, options);\n\t} catch (e) {\n\t\t// If we couldn't parse the expression (ex: syntax error) and we throw here, Prettier fallback to `print` and we'll\n\t\t// get a totally useless error message (ex: unhandled node type). An undocumented way to work around this is to set\n\t\t// `PRETTIER_DEBUG=1`, but nobody know that exists / want to do that just to get useful error messages. So we force it on\n\t\tprocess.env.PRETTIER_DEBUG = 'true';\n\t\tthrow e;\n\t}\n}\n\n/**\n * Due to the differences between Astro and JSX, Prettier's TypeScript parsers (be it `typescript` or `babel-ts`) are not\n * able to parse all expressions. So we need to first make the expression compatible before passing it to the parser\n *\n * A list of the difference that matters here:\n * - Astro allows a shorthand syntax for props. ex: `<Component {props} />`\n * - Astro allows multiple root elements. ex: `<div></div><div></div>`\n * - Astro allows attributes to include at signs (@) and dots (.)\n */\nfunction makeNodeJSXCompatible<T>(node: any): T {\n\tconst newNode = { ...node };\n\tconst childBundle: Node[][] = [];\n\tlet childBundleIndex = 0;\n\n\tif (isNodeWithChildren(newNode)) {\n\t\tnewNode.children = newNode.children.reduce((result: Node[], child, index) => {\n\t\t\tconst previousChildren = newNode.children[index - 1];\n\t\t\tconst nextChildren = newNode.children[index + 1];\n\t\t\tif (isTagLikeNode(child)) {\n\t\t\t\tchild.attributes = child.attributes.map(makeAttributeJSXCompatible);\n\n\t\t\t\tif (!childBundle[childBundleIndex]) {\n\t\t\t\t\tchildBundle[childBundleIndex] = [];\n\t\t\t\t}\n\n\t\t\t\tif (isNodeWithChildren(child)) {\n\t\t\t\t\tchild = makeNodeJSXCompatible<typeof child>(child);\n\t\t\t\t}\n\n\t\t\t\t// If we don't have a previous children, or it's not an element AND\n\t\t\t\t// we have a next children, and it's an element. Add the current children to the bundle\n\t\t\t\tif (\n\t\t\t\t\t(!previousChildren || isTextNode(previousChildren)) &&\n\t\t\t\t\tnextChildren &&\n\t\t\t\t\tisTagLikeNode(nextChildren)\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// If we have a previous children, and it's an element AND\n\t\t\t\t// we have a next children, and it's also an element. Add the current children to the bundle\n\t\t\t\tif (\n\t\t\t\t\tpreviousChildren &&\n\t\t\t\t\tisTagLikeNode(previousChildren) &&\n\t\t\t\t\tnextChildren &&\n\t\t\t\t\tisTagLikeNode(nextChildren)\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// If we have elements in our bundle, and there's no next children, or it's a text node\n\t\t\t\t// Create a fake parent, and add all the previous encountered elements as children of it\n\t\t\t\tif (\n\t\t\t\t\t(!nextChildren || isTextNode(nextChildren)) &&\n\t\t\t\t\tchildBundle[childBundleIndex].length > 0\n\t\t\t\t) {\n\t\t\t\t\tchildBundle[childBundleIndex].push(child);\n\n\t\t\t\t\tconst parentNode: FragmentNode = {\n\t\t\t\t\t\ttype: 'fragment',\n\t\t\t\t\t\tname: '',\n\t\t\t\t\t\tattributes: [],\n\t\t\t\t\t\tchildren: childBundle[childBundleIndex],\n\t\t\t\t\t};\n\n\t\t\t\t\tchildBundleIndex += 1;\n\t\t\t\t\tresult.push(parentNode);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tchildBundleIndex += 1;\n\t\t\t}\n\n\t\t\tresult.push(child);\n\t\t\treturn result;\n\t\t}, []);\n\t}\n\n\treturn newNode;\n\n\tfunction makeAttributeJSXCompatible(attr: AttributeNode): AttributeNode {\n\t\t// Transform shorthand attributes into an empty attribute, ex: `{shorthand}` becomes `shorthand` and wrap it\n\t\t// so we can transform it back into {}\n\t\tif (attr.kind === 'shorthand') {\n\t\t\tattr.kind = 'empty';\n\t\t\tattr.name = openingBracketReplace + attr.name + closingBracketReplace;\n\t\t}\n\n\t\t// For spreads, we don't need to do anything because it should already be JSX compatible\n\t\tif (attr.kind !== 'spread') {\n\t\t\tif (attr.name.includes('@')) {\n\t\t\t\tattr.name = attr.name.replaceAll('@', atSignReplace);\n\t\t\t}\n\n\t\t\tif (attr.name.includes('.')) {\n\t\t\t\tattr.name = attr.name.replaceAll('.', dotReplace);\n\t\t\t}\n\n\t\t\tif (attr.name.includes('?')) {\n\t\t\t\tattr.name = attr.name.replaceAll('?', interrogationReplace);\n\t\t\t}\n\t\t}\n\n\t\treturn attr;\n\t}\n}\n\n/** Tags whose content is raw text (not JSX) and must be extracted before Babel parsing */\nconst rawContentTags = ['script', 'style'] as const;\n\ninterface RawTagPlaceholder {\n\tplaceholder: string;\n\tcontent: string;\n\ttagName: (typeof rawContentTags)[number];\n\topeningTag: string; // the serialized opening tag, e.g. '<script is:inline>'\n\tisDirectChild: boolean; // true if direct child of expression (vs nested in fragment)\n\ttypeAttr?: string; // for script\n\tlangAttr?: string; // for style\n}\n\n/**\n * Replace the children of any raw-content elements (script, style) in an expression\n * node with placeholder text nodes. This prevents Babel's JSX parser from trying to\n * parse their content as JSX when they appear inside an expression.\n *\n * See: https://github.com/withastro/prettier-plugin-astro/issues/452\n * See: https://github.com/withastro/prettier-plugin-astro/issues/454\n */\nfunction replaceRawTagChildren(\n\tnode: any,\n\tplaceholders: RawTagPlaceholder[],\n\tisTopLevel = true,\n): any {\n\tconst newNode = { ...node };\n\tif (isNodeWithChildren(newNode)) {\n\t\tnewNode.children = newNode.children.map((child: any) => {\n\t\t\tif (\n\t\t\t\tchild.type === 'element' &&\n\t\t\t\trawContentTags.includes(child.name) &&\n\t\t\t\tchild.children.length\n\t\t\t) {\n\t\t\t\tconst placeholder = `__ASTRO_RAW_TAG_PLACEHOLDER_${placeholders.length}__`;\n\t\t\t\tconst content = printRaw(child);\n\n\t\t\t\t// Build the opening tag string from the original element\n\t\t\t\tconst attrs = (child.attributes || [])\n\t\t\t\t\t.map((a: AttributeNode) => {\n\t\t\t\t\t\tif (a.kind === 'empty') {return a.name;}\n\n\t\t\t\t\t\tif (a.kind === 'expression') {return `${a.name}={${a.value}}`;}\n\n\t\t\t\t\t\tif (a.kind === 'spread') {return `{...${a.name}}`;}\n\n\t\t\t\t\t\treturn `${a.name}=\"${a.value}\"`;\n\t\t\t\t\t})\n\t\t\t\t\t.join(' ');\n\t\t\t\tconst openingTag = attrs ? `<${child.name} ${attrs}>` : `<${child.name}>`;\n\n\t\t\t\tplaceholders.push({\n\t\t\t\t\tplaceholder,\n\t\t\t\t\tcontent,\n\t\t\t\t\ttagName: child.name,\n\t\t\t\t\topeningTag,\n\t\t\t\t\t// Whether this tag is a direct child of the expression (not nested\n\t\t\t\t\t// inside a fragment/element). Direct children are replaced entirely\n\t\t\t\t\t// so babel formats the expression around a simple identifier. Nested\n\t\t\t\t\t// children keep their tag structure for proper fragment formatting.\n\t\t\t\t\tisDirectChild: isTopLevel,\n\t\t\t\t\ttypeAttr: child.attributes?.find((a: AttributeNode) => a.name === 'type')?.value,\n\t\t\t\t\tlangAttr: child.attributes?.find((a: AttributeNode) => a.name === 'lang')?.value,\n\t\t\t\t});\n\n\t\t\t\tif (isTopLevel) {\n\t\t\t\t\t// Replace the entire element with a text placeholder.\n\t\t\t\t\t// Babel sees it as a simple identifier, keeping it on its own\n\t\t\t\t\t// line when the expression handler forces multi-line format.\n\t\t\t\t\treturn { type: 'text', value: placeholder };\n\t\t\t\t}\n\n\t\t\t\t// Nested: replace only children, preserving the tag structure so\n\t\t\t\t// babel can format it properly within fragments/wrappers.\n\t\t\t\treturn {\n\t\t\t\t\t...child,\n\t\t\t\t\tchildren: [{ type: 'text', value: placeholder }],\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif (isNodeWithChildren(child)) {\n\t\t\t\treturn replaceRawTagChildren(child, placeholders, false);\n\t\t\t}\n\n\t\t\treturn child;\n\t\t});\n\t}\n\n\treturn newNode;\n}\n\n/**\n * Format the content of a style tag and print the entire element\n */\nasync function embedStyle(\n\tlang: supportedStyleLang | undefined,\n\tcontent: string,\n\tpath: AstPath,\n\tprint: printFn,\n\ttextToDoc: TextToDoc,\n\toptions: ParserOptions,\n): Promise<_doc.builders.Doc | undefined> {\n\tconst isEmpty = /^\\s*$/.test(content);\n\n\tswitch (lang) {\n\t\tcase 'less':\n\t\tcase 'css':\n\t\tcase 'scss': {\n\t\t\tlet formattedStyles = await wrapParserTryCatch(textToDoc, content, {\n\t\t\t\t...options,\n\t\t\t\tparser: lang,\n\t\t\t});\n\n\t\t\t// The css parser appends an extra indented hardline, which we want outside of the `indent()`,\n\t\t\t// so we remove the last element of the array\n\t\t\tformattedStyles = stripTrailingHardline(formattedStyles);\n\n\t\t\t// print\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedStyles]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</style>',\n\t\t\t];\n\t\t}\n\n\t\tcase 'sass': {\n\t\t\tconst lineEnding = options?.endOfLine?.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n\t\t\tconst sassOptions: Partial<SassFormatterConfig> = {\n\t\t\t\ttabSize: options.tabWidth,\n\t\t\t\tinsertSpaces: !options.useTabs,\n\t\t\t\tlineEnding,\n\t\t\t};\n\n\t\t\t// dedent the .sass, otherwise SassFormatter gets indentation wrong\n\t\t\tconst { result: raw } = manualDedent(content);\n\n\t\t\t// format\n\t\t\tconst formattedSassIndented = SassFormatter.Format(raw, sassOptions).trim();\n\n\t\t\t// print\n\t\t\tconst formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n\t\t\tconst attributes = path.map(print, 'attributes');\n\t\t\tconst openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n\t\t\treturn [\n\t\t\t\topeningTag,\n\t\t\t\tindent([isEmpty ? '' : hardline, formattedSass]),\n\t\t\t\tisEmpty ? '' : hardline,\n\t\t\t\t'</style>',\n\t\t\t];\n\t\t}\n\n\t\tcase undefined: {\n\t\t\tconst node = path.getNode();\n\n\t\t\tif (node) {\n\t\t\t\treturn Buffer.from(options.originalText)\n\t\t\t\t\t.subarray(options.locStart(node), options.locEnd(node))\n\t\t\t\t\t.toString();\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t}\n\t}\n}\n","export function getVisitorKeys(node: any): string[] {\n\tif (!node || typeof node !== 'object') {return [];}\n\n\treturn Object.keys(node).filter((key) => {\n\t\tconst value = node[key];\n\t\treturn (\n\t\t\t(typeof value === 'object' &&\n\t\t\t\tvalue !== null &&\n\t\t\t\tkey !== 'position' && // skip position metadata\n\t\t\t\tkey !== 'type' && // skip node type itself\n\t\t\t\t!Array.isArray(value)) ||\n\t\t\t(Array.isArray(value) && value.length > 0 && typeof value[0] === 'object')\n\t\t);\n\t});\n}\n","import { parse } from '@astrojs/compiler/sync';\nimport type { Parser, Printer, SupportLanguage } from 'prettier';\nimport * as prettierPluginBabel from 'prettier/plugins/babel';\nimport { options } from './options';\nimport { print } from './printer';\nimport { embed } from './printer/embed';\nimport { getVisitorKeys } from './get-visitor-keys';\n\nconst babelParser = prettierPluginBabel.parsers['babel-ts'];\n\n// https://prettier.io/docs/en/plugins.html#languages\nexport const languages: Partial<SupportLanguage>[] = [\n\t{\n\t\tname: 'astro',\n\t\tparsers: ['astro'],\n\t\textensions: ['.astro'],\n\t\tvscodeLanguageIds: ['astro'],\n\t},\n];\n\n// https://prettier.io/docs/en/plugins.html#parsers\nexport const parsers: Record<string, Parser> = {\n\tastro: {\n\t\tparse: (source) => parse(source, { position: true }).ast,\n\t\tastFormat: 'astro',\n\t\tlocStart: (node) => node.position.start.offset,\n\t\tlocEnd: (node) => node.position.end?.offset,\n\t},\n\tastroExpressionParser: {\n\t\t...babelParser,\n\t\tpreprocess(text) {\n\t\t\t// note the trailing newline: if the statement ends in a // comment,\n\t\t\t// we can't add the closing bracket right afterwards\n\t\t\treturn `<>{${text}\\n}</>`;\n\t\t},\n\t\tparse(text, opts) {\n\t\t\tconst ast = babelParser.parse(text, opts);\n\n\t\t\treturn {\n\t\t\t\t...ast,\n\t\t\t\tprogram: ast.program.body[0].expression.children[0].expression,\n\t\t\t};\n\t\t},\n\t},\n};\n\n// https://prettier.io/docs/en/plugins.html#printers\nexport const printers: Record<string, Printer> = {\n\tastro: {\n\t\tprint,\n\t\tembed,\n\t\tgetVisitorKeys,\n\t},\n};\n\nconst defaultOptions = {\n\ttabWidth: 2,\n};\n\nexport { defaultOptions, options };\n"],"mappings":";;;;;;;AAaA,MAAa,UAAsD;CAClE,qBAAqB;EACpB,UAAU;EACV,MAAM;EACN,SAAS;EACT,aAAa;CACd;CACA,sBAAsB;EACrB,UAAU;EACV,MAAM;EACN,SA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AC,QAAQ,OAAO,SAAS,UAAW,OAAO,CAAC;CAEhD,OAAO,OAAO,KAAK,IAAI,EAAE,QAAQ,QAAQ;EACxC,MAAM,QAAQ,KAAK;EACnB,OACE,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,cACR,QAAQ,UACR,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM,QAAQ,KAAK,KAAK,MAAM,SAAS,KAAK,OAAO,MAAM,OAAO;CAEnE,CAAC;AACF;;;ACNA,MAAM,cAAc,oBAAoB,QAAQ;AAGhD,MAAa,YAAwC,CACpD;CACC,MAAM;CACN,SAAS,CAAC,OAAO;CACjB,YAAY,CAAC,QAAQ;CACrB,mBAAmB,CAAC,OAAO;AAC5B,CACD;AAGA,MAAa,UAAkC;CAC9C,OAAO;EACN,QAAQ,WAAW,MAAM,QAAQ,EAAE,UAAU,KAAK,CAAC,EAAE;EACrD,WAAW;EACX,WAAW,SAAS,KAAK,SAAS,MAAM;EACxC,SAAS,SAAS,KAAK,SAAS,KAAK;CACtC;CACA,uBAAuB;EACtB,GAAG;EACH,WAAW,MAAM;GAGhB,OAAO,MAAM,KAAK;EACnB;EACA,MAAM,MAAM,MAAM;GACjB,MAAM,MAAM,YAAY,MAAM,MAAM,IAAI;GAExC,OAAO;IACN,GAAG;IACH,SAAS,IAAI,QAAQ,KAAK,GAAG,WAAW,SAAS,GAAG;GACrD;EACD;CACD;AACD;AAGA,MAAa,WAAoC,EAChD,OAAO;CACN;CACA;CACA;AACD,EACD;AAEA,MAAM,iBAAiB,EACtB,UAAU,EACX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitschpatrol/prettier-plugin-astro",
|
|
3
|
-
"version": "0.14.1-fork.
|
|
3
|
+
"version": "0.14.1-fork.4",
|
|
4
4
|
"description": "A fork of Prettier Plugin Astro with minor fixes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prettier-plugin",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"dist/*"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@astrojs/compiler": "^
|
|
40
|
+
"@astrojs/compiler": "^4.0.0",
|
|
41
41
|
"sass-formatter": "^0.8.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@arethetypeswrong/core": "^0.18.2",
|
|
45
|
-
"@kitschpatrol/shared-config": "^7.
|
|
45
|
+
"@kitschpatrol/shared-config": "^7.6.0",
|
|
46
46
|
"@types/node": "~22.18.13",
|
|
47
|
-
"bumpp": "^11.0
|
|
48
|
-
"prettier": "^3.8.
|
|
49
|
-
"publint": "^0.3.
|
|
47
|
+
"bumpp": "^11.1.0",
|
|
48
|
+
"prettier": "^3.8.3",
|
|
49
|
+
"publint": "^0.3.21",
|
|
50
50
|
"shx": "^0.4.0",
|
|
51
|
-
"tsdown": "^0.
|
|
52
|
-
"typescript": "~
|
|
53
|
-
"vite": "^8.0.
|
|
54
|
-
"vitest": "^4.1.
|
|
51
|
+
"tsdown": "^0.22.0",
|
|
52
|
+
"typescript": "~5.9.3",
|
|
53
|
+
"vite": "^8.0.13",
|
|
54
|
+
"vitest": "^4.1.6"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"prettier": "^3.7.0"
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"clean": "shx rm -f pnpm-lock.yaml && git clean -fdX -e !.claude/",
|
|
76
76
|
"fix": "ksc fix",
|
|
77
77
|
"lint": "ksc lint",
|
|
78
|
-
"release": "bumpp --preid fork --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token')
|
|
78
|
+
"release": "bumpp --preid fork --commit 'Release: %s' && pnpm build && NPM_AUTH_TOKEN=$(op read 'op://Personal/npm/token') pnpm publish --tag latest",
|
|
79
79
|
"test": "vitest run"
|
|
80
80
|
}
|
|
81
81
|
}
|
package/readme.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<!-- badges -->
|
|
8
8
|
|
|
9
9
|
[](https://npmjs.com/package/@kitschpatrol/prettier-plugin-astro)
|
|
10
|
-
[](
|
|
10
|
+
[](http://trac.enlightenment.org/e/browser/trunk/imlib2/COPYING)
|
|
11
11
|
[](https://github.com/kitschpatrol/prettier-plugin-astro/actions/workflows/ci.yml)
|
|
12
12
|
|
|
13
13
|
<!-- /badges -->
|