Socket
Socket
Sign inDemoInstall

prettier-plugin-embed

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-embed - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

4

dist/embedded/json/options.d.ts

@@ -10,3 +10,3 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js";

type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
declare const JSON_PARSERS: readonly ["json", "json-stringify", "json5"];
declare const JSON_PARSERS: readonly ["json", "json5", "jsonc", "json-stringify"];
type JsonParser = (typeof JSON_PARSERS)[number];

@@ -33,3 +33,3 @@ declare const EMBEDDED_LANGUAGE_PARSER: "embeddedJsonParser";

choices: {
value: "json" | "json-stringify" | "json5";
value: "json" | "json5" | "jsonc" | "json-stringify";
description: string;

@@ -36,0 +36,0 @@ }[];

@@ -19,4 +19,4 @@ import type { EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers } from "./types.js";

import * as __glob__0_12 from "./ruby/index.js";
import * as __glob__0_13 from "./sql/index.js";
import * as __glob__0_14 from "./sh/index.js";
import * as __glob__0_13 from "./sh/index.js";
import * as __glob__0_14 from "./sql/index.js";
import * as __glob__0_15 from "./toml/index.js";

@@ -23,0 +23,0 @@ import * as __glob__0_16 from "./ts/index.js";

@@ -1,21 +0,21 @@

