prettier-plugin-embed 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import type { Parser, SupportOptions } from "prettier";
2
+ import type { EmbeddedPrinter } from "../types.js";
3
+ export declare const embeddedLanguageNames: readonly ["embeddedXml", "embeddedSql"];
4
+ export declare const embeddedParsers: Record<string, Parser>;
5
+ export declare const embeddedPrinters: Record<string, EmbeddedPrinter>;
6
+ export declare const embeddedOptions: SupportOptions;
@@ -0,0 +1,4 @@
1
+ export * from "./name.js";
2
+ export * from "./printer.js";
3
+ export * from "./option.js";
4
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export declare const name = "embeddedSql";
@@ -0,0 +1,2 @@
1
+ import { SupportOption } from "prettier";
2
+ export declare const embeddedOption: SupportOption;
@@ -0,0 +1,3 @@
1
+ import type { Options } from "prettier";
2
+ import type { EmbeddedPrinter } from "../../types.js";
3
+ export declare const embeddedPrinter: EmbeddedPrinter<Options>;
@@ -0,0 +1,13 @@
1
+ import { name } from "./name.js";
2
+ import { SqlBaseOptions as PrettierPluginSqlOptions } from "prettier-plugin-sql";
3
+ export declare const SQL_FORMATTER_LANGUAGES: readonly ["sql", "bigquery", "hive", "mariadb", "mysql", "postgresql", "db2", "plsql", "n1ql", "redshift", "singlestoredb", "spark", "sqlite", "transactsql", "tsql", "trino"];
4
+ export declare const NODE_SQL_PARSER_DATABASES: readonly ["bigquery", "db2", "hive", "mariadb", "mysql", "postgresql", "transactsql", "flinksql"];
5
+ export type SqlFormatterLanguage = (typeof SQL_FORMATTER_LANGUAGES)[number];
6
+ export type NodeSqlParserDataBase = (typeof NODE_SQL_PARSER_DATABASES)[number];
7
+ export interface PrettierPluginEmbedSqlOptions {
8
+ [name]?: SqlFormatterLanguage[] | NodeSqlParserDataBase[];
9
+ }
10
+ declare module "prettier" {
11
+ interface Options extends PrettierPluginSqlOptions, PrettierPluginEmbedSqlOptions {
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ export * from "./xml/types.js";
@@ -0,0 +1,8 @@
1
+ import { Expression, Comment, TemplateLiteral } from "estree";
2
+ import { AstPath } from "prettier";
3
+ import { builders } from "prettier/doc";
4
+ import { InternalPrintFun } from "../types.js";
5
+ export declare function printTemplateExpression(path: AstPath<Expression & {
6
+ comments?: Comment[];
7
+ }>, print: InternalPrintFun): builders.Doc[];
8
+ export declare function printTemplateExpressions(path: AstPath<TemplateLiteral>, print: InternalPrintFun): builders.Doc[][];
@@ -0,0 +1,5 @@
1
+ export * from "./name.js";
2
+ export * from "./parser.js";
3
+ export * from "./printer.js";
4
+ export * from "./option.js";
5
+ export * from "./types.js";
@@ -0,0 +1 @@
1
+ export declare const name = "embeddedXml";
@@ -0,0 +1,2 @@
1
+ import { SupportOption } from "prettier";
2
+ export declare const embeddedOption: SupportOption;
@@ -0,0 +1,5 @@
1
+ import type { Parser } from "prettier";
2
+ import { parse as xmlToolsParse } from "@xml-tools/parser";
3
+ type CstNode = ReturnType<typeof xmlToolsParse>["cst"];
4
+ export declare const embeddedParser: Parser<CstNode>;
5
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Options } from "prettier";
2
+ import type { EmbeddedPrinter } from "../../types.js";
3
+ export declare const embeddedPrinter: EmbeddedPrinter<Options>;
@@ -0,0 +1,14 @@
1
+ import { name } from "./name.js";
2
+ export interface PrettierPluginXmlOptions {
3
+ xmlSelfClosingSpace?: boolean;
4
+ xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
5
+ xmlSortAttributesByKey?: boolean;
6
+ xmlQuoteAttributes?: "preserve" | "single" | "double";
7
+ }
8
+ export interface PrettierPluginEmbedXmlOptions {
9
+ [name]?: string[];
10
+ }
11
+ declare module "prettier" {
12
+ interface Options extends PrettierPluginXmlOptions, PrettierPluginEmbedXmlOptions {
13
+ }
14
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { parsers } from "./parsers.js";
2
2
  export { printers } from "./printers.js";
3
3
  export { options } from "./options.js";
4
- export type * from "./options.js";
4
+ export type * from "./types.js";
package/dist/index.js CHANGED
@@ -1,146 +1,319 @@
1
- import L from "prettier/parser-babel";
2
- import R from "prettier/parser-espree";
3
- import S from "prettier/parser-flow";
4
- import k from "prettier/parser-typescript";
5
- import { printers as A } from "prettier/plugins/estree.mjs";
6
- import { builders as $, utils as V } from "prettier/doc";
7
- const oe = {
8
- ...L.parsers,
9
- ...R.parsers,
10
- ...S.parsers,
11
- ...k.parsers
1
+ import P from "prettier/parser-babel";
2
+ import F from "prettier/parser-espree";
3
+ import W from "prettier/parser-flow";
4
+ import _ from "prettier/parser-typescript";
5
+ import { parse as j } from "@xml-tools/parser";
6
+ import { builders as S, utils as I } from "prettier/doc";
7
+ import { printers as B } from "prettier/plugins/estree.mjs";
8
+ const q = "embeddedXml";
9
+ function L(e, t) {
10
+ const r = new SyntaxError(
11
+ e + " (" + t.loc.start.line + ":" + t.loc.start.column + ")"
12
+ );
13
+ return Object.assign(r, t);
14
+ }
15
+ const G = {
16
+ parse(e) {
17
+ const { lexErrors: t, parseErrors: r, cst: o } = j(e);
18
+ if (t.length > 0) {
19
+ const n = t[0];
20
+ throw L(n.message, {
21
+ loc: {
22
+ start: { line: n.line, column: n.column },
23
+ end: {
24
+ line: n.line,
25
+ column: n.column + n.length
26
+ }
27
+ }
28
+ });
29
+ }
30
+ if (r.length > 0) {
31
+ const n = r[0];
32
+ throw L(n.message, {
33
+ loc: {
34
+ start: {
35
+ line: n.token.startLine ?? NaN,
36
+ column: n.token.startColumn ?? NaN
37
+ },
38
+ end: {
39
+ line: n.token.endLine ?? NaN,
40
+ column: n.token.endColumn ?? NaN
41
+ }
42
+ }
43
+ });
44
+ }
45
+ return o;
46
+ },
47
+ astFormat: "xml",
48
+ locStart(e) {
49
+ return e.location.startOffset;
50
+ },
51
+ locEnd(e) {
52
+ return e.location.endOffset ?? NaN;
53
+ }
12
54
  };
13
- let f;
14
- const q = new Uint8Array(16);
15
- function C() {
16
- if (!f && (f = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !f))
55
+ let $;
56
+ const V = new Uint8Array(16);
57
+ function Q() {
58
+ if (!$ && ($ = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !$))
17
59
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
18
- return f(q);
60
+ return $(V);
19
61
  }
20
- const o = [];
62
+ const s = [];
21
63
  for (let e = 0; e < 256; ++e)
22
- o.push((e + 256).toString(16).slice(1));
23
- function H(e, n = 0) {
24
- return o[e[n + 0]] + o[e[n + 1]] + o[e[n + 2]] + o[e[n + 3]] + "-" + o[e[n + 4]] + o[e[n + 5]] + "-" + o[e[n + 6]] + o[e[n + 7]] + "-" + o[e[n + 8]] + o[e[n + 9]] + "-" + o[e[n + 10]] + o[e[n + 11]] + o[e[n + 12]] + o[e[n + 13]] + o[e[n + 14]] + o[e[n + 15]];
64
+ s.push((e + 256).toString(16).slice(1));
65
+ function z(e, t = 0) {
66
+ 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]];
25
67
  }
26
- const W = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), v = {
27
- randomUUID: W
68
+ const M = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), U = {
69
+ randomUUID: M
28
70
  };
29
- function _(e, n, r) {
30
- if (v.randomUUID && !n && !e)
31
- return v.randomUUID();
71
+ function O(e, t, r) {
72
+ if (U.randomUUID && !t && !e)
73
+ return U.randomUUID();
32
74
  e = e || {};
33
- const t = e.random || (e.rng || C)();
34
- if (t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128, n) {
75
+ const o = e.random || (e.rng || Q)();
76
+ if (o[6] = o[6] & 15 | 64, o[8] = o[8] & 63 | 128, t) {
35
77
  r = r || 0;
36
- for (let s = 0; s < 16; ++s)
37
- n[r + s] = t[s];
38
- return n;
78
+ for (let n = 0; n < 16; ++n)
79
+ t[r + n] = o[n];
80
+ return t;
39
81
  }
40
- return H(t);
82
+ return z(o);
41
83
  }
42
- const { label: j, softline: I, hardline: B, line: F, group: a, indent: h, lineSuffixBoundary: G } = $, { mapDoc: N } = V, T = _(), O = new RegExp(T + "-(\\d+)", "g");
43
- async function X(e, n, r, t) {
84
+ const { group: X, indent: H, softline: k, lineSuffixBoundary: J } = S;
85
+ function K(e, t) {
86
+ var n;
87
+ const { node: r } = e;
88
+ let o = t();
89
+ return (n = r == null ? void 0 : r.comments) != null && n.length && (o = X([H([k, o]), k])), ["${", o, J, "}"];
90
+ }
91
+ function C(e, t) {
92
+ return e.map(
93
+ (r) => K(r, t),
94
+ "expressions"
95
+ );
96
+ }
97
+ const { label: Y, hardline: Z, line: ee, group: E, indent: te } = S, { mapDoc: ne } = I, re = async (e, t, r, o) => {
44
98
  try {
45
- const { node: s } = r, i = s.quasis.map(
46
- (u, p, { length: g }) => p === g - 1 ? u.value.cooked : u.value.cooked + J(p)
47
- ).join(""), d = z(r, n), U = 0, m = await e(i, {
48
- parser: "xml"
49
- }), l = N(m, (u) => {
50
- if (typeof u != "string")
51
- return u;
52
- const p = [], g = u.split(O);
53
- for (let y = 0; y < g.length; y++) {
54
- let c = g[y];
55
- if (y % 2 == 0) {
56
- c && (c = c.replaceAll(/([\\`]|\${)/g, "\\$1"), t.__embeddedInHtml && (c = c.replaceAll(/<\/(?=script\b)/gi, "<\\/")), p.push(c));
57
- continue;
99
+ const n = O(), { node: i } = r, p = i.quasis.map(
100
+ (l, c, { length: u }) => c === u - 1 ? l.value.cooked : l.value.cooked + `${n}-${c}`
101
+ ).join("");
102
+ let d = "", g = 0;
103
+ const f = /^\s+/.exec(p);
104
+ f && (g = f.index + f[0].length, d = " ");
105
+ const y = /\s$/.test(p) ? " " : "", b = C(r, t), N = await e(p.slice(g), {
106
+ parser: q
107
+ }), x = ne(N, (l) => {
108
+ if (typeof l != "string")
109
+ return l;
110
+ const c = [], u = l.split(new RegExp(n + "-(\\d+)", "g"));
111
+ for (let m = 0; m < u.length; m++) {
112
+ let a = u[m];
113
+ if (m % 2 == 0) {
114
+ if (!a)
115
+ continue;
116
+ a = a.replaceAll(/([\\`]|\${)/g, "\\$1"), c.push(a);
117
+ } else {
118
+ const T = Number(a);
119
+ c.push(b[T]);
58
120
  }
59
- const w = Number(c);
60
- p.push(d[w]);
61
121
  }
62
- return p;
63
- }), E = /^\s/.test(i) ? " " : "", D = /\s$/.test(i) ? " " : "", x = t.xmlWhitespaceSensitivity === "ignore" ? B : E && D ? F : null;
64
- return x ? a([
122
+ return c;
123
+ }), h = o.xmlWhitespaceSensitivity === "ignore" ? Z : d && y ? ee : null;
124
+ return h ? E([
65
125
  "`",
66
- h([x, a(l)]),
67
- x,
126
+ te([h, E(x)]),
127
+ h,
68
128
  "`"
69
- ]) : j(
129
+ ]) : Y(
70
130
  { hug: !1 },
71
- a([
131
+ E([
72
132
  "`",
73
- E,
74
- U > 1 ? h(a(l)) : a(l),
75
- D,
133
+ d,
134
+ E(x),
135
+ y,
76
136
  "`"
77
137
  ])
78
138
  );
79
- } catch (s) {
80
- throw console.error(s), s;
139
+ } catch (n) {
140
+ throw console.error(n), n;
81
141
  }
82
- }
83
- function J(e) {
84
- return T + "-" + e;
85
- }
86
- function P(e, n) {
87
- var s;
88
- const { node: r } = e;
89
- let t = n();
90
- return (s = r == null ? void 0 : r.comments) != null && s.length && (t = a([h([I, t]), I])), ["${", t, G, "}"];
91
- }
92
- function z(e, n) {
93
- return e.map(
94
- (r) => P(r, n),
95
- "expressions"
96
- );
97
- }
98
- const K = {
99
- xml: X
100
- }, { estree: b } = A, M = function(e, n) {
101
- var t;
142
+ }, oe = {
143
+ category: "Global",
144
+ type: "string",
145
+ array: !0,
146
+ default: [{ value: ["xml", "svg"] }],
147
+ description: "Config embedded XML formatting. This requires @prettier/plugin-xml"
148
+ }, D = "embeddedSql", A = [
149
+ "sql",
150
+ "bigquery",
151
+ "hive",
152
+ "mariadb",
153
+ "mysql",
154
+ "postgresql",
155
+ "db2",
156
+ "plsql",
157
+ "n1ql",
158
+ "redshift",
159
+ "singlestoredb",
160
+ "spark",
161
+ "sqlite",
162
+ "transactsql",
163
+ "tsql",
164
+ "trino"
165
+ ], R = [
166
+ "bigquery",
167
+ "db2",
168
+ "hive",
169
+ "mariadb",
170
+ "mysql",
171
+ "postgresql",
172
+ "transactsql",
173
+ "flinksql"
174
+ ], { label: se, hardline: ie, group: w } = S, { mapDoc: le } = I, ce = async (e, t, r, o, n) => {
175
+ try {
176
+ const i = "p" + O().replaceAll("-", ""), { node: p } = r, d = p.quasis.map(
177
+ (l, c, { length: u }) => c === u - 1 ? l.value.cooked : l.value.cooked + `${i}${c}`
178
+ ).join(""), g = /^\s/.test(d) ? " " : "", f = /\s$/.test(d) ? " " : "", y = C(r, t);
179
+ n = n.toLowerCase();
180
+ let b = {};
181
+ if (o.formatter === "sql-formatter")
182
+ if (A.includes(n))
183
+ b = {
184
+ formatter: "sql-formatter",
185
+ language: n
186
+ };
187
+ else if (R.includes(n))
188
+ b = {
189
+ formatter: "node-sql-parser",
190
+ database: n
191
+ };
192
+ else
193
+ throw new SyntaxError(`Unrecognized language: ${n}`);
194
+ else if (R.includes(n))
195
+ b = {
196
+ formatter: "node-sql-parser",
197
+ database: n
198
+ };
199
+ else if (A.includes(n))
200
+ b = {
201
+ formatter: "sql-formatter",
202
+ language: n
203
+ };
204
+ else
205
+ throw new SyntaxError(`Unrecognized language: ${n}`);
206
+ const N = await e(d, {
207
+ parser: "sql",
208
+ ...b
209
+ }), x = le(N, (l) => {
210
+ if (typeof l != "string")
211
+ return l;
212
+ const c = [], u = l.split(new RegExp(i + "(\\d+)", "g"));
213
+ for (let m = 0; m < u.length; m++) {
214
+ let a = u[m];
215
+ if (m % 2 == 0) {
216
+ if (!a)
217
+ continue;
218
+ a = a.replaceAll(/([\\`]|\${)/g, "\\$1"), c.push(a);
219
+ } else {
220
+ const T = Number(a);
221
+ c.push(y[T]);
222
+ }
223
+ }
224
+ return c;
225
+ }), h = ie;
226
+ return h ? w(["`", h, w(x), h, "`"]) : se(
227
+ { hug: !1 },
228
+ w([
229
+ "`",
230
+ g,
231
+ w(x),
232
+ f,
233
+ "`"
234
+ ])
235
+ );
236
+ } catch (i) {
237
+ throw console.error(i), i;
238
+ }
239
+ }, ae = {
240
+ category: "Global",
241
+ type: "string",
242
+ array: !0,
243
+ default: [{ value: ["sql"] }],
244
+ description: "Config embedded SQL formatting. This requires prettier-plugin-sql"
245
+ }, de = [
246
+ q,
247
+ D
248
+ ], ue = {
249
+ [q]: G
250
+ }, me = {
251
+ [q]: re,
252
+ [D]: ce
253
+ }, pe = {
254
+ [q]: oe,
255
+ [D]: ae
256
+ }, ve = {
257
+ // parsers from internal
258
+ ...P.parsers,
259
+ ...F.parsers,
260
+ ...W.parsers,
261
+ ..._.parsers,
262
+ // parsers from plugin
263
+ ...ue
264
+ }, { estree: v } = B, ge = function(e, t) {
265
+ var o;
102
266
  const { node: r } = e;
103
- if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: s } }) => s === null))
267
+ if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: n } }) => n === null))
104
268
  return null;
105
- for (const { comment: s, tag: i, embedder: d } of JSON.parse(
106
- n.embeddedLanguages ?? "[]"
107
- )) {
108
- if (!Q(e, typeof i == "string" ? [i] : i))
269
+ for (const n of de) {
270
+ const i = t[n];
271
+ if (!i)
272
+ continue;
273
+ const p = fe(e, i) ?? ye(e, i);
274
+ if (p === void 0)
109
275
  continue;
110
- let m;
111
- if (typeof d == "string") {
112
- m = K[d];
113
- const l = e.node;
114
- if (l.quasis.length === 1 && l.quasis[0].value.raw.trim() === "")
115
- return "``";
116
- } else
117
- m = d ?? null;
118
- return m;
276
+ const d = me[n], g = e.node;
277
+ return g.quasis.length === 1 && g.quasis[0].value.raw.trim() === "" ? "``" : async (...f) => {
278
+ const y = await d(...f, p);
279
+ return S.label(
280
+ { embed: !0, ...y.label },
281
+ y
282
+ );
283
+ };
119
284
  }
120
- return ((t = b.embed) == null ? void 0 : t.call(b, e, n)) ?? null;
285
+ return ((o = v.embed) == null ? void 0 : o.call(v, e, t)) ?? null;
121
286
  };
122
- function Q({ node: e, parent: n }, r) {
123
- for (const t of r)
124
- if (e.type === "TemplateLiteral" && (n == null ? void 0 : n.type) === "TaggedTemplateExpression" && n.tag.type === "Identifier" && n.tag.name === t)
125
- return !0;
126
- return !1;
287
+ function fe({ node: e, parent: t }, r) {
288
+ if (r.length === 0 || e.type !== "TemplateLiteral")
289
+ return;
290
+ const o = e.comments ?? (t == null ? void 0 : t.comments);
291
+ if (!o)
292
+ return;
293
+ const n = o[o.length - 1];
294
+ if (!(n.type !== "Block" || !n.leading)) {
295
+ for (const i of r)
296
+ if (` ${i} ` === n.value)
297
+ return i;
298
+ }
127
299
  }
128
- const se = {
129
- estree: {
130
- ...b,
131
- embed: M
300
+ function ye({ node: e, parent: t }, r) {
301
+ if (r.length !== 0 && !(e.type !== "TemplateLiteral" || (t == null ? void 0 : t.type) !== "TaggedTemplateExpression" || t.tag.type !== "Identifier")) {
302
+ for (const o of r)
303
+ if (t.tag.name === o)
304
+ return o;
132
305
  }
133
- }, ie = {
134
- embeddedLanguages: {
135
- category: "Global",
136
- type: "string",
137
- array: !1,
138
- default: "[]",
139
- description: "Config embedded languages formatting supported by this plugin."
306
+ }
307
+ const Se = {
308
+ estree: {
309
+ ...v,
310
+ embed: ge
140
311
  }
312
+ }, Ne = {
313
+ ...pe
141
314
  };
142
315
  export {
143
- ie as options,
144
- oe as parsers,
145
- se as printers
316
+ Ne as options,
317
+ ve as parsers,
318
+ Se as printers
146
319
  };
package/dist/options.d.ts CHANGED
@@ -1,10 +1,2 @@
1
1
  import type { SupportOptions } from "prettier";
2
2
  export declare const options: SupportOptions;
3
- export interface EmbeddedLanguage {
4
- tag: string | string[];
5
- comment: string | string[];
6
- embedder?: string | null;
7
- }
8
- export interface PrettierPluginEmbedOptions {
9
- embeddedLanguages?: string;
10
- }
@@ -1,2 +1,2 @@
1
- import type { Plugin } from "prettier";
1
+ import { type Plugin } from "prettier";
2
2
  export declare const printers: Plugin["printers"];
@@ -0,0 +1,12 @@
1
+ import { Options, Doc, AstPath } from "prettier";
2
+ import type { Node as EsTreeNode, TemplateLiteral, Comment } from "estree";
3
+ export * from "./embedded/types.js";
4
+ export type PrettierNode = EsTreeNode & {
5
+ comments?: (Comment & {
6
+ leading: boolean;
7
+ trailing: boolean;
8
+ nodeDescription: string;
9
+ })[];
10
+ };
11
+ export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
12
+ 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>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "prettier-plugin-embed",
3
3
  "description": "A prettier plugin to format embedded languages in js/ts files.",
4
4
  "private": false,
5
- "version": "0.0.1",
5
+ "version": "0.0.2",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "./dist"
@@ -55,17 +55,19 @@
55
55
  "postncu": "npm i"
56
56
  },
57
57
  "peerDependencies": {
58
- "prettier": "^3.0.3"
58
+ "@xml-tools/parser": "^1.0.11",
59
+ "prettier": "^3.0.3",
60
+ "@prettier/plugin-xml": "^3.2.1",
61
+ "prettier-plugin-sql": "^0.15.1"
59
62
  },
60
63
  "devDependencies": {
61
64
  "@commitlint/cli": "^17.7.2",
62
65
  "@commitlint/config-conventional": "^17.7.0",
63
- "@prettier/plugin-xml": "^3.2.1",
64
66
  "@semantic-release/git": "^10.0.1",
65
67
  "@types/estree": "^1.0.2",
66
68
  "@types/uuid": "^9.0.4",
67
- "@typescript-eslint/eslint-plugin": "^6.7.3",
68
- "@typescript-eslint/parser": "^6.7.3",
69
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
70
+ "@typescript-eslint/parser": "^6.7.4",
69
71
  "@vitest/browser": "^0.34.6",
70
72
  "@vitest/coverage-istanbul": "^0.34.6",
71
73
  "@vitest/ui": "^0.34.6",
@@ -75,7 +77,7 @@
75
77
  "playwright": "^1.38.1",
76
78
  "semantic-release": "^22.0.5",
77
79
  "typescript": "^5.2.2",
78
- "vite": "^4.4.9",
80
+ "vite": "^4.4.10",
79
81
  "vitest": "^0.34.6"
80
82
  },
81
83
  "dependencies": {
@@ -1,3 +0,0 @@
1
- import type { Embedder } from "./types.js";
2
- export declare const embedders: Record<string, Embedder>;
3
- export * from "./types.js";
@@ -1,4 +0,0 @@
1
- import type { Options, Doc, AstPath } from "prettier";
2
- import type { TemplateLiteral } from "estree";
3
- export type InternalPrintFun = (selector?: string | number | (string | number)[] | AstPath<TemplateLiteral>) => Doc;
4
- export type Embedder = (textToDoc: (text: string, options: Options) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: Options) => Promise<Doc>;
@@ -1,11 +0,0 @@
1
- import type { AstPath, Options, Doc } from "prettier";
2
- import type { TemplateLiteral } from "estree";
3
- import type { InternalPrintFun } from "./types.js";
4
- interface PrettierPluginXmlOptions extends Options {
5
- xmlSelfClosingSpace?: boolean;
6
- xmlWhitespaceSensitivity?: "strict" | "preserve" | "ignore";
7
- xmlSortAttributesByKey?: boolean;
8
- xmlQuoteAttributes?: "preserve" | "single" | "double";
9
- }
10
- declare function printEmbedXml(textToDoc: (text: string, options: Options) => Promise<Doc>, print: InternalPrintFun, path: AstPath<TemplateLiteral>, options: PrettierPluginXmlOptions): Promise<Doc>;
11
- export default printEmbedXml;