prettier-plugin-astro 0.0.7 → 0.0.11
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/CHANGELOG.md +40 -0
- package/README.md +4 -2
- package/dist/index.js +867 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -12
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -10
- package/.eslintrc +0 -9
- package/.github/CODEOWNERS +0 -1
- package/.github/ISSUE_TEMPLATE/---01-bug-report.yml +0 -31
- package/.github/ISSUE_TEMPLATE/---02-feature-request.yml +0 -50
- package/.github/ISSUE_TEMPLATE/---03-documentation.md +0 -7
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -15
- package/.github/workflows/ci.yml +0 -26
- package/.github/workflows/format.yml +0 -29
- package/.github/workflows/release.yml +0 -52
- package/.gitpod.yml +0 -9
- package/.prettierignore +0 -1
- package/.prettierrc.json +0 -7
- package/jsconfig.json +0 -3
- package/src/index.d.ts +0 -9
- package/src/index.js +0 -38
- package/src/options.js +0 -24
- package/src/parse.js +0 -8
- package/src/printer.js +0 -442
- package/src/utils.js +0 -558
- package/test/astro-prettier.test.mjs +0 -123
- package/test/fixtures/in/attribute-with-embedded-expr.astro +0 -6
- package/test/fixtures/in/basic.astro +0 -13
- package/test/fixtures/in/converts-to-shorthand.astro +0 -5
- package/test/fixtures/in/doctype-with-embedded-expr.astro +0 -26
- package/test/fixtures/in/doctype-with-extra-attributes.astro +0 -26
- package/test/fixtures/in/embedded-expr.astro +0 -26
- package/test/fixtures/in/embedded-in-markdown.md +0 -332
- package/test/fixtures/in/expr-and-html-comment.astro +0 -20
- package/test/fixtures/in/frontmatter.astro +0 -18
- package/test/fixtures/in/html-comment.astro +0 -5
- package/test/fixtures/in/maximum-call-stack-size-exceeded.astro +0 -1
- package/test/fixtures/in/preserve-tag-case.astro +0 -5
- package/test/fixtures/in/single-style-element.astro +0 -9
- package/test/fixtures/in/unclosed-tag.astro +0 -42
- package/test/fixtures/in/with-codespans.astro +0 -19
- package/test/fixtures/in/with-indented-sass.astro +0 -20
- package/test/fixtures/in/with-script.astro +0 -5
- package/test/fixtures/in/with-scss.astro +0 -24
- package/test/fixtures/in/with-styles.astro +0 -21
- package/test/fixtures/out/attribute-with-embedded-expr.astro +0 -6
- package/test/fixtures/out/basic.astro +0 -12
- package/test/fixtures/out/converts-to-shorthand.astro +0 -6
- package/test/fixtures/out/doctype-with-embedded-expr.astro +0 -23
- package/test/fixtures/out/doctype-with-extra-attributes.astro +0 -23
- package/test/fixtures/out/embedded-expr.astro +0 -22
- package/test/fixtures/out/embedded-in-markdown.md +0 -336
- package/test/fixtures/out/expr-and-html-comment.astro +0 -5
- package/test/fixtures/out/frontmatter.astro +0 -16
- package/test/fixtures/out/html-comment.astro +0 -5
- package/test/fixtures/out/maximum-call-stack-size-exceeded.astro +0 -2
- package/test/fixtures/out/preserve-tag-case.astro +0 -5
- package/test/fixtures/out/single-style-element.astro +0 -9
- package/test/fixtures/out/unclosed-tag.astro +0 -34
- package/test/fixtures/out/with-codespans.astro +0 -17
- package/test/fixtures/out/with-indented-sass.astro +0 -17
- package/test/fixtures/out/with-script.astro +0 -5
- package/test/fixtures/out/with-scss.astro +0 -21
- package/test/fixtures/out/with-styles.astro +0 -18
- package/test/package.json +0 -3
- package/test/test-utils.mjs +0 -35
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/parse.ts","../src/options.ts","../src/nodes.ts","../src/utils.ts","../src/printer.ts","../src/index.ts"],"sourcesContent":["import { parse as parseAstro } from '@astrojs/parser';\n\nconst parse = (text: string) => parseAstro(text);\n\nexport default parse;\n","import { SupportOption } from 'prettier';\n\ndeclare module 'prettier' {\n interface RequiredOptions extends PluginOptions {}\n}\n\nexport interface PluginOptions {\n astroSortOrder: SortOrder;\n astroAllowShorthand: boolean;\n}\n\nexport const options: Record<keyof PluginOptions, SupportOption> = {\n astroSortOrder: {\n since: '0.0.1',\n category: 'Astro',\n type: 'choice',\n default: 'markup | styles',\n description: 'Sort order for markup, scripts, and styles',\n choices: [\n {\n value: 'markup | styles',\n description: 'markup | styles',\n },\n {\n value: 'styles | markup',\n description: 'styles | markup',\n },\n ],\n },\n astroAllowShorthand: {\n since: '0.0.10',\n category: 'Astro',\n type: 'boolean',\n default: true,\n description: 'Enable/disable attribute shorthand if attribute name and expression are the same',\n },\n};\n\nexport const parseSortOrder = (sortOrder: SortOrder): SortOrderPart[] => sortOrder.split(' | ') as SortOrderPart[];\n\nexport type SortOrder = 'markup | styles' | 'styles | markup';\n\nexport type SortOrderPart = 'markup' | 'styles';\n","// TODO: MAYBE WE SHOULD USE TYPES FROM THE PARSER\n\nexport interface Ast {\n html: anyNode;\n css: StyleNode[];\n module: ScriptNode;\n meta: {\n features: number;\n };\n}\n\nexport interface BaseNode {\n start: number;\n end: number;\n type: string;\n children?: anyNode[];\n // TODO: ADD BETTER TYPE\n [prop_name: string]: any;\n}\n\nexport type attributeValue = TextNode[] | AttributeShorthandNode[] | MustacheTagNode[] | true;\n\nexport interface NodeWithChildren {\n children: anyNode[];\n}\n\nexport interface NodeWithText {\n data: string;\n raw?: string;\n}\n\nexport interface FragmentNode extends BaseNode {\n type: 'Fragment';\n children: anyNode[];\n}\n\nexport interface TextNode extends BaseNode {\n type: 'Text';\n data: string;\n raw: string;\n}\n\nexport interface CodeFenceNode extends BaseNode {\n type: 'CodeFence';\n metadata: string;\n data: string;\n raw: string;\n}\n\nexport interface CodeSpanNode extends BaseNode {\n type: 'CodeSpan';\n metadata: string;\n data: string;\n raw: string;\n}\n\nexport interface SpreadNode extends BaseNode {\n type: 'Spread';\n expression: ExpressionNode;\n}\n\nexport interface ExpressionNode {\n type: 'Expression';\n start: number;\n end: number;\n codeChunks: string[];\n children: anyNode[];\n}\n\nexport interface ScriptNode extends BaseNode {\n type: 'Script';\n context: 'runtime' | 'setup';\n content: string;\n}\n\nexport interface StyleNode extends BaseNode {\n type: 'Style';\n // TODO: ADD BETTER TYPE\n attributes: any[];\n content: {\n start: number;\n end: number;\n styles: string;\n };\n}\n\nexport interface AttributeNode extends BaseNode {\n type: 'Attribute';\n name: string;\n value: attributeValue;\n}\n\nexport interface AttributeShorthandNode extends BaseNode {\n type: 'AttributeShorthand';\n expression: IdentifierNode;\n}\n\nexport interface IdentifierNode extends BaseNode {\n type: 'Identifier';\n name: string;\n}\n\nexport interface MustacheTagNode extends BaseNode {\n type: 'MustacheTag';\n expression: ExpressionNode;\n}\n\nexport interface SlotNode extends BaseNode {\n type: 'Slot';\n name: string;\n attributes: AttributeNode[];\n}\n\nexport interface CommentNode extends BaseNode {\n type: 'Comment';\n data: string;\n name?: string;\n leading?: boolean;\n trailing?: boolean;\n printed?: boolean;\n nodeDescription?: string;\n}\n\nexport interface ElementNode extends BaseNode {\n type: 'Element';\n name: string;\n attributes: AttributeNode[];\n}\n\nexport interface InlineComponentNode extends BaseNode {\n type: 'InlineComponent';\n name: string;\n attributes: AttributeNode[];\n}\n\nexport interface BlockElementNode extends ElementNode {\n name: typeof blockElementsT[number];\n}\n\nexport interface InlineElementNode extends ElementNode {\n name: typeof inlineElementsT[number];\n}\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements#Elements\nconst blockElementsT = [\n 'address',\n 'article',\n 'aside',\n 'blockquote',\n 'details',\n 'dialog',\n 'dd',\n 'div',\n 'dl',\n 'dt',\n 'fieldset',\n 'figcaption',\n 'figure',\n 'footer',\n 'form',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hgroup',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'ol',\n 'p',\n 'pre',\n 'section',\n 'table',\n 'ul',\n] as const;\n// https://github.com/microsoft/TypeScript/issues/31018\nexport const blockElements: string[] = [...blockElementsT];\n\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Inline_elements\nconst inlineElementsT = [\n 'a',\n 'abbr',\n 'acronym',\n 'audio',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'br',\n 'button',\n 'canvas',\n 'cite',\n 'code',\n 'data',\n 'datalist',\n 'del',\n 'dfn',\n 'em',\n 'embed',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'map',\n 'mark',\n 'meter',\n 'noscript',\n 'object',\n 'output',\n 'picture',\n 'progress',\n 'q',\n 'ruby',\n 's',\n 'samp',\n 'script',\n 'select',\n 'slot',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'sup',\n 'svg',\n 'template',\n 'textarea',\n 'time',\n 'u',\n 'tt',\n 'var',\n 'video',\n 'wbr',\n] as const;\n// https://github.com/microsoft/TypeScript/issues/31018\nexport const inlineElements: string[] = [...inlineElementsT];\n\n// @see http://xahlee.info/js/html5_non-closing_tag.html\nexport const selfClosingTags = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr'];\n\nexport type anyNode =\n | AttributeNode\n | AttributeShorthandNode\n | BlockElementNode\n | CodeFenceNode\n | CodeSpanNode\n | CommentNode\n | ElementNode\n | ExpressionNode\n | FragmentNode\n | IdentifierNode\n | InlineComponentNode\n | InlineElementNode\n | MustacheTagNode\n | MustacheTagNode\n | ScriptNode\n | SlotNode\n | SpreadNode\n | StyleNode\n | TextNode;\n","import { AstPath as AstP, doc, Doc, ParserOptions as ParserOpts, util } from 'prettier';\n\nimport {\n anyNode,\n Ast,\n AttributeNode,\n AttributeShorthandNode,\n attributeValue,\n BlockElementNode,\n blockElements,\n InlineElementNode,\n MustacheTagNode,\n NodeWithChildren,\n NodeWithText,\n TextNode,\n} from './nodes';\n\ntype ParserOptions = ParserOpts<anyNode>;\ntype AstPath = AstP<anyNode>;\n\n/**\n * HTML attributes that we may safely reformat (trim whitespace, add or remove newlines)\n */\nexport const formattableAttributes: string[] = [\n // None at the moment\n // Prettier HTML does not format attributes at all\n // and to be consistent we leave this array empty for now\n];\n\nconst rootNodeKeys = new Set(['html', 'css', 'module']);\n\nexport const isASTNode = (node: anyNode | Ast): node is Ast => typeof node === 'object' && Object.keys(node).filter((key) => rootNodeKeys.has(key)).length === rootNodeKeys.size;\n\nexport const isEmptyTextNode = (node: anyNode): boolean => {\n return !!node && node.type === 'Text' && getUnencodedText(node).trim() === '';\n};\n\nexport const isPreTagContent = (path: AstPath): boolean => {\n if (!path || !path.stack || !Array.isArray(path.stack)) return false;\n return path.stack.some(\n (node: anyNode) => (node.type === 'Element' && node.name.toLowerCase() === 'pre') || (node.type === 'Attribute' && !formattableAttributes.includes(node.name))\n );\n};\n\nexport function isLoneMustacheTag(node: attributeValue): node is [MustacheTagNode] {\n return node !== true && node.length === 1 && node[0].type === 'MustacheTag';\n}\n\nfunction isAttributeShorthand(node: attributeValue): node is [AttributeShorthandNode] {\n return node !== true && node.length === 1 && node[0].type === 'AttributeShorthand';\n}\n\n/**\n * True if node is of type `{a}` or `a={a}`\n */\nexport function isOrCanBeConvertedToShorthand(node: AttributeNode, opts: ParserOptions): boolean {\n if (!opts.astroAllowShorthand) return false;\n if (isAttributeShorthand(node.value)) {\n return true;\n }\n\n if (isLoneMustacheTag(node.value)) {\n const expression = node.value[0].expression;\n return expression.codeChunks[0] === node.name;\n // return (expression.type === 'Identifier' && expression.name === node.name) || (expression.type === 'Expression' && expression.codeChunks[0] === node.name);\n }\n\n return false;\n}\n\nexport function flatten<T>(arrays: T[][]): T[] {\n return ([] as T[]).concat.apply([], arrays);\n}\n\nexport function getText(node: anyNode, opts: ParserOptions): string {\n return opts.originalText.slice(opts.locStart(node), opts.locEnd(node));\n // const leadingComments = node.leadingComments;\n\n // return options.originalText.slice(\n // options.locStart(\n // // if there are comments before the node they are not included\n // // in the `start` of the node itself\n // (leadingComments && leadingComments[0]) || node\n // ),\n // options.locEnd(node)\n // );\n}\n\nexport function getUnencodedText(node: NodeWithText): string {\n // `raw` will contain HTML entities in unencoded form\n return node.raw || node.data;\n}\n\nexport function replaceEndOfLineWith(text: string, replacement: doc.builders.DocCommand): Doc[] {\n const parts = [];\n for (const part of text.split('\\n')) {\n if (parts.length > 0) {\n parts.push(replacement);\n }\n if (part.endsWith('\\r')) {\n parts.push(part.slice(0, -1));\n } else {\n parts.push(part);\n }\n }\n return parts;\n}\n\nexport function printRaw(node: anyNode, originalText: string, stripLeadingAndTrailingNewline: boolean = false): string {\n if (!isNodeWithChildren(node)) {\n return '';\n }\n\n if (node.children.length === 0) {\n return '';\n }\n\n const firstChild = node.children[0];\n const lastChild = node.children[node.children.length - 1];\n\n let raw = originalText.substring(firstChild.start, lastChild.end);\n\n if (!stripLeadingAndTrailingNewline) {\n return raw;\n }\n\n if (startsWithLinebreak(raw)) {\n raw = raw.substring(raw.indexOf('\\n') + 1);\n }\n if (endsWithLinebreak(raw)) {\n raw = raw.substring(0, raw.lastIndexOf('\\n'));\n if (raw.charAt(raw.length - 1) === '\\r') {\n raw = raw.substring(0, raw.length - 1);\n }\n }\n\n return raw;\n}\n\nexport function isNodeWithChildren(node: anyNode): node is anyNode & NodeWithChildren {\n return node && Array.isArray(node.children);\n}\n\nexport function isInlineElement(path: AstPath, opts: ParserOptions, node: anyNode): node is InlineElementNode {\n return node && node.type === 'Element' && !isBlockElement(node, opts) && !isPreTagContent(path);\n}\n\nexport function isBlockElement(node: anyNode, opts: ParserOptions): node is BlockElementNode {\n return node && node.type === 'Element' && opts.htmlWhitespaceSensitivity !== 'strict' && (opts.htmlWhitespaceSensitivity === 'ignore' || blockElements.includes(node.name));\n}\n\nexport function isTextNodeStartingWithLinebreak(node: TextNode, nrLines: number = 1): node is TextNode {\n return startsWithLinebreak(getUnencodedText(node), nrLines);\n // return node.type === 'Text' && startsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function startsWithLinebreak(text: string, nrLines: number = 1): boolean {\n return new RegExp(`^([\\\\t\\\\f\\\\r ]*\\\\n){${nrLines}}`).test(text);\n}\n\nexport function isTextNodeEndingWithLinebreak(node: TextNode, nrLines: number = 1) {\n return node.type === 'Text' && endsWithLinebreak(getUnencodedText(node), nrLines);\n}\n\nexport function endsWithLinebreak(text: string, nrLines: number = 1): boolean {\n return new RegExp(`(\\\\n[\\\\t\\\\f\\\\r ]*){${nrLines}}$`).test(text);\n}\n\nexport function isTextNodeStartingWithWhitespace(node: anyNode): node is TextNode {\n return node.type === 'Text' && /^\\s/.test(getUnencodedText(node));\n}\n\nexport function isTextNodeEndingWithWhitespace(node: anyNode): node is TextNode {\n return node.type === 'Text' && /\\s$/.test(getUnencodedText(node));\n}\n\nexport function forceIntoExpression(statement: string): string {\n // note the trailing newline: if the statement ends in a // comment,\n // we can't add the closing bracket right afterwards\n return `(${statement}\\n)`;\n}\n\n/**\n * Check if given node's starg 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 if (isBlockElement(node, opts)) {\n return false;\n }\n\n if (!isNodeWithChildren(node)) {\n return false;\n }\n\n const children = node.children;\n if (children.length === 0) {\n return true;\n }\n\n const firstChild = children[0];\n return !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 if (isBlockElement(node, opts)) {\n return false;\n }\n\n if (!isNodeWithChildren(node)) {\n return false;\n }\n\n const children = node.children;\n if (children.length === 0) {\n return true;\n }\n\n const lastChild = children[children.length - 1];\n return !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 return isLastChildWithinParentBlockElement(path, opts);\n // return !hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options);\n // return !options.svelteBracketNewLine && (!hugsStartOfNextNode(node, options) || isLastChildWithinParentBlockElement(path, options));\n}\n\n/**\n * Return true if given node does not hug the next node, meaning there's whitespace\n * or the end of the doc afterwards.\n */\nfunction hugsStartOfNextNode(node: anyNode, opts: ParserOptions): boolean {\n if (node.end === opts.originalText.length) {\n // end of document\n return false;\n }\n\n return !opts.originalText.substring(node.end).match(/^\\s/);\n}\n\nfunction getChildren(node: anyNode): anyNode[] {\n return isNodeWithChildren(node) ? node.children : [];\n}\n\nfunction isLastChildWithinParentBlockElement(path: AstPath, opts: ParserOptions): boolean {\n const parent = path.getParentNode();\n if (!parent || !isBlockElement(parent, opts)) {\n return false;\n }\n\n const children = getChildren(parent);\n const lastChild = children[children.length - 1];\n return lastChild === path.getNode();\n}\n\nexport function trimTextNodeLeft(node: TextNode): void {\n node.raw = node.raw && node.raw.trimLeft();\n node.data = node.data && node.data.trimLeft();\n}\n\nexport function trimTextNodeRight(node: TextNode): void {\n node.raw = node.raw && node.raw.trimRight();\n node.data = node.data && node.data.trimRight();\n}\n\nexport function findLastIndex<T>(isMatch: (item: T, idx: number) => boolean, items: T[]) {\n for (let i = items.length - 1; i >= 0; i--) {\n if (isMatch(items[i], i)) {\n return i;\n }\n }\n\n return -1;\n}\n\n/**\n * Remove all leading whitespace up until the first non-empty text node,\n * and all trailing whitepsace from the last non-empty text node onwards.\n */\nexport function trimChildren(children: anyNode[]) {\n // export function trimChildren(children: anyNode[], path: AstPath<anyNode>) {\n let firstNonEmptyNode = children.findIndex((n) => !isEmptyTextNode(n));\n // let firstNonEmptyNode = children.findIndex((n) => !isEmptyTextNode(n) && !doesEmbedStartAfterNode(n, path));\n firstNonEmptyNode = firstNonEmptyNode === -1 ? children.length - 1 : firstNonEmptyNode;\n\n let lastNonEmptyNode = findLastIndex((n, idx) => {\n // Last node is ok to end at the start of an embedded region,\n // if it's not a comment (which should stick to the region)\n return !isEmptyTextNode(n);\n // return !isEmptyTextNode(n) && ((idx === children.length - 1 && n.type !== 'Comment') || !doesEmbedStartAfterNode(n, path));\n }, children);\n lastNonEmptyNode = lastNonEmptyNode === -1 ? 0 : lastNonEmptyNode;\n\n for (let i = 0; i <= firstNonEmptyNode; i++) {\n const n = children[i];\n if (isTextNode(n)) {\n trimTextNodeLeft(n);\n }\n }\n\n for (let i = children.length - 1; i >= lastNonEmptyNode; i--) {\n const n = children[i];\n if (isTextNode(n)) {\n trimTextNodeRight(n);\n }\n }\n}\n\n/**\n * Returns siblings, that is, the children of the parent.\n */\nexport function getSiblings(path: AstPath): anyNode[] {\n let parent = path.getParentNode();\n if (!parent) return [];\n\n if (isASTNode(parent)) {\n parent = parent.html;\n }\n\n return getChildren(parent);\n}\n\n/**\n * Did there use to be any embedded object (that has been snipped out of the AST to be moved)\n * at the specified position?\n */\n// function doesEmbedStartAfterNode(node: anyNode, path: AstPath<anyNode>, siblings = getSiblings(path)): boolean {\n// // If node is not at the top level of html, an embed cannot start after it,\n// // because embeds are only at the top level\n// if (!isNodeTopLevelHTML(node, path)) {\n// return false;\n// }\n\n// const position = node.end;\n// const root = path.stack[0];\n\n// const embeds = [root.module, root.html, root.css];\n\n// const nextNode = siblings[siblings.indexOf(node) + 1];\n// return embeds.find((n) => n && n.start >= position && (!nextNode || n.end <= nextNode.start));\n// }\n\n// function isNodeTopLevelHTML(node: anyNode, path: AstPath<anyNode>) {\n// const root = path.stack[0];\n// return !!root.html && !!root.html.children && root.html.children.includes(node);\n// }\n\n/**\n * Check if doc is a hardline.\n * We can't just rely on a simple equality check because the doc could be created with another\n * runtime version of prettier than what we import, making a reference check fail.\n */\n\nfunction isHardline(docToCheck: Doc): boolean {\n return docToCheck === doc.builders.hardline || deepEqual(docToCheck, doc.builders.hardline);\n}\n\n/**\n * Simple deep equal function which suits our needs. Only works properly on POJOs without cyclic deps.\n */\nfunction deepEqual(x: any, y: any): boolean {\n if (x === y) {\n return true;\n } else if (typeof x == 'object' && x != null && typeof y == 'object' && y != null) {\n if (Object.keys(x).length != Object.keys(y).length) return false;\n\n for (var prop in x) {\n if (Object.prototype.hasOwnProperty.call(y, prop)) {\n if (!deepEqual(x[prop], y[prop])) return false;\n } else {\n return false;\n }\n }\n\n return true;\n } else {\n return false;\n }\n}\n\nexport function isLine(docToCheck: Doc): boolean {\n return (\n isHardline(docToCheck) ||\n (typeof docToCheck === 'object' && isDocCommand(docToCheck) && docToCheck.type === 'line') ||\n (typeof docToCheck === 'object' && isDocCommand(docToCheck) && docToCheck.type === 'concat' && docToCheck.parts.every(isLine))\n );\n}\n\n/**\n * Check if the doc is empty, i.e. consists of nothing more than empty strings (possibly nested).\n */\nexport function isEmptyDoc(doc: Doc): boolean {\n if (typeof doc === 'string') {\n return doc.length === 0;\n }\n\n // if (doc.type === 'line') {\n // return !doc.keepIfLonely;\n // }\n\n // Since Prettier 2.3.0, concats are represented as flat arrays\n if (Array.isArray(doc)) {\n return doc.length === 0;\n }\n\n // const { contents } = doc;\n\n // if (contents) {\n // return isEmptyDoc(contents);\n // }\n\n // const { parts } = doc;\n\n // if (parts) {\n // return isEmptyGroup(parts);\n // }\n\n return false;\n}\n\n// function isEmptyGroup(group: any) {\n// return !group.find((doc: any) => !isEmptyDoc(doc));\n// }\n\n/**\n * Trims both leading and trailing nodes matching `isWhitespace` independent of nesting level\n * (though all trimmed adjacent nodes need to be a the same level). Modifies the `docs` array.\n */\nexport function trim(docs: Doc[], isWhitespace: (doc: Doc) => boolean): Doc[] {\n trimLeft(docs, isWhitespace);\n trimRight(docs, isWhitespace);\n\n return docs;\n}\n\n/**\n * Trims the leading nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\n * If there are empty docs before the first whitespace, they are removed, too.\n */\nfunction trimLeft(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\n let firstNonWhitespace = group.findIndex((doc) => !isEmptyDoc(doc) && !isWhitespace(doc));\n\n if (firstNonWhitespace < 0 && group.length) {\n firstNonWhitespace = group.length;\n }\n\n if (firstNonWhitespace > 0) {\n const removed = group.splice(0, firstNonWhitespace);\n if (removed.every(isEmptyDoc)) {\n return trimLeft(group, isWhitespace);\n }\n } else {\n const parts = getParts(group[0]);\n\n if (parts) {\n return trimLeft(parts, isWhitespace);\n }\n }\n}\n\n/**\n * Trims the trailing nodes matching `isWhitespace` independent of nesting level (though all nodes need to be a the same level).\n * If there are empty docs after the last whitespace, they are removed, too.\n */\nfunction trimRight(group: Doc[], isWhitespace: (doc: Doc) => boolean): void {\n let lastNonWhitespace = group.length ? findLastIndex((doc: any) => !isEmptyDoc(doc) && !isWhitespace(doc), group) : 0;\n\n if (lastNonWhitespace < group.length - 1) {\n const removed = group.splice(lastNonWhitespace + 1);\n if (removed.every(isEmptyDoc)) {\n return trimRight(group, isWhitespace);\n }\n } else {\n const parts = getParts(group[group.length - 1]);\n\n if (parts) {\n return trimRight(parts, isWhitespace);\n }\n }\n}\n\nfunction getParts(doc: Doc): Doc[] | undefined {\n if (typeof doc === 'object') {\n // Since Prettier 2.3.0, concats are represented as flat arrays\n if (Array.isArray(doc)) {\n return doc;\n }\n if (doc.type === 'fill' || doc.type === 'concat') {\n return doc.parts;\n }\n if (doc.type === 'group') {\n return getParts(doc.contents);\n }\n }\n}\n\nexport const isObjEmpty = (obj: object): boolean => {\n for (let i in obj) return false;\n return true;\n};\n\n/** Shallowly attach comments to children */\nexport function attachCommentsHTML(node: anyNode): void {\n if (!isNodeWithChildren(node) || !node.children.some(({ type }) => type === 'Comment')) return;\n\n const nodesToRemove = [];\n\n // note: the .length - 1 is because we don’t need to read the last node\n for (let n = 0; n < node.children.length - 1; n++) {\n if (!node.children[n]) continue;\n\n // attach comment to the next non-whitespace node\n if (node.children[n].type === 'Comment') {\n let next = n + 1;\n while (isEmptyTextNode(node.children[next])) {\n nodesToRemove.push(next); // if arbitrary whitespace between comment and node, remove\n next++; // skip to the next non-whitespace node\n }\n util.addLeadingComment(node.children[next], node.children[n]);\n }\n }\n\n // remove arbitrary whitespace nodes\n nodesToRemove.reverse(); // start at back so we aren’t changing indices\n nodesToRemove.forEach((index) => {\n node.children.splice(index, 1);\n });\n}\n\n/** dedent string & return tabSize (the last part is what we need) */\nexport function dedent(input: string): { tabSize: number; char: string; result: string } {\n let minTabSize = Infinity;\n let result = input;\n // 1. normalize\n result = result.replace(/\\r\\n/g, '\\n');\n\n // 2. count tabSize\n let char = '';\n for (const line of result.split('\\n')) {\n if (!line) continue;\n // if any line begins with a non-whitespace char, minTabSize is 0\n if (line[0] && /^[^\\s]/.test(line[0])) {\n minTabSize = 0;\n break;\n }\n const match = line.match(/^(\\s+)\\S+/); // \\S ensures we don’t count lines of pure whitespace\n if (match) {\n if (match[1] && !char) char = match[1][0];\n if (match[1].length < minTabSize) minTabSize = match[1].length;\n }\n }\n\n // 3. reformat string\n if (minTabSize > 0 && Number.isFinite(minTabSize)) {\n result = result.replace(new RegExp(`^${new Array(minTabSize + 1).join(char)}`, 'gm'), '');\n }\n\n return {\n tabSize: minTabSize === Infinity ? 0 : minTabSize,\n char,\n result,\n };\n}\n\n/** re-indent string by chars */\nexport function indent(input: string, char: string = ' '): string {\n return input.replace(/^(.)/gm, `${char}$1`);\n}\n\n/** scan code for Markdown name(s) */\nexport function getMarkdownName(script: string): Set<string> {\n // default import: could be named anything\n let defaultMatch;\n while ((defaultMatch = /import\\s+([^\\s]+)\\s+from\\s+['|\"|`]astro\\/components\\/Markdown\\.astro/g.exec(script))) {\n if (defaultMatch[1]) return new Set([defaultMatch[1].trim()]);\n }\n\n // named component: must have \"Markdown\" in specifier, but can be renamed via \"as\"\n let namedMatch;\n while ((namedMatch = /import\\s+\\{\\s*([^}]+)\\}\\s+from\\s+['|\"|`]astro\\/components/g.exec(script))) {\n if (namedMatch[1] && !namedMatch[1].includes('Markdown')) continue;\n // if \"Markdown\" was imported, find out whether or not it was renamed\n const rawImports = namedMatch[1].trim().replace(/^\\{/, '').replace(/\\}$/, '').trim();\n let importName = 'Markdown';\n for (const spec of rawImports.split(',')) {\n const [original, renamed] = spec.split(' as ').map((s) => s.trim());\n if (original !== 'Markdown') continue;\n importName = renamed || original;\n break;\n }\n return new Set([importName]);\n }\n return new Set(['Markdown']);\n}\n\nexport function isTextNode(node: anyNode): node is TextNode {\n return node.type === 'Text';\n}\n\nexport function isMustacheNode(node: anyNode): node is MustacheTagNode {\n return node.type === 'MustacheTag';\n}\n\nexport function isDocCommand(doc: Doc): doc is doc.builders.DocCommand {\n if (typeof doc === 'string') return false;\n if (Array.isArray(doc)) return false;\n return true;\n}\n\nexport function isInsideQuotedAttribute(path: AstPath): boolean {\n const stack = path.stack as anyNode[];\n return stack.some((node) => node.type === 'Attribute' && !isLoneMustacheTag(node.value));\n}\n","import { AstPath as AstP, Doc, ParserOptions as ParserOpts, Printer } from 'prettier';\nimport _doc from 'prettier/doc';\nconst {\n builders: { breakParent, dedent, fill, group, hardline, indent, join, line, literalline, softline },\n utils: { removeLines, stripTrailingHardline },\n} = _doc;\nimport { SassFormatter, SassFormatterConfig } from 'sass-formatter';\n\nimport { parseSortOrder } from './options';\nimport { Ast, anyNode, AttributeNode, CommentNode, NodeWithText, selfClosingTags, TextNode } from './nodes';\n\ntype ParserOptions = ParserOpts<anyNode>;\ntype AstPath = AstP<anyNode>;\n\nimport {\n attachCommentsHTML,\n canOmitSoftlineBeforeClosingTag,\n dedent as manualDedent,\n endsWithLinebreak,\n forceIntoExpression,\n formattableAttributes,\n getMarkdownName,\n getText,\n getUnencodedText,\n isASTNode,\n isDocCommand,\n isEmptyDoc,\n isEmptyTextNode,\n isInlineElement,\n isInsideQuotedAttribute,\n isLine,\n isLoneMustacheTag,\n isNodeWithChildren,\n isOrCanBeConvertedToShorthand,\n isPreTagContent,\n isTextNode,\n isTextNodeEndingWithWhitespace,\n isTextNodeStartingWithLinebreak,\n isTextNodeStartingWithWhitespace,\n printRaw,\n replaceEndOfLineWith,\n shouldHugEnd,\n shouldHugStart,\n startsWithLinebreak,\n trim,\n trimChildren,\n trimTextNodeLeft,\n trimTextNodeRight,\n} from './utils';\n\nfunction printTopLevelParts(node: Ast, path: AstPath, opts: ParserOptions, print: printFn): Doc {\n let docs = [];\n\n const normalize = (doc: Doc) => [stripTrailingHardline(doc), hardline];\n\n // frontmatter always comes first\n if (node.module) {\n const subDoc = normalize(path.call(print, 'module'));\n docs.push(subDoc);\n }\n\n // markup and styles follow, whichever the user prefers (default: markup, styles)\n for (const section of parseSortOrder(opts.astroSortOrder)) {\n switch (section) {\n case 'markup': {\n const subDoc = path.call(print, 'html');\n if (!isEmptyDoc(subDoc)) docs.push(normalize(subDoc));\n break;\n }\n case 'styles': {\n const subDoc = path.call(print, 'css');\n if (!isEmptyDoc(subDoc)) docs.push(normalize(subDoc));\n break;\n }\n }\n }\n\n return join(softline, docs);\n}\n\nfunction printAttributeNodeValue(path: AstPath, print: printFn, quotes: boolean, node: AttributeNode): Doc[] | _doc.builders.Indent {\n const valueDocs = path.map((childPath) => childPath.call(print), 'value');\n\n if (!quotes || !formattableAttributes.includes(node.name)) {\n return valueDocs;\n } else {\n return indent(group(trim(valueDocs, isLine)));\n }\n}\n\n// TODO: USE ASTPATH GENERIC\nfunction printJS(path: AstP, print: printFn, name: string, { forceSingleQuote, forceSingleLine }: { forceSingleQuote: boolean; forceSingleLine: boolean }) {\n path.getValue()[name].isJS = true;\n path.getValue()[name].forceSingleQuote = forceSingleQuote;\n path.getValue()[name].forceSingleLine = forceSingleLine;\n return path.call(print, name);\n}\n\n// TODO: MAYBE USE THIS TO HANDLE COMMENTS\nfunction printComment(commentPath: AstPath, options: ParserOptions): Doc {\n // note(drew): this isn’t doing anything currently, but Prettier requires it anyway\n // @ts-ignore\n return commentPath;\n}\n\nexport type printFn = (path: AstPath) => Doc;\n\nfunction print(path: AstPath, opts: ParserOptions, print: printFn): Doc {\n const node = path.getValue();\n const isMarkdownSubDoc = opts.parentParser === 'markdown'; // is this a code block within .md?\n\n // 1. handle special node types\n if (!node) {\n return '';\n }\n\n if (typeof node === 'string') {\n return node;\n }\n\n if (Array.isArray(node)) {\n return path.map((childPath) => childPath.call(print));\n }\n\n if (isASTNode(node)) {\n return printTopLevelParts(node, path, opts, print);\n }\n\n // 2. attach comments shallowly to children, if any (https://prettier.io/docs/en/plugins.html#manually-attaching-a-comment)\n if (!isPreTagContent(path) && !isMarkdownSubDoc) {\n attachCommentsHTML(node);\n }\n\n // 3. handle printing\n switch (node.type) {\n case 'Fragment': {\n const text = getText(node, opts);\n if (text.length === 0) {\n return '';\n }\n\n if (!isNodeWithChildren(node) || node.children.every(isEmptyTextNode)) return '';\n\n // If we don't see any JSX expressions, this is just embedded HTML\n // and we can skip a bunch of work. Hooray!\n const hasInlineComponent = node.children.filter((x) => x.type === 'InlineComponent').length > 0;\n if (text.indexOf('{') === -1 && !hasInlineComponent) {\n // TODO:CHECK 'node.__isRawHTML'\n node.__isRawHTML = true;\n node.content = text;\n return path.call(print);\n // return path.map(print, 'children');\n }\n\n if (!isPreTagContent(path)) {\n trimChildren(node.children);\n const output = trim(\n [path.map(print, 'children')],\n (n) =>\n isLine(n) ||\n (typeof n === 'string' && n.trim() === '') ||\n // Because printChildren may append this at the end and\n // may hide other lines before it\n n === breakParent\n );\n if (output.every((doc) => isEmptyDoc(doc))) {\n return '';\n }\n return group([...output, hardline]);\n } else {\n return group(path.map(print, 'children'));\n }\n }\n case 'Text': {\n const rawText = getUnencodedText(node);\n\n if (isPreTagContent(path)) {\n if (path.getParentNode()?.type === 'Attribute') {\n // Direct child of attribute value -> add literallines at end of lines\n // so that other things don't break in unexpected places\n return replaceEndOfLineWith(rawText, literalline);\n }\n return rawText;\n }\n\n if (isEmptyTextNode(node)) {\n const hasWhiteSpace = rawText.trim().length < getUnencodedText(node).length;\n const hasOneOrMoreNewlines = /\\n/.test(getUnencodedText(node));\n const hasTwoOrMoreNewlines = /\\n\\r?\\s*\\n\\r?/.test(getUnencodedText(node));\n if (hasTwoOrMoreNewlines) {\n return [hardline, hardline];\n }\n if (hasOneOrMoreNewlines) {\n return hardline;\n }\n if (hasWhiteSpace) {\n return line;\n }\n return '';\n }\n\n /**\n * For non-empty text nodes each sequence of non-whitespace characters (effectively,\n * each \"word\") is joined by a single `line`, which will be rendered as a single space\n * until this node's current line is out of room, at which `fill` will break at the\n * most convenient instance of `line`.\n */\n return fill(splitTextToDocs(node));\n }\n\n case 'Element':\n case 'InlineComponent':\n case 'Slot': {\n const isEmpty = node.children?.every((child) => isEmptyTextNode(child));\n const isSelfClosingTag = isEmpty && (node.type !== 'Element' || selfClosingTags.indexOf(node.name) !== -1);\n const attributes = path.map(print, 'attributes');\n if (isSelfClosingTag) {\n return group(['<', node.name, indent(group(attributes)), line, `/>`]);\n // return group(['<', node.name, indent(group([...attributes, opts.jsxBracketNewLine ? dedent(line) : ''])), ...[opts.jsxBracketNewLine ? '' : ' ', `/>`]]);\n }\n try {\n if (node.name.toLowerCase() === '!doctype') {\n const attributesWithLowercaseHTML = attributes.map((attribute) => {\n if (typeof attribute === 'string') return attribute;\n if (isDocCommand(attribute)) return attribute;\n attribute = attribute.map((attrValue) => {\n if (typeof attrValue !== 'string') return attrValue;\n if (attrValue.toLowerCase() === 'html') {\n attrValue = attrValue.toLowerCase();\n }\n return attrValue;\n });\n\n // if (attribute[0].type === 'line' && attribute[1].toLowerCase() === 'html') {\n // attribute[1] = attribute[1].toLowerCase();\n // return attribute;\n // }\n return attribute;\n });\n\n return group(['<', node.name.toUpperCase(), ...attributesWithLowercaseHTML, `>`]);\n }\n } catch (e) {\n console.warn(`error ${e} in the doctype printing`);\n }\n\n if (node.children) {\n const children = node.children;\n const firstChild = children[0];\n const lastChild = children[children.length - 1];\n\n // No hugging of content means it's either a block element and/or there's whitespace at the start/end\n let noHugSeparatorStart: _doc.builders.Concat | _doc.builders.Line | _doc.builders.Softline | string = softline;\n let noHugSeparatorEnd: _doc.builders.Concat | _doc.builders.Line | _doc.builders.Softline | string = softline;\n let hugStart = shouldHugStart(node, opts);\n let hugEnd = shouldHugEnd(node, opts);\n\n let body;\n\n if (isEmpty) {\n body =\n isInlineElement(path, opts, node) && node.children.length && isTextNodeStartingWithWhitespace(node.children[0]) && !isPreTagContent(path)\n ? () => line\n : // () => (opts.jsxBracketNewLine ? '' : softline);\n () => softline;\n } else if (isPreTagContent(path)) {\n body = () => printRaw(node, opts.originalText);\n } else if (isInlineElement(path, opts, node) && !isPreTagContent(path)) {\n body = () => path.map(print, 'children');\n } else {\n body = () => path.map(print, 'children');\n }\n\n const openingTag = ['<', node.name, indent(group([...attributes, hugStart ? '' : !isPreTagContent(path) && !opts.bracketSameLine ? dedent(softline) : '']))];\n // const openingTag = ['<', node.name, indent(group([...attributes, hugStart ? '' : opts.jsxBracketNewLine && !isPreTagContent(path) ? dedent(softline) : '']))];\n\n if (hugStart && hugEnd) {\n const huggedContent = [softline, group(['>', body(), `</${node.name}`])];\n\n const omitSoftlineBeforeClosingTag = isEmpty || canOmitSoftlineBeforeClosingTag(path, opts);\n // const omitSoftlineBeforeClosingTag = (isEmpty && opts.jsxBracketNewLine) || canOmitSoftlineBeforeClosingTag(node, path, opts);\n return group([...openingTag, isEmpty ? group(huggedContent) : group(indent(huggedContent)), omitSoftlineBeforeClosingTag ? '' : softline, '>']);\n }\n\n if (isPreTagContent(path)) {\n noHugSeparatorStart = '';\n noHugSeparatorEnd = '';\n } else {\n let didSetEndSeparator = false;\n\n if (!hugStart && firstChild && isTextNode(firstChild)) {\n if (isTextNodeStartingWithLinebreak(firstChild) && firstChild !== lastChild && (!isInlineElement(path, opts, node) || isTextNodeEndingWithWhitespace(lastChild))) {\n noHugSeparatorStart = hardline;\n noHugSeparatorEnd = hardline;\n didSetEndSeparator = true;\n } else if (isInlineElement(path, opts, node)) {\n noHugSeparatorStart = line;\n }\n trimTextNodeLeft(firstChild);\n }\n if (!hugEnd && lastChild && isTextNode(lastChild)) {\n if (isInlineElement(path, opts, node) && !didSetEndSeparator) {\n noHugSeparatorEnd = line;\n }\n trimTextNodeRight(lastChild);\n }\n }\n\n if (hugStart) {\n return group([...openingTag, indent([softline, group(['>', body()])]), noHugSeparatorEnd, `</${node.name}>`]);\n }\n\n if (hugEnd) {\n return group([...openingTag, '>', indent([noHugSeparatorStart, group([body(), `</${node.name}`])]), canOmitSoftlineBeforeClosingTag(path, opts) ? '' : softline, '>']);\n }\n\n if (isEmpty) {\n return group([...openingTag, '>', body(), `</${node.name}>`]);\n }\n\n return group([...openingTag, '>', indent([noHugSeparatorStart, body()]), noHugSeparatorEnd, `</${node.name}>`]);\n }\n }\n case 'AttributeShorthand': {\n return node.expression.name;\n }\n case 'Attribute': {\n if (isOrCanBeConvertedToShorthand(node, opts)) {\n return [line, '{', node.name, '}'];\n } else {\n if (node.value === true) {\n return [line, node.name];\n }\n\n const quotes = !isLoneMustacheTag(node.value);\n const attrNodeValue = printAttributeNodeValue(path, print, quotes, node);\n if (quotes) {\n return [line, node.name, '=', '\"', attrNodeValue, '\"'];\n } else {\n return [line, node.name, '=', attrNodeValue];\n }\n }\n }\n case 'Expression':\n // missing test ?\n return [];\n case 'MustacheTag':\n return [\n '{',\n printJS(path, print, 'expression', {\n forceSingleLine: isInsideQuotedAttribute(path),\n forceSingleQuote: opts.jsxSingleQuote,\n }),\n '}',\n ];\n case 'Spread':\n return [\n line,\n '{...',\n printJS(path, print, 'expression', {\n forceSingleQuote: true,\n forceSingleLine: false,\n }),\n '}',\n ];\n case 'Comment':\n return ['<!--', getUnencodedText(node), '-->'];\n case 'CodeSpan':\n return getUnencodedText(node);\n case 'CodeFence': {\n console.debug(node);\n // const lang = node.metadata.slice(3);\n return [node.metadata, hardline, /** somehow call textToDoc(lang), */ node.data, hardline, '```', hardline];\n\n // We should use `node.metadata` to select a parser to embed with... something like return [node.metadata, hardline textToDoc(node.getMetadataLanguage()), hardline, `\\`\\`\\``];\n }\n default: {\n throw new Error(`Unhandled node type \"${node.type}\"!`);\n }\n }\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: NodeWithText): Doc[] {\n const text = getUnencodedText(node);\n\n let textLines = text.split(/[\\t\\n\\f\\r ]+/);\n\n let docs = join(line, textLines).parts.filter((s) => s !== '');\n\n if (startsWithLinebreak(text)) {\n docs[0] = hardline;\n }\n if (startsWithLinebreak(text, 2)) {\n docs = [hardline, ...docs];\n }\n\n if (endsWithLinebreak(text)) {\n docs[docs.length - 1] = hardline;\n }\n if (endsWithLinebreak(text, 2)) {\n docs = [...docs, hardline];\n }\n\n return docs;\n}\n\n// TODO: CHANGE 'parsers' TYPE\nfunction expressionParser(text: string, parsers: any, opts: ParserOptions) {\n const ast = parsers.babel(text, parsers, opts);\n\n return { ...ast, program: ast.program.body[0].expression };\n}\n\nlet markdownComponentName = new Set();\n\nfunction embed(path: AstPath, print: printFn, textToDoc: (text: string, options: object) => Doc, opts: ParserOptions) {\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n if (!opts.__astro) opts.__astro = {};\n\n const node = path.getValue();\n\n if (!node) return null;\n\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n if (node.isJS) {\n try {\n const embeddedopts = {\n parser: expressionParser,\n };\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n if (node.forceSingleQuote) {\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n embeddedopts.singleQuote = true;\n }\n\n const docs = textToDoc(forceIntoExpression(getText(node, opts)), embeddedopts);\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n return node.forceSingleLine ? removeLines(docs) : docs;\n } catch (e) {\n return getText(node, opts);\n }\n }\n\n if (node.type === 'Script' && node.context === 'setup') {\n markdownComponentName = getMarkdownName(node.content);\n return group(['---', hardline, textToDoc(node.content, { ...opts, parser: 'typescript' }), '---', hardline]);\n }\n\n // format <script type=\"module\"> content\n if (isTextNode(node)) {\n const parent = path.getParentNode();\n\n if (parent && parent.type === 'Element' && parent.name === 'script') {\n const formatttedScript = textToDoc(node.data, { ...opts, parser: 'typescript' });\n return stripTrailingHardline(formatttedScript);\n }\n }\n\n // type style is top level style tag\n // type element is nested style tag\n if (node.type === 'Style' || (node.type === 'Element' && node.name === 'style')) {\n let styleTagContent = '';\n if (node.type === 'Style') {\n styleTagContent = node.content.styles;\n } else if (node.children) {\n const children = node.children[0] as TextNode;\n styleTagContent = getUnencodedText(children);\n }\n\n const supportedStyleLangValues = ['css', 'scss', 'sass'];\n let parserLang = 'css';\n\n if ('attributes' in node) {\n const langAttribute = node.attributes.filter((x) => x.name === 'lang');\n if (langAttribute.length) {\n const styleLang = langAttribute[0].value[0].raw.toLowerCase();\n if (supportedStyleLangValues.includes(styleLang)) parserLang = styleLang;\n }\n }\n\n switch (parserLang) {\n case 'css':\n case 'scss': {\n // the css parser appends an extra indented hardline, which we want outside of the `indent()`,\n // so we remove the last element of the array\n let formattedStyles = textToDoc(styleTagContent, { ...opts, parser: parserLang });\n\n formattedStyles = stripTrailingHardline(formattedStyles);\n\n // print\n const attributes = path.map(print, 'attributes');\n const openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n return [openingTag, indent([hardline, formattedStyles]), hardline, '</style>'];\n }\n case 'sass': {\n const lineEnding = opts.endOfLine.toUpperCase() === 'CRLF' ? 'CRLF' : 'LF';\n const sassOptions: Partial<SassFormatterConfig> = {\n tabSize: opts.tabWidth,\n insertSpaces: !opts.useTabs,\n lineEnding,\n };\n\n // dedent the .sass, otherwise SassFormatter gets indentation wrong\n const { result: raw } = manualDedent(styleTagContent);\n\n // format\n let formattedSassIndented = SassFormatter.Format(raw, sassOptions).trim();\n\n // print\n const formattedSass = join(hardline, formattedSassIndented.split('\\n'));\n const attributes = path.map(print, 'attributes');\n const openingTag = group(['<style', indent(group(attributes)), softline, '>']);\n return [openingTag, indent(group([hardline, formattedSass])), hardline, '</style>'];\n }\n }\n }\n\n // MARKDOWN COMPONENT\n if (node.type === 'InlineComponent' && markdownComponentName.has(node.name)) {\n let content = printRaw(node, opts.originalText);\n\n // dedent the content\n content = content.replace(/\\r\\n/g, '\\n');\n const contentArr = content.split('\\n').map((s) => s.trimStart());\n content = contentArr.join('\\n');\n\n // format\n let formatttedMarkdown = textToDoc(content, { ...opts, parser: 'markdown' });\n formatttedMarkdown = stripTrailingHardline(formatttedMarkdown);\n\n // return formatttedMarkdown;\n const attributes = path.map(print, 'attributes');\n const openingTag = group([`<${node.name}`, indent(group(attributes)), softline, '>']);\n return [openingTag, indent(group([hardline, formatttedMarkdown])), hardline, `</${node.name}>`];\n }\n\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n if (node.__isRawHTML) {\n // TODO: ADD TYPES OR FIND ANOTHER WAY TO ACHIVE THIS\n // @ts-ignore\n return textToDoc(node.content, { ...opts, parser: 'html' });\n }\n\n return null;\n}\n\nfunction hasPrettierIgnore(path: AstP<CommentNode>) {\n const node = path.getNode();\n\n if (!node || !Array.isArray(node.comments)) return false;\n\n const hasIgnore = node.comments.some(\n (comment: any) => comment.data.includes('prettier-ignore') && !comment.data.includes('prettier-ignore-start') && !comment.data.includes('prettier-ignore-end')\n );\n return hasIgnore;\n}\n\nconst printer: Printer = {\n print,\n printComment,\n embed,\n hasPrettierIgnore,\n};\n\nexport default printer;\n","import parse from './parse';\nimport printer from './printer';\nimport { options } from './options';\nimport { Parser, Printer, SupportLanguage } from 'prettier';\n\nexport const languages: Partial<SupportLanguage>[] = [\n {\n name: 'astro',\n parsers: ['astro'],\n extensions: ['.astro'],\n vscodeLanguageIds: ['astro'],\n },\n];\n\nexport const parsers: Record<string, Parser> = {\n astro: {\n parse,\n astFormat: 'astro',\n locStart: (node) => node.start,\n locEnd: (node) => node.end,\n },\n};\n\nexport const printers: Record<string, Printer> = {\n astro: printer,\n};\n\nconst defaultOptions = {\n tabWidth: 2,\n};\n\nexport { options, defaultOptions };\n"],"names":["parseAstro","doc","util","dedent","_doc","manualDedent","SassFormatter"],"mappings":";;;;;;;;;;;;;AAEA,MAAM,KAAK,GAA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AAE,OAAO,KAAK,CAAC;IAEzD,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAClC,CAAC,OAAY,KAAK,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAC/J,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,OAAO,GAAY;IACvB,KAAK;IACL,YAAY;IACZ,KAAK;IACL,iBAAiB;CAClB;;MCzjBY,SAAS,GAA+B;IACnD;QACE,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,QAAQ,CAAC;QACtB,iBAAiB,EAAE,CAAC,OAAO,CAAC;KAC7B;EACD;MAEW,OAAO,GAA2B;IAC7C,KAAK,EAAE;QACL,KAAK;QACL,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK;QAC9B,MAAM,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,GAAG;KAC3B;EACD;MAEW,QAAQ,GAA4B;IAC/C,KAAK,EAAE,OAAO;EACd;MAEI,cAAc,GAAG;IACrB,QAAQ,EAAE,CAAC;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-astro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "A Prettier Plugin for formatting Astro files",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/**"
|
|
8
|
+
],
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0",
|
|
11
|
+
"npm": ">=6.14.0"
|
|
12
|
+
},
|
|
7
13
|
"homepage": "https://github.com/snowpackjs/prettier-plugin-astro/",
|
|
8
14
|
"issues": {
|
|
9
15
|
"url": "https://github.com/snowpackjs/prettier-plugin-astro/issues"
|
|
@@ -20,22 +26,34 @@
|
|
|
20
26
|
"url": "https://github.com/snowpackjs/prettier-plugin-astro.git"
|
|
21
27
|
},
|
|
22
28
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
29
|
+
"build": "rollup -c",
|
|
30
|
+
"dev": "rollup -c -w",
|
|
31
|
+
"test": "ava test/*.test.ts",
|
|
32
|
+
"test:w": "ava -w test/*.test.ts",
|
|
33
|
+
"release": "yarn build && changeset publish",
|
|
25
34
|
"lint": "eslint .",
|
|
26
35
|
"fix": "yarn lint --fix",
|
|
27
36
|
"format": "prettier -w ."
|
|
28
37
|
},
|
|
29
38
|
"dependencies": {
|
|
30
|
-
"@astrojs/parser": "^0.
|
|
31
|
-
"prettier": "^2.4.1"
|
|
39
|
+
"@astrojs/parser": "^0.20.2",
|
|
40
|
+
"prettier": "^2.4.1",
|
|
41
|
+
"sass-formatter": "^0.7.2"
|
|
32
42
|
},
|
|
33
43
|
"devDependencies": {
|
|
34
44
|
"@changesets/cli": "^2.16.0",
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"eslint
|
|
45
|
+
"@rollup/plugin-commonjs": "^21.0.0",
|
|
46
|
+
"@rollup/plugin-node-resolve": "^13.0.5",
|
|
47
|
+
"@types/prettier": "^2.4.1",
|
|
48
|
+
"ava": "https://github.com/avajs/ava.git#main",
|
|
49
|
+
"eslint": "^8.0.0",
|
|
50
|
+
"eslint-plugin-ava": "^13.0.0",
|
|
51
|
+
"eslint-plugin-node": "^11.1.0",
|
|
52
|
+
"eslint-plugin-prettier-doc": "^1.0.1",
|
|
53
|
+
"rollup": "^2.58.0",
|
|
54
|
+
"rollup-plugin-typescript": "^1.0.1",
|
|
55
|
+
"ts-node": "^10.2.1",
|
|
56
|
+
"tslib": "^2.3.1",
|
|
57
|
+
"typescript": "^4.4.3"
|
|
40
58
|
}
|
|
41
59
|
}
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
package/.eslintrc
DELETED
package/.github/CODEOWNERS
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
* @snowpackjs/maintainers
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
name: "\U0001F41B Bug Report"
|
|
2
|
-
description: Report an issue or possible bug
|
|
3
|
-
title: "\U0001F41B BUG:"
|
|
4
|
-
labels: []
|
|
5
|
-
assignees: []
|
|
6
|
-
body:
|
|
7
|
-
- type: markdown
|
|
8
|
-
attributes:
|
|
9
|
-
value: |
|
|
10
|
-
## Quick Checklist
|
|
11
|
-
Thank you for taking the time to file a bug report! Please fill out this form as completely as possible.
|
|
12
|
-
|
|
13
|
-
✅ I am using the **latest version of the Astro Prettier Plugin**.
|
|
14
|
-
- type: textarea
|
|
15
|
-
attributes:
|
|
16
|
-
label: Describe the Bug
|
|
17
|
-
description: A clear and concise description of what the bug is.
|
|
18
|
-
validations:
|
|
19
|
-
required: true
|
|
20
|
-
- type: textarea
|
|
21
|
-
attributes:
|
|
22
|
-
label: Steps to Reproduce
|
|
23
|
-
description: Describe the bug in steps that we can reproduce ourselves.
|
|
24
|
-
value: |
|
|
25
|
-
1. `npm init astro` using template <NAME>
|
|
26
|
-
2. ...
|
|
27
|
-
3. ...
|
|
28
|
-
4. ...
|
|
29
|
-
5. Error! Describe what went wrong (and what was expected instead)...
|
|
30
|
-
validations:
|
|
31
|
-
required: true
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: "\U0001F4A1 Feature Request"
|
|
2
|
-
description: 'Submit an RFC or suggest an idea for this project'
|
|
3
|
-
title: "\U0001F4A1 RFC: "
|
|
4
|
-
labels: ['feature']
|
|
5
|
-
assignees: []
|
|
6
|
-
body:
|
|
7
|
-
- type: markdown
|
|
8
|
-
attributes:
|
|
9
|
-
value: Thanks for taking the time to suggest a new feature! Please fill out this form as completely as possible.
|
|
10
|
-
- type: textarea
|
|
11
|
-
attributes:
|
|
12
|
-
label: Background & Motivation
|
|
13
|
-
description: |
|
|
14
|
-
A quick, clear and concise description of what the problem is.
|
|
15
|
-
**Please include links to relevant issues, Discord convos, and anything else.**
|
|
16
|
-
placeholder: I want to be able to...
|
|
17
|
-
validations:
|
|
18
|
-
required: true
|
|
19
|
-
- type: textarea
|
|
20
|
-
attributes:
|
|
21
|
-
label: Proposed Solution
|
|
22
|
-
description: Your take on one (or more) possible solution(s) to problem.
|
|
23
|
-
value: |
|
|
24
|
-
### Possible solutions
|
|
25
|
-
|
|
26
|
-
### Alternatives considered
|
|
27
|
-
|
|
28
|
-
### Risks, downsides, and/or tradeoffs
|
|
29
|
-
|
|
30
|
-
### Open Questions
|
|
31
|
-
validations:
|
|
32
|
-
required: true
|
|
33
|
-
- type: textarea
|
|
34
|
-
attributes:
|
|
35
|
-
label: Detailed Design
|
|
36
|
-
description: |
|
|
37
|
-
🛑 **Just looking for feedback on an idea? Leave this section blank.**
|
|
38
|
-
|
|
39
|
-
Otherwise, explain the exact steps required to implement this change.
|
|
40
|
-
Include specific details that would help someone implement this feature.
|
|
41
|
-
- type: checkboxes
|
|
42
|
-
attributes:
|
|
43
|
-
label: Help make it happen!
|
|
44
|
-
description: 'Tip: RFCs with contributing authors are much more likely to get done!'
|
|
45
|
-
options:
|
|
46
|
-
- label: I am willing to submit a PR to implement this change.
|
|
47
|
-
- label: I am willing to submit a PR to implement this change, but would need some guidance.
|
|
48
|
-
- label: I am not willing to submit a PR to implement this change.
|
|
49
|
-
validations:
|
|
50
|
-
required: true
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
blank_issues_enabled: false
|
|
2
|
-
contact_links:
|
|
3
|
-
- name: 👾 Chat
|
|
4
|
-
url: https://astro.build/chat
|
|
5
|
-
about: Our Discord server is active, come join us!
|
|
6
|
-
- name: 💁 Support
|
|
7
|
-
url: https://astro.build/chat
|
|
8
|
-
about: 'This issue tracker is not for support questions. Join us on Discord for assistance!'
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
## Changes
|
|
2
|
-
|
|
3
|
-
- What does this change?
|
|
4
|
-
- Be short and concise. Bullet points can help!
|
|
5
|
-
- Before/after screenshots can be helpful as well.
|
|
6
|
-
|
|
7
|
-
## Testing
|
|
8
|
-
|
|
9
|
-
<!-- How was this change tested? -->
|
|
10
|
-
<!-- DON'T DELETE THIS SECTION! If no tests added, explain why. -->
|
|
11
|
-
|
|
12
|
-
## Docs
|
|
13
|
-
|
|
14
|
-
<!-- Was public documentation updated? -->
|
|
15
|
-
<!-- DON'T DELETE THIS SECTION! If no docs added, explain why (e.g. "bug fix only") -->
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
name: 'CI'
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
env:
|
|
10
|
-
node_version: 14
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
with:
|
|
18
|
-
ref: ${{ github.head_ref }}
|
|
19
|
-
- uses: actions/setup-node@v2
|
|
20
|
-
with:
|
|
21
|
-
node-version: ${{ env.node_version }}
|
|
22
|
-
- run: yarn --frozen-lockfile --ignore-engines
|
|
23
|
-
env:
|
|
24
|
-
CI: true
|
|
25
|
-
- run: yarn test
|
|
26
|
-
- run: yarn lint
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: 'Format Code'
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
env:
|
|
9
|
-
node_version: 14
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
format:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v2
|
|
16
|
-
with:
|
|
17
|
-
ref: ${{ github.head_ref }}
|
|
18
|
-
- uses: actions/setup-node@v2
|
|
19
|
-
with:
|
|
20
|
-
node-version: ${{ env.node_version }}
|
|
21
|
-
- run: yarn --frozen-lockfile --ignore-engines
|
|
22
|
-
env:
|
|
23
|
-
CI: true
|
|
24
|
-
- run: yarn format
|
|
25
|
-
- name: Commit changes
|
|
26
|
-
uses: stefanzweifel/git-auto-commit-action@v4
|
|
27
|
-
with:
|
|
28
|
-
commit_message: '[ci] yarn format'
|
|
29
|
-
branch: ${{ github.head_ref }}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
name: Changelog
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
name: Changelog
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Check out branch
|
|
14
|
-
uses: actions/checkout@v2
|
|
15
|
-
with:
|
|
16
|
-
fetch-depth: 0 # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
|
|
17
|
-
|
|
18
|
-
- name: Set up Node.js 14.x
|
|
19
|
-
uses: actions/setup-node@v2
|
|
20
|
-
with:
|
|
21
|
-
node-version: 14.x
|
|
22
|
-
|
|
23
|
-
- name: Install dependencies
|
|
24
|
-
run: yarn --frozen-lockfile --ignore-engines
|
|
25
|
-
env:
|
|
26
|
-
CI: true
|
|
27
|
-
|
|
28
|
-
- name: Create Release Pull Request or Publish to npm
|
|
29
|
-
id: changesets
|
|
30
|
-
uses: changesets/action@master
|
|
31
|
-
with:
|
|
32
|
-
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
|
33
|
-
publish: yarn release
|
|
34
|
-
env:
|
|
35
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
36
|
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
37
|
-
|
|
38
|
-
# - name: Send a Discord notification if a publish happens
|
|
39
|
-
# if: steps.changesets.outputs.published == 'true'
|
|
40
|
-
# id: discord-notification
|
|
41
|
-
# env:
|
|
42
|
-
# DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
43
|
-
# uses: Ilshidur/action-discord@0.3.2
|
|
44
|
-
# with:
|
|
45
|
-
# args: 'A new release just went out! [Release notes →](<https://github.com/snowpackjs/prettier-plugin-astro/releases/>)'
|
|
46
|
-
|
|
47
|
-
- name: push main branch to latest branch
|
|
48
|
-
if: steps.changesets.outputs.published == 'true'
|
|
49
|
-
id: git-push-latest
|
|
50
|
-
# Note: this will fail if "latest" and "main" have different commit history,
|
|
51
|
-
# which is a good thing! Also, don't push if in pre-release mode.
|
|
52
|
-
run: '(test -f .changeset/pre.json && echo "prerelease: skip pushing to latest branch.") || git push origin main:latest'
|
package/.gitpod.yml
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# Commands to start on workspace startup
|
|
2
|
-
tasks:
|
|
3
|
-
- init: yarn install
|
|
4
|
-
command: yarn build
|
|
5
|
-
# Once astro is on [vsx](https://open-vsx.org/), we should be able to specify it as an extension as well!
|
|
6
|
-
# https://www.gitpod.io/docs/vscode-extensions
|
|
7
|
-
# vscode:
|
|
8
|
-
# extensions:
|
|
9
|
-
# - astro-build.astro-vscode
|
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
test/fixtures/**/*
|
package/.prettierrc.json
DELETED
package/jsconfig.json
DELETED
package/src/index.d.ts
DELETED
package/src/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const parse = require('./parse');
|
|
2
|
-
const printer = require('./printer');
|
|
3
|
-
const { options } = require('./options');
|
|
4
|
-
|
|
5
|
-
/** @type {Partial<import('prettier').SupportLanguage>[]} */
|
|
6
|
-
const languages = [
|
|
7
|
-
{
|
|
8
|
-
name: 'astro',
|
|
9
|
-
parsers: ['astro'],
|
|
10
|
-
extensions: ['.astro'],
|
|
11
|
-
vscodeLanguageIds: ['astro'],
|
|
12
|
-
},
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
/** @type {Record<string, import('prettier').Parser>} */
|
|
16
|
-
const parsers = {
|
|
17
|
-
astro: {
|
|
18
|
-
parse,
|
|
19
|
-
astFormat: 'astro',
|
|
20
|
-
locStart: (node) => node.start,
|
|
21
|
-
locEnd: (node) => node.end,
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/** @type {Record<string, import('prettier').Printer>} */
|
|
26
|
-
const printers = {
|
|
27
|
-
astro: printer,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
module.exports = {
|
|
31
|
-
languages,
|
|
32
|
-
printers,
|
|
33
|
-
parsers,
|
|
34
|
-
options,
|
|
35
|
-
defaultOptions: {
|
|
36
|
-
tabWidth: 2,
|
|
37
|
-
},
|
|
38
|
-
};
|
package/src/options.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @type {Record<string, import('prettier').SupportOption> } */
|
|
2
|
-
const options = {
|
|
3
|
-
astroSortOrder: {
|
|
4
|
-
since: '0.0.1',
|
|
5
|
-
category: 'Astro',
|
|
6
|
-
type: 'choice',
|
|
7
|
-
default: 'markup | styles',
|
|
8
|
-
description: 'Sort order for markup, scripts, and styles',
|
|
9
|
-
choices: [
|
|
10
|
-
{
|
|
11
|
-
value: 'markup | styles',
|
|
12
|
-
description: 'markup | styles',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
value: 'styles | markup',
|
|
16
|
-
description: 'styles | markup',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const parseSortOrder = (sortOrder) => sortOrder.split(' | ');
|
|
23
|
-
|
|
24
|
-
module.exports = { options, parseSortOrder };
|