import { utils as X, builders as I } from "prettier/doc";
import Rt from "prettier/parser-babel";
import jt from "prettier/parser-espree";
import Ft from "prettier/parser-flow";
import wt from "prettier/parser-meriyah";
import Bt from "prettier/parser-typescript";
import { printers as Ut } from "prettier/plugins/estree.mjs";
import { readFile as Ct } from "node:fs/promises";
import { isAbsolute as Wt, dirname as Gt, resolve as qt, extname as zt } from "node:path";
import { Worker as Kt } from "node:worker_threads";
import { resolveConfigFile as Ht } from "prettier";
const { group: Jt, indent: Xt, softline: ce, lineSuffixBoundary: Yt } = I, { mapDoc: Qt } = X;
function Vt(t, n) {
import { utils as X, builders as D } from "prettier/doc";
import wt from "prettier/parser-babel";
import Bt from "prettier/parser-espree";
import Ut from "prettier/parser-flow";
import Ct from "prettier/parser-meriyah";
import Wt from "prettier/parser-typescript";
import { printers as Gt } from "prettier/plugins/estree.mjs";
import { readFile as qt } from "node:fs/promises";
import { isAbsolute as zt, dirname as Kt, resolve as Ht, extname as Jt } from "node:path";
import { Worker as Xt } from "node:worker_threads";
import { resolveConfigFile as Yt } from "prettier";
const { group: Qt, indent: Vt, softline: ce, lineSuffixBoundary: Zt } = D, { mapDoc: en } = X;
function tn(t, n) {
const { node: r } = t;
let e = n();
return r?.comments?.length && (e = Jt([Xt([ce, e]), ce])), ["${", e, Yt, "}"];
return r?.comments?.length && (e = Qt([Vt([ce, e]), ce])), ["${", e, Zt, "}"];
}
function x(t, n) {
return t.map(
(r) => Vt(r, n),
(r) => tn(r, n),
"expressions"

@@ -25,15 +25,15 @@ );

function T(t, n, r) {
return Qt(t, (o) => {
return en(t, (o) => {
if (typeof o != "string")
return o;
const s = [], l = o.split(n);
for (let d = 0; d < l.length; d++) {
let p = l[d];
if (d % 2 == 0) {
if (!p)
for (let c = 0; c < l.length; c++) {
let g = l[c];
if (c % 2 == 0) {
if (!g)
continue;
p = p.replaceAll(/([\\`]|\${)/g, "\\$1"), s.push(p);
g = g.replaceAll(/([\\`]|\${)/g, "\\$1"), s.push(g);
} else {
const c = Number(p);
s.push(r[c]);
const a = Number(g);
s.push(r[a]);
}

@@ -44,3 +44,3 @@ }

}
function M(t, n, r) {
function A(t, n, r) {
if (!(n.plugins?.some(

@@ -55,3 +55,3 @@ (e) => e.name?.match(

}
function Zt(t, n, r) {
function nn(t, n, r) {
if (n === r) {

@@ -82,3 +82,3 @@ t.unshift(n);

function L(t = "p", n = "") {
const r = Y(), e = Y(), o = te(t), s = te(n), l = (p) => `${t}${r}${p}${e}${n}`, d = new RegExp(
const r = Y(), e = Y(), o = te(t), s = te(n), l = (g) => `${t}${r}${g}${e}${n}`, c = new RegExp(
`${o}${r}(\\d+)${e}${s}`,

@@ -89,3 +89,3 @@ "ig"

createPlaceholder: l,
placeholderRegex: d
placeholderRegex: c
};

@@ -99,3 +99,3 @@ }

}
function en(t) {
function rn(t) {
return `${t}Plugin`;

@@ -106,3 +106,3 @@ }

}
const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
const { line: ae, group: P, indent: de, softline: le } = D, on = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -112,40 +112,40 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L("@p"), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L("@p"), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "scss"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return k([
return P([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [k(i)] : de([k(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [P(i)] : de([P(i)]),
u,
"`"
]);
const h = a.length ? ae : le, v = u.length ? ae : le;
return k([
const f = d.length ? ae : le, v = u.length ? ae : le;
return P([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, k(i)] : de([h, k(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, P(i)] : de([f, P(i)]),
v,
"`"
]);
}, gt = "embeddedCss", nn = ["css"], rn = S(gt), on = {
[rn]: {
}, pt = "embeddedCss", sn = ["css"], cn = S(pt), an = {
[cn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...nn] }],
default: [{ value: [...sn] }],
description: "Specify embedded CSS language identifiers."
}
}, sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: tn,
language: gt,
options: on
}, Symbol.toStringTag, { value: "Module" })), { line: ue, group: N, indent: ge, softline: pe } = I, cn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: on,
language: pt,
options: an
}, Symbol.toStringTag, { value: "Module" })), { line: ue, group: k, indent: ge, softline: pe } = D, ln = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -155,27 +155,27 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: e.embeddedEsParser ?? "babel"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return N([
return k([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [N(i)] : ge([N(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [k(i)] : ge([k(i)]),
u,
"`"
]);
const h = a.length ? ue : pe, v = u.length ? ue : pe;
return N([
const f = d.length ? ue : pe, v = u.length ? ue : pe;
return k([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, N(i)] : ge([h, N(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, k(i)] : ge([f, k(i)]),
v,
"`"
]);
}, ne = "embeddedEs", an = [
}, ne = "embeddedEs", un = [
"js",

@@ -189,3 +189,3 @@ "jsx",

"javascript"
], dn = [
], gn = [
"babel",

@@ -197,11 +197,11 @@ "babel-flow",

"meriyah"
], ln = S(ne), un = V(ne), gn = {
[ln]: {
], pn = S(ne), mn = V(ne), fn = {
[pn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...an] }],
default: [{ value: [...un] }],
description: "Specify embedded ES language identifiers."
},
[un]: {
[mn]: {
category: "Embed",

@@ -211,3 +211,3 @@ type: "choice",

description: 'Specify the embedded ES language parser. Default is "babel".',
choices: dn.map((t) => ({
choices: gn.map((t) => ({
value: t,

@@ -217,50 +217,50 @@ description: `Use "${t}".`

}
}, pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: cn,
embedder: ln,
language: ne,
options: gn
}, Symbol.toStringTag, { value: "Module" })), { line: me, group: A, indent: he, softline: fe } = I, mn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("prettier-plugin-glsl", e, o), e = {
options: fn
}, Symbol.toStringTag, { value: "Module" })), { line: me, group: N, indent: fe, softline: he } = D, bn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("prettier-plugin-glsl", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "glsl-parser"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return A([
return N([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [A(i)] : he([A(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [N(i)] : fe([N(i)]),
u,
"`"
]);
const h = a.length ? me : fe, v = u.length ? me : fe;
return A([
const f = d.length ? me : he, v = u.length ? me : he;
return N([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, A(i)] : he([h, A(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, N(i)] : fe([f, N(i)]),
v,
"`"
]);
}, pt = "embeddedGlsl", hn = ["glsl", "shader"], fn = S(pt), En = {
[fn]: {
}, mt = "embeddedGlsl", En = ["glsl", "shader"], yn = S(mt), _n = {
[yn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...hn] }],
default: [{ value: [...En] }],
description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".'
}
}, bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: mn,
language: pt,
options: En
}, Symbol.toStringTag, { value: "Module" })), { line: Ee, group: P, indent: be, softline: ye } = I, yn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: bn,
language: mt,
options: _n
}, Symbol.toStringTag, { value: "Module" })), { line: be, group: M, indent: Ee, softline: ye } = D, $n = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -270,40 +270,40 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "graphql"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return P([
return M([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [P(i)] : be([P(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [M(i)] : Ee([M(i)]),
u,
"`"
]);
const h = a.length ? Ee : ye, v = u.length ? Ee : ye;
return P([
const f = d.length ? be : ye, v = u.length ? be : ye;
return M([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, P(i)] : be([h, P(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, M(i)] : Ee([f, M(i)]),
v,
"`"
]);
}, mt = "embeddedGraphql", _n = ["graphql", "gql"], vn = S(mt), $n = {
[vn]: {
}, ft = "embeddedGraphql", In = ["graphql", "gql"], Dn = S(ft), Sn = {
[Dn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [..._n] }],
default: [{ value: [...In] }],
description: "Specify embedded GraphQL language identifiers."
}
}, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: yn,
language: mt,
options: $n
}, Symbol.toStringTag, { value: "Module" })), { line: _e, group: R, indent: ve, softline: $e } = I, { mapDoc: In } = X, Sn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: $n,
language: ft,
options: Sn
}, Symbol.toStringTag, { value: "Module" })), { line: _e, group: R, indent: ve, softline: $e } = D, { mapDoc: Ln } = X, Tn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -313,26 +313,26 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "html"
}), i = In(E, (m) => {
}), i = Ln(b, (m) => {
if (typeof m != "string")
return m;
const g = [], f = m.split(p);
for (let $ = 0; $ < f.length; $++) {
let _ = f[$];
const p = [], h = m.split(g);
for (let $ = 0; $ < h.length; $++) {
let _ = h[$];
if ($ % 2 == 0) {
if (!_)
continue;
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(_);
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), p.push(_);
} else {
const D = Number(_);
g.push(b[D]);
const I = Number(_);
p.push(E[I]);
}
}
return g;
return p;
});

@@ -343,3 +343,3 @@ if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?

"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [R(i)] : ve([R(i)]),

@@ -349,65 +349,65 @@ u,

]);
const h = a.length ? _e : $e, v = u.length ? _e : $e;
const f = d.length ? _e : $e, v = u.length ? _e : $e;
return R([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, R(i)] : ve([h, R(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, R(i)] : ve([f, R(i)]),
v,
"`"
]);
}, ht = "embeddedHtml", xn = ["html", "xhtml"], Ln = S(ht), Tn = {
[Ln]: {
}, ht = "embeddedHtml", On = ["html", "xhtml"], An = S(ht), Pn = {
[An]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...xn] }],
default: [{ value: [...On] }],
description: "Specify embedded HTML language identifiers."
}
}, On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Sn,
embedder: Tn,
language: ht,
options: Tn
}, Symbol.toStringTag, { value: "Module" })), { line: De, group: j, indent: Ie, softline: Se } = I, Mn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("prettier-plugin-ini", e, o), e = {
options: Pn
}, Symbol.toStringTag, { value: "Module" })), { line: Ie, group: F, indent: De, softline: Se } = D, Nn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("prettier-plugin-ini", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "ini"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return j([
return F([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [j(i)] : Ie([j(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : De([F(i)]),
u,
"`"
]);
const h = a.length ? De : Se, v = u.length ? De : Se;
return j([
const f = d.length ? Ie : Se, v = u.length ? Ie : Se;
return F([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, j(i)] : Ie([h, j(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, F(i)] : De([f, F(i)]),
v,
"`"
]);
}, ft = "embeddedIni", kn = ["ini", "cfg", "pro"], Nn = S(ft), An = {
[Nn]: {
}, bt = "embeddedIni", Mn = ["ini", "cfg", "pro"], Rn = S(bt), Fn = {
[Rn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...kn] }],
default: [{ value: [...Mn] }],
description: 'Specify embedded INI language identifiers. This requires "prettier-plugin-ini".'
}
}, Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Mn,
language: ft,
options: An
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: F, indent: Le, softline: Te } = I, Rn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: Nn,
language: bt,
options: Fn
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: j, indent: Le, softline: Te } = D, wn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -417,23 +417,23 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = jn(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = Bn(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: e.embeddedJsonParser ?? "json"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return F([
return j([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : Le([F(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [j(i)] : Le([j(i)]),
u,
"`"
]);
const h = a.length ? xe : Te, v = u.length ? xe : Te;
return F([
const f = d.length ? xe : Te, v = u.length ? xe : Te;
return j([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] : Le([h, F(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, j(i)] : Le([f, j(i)]),
v,

@@ -443,3 +443,3 @@ "`"

};
function jn() {
function Bn() {
const t = Y(), n = Y(), r = (o) => `'0${t}${o}${n}'`, e = new RegExp(

@@ -454,11 +454,11 @@ `["']?0${t}(\\d+)${n}['"]?`,

}
const re = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify", "json5"], Bn = V(re), Un = S(re), Cn = {
[Un]: {
const re = "embeddedJson", Un = ["json", "jsonl"], Cn = ["json", "json5", "jsonc", "json-stringify"], Wn = V(re), Gn = S(re), qn = {
[Gn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Fn] }],
default: [{ value: [...Un] }],
description: "Specify embedded JSON language identifiers."
},
[Bn]: {
[Wn]: {
category: "Embed",

@@ -468,3 +468,3 @@ type: "choice",

description: 'Specify the embedded JSON language parser. Default is "json".',
choices: wn.map((t) => ({
choices: Cn.map((t) => ({
value: t,

@@ -474,37 +474,37 @@ description: `Use "${t}".`

}
}, Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, zn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Rn,
embedder: wn,
language: re,
options: Cn
}, Symbol.toStringTag, { value: "Module" })), { line: Oe, group: w, indent: Me, softline: ke } = I, Gn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("prettier-plugin-latex", e, o), e = {
options: qn
}, Symbol.toStringTag, { value: "Module" })), { line: Oe, group: w, indent: Ae, softline: Pe } = D, Kn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("prettier-plugin-latex", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "latex-parser"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return w([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [w(i)] : Me([w(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [w(i)] : Ae([w(i)]),
u,
"`"
]);
const h = a.length ? Oe : ke, v = u.length ? Oe : ke;
const f = d.length ? Oe : Pe, v = u.length ? Oe : Pe;
return w([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, w(i)] : Me([h, w(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, w(i)] : Ae([f, w(i)]),
v,
"`"
]);
}, Et = "embeddedLatex", qn = [
}, Et = "embeddedLatex", Hn = [
"latex",

@@ -518,16 +518,16 @@ "tex",

"sty"
], zn = S(Et), Kn = {
[zn]: {
], Jn = S(Et), Xn = {
[Jn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...qn] }],
default: [{ value: [...Hn] }],
description: 'Specify embedded LaTeX language identifiers. This requires "prettier-plugin-latex".'
}
}, Hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, Yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Gn,
embedder: Kn,
language: Et,
options: Kn
}, Symbol.toStringTag, { value: "Module" })), { line: Ne, group: B, indent: Ae, softline: Pe } = I, Jn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
options: Xn
}, Symbol.toStringTag, { value: "Module" })), { line: ke, group: B, indent: Ne, softline: Me } = D, Qn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -537,42 +537,42 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "markdown",
__inJsTemplate: !0
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return B([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [B(i)] : Ae([B(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [B(i)] : Ne([B(i)]),
u,
"`"
]);
const h = a.length ? Ne : Pe, v = u.length ? Ne : Pe;
const f = d.length ? ke : Me, v = u.length ? ke : Me;
return B([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, B(i)] : Ae([h, B(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, B(i)] : Ne([f, B(i)]),
v,
"`"
]);
}, bt = "embeddedMarkdown", Xn = ["md", "markdown"], Yn = S(bt), Qn = {
[Yn]: {
}, yt = "embeddedMarkdown", Vn = ["md", "markdown"], Zn = S(yt), er = {
[Zn]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Xn] }],
default: [{ value: [...Vn] }],
description: "Specify embedded Markdown language identifiers."
}
}, Vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Jn,
language: bt,
options: Qn
}, Symbol.toStringTag, { value: "Module" })), oe = "embeddedNoop", Zn = S(oe), er = {
[Zn]: {
embedder: Qn,
language: yt,
options: er
}, Symbol.toStringTag, { value: "Module" })), oe = "embeddedNoop", nr = S(oe), rr = {
[nr]: {
category: "Embed",

@@ -584,66 +584,66 @@ type: "string",

}
}, tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
language: oe,
options: er
}, Symbol.toStringTag, { value: "Module" })), { line: Re, group: U, indent: je, softline: Fe } = I, nr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("@prettier/plugin-php", e, o), e = {
options: rr
}, Symbol.toStringTag, { value: "Module" })), { line: Re, group: U, indent: Fe, softline: je } = D, sr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("@prettier/plugin-php", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L("$p"), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L("$p"), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "php"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return U([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [U(i)] : je([U(i)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [U(i)] : Fe([U(i)]),
u,
"`"
]);
const h = a.length ? Re : Fe, v = u.length ? Re : Fe;
const f = d.length ? Re : je, v = u.length ? Re : je;
return U([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, U(i)] : je([h, U(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, U(i)] : Fe([f, U(i)]),
v,
"`"
]);
}, yt = "embeddedPhp", rr = ["php", "php5"], or = S(yt), sr = {
[or]: {
}, _t = "embeddedPhp", ir = ["php", "php5"], cr = S(_t), ar = {
[cr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...rr] }],
default: [{ value: [...ir] }],
description: 'Specify embedded PHP language identifiers. This requires "@prettier/plugin-php".'
}
}, ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, dr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: nr,
language: yt,
options: sr
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: C, indent: Be, softline: Ue } = I, cr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("prettier-plugin-properties", e, o), e = {
embedder: sr,
language: _t,
options: ar
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: C, indent: Be, softline: Ue } = D, lr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("prettier-plugin-properties", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "dot-properties"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return C([
"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [C(i)] : Be([C(i)]),

@@ -653,40 +653,40 @@ u,

]);
const h = a.length ? we : Ue, v = u.length ? we : Ue;
const f = d.length ? we : Ue, v = u.length ? we : Ue;
return C([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, C(i)] : Be([h, C(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, C(i)] : Be([f, C(i)]),
v,
"`"
]);
}, _t = "embeddedProperties", ar = ["properties"], dr = S(_t), lr = {
[dr]: {
}, vt = "embeddedProperties", ur = ["properties"], gr = S(vt), pr = {
[gr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...ar] }],
default: [{ value: [...ur] }],
description: 'Specify embedded Java Properties language identifiers. This requires "prettier-plugin-properties".'
}
}, ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: cr,
language: _t,
options: lr
}, Symbol.toStringTag, { value: "Module" })), { line: Ce, group: W, indent: We, softline: Ge } = I, gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("@prettier/plugin-ruby", e, o), e = {
embedder: lr,
language: vt,
options: pr
}, Symbol.toStringTag, { value: "Module" })), { line: Ce, group: W, indent: We, softline: Ge } = D, fr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("@prettier/plugin-ruby", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: e.embeddedRubyParser ?? "ruby"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return W([
"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [W(i)] : We([W(i)]),

@@ -696,18 +696,18 @@ u,

]);
const h = a.length ? Ce : Ge, v = u.length ? Ce : Ge;
const f = d.length ? Ce : Ge, v = u.length ? Ce : Ge;
return W([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, W(i)] : We([h, W(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, W(i)] : We([f, W(i)]),
v,
"`"
]);
}, vt = "embeddedRuby", pr = ["ruby"], mr = ["ruby", "rbs", "haml"], hr = "embeddedRubyParser", fr = S(vt), Er = {
[fr]: {
}, $t = "embeddedRuby", hr = ["ruby"], br = ["ruby", "rbs", "haml"], Er = "embeddedRubyParser", yr = S($t), _r = {
[yr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...pr] }],
default: [{ value: [...hr] }],
description: 'Specify embedded Ruby language identifiers. This requires "@prettier/plugin-ruby".'
},
[hr]: {
[Er]: {
category: "Embed",

@@ -717,3 +717,3 @@ type: "choice",

description: 'Specify the embedded Ruby language parser. Default is "ruby".',
choices: mr.map((t) => ({
choices: br.map((t) => ({
value: t,

@@ -723,8 +723,8 @@ description: `Use "${t}".`

}
}, br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: gr,
language: vt,
options: Er
}, Symbol.toStringTag, { value: "Module" })), { hardline: yr, group: G, line: qe, softline: ze, indent: Ke } = I, { mapDoc: _r } = X, vr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: fr,
language: $t,
options: _r
}, Symbol.toStringTag, { value: "Module" })), { hardline: $r, group: G, line: qe, softline: ze, indent: Ke } = D, { mapDoc: Ir } = X, Dr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -734,27 +734,27 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "sh"
}), i = _r(E, (m) => {
}), i = Ir(b, (m) => {
if (typeof m != "string")
return m;
const g = [], f = m.split(p);
for (let $ = 0; $ < f.length; $++) {
let _ = f[$];
const p = [], h = m.split(g);
for (let $ = 0; $ < h.length; $++) {
let _ = h[$];
if ($ % 2 == 0) {
if (!_)
continue;
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === `
` ? g.push(yr) : g.push(D));
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((I) => I === `
` ? p.push($r) : p.push(I));
} else {
const D = Number(_);
g.push(b[D]);
const I = Number(_);
p.push(E[I]);
}
}
return g;
return p;
});

@@ -764,3 +764,3 @@ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))

"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [G(i)] : Ke([G(i)]),

@@ -770,22 +770,22 @@ u,

]);
const h = a.length ? qe : ze, v = u.length ? qe : ze;
const f = d.length ? qe : ze, v = u.length ? qe : ze;
return G([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, G(i)] : Ke([h, G(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, G(i)] : Ke([f, G(i)]),
v,
"`"
]);
}, $t = "embeddedSh", $r = ["sh"], Dr = S($t), Ir = {
[Dr]: {
}, It = "embeddedSh", Sr = ["sh"], xr = S(It), Lr = {
[xr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...$r] }],
default: [{ value: [...Sr] }],
description: "Specify embedded Shell language identifiers."
}
}, Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, Tr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: vr,
language: $t,
options: Ir
embedder: Dr,
language: It,
options: Lr
}, Symbol.toStringTag, { value: "Module" }));

