{
  "version": 3,
  "sources": ["../src/index.ts", "../src/options.ts", "../src/parser.ts", "../src/printer.ts"],
  "sourcesContent": ["import type { Parser, Printer, SupportLanguage } from \"prettier\";\nimport { defaultOptions, options } from \"./options\";\nimport { parse } from \"./parser\";\nimport { print } from \"./printer\";\n\n/**\n * An array of supported languages by the plugin.\n */\nexport const languages: SupportLanguage[] = [\n\t{\n\t\tname: \"Blade\",\n\t\tparsers: [\"blade\"],\n\t\tsince: \"1.0.0\",\n\t\textensions: [\".blade.php\"],\n\t\ttmScope: \"source.blade.php\",\n\t\taceMode: \"text\",\n\t\tlinguistLanguageId: 33,\n\t\tvscodeLanguageIds: [\"blade\"],\n\t},\n];\n\n/**\n * An object containing the parser functions for each supported language.\n */\nexport const parsers: { [k: string]: Parser } = {\n\tblade: {\n\t\t/**\n\t\t * The parse function for the Blade parser.\n\t\t */\n\t\tparse,\n\t\t/**\n\t\t * The AST format used by the Blade parser.\n\t\t */\n\t\tastFormat: \"blade-format\",\n\t\t/**\n\t\t * The function used to get the start location of a node in the AST.\n\t\t * @param node The AST node.\n\t\t * @returns The start location of the node.\n\t\t */\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tlocStart(node: any) {\n\t\t\treturn node.start;\n\t\t},\n\t\t/**\n\t\t * The function used to get the end location of a node in the AST.\n\t\t * @param node The AST node.\n\t\t * @returns The end location of the node.\n\t\t */\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tlocEnd(node: any) {\n\t\t\treturn node.end;\n\t\t},\n\t},\n};\n\n/**\n * An object containing the printer functions for each AST format.\n */\nexport const printers: { [k: string]: Printer } = {\n\t\"blade-format\": {\n\t\t/**\n\t\t * The print function for the Blade AST format.\n\t\t */\n\t\tprint,\n\t},\n};\n\nexport { options, defaultOptions };\n", "/**\n * This module exports default options and additional options for the Prettier plugin for Blade templates.\n *\n * @since 1.0.0\n * @module options\n */\n\n/**\n * Default options for the Prettier plugin for Blade templates.\n *\n * @type {Object}\n * @property {number} tabWidth - The number of spaces for each tab.\n * @property {number} printWidth - The maximum width of the output.\n * @property {boolean} singleQuote - Whether to use single quotes for strings.\n * @since 1.0.0\n */\nexport const defaultOptions = {\n\ttabWidth: 4,\n\tprintWidth: 120,\n\tsingleQuote: true,\n};\n\n/**\n * Additional options for the Prettier plugin for Blade templates.\n *\n * @type {Object}\n * @property {Object} wrapAttributes - The way to wrap attributes. [auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned]\n * @property {Object} wrapAttributesMinAttrs - Minimum number of html tag attributes for force wrap attribute options. Wrap the first attribute only if 'force-expand-multiline' is specified in wrap attributes.\n * @property {Object} endWithNewLine - Whether to end output with newline.\n * @property {Object} sortTailwindcssClasses - Whether to sort Tailwindcss classes automatically. This option respects `tailwind.config.js`.\n * @property {Object} tailwindcssConfigPath - Path to custom Tailwindcss config. This option is available only when `sortTailwindcssClasses` is present.\n * @property {Object} sortHtmlAttributes - Sort HTML Attributes. [none|alphabetical|code-guide|idiomatic|vuejs|custom]\n * @property {Object} customHtmlAttributesOrder - Comma separated custom HTML attributes order. e.g. \"id, aria-.+, class, src\". To enable this you must specify sort html attributes option as `custom`. You can use regex for attribute names.\n * @property {Object} noPhpSyntaxCheck - Whether to disable PHP syntax checking.\n * @property {Object} indentInnerHtml - Whether to indent <head> and <body> sections in html.\n * @property {Object} extraLiners - Comma separated list of tags that should have an extra newline before them.\n * @property {Object} componentPrefix - Comma separated list of component prefixes use to preserve style in html attributes.\n * @property {Object} trailingCommaPHP - Whether to print trailing commas for php expression.\n * @property {Object} phpVersion - The version of PHP to use for formatting.\n * @since 1.0.0\n */\nexport const options = {\n\twrapAttributes: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"auto\",\n\t\tdescription:\n\t\t\t\"The way to wrap attributes. [auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned]\",\n\t\tsince: \"1.0.0\",\n\t},\n\twrapAttributesMinAttrs: {\n\t\ttype: \"int\",\n\t\tcategory: \"Blade\",\n\t\tdefault: 2,\n\t\tdescription:\n\t\t\t\"Minimum number of html tag attributes for force wrap attribute options. Wrap the first attribute only if 'force-expand-multiline' is specified in wrap attributes\",\n\t\tsince: \"1.11.0\",\n\t},\n\tendWithNewLine: {\n\t\ttype: \"boolean\",\n\t\tcategory: \"Blade\",\n\t\tdefault: true,\n\t\tdescription: \"End output with newline.\",\n\t\tsince: \"1.0.0\",\n\t},\n\tsortTailwindcssClasses: {\n\t\ttype: \"boolean\",\n\t\tcategory: \"Blade\",\n\t\tdefault: false,\n\t\tdescription:\n\t\t\t\"Sort Tailwindcss classes automatically. This option respects `tailwind.config.js`.\",\n\t\tsince: \"1.0.0\",\n\t},\n\ttailwindcssConfigPath: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"\",\n\t\tdescription:\n\t\t\t\"Path to custom Tailwindcss config. This option is available only when `sortTailwindcssClasses` is present.\",\n\t\tsince: \"1.5.7\",\n\t},\n\tsortHtmlAttributes: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"none\",\n\t\tdescription:\n\t\t\t\"Sort HTML Attributes. [none|alphabetical|code-guide|idiomatic|vuejs|custom]\",\n\t\tsince: \"1.5.0\",\n\t},\n\tcustomHtmlAttributesOrder: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"\",\n\t\tdescription:\n\t\t\t'Comma separated custom HTML attributes order. e.g. \"id, aria-.+, class, src\". To enable this you must specify sort html attributes option as `custom`. You can use regex for attribute names.',\n\t\tsince: \"1.8.0\",\n\t},\n\tnoPhpSyntaxCheck: {\n\t\ttype: \"boolean\",\n\t\tcategory: \"Blade\",\n\t\tdefault: false,\n\t\tdescription: \"Disable PHP syntax checking\",\n\t\tsince: \"1.7.0\",\n\t},\n\tindentInnerHtml: {\n\t\ttype: \"boolean\",\n\t\tcategory: \"Blade\",\n\t\tdefault: false,\n\t\tdescription: \"Indent <head> and <body> sections in html\",\n\t\tsince: \"1.10.0\",\n\t},\n\textraLiners: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"head,body,/html\",\n\t\tdescription:\n\t\t\t\"Comma separated list of tags that should have an extra newline before them.\",\n\t\tsince: \"1.10.0\",\n\t},\n\ttrailingCommaPHP: {\n\t\ttype: \"boolean\",\n\t\tcategory: \"Blade\",\n\t\tdefault: true,\n\t\tdescription:\n\t\t\t\"If set to false, no trailing commas are printed for php expression.\",\n\t\tsince: \"1.10.0\",\n\t},\n\tphpVersion: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"8.4\",\n\t\tdescription: \"The version of PHP to use for formatting.\",\n\t\tsince: \"1.13.0\",\n\t},\n\tcomponentPrefix: {\n\t\ttype: \"string\",\n\t\tcategory: \"Blade\",\n\t\tdefault: \"x-,livewire:\",\n\t\tdescription:\n\t\t\t\"Comma separated list of component prefix use to preserve style in html attributes.\",\n\t\tsince: \"1.15.0\",\n\t},\n};\n\n/**\n * Parses a PHP version string and returns a floating point number.\n *\n * @param {string} version - The PHP version string to parse.\n * @returns {number} The parsed PHP version as a floating point number.\n * @since 1.0.0\n */\nexport function parsePhpVersion(version: string): number {\n\treturn Number.parseFloat(version);\n}\n", "import { type Parser, type ParserOptions, resolveConfigFile } from \"prettier\";\nimport type { FormatterOption } from \"blade-formatter\";\nimport { Formatter } from \"blade-formatter\";\nimport path from \"node:path\";\nimport { parsePhpVersion } from \"./options\";\n\n/**\n * Parses the given Blade template text using the provided options and returns the formatted result.\n * @param text The Blade template text to parse and format.\n * @param parsers An object containing parsers to use for parsing the template.\n * @param opts The options to use for formatting the template.\n * @returns An object containing the formatted result, along with metadata about the original text.\n */\nexport const parse = async (\n\ttext: string,\n\tparsers: { [parserName: string]: Parser },\n\topts: ParserOptions & FormatterOption,\n) => {\n\tconst phpVersion = parsePhpVersion(opts.phpVersion);\n\n\tconst formatterOptions: FormatterOption = {\n\t\tindentSize: opts.tabWidth,\n\t\twrapLineLength: opts.printWidth,\n\t\twrapAttributes: opts.singleAttributePerLine\n\t\t\t? \"force-expand-multiline\"\n\t\t\t: opts.bracketSameLine\n\t\t\t\t? \"force-aligned\"\n\t\t\t\t: opts.wrapAttributes,\n\t\twrapAttributesMinAttrs: opts.wrapAttributesMinAttrs,\n\t\tendWithNewline: opts.endWithNewline,\n\t\tuseTabs: opts.useTabs,\n\t\tsortTailwindcssClasses: opts.sortTailwindcssClasses,\n\t\ttailwindcssConfigPath: await resolveTailwindConfigPath(\n\t\t\topts.filepath,\n\t\t\topts.tailwindcssConfigPath,\n\t\t),\n\t\tsortHtmlAttributes: opts.sortHtmlAttributes,\n\t\tnoMultipleEmptyLines: true,\n\t\tnoPhpSyntaxCheck: opts.noPhpSyntaxCheck,\n\t\tnoSingleQuote: !opts.singleQuote,\n\t\tnoTrailingCommaPhp: phpVersion < 7.2 || !opts.trailingCommaPHP,\n\t\tcustomHtmlAttributesOrder: opts.customHtmlAttributesOrder,\n\t\tindentInnerHtml: opts.indentInnerHtml,\n\t\tcomponentPrefix: opts.componentPrefix?.split(\",\"),\n\t\t// @ts-ignore\n\t\textraLiners: opts.extraLiners.split(\",\"),\n\t\tphpVersion: opts.phpVersion || \"auto\",\n\t};\n\n\tconst result = await new Formatter(formatterOptions).formatContent(text);\n\n\treturn {\n\t\ttype: \"blade-formatter\",\n\t\tbody: result,\n\t\tend: text.length,\n\t\tsource: text,\n\t\tstart: 0,\n\t};\n};\n\n/**\n * Resolves the path to the Tailwind CSS configuration file, if one is specified.\n * @param filepath The path to the Blade template file being formatted.\n * @param optionPath The path to the Tailwind CSS configuration file, as specified in the formatting options.\n * @returns The resolved path to the Tailwind CSS configuration file, or undefined if no path was specified.\n */\nasync function resolveTailwindConfigPath(\n\tfilepath: string | undefined,\n\toptionPath: string | undefined,\n): Promise<string | undefined> {\n\tif (!optionPath) {\n\t\treturn;\n\t}\n\n\tif (path.isAbsolute(optionPath ?? \"\")) {\n\t\treturn optionPath;\n\t}\n\n\tconst prettierRcPath = await resolveConfigFile(filepath);\n\n\treturn path.resolve(path.dirname(prettierRcPath ?? \"\"), optionPath ?? \"\");\n}\n", "import type { AstPath, Doc } from \"prettier\";\n\n/**\n * Returns a `Doc` representation of the given AST `path`.\n * @param path The AST path to print.\n * @returns A `Doc` representation of the AST node.\n * @throws An error if the AST node type is unknown.\n */\nexport const print = (path: AstPath): Doc => {\n\tconst node = path.getValue();\n\n\tswitch (node.type) {\n\t\tcase \"blade-formatter\": {\n\t\t\treturn node.body;\n\t\t}\n\t}\n\n\tthrow new Error(`Unknown node type: ${node.type}`);\n};\n"],
  "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,YAAAC,EAAA,YAAAC,EAAA,aAAAC,IAAA,eAAAC,EAAAP,GCgBO,IAAMQ,EAAiB,CAC7B,SAAU,EACV,WAAY,IACZ,YAAa,EACd,EAqBaC,EAAU,CACtB,eAAgB,CACf,KAAM,SACN,SAAU,QACV,QAAS,OACT,YACC,2HACD,MAAO,OACR,EACA,uBAAwB,CACvB,KAAM,MACN,SAAU,QACV,QAAS,EACT,YACC,oKACD,MAAO,QACR,EACA,eAAgB,CACf,KAAM,UACN,SAAU,QACV,QAAS,GACT,YAAa,2BACb,MAAO,OACR,EACA,uBAAwB,CACvB,KAAM,UACN,SAAU,QACV,QAAS,GACT,YACC,qFACD,MAAO,OACR,EACA,sBAAuB,CACtB,KAAM,SACN,SAAU,QACV,QAAS,GACT,YACC,6GACD,MAAO,OACR,EACA,mBAAoB,CACnB,KAAM,SACN,SAAU,QACV,QAAS,OACT,YACC,8EACD,MAAO,OACR,EACA,0BAA2B,CAC1B,KAAM,SACN,SAAU,QACV,QAAS,GACT,YACC,gMACD,MAAO,OACR,EACA,iBAAkB,CACjB,KAAM,UACN,SAAU,QACV,QAAS,GACT,YAAa,8BACb,MAAO,OACR,EACA,gBAAiB,CAChB,KAAM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,EACR,MAAO,CACR,CACD,EAQA,eAAeO,EACdC,EACAC,EAC8B,CAC9B,GAAI,CAACA,EACJ,OAGD,GAAI,EAAAC,QAAK,WAAWD,GAAc,EAAE,EACnC,OAAOA,EAGR,IAAME,EAAiB,QAAM,qBAAkBH,CAAQ,EAEvD,OAAO,EAAAE,QAAK,QAAQ,EAAAA,QAAK,QAAQC,GAAkB,EAAE,EAAGF,GAAc,EAAE,CACzE,CCzEO,IAAMG,EAASC,GAAuB,CAC5C,IAAMC,EAAOD,EAAK,SAAS,EAE3B,OAAQC,EAAK,KAAM,CAClB,IAAK,kBACJ,OAAOA,EAAK,IAEd,CAEA,MAAM,IAAI,MAAM,sBAAsBA,EAAK,IAAI,EAAE,CAClD,EHVO,IAAMC,EAA+B,CAC3C,CACC,KAAM,QACN,QAAS,CAAC,OAAO,EACjB,MAAO,QACP,WAAY,CAAC,YAAY,EACzB,QAAS,mBACT,QAAS,OACT,mBAAoB,GACpB,kBAAmB,CAAC,OAAO,CAC5B,CACD,EAKaC,EAAmC,CAC/C,MAAO,CAIN,MAAAC,EAIA,UAAW,eAQX,SAASC,EAAW,CACnB,OAAOA,EAAK,KACb,EAOA,OAAOA,EAAW,CACjB,OAAOA,EAAK,GACb,CACD,CACD,EAKaC,EAAqC,CACjD,eAAgB,CAIf,MAAAC,CACD,CACD",
  "names": ["index_exports", "__export", "defaultOptions", "languages", "options", "parsers", "printers", "__toCommonJS", "defaultOptions", "options", "parsePhpVersion", "version", "import_prettier", "import_blade_formatter", "import_node_path", "parse", "text", "parsers", "opts", "_a", "phpVersion", "parsePhpVersion", "formatterOptions", "resolveTailwindConfigPath", "filepath", "optionPath", "path", "prettierRcPath", "print", "path", "node", "languages", "parsers", "parse", "node", "printers", "print"]
}
