{
  "version": 3,
  "sources": ["../src/index.ts", "../src/parser.ts", "../src/options.ts", "../src/printer.ts"],
  "sourcesContent": ["import { parse } from \"./parser\";\nimport { print } from \"./printer\";\nimport { options, defaultOptions } from \"./options\";\nimport { Parser, Printer, SupportLanguage } from \"prettier\";\n\n/**\n * An array of supported languages by the plugin.\n */\nexport const languages: SupportLanguage[] = [\n  {\n    name: \"Blade\",\n    parsers: [\"blade\"],\n    since: \"1.0.0\",\n    extensions: [\".blade.php\"],\n    tmScope: \"source.blade.php\",\n    aceMode: \"text\",\n    linguistLanguageId: 33,\n    vscodeLanguageIds: [\"blade\"],\n  },\n];\n\n/**\n * An object containing the parser functions for each supported language.\n */\nexport const parsers: { [k: string]: Parser } = {\n  blade: {\n    /**\n     * The parse function for the Blade parser.\n     */\n    parse,\n    /**\n     * The AST format used by the Blade parser.\n     */\n    astFormat: \"blade-format\",\n    /**\n     * The function used to get the start location of a node in the AST.\n     * @param node The AST node.\n     * @returns The start location of the node.\n     */\n    locStart(node: any) {\n      return node.start;\n    },\n    /**\n     * The function used to get the end location of a node in the AST.\n     * @param node The AST node.\n     * @returns The end location of the node.\n     */\n    locEnd(node: any) {\n      return node.end;\n    },\n  },\n};\n\n/**\n * An object containing the printer functions for each AST format.\n */\nexport const printers: { [k: string]: Printer } = {\n  \"blade-format\": {\n    /**\n     * The print function for the Blade AST format.\n     */\n    print,\n  },\n};\n\nexport { options, defaultOptions };\n", "import { Parser, ParserOptions, resolveConfigFile } from \"prettier\";\nimport { FormatterOption } from \"blade-formatter\";\nimport { Formatter } from \"blade-formatter\";\nimport path from \"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  text: string,\n  parsers: { [parserName: string]: Parser },\n  opts: ParserOptions & FormatterOption,\n) => {\n  const phpVersion = parsePhpVersion(opts[\"phpVersion\"]);\n\n  const formatterOptions: FormatterOption = {\n    indentSize: opts[\"tabWidth\"],\n    wrapLineLength: opts[\"printWidth\"],\n    wrapAttributes: opts[\"singleAttributePerLine\"]\n      ? \"force-expand-multiline\"\n      : opts[\"bracketSameLine\"]\n        ? \"force-aligned\"\n        : opts[\"wrapAttributes\"],\n    wrapAttributesMinAttrs: opts[\"wrapAttributesMinAttrs\"],\n    endWithNewline: opts[\"endWithNewline\"],\n    useTabs: opts[\"useTabs\"],\n    sortTailwindcssClasses: opts[\"sortTailwindcssClasses\"],\n    tailwindcssConfigPath: await resolveTailwindConfigPath(opts[\"filepath\"], opts[\"tailwindcssConfigPath\"]),\n    sortHtmlAttributes: opts[\"sortHtmlAttributes\"],\n    noMultipleEmptyLines: true,\n    noPhpSyntaxCheck: opts[\"noPhpSyntaxCheck\"],\n    noSingleQuote: !opts[\"singleQuote\"],\n    noTrailingCommaPhp: phpVersion < 7.2 || !opts[\"trailingCommaPHP\"],\n    customHtmlAttributesOrder: opts[\"customHtmlAttributesOrder\"],\n    indentInnerHtml: opts[\"indentInnerHtml\"],\n    // @ts-ignore\n    extraLiners: opts[\"extraLiners\"].split(\",\"),\n  };\n\n  const result = await new Formatter(formatterOptions).formatContent(text);\n\n  return {\n    type: \"blade-formatter\",\n    body: result,\n    end: text.length,\n    source: text,\n    start: 0,\n  };\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  filepath: string | undefined,\n  optionPath: string | undefined,\n): Promise<string | undefined> {\n  if (!optionPath) {\n    return;\n  }\n\n  if (path.isAbsolute(optionPath ?? \"\")) {\n    return optionPath;\n  }\n\n  const prettierRcPath = await resolveConfigFile(filepath);\n\n  return path.resolve(path.dirname(prettierRcPath ?? \"\"), optionPath ?? \"\");\n}\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  tabWidth: 4,\n  printWidth: 120,\n  singleQuote: 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} 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  wrapAttributes: {\n    type: \"string\",\n    category: \"Blade\",\n    default: \"auto\",\n    description:\n      \"The way to wrap attributes. [auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned]\",\n    since: \"1.0.0\",\n  },\n  wrapAttributesMinAttrs: {\n    type: \"int\",\n    category: \"Blade\",\n    default: 2,\n    description:\n      \"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    since: \"1.11.0\",\n  },\n  endWithNewLine: {\n    type: \"boolean\",\n    category: \"Blade\",\n    default: true,\n    description: \"End output with newline.\",\n    since: \"1.0.0\",\n  },\n  sortTailwindcssClasses: {\n    type: \"boolean\",\n    category: \"Blade\",\n    default: false,\n    description: \"Sort Tailwindcss classes automatically. This option respects `tailwind.config.js`.\",\n    since: \"1.0.0\",\n  },\n  tailwindcssConfigPath: {\n    type: \"string\",\n    category: \"Blade\",\n    default: '',\n    description: \"Path to custom Tailwindcss config. This option is available only when `sortTailwindcssClasses` is present.\",\n    since: \"1.5.7\",\n  },\n  sortHtmlAttributes: {\n    type: \"string\",\n    category: \"Blade\",\n    default: \"none\",\n    description: \"Sort HTML Attributes. [none|alphabetical|code-guide|idiomatic|vuejs|custom]\",\n    since: \"1.5.0\",\n  },\n  customHtmlAttributesOrder: {\n    type: \"string\",\n    category: \"Blade\",\n    default: \"\",\n    description: \"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    since: \"1.8.0\",\n  },\n  noPhpSyntaxCheck: {\n    type: \"boolean\",\n    category: \"Blade\",\n    default: false,\n    description: \"Disable PHP syntax checking\",\n    since: \"1.7.0\",\n  },\n  indentInnerHtml: {\n    type: \"boolean\",\n    category: \"Blade\",\n    default: false,\n    description: \"Indent <head> and <body> sections in html\",\n    since: \"1.10.0\",\n  },\n  extraLiners: {\n    type: \"string\",\n    category: \"Blade\",\n    default: \"head,body,/html\",\n    description: \"Comma separated list of tags that should have an extra newline before them.\",\n    since: \"1.10.0\",\n  },\n  trailingCommaPHP: {\n    type: \"boolean\",\n    category: \"Blade\",\n    default: true,\n    description: \"If set to false, no trailing commas are printed for php expression.\",\n    since: \"1.10.0\",\n  },\n  phpVersion: {\n    type: \"string\",\n    category: \"Blade\",\n    default: \"8.1\",\n    description: \"The version of PHP to use for formatting.\",\n    since: \"1.13.0\",\n  },\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  return parseFloat(version);\n}\n", "import { 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  const node = path.getValue();\n\n  switch (node.type) {\n    case \"blade-formatter\": {\n      return node.body;\n    }\n  }\n\n  throw 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,GCAA,IAAAQ,EAAyD,oBAEzDC,EAA0B,2BAC1BC,EAAiB,qBCaV,IAAMC,EAAiB,CAC5B,SAAU,EACV,WAAY,IACZ,YAAa,EACf,EAoBaC,EAAU,CACrB,eAAgB,CACd,KAAM,SACN,SAAU,QACV,QAAS,OACT,YACE,2HACF,MAAO,OACT,EACA,uBAAwB,CACtB,KAAM,MACN,SAAU,QACV,QAAS,EACT,YACE,oKACF,MAAO,QACT,EACA,eAAgB,CACd,KAAM,UACN,SAAU,QACV,QAAS,GACT,YAAa,2BACb,MAAO,OACT,EACA,uBAAwB,CACtB,KAAM,UACN,SAAU,QACV,QAAS,GACT,YAAa,qFACb,MAAO,OACT,EACA,sBAAuB,CACrB,KAAM,SACN,SAAU,QACV,QAAS,GACT,YAAa,6GACb,MAAO,OACT,EACA,mBAAoB,CAClB,KAAM,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,MAAO,CACT,CACF,EAQA,eAAeM,EACbC,EACAC,EAC6B,CAC7B,GAAI,CAACA,EACH,OAGF,GAAI,EAAAC,QAAK,WAAWD,GAAc,EAAE,EAClC,OAAOA,EAGT,IAAME,EAAiB,QAAM,qBAAkBH,CAAQ,EAEvD,OAAO,EAAAE,QAAK,QAAQ,EAAAA,QAAK,QAAQC,GAAkB,EAAE,EAAGF,GAAc,EAAE,CAC1E,CEpEO,IAAMG,EAASC,GAAuB,CAC3C,IAAMC,EAAOD,EAAK,SAAS,EAE3B,OAAQC,EAAK,KAAM,CACjB,IAAK,kBACH,OAAOA,EAAK,IAEhB,CAEA,MAAM,IAAI,MAAM,sBAAsBA,EAAK,IAAI,EAAE,CACnD,EHVO,IAAMC,EAA+B,CAC1C,CACE,KAAM,QACN,QAAS,CAAC,OAAO,EACjB,MAAO,QACP,WAAY,CAAC,YAAY,EACzB,QAAS,mBACT,QAAS,OACT,mBAAoB,GACpB,kBAAmB,CAAC,OAAO,CAC7B,CACF,EAKaC,EAAmC,CAC9C,MAAO,CAIL,MAAAC,EAIA,UAAW,eAMX,SAASC,EAAW,CAClB,OAAOA,EAAK,KACd,EAMA,OAAOA,EAAW,CAChB,OAAOA,EAAK,GACd,CACF,CACF,EAKaC,EAAqC,CAChD,eAAgB,CAId,MAAAC,CACF,CACF",
  "names": ["src_exports", "__export", "defaultOptions", "languages", "options", "parsers", "printers", "__toCommonJS", "import_prettier", "import_blade_formatter", "import_path", "defaultOptions", "options", "parsePhpVersion", "version", "parse", "text", "parsers", "opts", "phpVersion", "parsePhpVersion", "formatterOptions", "resolveTailwindConfigPath", "filepath", "optionPath", "path", "prettierRcPath", "print", "path", "node", "languages", "parsers", "parse", "node", "printers", "print"]
}
