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