@@ -806,3 +806,3 @@ function He(t, n) {

n % 2 ? He(Object(r), !0).forEach(function(e) {
xr(t, e, r[e]);
Or(t, e, r[e]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : He(Object(r)).forEach(function(e) {

@@ -814,10 +814,10 @@ Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));

}
function xr(t, n, r) {
return n = Lr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t;
function Or(t, n, r) {
return n = Ar(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t;
}
function Lr(t) {
var n = Tr(t, "string");
function Ar(t) {
var n = Pr(t, "string");
return typeof n == "symbol" ? n : String(n);
}
function Tr(t, n) {
function Pr(t, n) {
if (typeof t != "object" || t === null)

@@ -834,3 +834,3 @@ return t;

}
const Or = Dt({});
const kr = Dt({});
function Dt(t) {

@@ -843,19 +843,19 @@ return n.withOptions = (r) => Dt(Je(Je({}, t), r)), n;

let l = "";
for (let c = 0; c < o.length; c++) {
let a = o[c];
s && (a = a.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), l += a, c < e.length && (l += e[c]);
for (let a = 0; a < o.length; a++) {
let d = o[a];
s && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), l += d, a < e.length && (l += e[a]);
}
const d = l.split(`
const c = l.split(`
`);
let p = null;
for (const c of d) {
const a = c.match(/^(\s+)\S+/);
if (a) {
const u = a[1].length;
p ? p = Math.min(p, u) : p = u;
let g = null;
for (const a of c) {
const d = a.match(/^(\s+)\S+/);
if (d) {
const u = d[1].length;
g ? g = Math.min(g, u) : g = u;
}
}
if (p !== null) {
const c = p;
l = d.map((a) => a[0] === " " || a[0] === " " ? a.slice(c) : a).join(`
if (g !== null) {
const a = g;
l = c.map((d) => d[0] === " " || d[0] === " " ? d.slice(a) : d).join(`
`);

@@ -867,3 +867,3 @@ }

}
const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapDoc: kr } = X, Nr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
const { hardline: Nr, group: q, line: Xe, softline: Ye, indent: Qe } = D, { mapDoc: Mr } = X, Rr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -874,40 +874,40 @@ ...e,

const l = e.embeddedSqlPlugin ?? "prettier-plugin-sql";
M(l, e, o);
const { node: d } = r, { createPlaceholder: p, placeholderRegex: c } = L(), a = d.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + p(g)
).join(""), u = a.match(/^\s+/)?.[0] ?? "", y = a.match(/\s+$/)?.[0] ?? "", b = a.slice(
A(l, e, o);
const { node: c } = r, { createPlaceholder: g, placeholderRegex: a } = L(), d = c.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + g(p)
).join(""), u = d.match(/^\s+/)?.[0] ?? "", y = d.match(/\s+$/)?.[0] ?? "", E = d.slice(
u.length,
-y.length || void 0
), E = x(r, n);
), b = x(r, n);
let i;
if (l === "prettier-plugin-sql-cst") {
const m = await t(b, {
const m = await t(E, {
...e,
parser: e.embeddedSqlParser ?? "sqlite"
});
i = T(m, c, E);
i = T(m, a, b);
} else {
const m = await t(Or(b), {
const m = await t(kr(E), {
...e,
parser: "sql"
});
i = kr(m, (g) => {
if (typeof g != "string")
return g;
const f = [], $ = g.split(c);
i = Mr(m, (p) => {
if (typeof p != "string")
return p;
const h = [], $ = p.split(a);
for (let _ = 0; _ < $.length; _++) {
let D = $[_];
let I = $[_];
if (_ % 2 == 0) {
if (!D)
if (!I)
continue;
D = D.replaceAll(/([\\`]|\${)/g, "\\$1"), D.split(/(\n)/).forEach(
I = I.replaceAll(/([\\`]|\${)/g, "\\$1"), I.split(/(\n)/).forEach(
(O) => O === `
` ? f.push(Mr) : f.push(O)
` ? h.push(Nr) : h.push(O)
);
} else {
const O = Number(D);
f.push(E[O]);
const O = Number(I);
h.push(b[O]);
}
}
return f;
return h;
});

@@ -923,10 +923,10 @@ }

]);
const h = u.length ? Xe : Ye, v = y.length ? Xe : Ye;
const f = u.length ? Xe : Ye, v = y.length ? Xe : Ye;
return q([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, q(i)] : Qe([h, q(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, q(i)] : Qe([f, q(i)]),
v,
"`"
]);
}, Z = "embeddedSql", Ar = ["sql"], Pr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Rr = [
}, Z = "embeddedSql", Fr = ["sql"], jr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], wr = [
"sqlite",

@@ -937,11 +937,11 @@ "bigquery",

"postgresql"
], jr = S(Z), Fr = en(Z), wr = V(Z), Br = {
[jr]: {
], Br = S(Z), Ur = rn(Z), Cr = V(Z), Wr = {
[Br]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Ar] }],
default: [{ value: [...Fr] }],
description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql" or "prettier-plugin-sql-cst".'
},
[Fr]: {
[Ur]: {
category: "Embed",

@@ -951,3 +951,3 @@ type: "choice",

description: 'Specify the Prettier plugin for parsing and formatting SQL. Default is "prettier-plugin-sql"',
choices: Pr.map((t) => ({
choices: jr.map((t) => ({
value: t,

@@ -957,3 +957,3 @@ description: `Use "${t}".`

},
[wr]: {
[Cr]: {
category: "Embed",

@@ -963,3 +963,3 @@ type: "choice",

description: 'Specify the embedded SQL language parser. Default is "sqlite". This option is only for "prettier-plugin-sql-cst".',
choices: Rr.map((t) => ({
choices: wr.map((t) => ({
value: t,

@@ -969,37 +969,37 @@ description: `Use "${t}" parser.`

}
}, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, Gr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Nr,
embedder: Rr,
language: Z,
options: Br
}, Symbol.toStringTag, { value: "Module" })), { line: Ve, group: z, indent: Ze, softline: et, hardline: Cr } = I, { mapDoc: Wr } = X, Gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("prettier-plugin-toml", e, o), e = {
options: Wr
}, Symbol.toStringTag, { value: "Module" })), { line: Ve, group: z, indent: Ze, softline: et, hardline: qr } = D, { mapDoc: zr } = X, Kr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("prettier-plugin-toml", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "toml"
}), i = Wr(E, (m) => {
}), i = zr(b, (m) => {
if (typeof m != "string")
return m;
const g = [], f = m.split(p);
for (let $ = 0; $ < f.length; $++) {
let _ = f[$];
const p = [], h = m.split(g);
for (let $ = 0; $ < h.length; $++) {
let _ = h[$];
if ($ % 2 == 0) {
if (!_)
continue;
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === `
` ? g.push(Cr) : g.push(D));
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((I) => I === `
` ? p.push(qr) : p.push(I));
} else {
const D = Number(_);
g.push(b[D]);
const I = Number(_);
p.push(E[I]);
}
}
return g;
return p;
});

@@ -1009,3 +1009,3 @@ if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))

"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [z(i)] : Ze([z(i)]),

@@ -1015,23 +1015,23 @@ u,

]);
const h = a.length ? Ve : et, v = u.length ? Ve : et;
const f = d.length ? Ve : et, v = u.length ? Ve : et;
return z([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, z(i)] : Ze([h, z(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, z(i)] : Ze([f, z(i)]),
v,
"`"
]);
}, It = "embeddedToml", qr = ["toml"], zr = S(It), Kr = {
[zr]: {
}, St = "embeddedToml", Hr = ["toml"], Jr = S(St), Xr = {
[Jr]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...qr] }],
default: [{ value: [...Hr] }],
description: 'Specify embedded TOML language identifiers. This requires "prettier-plugin-toml".'
}
}, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, Yr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Gr,
language: It,
options: Kr
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt } = I, Jr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
embedder: Kr,
language: St,
options: Xr
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt } = D, Qr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -1041,8 +1041,8 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,

@@ -1053,7 +1053,7 @@ parser: e.embeddedTsParser ?? "typescript",

filepath: void 0
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return K([
"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [K(i)] : nt([K(i)]),

@@ -1063,18 +1063,18 @@ u,

]);
const h = a.length ? tt : rt, v = u.length ? tt : rt;
const f = d.length ? tt : rt, v = u.length ? tt : rt;
return K([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, K(i)] : nt([h, K(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, K(i)] : nt([f, K(i)]),
v,
"`"
]);
}, se = "embeddedTs", Xr = ["ts", "tsx", "cts", "mts", "typescript"], Yr = ["typescript", "babel-ts"], Qr = V(se), Vr = S(se), Zr = {
[Vr]: {
}, se = "embeddedTs", Vr = ["ts", "tsx", "cts", "mts", "typescript"], Zr = ["typescript", "babel-ts"], eo = V(se), to = S(se), no = {
[to]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...Xr] }],
default: [{ value: [...Vr] }],
description: "Specify embedded TS language parsers."
},
[Qr]: {
[eo]: {
category: "Embed",

@@ -1084,3 +1084,3 @@ type: "choice",

description: 'Specify the embedded TS language parser. Default is "typescript".',
choices: Yr.map((t) => ({
choices: Zr.map((t) => ({
value: t,

@@ -1090,28 +1090,28 @@ description: `Use "${t}".`

}
}, eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, ro = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Jr,
embedder: Qr,
language: se,
options: Zr
}, Symbol.toStringTag, { value: "Module" })), ie = "embeddedXml", { line: ot, group: H, indent: st, softline: ee } = I, to = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
M("@prettier/plugin-xml", e, o), e = {
options: no
}, Symbol.toStringTag, { value: "Module" })), ie = "embeddedXml", { line: ot, group: H, indent: st, softline: ee } = D, oo = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
A("@prettier/plugin-xml", e, o), e = {
...e,
...s
};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(g, f, { length: $ }) => f === $ - 1 ? g.value.cooked : g.value.cooked + d(f)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(p, h, { length: $ }) => h === $ - 1 ? p.value.cooked : p.value.cooked + c(h)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = [];
), E = x(r, n), b = [];
let i = 0;
for (; i !== void 0; ) {
const g = y.slice(i);
if (g.length === 0)
const p = y.slice(i);
if (p.length === 0)
break;
i > 0 && e.xmlWhitespaceSensitivity !== "strict" && E.push(ee), e.__embeddedXmlFragmentRecoverIndex?.splice(
i > 0 && e.xmlWhitespaceSensitivity !== "strict" && b.push(ee), e.__embeddedXmlFragmentRecoverIndex?.splice(
0,
e.__embeddedXmlFragmentRecoverIndex.length
);
let f = await t(g, {
let h = await t(p, {
...e,

@@ -1121,26 +1121,26 @@ parser: ie

const [$, _] = e.__embeddedXmlFragmentRecoverIndex ?? [];
$ === void 0 ? i = void 0 : _ === void 0 ? i += $ : (f = g.slice($, _ + 1), i += _ + 1), E.push(f);
$ === void 0 ? i = void 0 : _ === void 0 ? i += $ : (h = p.slice($, _ + 1), i += _ + 1), b.push(h);
}
const h = T(E, p, b);
const f = T(b, g, E);
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return H([
"`",
a,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [H(h)] : st([H(h)]),
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [H(f)] : st([H(f)]),
u,
"`"
]);
const v = a.length ? ot : ee, m = u.length ? ot : ee;
const v = d.length ? ot : ee, m = u.length ? ot : ee;
return H([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [v, H(h)] : st([v, H(h)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [v, H(f)] : st([v, H(f)]),
m,
"`"
]);
}, no = ["xml", "opml", "rss", "svg"], ro = S(ie), oo = {
[ro]: {
}, so = ["xml", "opml", "rss", "svg"], io = S(ie), co = {
[io]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...no] }],
default: [{ value: [...so] }],
description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'

@@ -1159,3 +1159,3 @@ },

};
function so(t) {
function ao(t) {
const n = {

@@ -1200,3 +1200,3 @@ loc: {

}
const io = {
const lo = {
async parse(t, n) {

@@ -1206,12 +1206,12 @@ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: o, cst: s } = r(t);

const l = e[0];
throw so(l);
throw ao(l);
}
if (o.length > 0) {
let l = !1;
for (const d of o) {
for (const c of o) {
if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
d.name
c.name
))
throw it(d);
if (d.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
throw it(c);
if (c.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
l = !0;

@@ -1221,8 +1221,8 @@ continue;

if (/Expecting token of type --> EOF <-- but found --> '[\s\S]+' <--/.test(
d.message
) || /Redundant input, expecting EOF but found: /.test(d.message)) {
c.message
) || /Redundant input, expecting EOF but found: /.test(c.message)) {
n.__embeddedXmlFragmentRecoverIndex?.splice(
0,
n.__embeddedXmlFragmentRecoverIndex.length,
d.token.startOffset
c.token.startOffset
);

@@ -1232,5 +1232,5 @@ break;

if (/Expecting token of type --> OPEN <-- but found --> '[\s\S]+' <--/.test(
d.message
c.message
)) {
if (d.token.endOffset === void 0 || Number.isNaN(d.token.endOffset))
if (c.token.endOffset === void 0 || Number.isNaN(c.token.endOffset))
break;

@@ -1240,10 +1240,10 @@ n.__embeddedXmlFragmentRecoverIndex?.splice(

n.__embeddedXmlFragmentRecoverIndex.length,
d.token.startOffset,
d.token.endOffset
c.token.startOffset,
c.token.endOffset
), l = !0;
break;
}
throw it(d);
throw it(c);
}
l && St(s);
l && xt(s);
}

@@ -1260,3 +1260,3 @@ return s;

};
function St(t) {
function xt(t) {
const n = t.children;

@@ -1267,3 +1267,3 @@ for (const r in n) {

const s = e[o];
if (co(s)) {
if (uo(s)) {
if (Object.keys(s.children).length === 0) {

@@ -1273,3 +1273,3 @@ e.splice(o, 1), e.length === 0 && delete n[r];

}
St(s);
xt(s);
}

@@ -1279,12 +1279,12 @@ }

}
function co(t) {
function uo(t) {
return "name" in t && "children" in t && "location" in t;
}
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: to,
embedder: oo,
language: ie,
options: oo,
parser: io
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: at, softline: dt } = I, lo = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
options: co,
parser: lo
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: at, softline: dt } = D, po = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
e = {

@@ -1294,15 +1294,15 @@ ...e,

};
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
a.length,
const { node: l } = r, { createPlaceholder: c, placeholderRegex: g } = L(), a = l.quasis.map(
(m, p, { length: h }) => p === h - 1 ? m.value.cooked : m.value.cooked + c(p)
).join(""), d = a.match(/^\s+/)?.[0] ?? "", u = a.match(/\s+$/)?.[0] ?? "", y = a.slice(
d.length,
-u.length || void 0
), b = x(r, n), E = await t(y, {
), E = x(r, n), b = await t(y, {
...e,
parser: "yaml"
}), i = T(E, p, b);
}), i = T(b, g, E);
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
return J([
"`",
a,
d,
e.noEmbeddedMultiLineIndentation?.includes(o) ? [J(i)] : at([J(i)]),

@@ -1312,49 +1312,49 @@ u,

]);
const h = a.length ? ct : dt, v = u.length ? ct : dt;
const f = d.length ? ct : dt, v = u.length ? ct : dt;
return J([
"`",
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, J(i)] : at([h, J(i)]),
e.noEmbeddedMultiLineIndentation?.includes(o) ? [f, J(i)] : at([f, J(i)]),
v,
"`"
]);
}, xt = "embeddedYaml", uo = ["yaml", "yml"], go = S(xt), po = {
[go]: {
}, Lt = "embeddedYaml", mo = ["yaml", "yml"], fo = S(Lt), ho = {
[fo]: {
category: "Embed",
type: "string",
array: !0,
default: [{ value: [...uo] }],
default: [{ value: [...mo] }],
description: "Specify embedded YAML language identifiers."
}
}, mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
}, bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: lo,
language: xt,
options: po
}, Symbol.toStringTag, { value: "Module" })), Lt = [], Tt = {}, Ot = {}, Mt = {}, ho = /* @__PURE__ */ Object.assign({
"./css/index.ts": sn,
"./es/index.ts": pn,
"./glsl/index.ts": bn,
"./graphql/index.ts": Dn,
"./html/index.ts": On,
"./ini/index.ts": Pn,
"./json/index.ts": Wn,
"./latex/index.ts": Hn,
"./markdown/index.ts": Vn,
"./noop/index.ts": tr,
"./php/index.ts": ir,
"./properties/index.ts": ur,
"./ruby/index.ts": br,
"./sh/index.ts": Sr,
"./sql/index.ts": Ur,
"./toml/index.ts": Hr,
"./ts/index.ts": eo,
"./xml/index.ts": ao,
"./yaml/index.ts": mo
embedder: po,
language: Lt,
options: ho
}, Symbol.toStringTag, { value: "Module" })), Tt = [], Ot = {}, At = {}, Pt = {}, Eo = /* @__PURE__ */ Object.assign({
"./css/index.ts": dn,
"./es/index.ts": hn,
"./glsl/index.ts": vn,
"./graphql/index.ts": xn,
"./html/index.ts": kn,
"./ini/index.ts": jn,
"./json/index.ts": zn,
"./latex/index.ts": Yn,
"./markdown/index.ts": tr,
"./noop/index.ts": or,
"./php/index.ts": dr,
"./properties/index.ts": mr,
"./ruby/index.ts": vr,
"./sh/index.ts": Tr,
"./sql/index.ts": Gr,
"./toml/index.ts": Yr,
"./ts/index.ts": ro,
"./xml/index.ts": go,
"./yaml/index.ts": bo
});
Object.values(ho).forEach(({ language: t, parser: n, embedder: r, options: e }) => {
Zt(Lt, t, oe), n && (Tt[t] = n), r && (Ot[t] = r), Object.assign(Mt, e);
Object.values(Eo).forEach(({ language: t, parser: n, embedder: r, options: e }) => {
nn(Tt, t, oe), n && (Ot[t] = n), r && (At[t] = r), Object.assign(Pt, e);
});
const fo = "noEmbeddedIdentificationByComment", Eo = "noEmbeddedIdentificationByTag", bo = "preserveEmbeddedExteriorWhitespaces", yo = "noEmbeddedMultiLineIndentation", _o = "embeddedOverrides", Ho = {
...Mt,
[fo]: {
const yo = "noEmbeddedIdentificationByComment", _o = "noEmbeddedIdentificationByTag", vo = "preserveEmbeddedExteriorWhitespaces", $o = "noEmbeddedMultiLineIndentation", Io = "embeddedOverrides", Vo = {
...Pt,
[yo]: {
category: "Embed",

@@ -1366,3 +1366,3 @@ type: "string",

},
[Eo]: {
[_o]: {
category: "Embed",

@@ -1374,4 +1374,4 @@ type: "string",

},
[bo]: {
category: "Config",
[vo]: {
category: "Embed",
type: "string",

@@ -1382,3 +1382,3 @@ array: !0,

},
[yo]: {
[$o]: {
category: "Embed",

@@ -1390,3 +1390,3 @@ type: "string",

},
[_o]: {
[Io]: {
category: "Embed",

@@ -1398,13 +1398,13 @@ type: "string",

}
}, Jo = {
}, lt = {
// parsers from internal
...Rt.parsers,
...jt.parsers,
...Ft.parsers,
...wt.parsers,
...Bt.parsers,
...wt.parsers,
...Ut.parsers,
...Wt.parsers,
...Ct.parsers,
// parsers from this plugin
...Tt
...Ot
};
var vo = {
var Do = {
isEqual: !0,

@@ -1418,20 +1418,20 @@ isMatchingKey: !0,

transformKey: !0
}, $o = Array.prototype.slice;
}, So = Array.prototype.slice;
function Q(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]] : $o.call(t, 0) : [];
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : So.call(t, 0) : [];
}
function Do(t) {
function xo(t) {
var n = {};
for (var r in t)
vo[r] || (n[r] = t[r]);
Do[r] || (n[r] = t[r]);
return n;
}
function Io(t) {
function Lo(t) {
return typeof t == "function" && t.isMemoized;
}
function So(t, n) {
function To(t, n) {
return t === n || t !== t && n !== n;
}
function lt(t, n) {
function ut(t, n) {
var r = {};

@@ -1444,3 +1444,3 @@ for (var e in t)

}
var xo = (
var Oo = (
/** @class */

@@ -1484,5 +1484,5 @@ function() {

if (o > 1) {
for (var d = 1; d < l; d++)
if (e(s[d], n))
return d;
for (var c = 1; c < l; c++)
if (e(s[c], n))
return c;
}

@@ -1496,15 +1496,15 @@ return -1;

return this._getKeyIndexForSingle(n);
var s = n.length, l, d;
var s = n.length, l, c;
if (s > 1) {
for (var p = 0; p < o; p++)
if (l = e[p], l.length === s) {
for (d = 0; d < s && r(l[d], n[d]); d++)
for (var g = 0; g < o; g++)
if (l = e[g], l.length === s) {
for (c = 0; c < s && r(l[c], n[c]); c++)
;
if (d === s)
return p;
if (c === s)
return g;
}
} else
for (var p = 0; p < o; p++)
if (l = e[p], l.length === s && r(l[0], n[0]))
return p;
for (var g = 0; g < o; g++)
if (l = e[g], l.length === s && r(l[0], n[0]))
return g;
return -1;

@@ -1527,14 +1527,14 @@ }, t.prototype._getKeyIndexForSingle = function(n) {

}, t.prototype.orderByLru = function(n, r, e) {
for (var o = this.keys, s = this.values, l = o.length, d = e; d--; )
o[d + 1] = o[d], s[d + 1] = s[d];
for (var o = this.keys, s = this.values, l = o.length, c = e; c--; )
o[c + 1] = o[c], s[c + 1] = s[c];
o[0] = n, s[0] = r;
var p = this.options.maxSize;
l === p && e === l ? (o.pop(), s.pop()) : e >= p && (o.length = s.length = p);
var g = this.options.maxSize;
l === g && e === l ? (o.pop(), s.pop()) : e >= g && (o.length = s.length = g);
}, t.prototype.updateAsyncCache = function(n) {
var r = this, e = this.options, o = e.onCacheChange, s = e.onCacheHit, l = this.keys[0], d = this.values[0];
this.values[0] = d.then(function(p) {
return r.shouldUpdateOnHit && s(r, r.options, n), r.shouldUpdateOnChange && o(r, r.options, n), p;
}, function(p) {
var c = r.getKeyIndex(l);
throw c !== -1 && (r.keys.splice(c, 1), r.values.splice(c, 1)), p;
var r = this, e = this.options, o = e.onCacheChange, s = e.onCacheHit, l = this.keys[0], c = this.values[0];
this.values[0] = c.then(function(g) {
return r.shouldUpdateOnHit && s(r, r.options, n), r.shouldUpdateOnChange && o(r, r.options, n), g;
}, function(g) {
var a = r.getKeyIndex(l);
throw a !== -1 && (r.keys.splice(a, 1), r.values.splice(a, 1)), g;
});

@@ -1545,32 +1545,32 @@ }, t;

function kt(t, n) {
if (n === void 0 && (n = {}), Io(t))
return kt(t.fn, lt(t.options, n));
if (n === void 0 && (n = {}), Lo(t))
return kt(t.fn, ut(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 ? So : r, o = n.isMatchingKey, s = n.isPromise, l = s === void 0 ? !1 : s, d = n.maxSize, p = d === void 0 ? 1 : d, c = n.onCacheAdd, a = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, b = lt({
var r = n.isEqual, e = r === void 0 ? To : r, o = n.isMatchingKey, s = n.isPromise, l = s === void 0 ? !1 : s, c = n.maxSize, g = c === void 0 ? 1 : c, a = n.onCacheAdd, d = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, E = ut({
isEqual: e,
isMatchingKey: o,
isPromise: l,
maxSize: p,
onCacheAdd: c,
onCacheChange: a,
maxSize: g,
onCacheAdd: a,
onCacheChange: d,
onCacheHit: u,
transformKey: y
}, Do(n)), E = new xo(b), i = E.keys, h = E.values, v = E.canTransformKey, m = E.shouldCloneArguments, g = E.shouldUpdateOnAdd, f = E.shouldUpdateOnChange, $ = E.shouldUpdateOnHit, _ = function() {
var D = m ? Q(arguments) : arguments;
v && (D = y(D));
var O = i.length ? E.getKeyIndex(D) : -1;
}, xo(n)), b = new Oo(E), i = b.keys, f = b.values, v = b.canTransformKey, m = b.shouldCloneArguments, p = b.shouldUpdateOnAdd, h = b.shouldUpdateOnChange, $ = b.shouldUpdateOnHit, _ = function() {
var I = m ? Q(arguments) : arguments;
v && (I = y(I));
var O = i.length ? b.getKeyIndex(I) : -1;
if (O !== -1)
$ && u(E, b, _), O && (E.orderByLru(i[O], h[O], O), f && a(E, b, _));
$ && u(b, E, _), O && (b.orderByLru(i[O], f[O], O), h && d(b, E, _));
else {
var At = t.apply(this, arguments), Pt = m ? D : Q(arguments);
E.orderByLru(Pt, At, i.length), l && E.updateAsyncCache(_), g && c(E, b, _), f && a(E, b, _);
var Ft = t.apply(this, arguments), jt = m ? I : Q(arguments);
b.orderByLru(jt, Ft, i.length), l && b.updateAsyncCache(_), p && a(b, E, _), h && d(b, E, _);
}
return h[0];
return f[0];
};
return _.cache = E, _.fn = t, _.isMemoized = !0, _.options = b, _;
return _.cache = b, _.fn = t, _.isMemoized = !0, _.options = E, _;
}
async function ut(t) {
async function gt(t) {
try {
const n = await Ct(t, { encoding: "utf-8" });
const n = await qt(t, { encoding: "utf-8" });
return JSON.parse(n);

@@ -1580,8 +1580,8 @@ } catch {

}
const Lo = /* @__PURE__ */ new URL(
const Ao = /* @__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 To(t) {
async function Po(t) {
return new Promise((n) => {
const r = new Kt(Lo, {
const r = new Xt(Ao, {
workerData: {

@@ -1598,3 +1598,3 @@ absolutePath: t

}
async function Oo(t) {
async function ko(t) {
console.error(

@@ -1604,17 +1604,17 @@ "Ts module type embeddedOverrides has not been implemented yet."

}
const Mo = kt(
const No = kt(
async (t, n) => {
if (Wt(t))
if (zt(t))
return t;
const r = await Ht(n);
const r = await Yt(n);
let e;
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = Gt(r), qt(e, t);
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = Kt(r), Ht(e, t);
}
), ko = async (t, n) => {
const r = Mo(
), Mo = async (t, n) => {
const r = No(
t,
n
), e = zt(t);
), e = Jt(t);
if (e === ".json") {
const o = await r, s = await ut(o);
const o = await r, s = await gt(o);
if (s !== void 0)

@@ -1625,3 +1625,3 @@ return s;

} else if (e === ".mjs" || e === ".cjs" || e === ".js") {
const o = await r, s = await To(o);
const o = await r, s = await Po(o);
if (s !== void 0)

@@ -1632,3 +1632,3 @@ return s;

} else if (e === ".mts" || e === ".cts" || e === ".ts") {
const o = await r, s = await Oo();
const o = await r, s = await ko();
if (s !== void 0)

@@ -1639,3 +1639,3 @@ return s;

} else if (e === "") {
const o = await r, s = await ut(o);
const o = await r, s = await gt(o);
if (s !== void 0)

@@ -1649,6 +1649,6 @@ return s;

}
}, No = async (t, n, r) => {
}, Ro = async (t, n, r) => {
if (t === void 0)
return;
const e = await ko(
const e = await Mo(
t,

@@ -1666,3 +1666,3 @@ r

};
function Ao({ node: t, parent: n }, r, e) {
function Fo({ node: t, parent: n }, r, e) {
if (r.length === 0 || t.type !== "TemplateLiteral")

@@ -1674,3 +1674,3 @@ return;

const s = o[o.length - 1];
if (!(![
if (![
"MultiLine",

@@ -1682,40 +1682,95 @@ // meriyah

// babel, babel-flow, babel-ts
].includes(s.type) || !s.leading)) {
for (const l of r)
if (` ${l} ` === s.value && !e.includes(l))
return l;
}
].includes(s.type) || !s.leading)
return;
const l = e.noEmbeddedIdentificationByComment ?? [];
for (const c of r)
if (!l.includes(c) && ` ${c} ` === s.value)
return c;
}
function Po({ node: t, parent: n }, r, e) {
if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
for (const o of r)
if (n.tag.name === o && !e.includes(o))
return o;
}
function jo({ node: t, parent: n }, r, e) {
if (r.length === 0 || t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression")
return;
e.parser;
const o = e.parser in lt, s = e.noEmbeddedIdentificationByTag ?? [], l = /* @__PURE__ */ new Set([
"start",
"end",
"loc",
"range",
"filename",
"typeAnnotation",
"decorators"
]);
for (const c of r)
if (!s.includes(c))
if (wo(c)) {
if (n.tag.type === "Identifier" && n.tag.name === c)
return c;
} else {
if (!o)
return;
let g;
try {
const d = lt[e.parser].parse(
`${c}\`\``,
e
);
if (d instanceof Promise)
throw new TypeError(
"Async parse function hasn't been supported yet."
);
g = d;
} catch {
continue;
}
if (g.type === "File" && (g = g.program), !(g.type === "Program" && g.body[0]?.type === "ExpressionStatement"))
continue;
const a = g.body[0]?.expression;
if (a?.type !== "TaggedTemplateExpression")
continue;
if (n.tag, a.tag, Mt(n.tag, a.tag, l))
return c;
}
}
const { estree: Nt } = Ut, Ro = function(t, n) {
function wo(t) {
return /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(t);
}
function Nt(t, n, r = /* @__PURE__ */ new Set()) {
return Object.is(t, n) ? !0 : Array.isArray(t) ? Bo(t, n, r) : typeof t == "object" ? Mt(
t,
n,
r
) : !1;
}
function Bo(t, n, r = /* @__PURE__ */ new Set()) {
const e = t.length;
if (e != n.length)
return !1;
for (let o = 0; o < e; o++)
if (!Nt(t[o], n[o], r))
return !1;
return !0;
}
function Mt(t, n, r = /* @__PURE__ */ new Set()) {
for (const e of Object.keys(t))
if (!r.has(e) && !(Object.prototype.hasOwnProperty.call(n, e) && Nt(t[e], n[e], r)))
return !1;
return !0;
}
const { estree: Rt } = Gt, Uo = function(t, n) {
const { node: r } = t;
if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
return null;
for (const e of Lt) {
for (const e of Tt) {
const o = n[S(e)];
if (!o)
continue;
const s = Ao(
t,
o,
n.noEmbeddedIdentificationByComment ?? []
) ?? Po(
t,
o,
n.noEmbeddedIdentificationByTag ?? []
);
const s = Fo(t, o, n) ?? jo(t, o, n);
if (s === void 0)
continue;
const l = Ot[e];
const l = At[e];
if (!l)
return null;
const d = t.node;
return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (p, c, a, u) => {
const y = await No(
const c = t.node;
return c.quasis.length === 1 && c.quasis[0]?.value.raw.trim() === "" ? "``" : async (g, a, d, u) => {
const y = await Ro(
u.embeddedOverrides,

@@ -1726,3 +1781,3 @@ s,

try {
const b = await l(p, c, a, u, {
const E = await l(g, a, d, u, {
identifier: s,

@@ -1732,27 +1787,27 @@ identifiers: o,

});
return I.label(
{ embed: !0, ...b.label },
b
return D.label(
{ embed: !0, ...E.label },
E
);
} catch (b) {
throw console.error(b), b;
} catch (E) {
throw console.error(E), E;
}
};
}
return Nt.embed?.(t, n) ?? null;
}, Xo = {
return Rt.embed?.(t, n) ?? null;
}, Zo = {
estree: {
...Nt,
embed: Ro
...Rt,
embed: Uo
}
};
export {
Ot as embeddedEmbedders,
Lt as embeddedLanguages,
Mt as embeddedOptions,
Tt as embeddedParsers,
At as embeddedEmbedders,
Tt as embeddedLanguages,
Pt as embeddedOptions,
Ot as embeddedParsers,
S as makeIdentifiersOptionName,
Ho as options,
Jo as parsers,
Xo as printers
Vo as options,
lt as parsers,
Zo as printers
};

@@ -28,3 +28,3 @@ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type PrettierPluginEmbedOptions } from "./embedded/index.js";

readonly preserveEmbeddedExteriorWhitespaces: {
readonly category: "Config";
readonly category: "Embed";
readonly type: "string";

@@ -141,3 +141,3 @@ readonly array: true;

choices: {
value: "json" | "json-stringify" | "json5";
value: "json" | "json5" | "jsonc" | "json-stringify";
description: string;

@@ -144,0 +144,0 @@ }[];

@@ -20,3 +20,4 @@ export declare const parsers: {

json5: import("prettier").Parser<any>;
jsonc: import("prettier").Parser<any>;
"json-stringify": import("prettier").Parser<any>;
};

@@ -1,12 +0,23 @@

import type { Comment, Node as EsTreeNode, TemplateLiteral } from "estree";
import type { TemplateLiteral } from "estree";
import type { AstPath, Doc, Options } from "prettier";
import { makeIdentifiersOptionName, type AutocompleteStringList, type EmbeddedDefaultIdentifier, type EmbeddedLanguage, type PrettierPluginEmbedOptions } from "./embedded/index.js";
import type { PrettierPluginGlobalOptions } from "./options.js";
export type PrettierNode = EsTreeNode & {
comments?: (Comment & {
declare module "estree" {
interface Comment {
leading: boolean;
trailing: boolean;
nodeDescription: string;
})[];
};
}
interface BaseNode {
comments?: Comment[];
}
interface File extends BaseNode {
type: "File";
sourceType: "script" | "module";
program: Program;
}
interface NodeMap {
File: File;
}
}
export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;

@@ -13,0 +24,0 @@ export interface EmbedderPayload {

@@ -1,5 +0,5 @@

import { type AstPath } from "prettier";
import type { PrettierNode } from "./types.js";
export declare const resolveEmbeddedOverrideOptions: (embeddedOverridesString: string | undefined, identifier: string, sourceFilePath?: string) => Promise<Omit<Omit<import("prettier").Options, keyof import("./index.js").PrettierPluginEmbedOptions> & Omit<import("./index.js").PrettierPluginEmbedOptions, "embeddedNoopIdentifiers" | "embeddedCssIdentifiers" | "embeddedEsIdentifiers" | "embeddedGlslIdentifiers" | "embeddedGraphqlIdentifiers" | "embeddedHtmlIdentifiers" | "embeddedIniIdentifiers" | "embeddedJsonIdentifiers" | "embeddedLatexIdentifiers" | "embeddedMarkdownIdentifiers" | "embeddedPhpIdentifiers" | "embeddedPropertiesIdentifiers" | "embeddedRubyIdentifiers" | "embeddedShIdentifiers" | "embeddedSqlIdentifiers" | "embeddedTomlIdentifiers" | "embeddedTsIdentifiers" | "embeddedXmlIdentifiers" | "embeddedYamlIdentifiers" | keyof import("./options.js").PrettierPluginGlobalOptions>, "parser" | "filepath" | "endOfLine" | "embeddedLanguageFormatting" | "printWidth" | "tabWidth" | "useTabs" | `__${string}`> | undefined>;
export declare function getIdentifierFromComment({ node, parent }: AstPath<PrettierNode>, comments: string[], noIdentificationList: string[]): string | undefined;
export declare function getIdentifierFromTag({ node, parent }: AstPath<PrettierNode>, tags: string[], noIdentificationList: string[]): string | undefined;
import type { Node } from "estree";
import { type AstPath, type Options } from "prettier";
export declare const resolveEmbeddedOverrideOptions: (embeddedOverridesString: string | undefined, identifier: string, sourceFilePath?: string) => Promise<Omit<Omit<Options, keyof import("./index.js").PrettierPluginEmbedOptions> & Omit<import("./index.js").PrettierPluginEmbedOptions, "embeddedNoopIdentifiers" | "embeddedCssIdentifiers" | "embeddedEsIdentifiers" | "embeddedGlslIdentifiers" | "embeddedGraphqlIdentifiers" | "embeddedHtmlIdentifiers" | "embeddedIniIdentifiers" | "embeddedJsonIdentifiers" | "embeddedLatexIdentifiers" | "embeddedMarkdownIdentifiers" | "embeddedPhpIdentifiers" | "embeddedPropertiesIdentifiers" | "embeddedRubyIdentifiers" | "embeddedShIdentifiers" | "embeddedSqlIdentifiers" | "embeddedTomlIdentifiers" | "embeddedTsIdentifiers" | "embeddedXmlIdentifiers" | "embeddedYamlIdentifiers" | keyof import("./options.js").PrettierPluginGlobalOptions>, "parser" | "filepath" | "endOfLine" | "embeddedLanguageFormatting" | "printWidth" | "tabWidth" | "useTabs" | `__${string}`> | undefined>;
export declare function getIdentifierFromComment({ node, parent }: AstPath<Node>, comments: string[], options: Options): string | undefined;
export declare function getIdentifierFromTag({ node, parent }: AstPath<Node>, tags: string[], options: Options): string | undefined;

@@ -5,3 +5,3 @@ {

"private": false,
"version": "0.4.4",
"version": "0.4.5",
"type": "module",

@@ -68,10 +68,10 @@ "files": [

"@prettier/plugin-php": "^0.22.1",
"@prettier/plugin-ruby": "^4.0.0",
"@prettier/plugin-xml": "^3.1.0",
"@prettier/plugin-ruby": "^4.0.4",
"@prettier/plugin-xml": "^3.2.2",
"@types/estree": "^1.0.5",
"@types/node": "^20.10.7",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"@vitest/coverage-istanbul": "^1.1.3",
"@vitest/ui": "^1.1.3",
"@types/node": "^20.11.0",
"@typescript-eslint/eslint-plugin": "^6.18.1",
"@typescript-eslint/parser": "^6.18.1",
"@vitest/coverage-istanbul": "^1.2.0",
"@vitest/ui": "^1.2.0",
"@xml-tools/parser": "^1.0.11",

@@ -83,3 +83,3 @@ "chevrotain": "7.1.1",

"npm-check-updates": "^16.14.12",
"prettier": "^3.0.0",
"prettier": "^3.2.1",
"prettier-plugin-glsl": "^0.1.3",

@@ -93,3 +93,3 @@ "prettier-plugin-ini": "^1.1.0",

"prettier-plugin-sql": "^0.18.0",
"prettier-plugin-sql-cst": "^0.10.0",
"prettier-plugin-sql-cst": "^0.10.2",
"prettier-plugin-toml": "^2.0.1",

@@ -99,3 +99,3 @@ "tsx": "^4.7.0",

"vite": "^5.0.11",
"vitest": "^1.1.3"
"vitest": "^1.2.0"
},

@@ -102,0 +102,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc