prettier-plugin-embed
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -7,6 +7,6 @@ import type { EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers } from "./types.js"; | ||
import * as __glob__0_0 from "./css/index.js"; | ||
import * as __glob__0_1 from "./graphql/index.js"; | ||
import * as __glob__0_1 from "./es/index.js"; | ||
import * as __glob__0_2 from "./glsl/index.js"; | ||
import * as __glob__0_3 from "./html/index.js"; | ||
import * as __glob__0_4 from "./es/index.js"; | ||
import * as __glob__0_3 from "./graphql/index.js"; | ||
import * as __glob__0_4 from "./html/index.js"; | ||
import * as __glob__0_5 from "./ini/index.js"; | ||
@@ -13,0 +13,0 @@ import * as __glob__0_6 from "./json/index.js"; |
@@ -38,9 +38,6 @@ import type { SqlBaseOptions as PrettierPluginSqlOptions } from "prettier-plugin-sql"; | ||
description: string; | ||
choices: ({ | ||
value: "prettier-plugin-sql"; | ||
choices: { | ||
value: "prettier-plugin-sql" | "prettier-plugin-sql-cst"; | ||
description: string; | ||
} | { | ||
value: "prettier-plugin-sql-cst"; | ||
description: string; | ||
})[]; | ||
}[]; | ||
}; | ||
@@ -52,9 +49,6 @@ readonly embeddedSqlParser: { | ||
description: string; | ||
choices: ({ | ||
value: "sqlite"; | ||
choices: { | ||
value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql"; | ||
description: string; | ||
} | { | ||
value: "bigquery"; | ||
description: string; | ||
})[]; | ||
}[]; | ||
}; | ||
@@ -61,0 +55,0 @@ }; |
@@ -8,4 +8,4 @@ import { utils as X, builders as I } from "prettier/doc"; | ||
import { printers as Ut } from "prettier/plugins/estree.mjs"; | ||
import { readFile as Wt } from "node:fs/promises"; | ||
import { isAbsolute as Ct, dirname as Gt, resolve as qt, extname as zt } from "node:path"; | ||
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"; | ||
@@ -25,3 +25,3 @@ import { resolveConfigFile as Ht } from "prettier"; | ||
} | ||
function L(t, n, r) { | ||
function T(t, n, r) { | ||
return Qt(t, (o) => { | ||
@@ -78,3 +78,3 @@ if (typeof o != "string") | ||
})(); | ||
function T(t = "p", n = "") { | ||
function L(t = "p", n = "") { | ||
const r = Y(), e = Y(), o = ce(t), s = ce(n), l = (p) => `${t}${r}${p}${e}${n}`, d = new RegExp( | ||
@@ -106,3 +106,3 @@ `${o}${r}(\\d+)${e}${s}`, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T("@p"), c = l.quasis.map( | ||
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) | ||
@@ -115,3 +115,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "scss" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -150,3 +150,3 @@ return k([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -159,3 +159,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: e.embeddedEsParser ?? "babel" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -220,3 +220,3 @@ return N([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -229,3 +229,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "glsl-parser" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -264,3 +264,3 @@ return A([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -273,3 +273,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "graphql" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -308,3 +308,3 @@ return P([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -350,4 +350,4 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
]); | ||
}, ht = "embeddedHtml", xn = ["html", "xhtml"], Tn = S(ht), Ln = { | ||
[Tn]: { | ||
}, ht = "embeddedHtml", xn = ["html", "xhtml"], Ln = S(ht), Tn = { | ||
[Ln]: { | ||
category: "Embed", | ||
@@ -363,3 +363,3 @@ type: "string", | ||
language: ht, | ||
options: Ln | ||
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 }) => { | ||
@@ -370,3 +370,3 @@ M("prettier-plugin-ini", e, o), e = { | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -379,3 +379,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "ini" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -409,3 +409,3 @@ return j([ | ||
options: An | ||
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: F, indent: Te, softline: Le } = I, Rn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: F, indent: Le, softline: Te } = I, Rn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
e = { | ||
@@ -423,3 +423,3 @@ ...e, | ||
parser: e.embeddedJsonParser ?? "json" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -429,10 +429,10 @@ return F([ | ||
a, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : Te([F(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : Le([F(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = a.length ? xe : Le, v = u.length ? xe : Le; | ||
const h = a.length ? xe : Te, v = u.length ? xe : Te; | ||
return F([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] : Te([h, F(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] : Le([h, F(i)]), | ||
v, | ||
@@ -449,3 +449,3 @@ "`" | ||
} | ||
const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify", "json5"], Bn = V(ne), Un = S(ne), Wn = { | ||
const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify", "json5"], Bn = V(ne), Un = S(ne), Cn = { | ||
[Un]: { | ||
@@ -468,7 +468,7 @@ category: "Embed", | ||
} | ||
}, Cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Rn, | ||
language: ne, | ||
options: Wn | ||
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 }) => { | ||
@@ -479,3 +479,3 @@ M("prettier-plugin-latex", e, o), e = { | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -488,3 +488,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "latex-parser" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -532,3 +532,3 @@ return w([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -542,3 +542,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
__inJsTemplate: !0 | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -589,3 +589,3 @@ return B([ | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T("$p"), c = l.quasis.map( | ||
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) | ||
@@ -598,3 +598,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "php" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -628,3 +628,3 @@ return U([ | ||
options: sr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: W, indent: Be, softline: Ue } = I, cr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
}, 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 = { | ||
@@ -634,3 +634,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -643,8 +643,8 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "dot-properties" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return W([ | ||
return C([ | ||
"`", | ||
a, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [W(i)] : Be([W(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [C(i)] : Be([C(i)]), | ||
u, | ||
@@ -654,5 +654,5 @@ "`" | ||
const h = a.length ? we : Ue, v = u.length ? we : Ue; | ||
return W([ | ||
return C([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, W(i)] : Be([h, W(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, C(i)] : Be([h, C(i)]), | ||
v, | ||
@@ -674,3 +674,3 @@ "`" | ||
options: lr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: We, group: C, indent: Ce, softline: Ge } = I, gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
}, 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 = { | ||
@@ -680,3 +680,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -689,15 +689,15 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: e.embeddedRubyParser ?? "ruby" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
return C([ | ||
return W([ | ||
"`", | ||
a, | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [C(i)] : Ce([C(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [W(i)] : We([W(i)]), | ||
u, | ||
"`" | ||
]); | ||
const h = a.length ? We : Ge, v = u.length ? We : Ge; | ||
return C([ | ||
const h = a.length ? Ce : Ge, v = u.length ? Ce : Ge; | ||
return W([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, C(i)] : Ce([h, C(i)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, W(i)] : We([h, W(i)]), | ||
v, | ||
@@ -734,3 +734,3 @@ "`" | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -812,9 +812,9 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
function xr(t, n, r) { | ||
return n = Tr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t; | ||
return n = Lr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t; | ||
} | ||
function Tr(t) { | ||
var n = Lr(t, "string"); | ||
function Lr(t) { | ||
var n = Tr(t, "string"); | ||
return typeof n == "symbol" ? n : String(n); | ||
} | ||
function Lr(t, n) { | ||
function Tr(t, n) { | ||
if (typeof t != "object" || t === null) | ||
@@ -869,3 +869,3 @@ return t; | ||
M(l, e, o); | ||
const { node: d } = r, { createPlaceholder: p, placeholderRegex: c } = T(), a = d.quasis.map( | ||
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) | ||
@@ -882,3 +882,3 @@ ).join(""), u = a.match(/^\s+/)?.[0] ?? "", y = a.match(/\s+$/)?.[0] ?? "", b = a.slice( | ||
}); | ||
i = L(m, c, E); | ||
i = T(m, c, E); | ||
} else { | ||
@@ -925,4 +925,10 @@ const m = await t(Or(b), { | ||
]); | ||
}, Z = "embeddedSql", Ar = ["sql"], Pr = S(Z), Rr = en(Z), jr = V(Z), Fr = { | ||
[Pr]: { | ||
}, Z = "embeddedSql", Ar = ["sql"], Pr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Rr = [ | ||
"sqlite", | ||
"bigquery", | ||
"mysql", | ||
"mariadb", | ||
"postgresql" | ||
], jr = S(Z), Fr = en(Z), wr = V(Z), Br = { | ||
[jr]: { | ||
category: "Embed", | ||
@@ -934,3 +940,3 @@ type: "string", | ||
}, | ||
[Rr]: { | ||
[Fr]: { | ||
category: "Embed", | ||
@@ -940,14 +946,8 @@ type: "choice", | ||
description: 'Specify the Prettier plugin for parsing and formatting SQL. Default is "prettier-plugin-sql"', | ||
choices: [ | ||
{ | ||
value: "prettier-plugin-sql", | ||
description: 'Use "prettier-plugin-sql".' | ||
}, | ||
{ | ||
value: "prettier-plugin-sql-cst", | ||
description: 'Use "prettier-plugin-sql-cst".' | ||
} | ||
] | ||
choices: Pr.map((t) => ({ | ||
value: t, | ||
description: `Use "${t}".` | ||
})) | ||
}, | ||
[jr]: { | ||
[wr]: { | ||
category: "Embed", | ||
@@ -957,19 +957,13 @@ type: "choice", | ||
description: 'Specify the embedded SQL language parser. Default is "sqlite". This option is only for "prettier-plugin-sql-cst".', | ||
choices: [ | ||
{ | ||
value: "sqlite", | ||
description: "SQLite parser." | ||
}, | ||
{ | ||
value: "bigquery", | ||
description: "BigQuery parser." | ||
} | ||
] | ||
choices: Rr.map((t) => ({ | ||
value: t, | ||
description: `Use "${t}" parser.` | ||
})) | ||
} | ||
}, wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Nr, | ||
language: Z, | ||
options: Fr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: Ve, group: z, indent: Ze, softline: et, hardline: Br } = I, { mapDoc: Ur } = X, Wr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
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 = { | ||
@@ -979,3 +973,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -988,3 +982,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "toml" | ||
}), i = Ur(E, (m) => { | ||
}), i = Wr(E, (m) => { | ||
if (typeof m != "string") | ||
@@ -999,3 +993,3 @@ return m; | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === ` | ||
` ? g.push(Br) : g.push(D)); | ||
` ? g.push(Cr) : g.push(D)); | ||
} else { | ||
@@ -1023,16 +1017,16 @@ const D = Number(_); | ||
]); | ||
}, It = "embeddedToml", Cr = ["toml"], Gr = S(It), qr = { | ||
[Gr]: { | ||
}, It = "embeddedToml", qr = ["toml"], zr = S(It), Kr = { | ||
[zr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Cr] }], | ||
default: [{ value: [...qr] }], | ||
description: 'Specify embedded TOML language identifiers. This requires "prettier-plugin-toml".' | ||
} | ||
}, zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Wr, | ||
embedder: Gr, | ||
language: It, | ||
options: qr | ||
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt } = I, Kr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
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 }) => { | ||
e = { | ||
@@ -1042,3 +1036,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -1054,3 +1048,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
filepath: void 0 | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -1071,11 +1065,11 @@ return K([ | ||
]); | ||
}, oe = "embeddedTs", Hr = ["ts", "tsx", "cts", "mts", "typescript"], Jr = ["typescript", "babel-ts"], Xr = V(oe), Yr = S(oe), Qr = { | ||
[Yr]: { | ||
}, oe = "embeddedTs", Xr = ["ts", "tsx", "cts", "mts", "typescript"], Yr = ["typescript", "babel-ts"], Qr = V(oe), Vr = S(oe), Zr = { | ||
[Vr]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Hr] }], | ||
default: [{ value: [...Xr] }], | ||
description: "Specify embedded TS language parsers." | ||
}, | ||
[Xr]: { | ||
[Qr]: { | ||
category: "Embed", | ||
@@ -1085,3 +1079,3 @@ type: "choice", | ||
description: 'Specify the embedded TS language parser. Default is "typescript".', | ||
choices: Jr.map((t) => ({ | ||
choices: Yr.map((t) => ({ | ||
value: t, | ||
@@ -1091,8 +1085,8 @@ description: `Use "${t}".` | ||
} | ||
}, Vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Kr, | ||
embedder: Jr, | ||
language: oe, | ||
options: Qr | ||
}, Symbol.toStringTag, { value: "Module" })), se = "embeddedXml", { line: ot, group: H, indent: st, softline: ee } = I, Zr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
options: Zr | ||
}, Symbol.toStringTag, { value: "Module" })), se = "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 = { | ||
@@ -1102,3 +1096,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -1125,3 +1119,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
} | ||
const h = L(E, p, b); | ||
const h = T(E, p, b); | ||
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -1142,8 +1136,8 @@ return H([ | ||
]); | ||
}, eo = ["xml", "opml", "rss", "svg"], to = S(se), no = { | ||
[to]: { | ||
}, no = ["xml", "opml", "rss", "svg"], ro = S(se), oo = { | ||
[ro]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...eo] }], | ||
default: [{ value: [...no] }], | ||
description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".' | ||
@@ -1162,3 +1156,3 @@ }, | ||
}; | ||
function ro(t) { | ||
function so(t) { | ||
const n = { | ||
@@ -1203,3 +1197,3 @@ loc: { | ||
} | ||
const oo = { | ||
const io = { | ||
async parse(t, n) { | ||
@@ -1209,3 +1203,3 @@ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: o, cst: s } = r(t); | ||
const l = e[0]; | ||
throw ro(l); | ||
throw so(l); | ||
} | ||
@@ -1266,3 +1260,3 @@ if (o.length > 0) { | ||
const s = e[o]; | ||
if (so(s)) { | ||
if (co(s)) { | ||
if (Object.keys(s.children).length === 0) { | ||
@@ -1277,12 +1271,12 @@ e.splice(o, 1), e.length === 0 && delete n[r]; | ||
} | ||
function so(t) { | ||
function co(t) { | ||
return "name" in t && "children" in t && "location" in t; | ||
} | ||
const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: Zr, | ||
embedder: to, | ||
language: se, | ||
options: no, | ||
parser: oo | ||
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: at, softline: dt } = I, co = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => { | ||
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 }) => { | ||
e = { | ||
@@ -1292,3 +1286,3 @@ ...e, | ||
}; | ||
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = T(), c = l.quasis.map( | ||
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) | ||
@@ -1301,3 +1295,3 @@ ).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice( | ||
parser: "yaml" | ||
}), i = L(E, p, b); | ||
}), i = T(E, p, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o)) | ||
@@ -1318,16 +1312,16 @@ return J([ | ||
]); | ||
}, xt = "embeddedYaml", ao = ["yaml", "yml"], lo = S(xt), uo = { | ||
[lo]: { | ||
}, xt = "embeddedYaml", uo = ["yaml", "yml"], go = S(xt), po = { | ||
[go]: { | ||
category: "Embed", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...ao] }], | ||
default: [{ value: [...uo] }], | ||
description: "Specify embedded YAML language identifiers." | ||
} | ||
}, go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embedder: co, | ||
embedder: lo, | ||
language: xt, | ||
options: uo | ||
}, Symbol.toStringTag, { value: "Module" })), Tt = [], Lt = {}, Ot = {}, Mt = {}, po = /* @__PURE__ */ Object.assign({ | ||
options: po | ||
}, Symbol.toStringTag, { value: "Module" })), Lt = [], Tt = {}, Ot = {}, Mt = {}, ho = /* @__PURE__ */ Object.assign({ | ||
"./css/index.ts": sn, | ||
@@ -1339,3 +1333,3 @@ "./es/index.ts": pn, | ||
"./ini/index.ts": Pn, | ||
"./json/index.ts": Cn, | ||
"./json/index.ts": Wn, | ||
"./latex/index.ts": Hn, | ||
@@ -1348,14 +1342,14 @@ "./markdown/index.ts": Vn, | ||
"./sh/index.ts": Sr, | ||
"./sql/index.ts": wr, | ||
"./toml/index.ts": zr, | ||
"./ts/index.ts": Vr, | ||
"./xml/index.ts": io, | ||
"./yaml/index.ts": go | ||
"./sql/index.ts": Ur, | ||
"./toml/index.ts": Hr, | ||
"./ts/index.ts": eo, | ||
"./xml/index.ts": ao, | ||
"./yaml/index.ts": mo | ||
}); | ||
Object.values(po).forEach(({ language: t, parser: n, embedder: r, options: e }) => { | ||
Zt(Tt, t, re), n && (Lt[t] = n), r && (Ot[t] = r), Object.assign(Mt, e); | ||
Object.values(ho).forEach(({ language: t, parser: n, embedder: r, options: e }) => { | ||
Zt(Lt, t, re), n && (Tt[t] = n), r && (Ot[t] = r), Object.assign(Mt, e); | ||
}); | ||
const mo = "noEmbeddedIdentificationByComment", ho = "noEmbeddedIdentificationByTag", fo = "preserveEmbeddedExteriorWhitespaces", Eo = "noEmbeddedMultiLineIndentation", bo = "embeddedOverrides", zo = { | ||
const fo = "noEmbeddedIdentificationByComment", Eo = "noEmbeddedIdentificationByTag", bo = "preserveEmbeddedExteriorWhitespaces", yo = "noEmbeddedMultiLineIndentation", _o = "embeddedOverrides", Ho = { | ||
...Mt, | ||
[mo]: { | ||
[fo]: { | ||
category: "Embed", | ||
@@ -1367,3 +1361,3 @@ type: "string", | ||
}, | ||
[ho]: { | ||
[Eo]: { | ||
category: "Embed", | ||
@@ -1375,3 +1369,3 @@ type: "string", | ||
}, | ||
[fo]: { | ||
[bo]: { | ||
category: "Config", | ||
@@ -1383,3 +1377,3 @@ type: "string", | ||
}, | ||
[Eo]: { | ||
[yo]: { | ||
category: "Embed", | ||
@@ -1391,3 +1385,3 @@ type: "string", | ||
}, | ||
[bo]: { | ||
[_o]: { | ||
category: "Embed", | ||
@@ -1399,3 +1393,3 @@ type: "string", | ||
} | ||
}, Ko = { | ||
}, Jo = { | ||
// parsers from internal | ||
@@ -1408,5 +1402,5 @@ ...Rt.parsers, | ||
// parsers from this plugin | ||
...Lt | ||
...Tt | ||
}; | ||
var yo = { | ||
var vo = { | ||
isEqual: !0, | ||
@@ -1420,17 +1414,17 @@ isMatchingKey: !0, | ||
transformKey: !0 | ||
}, _o = Array.prototype.slice; | ||
}, $o = 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]] : $o.call(t, 0) : []; | ||
} | ||
function vo(t) { | ||
function Do(t) { | ||
var n = {}; | ||
for (var r in t) | ||
yo[r] || (n[r] = t[r]); | ||
vo[r] || (n[r] = t[r]); | ||
return n; | ||
} | ||
function $o(t) { | ||
function Io(t) { | ||
return typeof t == "function" && t.isMemoized; | ||
} | ||
function Do(t, n) { | ||
function So(t, n) { | ||
return t === n || t !== t && n !== n; | ||
@@ -1446,3 +1440,3 @@ } | ||
} | ||
var Io = ( | ||
var xo = ( | ||
/** @class */ | ||
@@ -1544,7 +1538,7 @@ function() { | ||
function kt(t, n) { | ||
if (n === void 0 && (n = {}), $o(t)) | ||
if (n === void 0 && (n = {}), Io(t)) | ||
return kt(t.fn, lt(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 ? Do : 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 ? 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({ | ||
isEqual: e, | ||
@@ -1558,3 +1552,3 @@ isMatchingKey: o, | ||
transformKey: y | ||
}, vo(n)), E = new Io(b), i = E.keys, h = E.values, v = E.canTransformKey, m = E.shouldCloneArguments, g = E.shouldUpdateOnAdd, f = E.shouldUpdateOnChange, $ = E.shouldUpdateOnHit, _ = function() { | ||
}, 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; | ||
@@ -1575,3 +1569,3 @@ v && (D = y(D)); | ||
try { | ||
const n = await Wt(t, { encoding: "utf-8" }); | ||
const n = await Ct(t, { encoding: "utf-8" }); | ||
return JSON.parse(n); | ||
@@ -1581,8 +1575,8 @@ } catch { | ||
} | ||
const So = /* @__PURE__ */ new URL( | ||
const Lo = /* @__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 xo(t) { | ||
async function To(t) { | ||
return new Promise((n) => { | ||
const r = new Kt(So, { | ||
const r = new Kt(Lo, { | ||
workerData: { | ||
@@ -1599,3 +1593,3 @@ absolutePath: t | ||
} | ||
async function To(t) { | ||
async function Oo(t) { | ||
console.error( | ||
@@ -1605,5 +1599,5 @@ "Ts module type embeddedOverrides has not been implemented yet." | ||
} | ||
const Lo = kt( | ||
const Mo = kt( | ||
async (t, n) => { | ||
if (Ct(t)) | ||
if (Wt(t)) | ||
return t; | ||
@@ -1614,4 +1608,4 @@ const r = await Ht(n); | ||
} | ||
), Oo = async (t, n) => { | ||
const r = Lo( | ||
), ko = async (t, n) => { | ||
const r = Mo( | ||
t, | ||
@@ -1627,3 +1621,3 @@ n | ||
} else if (e === ".mjs" || e === ".cjs" || e === ".js") { | ||
const o = await r, s = await xo(o); | ||
const o = await r, s = await To(o); | ||
if (s !== void 0) | ||
@@ -1634,3 +1628,3 @@ return s; | ||
} else if (e === ".mts" || e === ".cts" || e === ".ts") { | ||
const o = await r, s = await To(); | ||
const o = await r, s = await Oo(); | ||
if (s !== void 0) | ||
@@ -1650,6 +1644,6 @@ return s; | ||
} | ||
}, Mo = async (t, n, r) => { | ||
}, No = async (t, n, r) => { | ||
if (t === void 0) | ||
return; | ||
const e = await Oo( | ||
const e = await ko( | ||
t, | ||
@@ -1667,3 +1661,3 @@ r | ||
}; | ||
function ko({ node: t, parent: n }, r, e) { | ||
function Ao({ node: t, parent: n }, r, e) { | ||
if (r.length === 0 || t.type !== "TemplateLiteral") | ||
@@ -1688,3 +1682,3 @@ return; | ||
} | ||
function No({ node: t, parent: n }, r, e) { | ||
function Po({ node: t, parent: n }, r, e) { | ||
if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) { | ||
@@ -1696,15 +1690,15 @@ for (const o of r) | ||
} | ||
const { estree: Nt } = Ut, Ao = function(t, n) { | ||
const { estree: Nt } = Ut, Ro = 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 Tt) { | ||
for (const e of Lt) { | ||
const o = n[S(e)]; | ||
if (!o) | ||
continue; | ||
const s = ko( | ||
const s = Ao( | ||
t, | ||
o, | ||
n.noEmbeddedIdentificationByComment ?? [] | ||
) ?? No( | ||
) ?? Po( | ||
t, | ||
@@ -1721,3 +1715,3 @@ o, | ||
return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (p, c, a, u) => { | ||
const y = await Mo( | ||
const y = await No( | ||
u.embeddedOverrides, | ||
@@ -1743,6 +1737,6 @@ s, | ||
return Nt.embed?.(t, n) ?? null; | ||
}, Ho = { | ||
}, Xo = { | ||
estree: { | ||
...Nt, | ||
embed: Ao | ||
embed: Ro | ||
} | ||
@@ -1752,9 +1746,9 @@ }; | ||
Ot as embeddedEmbedders, | ||
Tt as embeddedLanguages, | ||
Lt as embeddedLanguages, | ||
Mt as embeddedOptions, | ||
Lt as embeddedParsers, | ||
Tt as embeddedParsers, | ||
S as makeIdentifiersOptionName, | ||
zo as options, | ||
Ko as parsers, | ||
Ho as printers | ||
Ho as options, | ||
Jo as parsers, | ||
Xo as printers | ||
}; |
@@ -222,9 +222,6 @@ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type PrettierPluginEmbedOptions } from "./embedded/index.js"; | ||
description: string; | ||
choices: ({ | ||
value: "prettier-plugin-sql"; | ||
choices: { | ||
value: "prettier-plugin-sql" | "prettier-plugin-sql-cst"; | ||
description: string; | ||
} | { | ||
value: "prettier-plugin-sql-cst"; | ||
description: string; | ||
})[]; | ||
}[]; | ||
}; | ||
@@ -236,9 +233,6 @@ readonly embeddedSqlParser: { | ||
description: string; | ||
choices: ({ | ||
value: "sqlite"; | ||
choices: { | ||
value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql"; | ||
description: string; | ||
} | { | ||
value: "bigquery"; | ||
description: string; | ||
})[]; | ||
}[]; | ||
}; | ||
@@ -245,0 +239,0 @@ readonly embeddedTomlIdentifiers: { |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147587
3396