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.0.2 to 0.0.3

dist/embedded/noop/index.d.ts

8

dist/embedded/index.d.ts

@@ -1,6 +0,2 @@

import type { Parser, SupportOptions } from "prettier";
import type { EmbeddedPrinter } from "../types.js";
export declare const embeddedLanguageNames: readonly ["embeddedXml", "embeddedSql"];
export declare const embeddedParsers: Record<string, Parser>;
export declare const embeddedPrinters: Record<string, EmbeddedPrinter>;
export declare const embeddedOptions: SupportOptions;
export * from "./register.js";
export type { EmbeddedNames, EmbeddedParsers, EmbeddedEmbedders, EmbeddedOptions, } from "./types.js";
export * from "./name.js";
export * from "./printer.js";
export * from "./embedder.js";
export * from "./option.js";
export * from "./types.js";
export declare const name = "embeddedSql";
declare module "../types.js" {
interface EmbeddedNamesHolder {
[name]: void;
}
}
import { SupportOption } from "prettier";
export declare const embeddedOption: SupportOption;
import type { SqlBaseOptions as PrettierPluginDepsOptions } from "prettier-plugin-sql";
import { name } from "./name.js";
export declare const option: SupportOption;
declare module "../types.js" {
interface EmbeddedOptions {
[name]: typeof option;
}
}
export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "hive", "mariadb", "mysql", "postgresql", "db2", "plsql", "n1ql", "redshift", "singlestoredb", "spark", "sqlite", "transactsql", "tsql", "trino"];
export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql"];
export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number];
export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number];
export { PrettierPluginDepsOptions };
export interface PrettierPluginEmbedOptions {
[name]?: SqlFormatterLanguage[] | NodeSqlParserDataBase[] | string[];
}
declare module "prettier" {
interface Options extends PrettierPluginDepsOptions, PrettierPluginEmbedOptions {
}
}

@@ -1,1 +0,14 @@

export * from "./xml/types.js";
import { Parser, SupportOption, Options } from "prettier";
import { Embedder } from "../types.js";
export interface EmbeddedParsers {
[name: string]: Parser | undefined;
}
export interface EmbeddedEmbedders {
[name: string]: Embedder<Options> | undefined;
}
export interface EmbeddedOptions {
[name: string]: SupportOption | undefined;
}
export interface EmbeddedNamesHolder {
}
export type EmbeddedNames = keyof EmbeddedNamesHolder;
import { Expression, Comment, TemplateLiteral } from "estree";
import { AstPath } from "prettier";
import { AstPath, Options } from "prettier";
import { builders } from "prettier/doc";

@@ -9,1 +9,3 @@ import { InternalPrintFun } from "../types.js";

export declare function printTemplateExpressions(path: AstPath<TemplateLiteral>, print: InternalPrintFun): builders.Doc[][];
export declare function throwIfPluginIsNotFound(pluginName: string, options: Options, lang: string): void;
export declare function insertEmbeddedLanguageName(names: string[], name: string, headName: string): void;
export * from "./name.js";
export * from "./parser.js";
export * from "./printer.js";
export * from "./embedder.js";
export * from "./option.js";
export * from "./types.js";
export declare const name = "embeddedXml";
declare module "../types.js" {
interface EmbeddedNamesHolder {
[name]: void;
}
}
import { SupportOption } from "prettier";
export declare const embeddedOption: SupportOption;
import { name } from "./name.js";
export declare const option: SupportOption;
declare module "../types.js" {
interface EmbeddedOptions {
[name]: typeof option;
}
}
export interface PrettierPluginDepsOptions {
xmlSelfClosingSpace?: boolean;
xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
xmlSortAttributesByKey?: boolean;
xmlQuoteAttributes?: "preserve" | "single" | "double";
}
export interface PrettierPluginEmbedOptions {
[name]?: string[];
}
declare module "prettier" {
interface Options extends PrettierPluginDepsOptions, PrettierPluginEmbedOptions {
}
}
import type { Parser } from "prettier";
import { parse as xmlToolsParse } from "@xml-tools/parser";
import { name } from "./name.js";
type CstNode = ReturnType<typeof xmlToolsParse>["cst"];
export declare const embeddedParser: Parser<CstNode>;
export declare const parser: Parser<CstNode>;
declare module "../types.js" {
interface EmbeddedParsers {
[name]: Parser;
}
}
export {};

