prettier-plugin-embed 0.4.0 → 0.4.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.
- package/dist/embedded/sql/options.d.ts +7 -13
- package/dist/index.js +174 -180
- package/dist/options.d.ts +6 -12
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ type Identifiers = AutocompleteStringList<typeof DEFAULT_IDENTIFIERS>;
|
|
|
12
12
|
type DefaultIdentifiersHolder = StringListToInterfaceKey<typeof DEFAULT_IDENTIFIERS>;
|
|
13
13
|
declare const SQL_PLUGINS: readonly ["prettier-plugin-sql", "prettier-plugin-sql-cst"];
|
|
14
14
|
type SqlPlugin = (typeof SQL_PLUGINS)[number];
|
|
15
|
-
declare const SQL_CST_PARSERS: readonly ["sqlite", "bigquery"];
|
|
15
|
+
declare const SQL_CST_PARSERS: readonly ["sqlite", "bigquery", "mysql", "mariadb", "postgresql"];
|
|
16
16
|
type SqlCstParser = (typeof SQL_CST_PARSERS)[number];
|
|
17
17
|
declare const EMBEDDED_LANGUAGE_IDENTIFIERS: "embeddedSqlIdentifiers";
|
|
18
18
|
declare const EMBEDDED_LANGUAGE_PLUGIN: "embeddedSqlPlugin";
|
|
@@ -35,26 +35,20 @@ export declare const options: {
|
|
|
35
35
|
type: "choice";
|
|
36
36
|
default: "prettier-plugin-sql";
|
|
37
37
|
description: string;
|
|
38
|
-
choices:
|
|
39
|
-
value: "prettier-plugin-sql";
|
|
38
|
+
choices: {
|
|
39
|
+
value: "prettier-plugin-sql" | "prettier-plugin-sql-cst";
|
|
40
40
|
description: string;
|
|
41
|
-
}
|
|
42
|
-
value: "prettier-plugin-sql-cst";
|
|
43
|
-
description: string;
|
|
44
|
-
})[];
|
|
41
|
+
}[];
|
|
45
42
|
};
|
|
46
43
|
readonly embeddedSqlParser: {
|
|
47
44
|
category: string;
|
|
48
45
|
type: "choice";
|
|
49
46
|
default: "sqlite";
|
|
50
47
|
description: string;
|
|
51
|
-
choices:
|
|
52
|
-
value: "sqlite";
|
|
53
|
-
description: string;
|
|
54
|
-
} | {
|
|
55
|
-
value: "bigquery";
|
|
48
|
+
choices: {
|
|
49
|
+
value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql";
|
|
56
50
|
description: string;
|
|
57
|
-
}
|
|
51
|
+
}[];
|
|
58
52
|
};
|
|
59
53
|
};
|
|
60
54
|
type Options = typeof options;
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import Ft from "prettier/parser-flow";
|
|
|
5
5
|
import wt from "prettier/parser-meriyah";
|
|
6
6
|
import Bt from "prettier/parser-typescript";
|
|
7
7
|
import { printers as Ut } from "prettier/plugins/estree.mjs";
|
|
8
|
-
import { readFile as
|
|
9
|
-
import { isAbsolute as
|
|
8
|
+
import { readFile as Ct } from "node:fs/promises";
|
|
9
|
+
import { isAbsolute as Wt, dirname as Gt, resolve as qt, extname as zt } from "node:path";
|
|
10
10
|
import { Worker as Kt } from "node:worker_threads";
|
|
11
11
|
import { resolveConfigFile as Ht } from "prettier";
|
|
12
12
|
const { group: Jt, indent: Xt, softline: ie, lineSuffixBoundary: Yt } = I, { mapDoc: Qt } = X;
|
|
@@ -21,7 +21,7 @@ function x(t, n) {
|
|
|
21
21
|
"expressions"
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function T(t, n, r) {
|
|
25
25
|
return Qt(t, (o) => {
|
|
26
26
|
if (typeof o != "string")
|
|
27
27
|
return o;
|
|
@@ -73,7 +73,7 @@ const Y = (() => {
|
|
|
73
73
|
return r;
|
|
74
74
|
};
|
|
75
75
|
})();
|
|
76
|
-
function
|
|
76
|
+
function L(t = "p", n = "") {
|
|
77
77
|
const r = Y(), e = Y(), o = ce(t), s = ce(n), l = (p) => `${t}${r}${p}${e}${n}`, d = new RegExp(
|
|
78
78
|
`${o}${r}(\\d+)${e}${s}`,
|
|
79
79
|
"g"
|
|
@@ -100,7 +100,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
100
100
|
...e,
|
|
101
101
|
...s
|
|
102
102
|
};
|
|
103
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
103
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L("@p"), c = l.quasis.map(
|
|
104
104
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
105
105
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
106
106
|
a.length,
|
|
@@ -108,7 +108,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
108
108
|
), b = x(r, n), E = await t(y, {
|
|
109
109
|
...e,
|
|
110
110
|
parser: "scss"
|
|
111
|
-
}), i =
|
|
111
|
+
}), i = T(E, p, b);
|
|
112
112
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
113
113
|
return k([
|
|
114
114
|
"`",
|
|
@@ -142,7 +142,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
142
142
|
...e,
|
|
143
143
|
...s
|
|
144
144
|
};
|
|
145
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
145
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
146
146
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
147
147
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
148
148
|
a.length,
|
|
@@ -150,7 +150,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
150
150
|
), b = x(r, n), E = await t(y, {
|
|
151
151
|
...e,
|
|
152
152
|
parser: e.embeddedEsParser ?? "babel"
|
|
153
|
-
}), i =
|
|
153
|
+
}), i = T(E, p, b);
|
|
154
154
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
155
155
|
return N([
|
|
156
156
|
"`",
|
|
@@ -210,7 +210,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
210
210
|
...e,
|
|
211
211
|
...s
|
|
212
212
|
};
|
|
213
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
213
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
214
214
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
215
215
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
216
216
|
a.length,
|
|
@@ -218,7 +218,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
218
218
|
), b = x(r, n), E = await t(y, {
|
|
219
219
|
...e,
|
|
220
220
|
parser: "glsl-parser"
|
|
221
|
-
}), i =
|
|
221
|
+
}), i = T(E, p, b);
|
|
222
222
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
223
223
|
return A([
|
|
224
224
|
"`",
|
|
@@ -252,7 +252,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
252
252
|
...e,
|
|
253
253
|
...s
|
|
254
254
|
};
|
|
255
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
255
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
256
256
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
257
257
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
258
258
|
a.length,
|
|
@@ -260,7 +260,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
260
260
|
), b = x(r, n), E = await t(y, {
|
|
261
261
|
...e,
|
|
262
262
|
parser: "graphql"
|
|
263
|
-
}), i =
|
|
263
|
+
}), i = T(E, p, b);
|
|
264
264
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
265
265
|
return P([
|
|
266
266
|
"`",
|
|
@@ -294,7 +294,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
294
294
|
...e,
|
|
295
295
|
...s
|
|
296
296
|
};
|
|
297
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
297
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
298
298
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
299
299
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
300
300
|
a.length,
|
|
@@ -335,8 +335,8 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
335
335
|
v,
|
|
336
336
|
"`"
|
|
337
337
|
]);
|
|
338
|
-
}, ht = "embeddedHtml", xn = ["html", "xhtml"],
|
|
339
|
-
[
|
|
338
|
+
}, ht = "embeddedHtml", xn = ["html", "xhtml"], Ln = S(ht), Tn = {
|
|
339
|
+
[Ln]: {
|
|
340
340
|
category: "Embed",
|
|
341
341
|
type: "string",
|
|
342
342
|
array: !0,
|
|
@@ -347,13 +347,13 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
347
347
|
__proto__: null,
|
|
348
348
|
embedder: Sn,
|
|
349
349
|
language: ht,
|
|
350
|
-
options:
|
|
350
|
+
options: Tn
|
|
351
351
|
}, Symbol.toStringTag, { value: "Module" })), { line: De, group: j, indent: Ie, softline: Se } = I, Mn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
352
352
|
M("prettier-plugin-ini", e, o), e = {
|
|
353
353
|
...e,
|
|
354
354
|
...s
|
|
355
355
|
};
|
|
356
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
356
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
357
357
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
358
358
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
359
359
|
a.length,
|
|
@@ -361,7 +361,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
361
361
|
), b = x(r, n), E = await t(y, {
|
|
362
362
|
...e,
|
|
363
363
|
parser: "ini"
|
|
364
|
-
}), i =
|
|
364
|
+
}), i = T(E, p, b);
|
|
365
365
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
366
366
|
return j([
|
|
367
367
|
"`",
|
|
@@ -390,7 +390,7 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
390
390
|
embedder: Mn,
|
|
391
391
|
language: ft,
|
|
392
392
|
options: An
|
|
393
|
-
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: F, indent:
|
|
393
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: xe, group: F, indent: Le, softline: Te } = I, Rn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
394
394
|
e = {
|
|
395
395
|
...e,
|
|
396
396
|
...s
|
|
@@ -403,19 +403,19 @@ const { line: ae, group: k, indent: de, softline: le } = I, tn = async (t, n, r,
|
|
|
403
403
|
), b = x(r, n), E = await t(y, {
|
|
404
404
|
...e,
|
|
405
405
|
parser: e.embeddedJsonParser ?? "json"
|
|
406
|
-
}), i =
|
|
406
|
+
}), i = T(E, p, b);
|
|
407
407
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
408
408
|
return F([
|
|
409
409
|
"`",
|
|
410
410
|
a,
|
|
411
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] :
|
|
411
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [F(i)] : Le([F(i)]),
|
|
412
412
|
u,
|
|
413
413
|
"`"
|
|
414
414
|
]);
|
|
415
|
-
const h = a.length ? xe :
|
|
415
|
+
const h = a.length ? xe : Te, v = u.length ? xe : Te;
|
|
416
416
|
return F([
|
|
417
417
|
"`",
|
|
418
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] :
|
|
418
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, F(i)] : Le([h, F(i)]),
|
|
419
419
|
v,
|
|
420
420
|
"`"
|
|
421
421
|
]);
|
|
@@ -427,7 +427,7 @@ function jn() {
|
|
|
427
427
|
placeholderRegex: e
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
|
-
const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify", "json5"], Bn = V(ne), Un = S(ne),
|
|
430
|
+
const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify", "json5"], Bn = V(ne), Un = S(ne), Cn = {
|
|
431
431
|
[Un]: {
|
|
432
432
|
category: "Embed",
|
|
433
433
|
type: "string",
|
|
@@ -445,17 +445,17 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
445
445
|
description: `Use "${t}".`
|
|
446
446
|
}))
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, Wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
449
449
|
__proto__: null,
|
|
450
450
|
embedder: Rn,
|
|
451
451
|
language: ne,
|
|
452
|
-
options:
|
|
452
|
+
options: Cn
|
|
453
453
|
}, Symbol.toStringTag, { value: "Module" })), { line: Oe, group: w, indent: Me, softline: ke } = I, Gn = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
454
454
|
M("prettier-plugin-latex", e, o), e = {
|
|
455
455
|
...e,
|
|
456
456
|
...s
|
|
457
457
|
};
|
|
458
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
458
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
459
459
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
460
460
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
461
461
|
a.length,
|
|
@@ -463,7 +463,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
463
463
|
), b = x(r, n), E = await t(y, {
|
|
464
464
|
...e,
|
|
465
465
|
parser: "latex-parser"
|
|
466
|
-
}), i =
|
|
466
|
+
}), i = T(E, p, b);
|
|
467
467
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
468
468
|
return w([
|
|
469
469
|
"`",
|
|
@@ -506,7 +506,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
506
506
|
...e,
|
|
507
507
|
...s
|
|
508
508
|
};
|
|
509
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
509
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
510
510
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
511
511
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
512
512
|
a.length,
|
|
@@ -515,7 +515,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
515
515
|
...e,
|
|
516
516
|
parser: "markdown",
|
|
517
517
|
__inJsTemplate: !0
|
|
518
|
-
}), i =
|
|
518
|
+
}), i = T(E, p, b);
|
|
519
519
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
520
520
|
return B([
|
|
521
521
|
"`",
|
|
@@ -561,7 +561,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
561
561
|
...e,
|
|
562
562
|
...s
|
|
563
563
|
};
|
|
564
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
564
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L("$p"), c = l.quasis.map(
|
|
565
565
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
566
566
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
567
567
|
a.length,
|
|
@@ -569,7 +569,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
569
569
|
), b = x(r, n), E = await t(y, {
|
|
570
570
|
...e,
|
|
571
571
|
parser: "php"
|
|
572
|
-
}), i =
|
|
572
|
+
}), i = T(E, p, b);
|
|
573
573
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
574
574
|
return U([
|
|
575
575
|
"`",
|
|
@@ -598,12 +598,12 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
598
598
|
embedder: nr,
|
|
599
599
|
language: yt,
|
|
600
600
|
options: sr
|
|
601
|
-
}, Symbol.toStringTag, { value: "Module" })), { line: we, group:
|
|
601
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: C, indent: Be, softline: Ue } = I, cr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
602
602
|
M("prettier-plugin-properties", e, o), e = {
|
|
603
603
|
...e,
|
|
604
604
|
...s
|
|
605
605
|
};
|
|
606
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
606
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
607
607
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
608
608
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
609
609
|
a.length,
|
|
@@ -611,19 +611,19 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
611
611
|
), b = x(r, n), E = await t(y, {
|
|
612
612
|
...e,
|
|
613
613
|
parser: "dot-properties"
|
|
614
|
-
}), i =
|
|
614
|
+
}), i = T(E, p, b);
|
|
615
615
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
616
|
-
return
|
|
616
|
+
return C([
|
|
617
617
|
"`",
|
|
618
618
|
a,
|
|
619
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [
|
|
619
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [C(i)] : Be([C(i)]),
|
|
620
620
|
u,
|
|
621
621
|
"`"
|
|
622
622
|
]);
|
|
623
623
|
const h = a.length ? we : Ue, v = u.length ? we : Ue;
|
|
624
|
-
return
|
|
624
|
+
return C([
|
|
625
625
|
"`",
|
|
626
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h,
|
|
626
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, C(i)] : Be([h, C(i)]),
|
|
627
627
|
v,
|
|
628
628
|
"`"
|
|
629
629
|
]);
|
|
@@ -640,12 +640,12 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
640
640
|
embedder: cr,
|
|
641
641
|
language: _t,
|
|
642
642
|
options: lr
|
|
643
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
643
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Ce, group: W, indent: We, softline: Ge } = I, gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
644
644
|
M("@prettier/plugin-ruby", e, o), e = {
|
|
645
645
|
...e,
|
|
646
646
|
...s
|
|
647
647
|
};
|
|
648
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
648
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
649
649
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
650
650
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
651
651
|
a.length,
|
|
@@ -653,19 +653,19 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
653
653
|
), b = x(r, n), E = await t(y, {
|
|
654
654
|
...e,
|
|
655
655
|
parser: e.embeddedRubyParser ?? "ruby"
|
|
656
|
-
}), i =
|
|
656
|
+
}), i = T(E, p, b);
|
|
657
657
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
658
|
-
return
|
|
658
|
+
return W([
|
|
659
659
|
"`",
|
|
660
660
|
a,
|
|
661
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [
|
|
661
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [W(i)] : We([W(i)]),
|
|
662
662
|
u,
|
|
663
663
|
"`"
|
|
664
664
|
]);
|
|
665
|
-
const h = a.length ?
|
|
666
|
-
return
|
|
665
|
+
const h = a.length ? Ce : Ge, v = u.length ? Ce : Ge;
|
|
666
|
+
return W([
|
|
667
667
|
"`",
|
|
668
|
-
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h,
|
|
668
|
+
e.noEmbeddedMultiLineIndentation?.includes(o) ? [h, W(i)] : We([h, W(i)]),
|
|
669
669
|
v,
|
|
670
670
|
"`"
|
|
671
671
|
]);
|
|
@@ -697,7 +697,7 @@ const ne = "embeddedJson", Fn = ["json", "jsonl"], wn = ["json", "json-stringify
|
|
|
697
697
|
...e,
|
|
698
698
|
...s
|
|
699
699
|
};
|
|
700
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
700
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
701
701
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
702
702
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
703
703
|
a.length,
|
|
@@ -774,13 +774,13 @@ function Je(t) {
|
|
|
774
774
|
return t;
|
|
775
775
|
}
|
|
776
776
|
function xr(t, n, r) {
|
|
777
|
-
return n =
|
|
777
|
+
return n = Lr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t;
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
var n =
|
|
779
|
+
function Lr(t) {
|
|
780
|
+
var n = Tr(t, "string");
|
|
781
781
|
return typeof n == "symbol" ? n : String(n);
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function Tr(t, n) {
|
|
784
784
|
if (typeof t != "object" || t === null)
|
|
785
785
|
return t;
|
|
786
786
|
var r = t[Symbol.toPrimitive];
|
|
@@ -830,7 +830,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
830
830
|
};
|
|
831
831
|
const l = e.embeddedSqlPlugin ?? "prettier-plugin-sql";
|
|
832
832
|
M(l, e, o);
|
|
833
|
-
const { node: d } = r, { createPlaceholder: p, placeholderRegex: c } =
|
|
833
|
+
const { node: d } = r, { createPlaceholder: p, placeholderRegex: c } = L(), a = d.quasis.map(
|
|
834
834
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + p(g)
|
|
835
835
|
).join(""), u = a.match(/^\s+/)?.[0] ?? "", y = a.match(/\s+$/)?.[0] ?? "", b = a.slice(
|
|
836
836
|
u.length,
|
|
@@ -842,7 +842,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
842
842
|
...e,
|
|
843
843
|
parser: e.embeddedSqlParser ?? "sqlite"
|
|
844
844
|
});
|
|
845
|
-
i =
|
|
845
|
+
i = T(m, c, E);
|
|
846
846
|
} else {
|
|
847
847
|
const m = await t(Or(b), {
|
|
848
848
|
...e,
|
|
@@ -884,57 +884,51 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
884
884
|
v,
|
|
885
885
|
"`"
|
|
886
886
|
]);
|
|
887
|
-
}, Z = "embeddedSql", Ar = ["sql"], Pr =
|
|
888
|
-
|
|
887
|
+
}, Z = "embeddedSql", Ar = ["sql"], Pr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Rr = [
|
|
888
|
+
"sqlite",
|
|
889
|
+
"bigquery",
|
|
890
|
+
"mysql",
|
|
891
|
+
"mariadb",
|
|
892
|
+
"postgresql"
|
|
893
|
+
], jr = S(Z), Fr = en(Z), wr = V(Z), Br = {
|
|
894
|
+
[jr]: {
|
|
889
895
|
category: "Embed",
|
|
890
896
|
type: "string",
|
|
891
897
|
array: !0,
|
|
892
898
|
default: [{ value: [...Ar] }],
|
|
893
899
|
description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql" or "prettier-plugin-sql-cst".'
|
|
894
900
|
},
|
|
895
|
-
[
|
|
901
|
+
[Fr]: {
|
|
896
902
|
category: "Embed",
|
|
897
903
|
type: "choice",
|
|
898
904
|
default: "prettier-plugin-sql",
|
|
899
905
|
description: 'Specify the Prettier plugin for parsing and formatting SQL. Default is "prettier-plugin-sql"',
|
|
900
|
-
choices:
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
},
|
|
905
|
-
{
|
|
906
|
-
value: "prettier-plugin-sql-cst",
|
|
907
|
-
description: 'Use "prettier-plugin-sql-cst".'
|
|
908
|
-
}
|
|
909
|
-
]
|
|
906
|
+
choices: Pr.map((t) => ({
|
|
907
|
+
value: t,
|
|
908
|
+
description: `Use "${t}".`
|
|
909
|
+
}))
|
|
910
910
|
},
|
|
911
|
-
[
|
|
911
|
+
[wr]: {
|
|
912
912
|
category: "Embed",
|
|
913
913
|
type: "choice",
|
|
914
914
|
default: "sqlite",
|
|
915
915
|
description: 'Specify the embedded SQL language parser. Default is "sqlite". This option is only for "prettier-plugin-sql-cst".',
|
|
916
|
-
choices:
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
},
|
|
921
|
-
{
|
|
922
|
-
value: "bigquery",
|
|
923
|
-
description: "BigQuery parser."
|
|
924
|
-
}
|
|
925
|
-
]
|
|
916
|
+
choices: Rr.map((t) => ({
|
|
917
|
+
value: t,
|
|
918
|
+
description: `Use "${t}" parser.`
|
|
919
|
+
}))
|
|
926
920
|
}
|
|
927
|
-
},
|
|
921
|
+
}, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
928
922
|
__proto__: null,
|
|
929
923
|
embedder: Nr,
|
|
930
924
|
language: Z,
|
|
931
|
-
options:
|
|
932
|
-
}, Symbol.toStringTag, { value: "Module" })), { line: Ve, group: z, indent: Ze, softline: et, hardline:
|
|
925
|
+
options: Br
|
|
926
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Ve, group: z, indent: Ze, softline: et, hardline: Cr } = I, { mapDoc: Wr } = X, Gr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
933
927
|
M("prettier-plugin-toml", e, o), e = {
|
|
934
928
|
...e,
|
|
935
929
|
...s
|
|
936
930
|
};
|
|
937
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
931
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
938
932
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
939
933
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
940
934
|
a.length,
|
|
@@ -942,7 +936,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
942
936
|
), b = x(r, n), E = await t(y, {
|
|
943
937
|
...e,
|
|
944
938
|
parser: "toml"
|
|
945
|
-
}), i =
|
|
939
|
+
}), i = Wr(E, (m) => {
|
|
946
940
|
if (typeof m != "string")
|
|
947
941
|
return m;
|
|
948
942
|
const g = [], f = m.split(p);
|
|
@@ -952,7 +946,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
952
946
|
if (!_)
|
|
953
947
|
continue;
|
|
954
948
|
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === `
|
|
955
|
-
` ? g.push(
|
|
949
|
+
` ? g.push(Cr) : g.push(D));
|
|
956
950
|
} else {
|
|
957
951
|
const D = Number(_);
|
|
958
952
|
g.push(b[D]);
|
|
@@ -975,25 +969,25 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
975
969
|
v,
|
|
976
970
|
"`"
|
|
977
971
|
]);
|
|
978
|
-
}, It = "embeddedToml",
|
|
979
|
-
[
|
|
972
|
+
}, It = "embeddedToml", qr = ["toml"], zr = S(It), Kr = {
|
|
973
|
+
[zr]: {
|
|
980
974
|
category: "Embed",
|
|
981
975
|
type: "string",
|
|
982
976
|
array: !0,
|
|
983
|
-
default: [{ value: [...
|
|
977
|
+
default: [{ value: [...qr] }],
|
|
984
978
|
description: 'Specify embedded TOML language identifiers. This requires "prettier-plugin-toml".'
|
|
985
979
|
}
|
|
986
|
-
},
|
|
980
|
+
}, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
987
981
|
__proto__: null,
|
|
988
|
-
embedder:
|
|
982
|
+
embedder: Gr,
|
|
989
983
|
language: It,
|
|
990
|
-
options:
|
|
991
|
-
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt } = I,
|
|
984
|
+
options: Kr
|
|
985
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt } = I, Jr = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
992
986
|
e = {
|
|
993
987
|
...e,
|
|
994
988
|
...s
|
|
995
989
|
};
|
|
996
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
990
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
997
991
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
998
992
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
999
993
|
a.length,
|
|
@@ -1004,7 +998,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
1004
998
|
// set filepath to undefined to enable jsx auto detection:
|
|
1005
999
|
// https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
|
|
1006
1000
|
filepath: void 0
|
|
1007
|
-
}), i =
|
|
1001
|
+
}), i = T(E, p, b);
|
|
1008
1002
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
1009
1003
|
return K([
|
|
1010
1004
|
"`",
|
|
@@ -1020,35 +1014,35 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
1020
1014
|
v,
|
|
1021
1015
|
"`"
|
|
1022
1016
|
]);
|
|
1023
|
-
}, oe = "embeddedTs",
|
|
1024
|
-
[
|
|
1017
|
+
}, oe = "embeddedTs", Xr = ["ts", "tsx", "cts", "mts", "typescript"], Yr = ["typescript", "babel-ts"], Qr = V(oe), Vr = S(oe), Zr = {
|
|
1018
|
+
[Vr]: {
|
|
1025
1019
|
category: "Embed",
|
|
1026
1020
|
type: "string",
|
|
1027
1021
|
array: !0,
|
|
1028
|
-
default: [{ value: [...
|
|
1022
|
+
default: [{ value: [...Xr] }],
|
|
1029
1023
|
description: "Specify embedded TS language parsers."
|
|
1030
1024
|
},
|
|
1031
|
-
[
|
|
1025
|
+
[Qr]: {
|
|
1032
1026
|
category: "Embed",
|
|
1033
1027
|
type: "choice",
|
|
1034
1028
|
default: "typescript",
|
|
1035
1029
|
description: 'Specify the embedded TS language parser. Default is "typescript".',
|
|
1036
|
-
choices:
|
|
1030
|
+
choices: Yr.map((t) => ({
|
|
1037
1031
|
value: t,
|
|
1038
1032
|
description: `Use "${t}".`
|
|
1039
1033
|
}))
|
|
1040
1034
|
}
|
|
1041
|
-
},
|
|
1035
|
+
}, eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1042
1036
|
__proto__: null,
|
|
1043
|
-
embedder:
|
|
1037
|
+
embedder: Jr,
|
|
1044
1038
|
language: oe,
|
|
1045
|
-
options:
|
|
1046
|
-
}, Symbol.toStringTag, { value: "Module" })), se = "embeddedXml", { line: ot, group: H, indent: st, softline: ee } = I,
|
|
1039
|
+
options: Zr
|
|
1040
|
+
}, Symbol.toStringTag, { value: "Module" })), se = "embeddedXml", { line: ot, group: H, indent: st, softline: ee } = I, to = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
1047
1041
|
M("@prettier/plugin-xml", e, o), e = {
|
|
1048
1042
|
...e,
|
|
1049
1043
|
...s
|
|
1050
1044
|
};
|
|
1051
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
1045
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
1052
1046
|
(g, f, { length: $ }) => f === $ - 1 ? g.value.cooked : g.value.cooked + d(f)
|
|
1053
1047
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
1054
1048
|
a.length,
|
|
@@ -1070,7 +1064,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
1070
1064
|
const [$, _] = e.__embeddedXmlFragmentRecoverIndex ?? [];
|
|
1071
1065
|
$ === void 0 ? i = void 0 : _ === void 0 ? i += $ : (f = g.slice($, _ + 1), i += _ + 1), E.push(f);
|
|
1072
1066
|
}
|
|
1073
|
-
const h =
|
|
1067
|
+
const h = T(E, p, b);
|
|
1074
1068
|
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
1075
1069
|
return H([
|
|
1076
1070
|
"`",
|
|
@@ -1086,12 +1080,12 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
1086
1080
|
m,
|
|
1087
1081
|
"`"
|
|
1088
1082
|
]);
|
|
1089
|
-
},
|
|
1090
|
-
[
|
|
1083
|
+
}, no = ["xml", "opml", "rss", "svg"], ro = S(se), oo = {
|
|
1084
|
+
[ro]: {
|
|
1091
1085
|
category: "Embed",
|
|
1092
1086
|
type: "string",
|
|
1093
1087
|
array: !0,
|
|
1094
|
-
default: [{ value: [...
|
|
1088
|
+
default: [{ value: [...no] }],
|
|
1095
1089
|
description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'
|
|
1096
1090
|
},
|
|
1097
1091
|
/**
|
|
@@ -1105,7 +1099,7 @@ const { hardline: Mr, group: q, line: Xe, softline: Ye, indent: Qe } = I, { mapD
|
|
|
1105
1099
|
description: "This option is read only and used as a workaround to support xml fragments"
|
|
1106
1100
|
}
|
|
1107
1101
|
};
|
|
1108
|
-
function
|
|
1102
|
+
function so(t) {
|
|
1109
1103
|
const n = {
|
|
1110
1104
|
loc: {
|
|
1111
1105
|
start: {
|
|
@@ -1145,12 +1139,12 @@ function it(t) {
|
|
|
1145
1139
|
);
|
|
1146
1140
|
return Object.assign(r, n), r;
|
|
1147
1141
|
}
|
|
1148
|
-
const
|
|
1142
|
+
const io = {
|
|
1149
1143
|
async parse(t, n) {
|
|
1150
1144
|
const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: o, cst: s } = r(t);
|
|
1151
1145
|
if (e.length > 0) {
|
|
1152
1146
|
const l = e[0];
|
|
1153
|
-
throw
|
|
1147
|
+
throw so(l);
|
|
1154
1148
|
}
|
|
1155
1149
|
if (o.length > 0) {
|
|
1156
1150
|
let l = !1;
|
|
@@ -1206,7 +1200,7 @@ function St(t) {
|
|
|
1206
1200
|
const e = n[r] ?? [];
|
|
1207
1201
|
for (let o = e.length - 1; o >= 0; --o) {
|
|
1208
1202
|
const s = e[o];
|
|
1209
|
-
if (
|
|
1203
|
+
if (co(s)) {
|
|
1210
1204
|
if (Object.keys(s.children).length === 0) {
|
|
1211
1205
|
e.splice(o, 1), e.length === 0 && delete n[r];
|
|
1212
1206
|
continue;
|
|
@@ -1216,21 +1210,21 @@ function St(t) {
|
|
|
1216
1210
|
}
|
|
1217
1211
|
}
|
|
1218
1212
|
}
|
|
1219
|
-
function
|
|
1213
|
+
function co(t) {
|
|
1220
1214
|
return "name" in t && "children" in t && "location" in t;
|
|
1221
1215
|
}
|
|
1222
|
-
const
|
|
1216
|
+
const ao = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1223
1217
|
__proto__: null,
|
|
1224
|
-
embedder:
|
|
1218
|
+
embedder: to,
|
|
1225
1219
|
language: se,
|
|
1226
|
-
options:
|
|
1227
|
-
parser:
|
|
1228
|
-
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: at, softline: dt } = I,
|
|
1220
|
+
options: oo,
|
|
1221
|
+
parser: io
|
|
1222
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: ct, group: J, indent: at, softline: dt } = I, lo = async (t, n, r, e, { identifier: o, embeddedOverrideOptions: s }) => {
|
|
1229
1223
|
e = {
|
|
1230
1224
|
...e,
|
|
1231
1225
|
...s
|
|
1232
1226
|
};
|
|
1233
|
-
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } =
|
|
1227
|
+
const { node: l } = r, { createPlaceholder: d, placeholderRegex: p } = L(), c = l.quasis.map(
|
|
1234
1228
|
(m, g, { length: f }) => g === f - 1 ? m.value.cooked : m.value.cooked + d(g)
|
|
1235
1229
|
).join(""), a = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
1236
1230
|
a.length,
|
|
@@ -1238,7 +1232,7 @@ const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1238
1232
|
), b = x(r, n), E = await t(y, {
|
|
1239
1233
|
...e,
|
|
1240
1234
|
parser: "yaml"
|
|
1241
|
-
}), i =
|
|
1235
|
+
}), i = T(E, p, b);
|
|
1242
1236
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(o))
|
|
1243
1237
|
return J([
|
|
1244
1238
|
"`",
|
|
@@ -1254,27 +1248,27 @@ const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1254
1248
|
v,
|
|
1255
1249
|
"`"
|
|
1256
1250
|
]);
|
|
1257
|
-
}, xt = "embeddedYaml",
|
|
1258
|
-
[
|
|
1251
|
+
}, xt = "embeddedYaml", uo = ["yaml", "yml"], go = S(xt), po = {
|
|
1252
|
+
[go]: {
|
|
1259
1253
|
category: "Embed",
|
|
1260
1254
|
type: "string",
|
|
1261
1255
|
array: !0,
|
|
1262
|
-
default: [{ value: [...
|
|
1256
|
+
default: [{ value: [...uo] }],
|
|
1263
1257
|
description: "Specify embedded YAML language identifiers."
|
|
1264
1258
|
}
|
|
1265
|
-
},
|
|
1259
|
+
}, mo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1266
1260
|
__proto__: null,
|
|
1267
|
-
embedder:
|
|
1261
|
+
embedder: lo,
|
|
1268
1262
|
language: xt,
|
|
1269
|
-
options:
|
|
1270
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1263
|
+
options: po
|
|
1264
|
+
}, Symbol.toStringTag, { value: "Module" })), Lt = [], Tt = {}, Ot = {}, Mt = {}, ho = /* @__PURE__ */ Object.assign({
|
|
1271
1265
|
"./css/index.ts": sn,
|
|
1272
1266
|
"./es/index.ts": pn,
|
|
1273
1267
|
"./glsl/index.ts": bn,
|
|
1274
1268
|
"./graphql/index.ts": Dn,
|
|
1275
1269
|
"./html/index.ts": On,
|
|
1276
1270
|
"./ini/index.ts": Pn,
|
|
1277
|
-
"./json/index.ts":
|
|
1271
|
+
"./json/index.ts": Wn,
|
|
1278
1272
|
"./latex/index.ts": Hn,
|
|
1279
1273
|
"./markdown/index.ts": Vn,
|
|
1280
1274
|
"./noop/index.ts": tr,
|
|
@@ -1282,53 +1276,53 @@ const io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1282
1276
|
"./properties/index.ts": ur,
|
|
1283
1277
|
"./ruby/index.ts": br,
|
|
1284
1278
|
"./sh/index.ts": Sr,
|
|
1285
|
-
"./sql/index.ts":
|
|
1286
|
-
"./toml/index.ts":
|
|
1287
|
-
"./ts/index.ts":
|
|
1288
|
-
"./xml/index.ts":
|
|
1289
|
-
"./yaml/index.ts":
|
|
1279
|
+
"./sql/index.ts": Ur,
|
|
1280
|
+
"./toml/index.ts": Hr,
|
|
1281
|
+
"./ts/index.ts": eo,
|
|
1282
|
+
"./xml/index.ts": ao,
|
|
1283
|
+
"./yaml/index.ts": mo
|
|
1290
1284
|
});
|
|
1291
|
-
Object.values(
|
|
1292
|
-
Zt(
|
|
1285
|
+
Object.values(ho).forEach(({ language: t, parser: n, embedder: r, options: e }) => {
|
|
1286
|
+
Zt(Lt, t, re), n && (Tt[t] = n), r && (Ot[t] = r), Object.assign(Mt, e);
|
|
1293
1287
|
});
|
|
1294
|
-
const
|
|
1288
|
+
const fo = "noEmbeddedIdentificationByComment", Eo = "noEmbeddedIdentificationByTag", bo = "preserveEmbeddedExteriorWhitespaces", yo = "noEmbeddedMultiLineIndentation", _o = "embeddedOverrides", Ho = {
|
|
1295
1289
|
...Mt,
|
|
1296
|
-
[
|
|
1290
|
+
[fo]: {
|
|
1297
1291
|
category: "Embed",
|
|
1298
1292
|
type: "string",
|
|
1299
1293
|
array: !0,
|
|
1300
1294
|
default: [{ value: [] }],
|
|
1301
1295
|
description: 'This option turns off "/* identifier */ `...`" comment-based language identification for the specified identifiers.'
|
|
1302
1296
|
},
|
|
1303
|
-
[
|
|
1297
|
+
[Eo]: {
|
|
1304
1298
|
category: "Embed",
|
|
1305
1299
|
type: "string",
|
|
1306
1300
|
array: !0,
|
|
1307
1301
|
default: [{ value: [] }],
|
|
1308
1302
|
description: 'This option turns off "identifier`...`" tag-based language identification for the specified identifiers.'
|
|
1309
1303
|
},
|
|
1310
|
-
[
|
|
1304
|
+
[bo]: {
|
|
1311
1305
|
category: "Config",
|
|
1312
1306
|
type: "string",
|
|
1313
1307
|
array: !0,
|
|
1314
1308
|
default: [{ value: [] }],
|
|
1315
1309
|
description: "This option preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
|
|
1316
1310
|
},
|
|
1317
|
-
[
|
|
1311
|
+
[yo]: {
|
|
1318
1312
|
category: "Embed",
|
|
1319
1313
|
type: "string",
|
|
1320
1314
|
array: !0,
|
|
1321
1315
|
default: [{ value: [] }],
|
|
1322
1316
|
description: "This option turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
|
|
1323
1317
|
},
|
|
1324
|
-
[
|
|
1318
|
+
[_o]: {
|
|
1325
1319
|
category: "Embed",
|
|
1326
1320
|
type: "string",
|
|
1327
1321
|
array: !1,
|
|
1328
1322
|
default: void 0,
|
|
1329
1323
|
description: "This option accepts option overrides for the specified identifiers. It should either be a stringified JSON or an absolute filepath to the option overrides file."
|
|
1330
1324
|
}
|
|
1331
|
-
},
|
|
1325
|
+
}, Jo = {
|
|
1332
1326
|
// parsers from internal
|
|
1333
1327
|
...Rt.parsers,
|
|
1334
1328
|
...jt.parsers,
|
|
@@ -1336,9 +1330,9 @@ const mo = "noEmbeddedIdentificationByComment", ho = "noEmbeddedIdentificationBy
|
|
|
1336
1330
|
...Bt.parsers,
|
|
1337
1331
|
...wt.parsers,
|
|
1338
1332
|
// parsers from this plugin
|
|
1339
|
-
...
|
|
1333
|
+
...Tt
|
|
1340
1334
|
};
|
|
1341
|
-
var
|
|
1335
|
+
var vo = {
|
|
1342
1336
|
isEqual: !0,
|
|
1343
1337
|
isMatchingKey: !0,
|
|
1344
1338
|
isPromise: !0,
|
|
@@ -1347,21 +1341,21 @@ var yo = {
|
|
|
1347
1341
|
onCacheChange: !0,
|
|
1348
1342
|
onCacheHit: !0,
|
|
1349
1343
|
transformKey: !0
|
|
1350
|
-
},
|
|
1344
|
+
}, $o = Array.prototype.slice;
|
|
1351
1345
|
function Q(t) {
|
|
1352
1346
|
var n = t.length;
|
|
1353
|
-
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] :
|
|
1347
|
+
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : $o.call(t, 0) : [];
|
|
1354
1348
|
}
|
|
1355
|
-
function
|
|
1349
|
+
function Do(t) {
|
|
1356
1350
|
var n = {};
|
|
1357
1351
|
for (var r in t)
|
|
1358
|
-
|
|
1352
|
+
vo[r] || (n[r] = t[r]);
|
|
1359
1353
|
return n;
|
|
1360
1354
|
}
|
|
1361
|
-
function
|
|
1355
|
+
function Io(t) {
|
|
1362
1356
|
return typeof t == "function" && t.isMemoized;
|
|
1363
1357
|
}
|
|
1364
|
-
function
|
|
1358
|
+
function So(t, n) {
|
|
1365
1359
|
return t === n || t !== t && n !== n;
|
|
1366
1360
|
}
|
|
1367
1361
|
function lt(t, n) {
|
|
@@ -1372,7 +1366,7 @@ function lt(t, n) {
|
|
|
1372
1366
|
r[e] = n[e];
|
|
1373
1367
|
return r;
|
|
1374
1368
|
}
|
|
1375
|
-
var
|
|
1369
|
+
var xo = (
|
|
1376
1370
|
/** @class */
|
|
1377
1371
|
function() {
|
|
1378
1372
|
function t(n) {
|
|
@@ -1469,11 +1463,11 @@ var Io = (
|
|
|
1469
1463
|
}()
|
|
1470
1464
|
);
|
|
1471
1465
|
function kt(t, n) {
|
|
1472
|
-
if (n === void 0 && (n = {}),
|
|
1466
|
+
if (n === void 0 && (n = {}), Io(t))
|
|
1473
1467
|
return kt(t.fn, lt(t.options, n));
|
|
1474
1468
|
if (typeof t != "function")
|
|
1475
1469
|
throw new TypeError("You must pass a function to `memoize`.");
|
|
1476
|
-
var r = n.isEqual, e = r === void 0 ?
|
|
1470
|
+
var r = n.isEqual, e = r === void 0 ? So : r, o = n.isMatchingKey, s = n.isPromise, l = s === void 0 ? !1 : s, d = n.maxSize, p = d === void 0 ? 1 : d, c = n.onCacheAdd, a = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, b = lt({
|
|
1477
1471
|
isEqual: e,
|
|
1478
1472
|
isMatchingKey: o,
|
|
1479
1473
|
isPromise: l,
|
|
@@ -1482,7 +1476,7 @@ function kt(t, n) {
|
|
|
1482
1476
|
onCacheChange: a,
|
|
1483
1477
|
onCacheHit: u,
|
|
1484
1478
|
transformKey: y
|
|
1485
|
-
},
|
|
1479
|
+
}, Do(n)), E = new xo(b), i = E.keys, h = E.values, v = E.canTransformKey, m = E.shouldCloneArguments, g = E.shouldUpdateOnAdd, f = E.shouldUpdateOnChange, $ = E.shouldUpdateOnHit, _ = function() {
|
|
1486
1480
|
var D = m ? Q(arguments) : arguments;
|
|
1487
1481
|
v && (D = y(D));
|
|
1488
1482
|
var O = i.length ? E.getKeyIndex(D) : -1;
|
|
@@ -1498,17 +1492,17 @@ function kt(t, n) {
|
|
|
1498
1492
|
}
|
|
1499
1493
|
async function ut(t) {
|
|
1500
1494
|
try {
|
|
1501
|
-
const n = await
|
|
1495
|
+
const n = await Ct(t, { encoding: "utf-8" });
|
|
1502
1496
|
return JSON.parse(n);
|
|
1503
1497
|
} catch {
|
|
1504
1498
|
}
|
|
1505
1499
|
}
|
|
1506
|
-
const
|
|
1500
|
+
const Lo = /* @__PURE__ */ new URL(
|
|
1507
1501
|
"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);')
|
|
1508
1502
|
);
|
|
1509
|
-
async function
|
|
1503
|
+
async function To(t) {
|
|
1510
1504
|
return new Promise((n) => {
|
|
1511
|
-
const r = new Kt(
|
|
1505
|
+
const r = new Kt(Lo, {
|
|
1512
1506
|
workerData: {
|
|
1513
1507
|
absolutePath: t
|
|
1514
1508
|
}
|
|
@@ -1520,21 +1514,21 @@ async function xo(t) {
|
|
|
1520
1514
|
});
|
|
1521
1515
|
});
|
|
1522
1516
|
}
|
|
1523
|
-
async function
|
|
1517
|
+
async function Oo(t) {
|
|
1524
1518
|
console.error(
|
|
1525
1519
|
"Ts module type embeddedOverrides has not been implemented yet."
|
|
1526
1520
|
);
|
|
1527
1521
|
}
|
|
1528
|
-
const
|
|
1522
|
+
const Mo = kt(
|
|
1529
1523
|
async (t, n) => {
|
|
1530
|
-
if (
|
|
1524
|
+
if (Wt(t))
|
|
1531
1525
|
return t;
|
|
1532
1526
|
const r = await Ht(n);
|
|
1533
1527
|
let e;
|
|
1534
1528
|
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = Gt(r), qt(e, t);
|
|
1535
1529
|
}
|
|
1536
|
-
),
|
|
1537
|
-
const r =
|
|
1530
|
+
), ko = async (t, n) => {
|
|
1531
|
+
const r = Mo(
|
|
1538
1532
|
t,
|
|
1539
1533
|
n
|
|
1540
1534
|
), e = zt(t);
|
|
@@ -1545,13 +1539,13 @@ const Lo = kt(
|
|
|
1545
1539
|
console.error(`Failed to parse the json file: ${o}`);
|
|
1546
1540
|
return;
|
|
1547
1541
|
} else if (e === ".mjs" || e === ".cjs" || e === ".js") {
|
|
1548
|
-
const o = await r, s = await
|
|
1542
|
+
const o = await r, s = await To(o);
|
|
1549
1543
|
if (s !== void 0)
|
|
1550
1544
|
return s;
|
|
1551
1545
|
console.error(`Failed to parse the js module file: ${o}`);
|
|
1552
1546
|
return;
|
|
1553
1547
|
} else if (e === ".mts" || e === ".cts" || e === ".ts") {
|
|
1554
|
-
const o = await r, s = await
|
|
1548
|
+
const o = await r, s = await Oo();
|
|
1555
1549
|
if (s !== void 0)
|
|
1556
1550
|
return s;
|
|
1557
1551
|
console.error(`Failed to parse the ts module file: ${o}`);
|
|
@@ -1566,10 +1560,10 @@ const Lo = kt(
|
|
|
1566
1560
|
} catch {
|
|
1567
1561
|
console.error("Failed to parse embeddedOverrides as a json object");
|
|
1568
1562
|
}
|
|
1569
|
-
},
|
|
1563
|
+
}, No = async (t, n, r) => {
|
|
1570
1564
|
if (t === void 0)
|
|
1571
1565
|
return;
|
|
1572
|
-
const e = await
|
|
1566
|
+
const e = await ko(
|
|
1573
1567
|
t,
|
|
1574
1568
|
r
|
|
1575
1569
|
);
|
|
@@ -1582,7 +1576,7 @@ const Lo = kt(
|
|
|
1582
1576
|
console.error("Error parsing embedded override options.");
|
|
1583
1577
|
}
|
|
1584
1578
|
};
|
|
1585
|
-
function
|
|
1579
|
+
function Ao({ node: t, parent: n }, r, e) {
|
|
1586
1580
|
if (r.length === 0 || t.type !== "TemplateLiteral")
|
|
1587
1581
|
return;
|
|
1588
1582
|
const o = t.comments ?? n?.comments;
|
|
@@ -1602,26 +1596,26 @@ function ko({ node: t, parent: n }, r, e) {
|
|
|
1602
1596
|
return l;
|
|
1603
1597
|
}
|
|
1604
1598
|
}
|
|
1605
|
-
function
|
|
1599
|
+
function Po({ node: t, parent: n }, r, e) {
|
|
1606
1600
|
if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
|
|
1607
1601
|
for (const o of r)
|
|
1608
1602
|
if (n.tag.name === o && !e.includes(o))
|
|
1609
1603
|
return o;
|
|
1610
1604
|
}
|
|
1611
1605
|
}
|
|
1612
|
-
const { estree: Nt } = Ut,
|
|
1606
|
+
const { estree: Nt } = Ut, Ro = function(t, n) {
|
|
1613
1607
|
const { node: r } = t;
|
|
1614
1608
|
if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
|
|
1615
1609
|
return null;
|
|
1616
|
-
for (const e of
|
|
1610
|
+
for (const e of Lt) {
|
|
1617
1611
|
const o = n[S(e)];
|
|
1618
1612
|
if (!o)
|
|
1619
1613
|
continue;
|
|
1620
|
-
const s =
|
|
1614
|
+
const s = Ao(
|
|
1621
1615
|
t,
|
|
1622
1616
|
o,
|
|
1623
1617
|
n.noEmbeddedIdentificationByComment ?? []
|
|
1624
|
-
) ??
|
|
1618
|
+
) ?? Po(
|
|
1625
1619
|
t,
|
|
1626
1620
|
o,
|
|
1627
1621
|
n.noEmbeddedIdentificationByTag ?? []
|
|
@@ -1633,7 +1627,7 @@ const { estree: Nt } = Ut, Ao = function(t, n) {
|
|
|
1633
1627
|
return null;
|
|
1634
1628
|
const d = t.node;
|
|
1635
1629
|
return d.quasis.length === 1 && d.quasis[0].value.raw.trim() === "" ? "``" : async (p, c, a, u) => {
|
|
1636
|
-
const y = await
|
|
1630
|
+
const y = await No(
|
|
1637
1631
|
u.embeddedOverrides,
|
|
1638
1632
|
s,
|
|
1639
1633
|
u.filepath
|
|
@@ -1654,19 +1648,19 @@ const { estree: Nt } = Ut, Ao = function(t, n) {
|
|
|
1654
1648
|
};
|
|
1655
1649
|
}
|
|
1656
1650
|
return Nt.embed?.(t, n) ?? null;
|
|
1657
|
-
},
|
|
1651
|
+
}, Xo = {
|
|
1658
1652
|
estree: {
|
|
1659
1653
|
...Nt,
|
|
1660
|
-
embed:
|
|
1654
|
+
embed: Ro
|
|
1661
1655
|
}
|
|
1662
1656
|
};
|
|
1663
1657
|
export {
|
|
1664
1658
|
Ot as embeddedEmbedders,
|
|
1665
|
-
|
|
1659
|
+
Lt as embeddedLanguages,
|
|
1666
1660
|
Mt as embeddedOptions,
|
|
1667
|
-
|
|
1661
|
+
Tt as embeddedParsers,
|
|
1668
1662
|
S as makeIdentifiersOptionName,
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1663
|
+
Ho as options,
|
|
1664
|
+
Jo as parsers,
|
|
1665
|
+
Xo as printers
|
|
1672
1666
|
};
|
package/dist/options.d.ts
CHANGED
|
@@ -219,26 +219,20 @@ export declare const options: {
|
|
|
219
219
|
type: "choice";
|
|
220
220
|
default: "prettier-plugin-sql";
|
|
221
221
|
description: string;
|
|
222
|
-
choices:
|
|
223
|
-
value: "prettier-plugin-sql";
|
|
224
|
-
description: string;
|
|
225
|
-
} | {
|
|
226
|
-
value: "prettier-plugin-sql-cst";
|
|
222
|
+
choices: {
|
|
223
|
+
value: "prettier-plugin-sql" | "prettier-plugin-sql-cst";
|
|
227
224
|
description: string;
|
|
228
|
-
}
|
|
225
|
+
}[];
|
|
229
226
|
};
|
|
230
227
|
readonly embeddedSqlParser: {
|
|
231
228
|
category: string;
|
|
232
229
|
type: "choice";
|
|
233
230
|
default: "sqlite";
|
|
234
231
|
description: string;
|
|
235
|
-
choices:
|
|
236
|
-
value: "sqlite";
|
|
237
|
-
description: string;
|
|
238
|
-
} | {
|
|
239
|
-
value: "bigquery";
|
|
232
|
+
choices: {
|
|
233
|
+
value: "sqlite" | "bigquery" | "mysql" | "mariadb" | "postgresql";
|
|
240
234
|
description: string;
|
|
241
|
-
}
|
|
235
|
+
}[];
|
|
242
236
|
};
|
|
243
237
|
readonly embeddedTomlIdentifiers: {
|
|
244
238
|
readonly category: "Embed";
|