prettier-plugin-embed
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -11,3 +11,6 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>; | ||
declare const CSS_PARSERS: readonly ["css", "less", "scss"]; | ||
type CssParser = (typeof CSS_PARSERS)[number]; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedCssParser"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -25,2 +28,12 @@ } | ||
}; | ||
readonly embeddedCssParser: { | ||
category: string; | ||
type: "choice"; | ||
default: "scss"; | ||
description: string; | ||
choices: { | ||
value: "css" | "less" | "scss"; | ||
description: string; | ||
}[]; | ||
}; | ||
}; | ||
@@ -35,2 +48,3 @@ type Options = typeof options; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_PARSER]?: CssParser; | ||
} | ||
@@ -37,0 +51,0 @@ } |
@@ -11,3 +11,6 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>; | ||
declare const MARKDOWN_PARSERS: readonly ["markdown", "mdx", "remark"]; | ||
type MarkdownParser = (typeof MARKDOWN_PARSERS)[number]; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedMarkdownIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedMarkdownParser"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -26,2 +29,12 @@ __inJsTemplate?: boolean; | ||
}; | ||
readonly embeddedMarkdownParser: { | ||
category: string; | ||
type: "choice"; | ||
default: "markdown"; | ||
description: string; | ||
choices: { | ||
value: "markdown" | "mdx" | "remark"; | ||
description: string; | ||
}[]; | ||
}; | ||
}; | ||
@@ -36,2 +49,3 @@ type Options = typeof options; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_PARSER]?: MarkdownParser; | ||
} | ||
@@ -38,0 +52,0 @@ } |
@@ -8,12 +8,12 @@ import type { EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers } from "./types.js"; | ||
import * as __glob__0_1 from "./es/index.js"; | ||
import * as __glob__0_2 from "./glsl/index.js"; | ||
import * as __glob__0_3 from "./graphql/index.js"; | ||
import * as __glob__0_4 from "./html/index.js"; | ||
import * as __glob__0_2 from "./html/index.js"; | ||
import * as __glob__0_3 from "./glsl/index.js"; | ||
import * as __glob__0_4 from "./graphql/index.js"; | ||
import * as __glob__0_5 from "./ini/index.js"; | ||
import * as __glob__0_6 from "./json/index.js"; | ||
import * as __glob__0_7 from "./latex/index.js"; | ||
import * as __glob__0_8 from "./noop/index.js"; | ||
import * as __glob__0_9 from "./php/index.js"; | ||
import * as __glob__0_8 from "./markdown/index.js"; | ||
import * as __glob__0_9 from "./noop/index.js"; | ||
import * as __glob__0_10 from "./properties/index.js"; | ||
import * as __glob__0_11 from "./markdown/index.js"; | ||
import * as __glob__0_11 from "./php/index.js"; | ||
import * as __glob__0_12 from "./ruby/index.js"; | ||
@@ -20,0 +20,0 @@ import * as __glob__0_13 from "./sh/index.js"; |
1124
dist/index.js
@@ -1,2 +0,2 @@ | ||
import { utils as X, builders as D } from "prettier/doc"; | ||
import { utils as Y, builders as I } from "prettier/doc"; | ||
import wt from "prettier/parser-babel"; | ||
@@ -12,9 +12,9 @@ import Bt from "prettier/parser-espree"; | ||
import { resolveConfigFile as Yt } from "prettier"; | ||
const { group: Qt, indent: Vt, softline: ce, lineSuffixBoundary: Zt } = D, { mapDoc: en } = X; | ||
const { group: Qt, indent: Vt, softline: le, lineSuffixBoundary: Zt } = I, { mapDoc: en } = Y; | ||
function tn(t, n) { | ||
const { node: r } = t; | ||
let e = n(); | ||
return r?.comments?.length && (e = Qt([Vt([ce, e]), ce])), ["${", e, Zt, "}"]; | ||
return r?.comments?.length && (e = Qt([Vt([le, e]), le])), ["${", e, Zt, "}"]; | ||
} | ||
function x(t, n) { | ||
function S(t, n) { | ||
return t.map( | ||
@@ -26,6 +26,6 @@ (r) => tn(r, n), | ||
function L(t, n, r) { | ||
return en(t, (o) => { | ||
if (typeof o != "string") | ||
return o; | ||
const s = [], l = o.split(n); | ||
return en(t, (s) => { | ||
if (typeof s != "string") | ||
return s; | ||
const o = [], l = s.split(n); | ||
for (let a = 0; a < l.length; a++) { | ||
@@ -36,9 +36,9 @@ let g = l[a]; | ||
continue; | ||
g = g.replaceAll(/([\\`]|\${)/g, "\\$1"), s.push(g); | ||
g = g.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(g); | ||
} else { | ||
const c = Number(g); | ||
s.push(r[c]); | ||
o.push(r[c]); | ||
} | ||
} | ||
return s; | ||
return o; | ||
}); | ||
@@ -61,10 +61,10 @@ } | ||
} | ||
let e = 0, o = t.length; | ||
for (; e < o; ) { | ||
const s = e + o >>> 1; | ||
if (t[s] === r) { | ||
let e = 0, s = t.length; | ||
for (; e < s; ) { | ||
const o = e + s >>> 1; | ||
if (t[o] === r) { | ||
t.push(n); | ||
return; | ||
} | ||
t[s] < n ? e = s + 1 : o = s; | ||
t[o] < n ? e = o + 1 : s = o; | ||
} | ||
@@ -82,5 +82,5 @@ t.splice(e, 0, n); | ||
})(); | ||
function S(t = "p", n = "") { | ||
const r = Q(), e = Q(), o = te(t), s = te(n), l = (g) => `${t}${r}${g}${e}${n}`, a = new RegExp( | ||
`${o}${r}(\\d+)${e}${s}`, | ||
function x(t = "p", n = "") { | ||
const r = Q(), e = Q(), s = te(t), o = te(n), l = (g) => `${t}${r}${g}${e}${n}`, a = new RegExp( | ||
`${s}${r}(\\d+)${e}${o}`, | ||
"ig" | ||
@@ -102,11 +102,11 @@ ); | ||
} | ||
function Y(t) { | ||
function O(t) { | ||
return `${t}Parser`; | ||
} | ||
const { line: de, group: O, indent: le, softline: ue } = D, on = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
const { line: ue, group: P, indent: ge, softline: me } = I, sn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S("@p"), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x("@p"), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -116,40 +116,50 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "scss" | ||
parser: e.embeddedCssParser ?? "scss" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return O([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return P([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [O(i)] : le([O(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(i)] : ge([P(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? de : ue, v = u.length ? de : ue; | ||
return O([ | ||
const h = d.length ? ue : me, v = u.length ? ue : me; | ||
return P([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, O(i)] : le([h, O(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, P(i)] : ge([h, P(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, pt = "embeddedCss", sn = ["css"], an = T(pt), cn = { | ||
[an]: { | ||
}, ne = "embeddedCss", on = ["css"], an = ["css", "less", "scss"], cn = T(ne), dn = O(ne), ln = { | ||
[cn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...sn] }], | ||
default: [{ value: [...on] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language." | ||
}, | ||
[dn]: { | ||
category: "Embed", | ||
type: "choice", | ||
default: "scss", | ||
description: "The parser used to parse the embedded CSS language.", | ||
choices: an.map((t) => ({ | ||
value: t, | ||
description: `Use the "${t}" parser.` | ||
})) | ||
} | ||
}, dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: on, | ||
language: pt, | ||
options: cn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: ge, group: P, indent: me, softline: pe } = D, ln = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: sn, | ||
language: ne, | ||
options: ln | ||
}, Symbol.toStringTag, { value: "Module" })), { line: pe, group: M, indent: he, softline: fe } = I, gn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -159,22 +169,22 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: e.embeddedEsParser ?? "babel" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return P([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return M([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [P(i)] : me([P(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(i)] : he([M(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? ge : pe, v = u.length ? ge : pe; | ||
return P([ | ||
const h = d.length ? pe : fe, v = u.length ? pe : fe; | ||
return M([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, P(i)] : me([h, P(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, M(i)] : he([h, M(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, ne = "embeddedEs", un = [ | ||
}, re = "embeddedEs", mn = [ | ||
"js", | ||
@@ -188,3 +198,3 @@ "jsx", | ||
"javascript" | ||
], gn = [ | ||
], pn = [ | ||
"babel", | ||
@@ -196,11 +206,11 @@ "babel-flow", | ||
"meriyah" | ||
], mn = T(ne), pn = Y(ne), hn = { | ||
[mn]: { | ||
], hn = T(re), fn = O(re), bn = { | ||
[hn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...un] }], | ||
default: [{ value: [...mn] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language." | ||
}, | ||
[pn]: { | ||
[fn]: { | ||
category: "Embed", | ||
@@ -210,3 +220,3 @@ type: "choice", | ||
description: "The parser used to parse the embedded ECMASCript/JavaScript language.", | ||
choices: gn.map((t) => ({ | ||
choices: pn.map((t) => ({ | ||
value: t, | ||
@@ -216,13 +226,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: ln, | ||
language: ne, | ||
options: hn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: he, group: M, indent: fe, softline: be } = D, bn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("prettier-plugin-glsl", e, o), e = { | ||
embedder: gn, | ||
language: re, | ||
options: bn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: be, group: N, indent: Ee, softline: ye } = I, yn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-glsl", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -232,40 +242,40 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "glsl-parser" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return M([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return N([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [M(i)] : fe([M(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(i)] : Ee([N(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? he : be, v = u.length ? he : be; | ||
return M([ | ||
const h = d.length ? be : ye, v = u.length ? be : ye; | ||
return N([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, M(i)] : fe([h, M(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, N(i)] : Ee([h, N(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, ht = "embeddedGlsl", En = ["glsl", "shader"], yn = T(ht), _n = { | ||
[yn]: { | ||
}, ft = "embeddedGlsl", _n = ["glsl", "shader"], vn = T(ft), $n = { | ||
[vn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...En] }], | ||
default: [{ value: [..._n] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin." | ||
} | ||
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: bn, | ||
language: ht, | ||
options: _n | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ee, group: N, indent: ye, softline: _e } = D, $n = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: yn, | ||
language: ft, | ||
options: $n | ||
}, Symbol.toStringTag, { value: "Module" })), { line: _e, group: R, indent: ve, softline: $e } = I, In = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -275,40 +285,40 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "graphql" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return N([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return R([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [N(i)] : ye([N(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(i)] : ve([R(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Ee : _e, v = u.length ? Ee : _e; | ||
return N([ | ||
const h = d.length ? _e : $e, v = u.length ? _e : $e; | ||
return R([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, N(i)] : ye([h, N(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, R(i)] : ve([h, R(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, ft = "embeddedGraphql", In = ["graphql", "gql"], Dn = T(ft), Tn = { | ||
[Dn]: { | ||
}, bt = "embeddedGraphql", Tn = ["graphql", "gql"], Sn = T(bt), xn = { | ||
[Sn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...In] }], | ||
default: [{ value: [...Tn] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language." | ||
} | ||
}, xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: $n, | ||
language: ft, | ||
options: Tn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: ve, group: R, indent: $e, softline: Ie } = D, { mapDoc: Sn } = X, Ln = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: In, | ||
language: bt, | ||
options: xn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: De, group: F, indent: Ie, softline: Te } = I, { mapDoc: kn } = Y, An = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -318,6 +328,6 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: e.embeddedHtmlParser ?? "html" | ||
}), i = Sn(b, (p) => { | ||
}), i = kn(b, (p) => { | ||
if (typeof p != "string") | ||
@@ -333,4 +343,4 @@ return p; | ||
} else { | ||
const I = Number(_); | ||
m.push(E[I]); | ||
const D = Number(_); | ||
m.push(E[D]); | ||
} | ||
@@ -341,26 +351,26 @@ } | ||
if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here? | ||
e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return R([ | ||
e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return F([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [R(i)] : $e([R(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(i)] : Ie([F(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? ve : Ie, v = u.length ? ve : Ie; | ||
return R([ | ||
const h = d.length ? De : Te, v = u.length ? De : Te; | ||
return F([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, R(i)] : $e([h, R(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, F(i)] : Ie([h, F(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, re = "embeddedHtml", kn = ["html", "xhtml"], An = ["html", "vue", "angular", "lwc"], On = T(re), Pn = Y(re), Mn = { | ||
[On]: { | ||
}, se = "embeddedHtml", On = ["html", "xhtml"], Pn = ["html", "vue", "angular", "lwc"], Mn = T(se), Nn = O(se), Rn = { | ||
[Mn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...kn] }], | ||
default: [{ value: [...On] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language." | ||
}, | ||
[Pn]: { | ||
[Nn]: { | ||
category: "Embed", | ||
@@ -370,3 +380,3 @@ type: "choice", | ||
description: "The parser used to parse the embedded HTML language.", | ||
choices: An.map((t) => ({ | ||
choices: Pn.map((t) => ({ | ||
value: t, | ||
@@ -376,13 +386,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, Nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Ln, | ||
language: re, | ||
options: Mn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: De, group: F, indent: Te, softline: xe } = D, Rn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("prettier-plugin-ini", e, o), e = { | ||
embedder: An, | ||
language: se, | ||
options: Rn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Se, group: j, indent: xe, softline: Le } = I, jn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-ini", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -392,40 +402,40 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "ini" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return F([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return j([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : Te([F(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(i)] : xe([j(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? De : xe, v = u.length ? De : xe; | ||
return F([ | ||
const h = d.length ? Se : Le, v = u.length ? Se : Le; | ||
return j([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] : Te([h, F(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, j(i)] : xe([h, j(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, bt = "embeddedIni", Fn = ["ini", "cfg", "pro"], jn = T(bt), wn = { | ||
[jn]: { | ||
}, Et = "embeddedIni", wn = ["ini", "cfg", "pro"], Bn = T(Et), Un = { | ||
[Bn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Fn] }], | ||
default: [{ value: [...wn] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin." | ||
} | ||
}, Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Rn, | ||
language: bt, | ||
options: wn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Se, group: j, indent: Le, softline: ke } = D, Un = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: jn, | ||
language: Et, | ||
options: Un | ||
}, Symbol.toStringTag, { value: "Module" })), { line: ke, group: w, indent: Ae, softline: Oe } = I, Cn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = qn(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = Wn(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -435,18 +445,18 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: e.embeddedJsonParser ?? "json" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return j([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return w([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [j(i)] : Le([j(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(i)] : Ae([w(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Se : ke, v = u.length ? Se : ke; | ||
return j([ | ||
const h = d.length ? ke : Oe, v = u.length ? ke : Oe; | ||
return w([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, j(i)] : Le([h, j(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, w(i)] : Ae([h, w(i)]), | ||
v, | ||
@@ -456,4 +466,4 @@ "`" | ||
}; | ||
function qn() { | ||
const t = Q(), n = Q(), r = (o) => `'0${t}${o}${n}'`, e = new RegExp( | ||
function Wn() { | ||
const t = Q(), n = Q(), r = (s) => `'0${t}${s}${n}'`, e = new RegExp( | ||
`["']?0${t}(\\d+)${n}['"]?`, | ||
@@ -467,11 +477,11 @@ "ig" | ||
} | ||
const oe = "embeddedJson", Cn = ["json", "jsonl"], Wn = ["json", "json5", "jsonc", "json-stringify"], Gn = Y(oe), zn = T(oe), Kn = { | ||
[zn]: { | ||
const oe = "embeddedJson", Gn = ["json", "jsonl"], zn = ["json", "json5", "jsonc", "json-stringify"], Kn = O(oe), Hn = T(oe), Jn = { | ||
[Hn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Cn] }], | ||
default: [{ value: [...Gn] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language." | ||
}, | ||
[Gn]: { | ||
[Kn]: { | ||
category: "Embed", | ||
@@ -481,3 +491,3 @@ type: "choice", | ||
description: "The parser used to parse the embedded JSON language.", | ||
choices: Wn.map((t) => ({ | ||
choices: zn.map((t) => ({ | ||
value: t, | ||
@@ -487,13 +497,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Un, | ||
embedder: Cn, | ||
language: oe, | ||
options: Kn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ae, group: w, indent: Oe, softline: Pe } = D, Jn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("prettier-plugin-latex", e, o), e = { | ||
options: Jn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Pe, group: B, indent: Me, softline: Ne } = I, Yn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-latex", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -503,22 +513,22 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "latex-parser" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return w([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return B([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [w(i)] : Oe([w(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [B(i)] : Me([B(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Ae : Pe, v = u.length ? Ae : Pe; | ||
return w([ | ||
const h = d.length ? Pe : Ne, v = u.length ? Pe : Ne; | ||
return B([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, w(i)] : Oe([h, w(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, B(i)] : Me([h, B(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, Et = "embeddedLatex", Xn = [ | ||
}, yt = "embeddedLatex", Qn = [ | ||
"latex", | ||
@@ -532,21 +542,21 @@ "tex", | ||
"sty" | ||
], Yn = T(Et), Qn = { | ||
[Yn]: { | ||
], Vn = T(yt), Zn = { | ||
[Vn]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Xn] }], | ||
default: [{ value: [...Qn] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin." | ||
} | ||
}, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Jn, | ||
language: Et, | ||
options: Qn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Me, group: B, indent: Ne, softline: Re } = D, Zn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: Yn, | ||
language: yt, | ||
options: Zn | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Re, group: U, indent: Fe, softline: je } = I, tr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -556,37 +566,47 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "markdown", | ||
parser: e.embeddedMarkdownParser ?? "markdown", | ||
__inJsTemplate: !0 | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return B([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return U([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [B(i)] : Ne([B(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [U(i)] : Fe([U(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Me : Re, v = u.length ? Me : Re; | ||
return B([ | ||
const h = d.length ? Re : je, v = u.length ? Re : je; | ||
return U([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, B(i)] : Ne([h, B(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, U(i)] : Fe([h, U(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, yt = "embeddedMarkdown", er = ["md", "markdown"], tr = T(yt), nr = { | ||
[tr]: { | ||
}, ie = "embeddedMarkdown", nr = ["md", "markdown"], rr = ["markdown", "mdx", "remark"], sr = T(ie), or = O(ie), ir = { | ||
[sr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...er] }], | ||
default: [{ value: [...nr] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language." | ||
}, | ||
[or]: { | ||
category: "Embed", | ||
type: "choice", | ||
default: "markdown", | ||
description: "The parser used to parse the embedded Markdown language.", | ||
choices: rr.map((t) => ({ | ||
value: t, | ||
description: `Use the "${t}" parser.` | ||
})) | ||
} | ||
}, rr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Zn, | ||
language: yt, | ||
options: nr | ||
}, Symbol.toStringTag, { value: "Module" })), se = "embeddedNoop", or = T(se), sr = { | ||
[or]: { | ||
embedder: tr, | ||
language: ie, | ||
options: ir | ||
}, Symbol.toStringTag, { value: "Module" })), ae = "embeddedNoop", cr = T(ae), dr = { | ||
[cr]: { | ||
category: "Embed", | ||
@@ -598,12 +618,12 @@ type: "string", | ||
} | ||
}, ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
language: se, | ||
options: sr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Fe, group: U, indent: je, softline: we } = D, ar = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("@prettier/plugin-php", e, o), e = { | ||
language: ae, | ||
options: dr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: q, indent: Be, softline: Ue } = I, ur = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("@prettier/plugin-php", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S("$p"), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x("$p"), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -613,40 +633,40 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "php" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return U([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return q([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [U(i)] : je([U(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [q(i)] : Be([q(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Fe : we, v = u.length ? Fe : we; | ||
return U([ | ||
const h = d.length ? we : Ue, v = u.length ? we : Ue; | ||
return q([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, U(i)] : je([h, U(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, q(i)] : Be([h, q(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, _t = "embeddedPhp", cr = ["php", "php5"], dr = T(_t), lr = { | ||
[dr]: { | ||
}, _t = "embeddedPhp", gr = ["php", "php5"], mr = T(_t), pr = { | ||
[mr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...cr] }], | ||
default: [{ value: [...gr] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin." | ||
} | ||
}, ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: ar, | ||
embedder: ur, | ||
language: _t, | ||
options: lr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Be, group: q, indent: Ue, softline: qe } = D, gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("prettier-plugin-properties", e, o), e = { | ||
options: pr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: qe, group: C, indent: Ce, softline: We } = I, fr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-properties", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -656,40 +676,40 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "dot-properties" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return q([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return C([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [q(i)] : Ue([q(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(i)] : Ce([C(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Be : qe, v = u.length ? Be : qe; | ||
return q([ | ||
const h = d.length ? qe : We, v = u.length ? qe : We; | ||
return C([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, q(i)] : Ue([h, q(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(i)] : Ce([h, C(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, vt = "embeddedProperties", mr = ["properties"], pr = T(vt), hr = { | ||
[pr]: { | ||
}, vt = "embeddedProperties", br = ["properties"], Er = T(vt), yr = { | ||
[Er]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...mr] }], | ||
default: [{ value: [...br] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin." | ||
} | ||
}, fr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: gr, | ||
embedder: fr, | ||
language: vt, | ||
options: hr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ce, group: C, indent: We, softline: Ge } = D, br = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("@prettier/plugin-ruby", e, o), e = { | ||
options: yr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ge, group: W, indent: ze, softline: Ke } = I, vr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("@prettier/plugin-ruby", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -699,30 +719,30 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: e.embeddedRubyParser ?? "ruby" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return C([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return W([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [C(i)] : We([C(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [W(i)] : ze([W(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Ce : Ge, v = u.length ? Ce : Ge; | ||
return C([ | ||
const h = d.length ? Ge : Ke, v = u.length ? Ge : Ke; | ||
return W([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, C(i)] : We([h, C(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, W(i)] : ze([h, W(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, $t = "embeddedRuby", Er = ["ruby"], yr = ["ruby", "rbs", "haml"], _r = "embeddedRubyParser", vr = T($t), $r = { | ||
[vr]: { | ||
}, $t = "embeddedRuby", $r = ["ruby"], Dr = ["ruby", "rbs", "haml"], Ir = "embeddedRubyParser", Tr = T($t), Sr = { | ||
[Tr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Er] }], | ||
default: [{ value: [...$r] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin." | ||
}, | ||
[_r]: { | ||
[Ir]: { | ||
category: "Embed", | ||
@@ -732,3 +752,3 @@ type: "choice", | ||
description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.", | ||
choices: yr.map((t) => ({ | ||
choices: Dr.map((t) => ({ | ||
value: t, | ||
@@ -738,13 +758,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: br, | ||
embedder: vr, | ||
language: $t, | ||
options: $r | ||
}, Symbol.toStringTag, { value: "Module" })), { hardline: Dr, group: W, line: ze, softline: Ke, indent: He } = D, { mapDoc: Tr } = X, xr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
options: Sr | ||
}, Symbol.toStringTag, { value: "Module" })), { hardline: Lr, group: G, line: He, softline: Je, indent: Xe } = I, { mapDoc: kr } = Y, Ar = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -754,6 +774,6 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "sh" | ||
}), i = Tr(b, (p) => { | ||
}), i = kr(b, (p) => { | ||
if (typeof p != "string") | ||
@@ -767,7 +787,7 @@ return p; | ||
continue; | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((I) => I === ` | ||
` ? m.push(Dr) : m.push(I)); | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === ` | ||
` ? m.push(Lr) : m.push(D)); | ||
} else { | ||
const I = Number(_); | ||
m.push(E[I]); | ||
const D = Number(_); | ||
m.push(E[D]); | ||
} | ||
@@ -777,37 +797,37 @@ } | ||
}); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return W([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return G([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [W(i)] : He([W(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [G(i)] : Xe([G(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? ze : Ke, v = u.length ? ze : Ke; | ||
return W([ | ||
const h = d.length ? He : Je, v = u.length ? He : Je; | ||
return G([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, W(i)] : He([h, W(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, G(i)] : Xe([h, G(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, It = "embeddedSh", Sr = ["sh"], Lr = T(It), kr = { | ||
[Lr]: { | ||
}, Dt = "embeddedSh", Or = ["sh"], Pr = T(Dt), Mr = { | ||
[Pr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Sr] }], | ||
default: [{ value: [...Or] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin." | ||
} | ||
}, Ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: xr, | ||
language: It, | ||
options: kr | ||
embedder: Ar, | ||
language: Dt, | ||
options: Mr | ||
}, Symbol.toStringTag, { value: "Module" })); | ||
function Je(t, n) { | ||
function Ye(t, n) { | ||
var r = Object.keys(t); | ||
if (Object.getOwnPropertySymbols) { | ||
var e = Object.getOwnPropertySymbols(t); | ||
n && (e = e.filter(function(o) { | ||
return Object.getOwnPropertyDescriptor(t, o).enumerable; | ||
n && (e = e.filter(function(s) { | ||
return Object.getOwnPropertyDescriptor(t, s).enumerable; | ||
})), r.push.apply(r, e); | ||
@@ -817,8 +837,8 @@ } | ||
} | ||
function Xe(t) { | ||
function Qe(t) { | ||
for (var n = 1; n < arguments.length; n++) { | ||
var r = arguments[n] != null ? arguments[n] : {}; | ||
n % 2 ? Je(Object(r), !0).forEach(function(e) { | ||
Or(t, e, r[e]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Je(Object(r)).forEach(function(e) { | ||
n % 2 ? Ye(Object(r), !0).forEach(function(e) { | ||
Rr(t, e, r[e]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ye(Object(r)).forEach(function(e) { | ||
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e)); | ||
@@ -829,10 +849,10 @@ }); | ||
} | ||
function Or(t, n, r) { | ||
return n = Pr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t; | ||
function Rr(t, n, r) { | ||
return n = Fr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t; | ||
} | ||
function Pr(t) { | ||
var n = Mr(t, "string"); | ||
function Fr(t) { | ||
var n = jr(t, "string"); | ||
return typeof n == "symbol" ? n : String(n); | ||
} | ||
function Mr(t, n) { | ||
function jr(t, n) { | ||
if (typeof t != "object" || t === null) | ||
@@ -849,13 +869,13 @@ return t; | ||
} | ||
const Nr = Dt({}); | ||
function Dt(t) { | ||
return n.withOptions = (r) => Dt(Xe(Xe({}, t), r)), n; | ||
const wr = It({}); | ||
function It(t) { | ||
return n.withOptions = (r) => It(Qe(Qe({}, t), r)), n; | ||
function n(r, ...e) { | ||
const o = typeof r == "string" ? [r] : r.raw, { | ||
escapeSpecialCharacters: s = Array.isArray(r) | ||
const s = typeof r == "string" ? [r] : r.raw, { | ||
escapeSpecialCharacters: o = Array.isArray(r) | ||
} = t; | ||
let l = ""; | ||
for (let c = 0; c < o.length; c++) { | ||
let d = o[c]; | ||
s && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), l += d, c < e.length && (l += e[c]); | ||
for (let c = 0; c < s.length; c++) { | ||
let d = s[c]; | ||
o && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), l += d, c < e.length && (l += e[c]); | ||
} | ||
@@ -881,10 +901,10 @@ const a = l.split(` | ||
} | ||
const { hardline: Rr, group: G, line: Ye, softline: Qe, indent: Ve } = D, { mapDoc: Fr } = X, jr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
const { hardline: Br, group: z, line: Ve, softline: Ze, indent: et } = I, { mapDoc: Ur } = Y, qr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const l = e.embeddedSqlPlugin ?? "prettier-plugin-sql"; | ||
A(l, e, o); | ||
const { node: a } = r, { createPlaceholder: g, placeholderRegex: c } = S(), d = a.quasis.map( | ||
A(l, e, s); | ||
const { node: a } = r, { createPlaceholder: g, placeholderRegex: c } = x(), d = a.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + g(m) | ||
@@ -894,3 +914,3 @@ ).join(""), u = d.match(/^\s+/)?.[0] ?? "", y = d.match(/\s+$/)?.[0] ?? "", E = d.slice( | ||
-y.length || void 0 | ||
), b = x(r, n); | ||
), b = S(r, n); | ||
let i; | ||
@@ -904,7 +924,7 @@ if (l === "prettier-plugin-sql-cst") { | ||
} else { | ||
const p = await t(Nr(E), { | ||
const p = await t(wr(E), { | ||
...e, | ||
parser: "sql" | ||
}); | ||
i = Fr(p, (m) => { | ||
i = Ur(p, (m) => { | ||
if (typeof m != "string") | ||
@@ -914,12 +934,12 @@ return m; | ||
for (let _ = 0; _ < $.length; _++) { | ||
let I = $[_]; | ||
let D = $[_]; | ||
if (_ % 2 == 0) { | ||
if (!I) | ||
if (!D) | ||
continue; | ||
I = I.replaceAll(/([\\`]|\${)/g, "\\$1"), I.split(/(\n)/).forEach( | ||
D = D.replaceAll(/([\\`]|\${)/g, "\\$1"), D.split(/(\n)/).forEach( | ||
(k) => k === ` | ||
` ? f.push(Rr) : f.push(k) | ||
` ? f.push(Br) : f.push(k) | ||
); | ||
} else { | ||
const k = Number(I); | ||
const k = Number(D); | ||
f.push(b[k]); | ||
@@ -931,18 +951,18 @@ } | ||
} | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return G([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return z([ | ||
"`", | ||
u, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [G(i)] : Ve([G(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [z(i)] : et([z(i)]), | ||
y, | ||
"`" | ||
]); | ||
const h = u.length ? Ye : Qe, v = y.length ? Ye : Qe; | ||
return G([ | ||
const h = u.length ? Ve : Ze, v = y.length ? Ve : Ze; | ||
return z([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, G(i)] : Ve([h, G(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, z(i)] : et([h, z(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, Z = "embeddedSql", wr = ["sql"], Br = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Ur = [ | ||
}, Z = "embeddedSql", Cr = ["sql"], Wr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Gr = [ | ||
"sqlite", | ||
@@ -953,11 +973,11 @@ "bigquery", | ||
"postgresql" | ||
], qr = T(Z), Cr = rn(Z), Wr = Y(Z), Gr = { | ||
[qr]: { | ||
], zr = T(Z), Kr = rn(Z), Hr = O(Z), Jr = { | ||
[zr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...wr] }], | ||
default: [{ value: [...Cr] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin." | ||
}, | ||
[Cr]: { | ||
[Kr]: { | ||
category: "Embed", | ||
@@ -967,3 +987,3 @@ type: "choice", | ||
description: "The plugin used to format the embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.", | ||
choices: Br.map((t) => ({ | ||
choices: Wr.map((t) => ({ | ||
value: t, | ||
@@ -973,3 +993,3 @@ description: `Use the "${t}" plugin.` | ||
}, | ||
[Wr]: { | ||
[Hr]: { | ||
category: "Embed", | ||
@@ -979,3 +999,3 @@ type: "choice", | ||
description: "Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.", | ||
choices: Ur.map((t) => ({ | ||
choices: Gr.map((t) => ({ | ||
value: t, | ||
@@ -985,13 +1005,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: jr, | ||
embedder: qr, | ||
language: Z, | ||
options: Gr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ze, group: z, indent: et, softline: tt, hardline: Kr } = D, { mapDoc: Hr } = X, Jr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("prettier-plugin-toml", e, o), e = { | ||
options: Jr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt, hardline: Yr } = I, { mapDoc: Qr } = Y, Vr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-toml", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -1001,6 +1021,6 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "toml" | ||
}), i = Hr(b, (p) => { | ||
}), i = Qr(b, (p) => { | ||
if (typeof p != "string") | ||
@@ -1014,7 +1034,7 @@ return p; | ||
continue; | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((I) => I === ` | ||
` ? m.push(Kr) : m.push(I)); | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === ` | ||
` ? m.push(Yr) : m.push(D)); | ||
} else { | ||
const I = Number(_); | ||
m.push(E[I]); | ||
const D = Number(_); | ||
m.push(E[D]); | ||
} | ||
@@ -1024,36 +1044,36 @@ } | ||
}); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return z([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return K([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [z(i)] : et([z(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [K(i)] : nt([K(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? Ze : tt, v = u.length ? Ze : tt; | ||
return z([ | ||
const h = d.length ? tt : rt, v = u.length ? tt : rt; | ||
return K([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, z(i)] : et([h, z(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, K(i)] : nt([h, K(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, Tt = "embeddedToml", Xr = ["toml"], Yr = T(Tt), Qr = { | ||
[Yr]: { | ||
}, Tt = "embeddedToml", Zr = ["toml"], es = T(Tt), ts = { | ||
[es]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Xr] }], | ||
default: [{ value: [...Zr] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin." | ||
} | ||
}, Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Jr, | ||
embedder: Vr, | ||
language: Tt, | ||
options: Qr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: nt, group: K, indent: rt, softline: ot } = D, Zr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
options: ts | ||
}, Symbol.toStringTag, { value: "Module" })), { line: st, group: H, indent: ot, softline: it } = I, rs = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -1063,3 +1083,3 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
@@ -1071,26 +1091,26 @@ parser: e.embeddedTsParser ?? "typescript", | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return K([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return H([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [K(i)] : rt([K(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [H(i)] : ot([H(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? nt : ot, v = u.length ? nt : ot; | ||
return K([ | ||
const h = d.length ? st : it, v = u.length ? st : it; | ||
return H([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, K(i)] : rt([h, K(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, H(i)] : ot([h, H(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, ie = "embeddedTs", eo = ["ts", "tsx", "cts", "mts", "typescript"], to = ["typescript", "babel-ts"], no = Y(ie), ro = T(ie), oo = { | ||
[ro]: { | ||
}, ce = "embeddedTs", ss = ["ts", "tsx", "cts", "mts", "typescript"], os = ["typescript", "babel-ts"], is = O(ce), as = T(ce), cs = { | ||
[as]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...eo] }], | ||
default: [{ value: [...ss] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language." | ||
}, | ||
[no]: { | ||
[is]: { | ||
category: "Embed", | ||
@@ -1100,3 +1120,3 @@ type: "choice", | ||
description: "The parser used to parse the embedded TypeScript language.", | ||
choices: to.map((t) => ({ | ||
choices: os.map((t) => ({ | ||
value: t, | ||
@@ -1106,13 +1126,13 @@ description: `Use the "${t}" parser.` | ||
} | ||
}, so = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Zr, | ||
language: ie, | ||
options: oo | ||
}, Symbol.toStringTag, { value: "Module" })), ae = "embeddedXml", { line: st, group: H, indent: it, softline: ee } = D, io = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
A("@prettier/plugin-xml", e, o), e = { | ||
embedder: rs, | ||
language: ce, | ||
options: cs | ||
}, Symbol.toStringTag, { value: "Module" })), de = "embeddedXml", { line: at, group: J, indent: ct, softline: ee } = I, ls = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("@prettier/plugin-xml", e, s), e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(m, f, { length: $ }) => f === $ - 1 ? m.value.cooked : m.value.cooked + a(f) | ||
@@ -1122,3 +1142,3 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = []; | ||
), E = S(r, n), b = []; | ||
let i = 0; | ||
@@ -1135,3 +1155,3 @@ for (; i !== void 0; ) { | ||
...e, | ||
parser: ae | ||
parser: de | ||
}); | ||
@@ -1142,23 +1162,23 @@ const [$, _] = e.__embeddedXmlFragmentRecoverIndex ?? []; | ||
const h = L(b, g, E); | ||
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return H([ | ||
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return J([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [H(h)] : it([H(h)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [J(h)] : ct([J(h)]), | ||
u, | ||
"`" | ||
]); | ||
const v = d.length ? st : ee, p = u.length ? st : ee; | ||
return H([ | ||
const v = d.length ? at : ee, p = u.length ? at : ee; | ||
return J([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [v, H(h)] : it([v, H(h)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [v, J(h)] : ct([v, J(h)]), | ||
p, | ||
"`" | ||
]); | ||
}, ao = ["xml", "opml", "rss", "svg"], co = T(ae), lo = { | ||
[co]: { | ||
}, us = ["xml", "opml", "rss", "svg"], gs = T(de), ms = { | ||
[gs]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...ao] }], | ||
default: [{ value: [...us] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin." | ||
@@ -1177,3 +1197,3 @@ }, | ||
}; | ||
function uo(t) { | ||
function ps(t) { | ||
const n = { | ||
@@ -1198,3 +1218,3 @@ loc: { | ||
} | ||
function at(t) { | ||
function dt(t) { | ||
const n = { | ||
@@ -1219,16 +1239,16 @@ loc: { | ||
} | ||
const go = { | ||
const hs = { | ||
async parse(t, n) { | ||
const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: o, cst: s } = r(t); | ||
const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t); | ||
if (e.length > 0) { | ||
const l = e[0]; | ||
throw uo(l); | ||
throw ps(l); | ||
} | ||
if (o.length > 0) { | ||
if (s.length > 0) { | ||
let l = !1; | ||
for (const a of o) { | ||
for (const a of s) { | ||
if (!["MismatchedTokenException", "NotAllInputParsedException"].includes( | ||
a.name | ||
)) | ||
throw at(a); | ||
throw dt(a); | ||
if (a.message === "Expecting token of type --> OPEN <-- but found --> '' <--") { | ||
@@ -1261,7 +1281,7 @@ l = !0; | ||
} | ||
throw at(a); | ||
throw dt(a); | ||
} | ||
l && xt(s); | ||
l && St(o); | ||
} | ||
return s; | ||
return o; | ||
}, | ||
@@ -1276,14 +1296,14 @@ astFormat: "xml", | ||
}; | ||
function xt(t) { | ||
function St(t) { | ||
const n = t.children; | ||
for (const r in n) { | ||
const e = n[r] ?? []; | ||
for (let o = e.length - 1; o >= 0; --o) { | ||
const s = e[o]; | ||
if (mo(s)) { | ||
if (Object.keys(s.children).length === 0) { | ||
e.splice(o, 1), e.length === 0 && delete n[r]; | ||
for (let s = e.length - 1; s >= 0; --s) { | ||
const o = e[s]; | ||
if (fs(o)) { | ||
if (Object.keys(o.children).length === 0) { | ||
e.splice(s, 1), e.length === 0 && delete n[r]; | ||
continue; | ||
} | ||
xt(s); | ||
St(o); | ||
} | ||
@@ -1293,17 +1313,17 @@ } | ||
} | ||
function mo(t) { | ||
function fs(t) { | ||
return "name" in t && "children" in t && "location" in t; | ||
} | ||
const po = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
const bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: io, | ||
language: ae, | ||
options: lo, | ||
parser: go | ||
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: dt, softline: lt } = D, ho = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
embedder: ls, | ||
language: de, | ||
options: ms, | ||
parser: hs | ||
}, Symbol.toStringTag, { value: "Module" })), { line: lt, group: X, indent: ut, softline: gt } = I, Es = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
...e, | ||
...s | ||
...o | ||
}; | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = S(), c = l.quasis.map( | ||
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map( | ||
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m) | ||
@@ -1313,61 +1333,61 @@ ).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
-u.length || void 0 | ||
), E = x(r, n), b = await t(y, { | ||
), E = S(r, n), b = await t(y, { | ||
...e, | ||
parser: "yaml" | ||
}), i = L(b, g, E); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return J([ | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return X([ | ||
"`", | ||
d, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [J(i)] : dt([J(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [X(i)] : ut([X(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = d.length ? ct : lt, v = u.length ? ct : lt; | ||
return J([ | ||
const h = d.length ? lt : gt, v = u.length ? lt : gt; | ||
return X([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, J(i)] : dt([h, J(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, X(i)] : ut([h, X(i)]), | ||
v, | ||
"`" | ||
]); | ||
}, St = "embeddedYaml", fo = ["yaml", "yml"], bo = T(St), Eo = { | ||
[bo]: { | ||
}, xt = "embeddedYaml", ys = ["yaml", "yml"], _s = T(xt), vs = { | ||
[_s]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...fo] }], | ||
default: [{ value: [...ys] }], | ||
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded YAML language." | ||
} | ||
}, yo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: ho, | ||
language: St, | ||
options: Eo | ||
}, Symbol.toStringTag, { value: "Module" })), Lt = [], kt = {}, At = {}, Ot = {}, _o = /* @__PURE__ */ Object.assign({ | ||
"./css/index.ts": dn, | ||
"./es/index.ts": fn, | ||
"./glsl/index.ts": vn, | ||
"./graphql/index.ts": xn, | ||
"./html/index.ts": Nn, | ||
"./ini/index.ts": Bn, | ||
"./json/index.ts": Hn, | ||
"./latex/index.ts": Vn, | ||
"./markdown/index.ts": rr, | ||
"./noop/index.ts": ir, | ||
"./php/index.ts": ur, | ||
"./properties/index.ts": fr, | ||
"./ruby/index.ts": Ir, | ||
"./sh/index.ts": Ar, | ||
"./sql/index.ts": zr, | ||
"./toml/index.ts": Vr, | ||
"./ts/index.ts": so, | ||
"./xml/index.ts": po, | ||
"./yaml/index.ts": yo | ||
embedder: Es, | ||
language: xt, | ||
options: vs | ||
}, Symbol.toStringTag, { value: "Module" })), Lt = [], kt = {}, At = {}, Ot = {}, Ds = /* @__PURE__ */ Object.assign({ | ||
"./css/index.ts": un, | ||
"./es/index.ts": En, | ||
"./glsl/index.ts": Dn, | ||
"./graphql/index.ts": Ln, | ||
"./html/index.ts": Fn, | ||
"./ini/index.ts": qn, | ||
"./json/index.ts": Xn, | ||
"./latex/index.ts": er, | ||
"./markdown/index.ts": ar, | ||
"./noop/index.ts": lr, | ||
"./php/index.ts": hr, | ||
"./properties/index.ts": _r, | ||
"./ruby/index.ts": xr, | ||
"./sh/index.ts": Nr, | ||
"./sql/index.ts": Xr, | ||
"./toml/index.ts": ns, | ||
"./ts/index.ts": ds, | ||
"./xml/index.ts": bs, | ||
"./yaml/index.ts": $s | ||
}); | ||
Object.values(_o).forEach(({ language: t, parser: n, embedder: r, options: e }) => { | ||
nn(Lt, t, se), n && (kt[t] = n), r && (At[t] = r), Object.assign(Ot, e); | ||
Object.values(Ds).forEach(({ language: t, parser: n, embedder: r, options: e }) => { | ||
nn(Lt, t, ae), n && (kt[t] = n), r && (At[t] = r), Object.assign(Ot, e); | ||
}); | ||
const vo = "noEmbeddedIdentificationByComment", $o = "noEmbeddedIdentificationByTag", Io = "preserveEmbeddedExteriorWhitespaces", Do = "noEmbeddedMultiLineIndentation", To = "embeddedOverrides", es = { | ||
const Is = "noEmbeddedIdentificationByComment", Ts = "noEmbeddedIdentificationByTag", Ss = "preserveEmbeddedExteriorWhitespaces", xs = "noEmbeddedMultiLineIndentation", Ls = "embeddedOverrides", ro = { | ||
...Ot, | ||
[vo]: { | ||
[Is]: { | ||
category: "Embed", | ||
@@ -1379,3 +1399,3 @@ type: "string", | ||
}, | ||
[$o]: { | ||
[Ts]: { | ||
category: "Embed", | ||
@@ -1387,3 +1407,3 @@ type: "string", | ||
}, | ||
[Io]: { | ||
[Ss]: { | ||
category: "Embed", | ||
@@ -1395,3 +1415,3 @@ type: "string", | ||
}, | ||
[Do]: { | ||
[xs]: { | ||
category: "Embed", | ||
@@ -1403,3 +1423,3 @@ type: "string", | ||
}, | ||
[To]: { | ||
[Ls]: { | ||
category: "Embed", | ||
@@ -1411,3 +1431,3 @@ type: "string", | ||
} | ||
}, ut = { | ||
}, mt = { | ||
// parsers from internal | ||
@@ -1422,3 +1442,3 @@ ...wt.parsers, | ||
}; | ||
var xo = { | ||
var ks = { | ||
isEqual: !0, | ||
@@ -1432,20 +1452,20 @@ isMatchingKey: !0, | ||
transformKey: !0 | ||
}, So = Array.prototype.slice; | ||
}, As = Array.prototype.slice; | ||
function V(t) { | ||
var n = t.length; | ||
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : So.call(t, 0) : []; | ||
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : As.call(t, 0) : []; | ||
} | ||
function Lo(t) { | ||
function Os(t) { | ||
var n = {}; | ||
for (var r in t) | ||
xo[r] || (n[r] = t[r]); | ||
ks[r] || (n[r] = t[r]); | ||
return n; | ||
} | ||
function ko(t) { | ||
function Ps(t) { | ||
return typeof t == "function" && t.isMemoized; | ||
} | ||
function Ao(t, n) { | ||
function Ms(t, n) { | ||
return t === n || t !== t && n !== n; | ||
} | ||
function gt(t, n) { | ||
function pt(t, n) { | ||
var r = {}; | ||
@@ -1458,3 +1478,3 @@ for (var e in t) | ||
} | ||
var Oo = ( | ||
var Ns = ( | ||
/** @class */ | ||
@@ -1492,10 +1512,10 @@ function() { | ||
}), t.prototype._getKeyIndexFromMatchingKey = function(n) { | ||
var r = this.options, e = r.isMatchingKey, o = r.maxSize, s = this.keys, l = s.length; | ||
var r = this.options, e = r.isMatchingKey, s = r.maxSize, o = this.keys, l = o.length; | ||
if (!l) | ||
return -1; | ||
if (e(s[0], n)) | ||
if (e(o[0], n)) | ||
return 0; | ||
if (o > 1) { | ||
if (s > 1) { | ||
for (var a = 1; a < l; a++) | ||
if (e(s[a], n)) | ||
if (e(o[a], n)) | ||
return a; | ||
@@ -1505,19 +1525,19 @@ } | ||
}, t.prototype._getKeyIndexForMany = function(n) { | ||
var r = this.options.isEqual, e = this.keys, o = e.length; | ||
if (!o) | ||
var r = this.options.isEqual, e = this.keys, s = e.length; | ||
if (!s) | ||
return -1; | ||
if (o === 1) | ||
if (s === 1) | ||
return this._getKeyIndexForSingle(n); | ||
var s = n.length, l, a; | ||
if (s > 1) { | ||
for (var g = 0; g < o; g++) | ||
if (l = e[g], l.length === s) { | ||
for (a = 0; a < s && r(l[a], n[a]); a++) | ||
var o = n.length, l, a; | ||
if (o > 1) { | ||
for (var g = 0; g < s; g++) | ||
if (l = e[g], l.length === o) { | ||
for (a = 0; a < o && r(l[a], n[a]); a++) | ||
; | ||
if (a === s) | ||
if (a === o) | ||
return g; | ||
} | ||
} else | ||
for (var g = 0; g < o; g++) | ||
if (l = e[g], l.length === s && r(l[0], n[0])) | ||
for (var g = 0; g < s; g++) | ||
if (l = e[g], l.length === o && r(l[0], n[0])) | ||
return g; | ||
@@ -1529,23 +1549,23 @@ return -1; | ||
return -1; | ||
var e = r[0], o = e.length; | ||
if (n.length !== o) | ||
var e = r[0], s = e.length; | ||
if (n.length !== s) | ||
return -1; | ||
var s = this.options.isEqual; | ||
if (o > 1) { | ||
for (var l = 0; l < o; l++) | ||
if (!s(e[l], n[l])) | ||
var o = this.options.isEqual; | ||
if (s > 1) { | ||
for (var l = 0; l < s; l++) | ||
if (!o(e[l], n[l])) | ||
return -1; | ||
return 0; | ||
} | ||
return s(e[0], n[0]) ? 0 : -1; | ||
return o(e[0], n[0]) ? 0 : -1; | ||
}, t.prototype.orderByLru = function(n, r, e) { | ||
for (var o = this.keys, s = this.values, l = o.length, a = e; a--; ) | ||
o[a + 1] = o[a], s[a + 1] = s[a]; | ||
o[0] = n, s[0] = r; | ||
for (var s = this.keys, o = this.values, l = s.length, a = e; a--; ) | ||
s[a + 1] = s[a], o[a + 1] = o[a]; | ||
s[0] = n, o[0] = r; | ||
var g = this.options.maxSize; | ||
l === g && e === l ? (o.pop(), s.pop()) : e >= g && (o.length = s.length = g); | ||
l === g && e === l ? (s.pop(), o.pop()) : e >= g && (s.length = o.length = g); | ||
}, t.prototype.updateAsyncCache = function(n) { | ||
var r = this, e = this.options, o = e.onCacheChange, s = e.onCacheHit, l = this.keys[0], a = this.values[0]; | ||
var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, l = this.keys[0], a = this.values[0]; | ||
this.values[0] = a.then(function(g) { | ||
return r.shouldUpdateOnHit && s(r, r.options, n), r.shouldUpdateOnChange && o(r, r.options, n), g; | ||
return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), g; | ||
}, function(g) { | ||
@@ -1559,9 +1579,9 @@ var c = r.getKeyIndex(l); | ||
function Pt(t, n) { | ||
if (n === void 0 && (n = {}), ko(t)) | ||
return Pt(t.fn, gt(t.options, n)); | ||
if (n === void 0 && (n = {}), Ps(t)) | ||
return Pt(t.fn, pt(t.options, n)); | ||
if (typeof t != "function") | ||
throw new TypeError("You must pass a function to `memoize`."); | ||
var r = n.isEqual, e = r === void 0 ? Ao : r, o = n.isMatchingKey, s = n.isPromise, l = s === void 0 ? !1 : s, a = n.maxSize, g = a === void 0 ? 1 : a, c = n.onCacheAdd, d = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, E = gt({ | ||
var r = n.isEqual, e = r === void 0 ? Ms : r, s = n.isMatchingKey, o = n.isPromise, l = o === void 0 ? !1 : o, a = n.maxSize, g = a === void 0 ? 1 : a, c = n.onCacheAdd, d = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, E = pt({ | ||
isEqual: e, | ||
isMatchingKey: o, | ||
isMatchingKey: s, | ||
isPromise: l, | ||
@@ -1573,10 +1593,10 @@ maxSize: g, | ||
transformKey: y | ||
}, Lo(n)), b = new Oo(E), i = b.keys, h = b.values, v = b.canTransformKey, p = b.shouldCloneArguments, m = b.shouldUpdateOnAdd, f = b.shouldUpdateOnChange, $ = b.shouldUpdateOnHit, _ = function() { | ||
var I = p ? V(arguments) : arguments; | ||
v && (I = y(I)); | ||
var k = i.length ? b.getKeyIndex(I) : -1; | ||
}, Os(n)), b = new Ns(E), i = b.keys, h = b.values, v = b.canTransformKey, p = b.shouldCloneArguments, m = b.shouldUpdateOnAdd, f = b.shouldUpdateOnChange, $ = b.shouldUpdateOnHit, _ = function() { | ||
var D = p ? V(arguments) : arguments; | ||
v && (D = y(D)); | ||
var k = i.length ? b.getKeyIndex(D) : -1; | ||
if (k !== -1) | ||
$ && u(b, E, _), k && (b.orderByLru(i[k], h[k], k), f && d(b, E, _)); | ||
else { | ||
var Ft = t.apply(this, arguments), jt = p ? I : V(arguments); | ||
var Ft = t.apply(this, arguments), jt = p ? D : V(arguments); | ||
b.orderByLru(jt, Ft, i.length), l && b.updateAsyncCache(_), m && c(b, E, _), f && d(b, E, _); | ||
@@ -1588,3 +1608,3 @@ } | ||
} | ||
async function mt(t) { | ||
async function ht(t) { | ||
try { | ||
@@ -1596,8 +1616,8 @@ const n = await Gt(t, { encoding: "utf-8" }); | ||
} | ||
const Po = /* @__PURE__ */ new URL( | ||
const Rs = /* @__PURE__ */ new URL( | ||
"data:text/javascript," + encodeURIComponent('import{pathToFileURL as r}from"node:url";import{parentPort as t,workerData as a}from"node:worker_threads";const s=async({absolutePath:o})=>{try{const e=await import(r(o).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}};s(a);') | ||
); | ||
async function Mo(t) { | ||
async function Fs(t) { | ||
return new Promise((n) => { | ||
const r = new Xt(Po, { | ||
const r = new Xt(Rs, { | ||
workerData: { | ||
@@ -1614,3 +1634,3 @@ absolutePath: t | ||
} | ||
async function No(t) { | ||
async function js(t) { | ||
console.error( | ||
@@ -1620,3 +1640,3 @@ "Ts module type embeddedOverrides has not been implemented yet." | ||
} | ||
const Ro = Pt( | ||
const ws = Pt( | ||
async (t, n) => { | ||
@@ -1629,4 +1649,4 @@ if (zt(t)) | ||
} | ||
), Fo = async (t, n) => { | ||
const r = Ro( | ||
), Bs = async (t, n) => { | ||
const r = ws( | ||
t, | ||
@@ -1636,23 +1656,23 @@ n | ||
if (e === ".json") { | ||
const o = await r, s = await mt(o); | ||
if (s !== void 0) | ||
return s; | ||
console.error(`Failed to parse the json file: ${o}`); | ||
const s = await r, o = await ht(s); | ||
if (o !== void 0) | ||
return o; | ||
console.error(`Failed to parse the json file: ${s}`); | ||
return; | ||
} else if (e === ".mjs" || e === ".cjs" || e === ".js") { | ||
const o = await r, s = await Mo(o); | ||
if (s !== void 0) | ||
return s; | ||
console.error(`Failed to parse the js module file: ${o}`); | ||
const s = await r, o = await Fs(s); | ||
if (o !== void 0) | ||
return o; | ||
console.error(`Failed to parse the js module file: ${s}`); | ||
return; | ||
} else if (e === ".mts" || e === ".cts" || e === ".ts") { | ||
const o = await r, s = await No(); | ||
if (s !== void 0) | ||
return s; | ||
console.error(`Failed to parse the ts module file: ${o}`); | ||
const s = await r, o = await js(); | ||
if (o !== void 0) | ||
return o; | ||
console.error(`Failed to parse the ts module file: ${s}`); | ||
return; | ||
} else if (e === "") { | ||
const o = await r, s = await mt(o); | ||
if (s !== void 0) | ||
return s; | ||
const s = await r, o = await ht(s); | ||
if (o !== void 0) | ||
return o; | ||
} | ||
@@ -1664,6 +1684,6 @@ try { | ||
} | ||
}, jo = async (t, n, r) => { | ||
}, Us = async (t, n, r) => { | ||
if (t === void 0) | ||
return; | ||
const e = await Fo( | ||
const e = await Bs( | ||
t, | ||
@@ -1674,5 +1694,5 @@ r | ||
try { | ||
for (const { identifiers: o, options: s } of e) | ||
if (o.includes(n)) | ||
return s; | ||
for (const { identifiers: s, options: o } of e) | ||
if (s.includes(n)) | ||
return o; | ||
} catch { | ||
@@ -1682,9 +1702,9 @@ console.error("Error parsing embedded override options."); | ||
}; | ||
function wo({ node: t, parent: n }, r, e) { | ||
function qs({ node: t, parent: n }, r, e) { | ||
if (r.length === 0 || t.type !== "TemplateLiteral") | ||
return; | ||
const o = t.comments ?? n?.comments; | ||
if (!o) | ||
const s = t.comments ?? n?.comments; | ||
if (!s) | ||
return; | ||
const s = o[o.length - 1]; | ||
const o = s[s.length - 1]; | ||
if (![ | ||
@@ -1697,14 +1717,14 @@ "MultiLine", | ||
// babel, babel-flow, babel-ts | ||
].includes(s.type) || !s.leading) | ||
].includes(o.type) || !o.leading) | ||
return; | ||
const l = e.noEmbeddedIdentificationByComment ?? []; | ||
for (const a of r) | ||
if (!l.includes(a) && ` ${a} ` === s.value) | ||
if (!l.includes(a) && ` ${a} ` === o.value) | ||
return a; | ||
} | ||
function Bo({ node: t, parent: n }, r, e) { | ||
function Cs({ node: t, parent: n }, r, e) { | ||
if (r.length === 0 || t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression") | ||
return; | ||
e.parser; | ||
const o = e.parser in ut, s = e.noEmbeddedIdentificationByTag ?? [], l = /* @__PURE__ */ new Set([ | ||
const s = e.parser in mt, o = e.noEmbeddedIdentificationByTag ?? [], l = /* @__PURE__ */ new Set([ | ||
"start", | ||
@@ -1719,12 +1739,12 @@ "end", | ||
for (const a of r) | ||
if (!s.includes(a)) | ||
if (Uo(a)) { | ||
if (!o.includes(a)) | ||
if (Ws(a)) { | ||
if (n.tag.type === "Identifier" && n.tag.name === a) | ||
return a; | ||
} else { | ||
if (!o) | ||
if (!s) | ||
return; | ||
let g; | ||
try { | ||
const d = ut[e.parser].parse( | ||
const d = mt[e.parser].parse( | ||
`${a}\`\``, | ||
@@ -1750,7 +1770,7 @@ e | ||
} | ||
function Uo(t) { | ||
function Ws(t) { | ||
return /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(t); | ||
} | ||
function Mt(t, n, r = /* @__PURE__ */ new Set()) { | ||
return Object.is(t, n) ? !0 : Array.isArray(t) ? qo(t, n, r) : typeof t == "object" ? Nt( | ||
return Object.is(t, n) ? !0 : Array.isArray(t) ? Gs(t, n, r) : typeof t == "object" ? Nt( | ||
t, | ||
@@ -1761,8 +1781,8 @@ n, | ||
} | ||
function qo(t, n, r = /* @__PURE__ */ new Set()) { | ||
function Gs(t, n, r = /* @__PURE__ */ new Set()) { | ||
const e = t.length; | ||
if (e != n.length) | ||
return !1; | ||
for (let o = 0; o < e; o++) | ||
if (!Mt(t[o], n[o], r)) | ||
for (let s = 0; s < e; s++) | ||
if (!Mt(t[s], n[s], r)) | ||
return !1; | ||
@@ -1777,3 +1797,3 @@ return !0; | ||
} | ||
const { estree: Rt } = Wt, Co = function(t, n) { | ||
const { estree: Rt } = Wt, zs = function(t, n) { | ||
const { node: r } = t; | ||
@@ -1783,7 +1803,7 @@ if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null)) | ||
for (const e of Lt) { | ||
const o = n[T(e)]; | ||
if (!o) | ||
const s = n[T(e)]; | ||
if (!s) | ||
continue; | ||
const s = wo(t, o, n) ?? Bo(t, o, n); | ||
if (s === void 0) | ||
const o = qs(t, s, n) ?? Cs(t, s, n); | ||
if (o === void 0) | ||
continue; | ||
@@ -1795,5 +1815,5 @@ const l = At[e]; | ||
return a.quasis.length === 1 && a.quasis[0]?.value.raw.trim() === "" ? "``" : async (g, c, d, u) => { | ||
const y = await jo( | ||
const y = await Us( | ||
u.embeddedOverrides, | ||
s, | ||
o, | ||
u.filepath | ||
@@ -1803,7 +1823,7 @@ ); | ||
const E = await l(g, c, d, u, { | ||
identifier: s, | ||
identifiers: o, | ||
identifier: o, | ||
identifiers: s, | ||
embeddedOverrideOptions: y | ||
}); | ||
return D.label( | ||
return I.label( | ||
{ embed: !0, ...E.label }, | ||
@@ -1818,6 +1838,6 @@ E | ||
return Rt.embed?.(t, n) ?? null; | ||
}, ts = { | ||
}, so = { | ||
estree: { | ||
...Rt, | ||
embed: Co | ||
embed: zs | ||
} | ||
@@ -1831,5 +1851,5 @@ }; | ||
T as makeIdentifiersOptionName, | ||
es as options, | ||
ut as parsers, | ||
ts as printers | ||
ro as options, | ||
mt as parsers, | ||
so as printers | ||
}; |
@@ -70,2 +70,12 @@ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type PrettierPluginEmbedOptions } from "./embedded/index.js"; | ||
}; | ||
readonly embeddedCssParser: { | ||
category: string; | ||
type: "choice"; | ||
default: "scss"; | ||
description: string; | ||
choices: { | ||
value: "css" | "less" | "scss"; | ||
description: string; | ||
}[]; | ||
}; | ||
readonly embeddedEsIdentifiers: { | ||
@@ -173,2 +183,12 @@ readonly category: "Embed"; | ||
}; | ||
readonly embeddedMarkdownParser: { | ||
category: string; | ||
type: "choice"; | ||
default: "markdown"; | ||
description: string; | ||
choices: { | ||
value: "markdown" | "mdx" | "remark"; | ||
description: string; | ||
}[]; | ||
}; | ||
readonly embeddedPhpIdentifiers: { | ||
@@ -175,0 +195,0 @@ readonly category: "Embed"; |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "files": [ |
@@ -142,9 +142,10 @@ <div align="center"> | ||
This option doesn't require other plugins and can override the native embedded language formatting. It serves as a way to turn off embedded language formatting for specific language identifiers. | ||
This option doesn't require other plugins and can override the native embedded language formatting. It serves as a way to turn off embedded language formatting for the specified language identifiers. | ||
#### CSS | ||
| Option | Type | Default | Description | | ||
| :----------------------: | :--------: | :----------------------------------------: | --------------------------------------------------------------------------------------------------------------- | | ||
| `embeddedCssIdentifiers` | `string[]` | [`["css"]`](./src/embedded/css/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language. | | ||
| Option | Type | Default | Description | | ||
| :----------------------: | :----------------------------------------------------------: | :----------------------------------------: | --------------------------------------------------------------------------------------------------------------- | | ||
| `embeddedCssIdentifiers` | `string[]` | [`["css"]`](./src/embedded/css/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language. | | ||
| `embeddedCssParser` | [`"css" \| "less"\| "scss"`](./src/embedded/css/options.ts) | [`"scss"`](./src/embedded/css/options.ts) | The parser used to parse the embedded CSS language. | | ||
@@ -155,2 +156,4 @@ Formatting embedded CSS language doesn't require other plugins and uses the parsers and printers provided by Prettier natively. | ||
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides). | ||
#### ES (ECMAScript/JavaScript) | ||
@@ -227,5 +230,6 @@ | ||
| Option | Type | Default | Description | | ||
| :---------------------------: | :--------: | :--------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------- | | ||
| `embeddedMarkdownIdentifiers` | `string[]` | [`["md", "markdown"]`](./src/embedded/markdown/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language. | | ||
| Option | Type | Default | Description | | ||
| :---------------------------: | :---------------------------------------------------------------------: | :--------------------------------------------------------: | -------------------------------------------------------------------------------------------------------------------- | | ||
| `embeddedMarkdownIdentifiers` | `string[]` | [`["md", "markdown"]`](./src/embedded/markdown/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language. | | ||
| `embeddedMarkdownParser` | [`"markdown" \| "mdx"\| "remark"`](./src/embedded/markdown/options.ts) | [`"markdown"`](./src/embedded/markdown/options.ts) | The parser used to parse the embedded Markdown language. | | ||
@@ -236,2 +240,6 @@ Formatting embedded Markdown language doesn't require other plugins and uses the parsers and printers provided by Prettier natively. | ||
If you want to specify different parsers for different identifiers, check [`embeddedOverrides`](#embeddedoverrides). | ||
The `remark` parser is [an alias of the `markdown` parser](https://github.com/prettier/prettier/blob/ed23dacc9e655c3876971b30859497b17ff2cf9f/src/language-markdown/parser-markdown.js#L57). | ||
#### PHP | ||
@@ -238,0 +246,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
167337
3574
375