@@ -5,1 +5,2 @@ export { parsers } from "./parsers.js";

export type * from "./types.js";
export * from "./embedded/index.js";

@@ -1,149 +0,150 @@

import P from "prettier/parser-babel";
import F from "prettier/parser-espree";
import W from "prettier/parser-flow";
import _ from "prettier/parser-typescript";
import { parse as j } from "@xml-tools/parser";
import { builders as S, utils as I } from "prettier/doc";
import { printers as B } from "prettier/plugins/estree.mjs";
const q = "embeddedXml";
function L(e, t) {
const r = new SyntaxError(
e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")"
);
return Object.assign(r, t);
}
const G = {
parse(e) {
const { lexErrors: t, parseErrors: r, cst: o } = j(e);
if (t.length > 0) {
const n = t[0];
throw L(n.message, {
loc: {
start: { line: n.line, column: n.column },
end: {
line: n.line,
column: n.column + n.length
}
}
});
}
if (r.length > 0) {
const n = r[0];
throw L(n.message, {
loc: {
start: {
line: n.token.startLine ?? NaN,
column: n.token.startColumn ?? NaN
},
end: {
line: n.token.endLine ?? NaN,
column: n.token.endColumn ?? NaN
}
}
});
}
return o;
},
astFormat: "xml",
locStart(e) {
return e.location.startOffset;
},
locEnd(e) {
return e.location.endOffset ?? NaN;
}
};
let $;
const V = new Uint8Array(16);
function Q() {
if (!$ && ($ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !$))
import H from "prettier/parser-babel";
import X from "prettier/parser-espree";
import J from "prettier/parser-flow";
import K from "prettier/parser-typescript";
import { builders as E, utils as N } from "prettier/doc";
import { parse as Y } from "@xml-tools/parser";
import { printers as Z } from "prettier/plugins/estree.mjs";
const C = "embeddedNoop", ee = {
category: "Global",
type: "string",
array: !0,
default: [{ value: [] }],
description: "Specify embedded languages that will not be formatted."
}, te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
name: C,
option: ee
}, Symbol.toStringTag, { value: "Module" })), ne = "embeddedPhp";
let S;
const re = new Uint8Array(16);
function oe() {
if (!S && (S = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !S))
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
return $(V);
return S(re);
}
const s = [];
const c = [];
for (let e = 0; e < 256; ++e)
s.push((e + 256).toString(16).slice(1));
function z(e, t = 0) {
return s[e[t + 0]] + s[e[t + 1]] + s[e[t + 2]] + s[e[t + 3]] + "-" + s[e[t + 4]] + s[e[t + 5]] + "-" + s[e[t + 6]] + s[e[t + 7]] + "-" + s[e[t + 8]] + s[e[t + 9]] + "-" + s[e[t + 10]] + s[e[t + 11]] + s[e[t + 12]] + s[e[t + 13]] + s[e[t + 14]] + s[e[t + 15]];
c.push((e + 256).toString(16).slice(1));
function se(e, t = 0) {
return c[e[t + 0]] + c[e[t + 1]] + c[e[t + 2]] + c[e[t + 3]] + "-" + c[e[t + 4]] + c[e[t + 5]] + "-" + c[e[t + 6]] + c[e[t + 7]] + "-" + c[e[t + 8]] + c[e[t + 9]] + "-" + c[e[t + 10]] + c[e[t + 11]] + c[e[t + 12]] + c[e[t + 13]] + c[e[t + 14]] + c[e[t + 15]];
}
const M = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), U = {
randomUUID: M
const ie = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), I = {
randomUUID: ie
};
function O(e, t, r) {
if (U.randomUUID && !t && !e)
return U.randomUUID();
function k(e, t, n) {
if (I.randomUUID && !t && !e)
return I.randomUUID();
e = e || {};
const o = e.random || (e.rng || Q)();
const o = e.random || (e.rng || oe)();
if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
r = r || 0;
for (let n = 0; n < 16; ++n)
t[r + n] = o[n];
n = n || 0;
for (let r = 0; r < 16; ++r)
t[n + r] = o[r];
return t;
}
return z(o);
return se(o);
}
const { group: X, indent: H, softline: k, lineSuffixBoundary: J } = S;
function K(e, t) {
var n;
const { node: r } = e;
const { group: le, indent: ce, softline: U, lineSuffixBoundary: ae } = E;
function ue(e, t) {
var r;
const { node: n } = e;
let o = t();
return (n = r == null ? void 0 : r.comments) != null && n.length && (o = X([H([k, o]), k])), ["${", o, J, "}"];
return (r = n == null ? void 0 : n.comments) != null && r.length && (o = le([ce([U, o]), U])), ["${", o, ae, "}"];
}
function C(e, t) {
function j(e, t) {
return e.map(
(r) => K(r, t),
(n) => ue(n, t),
"expressions"
);
}
const { label: Y, hardline: Z, line: ee, group: E, indent: te } = S, { mapDoc: ne } = I, re = async (e, t, r, o) => {
function A(e, t, n) {
var o;
if (!(((o = t.plugins) == null ? void 0 : o.map((r) => r.name)) ?? []).includes(e))
throw new Error(
`Cannot format embedded language "${n}" because plugin "${e}" is not loaded.`
);
}
function de(e, t, n) {
if (t === n) {
e.unshift(t);
return;
}
let o = 0, r = e.length;
for (; o < r; ) {
const s = o + r >>> 1;
if (e[s] === n) {
e.push(t);
return;
}
e[s] < t ? o = s + 1 : r = s;
}
e.splice(o, 0, t);
}
const { label: pe, hardline: me, line: ge, group: w, indent: fe } = E, { mapDoc: be } = N, ye = async (e, t, n, o, r) => {
try {
const n = O(), { node: i } = r, p = i.quasis.map(
(l, c, { length: u }) => c === u - 1 ? l.value.cooked : l.value.cooked + `${n}-${c}`
A("@prettier/plugin-php", o, r);
const s = "$p" + k().replaceAll("-", ""), { node: a } = n, b = a.quasis.map(
(i, l, { length: m }) => l === m - 1 ? i.value.cooked : i.value.cooked + `${s}${l}`
).join("");
let d = "", g = 0;
const f = /^\s+/.exec(p);
f && (g = f.index + f[0].length, d = " ");
const y = /\s$/.test(p) ? " " : "", b = C(r, t), N = await e(p.slice(g), {
parser: q
}), x = ne(N, (l) => {
if (typeof l != "string")
return l;
const c = [], u = l.split(new RegExp(n + "-(\\d+)", "g"));
for (let m = 0; m < u.length; m++) {
let a = u[m];
if (m % 2 == 0) {
if (!a)
let d = "", y = 0;
const g = /^\s+/.exec(b);
g && (y = g.index + g[0].length, d = " ");
const x = /\s$/.test(b) ? " " : "", _ = j(n, t), q = await e(b.slice(y), {
parser: "php"
});
let h = !1;
const $ = be(q, (i) => {
if (typeof i != "string")
return Array.isArray(i) || (i.type === "group" && i.break || i.type === "line" && (i.hard || i.literal)) && (h = !0), i;
const l = [], m = i.split(new RegExp("\\" + s + "(\\d+)", "g"));
for (let u = 0; u < m.length; u++) {
let f = m[u];
if (u % 2 == 0) {
if (!f)
continue;
a = a.replaceAll(/([\\`]|\${)/g, "\\$1"), c.push(a);
f = f.replaceAll(/([\\`]|\${)/g, "\\$1"), l.push(f);
} else {
const T = Number(a);
c.push(b[T]);
const v = Number(f);
l.push(_[v]);
}
}
return c;
}), h = o.xmlWhitespaceSensitivity === "ignore" ? Z : d && y ? ee : null;
return h ? E([
return l;
}), p = h ? me : d && x ? ge : null;
return p ? w([
"`",
te([h, E(x)]),
h,
fe([p, w($)]),
p,
"`"
]) : Y(
]) : pe(
{ hug: !1 },
E([
w([
"`",
d,
E(x),
y,
w([$]),
x,
"`"
])
);
} catch (n) {
throw console.error(n), n;
} catch (s) {
throw console.error(s), s;
}
}, oe = {
}, he = {
category: "Global",
type: "string",
array: !0,
default: [{ value: ["xml", "svg"] }],
description: "Config embedded XML formatting. This requires @prettier/plugin-xml"
}, D = "embeddedSql", A = [
default: [{ value: ["php"] }],
description: "Specify embedded PHP languages. This requires @prettier/plugin-php"
}, $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: ye,
name: ne,
option: he
}, Symbol.toStringTag, { value: "Module" })), xe = "embeddedSql", _e = {
category: "Global",
type: "string",
array: !0,
default: [{ value: ["sql"] }],
description: "Specify embedded SQL languages. This requires prettier-plugin-sql"
}, G = [
"sql",

@@ -165,3 +166,3 @@ "bigquery",

"trino"
], R = [
], W = [
"bigquery",

@@ -175,147 +176,294 @@ "db2",

"flinksql"
], { label: se, hardline: ie, group: w } = S, { mapDoc: le } = I, ce = async (e, t, r, o, n) => {
], { label: ve, hardline: R, group: O, line: qe, indent: Ee } = E, { mapDoc: Se } = N, we = async (e, t, n, o, r, s) => {
try {
const i = "p" + O().replaceAll("-", ""), { node: p } = r, d = p.quasis.map(
(l, c, { length: u }) => c === u - 1 ? l.value.cooked : l.value.cooked + `${i}${c}`
).join(""), g = /^\s/.test(d) ? " " : "", f = /\s$/.test(d) ? " " : "", y = C(r, t);
n = n.toLowerCase();
let b = {};
if (o.formatter === "sql-formatter")
if (A.includes(n))
b = {
formatter: "sql-formatter",
language: n
};
else if (R.includes(n))
b = {
formatter: "node-sql-parser",
database: n
};
else
throw new SyntaxError(`Unrecognized language: ${n}`);
else if (R.includes(n))
b = {
formatter: "node-sql-parser",
database: n
};
else if (A.includes(n))
b = {
formatter: "sql-formatter",
language: n
};
else
throw new SyntaxError(`Unrecognized language: ${n}`);
const N = await e(d, {
A("prettier-plugin-sql", o, r);
const a = "p" + k().replaceAll("-", ""), { node: b } = n, d = b.quasis.map(
(i, l, { length: m }) => l === m - 1 ? i.value.cooked : i.value.cooked + `${a}${l}`
).join(""), y = /^\s/.test(d) ? " " : "", g = /\s$/.test(d) ? " " : "", x = j(n, t), _ = Te(o, r, s);
if (typeof _ > "u")
throw new SyntaxError(`Unrecognized language: ${r}`);
const q = await e(d, {
parser: "sql",
...b
}), x = le(N, (l) => {
if (typeof l != "string")
return l;
const c = [], u = l.split(new RegExp(i + "(\\d+)", "g"));
for (let m = 0; m < u.length; m++) {
let a = u[m];
if (m % 2 == 0) {
if (!a)
..._
});
let h = !1;
const $ = Se(q, (i) => {
if (typeof i != "string")
return i;
const l = [], m = i.split(new RegExp(a + "(\\d+)", "g"));
for (let u = 0; u < m.length; u++) {
let f = m[u];
if (u % 2 == 0) {
if (!f)
continue;
a = a.replaceAll(/([\\`]|\${)/g, "\\$1"), c.push(a);
f = f.replaceAll(/([\\`]|\${)/g, "\\$1"), f.split(/(\n)/).forEach(
(v) => v === `
` ? (h = !0, l.push(R)) : l.push(v)
);
} else {
const T = Number(a);
c.push(y[T]);
const v = Number(f);
l.push(x[v]);
}
}
return c;
}), h = ie;
return h ? w(["`", h, w(x), h, "`"]) : se(
return l;
}), p = h ? R : y && g ? qe : null;
return p ? O([
"`",
Ee([p, O($)]),
p,
"`"
]) : ve(
{ hug: !1 },
w([
O([
"`",
y,
O($),
g,
w(x),
f,
"`"
])
);
} catch (i) {
throw console.error(i), i;
} catch (a) {
throw console.error(a), a;
}
}, ae = {
}, Oe = {
"sql-formatter": (e) => G.includes(e),
"node-sql-parser": (e) => W.includes(e)
};
function B(e, t) {
for (const n of t)
if (Oe[n](e))
return {
formatter: n,
language: e
};
}
function F(e, t, n) {
let o = B(e, n);
if (o)
return o;
const r = t.indexOf(e);
for (let s = r - 1; s >= 0; --s)
if (o = B(t[s], n), o)
return o;
}
function Te(e, t, n) {
return e.formatter === "sql-formatter" ? F(t, n, [
"sql-formatter",
"node-sql-parser"
]) : F(t, n, [
"node-sql-parser",
"sql-formatter"
]);
}
const De = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
NODE_SQL_PARSER_DATABASES: W,
SQL_FORMATTER_LANGUAGES: G,
embedder: we,
name: xe,
option: _e
}, Symbol.toStringTag, { value: "Module" })), M = "embeddedXml";
function P(e, t) {
const n = new SyntaxError(
e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")"
);
return Object.assign(n, t);
}
const Ne = {
parse(e) {
const { lexErrors: t, parseErrors: n, cst: o } = Y(e);
if (t.length > 0) {
const r = t[0];
throw P(r.message, {
loc: {
start: { line: r.line, column: r.column },
end: {
line: r.line,
column: r.column + r.length
}
}
});
}
if (n.length > 0) {
const r = n[0];
throw P(r.message, {
loc: {
start: {
line: r.token.startLine ?? NaN,
column: r.token.startColumn ?? NaN
},
end: {
line: r.token.endLine ?? NaN,
column: r.token.endColumn ?? NaN
}
}
});
}
return o;
},
astFormat: "xml",
locStart(e) {
return e.location.startOffset;
},
locEnd(e) {
return e.location.endOffset ?? NaN;
}
}, { label: ke, hardline: je, line: Ae, group: T, indent: Le } = E, { mapDoc: Ie } = N, Ue = async (e, t, n, o, r) => {
try {
A("@prettier/plugin-xml", o, r);
const s = k(), { node: a } = n, b = a.quasis.map(
(p, i, { length: l }) => i === l - 1 ? p.value.cooked : p.value.cooked + `${s}-${i}`
).join("");
let d = "", y = 0;
const g = /^\s+/.exec(b);
g && (y = g.index + g[0].length, d = " ");
const x = /\s$/.test(b) ? " " : "", _ = j(n, t), q = await e(b.slice(y), {
parser: M
}), h = Ie(q, (p) => {
if (typeof p != "string")
return p;
const i = [], l = p.split(new RegExp(s + "-(\\d+)", "g"));
for (let m = 0; m < l.length; m++) {
let u = l[m];
if (m % 2 == 0) {
if (!u)
continue;
u = u.replaceAll(/([\\`]|\${)/g, "\\$1"), i.push(u);
} else {
const f = Number(u);
i.push(_[f]);
}
}
return i;
}), $ = o.xmlWhitespaceSensitivity === "ignore" ? je : d && x ? Ae : null;
return $ ? T([
"`",
Le([$, T(h)]),
$,
"`"
]) : ke(
{ hug: !1 },
T([
"`",
d,
T(h),
x,
"`"
])
);
} catch (s) {
throw console.error(s), s;
}
}, Re = {
category: "Global",
type: "string",
array: !0,
default: [{ value: ["sql"] }],
description: "Config embedded SQL formatting. This requires prettier-plugin-sql"
}, de = [
q,
D
], ue = {
[q]: G
}, me = {
[q]: re,
[D]: ce
}, pe = {
[q]: oe,
[D]: ae
}, ve = {
default: [{ value: ["xml", "svg"] }],
description: "Specify embedded XML languages. This requires @prettier/plugin-xml"
}, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
embedder: Ue,
name: M,
option: Re,
parser: Ne
}, Symbol.toStringTag, { value: "Module" })), L = [], z = {}, V = {}, Q = {}, Fe = /* @__PURE__ */ Object.assign({
"./noop/index.ts": te,
"./php/index.ts": $e,
"./sql/index.ts": De,
"./xml/index.ts": Be
});
Object.values(Fe).forEach(({ name: e, parser: t, embedder: n, option: o }) => {
de(L, e, C), t && (z[e] = t), n && (V[e] = n), Q[e] = o;
});
const Je = {
// parsers from internal
...P.parsers,
...F.parsers,
...W.parsers,
..._.parsers,
// parsers from plugin
...ue
}, { estree: v } = B, ge = function(e, t) {
// TODO: find out which parsers are required and which are optional
...H.parsers,
...X.parsers,
...J.parsers,
...K.parsers,
// parsers from this plugin
...z
};
console.log(L);
const { estree: D } = Z, Pe = function(e, t) {
var o;
const { node: r } = e;
if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: n } }) => n === null))
const { node: n } = e;
if (n.type !== "TemplateLiteral" || n.quasis.some(({ value: { cooked: r } }) => r === null))
return null;
for (const n of de) {
const i = t[n];
if (!i)
for (const r of L) {
const s = t[r];
if (!s)
continue;
const p = fe(e, i) ?? ye(e, i);
if (p === void 0)
const a = Ce(
e,
s,
t.disableEmbeddedDetectionByComment ?? []
) ?? Ge(e, s, t.disableEmbeddedDetectionByTag ?? []);
if (a === void 0)
continue;
const d = me[n], g = e.node;
return g.quasis.length === 1 && g.quasis[0].value.raw.trim() === "" ? "``" : async (...f) => {
const y = await d(...f, p);
return S.label(
{ embed: !0, ...y.label },
y
const b = V[r];
if (!b)
return null;
const d = e.node;
return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (...y) => {
const g = await b(...y, a, s);
return E.label(
{ embed: !0, ...g.label },
g
);
};
}
return ((o = v.embed) == null ? void 0 : o.call(v, e, t)) ?? null;
return ((o = D.embed) == null ? void 0 : o.call(D, e, t)) ?? null;
};
function fe({ node: e, parent: t }, r) {
if (r.length === 0 || e.type !== "TemplateLiteral")
function Ce({ node: e, parent: t }, n, o) {
if (n.length === 0 || e.type !== "TemplateLiteral")
return;
const o = e.comments ?? (t == null ? void 0 : t.comments);
if (!o)
const r = e.comments ?? (t == null ? void 0 : t.comments);
if (!r)
return;
const n = o[o.length - 1];
if (!(n.type !== "Block" || !n.leading)) {
for (const i of r)
if (` ${i} ` === n.value)
return i;
const s = r[r.length - 1];
if (!(s.type !== "Block" || !s.leading)) {
for (const a of n)
if (` ${a} ` === s.value && !o.includes(a))
return a;
}
}
function ye({ node: e, parent: t }, r) {
if (r.length !== 0 && !(e.type !== "TemplateLiteral" || (t == null ? void 0 : t.type) !== "TaggedTemplateExpression" || t.tag.type !== "Identifier")) {
for (const o of r)
if (t.tag.name === o)
return o;
function Ge({ node: e, parent: t }, n, o) {
if (n.length !== 0 && !(e.type !== "TemplateLiteral" || (t == null ? void 0 : t.type) !== "TaggedTemplateExpression" || t.tag.type !== "Identifier")) {
for (const r of n)
if (t.tag.name === r && !o.includes(r))
return r;
}
}
const Se = {
const Ke = {
estree: {
...v,
embed: ge
...D,
embed: Pe
}
}, Ne = {
...pe
}, Ye = {
...Q,
disableEmbeddedDetectionByComment: {
category: "Global",
type: "string",
array: !0,
default: [{ value: [] }],
description: 'This option turns off "/* lang */`...`" comment-based language detection for the specified languages.'
},
disableEmbeddedDetectionByTag: {
category: "Global",
type: "string",
array: !0,
default: [{ value: [] }],
description: 'This option turns off "lang`...`" tag-based language detection for the specified languages.'
}
};
export {
Ne as options,
ve as parsers,
Se as printers
V as embeddedEmbedders,
L as embeddedNames,
Q as embeddedOptions,
z as embeddedParsers,
Ye as options,
Je as parsers,
Ke as printers
};
import type { SupportOptions } from "prettier";
export declare const options: SupportOptions;
declare module "prettier" {
interface Options {
disableEmbeddedDetectionByComment?: string[];
disableEmbeddedDetectionByTag?: string[];
}
}
export declare const parsers: {
embeddedXml: import("prettier").Parser<any>;
typescript: import("prettier").Parser<any>;

@@ -3,0 +4,0 @@ flow: import("prettier").Parser<any>;

@@ -1,2 +0,2 @@

import { type Plugin } from "prettier";
import type { Plugin } from "prettier";
export declare const printers: Plugin["printers"];
import { Options, Doc, AstPath } from "prettier";
import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree";
export * from "./embedded/types.js";
export type PrettierNode = EsTreeNode & {

@@ -12,2 +11,2 @@ comments?: (Comment & {

export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
export type EmbeddedPrinter<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, lang: string) => Promise<Doc>;
export type Embedder<T extends Options = Options> = (textToDoc: (text: string, options: T) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: T, lang: string, langs: string[]) => Promise<Doc>;

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

"private": false,
"version": "0.0.2",
"version": "0.0.3",
"type": "module",

@@ -58,7 +58,4 @@ "files": [

},
"peerDependencies": {
"@xml-tools/parser": "^1.0.11",
"prettier": "^3.0.3",
"@prettier/plugin-xml": "^3.2.1",
"prettier-plugin-sql": "^0.15.1"
"dependencies": {
"uuid": "^9.0.1"
},

@@ -68,2 +65,4 @@ "devDependencies": {

"@commitlint/config-conventional": "^17.7.0",
"@prettier/plugin-php": "^0.20.1",
"@prettier/plugin-xml": "^3.2.1",
"@semantic-release/git": "^10.0.1",

@@ -79,12 +78,14 @@ "@types/estree": "^1.0.2",

"eslint": "^8.50.0",
"npm-check-updates": "^16.14.4",
"npm-check-updates": "^16.14.5",
"playwright": "^1.38.1",
"prettier-plugin-sql": "^0.15.1",
"semantic-release": "^22.0.5",
"typescript": "^5.2.2",
"vite": "^4.4.10",
"vite": "^4.4.11",
"vitest": "^0.34.6"
},
"dependencies": {
"uuid": "^9.0.1"
"peerDependencies": {
"@xml-tools/parser": "^1.0.11",
"prettier": "^3.0.3"
}
}
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