prettier-plugin-embed
Version:
A configurable Prettier plugin to format embedded languages in JS/TS files.
1,454 lines • 81.4 kB
JavaScript
import { builders as M, utils as si } from "prettier/doc";
import fi from "prettier/parser-babel";
import yi from "prettier/parser-espree";
import _i from "prettier/parser-flow";
import $i from "prettier/parser-meriyah";
import vi from "prettier/parser-typescript";
import { printers as Di } from "prettier/plugins/estree.mjs";
import { resolveConfigFile as Ti } from "prettier";
const { group: Mi, indent: Ai, softline: Be, hardline: Si, lineSuffixBoundary: ki } = M, { mapDoc: Li } = si;
function Gi(e, t) {
const { node: n } = e;
let r = t();
return n?.comments?.length && (r = Mi([Ai([Be, r]), Be])), ["${", r, ki, "}"];
}
function k(e, t) {
return e.map(
(n) => Gi(n, t),
"expressions"
);
}
function S(e, t, n, r = !1) {
return Li(e, (o) => {
if (typeof o != "string")
return o;
const i = [], l = o.split(t);
for (let u = 0; u < l.length; u++) {
let E = l[u];
if (u % 2 === 0) {
if (!E)
continue;
if (E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), r)
for (const d of E.split(/(\n)/))
d === `
` ? i.push(Si) : i.push(d);
else
i.push(E);
} else {
const d = Number(E);
i.push(n[d]);
}
}
return i;
});
}
function Ni(e, t, n) {
if (t === n) {
e.unshift(t);
return;
}
let r = 0, s = e.length;
for (; r < s; ) {
const o = r + s >>> 1;
if (e[o] === n) {
e.push(t);
return;
}
e[o] < t ? r = o + 1 : s = o;
}
e.splice(r, 0, t);
}
const he = (() => {
const e = [...Array(26).keys()].map((t) => String.fromCharCode(t + 97)).concat([...Array(10).keys()].map((t) => `${t}`));
return () => {
let n = "";
for (let r = 0; r < 16; ++r)
n += e[Number.parseInt((Math.random() * e.length).toFixed(0), 10) % e.length];
return n;
};
})();
function L(e = "p", t = "") {
const n = he(), r = he(), s = qe(e), o = qe(t), i = (u) => `${e}${n}${u}${r}${t}`, l = new RegExp(
`${s}${n}(\\d+)${r}${o}`,
"ig"
);
return {
createPlaceholder: i,
placeholderRegex: l
};
}
function qe(e) {
return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
function D(e) {
return `${e}Identifiers`;
}
function A(e) {
return `${e}Comments`;
}
function T(e) {
return `${e}Tags`;
}
function Oi(e) {
return `${e}Plugin`;
}
function O(e) {
return `${e}Parser`;
}
const _ = "9ff2b366e8ca4c97b9aed1a29b5b94ed", { line: je, group: I, indent: Ue, softline: Re } = M, xi = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(
"@prettier-placeholder"
), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: i.embeddedCssParser ?? "scss"
}), a = S(
$,
E,
b,
// https://github.com/prettier/prettier/blob/3bfabd012873e5022f341aca75566966d91870f1/src/language-js/embed/css.js#L52
!0
);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return I([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [I(a)] : Ue([I(a)]),
p,
"`"
]);
const h = c.length ? je : Re, v = p.length ? je : Re;
return I([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, I(a)] : Ue([h, I(a)]),
v,
"`"
]);
}, re = "embeddedCss", Ii = ["css"], Pi = ["css", "less", "scss"], Bi = D(re), Ce = A(re), we = T(re), qi = O(re), ji = {
[Bi]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Ii] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.",
deprecated: `Please use \`${Ce}\` or \`${we}\`.`
},
[Ce]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded CSS language."
},
[we]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded CSS language."
},
[qi]: {
category: "Embed",
type: "choice",
default: "scss",
description: "The parser used to parse the embedded CSS language.",
choices: Pi.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, Ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: xi,
language: re,
options: ji
}, Symbol.toStringTag, { value: "Module" })), { line: Fe, group: P, indent: We, softline: ze } = M, Ri = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: i.embeddedEsParser ?? "babel"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return P([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [P(a)] : We([P(a)]),
p,
"`"
]);
const h = c.length ? Fe : ze, v = p.length ? Fe : ze;
return P([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, P(a)] : We([h, P(a)]),
v,
"`"
]);
}, oe = "embeddedEs", Ci = [
"js",
"jsx",
"es",
"es6",
"mjs",
"cjs",
"pac",
"javascript"
], wi = [
"babel",
"babel-flow",
"acorn",
"espree",
"flow",
"meriyah"
], Fi = D(oe), Ke = A(oe), Je = T(oe), Wi = O(oe), zi = {
[Fi]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Ci] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.",
deprecated: `Please use \`${Ke}\` or \`${Je}\`.`
},
[Ke]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
},
[Je]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
},
[Wi]: {
category: "Embed",
type: "choice",
default: "babel",
description: "The parser used to parse the embedded ECMASCript/JavaScript language.",
choices: wi.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Ri,
language: oe,
options: zi
}, Symbol.toStringTag, { value: "Module" })), { line: He, group: B, indent: Xe, softline: Qe } = M, Ji = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "glsl-parser"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return B([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [B(a)] : Xe([B(a)]),
p,
"`"
]);
const h = c.length ? He : Qe, v = p.length ? He : Qe;
return B([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, B(a)] : Xe([h, B(a)]),
v,
"`"
]);
}, be = "embeddedGlsl", Hi = ["glsl", "shader"], Xi = D(be), Ye = A(be), Ve = T(be), Qi = {
[Xi]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Hi] }],
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.",
deprecated: `Please use \`${Ye}\` or \`${Ve}\`.`
},
[Ye]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
},
[Ve]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
}
}, Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Ji,
language: be,
options: Qi
}, Symbol.toStringTag, { value: "Module" })), { line: Ze, group: q, indent: et, softline: tt } = M, Vi = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "graphql"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return q([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [q(a)] : et([q(a)]),
p,
"`"
]);
const h = c.length ? Ze : tt, v = p.length ? Ze : tt;
return q([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, q(a)] : et([h, q(a)]),
v,
"`"
]);
}, fe = "embeddedGraphql", Zi = ["graphql", "gql"], es = D(fe), nt = A(fe), it = T(fe), ts = {
[es]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Zi] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language.",
deprecated: `Please use \`${nt}\` or \`${it}\`.`
},
[nt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded GraphQL language."
},
[it]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded GraphQL language."
}
}, ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Vi,
language: fe,
options: ts
}, Symbol.toStringTag, { value: "Module" })), { line: st, group: j, indent: rt, softline: ot } = M, { mapDoc: is } = si, ss = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: i.embeddedHtmlParser ?? "html"
}), a = is($, (m) => {
if (typeof m != "string")
return m;
const g = [], y = m.split(E);
for (let G = 0; G < y.length; G++) {
let N = y[G];
if (G % 2 === 0) {
if (!N)
continue;
N = N.replaceAll(/([\\`]|\${)/g, "\\$1"), i.__embeddedInHtml && (N = N.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(N);
} else {
const x = Number(N);
g.push(b[x]);
}
}
return g;
});
if (i.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
i.htmlWhitespaceSensitivity === "css" || i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return j([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [j(a)] : rt([j(a)]),
p,
"`"
]);
const h = c.length ? st : ot, v = p.length ? st : ot;
return j([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, j(a)] : rt([h, j(a)]),
v,
"`"
]);
}, ae = "embeddedHtml", rs = ["html", "xhtml"], os = ["html", "vue", "angular", "lwc"], as = D(ae), at = A(ae), dt = T(ae), ds = O(ae), ls = {
[as]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...rs] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language.",
deprecated: `Please use \`${at}\` or \`${dt}\`.`
},
[at]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded HTML language."
},
[dt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded HTML language."
},
[ds]: {
category: "Embed",
type: "choice",
default: "html",
description: "The parser used to parse the embedded HTML language.",
choices: os.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: ss,
language: ae,
options: ls
}, Symbol.toStringTag, { value: "Module" })), { line: lt, group: U, indent: ct, softline: ut } = M, us = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "ini"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return U([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [U(a)] : ct([U(a)]),
p,
"`"
]);
const h = c.length ? lt : ut, v = p.length ? lt : ut;
return U([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, U(a)] : ct([h, U(a)]),
v,
"`"
]);
}, ye = "embeddedIni", ps = ["ini", "cfg", "pro"], gs = D(ye), pt = A(ye), gt = T(ye), ms = {
[gs]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...ps] }],
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.",
deprecated: `Please use \`${pt}\` or \`${gt}\`.`
},
[pt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
},
[gt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
}
}, hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: us,
language: ye,
options: ms
}, Symbol.toStringTag, { value: "Module" })), { group: R, line: mt, softline: ht, indent: Et } = M, Es = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "java"
}), a = S(
$,
E,
b,
!0
);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return R([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [R(a)] : Et([R(a)]),
p,
"`"
]);
const h = c.length ? mt : ht, v = p.length ? mt : ht;
return R([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, R(a)] : Et([h, R(a)]),
v,
"`"
]);
}, _e = "embeddedJava", bs = ["java"], fs = D(_e), bt = A(_e), ft = T(_e), ys = {
[fs]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...bs] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.",
deprecated: `Please use \`${bt}\` or \`${ft}\`.`
},
[bt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
},
[ft]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
}
}, _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Es,
language: _e,
options: ys
}, Symbol.toStringTag, { value: "Module" })), { line: yt, group: C, indent: _t, softline: $t } = M, $s = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = vs(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: i.embeddedJsonParser ?? "json"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return C([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [C(a)] : _t([C(a)]),
p,
"`"
]);
const h = c.length ? yt : $t, v = p.length ? yt : $t;
return C([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(a)] : _t([h, C(a)]),
v,
"`"
]);
};
function vs() {
const e = he(), t = he(), n = (s) => `'0${e}${s}${t}'`, r = new RegExp(
`["']?0${e}(\\d+)${t}['"]?`,
"ig"
);
return {
createPlaceholder: n,
placeholderRegex: r
};
}
const de = "embeddedJson", Ds = ["json", "jsonl"], Ts = ["json", "json5", "jsonc", "json-stringify"], Ms = D(de), vt = A(de), Dt = T(de), As = O(de), Ss = {
[Ms]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Ds] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language.",
deprecated: `Please use \`${vt}\` or \`${Dt}\`.`
},
[vt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded JSON language."
},
[Dt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded JSON language."
},
[As]: {
category: "Embed",
type: "choice",
default: "json",
description: "The parser used to parse the embedded JSON language.",
choices: Ts.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: $s,
language: de,
options: Ss
}, Symbol.toStringTag, { value: "Module" })), { line: Tt, group: w, indent: Mt, softline: At } = M, Ls = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L("$p"), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "JSONata"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return w([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [w(a)] : Mt([w(a)]),
p,
"`"
]);
const h = c.length ? Tt : At, v = p.length ? Tt : At;
return w([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, w(a)] : Mt([h, w(a)]),
v,
"`"
]);
}, $e = "embeddedJsonata", Gs = ["jsonata"], Ns = D($e), St = A($e), kt = T($e), Os = {
[Ns]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Gs] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.",
deprecated: `Please use \`${St}\` or \`${kt}\`.`
},
[St]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
},
[kt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
}
}, xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Ls,
language: $e,
options: Os
}, Symbol.toStringTag, { value: "Module" })), { line: Lt, group: F, indent: Gt, softline: Nt } = M, Is = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "latex-parser"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return F([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [F(a)] : Gt([F(a)]),
p,
"`"
]);
const h = c.length ? Lt : Nt, v = p.length ? Lt : Nt;
return F([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, F(a)] : Gt([h, F(a)]),
v,
"`"
]);
}, ve = "embeddedLatex", Ps = [
"latex",
"tex",
"aux",
"cls",
"bbl",
"bib",
"toc",
"sty"
], Bs = D(ve), Ot = A(ve), xt = T(ve), qs = {
[Bs]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Ps] }],
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.",
deprecated: `Please use \`${Ot}\` or \`${xt}\`.`
},
[Ot]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
},
[xt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
}
}, js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Is,
language: ve,
options: qs
}, Symbol.toStringTag, { value: "Module" }));
function It(e, t) {
var n = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var r = Object.getOwnPropertySymbols(e);
t && (r = r.filter(function(s) {
return Object.getOwnPropertyDescriptor(e, s).enumerable;
})), n.push.apply(n, r);
}
return n;
}
function Pt(e) {
for (var t = 1; t < arguments.length; t++) {
var n = arguments[t] != null ? arguments[t] : {};
t % 2 ? It(Object(n), !0).forEach(function(r) {
Us(e, r, n[r]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : It(Object(n)).forEach(function(r) {
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
});
}
return e;
}
function Us(e, t, n) {
return t = Rs(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
}
function Rs(e) {
var t = Cs(e, "string");
return typeof t == "symbol" ? t : String(t);
}
function Cs(e, t) {
if (typeof e != "object" || e === null) return e;
var n = e[Symbol.toPrimitive];
if (n !== void 0) {
var r = n.call(e, t);
if (typeof r != "object") return r;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (t === "string" ? String : Number)(e);
}
const ri = oi({});
function oi(e) {
return t.withOptions = (n) => oi(Pt(Pt({}, e), n)), t;
function t(n, ...r) {
const s = typeof n == "string" ? [n] : n.raw, {
escapeSpecialCharacters: o = Array.isArray(n)
} = e;
let i = "";
for (let E = 0; E < s.length; E++) {
let d = s[E];
o && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), i += d, E < r.length && (i += r[E]);
}
const l = i.split(`
`);
let u = null;
for (const E of l) {
const d = E.match(/^(\s+)\S+/);
if (d) {
const c = d[1].length;
u ? u = Math.min(u, c) : u = c;
}
}
if (u !== null) {
const E = u;
i = l.map((d) => d[0] === " " || d[0] === " " ? d.slice(E) : d).join(`
`);
}
return i = i.trim(), o && (i = i.replace(/\\n/g, `
`)), i;
}
}
const { line: Bt, group: W, indent: qt, softline: jt } = M, ws = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(
// use `dedent` to fix unstable embedded markdown indentation with the `useTabs` option
// https://github.com/Sec-ant/prettier-plugin-embed/pull/91#issuecomment-1963760555
// https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-js/embed/markdown.js#L15-L19
ri(f),
{
...i,
parser: i.embeddedMarkdownParser ?? "markdown",
// this will change the code fence delimiter from ``` to ~~~
// https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-markdown/embed.js#L15
__inJsTemplate: !0
}
), a = S(
$,
E,
b,
!0
);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return W([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [W(a)] : qt([W(a)]),
p,
"`"
]);
const h = c.length ? Bt : jt, v = p.length ? Bt : jt;
return W([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, W(a)] : qt([h, W(a)]),
v,
"`"
]);
}, le = "embeddedMarkdown", Fs = ["md", "markdown"], Ws = ["markdown", "mdx", "remark"], zs = D(le), Ut = A(le), Rt = T(le), Ks = O(le), Js = {
[zs]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Fs] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.",
deprecated: `Please use \`${Ut}\` or \`${Rt}\`.`
},
[Ut]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Markdown language."
},
[Rt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Markdown language."
},
[Ks]: {
category: "Embed",
type: "choice",
default: "markdown",
description: "The parser used to parse the embedded Markdown language.",
choices: Ws.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, Hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: ws,
language: le,
options: Js
}, Symbol.toStringTag, { value: "Module" })), { line: Ct, group: z, indent: wt, softline: Ft } = M, Xs = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "nginx"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return z([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [z(a)] : wt([z(a)]),
p,
"`"
]);
const h = c.length ? Ct : Ft, v = p.length ? Ct : Ft;
return z([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, z(a)] : wt([h, z(a)]),
v,
"`"
]);
}, De = "embeddedNginx", Qs = ["nginx"], Ys = D(De), Wt = A(De), zt = T(De), Vs = {
[Ys]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Qs] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.",
deprecated: `Please use \`${Wt}\` or \`${zt}\`.`
},
[Wt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
},
[zt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
}
}, Zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Xs,
language: De,
options: Vs
}, Symbol.toStringTag, { value: "Module" })), ce = "embeddedNoop", er = D(ce), Kt = A(ce), Jt = T(ce), tr = {
[er]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [] }],
description: "Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.",
deprecated: `Please use \`${Kt}\` or \`${Jt}\`.`
},
[Kt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
},
[Jt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
}
}, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
language: ce,
options: tr
}, Symbol.toStringTag, { value: "Module" })), { line: Ht, group: K, indent: Xt, softline: Qt } = M, ir = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "pegjs-parser"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return K([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [K(a)] : Xt([K(a)]),
p,
"`"
]);
const h = c.length ? Ht : Qt, v = p.length ? Ht : Qt;
return K([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, K(a)] : Xt([h, K(a)]),
v,
"`"
]);
}, Te = "embeddedPegjs", sr = ["pegjs", "peggy", "peg"], rr = D(Te), Yt = A(Te), Vt = T(Te), or = {
[rr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...sr] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.",
deprecated: `Please use \`${Yt}\` or \`${Vt}\`.`
},
[Yt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
},
[Vt]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
}
}, ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: ir,
language: Te,
options: or
}, Symbol.toStringTag, { value: "Module" })), { line: Zt, group: J, indent: en, softline: tn } = M, dr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L("$p"), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "php"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return J([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [J(a)] : en([J(a)]),
p,
"`"
]);
const h = c.length ? Zt : tn, v = p.length ? Zt : tn;
return J([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, J(a)] : en([h, J(a)]),
v,
"`"
]);
}, Me = "embeddedPhp", lr = ["php", "php5"], cr = D(Me), nn = A(Me), sn = T(Me), ur = {
[cr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...lr] }],
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.",
deprecated: `Please use \`${nn}\` or \`${sn}\`.`
},
[nn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
},
[sn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
}
}, pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: dr,
language: Me,
options: ur
}, Symbol.toStringTag, { value: "Module" })), { line: rn, group: H, indent: on, softline: an } = M, gr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "prisma-parse"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return H([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [H(a)] : on([H(a)]),
p,
"`"
]);
const h = c.length ? rn : an, v = p.length ? rn : an;
return H([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, H(a)] : on([h, H(a)]),
v,
"`"
]);
}, Ae = "embeddedPrisma", mr = ["prisma"], hr = D(Ae), dn = A(Ae), ln = T(Ae), Er = {
[hr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...mr] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.",
deprecated: `Please use \`${dn}\` or \`${ln}\`.`
},
[dn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
},
[ln]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
}
}, br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: gr,
language: Ae,
options: Er
}, Symbol.toStringTag, { value: "Module" })), { line: cn, group: X, indent: un, softline: pn } = M, fr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "dot-properties"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return X([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [X(a)] : un([X(a)]),
p,
"`"
]);
const h = c.length ? cn : pn, v = p.length ? cn : pn;
return X([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, X(a)] : un([h, X(a)]),
v,
"`"
]);
}, Se = "embeddedProperties", yr = ["properties"], _r = D(Se), gn = A(Se), mn = T(Se), $r = {
[_r]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...yr] }],
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.",
deprecated: `Please use \`${gn}\` or \`${mn}\`.`
},
[gn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
},
[mn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
}
}, vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: fr,
language: Se,
options: $r
}, Symbol.toStringTag, { value: "Module" })), { group: Q, line: hn, softline: En, indent: bn } = M, Dr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "pug"
}), a = S(
$,
E,
b,
!0
);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return Q([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [Q(a)] : bn([Q(a)]),
p,
"`"
]);
const h = c.length ? hn : En, v = p.length ? hn : En;
return Q([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Q(a)] : bn([h, Q(a)]),
v,
"`"
]);
}, ke = "embeddedPug", Tr = ["pug", "jade"], Mr = D(ke), fn = A(ke), yn = T(ke), Ar = {
[Mr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Tr] }],
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.",
deprecated: `Please use \`${fn}\` or \`${yn}\`.`
},
[fn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
},
[yn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
}
}, Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Dr,
language: ke,
options: Ar
}, Symbol.toStringTag, { value: "Module" })), { line: _n, group: Y, indent: $n, softline: vn } = M, kr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: i.embeddedRubyParser ?? "ruby"
}), a = S($, E, b);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return Y([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [Y(a)] : $n([Y(a)]),
p,
"`"
]);
const h = c.length ? _n : vn, v = p.length ? _n : vn;
return Y([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Y(a)] : $n([h, Y(a)]),
v,
"`"
]);
}, ue = "embeddedRuby", Lr = ["ruby"], Gr = ["ruby", "rbs", "haml"], Nr = D(ue), Dn = A(ue), Tn = T(ue), Or = O(ue), xr = {
[Nr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Lr] }],
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.",
deprecated: `Please use \`${Dn}\` or \`${Tn}\`.`
},
[Dn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
},
[Tn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
},
[Or]: {
category: "Embed",
type: "choice",
default: "ruby",
description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
choices: Gr.map((e) => ({
value: e,
description: `Use the "${e}" parser.`
}))
}
}, Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: kr,
language: ue,
options: xr
}, Symbol.toStringTag, { value: "Module" })), { group: V, line: Mn, softline: An, indent: Sn } = M, Pr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
c.length,
-p.length || void 0
), b = k(n, t), $ = await e(f, {
...i,
parser: "sh"
}), a = S(
$,
E,
b,
!0
);
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return V([
"`",
c,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [V(a)] : Sn([V(a)]),
p,
"`"
]);
const h = c.length ? Mn : An, v = p.length ? Mn : An;
return V([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, V(a)] : Sn([h, V(a)]),
v,
"`"
]);
}, Le = "embeddedSh", Br = ["sh"], qr = D(Le), kn = A(Le), Ln = T(Le), jr = {
[qr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Br] }],
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.",
deprecated: `Please use \`${kn}\` or \`${Ln}\`.`
},
[kn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Block comments that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
},
[Ln]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [_] }],
description: "Tags that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
}
}, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Pr,
language: Le,
options: jr
}, Symbol.toStringTag, { value: "Module" })), { group: Z, line: Gn, softline: Nn, indent: On } = M, Rr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
const i = {
...r,
...o
}, l = i.embeddedSqlPlugin ?? "prettier-plugin-sql", { node: u } = n, { createPlaceholder: E, placeholderRegex: d } = L(), c = u.quasis.map(
(m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + E(g)
).join(""), p = c.match(/^\s+/)?.[0] ?? "", f = c.match(/\s+$/)?.[0] ?? "", b = c.slice(
p.length,
-f.length || void 0
), $ = k(n, t);
let a;
if (l === "prettier-plugin-sql-cst") {
const m = await e(b, {
...i,
parser: i.embeddedSqlParser ?? "sqlite"
});
a = S(m, d, $);
} else {
const m = await e(ri(b), {
...i,
parser: "sql"
});
a = S(
m,
d,
$,
!0
);
}
if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
return Z([
"`",
p,
i.noEmbeddedMultiLineIndentation?.includes(s) ? [Z(a)] : On([Z(a)]),
f,
"`"
]);
const h = p.length ? Gn : Nn, v = f.length ? Gn : Nn;
return Z([
"`",
i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Z(a)] : On([h, Z(a)]),
v,
"`"
]);
}, se = "embeddedSql", Cr = ["sql"], wr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Fr = [
"sqlite