prettier-plugin-embed
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -9,3 +9,3 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>; | ||
declare const embeddedLanguageIdentifiersOptionName: "embeddedCssIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedCssIdentifiers"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -31,3 +31,3 @@ } | ||
interface PrettierPluginEmbedOptions { | ||
[embeddedLanguageIdentifiersOptionName]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
} | ||
@@ -34,0 +34,0 @@ } |
@@ -11,4 +11,4 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type EsParser = (typeof DEFAULT_ES_PARSERS)[number]; | ||
declare const embeddedLanguageIdentifiersOptionName: "embeddedEsIdentifiers"; | ||
declare const embeddedLanguageParserOptionName: "embeddedEsParser"; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedEsIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedEsParser"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -41,4 +41,4 @@ } | ||
interface PrettierPluginEmbedOptions { | ||
[embeddedLanguageIdentifiersOptionName]?: Identifiers; | ||
[embeddedLanguageParserOptionName]?: EsParser; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_PARSER]?: EsParser; | ||
} | ||
@@ -45,0 +45,0 @@ } |
@@ -9,3 +9,3 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>; | ||
declare const embeddedLanguageIdentifiersOptionName: "embeddedMarkdownIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedMarkdownIdentifiers"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -32,3 +32,3 @@ __inJsTemplate?: boolean; | ||
interface PrettierPluginEmbedOptions { | ||
[embeddedLanguageIdentifiersOptionName]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
} | ||
@@ -35,0 +35,0 @@ } |
@@ -7,5 +7,5 @@ import type { EmbeddedEmbedders, EmbeddedLanguage, EmbeddedOptions, EmbeddedParsers } from "./types.js"; | ||
import * as __glob__0_0 from "./css/index.js"; | ||
import * as __glob__0_1 from "./glsl/index.js"; | ||
import * as __glob__0_1 from "./es/index.js"; | ||
import * as __glob__0_2 from "./html/index.js"; | ||
import * as __glob__0_3 from "./es/index.js"; | ||
import * as __glob__0_3 from "./glsl/index.js"; | ||
import * as __glob__0_4 from "./markdown/index.js"; | ||
@@ -15,4 +15,4 @@ import * as __glob__0_5 from "./noop/index.js"; | ||
import * as __glob__0_7 from "./ruby/index.js"; | ||
import * as __glob__0_8 from "./sql/index.js"; | ||
import * as __glob__0_9 from "./ts/index.js"; | ||
import * as __glob__0_8 from "./ts/index.js"; | ||
import * as __glob__0_9 from "./sql/index.js"; | ||
import * as __glob__0_10 from "./xml/index.js"; |
import type { SqlBaseOptions as PrettierPluginDepsOptions } from "prettier-plugin-sql"; | ||
import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
/** References | ||
* - https://github.com/un-ts/prettier/blob/a5f1aae6464aa54749377d69a8237a70a6509a13/packages/sql/src/index.ts | ||
* - https://github.com/un-ts/prettier/blob/master/packages/sql/src/index.ts | ||
* "sql" is the default dialect, so we only have "sql" as the default identifier to avoid confusion. | ||
*/ | ||
export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "db2", "db2i", "hive", "mariadb", "mysql", "n1ql", "postgresql", "plsql", "redshift", "singlestoredb", "snowflake", "spark", "sqlite", "transactsql", "tsql", "trino"]; | ||
export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql", "snowflake"]; | ||
type Identifiers = AutocompleteStringList<typeof SQL_FORMATTER_LANGUAGES | typeof NODE_SQL_PARSER_DATABASES>; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof SQL_FORMATTER_LANGUAGES | typeof NODE_SQL_PARSER_DATABASES>; | ||
export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number]; | ||
export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number]; | ||
declare const DEFAULT_IDENTIFIERS: readonly ["sql"]; | ||
type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>; | ||
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>; | ||
declare const embeddedLanguageIdentifiers: "embeddedSqlIdentifiers"; | ||
@@ -20,3 +18,3 @@ export { PrettierPluginDepsOptions }; | ||
default: { | ||
value: string[]; | ||
value: "sql"[]; | ||
}[]; | ||
@@ -23,0 +21,0 @@ description: string; |
@@ -11,4 +11,4 @@ import { type AutocompleteStringList, type StringListToInterfaceKey } from "../utils.js"; | ||
type TsParser = (typeof DEFAULT_TS_PARSERS)[number]; | ||
declare const EMBEDDED_LANGUAGE_PARSER = "embeddedTsParser"; | ||
declare const embeddedLanguageIdentifiers: "embeddedTsIdentifiers"; | ||
declare const EMBEDDED_LANGUAGE_PARSER: "embeddedTsParser"; | ||
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedTsIdentifiers"; | ||
export interface PrettierPluginDepsOptions { | ||
@@ -41,3 +41,3 @@ } | ||
interface PrettierPluginEmbedOptions { | ||
[embeddedLanguageIdentifiers]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_IDENTIFIERS]?: Identifiers; | ||
[EMBEDDED_LANGUAGE_PARSER]?: TsParser; | ||
@@ -44,0 +44,0 @@ } |
@@ -1,26 +0,26 @@ | ||
import { utils as G, builders as $ } from "prettier/doc"; | ||
import Xe from "prettier/parser-babel"; | ||
import Je from "prettier/parser-espree"; | ||
import Ye from "prettier/parser-flow"; | ||
import Ve from "prettier/parser-meriyah"; | ||
import Qe from "prettier/parser-typescript"; | ||
import { printers as Ze } from "prettier/plugins/estree.mjs"; | ||
import { readFile as et } from "node:fs/promises"; | ||
import { isAbsolute as tt, dirname as nt, resolve as rt, extname as st } from "node:path"; | ||
import { Worker as ot } from "node:worker_threads"; | ||
import { resolveConfigFile as it } from "prettier"; | ||
const we = "embeddedCss", { group: at, indent: dt, softline: Y, lineSuffixBoundary: ct } = $, { mapDoc: lt } = G; | ||
function ut(t, n) { | ||
import { utils as q, builders as I } from "prettier/doc"; | ||
import Je from "prettier/parser-babel"; | ||
import Ye from "prettier/parser-espree"; | ||
import Ve from "prettier/parser-flow"; | ||
import Qe from "prettier/parser-meriyah"; | ||
import Ze from "prettier/parser-typescript"; | ||
import { printers as et } from "prettier/plugins/estree.mjs"; | ||
import { readFile as tt } from "node:fs/promises"; | ||
import { isAbsolute as nt, dirname as rt, resolve as st, extname as ot } from "node:path"; | ||
import { Worker as it } from "node:worker_threads"; | ||
import { resolveConfigFile as at } from "prettier"; | ||
const Pe = "embeddedCss", { group: dt, indent: ct, softline: V, lineSuffixBoundary: lt } = I, { mapDoc: ut } = q; | ||
function mt(t, n) { | ||
const { node: r } = t; | ||
let e = n(); | ||
return r?.comments?.length && (e = at([dt([Y, e]), Y])), ["${", e, ct, "}"]; | ||
return r?.comments?.length && (e = dt([ct([V, e]), V])), ["${", e, lt, "}"]; | ||
} | ||
function S(t, n) { | ||
function D(t, n) { | ||
return t.map( | ||
(r) => ut(r, n), | ||
(r) => mt(r, n), | ||
"expressions" | ||
); | ||
} | ||
function k(t, n, r) { | ||
return lt(t, (s) => { | ||
function L(t, n, r) { | ||
return ut(t, (s) => { | ||
if (typeof s != "string") | ||
@@ -51,3 +51,3 @@ return s; | ||
} | ||
function mt(t, n, r) { | ||
function gt(t, n, r) { | ||
if (n === r) { | ||
@@ -68,3 +68,3 @@ t.unshift(n); | ||
} | ||
const V = (() => { | ||
const Q = (() => { | ||
const t = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`)); | ||
@@ -78,4 +78,4 @@ return () => { | ||
})(); | ||
function L(t = "p", n = "") { | ||
const r = V(), e = V(), s = Q(t), o = Q(n), a = (c) => `${t}${r}${c}${e}${n}`, i = new RegExp( | ||
function S(t = "p", n = "") { | ||
const r = Q(), e = Q(), s = Z(t), o = Z(n), a = (c) => `${t}${r}${c}${e}${n}`, i = new RegExp( | ||
`${s}${r}(\\d+)${e}${o}`, | ||
@@ -89,12 +89,12 @@ "g" | ||
} | ||
function Q(t) { | ||
function Z(t) { | ||
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); | ||
} | ||
function I(t) { | ||
function $(t) { | ||
return `${t}Identifiers`; | ||
} | ||
function gt(t) { | ||
function Me(t) { | ||
return `${t}Parser`; | ||
} | ||
const { line: Z, group: O, indent: ee, softline: te } = $, pt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
const { line: ee, group: k, indent: te, softline: ne } = I, pt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
@@ -104,24 +104,24 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L("@p"), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S("@p"), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
parser: "scss" | ||
}), d = k(b, c, v); | ||
}), d = L(b, c, v); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return O([ | ||
return k([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [O(d)] : ee([O(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [k(d)] : te([k(d)]), | ||
u, | ||
"`" | ||
]); | ||
const m = p.length ? Z : te, y = u.length ? Z : te; | ||
return O([ | ||
const m = p.length ? ee : ne, y = u.length ? ee : ne; | ||
return k([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, O(d)] : ee([m, O(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, k(d)] : te([m, k(d)]), | ||
y, | ||
"`" | ||
]); | ||
}, ft = ["css"], ht = I(we), bt = { | ||
}, ft = ["css"], ht = $(Pe), bt = { | ||
[ht]: { | ||
@@ -136,6 +136,6 @@ category: "Global", | ||
__proto__: null, | ||
embeddedLanguage: we, | ||
embeddedLanguage: Pe, | ||
embedder: pt, | ||
options: bt | ||
}, Symbol.toStringTag, { value: "Module" })), H = "embeddedEs", { line: ne, group: T, indent: re, softline: se } = $, vt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
}, Symbol.toStringTag, { value: "Module" })), H = "embeddedEs", { line: re, group: T, indent: se, softline: oe } = I, vt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
@@ -145,8 +145,8 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
parser: e.embeddedEsParser ?? "babel" | ||
}), d = k(b, c, v); | ||
}), d = L(b, c, v); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
@@ -156,14 +156,14 @@ return T([ | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [T(d)] : re([T(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [T(d)] : se([T(d)]), | ||
u, | ||
"`" | ||
]); | ||
const m = p.length ? ne : se, y = u.length ? ne : se; | ||
const m = p.length ? re : oe, y = u.length ? re : oe; | ||
return T([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, T(d)] : re([m, T(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, T(d)] : se([m, T(d)]), | ||
y, | ||
"`" | ||
]); | ||
}, _t = [ | ||
}, Et = [ | ||
"js", | ||
@@ -177,8 +177,8 @@ "jsx", | ||
"javascript" | ||
], Et = I(H), xt = gt(H), $t = { | ||
[Et]: { | ||
], _t = $(H), xt = Me(H), It = { | ||
[_t]: { | ||
category: "Global", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [..._t] }], | ||
default: [{ value: [...Et] }], | ||
description: "Specify embedded ES language identifiers." | ||
@@ -193,8 +193,8 @@ }, | ||
} | ||
}, It = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embeddedLanguage: H, | ||
embedder: vt, | ||
options: $t | ||
}, Symbol.toStringTag, { value: "Module" })), Pe = "embeddedGlsl", { line: oe, group: D, indent: ie, softline: ae } = $, St = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
options: It | ||
}, Symbol.toStringTag, { value: "Module" })), Re = "embeddedGlsl", { line: ie, group: O, indent: ae, softline: de } = I, Dt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-glsl", e, s), e = { | ||
@@ -204,27 +204,27 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
(g, h, { length: _ }) => h === _ - 1 ? g.value.cooked : g.value.cooked + i(h) | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(g, h, { length: E }) => h === E - 1 ? g.value.cooked : g.value.cooked + i(h) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice( | ||
p.length, | ||
-u.length || void 0 | ||
), b = S(r, n), d = await t(v, { | ||
), b = D(r, n), d = await t(v, { | ||
...e, | ||
parser: "glsl-parser" | ||
}), m = k(d, c, b); | ||
}), m = L(d, c, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return D([ | ||
return O([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [D(m)] : ie([D(m)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [O(m)] : ae([O(m)]), | ||
u, | ||
"`" | ||
]); | ||
const y = p.length ? oe : ae, f = u.length ? oe : ae; | ||
return D([ | ||
const y = p.length ? ie : de, f = u.length ? ie : de; | ||
return O([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, D(m)] : ie([y, D(m)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, O(m)] : ae([y, O(m)]), | ||
f, | ||
"`" | ||
]); | ||
}, Lt = [ | ||
}, St = [ | ||
"glsl", | ||
@@ -252,8 +252,8 @@ "fp", | ||
"vshader" | ||
], kt = I(Pe), Ot = { | ||
[kt]: { | ||
], Lt = $(Re), kt = { | ||
[Lt]: { | ||
category: "Global", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...Lt] }], | ||
default: [{ value: [...St] }], | ||
description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".' | ||
@@ -263,6 +263,6 @@ } | ||
__proto__: null, | ||
embeddedLanguage: Pe, | ||
embedder: St, | ||
options: Ot | ||
}, Symbol.toStringTag, { value: "Module" })), Re = "embeddedHtml", { line: de, group: w, indent: ce, softline: le } = $, { mapDoc: Dt } = G, wt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
embeddedLanguage: Re, | ||
embedder: Dt, | ||
options: kt | ||
}, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedHtml", { line: ce, group: w, indent: le, softline: ue } = I, { mapDoc: Ot } = q, wt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
@@ -272,19 +272,19 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
parser: "html" | ||
}), d = Dt(b, (f) => { | ||
}), d = Ot(b, (f) => { | ||
if (typeof f != "string") | ||
return f; | ||
const g = [], h = f.split(c); | ||
for (let _ = 0; _ < h.length; _++) { | ||
let E = h[_]; | ||
if (_ % 2 == 0) { | ||
if (!E) | ||
for (let E = 0; E < h.length; E++) { | ||
let _ = h[E]; | ||
if (E % 2 == 0) { | ||
if (!_) | ||
continue; | ||
E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (E = E.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(E); | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(_); | ||
} else { | ||
const x = Number(E); | ||
const x = Number(_); | ||
g.push(v[x]); | ||
@@ -300,10 +300,10 @@ } | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(d)] : ce([w(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(d)] : le([w(d)]), | ||
u, | ||
"`" | ||
]); | ||
const m = p.length ? de : le, y = u.length ? de : le; | ||
const m = p.length ? ce : ue, y = u.length ? ce : ue; | ||
return w([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, w(d)] : ce([m, w(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, w(d)] : le([m, w(d)]), | ||
y, | ||
@@ -325,4 +325,4 @@ "`" | ||
"rhtml" | ||
], Rt = I(Re), Mt = { | ||
[Rt]: { | ||
], Mt = $(Ne), Rt = { | ||
[Mt]: { | ||
category: "Global", | ||
@@ -334,8 +334,8 @@ type: "string", | ||
} | ||
}, Ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embeddedLanguage: Re, | ||
embeddedLanguage: Ne, | ||
embedder: wt, | ||
options: Mt | ||
}, Symbol.toStringTag, { value: "Module" })), Me = "embeddedMarkdown", { line: ue, group: P, indent: me, softline: ge } = $, Nt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
options: Rt | ||
}, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedMarkdown", { line: me, group: P, indent: ge, softline: pe } = I, Ft = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
@@ -345,9 +345,9 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
parser: "markdown", | ||
__inJsTemplate: !0 | ||
}), d = k(b, c, v); | ||
}), d = L(b, c, v); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
@@ -357,14 +357,14 @@ return P([ | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(d)] : me([P(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(d)] : ge([P(d)]), | ||
u, | ||
"`" | ||
]); | ||
const m = p.length ? ue : ge, y = u.length ? ue : ge; | ||
const m = p.length ? me : pe, y = u.length ? me : pe; | ||
return P([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, P(d)] : me([m, P(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, P(d)] : ge([m, P(d)]), | ||
y, | ||
"`" | ||
]); | ||
}, jt = [ | ||
}, Ct = [ | ||
"md", | ||
@@ -381,8 +381,8 @@ "livemd", | ||
"workbook" | ||
], Ft = I(Me), At = { | ||
[Ft]: { | ||
], jt = $(Fe), At = { | ||
[jt]: { | ||
category: "Global", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...jt] }], | ||
default: [{ value: [...Ct] }], | ||
description: "Specify embedded Markdown language identifiers." | ||
@@ -392,6 +392,6 @@ } | ||
__proto__: null, | ||
embeddedLanguage: Me, | ||
embedder: Nt, | ||
embeddedLanguage: Fe, | ||
embedder: Ft, | ||
options: At | ||
}, Symbol.toStringTag, { value: "Module" })), X = "embeddedNoop", Wt = I(X), qt = { | ||
}, Symbol.toStringTag, { value: "Module" })), X = "embeddedNoop", Wt = $(X), Ut = { | ||
[Wt]: { | ||
@@ -404,7 +404,7 @@ category: "Global", | ||
} | ||
}, Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embeddedLanguage: X, | ||
options: qt | ||
}, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedPhp", { line: pe, group: R, indent: fe, softline: he } = $, Ut = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
options: Ut | ||
}, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedPhp", { line: fe, group: M, indent: he, softline: be } = I, Kt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("@prettier/plugin-php", e, s), e = { | ||
@@ -414,28 +414,28 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L("$p"), l = a.quasis.map( | ||
(g, h, { length: _ }) => h === _ - 1 ? g.value.cooked : g.value.cooked + i(h) | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S("$p"), l = a.quasis.map( | ||
(g, h, { length: E }) => h === E - 1 ? g.value.cooked : g.value.cooked + i(h) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice( | ||
p.length, | ||
-u.length || void 0 | ||
), b = S(r, n), d = await t(v, { | ||
), b = D(r, n), d = await t(v, { | ||
...e, | ||
parser: "php" | ||
}), m = k(d, c, b); | ||
}), m = L(d, c, b); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return R([ | ||
return M([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(m)] : fe([R(m)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(m)] : he([M(m)]), | ||
u, | ||
"`" | ||
]); | ||
const y = p.length ? pe : he, f = u.length ? pe : he; | ||
return R([ | ||
const y = p.length ? fe : be, f = u.length ? fe : be; | ||
return M([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, R(m)] : fe([y, R(m)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, M(m)] : he([y, M(m)]), | ||
f, | ||
"`" | ||
]); | ||
}, zt = ["php", "php5", "phtml", "ctp"], Gt = I(Ce), Ht = { | ||
[Gt]: { | ||
}, zt = ["php", "php5", "phtml", "ctp"], qt = $(Ce), Ht = { | ||
[qt]: { | ||
category: "Global", | ||
@@ -450,5 +450,5 @@ type: "string", | ||
embeddedLanguage: Ce, | ||
embedder: Ut, | ||
embedder: Kt, | ||
options: Ht | ||
}, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedRuby", q = [ | ||
}, Symbol.toStringTag, { value: "Module" })), je = "embeddedRuby", U = [ | ||
"ruby", | ||
@@ -479,7 +479,7 @@ "arb", | ||
"watchr" | ||
], K = ["rbs"], U = ["haml"], Jt = [ | ||
...q, | ||
...K, | ||
...U | ||
], Yt = "embeddedRubyParser", Vt = I(Ne), Qt = { | ||
], G = ["rbs"], K = ["haml"], Jt = [ | ||
...U, | ||
...G, | ||
...K | ||
], Yt = "embeddedRubyParser", Vt = $(je), Qt = { | ||
[Vt]: { | ||
@@ -499,3 +499,3 @@ category: "Global", | ||
} | ||
}, { line: be, group: M, indent: ye, softline: ve } = $, Zt = async (t, n, r, e, { identifier: s, identifiers: o, embeddedOverrideOptions: a }) => { | ||
}, { line: ye, group: R, indent: ve, softline: Ee } = I, Zt = async (t, n, r, e, { identifier: s, identifiers: o, embeddedOverrideOptions: a }) => { | ||
A("@prettier/plugin-ruby", e, s), e = { | ||
@@ -505,23 +505,23 @@ ...e, | ||
}; | ||
const { node: i } = r, { createPlaceholder: c, placeholderRegex: l } = L(), p = i.quasis.map( | ||
(_, E, { length: x }) => E === x - 1 ? _.value.cooked : _.value.cooked + c(E) | ||
const { node: i } = r, { createPlaceholder: c, placeholderRegex: l } = S(), p = i.quasis.map( | ||
(E, _, { length: x }) => _ === x - 1 ? E.value.cooked : E.value.cooked + c(_) | ||
).join(""), u = p.match(/^\s+/)?.[0] ?? "", v = p.match(/\s+$/)?.[0] ?? "", b = p.slice( | ||
u.length, | ||
-v.length || void 0 | ||
), d = S(r, n), m = en(e, s, o), y = await t(b, { | ||
), d = D(r, n), m = en(e, s, o), y = await t(b, { | ||
...e, | ||
parser: m | ||
}), f = k(y, l, d); | ||
}), f = L(y, l, d); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return M([ | ||
return R([ | ||
"`", | ||
u, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(f)] : ye([M(f)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(f)] : ve([R(f)]), | ||
v, | ||
"`" | ||
]); | ||
const g = u.length ? be : ve, h = v.length ? be : ve; | ||
return M([ | ||
const g = u.length ? ye : Ee, h = v.length ? ye : Ee; | ||
return R([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, M(f)] : ye([g, M(f)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, R(f)] : ve([g, R(f)]), | ||
h, | ||
@@ -537,7 +537,7 @@ "`" | ||
if (tn(n)) | ||
return q[0]; | ||
return U[0]; | ||
if (nn(n)) | ||
return G[0]; | ||
if (rn(n)) | ||
return K[0]; | ||
if (rn(n)) | ||
return U[0]; | ||
} | ||
@@ -547,19 +547,19 @@ throw new SyntaxError(`Unrecognized ruby identifier: ${n}`); | ||
function tn(t) { | ||
return q.includes(t); | ||
return U.includes(t); | ||
} | ||
function nn(t) { | ||
return K.includes(t); | ||
return G.includes(t); | ||
} | ||
function rn(t) { | ||
return U.includes(t); | ||
return K.includes(t); | ||
} | ||
const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
HAML_PARSER_IDENTIFIERS: U, | ||
RBS_PARSER_IDENTIFIERS: K, | ||
RUBY_PARSER_IDENTIFIERS: q, | ||
embeddedLanguage: Ne, | ||
HAML_PARSER_IDENTIFIERS: K, | ||
RBS_PARSER_IDENTIFIERS: G, | ||
RUBY_PARSER_IDENTIFIERS: U, | ||
embeddedLanguage: je, | ||
embedder: Zt, | ||
options: Qt | ||
}, Symbol.toStringTag, { value: "Module" })), je = "embeddedSql", { hardline: on, group: C, line: _e, softline: Ee, indent: xe } = $, { mapDoc: an } = G, dn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
}, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedSql", { hardline: on, group: N, line: _e, softline: xe, indent: Ie } = I, { mapDoc: an } = q, dn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("prettier-plugin-sql", e, s), e = { | ||
@@ -569,5 +569,5 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
@@ -579,11 +579,11 @@ parser: "sql" | ||
const g = [], h = f.split(c); | ||
for (let _ = 0; _ < h.length; _++) { | ||
let E = h[_]; | ||
if (_ % 2 == 0) { | ||
if (!E) | ||
for (let E = 0; E < h.length; E++) { | ||
let _ = h[E]; | ||
if (E % 2 == 0) { | ||
if (!_) | ||
continue; | ||
E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), E.split(/(\n)/).forEach((x) => x === ` | ||
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((x) => x === ` | ||
` ? g.push(on) : g.push(x)); | ||
} else { | ||
const x = Number(E); | ||
const x = Number(_); | ||
g.push(v[x]); | ||
@@ -595,62 +595,30 @@ } | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return C([ | ||
return N([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(d)] : xe([C(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(d)] : Ie([N(d)]), | ||
u, | ||
"`" | ||
]); | ||
const m = p.length ? _e : Ee, y = u.length ? _e : Ee; | ||
return C([ | ||
const m = p.length ? _e : xe, y = u.length ? _e : xe; | ||
return N([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, C(d)] : xe([m, C(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, N(d)] : Ie([m, N(d)]), | ||
y, | ||
"`" | ||
]); | ||
}, cn = [ | ||
"sql", | ||
"bigquery", | ||
"db2", | ||
"db2i", | ||
"hive", | ||
"mariadb", | ||
"mysql", | ||
"n1ql", | ||
"postgresql", | ||
"plsql", | ||
"redshift", | ||
"singlestoredb", | ||
"snowflake", | ||
"spark", | ||
"sqlite", | ||
"transactsql", | ||
"tsql", | ||
"trino" | ||
], ln = [ | ||
"bigquery", | ||
"db2", | ||
"hive", | ||
"mariadb", | ||
"mysql", | ||
"postgresql", | ||
"transactsql", | ||
"flinksql", | ||
"snowflake" | ||
], un = I(je), mn = { | ||
[un]: { | ||
}, cn = ["sql"], ln = $(Ae), un = { | ||
[ln]: { | ||
category: "Global", | ||
type: "string", | ||
array: !0, | ||
// TODO: remove these hardcoded defaults once supported diacts are exported from prettier-plugin-sql | ||
default: [{ value: ["sql", "mysql", "mariadb", "postgresql"] }], | ||
default: [{ value: [...cn] }], | ||
description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql".' | ||
} | ||
}, gn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
NODE_SQL_PARSER_DATABASES: ln, | ||
SQL_FORMATTER_LANGUAGES: cn, | ||
embeddedLanguage: je, | ||
embeddedLanguage: Ae, | ||
embedder: dn, | ||
options: mn | ||
}, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedTs", { line: $e, group: N, indent: Ie, softline: Se } = $, pn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
options: un | ||
}, Symbol.toStringTag, { value: "Module" })), J = "embeddedTs", { line: $e, group: F, indent: De, softline: Se } = I, gn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
e = { | ||
@@ -660,5 +628,5 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(f, g, { length: h }) => g === h - 1 ? f.value.cooked : f.value.cooked + i(g) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = S(r, n), b = await t(l, { | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = D(r, n), b = await t(l, { | ||
...e, | ||
@@ -669,8 +637,8 @@ parser: e.embeddedTsParser ?? "typescript", | ||
filepath: void 0 | ||
}), d = k(b, c, v); | ||
}), d = L(b, c, v); | ||
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return N([ | ||
return F([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(d)] : Ie([N(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(d)] : De([F(d)]), | ||
u, | ||
@@ -680,17 +648,17 @@ "`" | ||
const m = p.length ? $e : Se, y = u.length ? $e : Se; | ||
return N([ | ||
return F([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, N(d)] : Ie([m, N(d)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, F(d)] : De([m, F(d)]), | ||
y, | ||
"`" | ||
]); | ||
}, fn = ["ts", "tsx", "cts", "mts", "typescript"], hn = "embeddedTsParser", bn = I(Fe), yn = { | ||
[bn]: { | ||
}, pn = ["ts", "tsx", "cts", "mts", "typescript"], fn = Me(J), hn = $(J), bn = { | ||
[hn]: { | ||
category: "Global", | ||
type: "string", | ||
array: !0, | ||
default: [{ value: [...fn] }], | ||
default: [{ value: [...pn] }], | ||
description: "Specify embedded TS language parsers." | ||
}, | ||
[hn]: { | ||
[fn]: { | ||
category: "Global", | ||
@@ -702,8 +670,8 @@ type: "string", | ||
} | ||
}, vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
}, yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embeddedLanguage: Fe, | ||
embedder: pn, | ||
options: yn | ||
}, Symbol.toStringTag, { value: "Module" })), J = "embeddedXml", { line: Le, group: j, indent: ke, softline: z } = $, _n = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
embeddedLanguage: J, | ||
embedder: gn, | ||
options: bn | ||
}, Symbol.toStringTag, { value: "Module" })), Y = "embeddedXml", { line: Le, group: C, indent: ke, softline: z } = I, vn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => { | ||
A("@prettier/plugin-xml", e, s), e = { | ||
@@ -713,8 +681,8 @@ ...e, | ||
}; | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = L(), l = a.quasis.map( | ||
(h, _, { length: E }) => _ === E - 1 ? h.value.cooked : h.value.cooked + i(_) | ||
const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = S(), l = a.quasis.map( | ||
(h, E, { length: _ }) => E === _ - 1 ? h.value.cooked : h.value.cooked + i(E) | ||
).join(""), p = l.match(/^\s+/)?.[0] ?? "", u = l.match(/\s+$/)?.[0] ?? "", v = l.slice( | ||
p.length, | ||
-u.length || void 0 | ||
), b = S(r, n), d = []; | ||
), b = D(r, n), d = []; | ||
let m = 0; | ||
@@ -729,15 +697,15 @@ for (; m !== void 0; ) { | ||
); | ||
let _ = await t(h, { | ||
let E = await t(h, { | ||
...e, | ||
parser: J | ||
parser: Y | ||
}); | ||
const [E, x] = e.__embeddedXmlFragmentRecoverIndex ?? []; | ||
E === void 0 ? m = void 0 : x === void 0 ? m += E : (_ = h.slice(E, x + 1), m += x + 1), d.push(_); | ||
const [_, x] = e.__embeddedXmlFragmentRecoverIndex ?? []; | ||
_ === void 0 ? m = void 0 : x === void 0 ? m += _ : (E = h.slice(_, x + 1), m += x + 1), d.push(E); | ||
} | ||
const y = k(d, c, b); | ||
const y = L(d, c, b); | ||
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s)) | ||
return j([ | ||
return C([ | ||
"`", | ||
p, | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(y)] : ke([j(y)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(y)] : ke([C(y)]), | ||
u, | ||
@@ -747,5 +715,5 @@ "`" | ||
const f = p.length ? Le : z, g = u.length ? Le : z; | ||
return j([ | ||
return C([ | ||
"`", | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, j(y)] : ke([f, j(y)]), | ||
e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, C(y)] : ke([f, C(y)]), | ||
g, | ||
@@ -811,4 +779,4 @@ "`" | ||
"xoml" | ||
], xn = I(J), $n = { | ||
[xn]: { | ||
], _n = $(Y), xn = { | ||
[_n]: { | ||
category: "Global", | ||
@@ -849,3 +817,3 @@ type: "string", | ||
} | ||
function Oe(t) { | ||
function Te(t) { | ||
const n = { | ||
@@ -870,3 +838,3 @@ loc: { | ||
} | ||
const Sn = { | ||
const $n = { | ||
async parse(t, n) { | ||
@@ -884,3 +852,3 @@ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t); | ||
)) | ||
throw Oe(i); | ||
throw Te(i); | ||
if (i.message === "Expecting token of type --> OPEN <-- but found --> '' <--") { | ||
@@ -913,5 +881,5 @@ a = !0; | ||
} | ||
throw Oe(i); | ||
throw Te(i); | ||
} | ||
a && Ae(o); | ||
a && Be(o); | ||
} | ||
@@ -928,3 +896,3 @@ return o; | ||
}; | ||
function Ae(t) { | ||
function Be(t) { | ||
const n = t.children; | ||
@@ -935,3 +903,3 @@ for (const r in n) { | ||
const o = e[s]; | ||
if (Ln(o)) { | ||
if (Dn(o)) { | ||
if (Object.keys(o.children).length === 0) { | ||
@@ -941,3 +909,3 @@ e.splice(s, 1), e.length === 0 && delete n[r]; | ||
} | ||
Ae(o); | ||
Be(o); | ||
} | ||
@@ -947,32 +915,32 @@ } | ||
} | ||
function Ln(t) { | ||
function Dn(t) { | ||
return "name" in t && "children" in t && "location" in t; | ||
} | ||
const kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ | ||
__proto__: null, | ||
embeddedLanguage: J, | ||
embedder: _n, | ||
options: $n, | ||
parser: Sn | ||
}, Symbol.toStringTag, { value: "Module" })), Be = [], We = {}, qe = {}, Ke = {}, On = /* @__PURE__ */ Object.assign({ | ||
embeddedLanguage: Y, | ||
embedder: vn, | ||
options: xn, | ||
parser: $n | ||
}, Symbol.toStringTag, { value: "Module" })), We = [], Ue = {}, Ge = {}, Ke = {}, Ln = /* @__PURE__ */ Object.assign({ | ||
"./css/index.ts": yt, | ||
"./es/index.ts": It, | ||
"./es/index.ts": $t, | ||
"./glsl/index.ts": Tt, | ||
"./html/index.ts": Ct, | ||
"./html/index.ts": Nt, | ||
"./markdown/index.ts": Bt, | ||
"./noop/index.ts": Kt, | ||
"./noop/index.ts": Gt, | ||
"./php/index.ts": Xt, | ||
"./ruby/index.ts": sn, | ||
"./sql/index.ts": gn, | ||
"./ts/index.ts": vn, | ||
"./xml/index.ts": kn | ||
"./sql/index.ts": mn, | ||
"./ts/index.ts": yn, | ||
"./xml/index.ts": Sn | ||
}); | ||
Object.values(On).forEach( | ||
Object.values(Ln).forEach( | ||
({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => { | ||
mt(Be, t, X), n && (We[t] = n), r && (qe[t] = r), Object.assign(Ke, e); | ||
gt(We, t, X), n && (Ue[t] = n), r && (Ge[t] = r), Object.assign(Ke, e); | ||
} | ||
); | ||
const Tn = "noEmbeddedIdentificationByComment", Dn = "noEmbeddedIdentificationByTag", wn = "preserveEmbeddedExteriorWhitespaces", Pn = "noEmbeddedMultiLineIndentation", Rn = "embeddedOverrides", ir = { | ||
const kn = "noEmbeddedIdentificationByComment", Tn = "noEmbeddedIdentificationByTag", On = "preserveEmbeddedExteriorWhitespaces", wn = "noEmbeddedMultiLineIndentation", Pn = "embeddedOverrides", or = { | ||
...Ke, | ||
[Tn]: { | ||
[kn]: { | ||
category: "Global", | ||
@@ -984,3 +952,3 @@ type: "string", | ||
}, | ||
[Dn]: { | ||
[Tn]: { | ||
category: "Global", | ||
@@ -992,3 +960,3 @@ type: "string", | ||
}, | ||
[wn]: { | ||
[On]: { | ||
category: "Config", | ||
@@ -1000,3 +968,3 @@ type: "string", | ||
}, | ||
[Pn]: { | ||
[wn]: { | ||
category: "Global", | ||
@@ -1008,3 +976,3 @@ type: "string", | ||
}, | ||
[Rn]: { | ||
[Pn]: { | ||
category: "Global", | ||
@@ -1016,11 +984,11 @@ type: "string", | ||
} | ||
}, ar = { | ||
}, ir = { | ||
// parsers from internal | ||
...Xe.parsers, | ||
...Je.parsers, | ||
...Ye.parsers, | ||
...Ve.parsers, | ||
...Ze.parsers, | ||
...Qe.parsers, | ||
...Ve.parsers, | ||
// parsers from this plugin | ||
...We | ||
...Ue | ||
}; | ||
@@ -1036,6 +1004,6 @@ var Mn = { | ||
transformKey: !0 | ||
}, Cn = Array.prototype.slice; | ||
}, Rn = Array.prototype.slice; | ||
function W(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]] : Cn.call(t, 0) : []; | ||
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : Rn.call(t, 0) : []; | ||
} | ||
@@ -1048,9 +1016,9 @@ function Nn(t) { | ||
} | ||
function jn(t) { | ||
function Fn(t) { | ||
return typeof t == "function" && t.isMemoized; | ||
} | ||
function Fn(t, n) { | ||
function Cn(t, n) { | ||
return t === n || t !== t && n !== n; | ||
} | ||
function Te(t, n) { | ||
function Oe(t, n) { | ||
var r = {}; | ||
@@ -1063,3 +1031,3 @@ for (var e in t) | ||
} | ||
var An = ( | ||
var jn = ( | ||
/** @class */ | ||
@@ -1160,8 +1128,8 @@ function() { | ||
); | ||
function Ue(t, n) { | ||
if (n === void 0 && (n = {}), jn(t)) | ||
return Ue(t.fn, Te(t.options, n)); | ||
function ze(t, n) { | ||
if (n === void 0 && (n = {}), Fn(t)) | ||
return ze(t.fn, Oe(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 ? Fn : r, s = n.isMatchingKey, o = n.isPromise, a = o === void 0 ? !1 : o, i = n.maxSize, c = i === void 0 ? 1 : i, l = n.onCacheAdd, p = n.onCacheChange, u = n.onCacheHit, v = n.transformKey, b = Te({ | ||
var r = n.isEqual, e = r === void 0 ? Cn : r, s = n.isMatchingKey, o = n.isPromise, a = o === void 0 ? !1 : o, i = n.maxSize, c = i === void 0 ? 1 : i, l = n.onCacheAdd, p = n.onCacheChange, u = n.onCacheHit, v = n.transformKey, b = Oe({ | ||
isEqual: e, | ||
@@ -1175,11 +1143,11 @@ isMatchingKey: s, | ||
transformKey: v | ||
}, Nn(n)), d = new An(b), m = d.keys, y = d.values, f = d.canTransformKey, g = d.shouldCloneArguments, h = d.shouldUpdateOnAdd, _ = d.shouldUpdateOnChange, E = d.shouldUpdateOnHit, x = function() { | ||
}, Nn(n)), d = new jn(b), m = d.keys, y = d.values, f = d.canTransformKey, g = d.shouldCloneArguments, h = d.shouldUpdateOnAdd, E = d.shouldUpdateOnChange, _ = d.shouldUpdateOnHit, x = function() { | ||
var B = g ? W(arguments) : arguments; | ||
f && (B = v(B)); | ||
var F = m.length ? d.getKeyIndex(B) : -1; | ||
if (F !== -1) | ||
E && u(d, b, x), F && (d.orderByLru(m[F], y[F], F), _ && p(d, b, x)); | ||
var j = m.length ? d.getKeyIndex(B) : -1; | ||
if (j !== -1) | ||
_ && u(d, b, x), j && (d.orderByLru(m[j], y[j], j), E && p(d, b, x)); | ||
else { | ||
var Ge = t.apply(this, arguments), He = g ? B : W(arguments); | ||
d.orderByLru(He, Ge, m.length), a && d.updateAsyncCache(x), h && l(d, b, x), _ && p(d, b, x); | ||
var He = t.apply(this, arguments), Xe = g ? B : W(arguments); | ||
d.orderByLru(Xe, He, m.length), a && d.updateAsyncCache(x), h && l(d, b, x), E && p(d, b, x); | ||
} | ||
@@ -1190,5 +1158,5 @@ return y[0]; | ||
} | ||
async function De(t) { | ||
async function we(t) { | ||
try { | ||
const n = await et(t, { encoding: "utf-8" }); | ||
const n = await tt(t, { encoding: "utf-8" }); | ||
return JSON.parse(n); | ||
@@ -1198,8 +1166,8 @@ } catch { | ||
} | ||
const Bn = /* @__PURE__ */ new URL( | ||
const An = /* @__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 Wn(t) { | ||
async function Bn(t) { | ||
return new Promise((n) => { | ||
const r = new ot(Bn, { | ||
const r = new it(An, { | ||
workerData: { | ||
@@ -1216,3 +1184,3 @@ absolutePath: t | ||
} | ||
async function qn(t) { | ||
async function Wn(t) { | ||
console.error( | ||
@@ -1222,17 +1190,17 @@ "Ts module type embeddedOverrides has not been implemented yet." | ||
} | ||
const Kn = Ue( | ||
const Un = ze( | ||
async (t, n) => { | ||
if (tt(t)) | ||
if (nt(t)) | ||
return t; | ||
const r = await it(n); | ||
const r = await at(n); | ||
let e; | ||
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = nt(r), rt(e, t); | ||
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = rt(r), st(e, t); | ||
} | ||
), Un = async (t, n) => { | ||
const r = Kn( | ||
), Gn = async (t, n) => { | ||
const r = Un( | ||
t, | ||
n | ||
), e = st(t); | ||
), e = ot(t); | ||
if (e === ".json") { | ||
const s = await r, o = await De(s); | ||
const s = await r, o = await we(s); | ||
if (o !== void 0) | ||
@@ -1243,3 +1211,3 @@ return o; | ||
} else if (e === ".mjs" || e === ".cjs" || e === ".js") { | ||
const s = await r, o = await Wn(s); | ||
const s = await r, o = await Bn(s); | ||
if (o !== void 0) | ||
@@ -1250,3 +1218,3 @@ return o; | ||
} else if (e === ".mts" || e === ".cts" || e === ".ts") { | ||
const s = await r, o = await qn(); | ||
const s = await r, o = await Wn(); | ||
if (o !== void 0) | ||
@@ -1257,3 +1225,3 @@ return o; | ||
} else if (e === "") { | ||
const s = await r, o = await De(s); | ||
const s = await r, o = await we(s); | ||
if (o !== void 0) | ||
@@ -1267,6 +1235,6 @@ return o; | ||
} | ||
}, zn = async (t, n, r) => { | ||
}, Kn = async (t, n, r) => { | ||
if (t === void 0) | ||
return; | ||
const e = await Un( | ||
const e = await Gn( | ||
t, | ||
@@ -1284,3 +1252,3 @@ r | ||
}; | ||
function Gn({ node: t, parent: n }, r, e) { | ||
function zn({ node: t, parent: n }, r, e) { | ||
if (r.length === 0 || t.type !== "TemplateLiteral") | ||
@@ -1305,3 +1273,3 @@ return; | ||
} | ||
function Hn({ node: t, parent: n }, r, e) { | ||
function qn({ node: t, parent: n }, r, e) { | ||
if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) { | ||
@@ -1313,15 +1281,15 @@ for (const s of r) | ||
} | ||
const { estree: ze } = Ze, Xn = function(t, n) { | ||
const { estree: qe } = et, Hn = 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 Be) { | ||
const s = n[I(e)]; | ||
for (const e of We) { | ||
const s = n[$(e)]; | ||
if (!s) | ||
continue; | ||
const o = Gn( | ||
const o = zn( | ||
t, | ||
s, | ||
n.noEmbeddedIdentificationByComment ?? [] | ||
) ?? Hn( | ||
) ?? qn( | ||
t, | ||
@@ -1333,3 +1301,3 @@ s, | ||
continue; | ||
const a = qe[e]; | ||
const a = Ge[e]; | ||
if (!a) | ||
@@ -1339,3 +1307,3 @@ return null; | ||
return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (c, l, p, u) => { | ||
const v = await zn( | ||
const v = await Kn( | ||
u.embeddedOverrides, | ||
@@ -1351,3 +1319,3 @@ o, | ||
}); | ||
return $.label( | ||
return I.label( | ||
{ embed: !0, ...b.label }, | ||
@@ -1361,18 +1329,18 @@ b | ||
} | ||
return ze.embed?.(t, n) ?? null; | ||
}, dr = { | ||
return qe.embed?.(t, n) ?? null; | ||
}, ar = { | ||
estree: { | ||
...ze, | ||
embed: Xn | ||
...qe, | ||
embed: Hn | ||
} | ||
}; | ||
export { | ||
qe as embeddedEmbedders, | ||
Be as embeddedLanguages, | ||
Ge as embeddedEmbedders, | ||
We as embeddedLanguages, | ||
Ke as embeddedOptions, | ||
We as embeddedParsers, | ||
I as makeIdentifiersOptionName, | ||
ir as options, | ||
ar as parsers, | ||
dr as printers | ||
Ue as embeddedParsers, | ||
$ as makeIdentifiersOptionName, | ||
or as options, | ||
ir as parsers, | ||
ar as printers | ||
}; |
@@ -143,3 +143,3 @@ import { type AutocompleteStringList, type EmbeddedDefaultIdentifier, type PrettierPluginEmbedOptions } from "./embedded/index.js"; | ||
default: { | ||
value: string[]; | ||
value: "sql"[]; | ||
}[]; | ||
@@ -146,0 +146,0 @@ description: string; |
@@ -5,3 +5,3 @@ { | ||
"private": false, | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"type": "module", | ||
@@ -67,30 +67,30 @@ "files": [ | ||
"@commitlint/config-conventional": "^18.4.3", | ||
"@prettier/plugin-php": ">=0.20.1 <1", | ||
"@prettier/plugin-ruby": "^4.0.0", | ||
"@prettier/plugin-xml": "^3.1.0", | ||
"@semantic-release/git": "^10.0.1", | ||
"@types/estree": "^1.0.5", | ||
"@types/node": "^20.10.0", | ||
"@typescript-eslint/eslint-plugin": "^6.12.0", | ||
"@typescript-eslint/parser": "^6.12.0", | ||
"@types/node": "^20.10.3", | ||
"@typescript-eslint/eslint-plugin": "^6.13.1", | ||
"@typescript-eslint/parser": "^6.13.1", | ||
"@vitest/browser": "^0.34.6", | ||
"@vitest/coverage-istanbul": "^0.34.6", | ||
"@vitest/ui": "^0.34.6", | ||
"@xml-tools/parser": "^1.0.11", | ||
"chevrotain": "7.1.1", | ||
"code-tag": "^1.1.0", | ||
"esbuild": "^0.19.8", | ||
"eslint": "^8.54.0", | ||
"eslint": "^8.55.0", | ||
"fast-glob": "^3.3.2", | ||
"npm-check-updates": "^16.14.11", | ||
"playwright": "^1.40.0", | ||
"playwright": "^1.40.1", | ||
"prettier": "^3.0.0", | ||
"prettier-plugin-glsl": ">=0.1.2 <1", | ||
"prettier-plugin-organize-imports": "^3.2.4", | ||
"prettier-plugin-sql": ">=0.15.0 <1", | ||
"semantic-release": "^22.0.8", | ||
"tsx": "^4.5.0", | ||
"tsx": "^4.6.2", | ||
"typescript": "^5.3.2", | ||
"vite": "^5.0.2", | ||
"vitest": "^0.34.6", | ||
"@prettier/plugin-php": ">=0.20.1 <1", | ||
"@prettier/plugin-ruby": "^4.0.0", | ||
"@prettier/plugin-xml": "^3.1.0", | ||
"@xml-tools/parser": "^1.0.11", | ||
"chevrotain": "7.1.1", | ||
"prettier": "^3.0.0", | ||
"prettier-plugin-glsl": ">=0.1.2 <1", | ||
"prettier-plugin-sql": ">=0.15.0 <1" | ||
"vite": "^5.0.4", | ||
"vitest": "^0.34.6" | ||
}, | ||
@@ -97,0 +97,0 @@ "dependencies": { |
@@ -100,2 +100,4 @@ <div align="center"> | ||
**Important: Until this notice is removed, always specify identifiers explicitly and do not rely on the built-in defaults, as they may be subject to change.** | ||
### Language-Specific Options | ||
@@ -133,2 +135,10 @@ | ||
#### GLSL | ||
| Option | Default | Description | | ||
| :-----------------------: | :---------------------------------------: | -------------------------------------------------------------------------------------------------- | | ||
| `embeddedGlslIdentifiers` | [`[...]`](./src/embedded/glsl/options.ts) | Tag or comment identifiers that make their subsequent template literals be identified as GLSL code | | ||
Formatting embedded GLSL code requires [`prettier-plugin-glsl`](https://github.com/NaridaL/glsl-language-toolkit/tree/main/packages/prettier-plugin-glsl) to be loaded as well. | ||
#### HTML | ||
@@ -135,0 +145,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254
100305
2249