You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
169 KiB
Plaintext

{"version":3,"file":"plugin.js","sources":["src/lib/elements.ts","src/lib/extractAttributes.ts","src/lib/snipTagContent.ts","src/lib/getText.ts","src/options.ts","src/print/helpers.ts","src/print/doc-helpers.ts","src/print/node-helpers.ts","src/print/index.ts","src/embed.ts","src/index.ts"],"sourcesContent":["export type TagName = keyof HTMLElementTagNameMap | 'svg';\r\n\r\n// @see http://xahlee.info/js/html5_non-closing_tag.html\r\nexport const selfClosingTags = [\r\n 'area',\r\n 'base',\r\n 'br',\r\n 'col',\r\n 'embed',\r\n 'hr',\r\n 'img',\r\n 'input',\r\n 'link',\r\n 'meta',\r\n 'param',\r\n 'source',\r\n 'track',\r\n 'wbr',\r\n];\r\n\r\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements\r\nexport const blockElements: TagName[] = [\r\n 'address',\r\n 'article',\r\n 'aside',\r\n 'blockquote',\r\n 'details',\r\n 'dialog',\r\n 'dd',\r\n 'div',\r\n 'dl',\r\n 'dt',\r\n 'fieldset',\r\n 'figcaption',\r\n 'figure',\r\n 'footer',\r\n 'form',\r\n 'h1',\r\n 'h2',\r\n 'h3',\r\n 'h4',\r\n 'h5',\r\n 'h6',\r\n 'header',\r\n 'hgroup',\r\n 'hr',\r\n 'li',\r\n 'main',\r\n 'nav',\r\n 'ol',\r\n 'p',\r\n 'pre',\r\n 'section',\r\n 'table',\r\n 'ul',\r\n];\r\n\r\n/**\r\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\r\n */\r\nexport const formattableAttributes: string[] = [\r\n // None at the moment\r\n // Prettier HTML does not format attributes at all\r\n // and to be consistent we leave this array empty for now\r\n];\r\n","import { AttributeNode, TextNode } from '../print/nodes';\r\n\r\nexport function extractAttributes(html: string): AttributeNode[] {\r\n const extractAttributesRegex = /<[a-z]+[\\s\\n]*([\\s\\S]*?)>/im;\r\n const attributeRegex = /([^\\s=]+)(?:=(?:(?:(\"|')([\\s\\S]*?)\\2)|(?:(\\S+?)(?:\\s|>|$))))?/gim;\r\n\r\n const [, attributesString] = html.match(extractAttributesRegex)!;\r\n\r\n const attrs: AttributeNode[] = [];\r\n\r\n let match: RegExpMatchArray | null;\r\n while ((match = attributeRegex.exec(attributesString))) {\r\n const [all, name, quotes, valueQuoted, valueUnquoted] = match;\r\n const value = valueQuoted || valueUnquoted;\r\n const attrStart = match.index!;\r\n\r\n let valueNode: AttributeNode['value'];\r\n if (!value) {\r\n valueNode = true;\r\n } else {\r\n let valueStart = attrStart + name.length;\r\n if (quotes) {\r\n valueStart += 2;\r\n }\r\n\r\n valueNode = [\r\n {\r\n type: 'Text',\r\n data: value,\r\n start: valueStart,\r\n end: valueStart + value.length,\r\n } as TextNode,\r\n ];\r\n }\r\n\r\n attrs.push({\r\n type: 'Attribute',\r\n name,\r\n value: valueNode,\r\n start: attrStart,\r\n end: attrStart + all.length,\r\n });\r\n }\r\n\r\n return attrs;\r\n}\r\n","export const snippedTagContentAttribute = '✂prettier:content✂';\r\n\r\nexport function snipScriptAndStyleTagContent(source: string): string {\r\n let scriptMatchSpans = getMatchIndexes('script');\r\n let styleMatchSpans = getMatchIndexes('style');\r\n\r\n return snipTagContent(\r\n snipTagContent(source, 'script', '{}', styleMatchSpans),\r\n 'style',\r\n '',\r\n scriptMatchSpans,\r\n );\r\n\r\n function getMatchIndexes(tagName: string) {\r\n const regex = getRegexp(tagName);\r\n const indexes: [number, number][] = [];\r\n let match = null;\r\n while ((match = regex.exec(source)) != null) {\r\n if (source.slice(match.index, match.index + 4) !== '<!--') {\r\n indexes.push([match.index, regex.lastIndex]);\r\n }\r\n }\r\n return indexes;\r\n }\r\n\r\n function snipTagContent(\r\n _source: string,\r\n tagName: string,\r\n placeholder: string,\r\n otherSpans: [number, number][],\r\n ) {\r\n const regex = getRegexp(tagName);\r\n let newScriptMatchSpans = scriptMatchSpans;\r\n let newStyleMatchSpans = styleMatchSpans;\r\n // Replace valid matches\r\n const newSource = _source.replace(regex, (match, attributes, content, index) => {\r\n if (match.startsWith('<!--') || withinOtherSpan(index)) {\r\n return match;\r\n }\r\n const encodedContent = Buffer.from(content).toString('base64');\r\n const newContent = `<${tagName}${attributes} ${snippedTagContentAttribute}=\"${encodedContent}\">${placeholder}</${tagName}>`;\r\n\r\n // Adjust the spans because the source now has a different content length\r\n const lengthDiff = match.length - newContent.length;\r\n newScriptMatchSpans = adjustSpans(scriptMatchSpans, newScriptMatchSpans);\r\n newStyleMatchSpans = adjustSpans(styleMatchSpans, newStyleMatchSpans);\r\n function adjustSpans(\r\n oldSpans: [number, number][],\r\n newSpans: [number, number][],\r\n ): [number, number][] {\r\n return oldSpans.map((oldSpan, idx) => {\r\n const newSpan = newSpans[idx];\r\n // Do the check using the old spans because the replace function works\r\n // on the old spans. Replace oldSpans with newSpans afterwards.\r\n if (oldSpan[0] > index) {\r\n // span is after the match -> adjust start and end\r\n return [newSpan[0] - lengthDiff, newSpan[1] - lengthDiff];\r\n } else if (oldSpan[0] === index) {\r\n // span is the match -> adjust end only\r\n return [newSpan[0], newSpan[1] - lengthDiff];\r\n } else {\r\n // span is before the match -> nothing to adjust\r\n return newSpan;\r\n }\r\n });\r\n }\r\n\r\n return newContent;\r\n });\r\n\r\n // Now that the replacement function ran, we can adjust the spans for the next run\r\n scriptMatchSpans = newScriptMatchSpans;\r\n styleMatchSpans = newStyleMatchSpans;\r\n\r\n return newSource;\r\n\r\n function withinOtherSpan(idx: number) {\r\n return otherSpans.some((otherSpan) => idx > otherSpan[0] && idx < otherSpan[1]);\r\n }\r\n }\r\n\r\n function getRegexp(tagName: string) {\r\n return new RegExp(`<!--[^]*?-->|<${tagName}([^]*?)>([^]*?)<\\/${tagName}>`, 'g');\r\n }\r\n}\r\n\r\nexport function hasSnippedContent(text: string) {\r\n return text.includes(snippedTagContentAttribute);\r\n}\r\n\r\nexport function unsnipContent(text: string): string {\r\n const regex = /(<\\w+.*?)\\s*✂prettier:content✂=\"(.*?)\">.*?(?=<\\/)/gi;\r\n\r\n return text.replace(regex, (_, start, encodedContent) => {\r\n const content = Buffer.from(encodedContent, 'base64').toString('utf8');\r\n return `${start}>${content}`;\r\n });\r\n}\r\n","import { ParserOptions } from 'prettier';\r\nimport { Node } from '../print/nodes';\r\nimport { hasSnippedContent, unsnipContent } from './snipTagContent';\r\n\r\nexport function getText(node: Node, options: ParserOptions, unsnip = false) {\r\n const leadingComments: Node[] = (node as any).leadingComments;\r\n const text = options.originalText.slice(\r\n options.locStart(\r\n // if there are comments before the node they are not included\r\n // in the `start` of the node itself\r\n (leadingComments && leadingComments[0]) || node,\r\n ),\r\n options.locEnd(node),\r\n );\r\n\r\n if (!unsnip || !hasSnippedContent(text)) {\r\n return text;\r\n }\r\n\r\n return unsnipContent(text);\r\n}\r\n","import { ParserOptions, SupportOption } from 'prettier';\r\n\r\ndeclare module 'prettier' {\r\n interface RequiredOptions extends PluginOptions {}\r\n}\r\n\r\nexport interface PluginOptions {\r\n svelteSortOrder: SortOrder;\r\n svelteStrictMode: boolean;\r\n svelteBracketNewLine: boolean;\r\n svelteAllowShorthand: boolean;\r\n svelteIndentScriptAndStyle: boolean;\r\n}\r\n\r\nfunction makeChoice(choice: string) {\r\n return { value: choice, description: choice };\r\n}\r\n\r\nexport const options: Record<keyof PluginOptions, SupportOption> = {\r\n svelteSortOrder: {\r\n since: '0.6.0',\r\n category: 'Svelte',\r\n type: 'choice',\r\n default: 'options-scripts-markup-styles',\r\n description: 'Sort order for scripts, markup, and styles',\r\n choices: [\r\n makeChoice('options-scripts-markup-styles'),\r\n makeChoice('options-scripts-styles-markup'),\r\n makeChoice('options-markup-styles-scripts'),\r\n makeChoice('options-markup-scripts-styles'),\r\n makeChoice('options-styles-markup-scripts'),\r\n makeChoice('options-styles-scripts-markup'),\r\n makeChoice('scripts-options-markup-styles'),\r\n makeChoice('scripts-options-styles-markup'),\r\n makeChoice('markup-options-styles-scripts'),\r\n makeChoice('markup-options-scripts-styles'),\r\n makeChoice('styles-options-markup-scripts'),\r\n makeChoice('styles-options-scripts-markup'),\r\n makeChoice('scripts-markup-options-styles'),\r\n makeChoice('scripts-styles-options-markup'),\r\n makeChoice('markup-styles-options-scripts'),\r\n makeChoice('markup-scripts-options-styles'),\r\n makeChoice('styles-markup-options-scripts'),\r\n makeChoice('styles-scripts-options-markup'),\r\n makeChoice('scripts-markup-styles-options'),\r\n makeChoice('scripts-styles-markup-options'),\r\n makeChoice('markup-styles-scripts-options'),\r\n makeChoice('markup-scripts-styles-options'),\r\n makeChoice('styles-markup-scripts-options'),\r\n makeChoice('styles-scripts-markup-options'),\r\n makeChoice('none'),\r\n // Deprecated, keep in 2.x for backwards-compatibility. svelte:options will be moved to the top\r\n makeChoice('scripts-markup-styles'),\r\n makeChoice('scripts-styles-markup'),\r\n makeChoice('markup-styles-scripts'),\r\n makeChoice('markup-scripts-styles'),\r\n makeChoice('styles-markup-scripts'),\r\n makeChoice('styles-scripts-markup'),\r\n ],\r\n },\r\n svelteStrictMode: {\r\n since: '0.7.0',\r\n category: 'Svelte',\r\n type: 'boolean',\r\n default: false,\r\n description: 'More strict HTML syntax: self-closed tags, quotes in attributes',\r\n },\r\n svelteBracketNewLine: {\r\n since: '0.6.0',\r\n category: 'Svelte',\r\n type: 'boolean',\r\n description: 'Put the `>` of a multiline element on a new line',\r\n deprecated: '2.5.0',\r\n },\r\n svelteAllowShorthand: {\r\n since: '1.0.0',\r\n category: 'Svelte',\r\n type: 'boolean',\r\n default: true,\r\n description:\r\n 'Option to enable/disable component attribute shorthand if attribute name and expressions are same',\r\n },\r\n svelteIndentScriptAndStyle: {\r\n since: '1.2.0',\r\n category: 'Svelte',\r\n type: 'boolean',\r\n default: true,\r\n description:\r\n 'Whether or not to indent the code inside <script> and <style> tags in Svelte files',\r\n },\r\n};\r\n\r\nexport type SortOrder =\r\n | 'options-scripts-markup-styles'\r\n | 'options-scripts-styles-markup'\r\n | 'options-markup-styles-scripts'\r\n | 'options-markup-scripts-styles'\r\n | 'options-styles-markup-scripts'\r\n | 'options-styles-scripts-markup'\r\n | 'scripts-options-markup-styles'\r\n | 'scripts-options-styles-markup'\r\n | 'markup-options-styles-scripts'\r\n | 'markup-options-scripts-styles'\r\n | 'styles-options-markup-scripts'\r\n | 'styles-options-scripts-markup'\r\n | 'scripts-markup-options-styles'\r\n | 'scripts-styles-options-markup'\r\n | 'markup-styles-options-scripts'\r\n | 'markup-scripts-options-styles'\r\n | 'styles-markup-options-scripts'\r\n | 'styles-scripts-options-markup'\r\n | 'scripts-markup-styles-options'\r\n | 'scripts-styles-markup-options'\r\n | 'markup-styles-scripts-options'\r\n | 'markup-scripts-styles-options'\r\n | 'styles-markup-scripts-options'\r\n | 'styles-scripts-markup-options'\r\n | 'none'\r\n | DeprecatedSortOrder;\r\n\r\nexport type DeprecatedSortOrder =\r\n | 'scripts-markup-styles'\r\n | 'scripts-styles-markup'\r\n | 'markup-styles-scripts'\r\n | 'markup-scripts-styles'\r\n | 'styles-markup-scripts'\r\n | 'styles-scripts-markup';\r\n\r\nexport type SortOrderPart = 'scripts' | 'markup' | 'styles' | 'options';\r\n\r\nconst sortOrderSeparator = '-';\r\n\r\nexport function parseSortOrder(sortOrder: SortOrder): SortOrderPart[] {\r\n if (sortOrder === 'none') {\r\n return [];\r\n }\r\n\r\n const order = sortOrder.split(sortOrderSeparator) as SortOrderPart[];\r\n // For backwards compatibility: Add options to beginning if not present\r\n if (!order.includes('options')) {\r\n console.warn(\r\n 'svelteSortOrder is missing option `options`. This will be an error in prettier-plugin-svelte version 3.',\r\n );\r\n order.unshift('options');\r\n }\r\n return order;\r\n}\r\n\r\nexport function isBracketSameLine(options: ParserOptions): boolean {\r\n return options.svelteBracketNewLine != null\r\n ? !options.svelteBracketNewLine\r\n : options.bracketSameLine != null\r\n ? options.bracketSameLine\r\n : false;\r\n}\r\n","import {\r\n ASTNode,\r\n AttributeNode,\r\n BodyNode,\r\n DocumentNode,\r\n ElementNode,\r\n HeadNode,\r\n InlineComponentNode,\r\n Node,\r\n OptionsNode,\r\n ScriptNode,\r\n SlotNode,\r\n SlotTemplateNode,\r\n StyleNode,\r\n TitleNode,\r\n WindowNode,\r\n} from './nodes';\r\nimport { Doc, doc, FastPath, ParserOptions } from 'prettier';\r\nimport { formattableAttributes } from '../lib/elements';\r\nimport { PrintFn } from '.';\r\nimport { snippedTagContentAttribute } from '../lib/snipTagContent';\r\n\r\n/**\r\n * Determines whether or not given node\r\n * is the root of the Svelte AST.\r\n */\r\nexport function isASTNode(n: any): n is ASTNode {\r\n return n && n.__isRoot;\r\n}\r\n\r\nexport function isPreTagContent(path: FastPath): boolean {\r\n const stack = path.stack as Node[];\r\n\r\n return stack.some(\r\n (node) =>\r\n (node.type === 'Element' && node.name.toLowerCase() === 'pre') ||\r\n (node.type === 'Attribute' && !formattableAttributes.includes(node.name)),\r\n );\r\n}\r\n\r\nexport function flatten<T>(arrays: T[][]): T[] {\r\n return ([] as T[]).concat.apply([], arrays);\r\n}\r\n\r\nexport function findLastIndex<T>(isMatch: (item: T, idx: number) => boolean, items: T[]) {\r\n for (let i = items.length - 1; i >= 0; i--) {\r\n if (isMatch(items[i], i)) {\r\n return i;\r\n }\r\n }\r\n\r\n return -1;\r\n}\r\n\r\nexport function replaceEndOfLineWith(text: string, replacement: Doc) {\r\n const parts: Doc[] = [];\r\n for (const part of text.split('\\n')) {\r\n if (parts.length > 0) {\r\n parts.push(replacement);\r\n }\r\n if (part.endsWith('\\r')) {\r\n parts.push(part.slice(0, -1));\r\n } else {\r\n parts.push(part);\r\n }\r\n }\r\n return parts;\r\n}\r\n\r\nexport function groupConcat(contents: doc.builders.Doc[]): doc.builders.Doc {\r\n const { concat, group } = doc.builders;\r\n return group(concat(contents));\r\n}\r\n\r\nexport function getAttributeLine(\r\n node:\r\n | ElementNode\r\n | InlineComponentNode\r\n | SlotNode\r\n | WindowNode\r\n | HeadNode\r\n | TitleNode\r\n | StyleNode\r\n | ScriptNode\r\n | BodyNode\r\n | DocumentNode\r\n | OptionsNode\r\n | SlotTemplateNode,\r\n options: ParserOptions,\r\n) {\r\n const { hardline, line } = doc.builders;\r\n const hasThisBinding =\r\n (node.type === 'InlineComponent' && !!node.expression) ||\r\n (node.type === 'Element' && !!node.tag);\r\n\r\n const attributes = (node.attributes as Array<AttributeNode>).filter(\r\n (attribute) => attribute.name !== snippedTagContentAttribute,\r\n );\r\n return options.singleAttributePerLine &&\r\n (attributes.length > 1 || (attributes.length && hasThisBinding))\r\n ? hardline\r\n : line;\r\n}\r\n\r\nexport function printWithPrependedAttributeLine(\r\n node:\r\n | ElementNode\r\n | InlineComponentNode\r\n | SlotNode\r\n | WindowNode\r\n | HeadNode\r\n | TitleNode\r\n | StyleNode\r\n | ScriptNode\r\n | BodyNode\r\n | DocumentNode\r\n | OptionsNode\r\n | SlotTemplateNode,\r\n options: ParserOptions,\r\n print: PrintFn,\r\n): PrintFn {\r\n return (path) =>\r\n path.getNode().name !== snippedTagContentAttribute\r\n ? doc.builders.concat([getAttributeLine(node, options), path.call(print)])\r\n : '';\r\n}\r\n","import { Doc, doc } from 'prettier';\r\nimport { findLastIndex } from './helpers';\r\n\r\n/**\r\n * Check if doc is a hardline.\r\n * We can't just rely on a simple equality check because the doc could be created with another\r\n * runtime version of prettier than what we import, making a reference check fail.\r\n */\r\nexport function isHardline(docToCheck: Doc): boolean {\r\n return docToCheck === doc.builders.hardline || deepEqual(docToCheck, doc.builders.hardline);\r\n}\r\n\r\n/**\r\n * Simple deep equal function which suits our needs. Only works properly on POJOs without cyclic deps.\r\n */\r\nfunction deepEqual(x: any, y: any): boolean {\r\n if (x === y) {\r\n return true;\r\n } else if (typeof x == 'object' && x != null && typeof y == 'object' && y != null) {\r\n if (Object.keys(x).length != Object.keys(y).length) return false;\r\n\r\n for (var prop in x) {\r\n if (y.hasOwnProperty(prop)) {\r\n if (!deepEqual(x[prop], y[prop])) return false;\r\n } else {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}\r\n\r\nfunction isDocCommand(doc: Doc): doc is doc.builders.DocCommand {\r\n return typeof doc === 'object' && doc !== null;\r\n}\r\n\r\nexport function isLine(docToCheck: Doc): boolean {\r\n return (\r\n isHardline(docToCheck) ||\r\n (isDocCommand(docToCheck) && docToCheck.type === 'line') ||\r\n (isDocCommand(docToCheck) &&\r\n docToCheck.type === 'concat' &&\r\n docToCheck.parts.every(isLine)) ||\r\n // Since Prettier 2.3.0, concats are represented as flat arrays\r\n (Array.isArray(docToCheck) && docToCheck.every(isLine))\r\n );\r\n}\r\n\r\n/**\r\n * Check if the doc is empty, i.e. consists of nothing more than empty strings (possibly nested).\r\n */\r\nexport function isEmptyDoc(doc: Doc): boolean {\r\n if (typeof doc === 'string') {\r\n return doc.length === 0;\r\n }\r\n\r\n if (isDocCommand(doc) && doc.type === 'line') {\r\n return !doc.keepIfLonely;\r\n }\r\n\r\n // Since Prettier 2.3.0, concats are represented as flat arrays\r\n if (Array.isArray(doc)) {\r\n return doc.length === 0;\r\n }\r\n\r\n const { contents } = doc as { contents?: Doc };\r\n\r\n if (contents) {\r\n return isEmptyDoc(contents);\r\n }\r\n\r\n const { parts } = doc as { parts?: Doc[] };\r\n\r\n if (parts) {\r\n return isEmptyGroup(parts);\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport function isEmptyGroup(group: Doc[]): boolean {\r\n return !group.find((doc) => !isEmptyDoc(doc));\r\n}\r\n\r\n/**\r\n * Trims both leading and trailing nodes matching `isWhitespace` independent of nesting level\r\n * (though all trimmed adjacent nodes need to be a the same level). Modifies the `docs` array.\r\n */\r\nexport function trim(docs: Doc[], isWhitespace: (doc: Doc) => boolean): Doc[] {\r\n trimLeft(docs, isWhitespace);\r\n trimRight(docs, isWhitespace);\r\n\r\n return docs;\r\n}\r\n\r\n/**\r\n * Trims the leading nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\r\n * If there are empty docs before the first whitespace, they are removed, too.\r\n */\r\nexport function trimLeft(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\r\n let firstNonWhitespace = group.findIndex((doc) => !isEmptyDoc(doc) && !isWhitespace(doc));\r\n\r\n if (firstNonWhitespace < 0 && group.length) {\r\n firstNonWhitespace = group.length;\r\n }\r\n\r\n if (firstNonWhitespace > 0) {\r\n const removed = group.splice(0, firstNonWhitespace);\r\n if (removed.every(isEmptyDoc)) {\r\n return trimLeft(group, isWhitespace);\r\n }\r\n } else {\r\n const parts = getParts(group[0]);\r\n\r\n if (parts) {\r\n return trimLeft(parts, isWhitespace);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Trims the trailing nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\r\n * If there are empty docs after the last whitespace, they are removed, too.\r\n */\r\nexport function trimRight(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\r\n let lastNonWhitespace = group.length\r\n ? findLastIndex((doc) => !isEmptyDoc(doc) && !isWhitespace(doc), group)\r\n : 0;\r\n\r\n if (lastNonWhitespace < group.length - 1) {\r\n const removed = group.splice(lastNonWhitespace + 1);\r\n if (removed.every(isEmptyDoc)) {\r\n return trimRight(group, isWhitespace);\r\n }\r\n } else {\r\n const parts = getParts(group[group.length - 1]);\r\n\r\n if (parts) {\r\n return trimRight(parts, isWhitespace);\r\n }\r\n }\r\n}\r\n\r\nfunction getParts(doc: Doc): Doc[] | undefined {\r\n if (typeof doc === 'object') {\r\n // Since Prettier 2.3.0, concats are represented as flat arrays\r\n if (Array.isArray(doc)) {\r\n return doc;\r\n }\r\n if (doc.type === 'fill' || doc.type === 'concat') {\r\n return doc.parts;\r\n }\r\n if (doc.type === 'group') {\r\n return getParts(doc.contents);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * `(foo = bar)` => `foo = bar`\r\n */\r\nexport function removeParentheses(doc: Doc): Doc {\r\n return trim([doc], (_doc: Doc) => _doc === '(' || _doc === ')')[0];\r\n}\r\n","import {\r\n Node,\r\n ElementNode,\r\n TextNode,\r\n AttributeNode,\r\n MustacheTagNode,\r\n AttributeShorthandNode,\r\n HeadNode,\r\n InlineComponentNode,\r\n SlotNode,\r\n TitleNode,\r\n WindowNode,\r\n IfBlockNode,\r\n AwaitBlockNode,\r\n CatchBlockNode,\r\n EachBlockNode,\r\n ElseBlockNode,\r\n KeyBlockNode,\r\n PendingBlockNode,\r\n ThenBlockNode,\r\n CommentNode,\r\n SlotTemplateNode,\r\n StyleDirectiveNode,\r\n} from './nodes';\r\nimport { blockElements, TagName } from '../lib/elements';\r\nimport { FastPath, ParserOptions } from 'prettier';\r\nimport { findLastIndex, isASTNode, isPreTagContent } from './helpers';\r\nimport { isBracketSameLine } from '../options';\r\n\r\nconst unsupportedLanguages = ['coffee', 'coffeescript', 'styl', 'stylus', 'sass'];\r\n\r\nexport function isInlineElement(path: FastPath, options: ParserOptions, node: Node) {\r\n return (\r\n node && node.type === 'Element' && !isBlockElement(node, options) && !isPreTagContent(path)\r\n );\r\n}\r\n\r\nexport function isBlockElement(node: Node, options: ParserOptions): node is ElementNode {\r\n return (\r\n node &&\r\n node.type === 'Element' &&\r\n options.htmlWhitespaceSensitivity !== 'strict' &&\r\n (options.htmlWhitespaceSensitivity === 'ignore' ||\r\n blockElements.includes(node.name as TagName))\r\n );\r\n}\r\n\r\nexport function isSvelteBlock(\r\n node: Node,\r\n): node is\r\n | IfBlockNode\r\n | AwaitBlockNode\r\n | CatchBlockNode\r\n | EachBlockNode\r\n | ElseBlockNode\r\n | KeyBlockNode\r\n | PendingBlockNode\r\n | ThenBlockNode {\r\n return [\r\n 'IfBlock',\r\n 'AwaitBlock',\r\n 'CatchBlock',\r\n 'EachBlock',\r\n 'ElseBlock',\r\n 'KeyBlock',\r\n 'PendingBlock',\r\n 'ThenBlock',\r\n ].includes(node.type);\r\n}\r\n\r\nexport function isNodeWithChildren(node: Node): node is Node & { children: Node[] } {\r\n return (node as any).children;\r\n}\r\n\r\nexport function getChildren(node: Node): Node[] {\r\n return isNodeWithChildren(node) ? node.children : [];\r\n}\r\n\r\n/**\r\n * Returns siblings, that is, the children of the parent.\r\n */\r\nexport function getSiblings(path: FastPath): Node[] {\r\n let parent: Node = path.getParentNode();\r\n\r\n if (isASTNode(parent)) {\r\n parent = parent.html;\r\n }\r\n\r\n return getChildren(parent);\r\n}\r\n\r\n/**\r\n * Returns the previous sibling node.\r\n */\r\nexport function getPreviousNode(path: FastPath): Node | undefined {\r\n const node: Node = path.getNode();\r\n return getSiblings(path).find((child) => child.end === node.start);\r\n}\r\n\r\n/**\r\n * Returns the next sibling node.\r\n */\r\nexport function getNextNode(path: FastPath, node: Node = path.getNode()): Node | undefined {\r\n return getSiblings(path).find((child) => child.start === node.end);\r\n}\r\n\r\n/**\r\n * Returns the comment that is above the current node.\r\n */\r\nexport function getLeadingComment(path: FastPath): CommentNode | undefined {\r\n const siblings = getSiblings(path);\r\n\r\n let node: Node = path.getNode();\r\n let prev: Node | undefined = siblings.find((child) => child.end === node.start);\r\n while (prev) {\r\n if (\r\n prev.type === 'Comment' &&\r\n !isIgnoreStartDirective(prev) &&\r\n !isIgnoreEndDirective(prev)\r\n ) {\r\n return prev;\r\n } else if (isEmptyTextNode(prev)) {\r\n node = prev;\r\n prev = siblings.find((child) => child.end === node.start);\r\n } else {\r\n return undefined;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Did there use to be any embedded object (that has been snipped out of the AST to be moved)\r\n * at the specified position?\r\n */\r\nexport function doesEmbedStartAfterNode(node: Node, path: FastPath, siblings = getSiblings(path)) {\r\n // If node is not at the top level of html, an embed cannot start after it,\r\n // because embeds are only at the top level\r\n if (!isNodeTopLevelHTML(node, path)) {\r\n return false;\r\n }\r\n\r\n const position = node.end;\r\n const root = path.stack[0];\r\n\r\n const embeds = [root.css, root.html, root.instance, root.js, root.module] as Node[];\r\n\r\n const nextNode = siblings[siblings.indexOf(node) + 1];\r\n return embeds.find((n) => n && n.start >= position && (!nextNode || n.end <= nextNode.start));\r\n}\r\n\r\nexport function isNodeTopLevelHTML(node: Node, path: FastPath): boolean {\r\n const root = path.stack[0];\r\n return !!root.html && !!root.html.children && root.html.children.includes(node);\r\n}\r\n\r\nexport function isEmptyTextNode(node: Node | undefined): node is TextNode {\r\n return !!node && node.type === 'Text' && getUnencodedText(node).trim() === '';\r\n}\r\n\r\nexport function isIgnoreDirective(node: Node | undefined | null): boolean {\r\n return !!node && node.type === 'Comment' && node.data.trim() === 'prettier-ignore';\r\n}\r\n\r\nexport function isIgnoreStartDirective(node: Node | undefined | null): boolean {\r\n return !!node && node.type === 'Comment' && node.data.trim() === 'prettier-ignore-start';\r\n}\r\n\r\nexport function isIgnoreEndDirective(node: Node | undefined | null): boolean {\r\n return !!node && node.type === 'Comment' && node.data.trim() === 'prettier-ignore-end';\r\n}\r\n\r\nexport function printRaw(\r\n node:\r\n | ElementNode\r\n | InlineComponentNode\r\n | SlotNode\r\n | WindowNode\r\n | HeadNode\r\n | TitleNode\r\n | SlotTemplateNode,\r\n originalText: string,\r\n stripLeadingAndTrailingNewline: boolean = false,\r\n): string {\r\n if (node.children.length === 0) {\r\n return '';\r\n }\r\n\r\n const firstChild = node.children[0];\r\n const lastChild = node.children[node.children.length - 1];\r\n\r\n let raw = originalText.substring(firstChild.start, lastChild.end);\r\n\r\n if (!stripLeadingAndTrailingNewline) {\r\n return raw;\r\n }\r\n\r\n if (startsWithLinebreak(raw)) {\r\n raw = raw.substring(raw.indexOf('\\n') + 1);\r\n }\r\n if (endsWithLinebreak(raw)) {\r\n raw = raw.substring(0, raw.lastIndexOf('\\n'));\r\n if (raw.charAt(raw.length - 1) === '\\r') {\r\n raw = raw.substring(0, raw.length - 1);\r\n }\r\n }\r\n\r\n return raw;\r\n}\r\n\r\nfunction isTextNode(node: Node): node is TextNode {\r\n return node.type === 'Text';\r\n}\r\n\r\nfunction getAttributeValue(attributeName: string, node: Node) {\r\n const attributes = (node as ElementNode)['attributes'] as AttributeNode[];\r\n\r\n const langAttribute = attributes.find(\r\n (attribute) => attribute.name === attributeName,\r\n ) as AttributeNode | null;\r\n\r\n return langAttribute && langAttribute.value;\r\n}\r\n\r\nexport function getAttributeTextValue(attributeName: string, node: Node): string | null {\r\n const value = getAttributeValue(attributeName, node);\r\n\r\n if (value != null && typeof value === 'object') {\r\n const textValue = value.find(isTextNode);\r\n\r\n if (textValue) {\r\n return textValue.data;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction getLangAttribute(node: Node): string | null {\r\n const value = getAttributeTextValue('lang', node) || getAttributeTextValue('type', node);\r\n\r\n if (value != null) {\r\n return value.replace(/^text\\//, '');\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Checks whether the node contains a `lang` or `type` attribute with a value corresponding to\r\n * a language we cannot format. This might for example be `<template lang=\"pug\">`.\r\n * If the node does not contain a `lang` attribute, the result is true.\r\n */\r\nexport function isNodeSupportedLanguage(node: Node) {\r\n const lang = getLangAttribute(node);\r\n\r\n return !(lang && unsupportedLanguages.includes(lang));\r\n}\r\n\r\n/**\r\n * Checks whether the node contains a `lang` or `type` attribute which indicates that\r\n * the script contents are written in TypeScript. Note that the absence of the tag\r\n * does not mean it's not TypeScript, because the user could have set the default\r\n * to TypeScript in his settings.\r\n */\r\nexport function isTypeScript(node: Node) {\r\n const lang = getLangAttribute(node) || '';\r\n return ['typescript', 'ts'].includes(lang);\r\n}\r\n\r\nexport function isPugTemplate(node: Node): boolean {\r\n return node.type === 'Element' && node.name === 'template' && getLangAttribute(node) === 'pug';\r\n}\r\n\r\nexport function isLoneMustacheTag(node: true | Node[]): node is [MustacheTagNode] {\r\n return node !== true && node.length === 1 && node[0].type === 'MustacheTag';\r\n}\r\n\r\nexport function isAttributeShorthand(node: true | Node[]): node is [AttributeShorthandNode] {\r\n return node !== true && node.length === 1 && node[0].type === 'AttributeShorthand';\r\n}\r\n\r\n/**\r\n * True if node is of type `{a}` or `a={a}`\r\n */\r\nexport function isOrCanBeConvertedToShorthand(node: AttributeNode | StyleDirectiveNode): boolean {\r\n if (isAttributeShorthand(node.value)) {\r\n return true;\r\n }\r\n\r\n if (isLoneMustacheTag(node.value)) {\r\n const expression = node.value[0].expression;\r\n return expression.type === 'Identifier' && expression.name === node.name;\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport function getUnencodedText(node: TextNode) {\r\n // `raw` will contain HTML entities in unencoded form\r\n return node.raw || node.data;\r\n}\r\n\r\nexport function isTextNodeStartingWithLinebreak(node: Node, nrLines = 1): node is TextNode {\r\n return node.type === 'Text' && startsWithLinebreak(getUnencodedText(node), nrLines);\r\n}\r\n\r\nexport function startsWithLinebreak(text: string, nrLines = 1): boolean {\r\n return new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\r\n}\r\n\r\nexport function isTextNodeEndingWithLinebreak(node: Node, nrLines = 1): node is TextNode {\r\n return node.type === 'Text' && endsWithLinebreak(getUnencodedText(node), nrLines);\r\n}\r\n\r\nexport function endsWithLinebreak(text: string, nrLines = 1): boolean {\r\n return new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\r\n}\r\n\r\nexport function isTextNodeStartingWithWhitespace(node: Node): node is TextNode {\r\n return node.type === 'Text' && /^\\s/.test(getUnencodedText(node));\r\n}\r\n\r\nexport function isTextNodeEndingWithWhitespace(node: Node): node is TextNode {\r\n return node.type === 'Text' && /\\s$/.test(getUnencodedText(node));\r\n}\r\n\r\nexport function trimTextNodeRight(node: TextNode): void {\r\n node.raw = node.raw && node.raw.trimRight();\r\n node.data = node.data && node.data.trimRight();\r\n}\r\n\r\nexport function trimTextNodeLeft(node: TextNode): void {\r\n node.raw = node.raw && node.raw.trimLeft();\r\n node.data = node.data && node.data.trimLeft();\r\n}\r\n\r\n/**\r\n * Remove all leading whitespace up until the first non-empty text node,\r\n * and all trailing whitespace from the last non-empty text node onwards.\r\n */\r\nexport function trimChildren(children: Node[], path: FastPath): void {\r\n let firstNonEmptyNode = children.findIndex(\r\n (n) => !isEmptyTextNode(n) && !doesEmbedStartAfterNode(n, path),\r\n );\r\n firstNonEmptyNode = firstNonEmptyNode === -1 ? children.length - 1 : firstNonEmptyNode;\r\n\r\n let lastNonEmptyNode = findLastIndex((n, idx) => {\r\n // Last node is ok to end at the start of an embedded region,\r\n // if it's not a comment (which should stick to the region)\r\n return (\r\n !isEmptyTextNode(n) &&\r\n ((idx === children.length - 1 && n.type !== 'Comment') ||\r\n !doesEmbedStartAfterNode(n, path))\r\n );\r\n }, children);\r\n lastNonEmptyNode = lastNonEmptyNode === -1 ? 0 : lastNonEmptyNode;\r\n\r\n for (let i = 0; i <= firstNonEmptyNode; i++) {\r\n const n = children[i];\r\n if (n.type === 'Text') {\r\n trimTextNodeLeft(n);\r\n }\r\n }\r\n\r\n for (let i = children.length - 1; i >= lastNonEmptyNode; i--) {\r\n const n = children[i];\r\n if (n.type === 'Text') {\r\n trimTextNodeRight(n);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Check if given node's start tag should hug its first child. This is the case for inline elements when there's\r\n * no whitespace between the `>` and the first child.\r\n */\r\nexport function shouldHugStart(\r\n node: Node,\r\n isSupportedLanguage: boolean,\r\n options: ParserOptions,\r\n): boolean {\r\n if (!isSupportedLanguage) {\r\n return true;\r\n }\r\n\r\n if (isBlockElement(node, options)) {\r\n return false;\r\n }\r\n\r\n if (!isNodeWithChildren(node)) {\r\n return false;\r\n }\r\n\r\n const children: Node[] = node.children;\r\n if (children.length === 0) {\r\n return true;\r\n }\r\n\r\n if (options.htmlWhitespaceSensitivity === 'ignore') {\r\n return false;\r\n }\r\n\r\n const firstChild = children[0];\r\n return !isTextNodeStartingWithWhitespace(firstChild);\r\n}\r\n\r\n/**\r\n * Check if given node's end tag should hug its last child. This is the case for inline elements when there's\r\n * no whitespace between the last child and the `</`.\r\n */\r\nexport function shouldHugEnd(\r\n node: Node,\r\n isSupportedLanguage: boolean,\r\n options: ParserOptions,\r\n): boolean {\r\n if (!isSupportedLanguage) {\r\n return true;\r\n }\r\n\r\n if (isBlockElement(node, options)) {\r\n return false;\r\n }\r\n\r\n if (!isNodeWithChildren(node)) {\r\n return false;\r\n }\r\n\r\n const children: Node[] = node.children;\r\n if (children.length === 0) {\r\n return true;\r\n }\r\n\r\n if (options.htmlWhitespaceSensitivity === 'ignore') {\r\n return false;\r\n }\r\n\r\n const lastChild = children[children.length - 1];\r\n return !isTextNodeEndingWithWhitespace(lastChild);\r\n}\r\n\r\n/**\r\n * Check for a svelte block if there's whitespace at the start and if it's a space or a line.\r\n */\r\nexport function checkWhitespaceAtStartOfSvelteBlock(\r\n node: Node,\r\n options: ParserOptions,\r\n): 'none' | 'space' | 'line' {\r\n if (!isSvelteBlock(node) || !isNodeWithChildren(node)) {\r\n return 'none';\r\n }\r\n\r\n const children: Node[] = node.children;\r\n if (children.length === 0) {\r\n return 'none';\r\n }\r\n\r\n const firstChild = children[0];\r\n\r\n if (isTextNodeStartingWithLinebreak(firstChild)) {\r\n return 'line';\r\n } else if (isTextNodeStartingWithWhitespace(firstChild)) {\r\n return 'space';\r\n }\r\n\r\n // This extra check is necessary because the Svelte AST might swallow whitespace between\r\n // the block's starting end and its first child.\r\n const parentOpeningEnd = options.originalText.lastIndexOf('}', firstChild.start);\r\n if (parentOpeningEnd > 0 && firstChild.start > parentOpeningEnd + 1) {\r\n const textBetween = options.originalText.substring(parentOpeningEnd + 1, firstChild.start);\r\n if (textBetween.trim() === '') {\r\n return startsWithLinebreak(textBetween) ? 'line' : 'space';\r\n }\r\n }\r\n\r\n return 'none';\r\n}\r\n\r\n/**\r\n * Check for a svelte block if there's whitespace at the end and if it's a space or a line.\r\n */\r\nexport function checkWhitespaceAtEndOfSvelteBlock(\r\n node: Node,\r\n options: ParserOptions,\r\n): 'none' | 'space' | 'line' {\r\n if (!isSvelteBlock(node) || !isNodeWithChildren(node)) {\r\n return 'none';\r\n }\r\n\r\n const children: Node[] = node.children;\r\n if (children.length === 0) {\r\n return 'none';\r\n }\r\n\r\n const lastChild = children[children.length - 1];\r\n if (isTextNodeEndingWithLinebreak(lastChild)) {\r\n return 'line';\r\n } else if (isTextNodeEndingWithWhitespace(lastChild)) {\r\n return 'space';\r\n }\r\n\r\n // This extra check is necessary because the Svelte AST might swallow whitespace between\r\n // the last child and the block's ending start.\r\n const parentClosingStart = options.originalText.indexOf('{', lastChild.end);\r\n if (parentClosingStart > 0 && lastChild.end < parentClosingStart) {\r\n const textBetween = options.originalText.substring(lastChild.end, parentClosingStart);\r\n if (textBetween.trim() === '') {\r\n return endsWithLinebreak(textBetween) ? 'line' : 'space';\r\n }\r\n }\r\n\r\n return 'none';\r\n}\r\n\r\nexport function isInsideQuotedAttribute(path: FastPath, options: ParserOptions): boolean {\r\n const stack = path.stack as Node[];\r\n\r\n return stack.some(\r\n (node) =>\r\n node.type === 'Attribute' &&\r\n (!isLoneMustacheTag(node.value) || options.svelteStrictMode),\r\n );\r\n}\r\n\r\n/**\r\n * Returns true if the softline between `</tagName` and `>` can be omitted.\r\n */\r\nexport function canOmitSoftlineBeforeClosingTag(\r\n node: Node,\r\n path: FastPath,\r\n options: ParserOptions,\r\n): boolean {\r\n return (\r\n isBracketSameLine(options) &&\r\n (!hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options))\r\n );\r\n}\r\n\r\n/**\r\n * Return true if given node does not hug the next node, meaning there's whitespace\r\n * or the end of the doc afterwards.\r\n */\r\nfunction hugsStartOfNextNode(node: Node, options: ParserOptions): boolean {\r\n if (node.end === options.originalText.length) {\r\n // end of document\r\n return false;\r\n }\r\n\r\n return !options.originalText.substring(node.end).match(/^\\s/);\r\n}\r\n\r\nfunction isLastChildWithinParentBlockElement(path: FastPath, options: ParserOptions): boolean {\r\n const parent = path.getParentNode() as Node | undefined;\r\n if (!parent || !isBlockElement(parent, options)) {\r\n return false;\r\n }\r\n\r\n const children = getChildren(parent);\r\n const lastChild = children[children.length - 1];\r\n return lastChild === path.getNode();\r\n}\r\n","import { Doc, doc, FastPath, ParserOptions } from 'prettier';\r\nimport { formattableAttributes, selfClosingTags } from '../lib/elements';\r\nimport { extractAttributes } from '../lib/extractAttributes';\r\nimport { getText } from '../lib/getText';\r\nimport { hasSnippedContent, unsnipContent } from '../lib/snipTagContent';\r\nimport { isBracketSameLine, parseSortOrder, SortOrderPart } from '../options';\r\nimport { isEmptyDoc, isLine, trim, trimRight } from './doc-helpers';\r\nimport {\r\n flatten,\r\n getAttributeLine,\r\n groupConcat,\r\n isASTNode,\r\n isPreTagContent,\r\n printWithPrependedAttributeLine,\r\n replaceEndOfLineWith,\r\n} from './helpers';\r\nimport {\r\n checkWhitespaceAtEndOfSvelteBlock,\r\n checkWhitespaceAtStartOfSvelteBlock,\r\n doesEmbedStartAfterNode,\r\n endsWithLinebreak,\r\n getUnencodedText,\r\n isBlockElement,\r\n isEmptyTextNode,\r\n isIgnoreDirective,\r\n isInlineElement,\r\n isInsideQuotedAttribute,\r\n isLoneMustacheTag,\r\n isNodeSupportedLanguage,\r\n isOrCanBeConvertedToShorthand,\r\n isTextNodeEndingWithLinebreak,\r\n isTextNodeEndingWithWhitespace,\r\n isTextNodeStartingWithLinebreak,\r\n isTextNodeStartingWithWhitespace,\r\n printRaw,\r\n shouldHugEnd,\r\n shouldHugStart,\r\n startsWithLinebreak,\r\n trimChildren,\r\n trimTextNodeLeft,\r\n trimTextNodeRight,\r\n canOmitSoftlineBeforeClosingTag,\r\n getNextNode,\r\n isIgnoreStartDirective,\r\n isIgnoreEndDirective,\r\n isNodeTopLevelHTML,\r\n getChildren,\r\n} from './node-helpers';\r\nimport {\r\n ASTNode,\r\n AttributeNode,\r\n CommentInfo,\r\n CommentNode,\r\n IfBlockNode,\r\n Node,\r\n OptionsNode,\r\n StyleDirectiveNode,\r\n TextNode,\r\n} from './nodes';\r\n\r\nconst {\r\n concat,\r\n join,\r\n line,\r\n group,\r\n indent,\r\n dedent,\r\n softline,\r\n hardline,\r\n fill,\r\n breakParent,\r\n literalline,\r\n} = doc.builders;\r\n\r\nexport type PrintFn = (path: FastPath) => Doc;\r\n\r\ndeclare module 'prettier' {\r\n export namespace doc {\r\n namespace builders {\r\n interface Line {\r\n keepIfLonely?: boolean;\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function hasPragma(text: string) {\r\n return /^\\s*<!--\\s*@(format|prettier)\\W/.test(text);\r\n}\r\n\r\nlet ignoreNext = false;\r\nlet ignoreRange = false;\r\nlet svelteOptionsDoc: Doc | undefined;\r\n\r\nexport function print(path: FastPath, options: ParserOptions, print: PrintFn): Doc {\r\n const bracketSameLine = isBracketSameLine(options);\r\n\r\n const n = path.getValue();\r\n if (!n) {\r\n return '';\r\n }\r\n\r\n if (isASTNode(n)) {\r\n assignCommentsToNodes(n);\r\n return printTopLevelParts(n, options, path, print);\r\n }\r\n\r\n const [open, close] = options.svelteStrictMode ? ['\"{', '}\"'] : ['{', '}'];\r\n const printJsExpression = () => [\r\n open,\r\n printJS(path, print, options.svelteStrictMode, false, false, 'expression'),\r\n close,\r\n ];\r\n const node = n as Node;\r\n\r\n if (\r\n (ignoreNext || (ignoreRange && !isIgnoreEndDirective(node))) &&\r\n (node.type !== 'Text' || !isEmptyTextNode(node))\r\n ) {\r\n if (ignoreNext) {\r\n ignoreNext = false;\r\n }\r\n return concat(\r\n flatten(\r\n options.originalText\r\n .slice(options.locStart(node), options.locEnd(node))\r\n .split('\\n')\r\n .map((o, i) => (i == 0 ? [o] : [literalline, o])),\r\n ),\r\n );\r\n }\r\n\r\n switch (node.type) {\r\n case 'Fragment':\r\n const children = node.children;\r\n\r\n if (children.length === 0 || children.every(isEmptyTextNode)) {\r\n return '';\r\n }\r\n if (!isPreTagContent(path)) {\r\n trimChildren(node.children, path);\r\n const output = trim(\r\n [printChildren(path, print, options)],\r\n (n) =>\r\n isLine(n) ||\r\n (typeof n === 'string' && n.trim() === '') ||\r\n // Because printChildren may append this at the end and\r\n // may hide other lines before it\r\n n === breakParent,\r\n );\r\n if (output.every((doc) => isEmptyDoc(doc))) {\r\n return '';\r\n }\r\n return groupConcat([...output, hardline]);\r\n } else {\r\n return groupConcat(path.map(print, 'children'));\r\n }\r\n case 'Text':\r\n if (!isPreTagContent(path)) {\r\n if (isEmptyTextNode(node)) {\r\n const hasWhiteSpace =\r\n getUnencodedText(node).trim().length < getUnencodedText(node).length;\r\n const hasOneOrMoreNewlines = /\\n/.test(getUnencodedText(node));\r\n const hasTwoOrMoreNewlines = /\\n\\r?\\s*\\n\\r?/.test(getUnencodedText(node));\r\n if (hasTwoOrMoreNewlines) {\r\n return concat([hardline, hardline]);\r\n }\r\n if (hasOneOrMoreNewlines) {\r\n return hardline;\r\n }\r\n if (hasWhiteSpace) {\r\n return line;\r\n }\r\n return '';\r\n }\r\n\r\n /**\r\n * For non-empty text nodes each sequence of non-whitespace characters (effectively,\r\n * each \"word\") is joined by a single `line`, which will be rendered as a single space\r\n * until this node's current line is out of room, at which `fill` will break at the\r\n * most convenient instance of `line`.\r\n */\r\n return fill(splitTextToDocs(node));\r\n } else {\r\n let rawText = getUnencodedText(node);\r\n const parent = path.getParentNode();\r\n if (parent.type === 'Attribute') {\r\n // Direct child of attribute value -> add literallines at end of lines\r\n // so that other things don't break in unexpected places\r\n if (parent.name === 'class' && path.getParentNode(1).type === 'Element') {\r\n // Special treatment for class attribute on html elements. Prettier\r\n // will force everything into one line, we deviate from that and preserve lines.\r\n rawText = rawText.replace(\r\n /([^ \\t\\n])(([ \\t]+$)|([ \\t]+(\\r?\\n))|[ \\t]+)/g,\r\n // Remove trailing whitespace in lines with non-whitespace characters\r\n // except at the end of the string\r\n (\r\n match,\r\n characterBeforeWhitespace,\r\n _,\r\n isEndOfString,\r\n isEndOfLine,\r\n endOfLine,\r\n ) =>\r\n isEndOfString\r\n ? match\r\n : characterBeforeWhitespace + (isEndOfLine ? endOfLine : ' '),\r\n );\r\n // Shrink trailing whitespace in case it's followed by a mustache tag\r\n // and remove it completely if it's at the end of the string, but not\r\n // if it's on its own line\r\n rawText = rawText.replace(\r\n /([^ \\t\\n])[ \\t]+$/,\r\n parent.value.indexOf(node) === parent.value.length - 1 ? '$1' : '$1 ',\r\n );\r\n }\r\n return concat(replaceEndOfLineWith(rawText, literalline));\r\n }\r\n return rawText;\r\n }\r\n case 'Element':\r\n case 'InlineComponent':\r\n case 'Slot':\r\n case 'SlotTemplate':\r\n case 'Window':\r\n case 'Head':\r\n case 'Title': {\r\n const isSupportedLanguage = !(\r\n node.name === 'template' && !isNodeSupportedLanguage(node)\r\n );\r\n const isEmpty = node.children.every((child) => isEmptyTextNode(child));\r\n const isDoctypeTag = node.name.toUpperCase() === '!DOCTYPE';\r\n\r\n const isSelfClosingTag =\r\n isEmpty &&\r\n (!options.svelteStrictMode ||\r\n node.type !== 'Element' ||\r\n selfClosingTags.indexOf(node.name) !== -1 ||\r\n isDoctypeTag);\r\n\r\n // Order important: print attributes first\r\n const attributes = path.map(\r\n printWithPrependedAttributeLine(node, options, print),\r\n 'attributes',\r\n );\r\n const attributeLine = getAttributeLine(node, options);\r\n const possibleThisBinding =\r\n node.type === 'InlineComponent' && node.expression\r\n ? concat([attributeLine, 'this=', ...printJsExpression()])\r\n : node.type === 'Element' && node.tag\r\n ? concat([\r\n attributeLine,\r\n 'this=',\r\n ...(typeof node.tag === 'string'\r\n ? [`\"${node.tag}\"`]\r\n : [\r\n open,\r\n printJS(\r\n path,\r\n print,\r\n options.svelteStrictMode,\r\n false,\r\n false,\r\n 'tag',\r\n ),\r\n close,\r\n ]),\r\n ])\r\n : '';\r\n\r\n if (isSelfClosingTag) {\r\n return groupConcat([\r\n '<',\r\n node.name,\r\n\r\n indent(\r\n groupConcat([\r\n possibleThisBinding,\r\n ...attributes,\r\n bracketSameLine || isDoctypeTag ? '' : dedent(line),\r\n ]),\r\n ),\r\n\r\n ...[bracketSameLine && !isDoctypeTag ? ' ' : '', `${isDoctypeTag ? '' : '/'}>`],\r\n ]);\r\n }\r\n\r\n const children = node.children;\r\n const firstChild = children[0];\r\n const lastChild = children[children.length - 1];\r\n\r\n // Is a function which is invoked later because printChildren will manipulate child nodes\r\n // which would wrongfully change the other checks about hugging etc done beforehand\r\n let body: () => Doc;\r\n\r\n const hugStart = shouldHugStart(node, isSupportedLanguage, options);\r\n const hugEnd = shouldHugEnd(node, isSupportedLanguage, options);\r\n\r\n if (isEmpty) {\r\n body =\r\n isInlineElement(path, options, node) &&\r\n node.children.length &&\r\n isTextNodeStartingWithWhitespace(node.children[0]) &&\r\n !isPreTagContent(path)\r\n ? () => line\r\n : () => (bracketSameLine ? softline : '');\r\n } else if (isPreTagContent(path)) {\r\n body = () => printPre(node, options.originalText, path, print);\r\n } else if (!isSupportedLanguage) {\r\n body = () => printRaw(node, options.originalText, true);\r\n } else if (isInlineElement(path, options, node) && !isPreTagContent(path)) {\r\n body = () => printChildren(path, print, options);\r\n } else {\r\n body = () => printChildren(path, print, options);\r\n }\r\n\r\n const openingTag = [\r\n '<',\r\n node.name,\r\n\r\n indent(\r\n groupConcat([\r\n possibleThisBinding,\r\n ...attributes,\r\n hugStart\r\n ? ''\r\n : !bracketSameLine && !isPreTagContent(path)\r\n ? dedent(softline)\r\n : '',\r\n ]),\r\n ),\r\n ];\r\n\r\n if (!isSupportedLanguage && !isEmpty) {\r\n // Format template tags so that there's a hardline but no indention.\r\n // That way the `lang=\"X\"` and the closing `>` of the start tag stay in one line\r\n // which is the 99% use case.\r\n return groupConcat([\r\n ...openingTag,\r\n '>',\r\n groupConcat([hardline, body(), hardline]),\r\n `</${node.name}>`,\r\n ]);\r\n }\r\n\r\n if (hugStart && hugEnd) {\r\n const huggedContent = concat([\r\n softline,\r\n groupConcat(['>', body(), `</${node.name}`]),\r\n ]);\r\n const omitSoftlineBeforeClosingTag =\r\n (isEmpty && !bracketSameLine) ||\r\n canOmitSoftlineBeforeClosingTag(node, path, options);\r\n return groupConcat([\r\n ...openingTag,\r\n isEmpty ? group(huggedContent) : group(indent(huggedContent)),\r\n omitSoftlineBeforeClosingTag ? '' : softline,\r\n '>',\r\n ]);\r\n }\r\n\r\n // No hugging of content means it's either a block element and/or there's whitespace at the start/end\r\n let noHugSeparatorStart: Doc = softline;\r\n let noHugSeparatorEnd: Doc = softline;\r\n if (isPreTagContent(path)) {\r\n noHugSeparatorStart = '';\r\n noHugSeparatorEnd = '';\r\n } else {\r\n let didSetEndSeparator = false;\r\n\r\n if (!hugStart && firstChild && firstChild.type === 'Text') {\r\n if (\r\n isTextNodeStartingWithLinebreak(firstChild) &&\r\n firstChild !== lastChild &&\r\n (!isInlineElement(path, options, node) ||\r\n isTextNodeEndingWithWhitespace(lastChild))\r\n ) {\r\n noHugSeparatorStart = hardline;\r\n noHugSeparatorEnd = hardline;\r\n didSetEndSeparator = true;\r\n } else if (isInlineElement(path, options, node)) {\r\n noHugSeparatorStart = line;\r\n }\r\n trimTextNodeLeft(firstChild);\r\n }\r\n if (!hugEnd && lastChild && lastChild.type === 'Text') {\r\n if (isInlineElement(path, options, node) && !didSetEndSeparator) {\r\n noHugSeparatorEnd = line;\r\n }\r\n trimTextNodeRight(lastChild);\r\n }\r\n }\r\n\r\n if (hugStart) {\r\n return groupConcat([\r\n ...openingTag,\r\n indent(concat([softline, groupConcat(['>', body()])])),\r\n noHugSeparatorEnd,\r\n `</${node.name}>`,\r\n ]);\r\n }\r\n\r\n if (hugEnd) {\r\n return groupConcat([\r\n ...openingTag,\r\n '>',\r\n indent(concat([noHugSeparatorStart, groupConcat([body(), `</${node.name}`])])),\r\n canOmitSoftlineBeforeClosingTag(node, path, options) ? '' : softline,\r\n '>',\r\n ]);\r\n }\r\n\r\n if (isEmpty) {\r\n return groupConcat([...openingTag, '>', body(), `</${node.name}>`]);\r\n }\r\n\r\n return groupConcat([\r\n ...openingTag,\r\n '>',\r\n indent(concat([noHugSeparatorStart, body()])),\r\n noHugSeparatorEnd,\r\n `</${node.name}>`,\r\n ]);\r\n }\r\n case 'Options':\r\n if (options.svelteSortOrder !== 'none') {\r\n throw new Error('Options tags should have been handled by prepareChildren');\r\n }\r\n // else fall through to Body\r\n case 'Body':\r\n return groupConcat([\r\n '<',\r\n node.name,\r\n indent(\r\n groupConcat([\r\n ...path.map(\r\n printWithPrependedAttributeLine(node, options, print),\r\n 'attributes',\r\n ),\r\n bracketSameLine ? '' : dedent(line),\r\n ]),\r\n ),\r\n ...[bracketSameLine ? ' ' : '', '/>'],\r\n ]);\r\n case 'Document':\r\n return groupConcat([\r\n '<',\r\n node.name,\r\n indent(\r\n groupConcat([\r\n ...path.map(\r\n printWithPrependedAttributeLine(node, options, print),\r\n 'attributes',\r\n ),\r\n bracketSameLine ? '' : dedent(line),\r\n ]),\r\n ),\r\n ...[bracketSameLine ? ' ' : '', '/>'],\r\n ]);\r\n case 'Identifier':\r\n return node.name;\r\n case 'AttributeShorthand': {\r\n return (node.expression as any).name;\r\n }\r\n case 'Attribute': {\r\n if (isOrCanBeConvertedToShorthand(node)) {\r\n if (options.svelteStrictMode) {\r\n return concat([node.name, '=\"{', node.name, '}\"']);\r\n } else if (options.svelteAllowShorthand) {\r\n return concat(['{', node.name, '}']);\r\n } else {\r\n return concat([node.name, '={', node.name, '}']);\r\n }\r\n } else {\r\n if (node.value === true) {\r\n return concat([node.name]);\r\n }\r\n\r\n const quotes = !isLoneMustacheTag(node.value) || options.svelteStrictMode;\r\n const attrNodeValue = printAttributeNodeValue(path, print, quotes, node);\r\n if (quotes) {\r\n return concat([node.name, '=', '\"', attrNodeValue, '\"']);\r\n } else {\r\n return concat([node.name, '=', attrNodeValue]);\r\n }\r\n }\r\n }\r\n case 'MustacheTag':\r\n return concat([\r\n '{',\r\n printJS(\r\n path,\r\n print,\r\n isInsideQuotedAttribute(path, options),\r\n false,\r\n false,\r\n 'expression',\r\n ),\r\n '}',\r\n ]);\r\n case 'IfBlock': {\r\n const def: Doc[] = [\r\n '{#if ',\r\n printSvelteBlockJS(path, print, 'expression'),\r\n '}',\r\n printSvelteBlockChildren(path, print, options),\r\n ];\r\n\r\n if (node.else) {\r\n def.push(path.call(print, 'else'));\r\n }\r\n\r\n def.push('{/if}');\r\n\r\n return concat([groupConcat(def), breakParent]);\r\n }\r\n case 'ElseBlock': {\r\n // Else if\r\n const parent = path.getParentNode() as Node;\r\n\r\n if (\r\n node.children.length === 1 &&\r\n node.children[0].type === 'IfBlock' &&\r\n parent.type !== 'EachBlock'\r\n ) {\r\n const ifNode = node.children[0] as IfBlockNode;\r\n const def: Doc[] = [\r\n '{:else if ',\r\n path.map(\r\n (ifPath) => printSvelteBlockJS(ifPath, print, 'expression'),\r\n 'children',\r\n )[0],\r\n '}',\r\n path.map(\r\n (ifPath) => printSvelteBlockChildren(ifPath, print, options),\r\n 'children',\r\n )[0],\r\n ];\r\n\r\n if (ifNode.else) {\r\n def.push(path.map((ifPath) => ifPath.call(print, 'else'), 'children')[0]);\r\n }\r\n return concat(def);\r\n }\r\n\r\n return concat(['{:else}', printSvelteBlockChildren(path, print, options)]);\r\n }\r\n case 'EachBlock': {\r\n const def: Doc[] = [\r\n '{#each ',\r\n printSvelteBlockJS(path, print, 'expression'),\r\n ' as',\r\n expandNode(node.context),\r\n ];\r\n\r\n if (node.index) {\r\n def.push(', ', node.index);\r\n }\r\n\r\n if (node.key) {\r\n def.push(' (', printSvelteBlockJS(path, print, 'key'), ')');\r\n }\r\n\r\n def.push('}', printSvelteBlockChildren(path, print, options));\r\n\r\n if (node.else) {\r\n def.push(path.call(print, 'else'));\r\n }\r\n\r\n def.push('{/each}');\r\n\r\n return concat([groupConcat(def), breakParent]);\r\n }\r\n case 'AwaitBlock': {\r\n const hasPendingBlock = node.pending.children.some((n) => !isEmptyTextNode(n));\r\n const hasThenBlock = node.then.children.some((n) => !isEmptyTextNode(n));\r\n const hasCatchBlock = node.catch.children.some((n) => !isEmptyTextNode(n));\r\n\r\n let block = [];\r\n\r\n if (!hasPendingBlock && hasThenBlock) {\r\n block.push(\r\n groupConcat([\r\n '{#await ',\r\n printSvelteBlockJS(path, print, 'expression'),\r\n ' then',\r\n expandNode(node.value),\r\n '}',\r\n ]),\r\n path.call(print, 'then'),\r\n );\r\n } else if (!hasPendingBlock && hasCatchBlock) {\r\n block.push(\r\n groupConcat([\r\n '{#await ',\r\n printSvelteBlockJS(path, print, 'expression'),\r\n ' catch',\r\n expandNode(node.error),\r\n '}',\r\n ]),\r\n path.call(print, 'catch'),\r\n );\r\n } else {\r\n block.push(\r\n groupConcat(['{#await ', printSvelteBlockJS(path, print, 'expression'), '}']),\r\n );\r\n\r\n if (hasPendingBlock) {\r\n block.push(path.call(print, 'pending'));\r\n }\r\n\r\n if (hasThenBlock) {\r\n block.push(\r\n groupConcat(['{:then', expandNode(node.value), '}']),\r\n path.call(print, 'then'),\r\n );\r\n }\r\n }\r\n\r\n if ((hasPendingBlock || hasThenBlock) && hasCatchBlock) {\r\n block.push(\r\n groupConcat(['{:catch', expandNode(node.error), '}']),\r\n path.call(print, 'catch'),\r\n );\r\n }\r\n\r\n block.push('{/await}');\r\n\r\n return groupConcat(block);\r\n }\r\n case 'KeyBlock': {\r\n const def: Doc[] = [\r\n '{#key ',\r\n printSvelteBlockJS(path, print, 'expression'),\r\n '}',\r\n printSvelteBlockChildren(path, print, options),\r\n ];\r\n\r\n def.push('{/key}');\r\n\r\n return concat([groupConcat(def), breakParent]);\r\n }\r\n case 'ThenBlock':\r\n case 'PendingBlock':\r\n case 'CatchBlock':\r\n return printSvelteBlockChildren(path, print, options);\r\n case 'EventHandler':\r\n return concat([\r\n 'on:',\r\n node.name,\r\n node.modifiers && node.modifiers.length\r\n ? concat(['|', join('|', node.modifiers)])\r\n : '',\r\n node.expression ? concat(['=', ...printJsExpression()]) : '',\r\n ]);\r\n case 'Binding':\r\n return concat([\r\n 'bind:',\r\n node.name,\r\n node.expression.type === 'Identifier' &&\r\n node.expression.name === node.name &&\r\n options.svelteAllowShorthand &&\r\n !options.svelteStrictMode\r\n ? ''\r\n : concat(['=', ...printJsExpression()]),\r\n ]);\r\n case 'Class':\r\n return concat([\r\n 'class:',\r\n node.name,\r\n node.expression.type === 'Identifier' &&\r\n node.expression.name === node.name &&\r\n options.svelteAllowShorthand &&\r\n !options.svelteStrictMode\r\n ? ''\r\n : concat(['=', ...printJsExpression()]),\r\n ]);\r\n case 'StyleDirective':\r\n const prefix = [\r\n 'style:',\r\n node.name,\r\n node.modifiers && node.modifiers.length\r\n ? concat(['|', join('|', node.modifiers)])\r\n : '',\r\n ];\r\n\r\n if (isOrCanBeConvertedToShorthand(node) || node.value === true) {\r\n if (options.svelteStrictMode) {\r\n return concat([...prefix, '=\"{', node.name, '}\"']);\r\n } else if (options.svelteAllowShorthand) {\r\n return concat([...prefix]);\r\n } else {\r\n return concat([...prefix, '={', node.name, '}']);\r\n }\r\n } else {\r\n const quotes = !isLoneMustacheTag(node.value) || options.svelteStrictMode;\r\n const attrNodeValue = printAttributeNodeValue(path, print, quotes, node);\r\n if (quotes) {\r\n return concat([...prefix, '=', '\"', attrNodeValue, '\"']);\r\n } else {\r\n return concat([...prefix, '=', attrNodeValue]);\r\n }\r\n }\r\n case 'Let':\r\n return concat([\r\n 'let:',\r\n node.name,\r\n // shorthand let directives have `null` expressions\r\n !node.expression ||\r\n (node.expression.type === 'Identifier' && node.expression.name === node.name)\r\n ? ''\r\n : concat(['=', ...printJsExpression()]),\r\n ]);\r\n case 'DebugTag':\r\n return concat([\r\n '{@debug',\r\n node.identifiers.length > 0\r\n ? concat([' ', join(', ', path.map(print, 'identifiers'))])\r\n : '',\r\n '}',\r\n ]);\r\n case 'Ref':\r\n return concat(['ref:', node.name]);\r\n case 'Comment': {\r\n const nodeAfterComment = getNextNode(path);\r\n\r\n if (isIgnoreStartDirective(node) && isNodeTopLevelHTML(node, path)) {\r\n ignoreRange = true;\r\n } else if (isIgnoreEndDirective(node) && isNodeTopLevelHTML(node, path)) {\r\n ignoreRange = false;\r\n } else if (\r\n // If there is no sibling node that starts right after us but the parent indicates\r\n // that there used to be, that means that node was actually an embedded `<style>`\r\n // or `<script>` node that was cut out.\r\n // If so, the comment does not refer to the next line we will see.\r\n // The `embed` function handles printing the comment in the right place.\r\n doesEmbedStartAfterNode(node, path) ||\r\n (isEmptyTextNode(nodeAfterComment) &&\r\n doesEmbedStartAfterNode(nodeAfterComment, path))\r\n ) {\r\n return '';\r\n } else if (isIgnoreDirective(node)) {\r\n ignoreNext = true;\r\n }\r\n\r\n return printComment(node);\r\n }\r\n case 'Transition':\r\n const kind = node.intro && node.outro ? 'transition' : node.intro ? 'in' : 'out';\r\n return concat([\r\n kind,\r\n ':',\r\n node.name,\r\n node.modifiers && node.modifiers.length\r\n ? concat(['|', join('|', node.modifiers)])\r\n : '',\r\n node.expression ? concat(['=', ...printJsExpression()]) : '',\r\n ]);\r\n case 'Action':\r\n return concat([\r\n 'use:',\r\n node.name,\r\n node.expression ? concat(['=', ...printJsExpression()]) : '',\r\n ]);\r\n case 'Animation':\r\n return concat([\r\n 'animate:',\r\n node.name,\r\n node.expression ? concat(['=', ...printJsExpression()]) : '',\r\n ]);\r\n case 'RawMustacheTag':\r\n return concat([\r\n '{@html ',\r\n printJS(path, print, false, false, false, 'expression'),\r\n '}',\r\n ]);\r\n case 'Spread':\r\n return concat(['{...', printJS(path, print, false, false, false, 'expression'), '}']);\r\n case 'ConstTag':\r\n return concat([\r\n '{@const ',\r\n printJS(path, print, false, false, true, 'expression'),\r\n '}',\r\n ]);\r\n }\r\n\r\n console.error(JSON.stringify(node, null, 4));\r\n throw new Error('unknown node type: ' + node.type);\r\n}\r\n\r\nfunction assignCommentsToNodes(ast: ASTNode) {\r\n if (ast.module) {\r\n ast.module.comments = removeAndGetLeadingComments(ast, ast.module);\r\n }\r\n if (ast.instance) {\r\n ast.instance.comments = removeAndGetLeadingComments(ast, ast.instance);\r\n }\r\n if (ast.css) {\r\n ast.css.comments = removeAndGetLeadingComments(ast, ast.css);\r\n }\r\n}\r\n\r\n/**\r\n * Returns the comments that are above the current node and deletes them from the html ast.\r\n */\r\nfunction removeAndGetLeadingComments(ast: ASTNode, current: Node): CommentInfo[] {\r\n const siblings = getChildren(ast.html);\r\n const comments: CommentNode[] = [];\r\n const newlines: TextNode[] = [];\r\n\r\n if (!siblings.length) {\r\n return [];\r\n }\r\n\r\n let node: Node = current;\r\n let prev: Node | undefined = siblings.find((child) => child.end === node.start);\r\n while (prev) {\r\n if (\r\n prev.type === 'Comment' &&\r\n !isIgnoreStartDirective(prev) &&\r\n !isIgnoreEndDirective(prev)\r\n ) {\r\n comments.push(prev);\r\n if (comments.length !== newlines.length) {\r\n newlines.push({ type: 'Text', data: '', raw: '', start: -1, end: -1 });\r\n }\r\n } else if (isEmptyTextNode(prev)) {\r\n newlines.push(prev);\r\n } else {\r\n break;\r\n }\r\n\r\n node = prev;\r\n prev = siblings.find((child) => child.end === node.start);\r\n }\r\n\r\n newlines.length = comments.length; // could be one more if first comment is preceeded by empty text node\r\n\r\n for (const comment of comments) {\r\n siblings.splice(siblings.indexOf(comment), 1);\r\n }\r\n\r\n for (const text of newlines) {\r\n siblings.splice(siblings.indexOf(text), 1);\r\n }\r\n\r\n return comments\r\n .map((comment, i) => ({\r\n comment,\r\n emptyLineAfter: getUnencodedText(newlines[i]).split('\\n').length > 2,\r\n }))\r\n .reverse();\r\n}\r\n\r\nfunction printTopLevelParts(\r\n n: ASTNode,\r\n options: ParserOptions,\r\n path: FastPath<any>,\r\n print: PrintFn,\r\n): Doc {\r\n if (options.svelteSortOrder === 'none') {\r\n const topLevelPartsByEnd: Record<number, any> = {};\r\n\r\n if (n.module) {\r\n n.module.type = 'Script';\r\n n.module.attributes = extractAttributes(getText(n.module, options));\r\n topLevelPartsByEnd[n.module.end] = n.module;\r\n }\r\n if (n.instance) {\r\n n.instance.type = 'Script';\r\n n.instance.attributes = extractAttributes(getText(n.instance, options));\r\n topLevelPartsByEnd[n.instance.end] = n.instance;\r\n }\r\n if (n.css) {\r\n n.css.type = 'Style';\r\n n.css.content.type = 'StyleProgram';\r\n topLevelPartsByEnd[n.css.end] = n.css;\r\n }\r\n\r\n const children = getChildren(n.html);\r\n for (let i = 0; i < children.length; i++) {\r\n const node = children[i];\r\n if (topLevelPartsByEnd[node.start]) {\r\n children.splice(i, 0, topLevelPartsByEnd[node.start]);\r\n delete topLevelPartsByEnd[node.start];\r\n }\r\n }\r\n\r\n const result = path.call(print, 'html');\r\n if (options.insertPragma && !hasPragma(options.originalText)) {\r\n return concat([`<!-- @format -->`, hardline, result]);\r\n } else {\r\n return result;\r\n }\r\n }\r\n\r\n const parts: Record<SortOrderPart, Doc[]> = {\r\n options: [],\r\n scripts: [],\r\n markup: [],\r\n styles: [],\r\n };\r\n\r\n // scripts\r\n if (n.module) {\r\n n.module.type = 'Script';\r\n n.module.attributes = extractAttributes(getText(n.module, options));\r\n parts.scripts.push(path.call(print, 'module'));\r\n }\r\n if (n.instance) {\r\n n.instance.type = 'Script';\r\n n.instance.attributes = extractAttributes(getText(n.instance, options));\r\n parts.scripts.push(path.call(print, 'instance'));\r\n }\r\n\r\n // styles\r\n if (n.css) {\r\n n.css.type = 'Style';\r\n n.css.content.type = 'StyleProgram';\r\n parts.styles.push(path.call(print, 'css'));\r\n }\r\n\r\n // markup\r\n const htmlDoc = path.call(print, 'html');\r\n if (htmlDoc) {\r\n parts.markup.push(htmlDoc);\r\n }\r\n if (svelteOptionsDoc) {\r\n parts.options.push(svelteOptionsDoc);\r\n }\r\n\r\n const docs = flatten(parseSortOrder(options.svelteSortOrder).map((p) => parts[p]));\r\n\r\n // Need to reset these because they are global and could affect the next formatting run\r\n ignoreNext = false;\r\n ignoreRange = false;\r\n svelteOptionsDoc = undefined;\r\n\r\n // If this is invoked as an embed of markdown, remove the last hardline.\r\n // The markdown parser tries this, too, but fails because it does not\r\n // recurse into concats. Doing this will prevent an empty line\r\n // at the end of the embedded code block.\r\n if (options.parentParser === 'markdown') {\r\n const lastDoc = docs[docs.length - 1];\r\n trimRight([lastDoc], isLine);\r\n }\r\n\r\n if (options.insertPragma && !hasPragma(options.originalText)) {\r\n return concat([`<!-- @format -->`, hardline, groupConcat(docs)]);\r\n } else {\r\n return groupConcat([join(hardline, docs)]);\r\n }\r\n}\r\n\r\nfunction printAttributeNodeValue(\r\n path: FastPath<any>,\r\n print: PrintFn,\r\n quotes: boolean,\r\n node: AttributeNode | StyleDirectiveNode,\r\n) {\r\n const valueDocs = path.map((childPath) => childPath.call(print), 'value');\r\n\r\n if (!quotes || !formattableAttributes.includes(node.name)) {\r\n return concat(valueDocs);\r\n } else {\r\n return indent(groupConcat(trim(valueDocs, isLine)));\r\n }\r\n}\r\n\r\nfunction printSvelteBlockChildren(path: FastPath, print: PrintFn, options: ParserOptions): Doc {\r\n const node = path.getValue();\r\n const children = node.children;\r\n if (!children || children.length === 0) {\r\n return '';\r\n }\r\n\r\n const whitespaceAtStartOfBlock = checkWhitespaceAtStartOfSvelteBlock(node, options);\r\n const whitespaceAtEndOfBlock = checkWhitespaceAtEndOfSvelteBlock(node, options);\r\n const startline =\r\n whitespaceAtStartOfBlock === 'none'\r\n ? ''\r\n : whitespaceAtEndOfBlock === 'line' || whitespaceAtStartOfBlock === 'line'\r\n ? hardline\r\n : line;\r\n const endline =\r\n whitespaceAtEndOfBlock === 'none'\r\n ? ''\r\n : whitespaceAtEndOfBlock === 'line' || whitespaceAtStartOfBlock === 'line'\r\n ? hardline\r\n : line;\r\n\r\n const firstChild = children[0];\r\n const lastChild = children[children.length - 1];\r\n if (isTextNodeStartingWithWhitespace(firstChild)) {\r\n trimTextNodeLeft(firstChild);\r\n }\r\n if (isTextNodeEndingWithWhitespace(lastChild)) {\r\n trimTextNodeRight(lastChild);\r\n }\r\n\r\n return concat([\r\n indent(concat([startline, group(printChildren(path, print, options))])),\r\n endline,\r\n ]);\r\n}\r\n\r\nfunction printPre(\r\n node: Parameters<typeof printRaw>[0],\r\n originalText: string,\r\n path: FastPath,\r\n print: PrintFn,\r\n): Doc {\r\n const result: Doc = [];\r\n const length = node.children.length;\r\n for (let i = 0; i < length; i++) {\r\n const child = node.children[i];\r\n if (child.type === 'Text') {\r\n const lines = originalText.substring(child.start, child.end).split(/\\r?\\n/);\r\n lines.forEach((line, j) => {\r\n if (j > 0) result.push(literalline);\r\n result.push(line);\r\n });\r\n } else {\r\n result.push(path.call(print, 'children', i));\r\n }\r\n }\r\n return concat(result);\r\n}\r\n\r\nfunction printChildren(path: FastPath, print: PrintFn, options: ParserOptions): Doc {\r\n if (isPreTagContent(path)) {\r\n return concat(path.map(print, 'children'));\r\n }\r\n\r\n const childNodes: Node[] = prepareChildren(path.getValue().children, path, print, options);\r\n // modify original array because it's accessed later through map(print, 'children', idx)\r\n path.getValue().children = childNodes;\r\n if (childNodes.length === 0) {\r\n return '';\r\n }\r\n\r\n const childDocs: Doc[] = [];\r\n let handleWhitespaceOfPrevTextNode = false;\r\n\r\n for (let i = 0; i < childNodes.length; i++) {\r\n const childNode = childNodes[i];\r\n if (childNode.type === 'Text') {\r\n handleTextChild(i, childNode);\r\n } else if (isBlockElement(childNode, options)) {\r\n handleBlockChild(i);\r\n } else if (isInlineElement(path, options, childNode)) {\r\n handleInlineChild(i);\r\n } else {\r\n childDocs.push(printChild(i));\r\n handleWhitespaceOfPrevTextNode = false;\r\n }\r\n }\r\n\r\n // If there's at least one block element and more than one node, break content\r\n const forceBreakContent =\r\n childNodes.length > 1 && childNodes.some((child) => isBlockElement(child, options));\r\n if (forceBreakContent) {\r\n childDocs.push(breakParent);\r\n }\r\n\r\n return concat(childDocs);\r\n\r\n function printChild(idx: number): Doc {\r\n return path.call(print, 'children', idx);\r\n }\r\n\r\n /**\r\n * Print inline child. Hug whitespace of previous text child if there was one.\r\n */\r\n function handleInlineChild(idx: number) {\r\n if (handleWhitespaceOfPrevTextNode) {\r\n childDocs.push(groupConcat([line, printChild(idx)]));\r\n } else {\r\n childDocs.push(printChild(idx));\r\n }\r\n handleWhitespaceOfPrevTextNode = false;\r\n }\r\n\r\n /**\r\n * Print block element. Add softlines around it if needed\r\n * so it breaks into a separate line if children are broken up.\r\n * Don't add lines at the start/end if it's the first/last child because this\r\n * kind of whitespace handling is done in the parent already.\r\n */\r\n function handleBlockChild(idx: number) {\r\n const prevChild = childNodes[idx - 1];\r\n if (\r\n prevChild &&\r\n !isBlockElement(prevChild, options) &&\r\n (prevChild.type !== 'Text' ||\r\n handleWhitespaceOfPrevTextNode ||\r\n !isTextNodeEndingWithWhitespace(prevChild))\r\n ) {\r\n childDocs.push(softline);\r\n }\r\n\r\n childDocs.push(printChild(idx));\r\n\r\n const nextChild = childNodes[idx + 1];\r\n if (\r\n nextChild &&\r\n (nextChild.type !== 'Text' ||\r\n // Only handle text which starts with a whitespace and has text afterwards,\r\n // or is empty but followed by an inline element. The latter is done\r\n // so that if the children break, the inline element afterwards is in a separate line.\r\n ((!isEmptyTextNode(nextChild) ||\r\n (childNodes[idx + 2] && isInlineElement(path, options, childNodes[idx + 2]))) &&\r\n !isTextNodeStartingWithLinebreak(nextChild)))\r\n ) {\r\n childDocs.push(softline);\r\n }\r\n handleWhitespaceOfPrevTextNode = false;\r\n }\r\n\r\n /**\r\n * Print text child. First/last child white space handling\r\n * is done in parent already. By definition of the Svelte AST,\r\n * a text node always is inbetween other tags. Add hardlines\r\n * if the users wants to have them inbetween.\r\n * If the text is trimmed right, toggle flag telling\r\n * subsequent (inline)block element to alter its printing logic\r\n * to check if they need to hug or print lines themselves.\r\n */\r\n function handleTextChild(idx: number, childNode: TextNode) {\r\n handleWhitespaceOfPrevTextNode = false;\r\n\r\n if (idx === 0 || idx === childNodes.length - 1) {\r\n childDocs.push(printChild(idx));\r\n return;\r\n }\r\n\r\n const prevNode = childNodes[idx - 1];\r\n const nextNode = childNodes[idx + 1];\r\n\r\n if (\r\n isTextNodeStartingWithWhitespace(childNode) &&\r\n // If node is empty, go straight through to checking the right end\r\n !isEmptyTextNode(childNode)\r\n ) {\r\n if (\r\n isInlineElement(path, options, prevNode) &&\r\n !isTextNodeStartingWithLinebreak(childNode)\r\n ) {\r\n trimTextNodeLeft(childNode);\r\n const lastChildDoc = childDocs.pop()!;\r\n childDocs.push(groupConcat([lastChildDoc, line]));\r\n }\r\n\r\n if (isBlockElement(prevNode, options) && !isTextNodeStartingWithLinebreak(childNode)) {\r\n trimTextNodeLeft(childNode);\r\n }\r\n }\r\n\r\n if (isTextNodeEndingWithWhitespace(childNode)) {\r\n if (\r\n isInlineElement(path, options, nextNode) &&\r\n !isTextNodeEndingWithLinebreak(childNode)\r\n ) {\r\n handleWhitespaceOfPrevTextNode = !prevNode || !isBlockElement(prevNode, options);\r\n trimTextNodeRight(childNode);\r\n }\r\n if (isBlockElement(nextNode, options) && !isTextNodeEndingWithLinebreak(childNode, 2)) {\r\n handleWhitespaceOfPrevTextNode = !prevNode || !isBlockElement(prevNode, options);\r\n trimTextNodeRight(childNode);\r\n }\r\n }\r\n\r\n childDocs.push(printChild(idx));\r\n }\r\n}\r\n\r\n/**\r\n * `svelte:options` is part of the html part but needs to be snipped out and handled\r\n * separately to reorder it as configured. The comment above it should be moved with it.\r\n * Do that here.\r\n */\r\nfunction prepareChildren(\r\n children: Node[],\r\n path: FastPath,\r\n print: PrintFn,\r\n options: ParserOptions,\r\n): Node[] {\r\n let svelteOptionsComment: Doc | undefined;\r\n const childrenWithoutOptions = [];\r\n const bracketSameLine = isBracketSameLine(options);\r\n\r\n for (let idx = 0; idx < children.length; idx++) {\r\n const currentChild = children[idx];\r\n\r\n if (currentChild.type === 'Text' && getUnencodedText(currentChild) === '') {\r\n continue;\r\n }\r\n\r\n if (isEmptyTextNode(currentChild) && doesEmbedStartAfterNode(currentChild, path)) {\r\n continue;\r\n }\r\n\r\n if (options.svelteSortOrder !== 'none') {\r\n if (isCommentFollowedByOptions(currentChild, idx)) {\r\n svelteOptionsComment = printComment(currentChild);\r\n const nextChild = children[idx + 1];\r\n idx += nextChild && isEmptyTextNode(nextChild) ? 1 : 0;\r\n continue;\r\n }\r\n\r\n if (currentChild.type === 'Options') {\r\n printSvelteOptions(currentChild, idx, path, print);\r\n continue;\r\n }\r\n }\r\n\r\n childrenWithoutOptions.push(currentChild);\r\n }\r\n\r\n const mergedChildrenWithoutOptions = [];\r\n\r\n for (let idx = 0; idx < childrenWithoutOptions.length; idx++) {\r\n const currentChild = childrenWithoutOptions[idx];\r\n const nextChild = childrenWithoutOptions[idx + 1];\r\n\r\n if (currentChild.type === 'Text' && nextChild && nextChild.type === 'Text') {\r\n // A tag was snipped out (f.e. svelte:options). Join text\r\n currentChild.raw += nextChild.raw;\r\n currentChild.data += nextChild.data;\r\n idx++;\r\n }\r\n\r\n mergedChildrenWithoutOptions.push(currentChild);\r\n }\r\n\r\n return mergedChildrenWithoutOptions;\r\n\r\n function printSvelteOptions(\r\n node: OptionsNode,\r\n idx: number,\r\n path: FastPath,\r\n print: PrintFn,\r\n ): void {\r\n svelteOptionsDoc = groupConcat([\r\n groupConcat([\r\n '<',\r\n node.name,\r\n indent(\r\n groupConcat([\r\n ...path.map(\r\n printWithPrependedAttributeLine(node, options, print),\r\n 'children',\r\n idx,\r\n 'attributes',\r\n ),\r\n bracketSameLine ? '' : dedent(line),\r\n ]),\r\n ),\r\n ...[bracketSameLine ? ' ' : '', '/>'],\r\n ]),\r\n hardline,\r\n ]);\r\n if (svelteOptionsComment) {\r\n svelteOptionsDoc = groupConcat([svelteOptionsComment, hardline, svelteOptionsDoc]);\r\n }\r\n }\r\n\r\n function isCommentFollowedByOptions(node: Node, idx: number): node is CommentNode {\r\n if (node.type !== 'Comment' || isIgnoreEndDirective(node) || isIgnoreStartDirective(node)) {\r\n return false;\r\n }\r\n\r\n const nextChild = children[idx + 1];\r\n if (nextChild) {\r\n if (isEmptyTextNode(nextChild)) {\r\n const afterNext = children[idx + 2];\r\n return afterNext && afterNext.type === 'Options';\r\n }\r\n return nextChild.type === 'Options';\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Split the text into words separated by whitespace. Replace the whitespaces by lines,\r\n * collapsing multiple whitespaces into a single line.\r\n *\r\n * If the text starts or ends with multiple newlines, two of those should be kept.\r\n */\r\nfunction splitTextToDocs(node: TextNode): Doc[] {\r\n const text = getUnencodedText(node);\r\n let docs: Doc[] = text.split(/[\\t\\n\\f\\r ]+/);\r\n\r\n docs = join(line, docs).parts.filter((s) => s !== '');\r\n\r\n if (startsWithLinebreak(text)) {\r\n docs[0] = hardline;\r\n }\r\n if (startsWithLinebreak(text, 2)) {\r\n docs = [hardline, ...docs];\r\n }\r\n\r\n if (endsWithLinebreak(text)) {\r\n docs[docs.length - 1] = hardline;\r\n }\r\n if (endsWithLinebreak(text, 2)) {\r\n docs = [...docs, hardline];\r\n }\r\n\r\n return docs;\r\n}\r\n\r\nfunction printSvelteBlockJS(path: FastPath, print: PrintFn, name: string) {\r\n return printJS(path, print, false, true, false, name);\r\n}\r\n\r\nfunction printJS(\r\n path: FastPath,\r\n print: PrintFn,\r\n forceSingleQuote: boolean,\r\n forceSingleLine: boolean,\r\n removeParentheses: boolean,\r\n name: string,\r\n) {\r\n path.getValue()[name].isJS = true;\r\n path.getValue()[name].forceSingleQuote = forceSingleQuote;\r\n path.getValue()[name].forceSingleLine = forceSingleLine;\r\n path.getValue()[name].removeParentheses = removeParentheses;\r\n return path.call(print, name);\r\n}\r\n\r\nfunction expandNode(node: any, parent?: any): string {\r\n if (node === null) {\r\n return '';\r\n }\r\n\r\n if (typeof node === 'string') {\r\n // pre-v3.20 AST\r\n return ' ' + node;\r\n }\r\n\r\n switch (node.type) {\r\n case 'ArrayExpression':\r\n case 'ArrayPattern':\r\n return ' [' + node.elements.map(expandNode).join(',').slice(1) + ']';\r\n case 'AssignmentPattern':\r\n return expandNode(node.left) + ' =' + expandNode(node.right);\r\n case 'Identifier':\r\n return ' ' + node.name;\r\n case 'Literal':\r\n return ' ' + node.raw;\r\n case 'ObjectExpression':\r\n return ' {' + node.properties.map((p: any) => expandNode(p, node)).join(',') + ' }';\r\n case 'ObjectPattern':\r\n return ' {' + node.properties.map(expandNode).join(',') + ' }';\r\n case 'Property':\r\n if (node.value.type === 'ObjectPattern' || node.value.type === 'ArrayPattern') {\r\n return ' ' + node.key.name + ':' + expandNode(node.value);\r\n } else if (\r\n (node.value.type === 'Identifier' && node.key.name !== node.value.name) ||\r\n (parent && parent.type === 'ObjectExpression')\r\n ) {\r\n return expandNode(node.key) + ':' + expandNode(node.value);\r\n } else {\r\n return expandNode(node.value);\r\n }\r\n case 'RestElement':\r\n return ' ...' + node.argument.name;\r\n }\r\n\r\n console.error(JSON.stringify(node, null, 4));\r\n throw new Error('unknown node type: ' + node.type);\r\n}\r\n\r\nfunction printComment(node: CommentNode) {\r\n let text = node.data;\r\n\r\n if (hasSnippedContent(text)) {\r\n text = unsnipContent(text);\r\n }\r\n\r\n return groupConcat(['<!--', text, '-->']);\r\n}\r\n","import { Doc, doc, FastPath, ParserOptions } from 'prettier';\r\nimport { getText } from './lib/getText';\r\nimport { snippedTagContentAttribute } from './lib/snipTagContent';\r\nimport { isBracketSameLine } from './options';\r\nimport { PrintFn } from './print';\r\nimport { isLine, removeParentheses, trimRight } from './print/doc-helpers';\r\nimport { groupConcat, printWithPrependedAttributeLine } from './print/helpers';\r\nimport {\r\n getAttributeTextValue,\r\n getLeadingComment,\r\n isIgnoreDirective,\r\n isNodeSupportedLanguage,\r\n isPugTemplate,\r\n isTypeScript,\r\n printRaw,\r\n} from './print/node-helpers';\r\nimport { CommentNode, ElementNode, Node, ScriptNode, StyleNode } from './print/nodes';\r\n\r\nconst {\r\n builders: { concat, hardline, softline, indent, dedent, literalline },\r\n utils: { removeLines },\r\n} = doc;\r\n\r\nexport function embed(\r\n path: FastPath,\r\n print: PrintFn,\r\n textToDoc: (text: string, options: object) => Doc,\r\n options: ParserOptions,\r\n): Doc | null {\r\n const node: Node = path.getNode();\r\n\r\n if (node.isJS) {\r\n try {\r\n const embeddedOptions: any = {\r\n parser: expressionParser,\r\n };\r\n if (node.forceSingleQuote) {\r\n embeddedOptions.singleQuote = true;\r\n }\r\n\r\n let docs = textToDoc(\r\n forceIntoExpression(\r\n // If we have snipped content, it was done wrongly and we need to unsnip it.\r\n // This happens for example for {@html `<script>{foo}</script>`}\r\n getText(node, options, true),\r\n ),\r\n embeddedOptions,\r\n );\r\n if (node.forceSingleLine) {\r\n docs = removeLines(docs);\r\n }\r\n if (node.removeParentheses) {\r\n docs = removeParentheses(docs);\r\n }\r\n return docs;\r\n } catch (e) {\r\n return getText(node, options, true);\r\n }\r\n }\r\n\r\n const embedType = (\r\n tag: 'script' | 'style' | 'template',\r\n parser: 'typescript' | 'babel-ts' | 'css' | 'pug',\r\n isTopLevel: boolean,\r\n ) =>\r\n embedTag(\r\n tag,\r\n options.originalText,\r\n path,\r\n (content) => formatBodyContent(content, parser, textToDoc, options),\r\n print,\r\n isTopLevel,\r\n options,\r\n );\r\n\r\n const embedScript = (isTopLevel: boolean) =>\r\n embedType(\r\n 'script',\r\n // Use babel-ts as fallback because the absence does not mean the content is not TS,\r\n // the user could have set the default language. babel-ts will format things a little\r\n // bit different though, especially preserving parentheses around dot notation which\r\n // fixes https://github.com/sveltejs/prettier-plugin-svelte/issues/218\r\n isTypeScript(node) ? 'typescript' : 'babel-ts',\r\n isTopLevel,\r\n );\r\n const embedStyle = (isTopLevel: boolean) => embedType('style', 'css', isTopLevel);\r\n const embedPug = () => embedType('template', 'pug', false);\r\n\r\n switch (node.type) {\r\n case 'Script':\r\n return embedScript(true);\r\n case 'Style':\r\n return embedStyle(true);\r\n case 'Element': {\r\n if (node.name === 'script') {\r\n return embedScript(false);\r\n } else if (node.name === 'style') {\r\n return embedStyle(false);\r\n } else if (isPugTemplate(node)) {\r\n return embedPug();\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nfunction forceIntoExpression(statement: string) {\r\n // note the trailing newline: if the statement ends in a // comment,\r\n // we can't add the closing bracket right afterwards\r\n return `(${statement}\\n)`;\r\n}\r\n\r\nfunction expressionParser(text: string, parsers: any, options: any) {\r\n const ast = parsers.babel(text, parsers, options);\r\n\r\n return { ...ast, program: ast.program.body[0].expression };\r\n}\r\n\r\nfunction preformattedBody(str: string): Doc {\r\n const firstNewline = /^[\\t\\f\\r ]*\\n/;\r\n const lastNewline = /\\n[\\t\\f\\r ]*$/;\r\n\r\n // If we do not start with a new line prettier might try to break the opening tag\r\n // to keep it together with the string. Use a literal line to skip indentation.\r\n return concat([literalline, str.replace(firstNewline, '').replace(lastNewline, ''), hardline]);\r\n}\r\n\r\nfunction getSnippedContent(node: Node) {\r\n const encodedContent = getAttributeTextValue(snippedTagContentAttribute, node);\r\n\r\n if (encodedContent) {\r\n return Buffer.from(encodedContent, 'base64').toString('utf-8');\r\n } else {\r\n return '';\r\n }\r\n}\r\n\r\nfunction formatBodyContent(\r\n content: string,\r\n parser: 'typescript' | 'babel-ts' | 'css' | 'pug',\r\n textToDoc: (text: string, options: object) => Doc,\r\n options: ParserOptions & { pugTabWidth?: number },\r\n) {\r\n try {\r\n const body = textToDoc(content, { parser });\r\n\r\n if (parser === 'pug' && typeof body === 'string') {\r\n // Pug returns no docs but a final string.\r\n // Therefore prepend the line offsets\r\n const whitespace = options.useTabs\r\n ? '\\t'\r\n : ' '.repeat(\r\n options.pugTabWidth && options.pugTabWidth > 0\r\n ? options.pugTabWidth\r\n : options.tabWidth,\r\n );\r\n const pugBody = body\r\n .split('\\n')\r\n .map((line) => (line ? whitespace + line : line))\r\n .join('\\n');\r\n return concat([hardline, pugBody]);\r\n }\r\n\r\n const indentIfDesired = (doc: Doc) =>\r\n options.svelteIndentScriptAndStyle ? indent(doc) : doc;\r\n trimRight([body], isLine);\r\n return concat([indentIfDesired(concat([hardline, body])), hardline]);\r\n } catch (error) {\r\n if (process.env.PRETTIER_DEBUG) {\r\n throw error;\r\n }\r\n\r\n // We will wind up here if there is a syntax error in the embedded code. If we throw an error,\r\n // prettier will try to print the node with the printer. That will fail with a hard-to-interpret\r\n // error message (e.g. \"Unsupported node type\", referring to `<script>`).\r\n // Therefore, fall back on just returning the unformatted text.\r\n console.error(error);\r\n\r\n return preformattedBody(content);\r\n }\r\n}\r\n\r\nfunction embedTag(\r\n tag: 'script' | 'style' | 'template',\r\n text: string,\r\n path: FastPath,\r\n formatBodyContent: (content: string) => Doc,\r\n print: PrintFn,\r\n isTopLevel: boolean,\r\n options: ParserOptions,\r\n) {\r\n const node: ScriptNode | StyleNode | ElementNode = path.getNode();\r\n const content =\r\n tag === 'template' ? printRaw(node as ElementNode, text) : getSnippedContent(node);\r\n const previousComments =\r\n node.type === 'Script' || node.type === 'Style'\r\n ? node.comments\r\n : [getLeadingComment(path)]\r\n .filter(Boolean)\r\n .map((comment) => ({ comment: comment as CommentNode, emptyLineAfter: false }));\r\n\r\n const canFormat =\r\n isNodeSupportedLanguage(node) &&\r\n !isIgnoreDirective(previousComments[previousComments.length - 1]?.comment) &&\r\n (tag !== 'template' ||\r\n options.plugins.some(\r\n (plugin) => typeof plugin !== 'string' && plugin.parsers && plugin.parsers.pug,\r\n ));\r\n const body: Doc = canFormat\r\n ? content.trim() !== ''\r\n ? formatBodyContent(content)\r\n : content === ''\r\n ? ''\r\n : hardline\r\n : preformattedBody(content);\r\n\r\n const openingTag = groupConcat([\r\n '<',\r\n tag,\r\n indent(\r\n groupConcat([\r\n ...path.map(printWithPrependedAttributeLine(node, options, print), 'attributes'),\r\n isBracketSameLine(options) ? '' : dedent(softline),\r\n ]),\r\n ),\r\n '>',\r\n ]);\r\n let result = groupConcat([openingTag, body, '</', tag, '>']);\r\n\r\n const comments = [];\r\n for (const comment of previousComments) {\r\n comments.push('<!--', comment.comment.data, '-->');\r\n comments.push(hardline);\r\n if (comment.emptyLineAfter) {\r\n comments.push(hardline);\r\n }\r\n }\r\n\r\n if (isTopLevel && options.svelteSortOrder !== 'none') {\r\n // top level embedded nodes have been moved from their normal position in the\r\n // node tree. if there is a comment referring to it, it must be recreated at\r\n // the new position.\r\n return concat([...comments, result, hardline]);\r\n } else {\r\n return comments.length ? concat([...comments, result]) : result;\r\n }\r\n}\r\n","import { SupportLanguage, Parser, Printer } from 'prettier';\r\nimport { hasPragma, print } from './print';\r\nimport { ASTNode } from './print/nodes';\r\nimport { embed } from './embed';\r\nimport { snipScriptAndStyleTagContent } from './lib/snipTagContent';\r\n\r\nfunction locStart(node: any) {\r\n return node.start;\r\n}\r\n\r\nfunction locEnd(node: any) {\r\n return node.end;\r\n}\r\n\r\nexport const languages: Partial<SupportLanguage>[] = [\r\n {\r\n name: 'svelte',\r\n parsers: ['svelte'],\r\n extensions: ['.svelte'],\r\n vscodeLanguageIds: ['svelte'],\r\n },\r\n];\r\n\r\nexport const parsers: Record<string, Parser> = {\r\n svelte: {\r\n hasPragma,\r\n parse: (text) => {\r\n try {\r\n return <ASTNode>{ ...require(`svelte/compiler`).parse(text), __isRoot: true };\r\n } catch (err: any) {\r\n if (err.start != null && err.end != null) {\r\n // Prettier expects error objects to have loc.start and loc.end fields.\r\n // Svelte uses start and end directly on the error.\r\n err.loc = {\r\n start: err.start,\r\n end: err.end,\r\n };\r\n }\r\n\r\n throw err;\r\n }\r\n },\r\n preprocess: (text, options) => {\r\n text = snipScriptAndStyleTagContent(text);\r\n text = text.trim();\r\n // Prettier sets the preprocessed text as the originalText in case\r\n // the Svelte formatter is called directly. In case it's called\r\n // as an embedded parser (for example when there's a Svelte code block\r\n // inside markdown), the originalText is not updated after preprocessing.\r\n // Therefore we do it ourselves here.\r\n options.originalText = text;\r\n return text;\r\n },\r\n locStart,\r\n locEnd,\r\n astFormat: 'svelte-ast',\r\n },\r\n};\r\n\r\nexport const printers: Record<string, Printer> = {\r\n 'svelte-ast': {\r\n print,\r\n embed,\r\n },\r\n};\r\n\r\nexport { options } from './options';\r\n"],"names":["doc","concat","hardline","softline","indent","dedent","literalline"],"mappings":";;;;;;AAEA;AACO,MAAM,eAAe,GAAG;IAC3B,MAAM;IACN,MAAM;IACN,IAAI;IACJ,KAAK;IACL,OAAO;IACP,IAAI;IACJ,KAAK;IACL,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC;AAEF;AACO,MAAM,aAAa,GAAc;IACpC,SAAS;IACT,SAAS;IACT,OAAO;IACP,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;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