prettier-plugin-embed 0.5.0 → 0.6.0

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/index.js CHANGED
@@ -1,2491 +1,1772 @@
1
- import { builders as M, utils as si } from "prettier/doc";
2
- import fi from "prettier/parser-babel";
3
- import yi from "prettier/parser-espree";
4
- import _i from "prettier/parser-flow";
5
- import $i from "prettier/parser-meriyah";
6
- import vi from "prettier/parser-typescript";
7
- import { printers as Di } from "prettier/plugins/estree.mjs";
8
- import { resolveConfigFile as Ti } from "prettier";
9
- const { group: Mi, indent: Ai, softline: Be, hardline: Si, lineSuffixBoundary: ki } = M, { mapDoc: Li } = si;
10
- function Gi(e, t) {
11
- const { node: n } = e;
12
- let r = t();
13
- return n?.comments?.length && (r = Mi([Ai([Be, r]), Be])), ["${", r, ki, "}"];
1
+ import { builders as e, utils as t } from "prettier/doc";
2
+ import { createRequire as n } from "node:module";
3
+ import r from "node:path";
4
+ import { pathToFileURL as i } from "node:url";
5
+ import a from "prettier/parser-babel";
6
+ import o from "prettier/parser-espree";
7
+ import s from "prettier/parser-flow";
8
+ import c from "prettier/parser-meriyah";
9
+ import l from "prettier/parser-typescript";
10
+ import { printers as u } from "prettier/plugins/estree.mjs";
11
+ import { resolveConfigFile as d } from "prettier";
12
+ //#region \0rolldown/runtime.js
13
+ var f = Object.defineProperty, p = (e, t) => {
14
+ let n = {};
15
+ for (var r in e) f(n, r, {
16
+ get: e[r],
17
+ enumerable: !0
18
+ });
19
+ return t || f(n, Symbol.toStringTag, { value: "Module" }), n;
20
+ }, { group: m, indent: h, line: ee, softline: g, lineSuffixBoundary: te, addAlignmentToDoc: ne, align: re, hardline: ie } = e, { mapDoc: ae, replaceEndOfLine: oe } = t;
21
+ function _(e, t) {
22
+ let n = e.quasis.map((e, n, { length: r }) => n === r - 1 ? e.value.cooked : e.value.cooked + t(n)).join(""), r = n.match(/^\s+/)?.[0] ?? "", i = n.match(/\s+$/)?.[0] ?? "";
23
+ return {
24
+ trimmedText: n.slice(r.length, -i.length || void 0),
25
+ leadingWhitespaces: r,
26
+ trailingWhitespaces: i
27
+ };
14
28
  }
15
- function k(e, t) {
16
- return e.map(
17
- (n) => Gi(n, t),
18
- "expressions"
19
- );
29
+ function v(e, t, n, r, i, a = !1) {
30
+ let o = a || t.preserveEmbeddedExteriorWhitespaces?.includes(n), s = t.noEmbeddedMultiLineIndentation?.includes(n), c = m(e);
31
+ if (o) return m([
32
+ "`",
33
+ r,
34
+ s ? c : h([c]),
35
+ i,
36
+ "`"
37
+ ]);
38
+ let l = r.length ? ee : g, u = i.length ? ee : g;
39
+ return m([
40
+ "`",
41
+ s ? [l, c] : h([l, c]),
42
+ u,
43
+ "`"
44
+ ]);
20
45
  }
21
- function S(e, t, n, r = !1) {
22
- return Li(e, (o) => {
23
- if (typeof o != "string")
24
- return o;
25
- const i = [], l = o.split(t);
26
- for (let u = 0; u < l.length; u++) {
27
- let E = l[u];
28
- if (u % 2 === 0) {
29
- if (!E)
30
- continue;
31
- if (E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), r)
32
- for (const d of E.split(/(\n)/))
33
- d === `
34
- ` ? i.push(Si) : i.push(d);
35
- else
36
- i.push(E);
37
- } else {
38
- const d = Number(E);
39
- i.push(n[d]);
40
- }
41
- }
42
- return i;
43
- });
46
+ function se(e, t) {
47
+ let n = 0;
48
+ for (let r of e) r === " " ? n = n + t - n % t : n++;
49
+ return n;
44
50
  }
45
- function Ni(e, t, n) {
46
- if (t === n) {
47
- e.unshift(t);
48
- return;
49
- }
50
- let r = 0, s = e.length;
51
- for (; r < s; ) {
52
- const o = r + s >>> 1;
53
- if (e[o] === n) {
54
- e.push(t);
55
- return;
56
- }
57
- e[o] < t ? r = o + 1 : s = o;
58
- }
59
- e.splice(r, 0, t);
51
+ function ce(e, t) {
52
+ let n = e.lastIndexOf("\n"), r = e.slice(n + 1), i = /^[\t ]*/.exec(r)[0];
53
+ return se(i, t);
60
54
  }
61
- const he = (() => {
62
- const e = [...Array(26).keys()].map((t) => String.fromCharCode(t + 97)).concat([...Array(10).keys()].map((t) => `${t}`));
63
- return () => {
64
- let n = "";
65
- for (let r = 0; r < 16; ++r)
66
- n += e[Number.parseInt((Math.random() * e.length).toFixed(0), 10) % e.length];
67
- return n;
68
- };
55
+ function le(e, t, n) {
56
+ let r = t, i = e.quasis[r].value.raw;
57
+ if (i.includes("\n")) return {
58
+ indentSize: ce(i, n),
59
+ previousQuasiText: i
60
+ };
61
+ for (; r-- > 0;) {
62
+ let t = e.quasis[r].value.raw;
63
+ if (t.includes("\n")) return {
64
+ indentSize: ce(t, n),
65
+ previousQuasiText: i
66
+ };
67
+ }
68
+ return {
69
+ indentSize: 0,
70
+ previousQuasiText: i
71
+ };
72
+ }
73
+ function ue(e, t, n, r, i, a = !0) {
74
+ let { node: o } = e, s = t();
75
+ if (o?.comments?.length && (s = m([h([g, s]), g])), !a) return m([
76
+ "${",
77
+ s,
78
+ te,
79
+ "}"
80
+ ]);
81
+ let { indentSize: c, previousQuasiText: l } = le(n, r, i), u = s;
82
+ return u = c === 0 && l.endsWith("\n") ? re(-Infinity, u) : ne(u, c, i), m([
83
+ "${",
84
+ u,
85
+ te,
86
+ "}"
87
+ ]);
88
+ }
89
+ function y(e, t, n, r = !0) {
90
+ let i = n?.tabWidth ?? 2, a = e.node;
91
+ return e.map((e, n) => ue(e, t, a, n, i, r), "expressions");
92
+ }
93
+ function b(e, t, n, r = !1, i, a) {
94
+ return ae(e, (e) => {
95
+ if (typeof e != "string") return e;
96
+ let o = [], s = e.split(t), c = "";
97
+ for (let e = 0; e < s.length; e++) {
98
+ let t = s[e];
99
+ if (e % 2 == 0) {
100
+ if (e === 0 || t.includes("\n")) {
101
+ let e = t.slice(t.lastIndexOf("\n") + 1);
102
+ c = /^[\t ]*/.exec(e)[0];
103
+ }
104
+ if (!t) continue;
105
+ if (t = t.replaceAll(/([\\`]|\${)/g, "\\$1"), r === "literalline") o.push(oe(t));
106
+ else if (r === "hardline") for (let e of t.split(/(\n)/)) e === "\n" ? o.push(ie) : o.push(e);
107
+ else o.push(t);
108
+ } else {
109
+ let r = Number(t), l = s[e - 1];
110
+ if (i?.has(r) && !/\n[\t ]*$/.test(l)) {
111
+ let e = o.at(-1);
112
+ typeof e == "string" && (o[o.length - 1] = e.replace(/[\t ]+$/, "")), o.push(ie), a !== void 0 && o.push(c);
113
+ }
114
+ let u = n[r];
115
+ o.push(a === void 0 ? u : re(se(c, a), u));
116
+ }
117
+ }
118
+ return o;
119
+ });
120
+ }
121
+ function de(e, t, n) {
122
+ if (t === n) {
123
+ e.unshift(t);
124
+ return;
125
+ }
126
+ let r = 0, i = e.length;
127
+ for (; r < i;) {
128
+ let a = r + i >>> 1;
129
+ if (e[a] === n) {
130
+ e.push(t);
131
+ return;
132
+ }
133
+ e[a] < t ? r = a + 1 : i = a;
134
+ }
135
+ e.splice(r, 0, t);
136
+ }
137
+ var x = (() => {
138
+ let e = [...Array(26).keys()].map((e) => String.fromCharCode(e + 97)).concat([...Array(10).keys()].map((e) => `${e}`));
139
+ return () => {
140
+ let t = "";
141
+ for (let n = 0; n < 16; ++n) t += e[Number.parseInt((Math.random() * e.length).toFixed(0), 10) % e.length];
142
+ return t;
143
+ };
69
144
  })();
70
- function L(e = "p", t = "") {
71
- const n = he(), r = he(), s = qe(e), o = qe(t), i = (u) => `${e}${n}${u}${r}${t}`, l = new RegExp(
72
- `${s}${n}(\\d+)${r}${o}`,
73
- "ig"
74
- );
75
- return {
76
- createPlaceholder: i,
77
- placeholderRegex: l
78
- };
145
+ function S(e = "p", t = "") {
146
+ let n = x(), r = x(), i = fe(e), a = fe(t);
147
+ return {
148
+ createPlaceholder: (i) => `${e}${n}${i}${r}${t}`,
149
+ placeholderRegex: RegExp(`${i}${n}(\\d+)${r}${a}`, "ig")
150
+ };
79
151
  }
80
- function qe(e) {
81
- return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
152
+ function fe(e) {
153
+ return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
82
154
  }
83
- function D(e) {
84
- return `${e}Identifiers`;
155
+ function C(e) {
156
+ return `${e}Identifiers`;
85
157
  }
86
- function A(e) {
87
- return `${e}Comments`;
158
+ function w(e) {
159
+ return `${e}Comments`;
88
160
  }
89
161
  function T(e) {
90
- return `${e}Tags`;
162
+ return `${e}Tags`;
91
163
  }
92
- function Oi(e) {
93
- return `${e}Plugin`;
164
+ function pe(e) {
165
+ return `${e}Plugin`;
94
166
  }
95
- function O(e) {
96
- return `${e}Parser`;
167
+ function E(e) {
168
+ return `${e}Parser`;
97
169
  }
98
- const _ = "9ff2b366e8ca4c97b9aed1a29b5b94ed", { line: je, group: I, indent: Ue, softline: Re } = M, xi = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
99
- const i = {
100
- ...r,
101
- ...o
102
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(
103
- "@prettier-placeholder"
104
- ), d = l.quasis.map(
105
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
106
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
107
- c.length,
108
- -p.length || void 0
109
- ), b = k(n, t), $ = await e(f, {
110
- ...i,
111
- parser: i.embeddedCssParser ?? "scss"
112
- }), a = S(
113
- $,
114
- E,
115
- b,
116
- // https://github.com/prettier/prettier/blob/3bfabd012873e5022f341aca75566966d91870f1/src/language-js/embed/css.js#L52
117
- !0
118
- );
119
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
120
- return I([
121
- "`",
122
- c,
123
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [I(a)] : Ue([I(a)]),
124
- p,
125
- "`"
126
- ]);
127
- const h = c.length ? je : Re, v = p.length ? je : Re;
128
- return I([
129
- "`",
130
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, I(a)] : Ue([h, I(a)]),
131
- v,
132
- "`"
133
- ]);
134
- }, re = "embeddedCss", Ii = ["css"], Pi = ["css", "less", "scss"], Bi = D(re), Ce = A(re), we = T(re), qi = O(re), ji = {
135
- [Bi]: {
136
- category: "Embed",
137
- type: "string",
138
- array: !0,
139
- default: [{ value: [...Ii] }],
140
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.",
141
- deprecated: `Please use \`${Ce}\` or \`${we}\`.`
142
- },
143
- [Ce]: {
144
- category: "Embed",
145
- type: "string",
146
- array: !0,
147
- default: [{ value: [_] }],
148
- description: "Block comments that make their subsequent template literals be identified as embedded CSS language."
149
- },
150
- [we]: {
151
- category: "Embed",
152
- type: "string",
153
- array: !0,
154
- default: [{ value: [_] }],
155
- description: "Tags that make their subsequent template literals be identified as embedded CSS language."
156
- },
157
- [qi]: {
158
- category: "Embed",
159
- type: "choice",
160
- default: "scss",
161
- description: "The parser used to parse the embedded CSS language.",
162
- choices: Pi.map((e) => ({
163
- value: e,
164
- description: `Use the "${e}" parser.`
165
- }))
166
- }
167
- }, Ui = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
168
- __proto__: null,
169
- embedder: xi,
170
- language: re,
171
- options: ji
172
- }, Symbol.toStringTag, { value: "Module" })), { line: Fe, group: P, indent: We, softline: ze } = M, Ri = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
173
- const i = {
174
- ...r,
175
- ...o
176
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
177
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
178
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
179
- c.length,
180
- -p.length || void 0
181
- ), b = k(n, t), $ = await e(f, {
182
- ...i,
183
- parser: i.embeddedEsParser ?? "babel"
184
- }), a = S($, E, b);
185
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
186
- return P([
187
- "`",
188
- c,
189
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [P(a)] : We([P(a)]),
190
- p,
191
- "`"
192
- ]);
193
- const h = c.length ? Fe : ze, v = p.length ? Fe : ze;
194
- return P([
195
- "`",
196
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, P(a)] : We([h, P(a)]),
197
- v,
198
- "`"
199
- ]);
200
- }, oe = "embeddedEs", Ci = [
201
- "js",
202
- "jsx",
203
- "es",
204
- "es6",
205
- "mjs",
206
- "cjs",
207
- "pac",
208
- "javascript"
209
- ], wi = [
210
- "babel",
211
- "babel-flow",
212
- "acorn",
213
- "espree",
214
- "flow",
215
- "meriyah"
216
- ], Fi = D(oe), Ke = A(oe), Je = T(oe), Wi = O(oe), zi = {
217
- [Fi]: {
218
- category: "Embed",
219
- type: "string",
220
- array: !0,
221
- default: [{ value: [...Ci] }],
222
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.",
223
- deprecated: `Please use \`${Ke}\` or \`${Je}\`.`
224
- },
225
- [Ke]: {
226
- category: "Embed",
227
- type: "string",
228
- array: !0,
229
- default: [{ value: [_] }],
230
- description: "Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
231
- },
232
- [Je]: {
233
- category: "Embed",
234
- type: "string",
235
- array: !0,
236
- default: [{ value: [_] }],
237
- description: "Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
238
- },
239
- [Wi]: {
240
- category: "Embed",
241
- type: "choice",
242
- default: "babel",
243
- description: "The parser used to parse the embedded ECMASCript/JavaScript language.",
244
- choices: wi.map((e) => ({
245
- value: e,
246
- description: `Use the "${e}" parser.`
247
- }))
248
- }
249
- }, Ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
250
- __proto__: null,
251
- embedder: Ri,
252
- language: oe,
253
- options: zi
254
- }, Symbol.toStringTag, { value: "Module" })), { line: He, group: B, indent: Xe, softline: Qe } = M, Ji = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
255
- const i = {
256
- ...r,
257
- ...o
258
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
259
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
260
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
261
- c.length,
262
- -p.length || void 0
263
- ), b = k(n, t), $ = await e(f, {
264
- ...i,
265
- parser: "glsl-parser"
266
- }), a = S($, E, b);
267
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
268
- return B([
269
- "`",
270
- c,
271
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [B(a)] : Xe([B(a)]),
272
- p,
273
- "`"
274
- ]);
275
- const h = c.length ? He : Qe, v = p.length ? He : Qe;
276
- return B([
277
- "`",
278
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, B(a)] : Xe([h, B(a)]),
279
- v,
280
- "`"
281
- ]);
282
- }, be = "embeddedGlsl", Hi = ["glsl", "shader"], Xi = D(be), Ye = A(be), Ve = T(be), Qi = {
283
- [Xi]: {
284
- category: "Embed",
285
- type: "string",
286
- array: !0,
287
- default: [{ value: [...Hi] }],
288
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.",
289
- deprecated: `Please use \`${Ye}\` or \`${Ve}\`.`
290
- },
291
- [Ye]: {
292
- category: "Embed",
293
- type: "string",
294
- array: !0,
295
- default: [{ value: [_] }],
296
- description: "Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
297
- },
298
- [Ve]: {
299
- category: "Embed",
300
- type: "string",
301
- array: !0,
302
- default: [{ value: [_] }],
303
- description: "Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
304
- }
305
- }, Yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
306
- __proto__: null,
307
- embedder: Ji,
308
- language: be,
309
- options: Qi
310
- }, Symbol.toStringTag, { value: "Module" })), { line: Ze, group: q, indent: et, softline: tt } = M, Vi = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
311
- const i = {
312
- ...r,
313
- ...o
314
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
315
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
316
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
317
- c.length,
318
- -p.length || void 0
319
- ), b = k(n, t), $ = await e(f, {
320
- ...i,
321
- parser: "graphql"
322
- }), a = S($, E, b);
323
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
324
- return q([
325
- "`",
326
- c,
327
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [q(a)] : et([q(a)]),
328
- p,
329
- "`"
330
- ]);
331
- const h = c.length ? Ze : tt, v = p.length ? Ze : tt;
332
- return q([
333
- "`",
334
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, q(a)] : et([h, q(a)]),
335
- v,
336
- "`"
337
- ]);
338
- }, fe = "embeddedGraphql", Zi = ["graphql", "gql"], es = D(fe), nt = A(fe), it = T(fe), ts = {
339
- [es]: {
340
- category: "Embed",
341
- type: "string",
342
- array: !0,
343
- default: [{ value: [...Zi] }],
344
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language.",
345
- deprecated: `Please use \`${nt}\` or \`${it}\`.`
346
- },
347
- [nt]: {
348
- category: "Embed",
349
- type: "string",
350
- array: !0,
351
- default: [{ value: [_] }],
352
- description: "Block comments that make their subsequent template literals be identified as embedded GraphQL language."
353
- },
354
- [it]: {
355
- category: "Embed",
356
- type: "string",
357
- array: !0,
358
- default: [{ value: [_] }],
359
- description: "Tags that make their subsequent template literals be identified as embedded GraphQL language."
360
- }
361
- }, ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
362
- __proto__: null,
363
- embedder: Vi,
364
- language: fe,
365
- options: ts
366
- }, Symbol.toStringTag, { value: "Module" })), { line: st, group: j, indent: rt, softline: ot } = M, { mapDoc: is } = si, ss = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
367
- const i = {
368
- ...r,
369
- ...o
370
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
371
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
372
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
373
- c.length,
374
- -p.length || void 0
375
- ), b = k(n, t), $ = await e(f, {
376
- ...i,
377
- parser: i.embeddedHtmlParser ?? "html"
378
- }), a = is($, (m) => {
379
- if (typeof m != "string")
380
- return m;
381
- const g = [], y = m.split(E);
382
- for (let G = 0; G < y.length; G++) {
383
- let N = y[G];
384
- if (G % 2 === 0) {
385
- if (!N)
386
- continue;
387
- N = N.replaceAll(/([\\`]|\${)/g, "\\$1"), i.__embeddedInHtml && (N = N.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(N);
388
- } else {
389
- const x = Number(N);
390
- g.push(b[x]);
391
- }
392
- }
393
- return g;
394
- });
395
- if (i.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
396
- i.htmlWhitespaceSensitivity === "css" || i.preserveEmbeddedExteriorWhitespaces?.includes(s))
397
- return j([
398
- "`",
399
- c,
400
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [j(a)] : rt([j(a)]),
401
- p,
402
- "`"
403
- ]);
404
- const h = c.length ? st : ot, v = p.length ? st : ot;
405
- return j([
406
- "`",
407
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, j(a)] : rt([h, j(a)]),
408
- v,
409
- "`"
410
- ]);
411
- }, ae = "embeddedHtml", rs = ["html", "xhtml"], os = ["html", "vue", "angular", "lwc"], as = D(ae), at = A(ae), dt = T(ae), ds = O(ae), ls = {
412
- [as]: {
413
- category: "Embed",
414
- type: "string",
415
- array: !0,
416
- default: [{ value: [...rs] }],
417
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language.",
418
- deprecated: `Please use \`${at}\` or \`${dt}\`.`
419
- },
420
- [at]: {
421
- category: "Embed",
422
- type: "string",
423
- array: !0,
424
- default: [{ value: [_] }],
425
- description: "Block comments that make their subsequent template literals be identified as embedded HTML language."
426
- },
427
- [dt]: {
428
- category: "Embed",
429
- type: "string",
430
- array: !0,
431
- default: [{ value: [_] }],
432
- description: "Tags that make their subsequent template literals be identified as embedded HTML language."
433
- },
434
- [ds]: {
435
- category: "Embed",
436
- type: "choice",
437
- default: "html",
438
- description: "The parser used to parse the embedded HTML language.",
439
- choices: os.map((e) => ({
440
- value: e,
441
- description: `Use the "${e}" parser.`
442
- }))
443
- }
444
- }, cs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
445
- __proto__: null,
446
- embedder: ss,
447
- language: ae,
448
- options: ls
449
- }, Symbol.toStringTag, { value: "Module" })), { line: lt, group: U, indent: ct, softline: ut } = M, us = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
450
- const i = {
451
- ...r,
452
- ...o
453
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
454
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
455
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
456
- c.length,
457
- -p.length || void 0
458
- ), b = k(n, t), $ = await e(f, {
459
- ...i,
460
- parser: "ini"
461
- }), a = S($, E, b);
462
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
463
- return U([
464
- "`",
465
- c,
466
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [U(a)] : ct([U(a)]),
467
- p,
468
- "`"
469
- ]);
470
- const h = c.length ? lt : ut, v = p.length ? lt : ut;
471
- return U([
472
- "`",
473
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, U(a)] : ct([h, U(a)]),
474
- v,
475
- "`"
476
- ]);
477
- }, ye = "embeddedIni", ps = ["ini", "cfg", "pro"], gs = D(ye), pt = A(ye), gt = T(ye), ms = {
478
- [gs]: {
479
- category: "Embed",
480
- type: "string",
481
- array: !0,
482
- default: [{ value: [...ps] }],
483
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.",
484
- deprecated: `Please use \`${pt}\` or \`${gt}\`.`
485
- },
486
- [pt]: {
487
- category: "Embed",
488
- type: "string",
489
- array: !0,
490
- default: [{ value: [_] }],
491
- description: "Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
492
- },
493
- [gt]: {
494
- category: "Embed",
495
- type: "string",
496
- array: !0,
497
- default: [{ value: [_] }],
498
- description: "Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
499
- }
500
- }, hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
501
- __proto__: null,
502
- embedder: us,
503
- language: ye,
504
- options: ms
505
- }, Symbol.toStringTag, { value: "Module" })), { group: R, line: mt, softline: ht, indent: Et } = M, Es = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
506
- const i = {
507
- ...r,
508
- ...o
509
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
510
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
511
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
512
- c.length,
513
- -p.length || void 0
514
- ), b = k(n, t), $ = await e(f, {
515
- ...i,
516
- parser: "java"
517
- }), a = S(
518
- $,
519
- E,
520
- b,
521
- !0
522
- );
523
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
524
- return R([
525
- "`",
526
- c,
527
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [R(a)] : Et([R(a)]),
528
- p,
529
- "`"
530
- ]);
531
- const h = c.length ? mt : ht, v = p.length ? mt : ht;
532
- return R([
533
- "`",
534
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, R(a)] : Et([h, R(a)]),
535
- v,
536
- "`"
537
- ]);
538
- }, _e = "embeddedJava", bs = ["java"], fs = D(_e), bt = A(_e), ft = T(_e), ys = {
539
- [fs]: {
540
- category: "Embed",
541
- type: "string",
542
- array: !0,
543
- default: [{ value: [...bs] }],
544
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.",
545
- deprecated: `Please use \`${bt}\` or \`${ft}\`.`
546
- },
547
- [bt]: {
548
- category: "Embed",
549
- type: "string",
550
- array: !0,
551
- default: [{ value: [_] }],
552
- description: "Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
553
- },
554
- [ft]: {
555
- category: "Embed",
556
- type: "string",
557
- array: !0,
558
- default: [{ value: [_] }],
559
- description: "Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
560
- }
561
- }, _s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
562
- __proto__: null,
563
- embedder: Es,
564
- language: _e,
565
- options: ys
566
- }, Symbol.toStringTag, { value: "Module" })), { line: yt, group: C, indent: _t, softline: $t } = M, $s = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
567
- const i = {
568
- ...r,
569
- ...o
570
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = vs(), d = l.quasis.map(
571
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
572
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
573
- c.length,
574
- -p.length || void 0
575
- ), b = k(n, t), $ = await e(f, {
576
- ...i,
577
- parser: i.embeddedJsonParser ?? "json"
578
- }), a = S($, E, b);
579
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
580
- return C([
581
- "`",
582
- c,
583
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [C(a)] : _t([C(a)]),
584
- p,
585
- "`"
586
- ]);
587
- const h = c.length ? yt : $t, v = p.length ? yt : $t;
588
- return C([
589
- "`",
590
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(a)] : _t([h, C(a)]),
591
- v,
592
- "`"
593
- ]);
170
+ var D = "9ff2b366e8ca4c97b9aed1a29b5b94ed", me = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
171
+ let o = {
172
+ ...r,
173
+ ...a
174
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S("@prettier-placeholder"), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
175
+ return v(b(await e(u, {
176
+ ...o,
177
+ parser: o.embeddedCssParser ?? "scss"
178
+ }), l, p, "literalline"), o, i, d, f);
179
+ }, O = "embeddedCss", he = ["css"], ge = [
180
+ "css",
181
+ "less",
182
+ "scss"
183
+ ], _e = C(O), ve = w(O), ye = T(O), be = E(O), xe = {
184
+ [_e]: {
185
+ category: "Embed",
186
+ type: "string",
187
+ array: !0,
188
+ default: [{ value: [...he] }],
189
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language.",
190
+ deprecated: `Please use \`${ve}\` or \`${ye}\`.`
191
+ },
192
+ [ve]: {
193
+ category: "Embed",
194
+ type: "string",
195
+ array: !0,
196
+ default: [{ value: [D] }],
197
+ description: "Block comments that make their subsequent template literals be identified as embedded CSS language."
198
+ },
199
+ [ye]: {
200
+ category: "Embed",
201
+ type: "string",
202
+ array: !0,
203
+ default: [{ value: [D] }],
204
+ description: "Tags that make their subsequent template literals be identified as embedded CSS language."
205
+ },
206
+ [be]: {
207
+ category: "Embed",
208
+ type: "choice",
209
+ default: "scss",
210
+ description: "The parser used to parse the embedded CSS language.",
211
+ choices: ge.map((e) => ({
212
+ value: e,
213
+ description: `Use the "${e}" parser.`
214
+ }))
215
+ }
216
+ }, Se = /* @__PURE__ */ p({
217
+ embedder: () => me,
218
+ language: () => O,
219
+ options: () => xe
220
+ }), Ce = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
221
+ let o = {
222
+ ...r,
223
+ ...a
224
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
225
+ return v(b(await e(u, {
226
+ ...o,
227
+ parser: o.embeddedEsParser ?? "babel"
228
+ }), l, p), o, i, d, f);
229
+ }, k = "embeddedEs", we = [
230
+ "js",
231
+ "jsx",
232
+ "es",
233
+ "es6",
234
+ "mjs",
235
+ "cjs",
236
+ "pac",
237
+ "javascript"
238
+ ], Te = [
239
+ "babel",
240
+ "babel-flow",
241
+ "acorn",
242
+ "espree",
243
+ "flow",
244
+ "meriyah"
245
+ ], Ee = C(k), De = w(k), Oe = T(k), ke = E(k), Ae = {
246
+ [Ee]: {
247
+ category: "Embed",
248
+ type: "string",
249
+ array: !0,
250
+ default: [{ value: [...we] }],
251
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language.",
252
+ deprecated: `Please use \`${De}\` or \`${Oe}\`.`
253
+ },
254
+ [De]: {
255
+ category: "Embed",
256
+ type: "string",
257
+ array: !0,
258
+ default: [{ value: [D] }],
259
+ description: "Block comments that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
260
+ },
261
+ [Oe]: {
262
+ category: "Embed",
263
+ type: "string",
264
+ array: !0,
265
+ default: [{ value: [D] }],
266
+ description: "Tags that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
267
+ },
268
+ [ke]: {
269
+ category: "Embed",
270
+ type: "choice",
271
+ default: "babel",
272
+ description: "The parser used to parse the embedded ECMASCript/JavaScript language.",
273
+ choices: Te.map((e) => ({
274
+ value: e,
275
+ description: `Use the "${e}" parser.`
276
+ }))
277
+ }
278
+ }, je = /* @__PURE__ */ p({
279
+ embedder: () => Ce,
280
+ language: () => k,
281
+ options: () => Ae
282
+ }), Me = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
283
+ let o = {
284
+ ...r,
285
+ ...a
286
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
287
+ return v(b(await e(u, {
288
+ ...o,
289
+ parser: "glsl-parser"
290
+ }), l, p), o, i, d, f);
291
+ }, A = "embeddedGlsl", Ne = ["glsl", "shader"], Pe = C(A), Fe = w(A), Ie = T(A), Le = {
292
+ [Pe]: {
293
+ category: "Embed",
294
+ type: "string",
295
+ array: !0,
296
+ default: [{ value: [...Ne] }],
297
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin.",
298
+ deprecated: `Please use \`${Fe}\` or \`${Ie}\`.`
299
+ },
300
+ [Fe]: {
301
+ category: "Embed",
302
+ type: "string",
303
+ array: !0,
304
+ default: [{ value: [D] }],
305
+ description: "Block comments that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
306
+ },
307
+ [Ie]: {
308
+ category: "Embed",
309
+ type: "string",
310
+ array: !0,
311
+ default: [{ value: [D] }],
312
+ description: "Tags that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
313
+ }
314
+ }, Re = /* @__PURE__ */ p({
315
+ embedder: () => Me,
316
+ language: () => A,
317
+ options: () => Le
318
+ }), ze = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
319
+ let o = {
320
+ ...r,
321
+ ...a
322
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
323
+ return v(b(await e(u, {
324
+ ...o,
325
+ parser: "graphql"
326
+ }), l, p), o, i, d, f);
327
+ }, j = "embeddedGraphql", Be = ["graphql", "gql"], Ve = C(j), He = w(j), Ue = T(j), We = {
328
+ [Ve]: {
329
+ category: "Embed",
330
+ type: "string",
331
+ array: !0,
332
+ default: [{ value: [...Be] }],
333
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language.",
334
+ deprecated: `Please use \`${He}\` or \`${Ue}\`.`
335
+ },
336
+ [He]: {
337
+ category: "Embed",
338
+ type: "string",
339
+ array: !0,
340
+ default: [{ value: [D] }],
341
+ description: "Block comments that make their subsequent template literals be identified as embedded GraphQL language."
342
+ },
343
+ [Ue]: {
344
+ category: "Embed",
345
+ type: "string",
346
+ array: !0,
347
+ default: [{ value: [D] }],
348
+ description: "Tags that make their subsequent template literals be identified as embedded GraphQL language."
349
+ }
350
+ }, Ge = /* @__PURE__ */ p({
351
+ embedder: () => ze,
352
+ language: () => j,
353
+ options: () => We
354
+ }), { mapDoc: Ke } = t, qe = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
355
+ let o = {
356
+ ...r,
357
+ ...a
358
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
359
+ return v(Ke(await e(u, {
360
+ ...o,
361
+ parser: o.embeddedHtmlParser ?? "html"
362
+ }), (e) => {
363
+ if (typeof e != "string") return e;
364
+ let t = [], n = e.split(l);
365
+ for (let e = 0; e < n.length; e++) {
366
+ let r = n[e];
367
+ if (e % 2 == 0) {
368
+ if (!r) continue;
369
+ r = r.replaceAll(/([\\`]|\${)/g, "\\$1"), o.__embeddedInHtml && (r = r.replaceAll(/<\/(?=script\b)/gi, "<\\/")), t.push(r);
370
+ } else {
371
+ let e = Number(r);
372
+ t.push(p[e]);
373
+ }
374
+ }
375
+ return t;
376
+ }), o, i, d, f, o.htmlWhitespaceSensitivity === "strict" || o.htmlWhitespaceSensitivity === "css");
377
+ }, M = "embeddedHtml", Je = ["html", "xhtml"], Ye = [
378
+ "html",
379
+ "vue",
380
+ "angular",
381
+ "lwc"
382
+ ], Xe = C(M), Ze = w(M), Qe = T(M), $e = E(M), et = {
383
+ [Xe]: {
384
+ category: "Embed",
385
+ type: "string",
386
+ array: !0,
387
+ default: [{ value: [...Je] }],
388
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language.",
389
+ deprecated: `Please use \`${Ze}\` or \`${Qe}\`.`
390
+ },
391
+ [Ze]: {
392
+ category: "Embed",
393
+ type: "string",
394
+ array: !0,
395
+ default: [{ value: [D] }],
396
+ description: "Block comments that make their subsequent template literals be identified as embedded HTML language."
397
+ },
398
+ [Qe]: {
399
+ category: "Embed",
400
+ type: "string",
401
+ array: !0,
402
+ default: [{ value: [D] }],
403
+ description: "Tags that make their subsequent template literals be identified as embedded HTML language."
404
+ },
405
+ [$e]: {
406
+ category: "Embed",
407
+ type: "choice",
408
+ default: "html",
409
+ description: "The parser used to parse the embedded HTML language.",
410
+ choices: Ye.map((e) => ({
411
+ value: e,
412
+ description: `Use the "${e}" parser.`
413
+ }))
414
+ }
415
+ }, tt = /* @__PURE__ */ p({
416
+ embedder: () => qe,
417
+ language: () => M,
418
+ options: () => et
419
+ }), nt = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
420
+ let o = {
421
+ ...r,
422
+ ...a
423
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
424
+ return v(b(await e(u, {
425
+ ...o,
426
+ parser: "ini"
427
+ }), l, p), o, i, d, f);
428
+ }, N = "embeddedIni", rt = [
429
+ "ini",
430
+ "cfg",
431
+ "pro"
432
+ ], it = C(N), at = w(N), ot = T(N), st = {
433
+ [it]: {
434
+ category: "Embed",
435
+ type: "string",
436
+ array: !0,
437
+ default: [{ value: [...rt] }],
438
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin.",
439
+ deprecated: `Please use \`${at}\` or \`${ot}\`.`
440
+ },
441
+ [at]: {
442
+ category: "Embed",
443
+ type: "string",
444
+ array: !0,
445
+ default: [{ value: [D] }],
446
+ description: "Block comments that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
447
+ },
448
+ [ot]: {
449
+ category: "Embed",
450
+ type: "string",
451
+ array: !0,
452
+ default: [{ value: [D] }],
453
+ description: "Tags that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
454
+ }
455
+ }, ct = /* @__PURE__ */ p({
456
+ embedder: () => nt,
457
+ language: () => N,
458
+ options: () => st
459
+ }), lt = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
460
+ let o = {
461
+ ...r,
462
+ ...a
463
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
464
+ return v(b(await e(u, {
465
+ ...o,
466
+ parser: "java"
467
+ }), l, p, "hardline"), o, i, d, f);
468
+ }, P = "embeddedJava", ut = ["java"], dt = C(P), ft = w(P), pt = T(P), mt = {
469
+ [dt]: {
470
+ category: "Embed",
471
+ type: "string",
472
+ array: !0,
473
+ default: [{ value: [...ut] }],
474
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin.",
475
+ deprecated: `Please use \`${ft}\` or \`${pt}\`.`
476
+ },
477
+ [ft]: {
478
+ category: "Embed",
479
+ type: "string",
480
+ array: !0,
481
+ default: [{ value: [D] }],
482
+ description: "Block comments that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
483
+ },
484
+ [pt]: {
485
+ category: "Embed",
486
+ type: "string",
487
+ array: !0,
488
+ default: [{ value: [D] }],
489
+ description: "Tags that make their subsequent template literals be identified as embedded Java language. This option requires the `prettier-plugin-java` plugin."
490
+ }
491
+ }, ht = /* @__PURE__ */ p({
492
+ embedder: () => lt,
493
+ language: () => P,
494
+ options: () => mt
495
+ }), gt = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
496
+ let o = {
497
+ ...r,
498
+ ...a
499
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = _t(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
500
+ return v(b(await e(u, {
501
+ ...o,
502
+ parser: o.embeddedJsonParser ?? "json"
503
+ }), l, p), o, i, d, f);
594
504
  };
595
- function vs() {
596
- const e = he(), t = he(), n = (s) => `'0${e}${s}${t}'`, r = new RegExp(
597
- `["']?0${e}(\\d+)${t}['"]?`,
598
- "ig"
599
- );
600
- return {
601
- createPlaceholder: n,
602
- placeholderRegex: r
603
- };
604
- }
605
- const de = "embeddedJson", Ds = ["json", "jsonl"], Ts = ["json", "json5", "jsonc", "json-stringify"], Ms = D(de), vt = A(de), Dt = T(de), As = O(de), Ss = {
606
- [Ms]: {
607
- category: "Embed",
608
- type: "string",
609
- array: !0,
610
- default: [{ value: [...Ds] }],
611
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language.",
612
- deprecated: `Please use \`${vt}\` or \`${Dt}\`.`
613
- },
614
- [vt]: {
615
- category: "Embed",
616
- type: "string",
617
- array: !0,
618
- default: [{ value: [_] }],
619
- description: "Block comments that make their subsequent template literals be identified as embedded JSON language."
620
- },
621
- [Dt]: {
622
- category: "Embed",
623
- type: "string",
624
- array: !0,
625
- default: [{ value: [_] }],
626
- description: "Tags that make their subsequent template literals be identified as embedded JSON language."
627
- },
628
- [As]: {
629
- category: "Embed",
630
- type: "choice",
631
- default: "json",
632
- description: "The parser used to parse the embedded JSON language.",
633
- choices: Ts.map((e) => ({
634
- value: e,
635
- description: `Use the "${e}" parser.`
636
- }))
637
- }
638
- }, ks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
639
- __proto__: null,
640
- embedder: $s,
641
- language: de,
642
- options: Ss
643
- }, Symbol.toStringTag, { value: "Module" })), { line: Tt, group: w, indent: Mt, softline: At } = M, Ls = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
644
- const i = {
645
- ...r,
646
- ...o
647
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L("$p"), d = l.quasis.map(
648
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
649
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
650
- c.length,
651
- -p.length || void 0
652
- ), b = k(n, t), $ = await e(f, {
653
- ...i,
654
- parser: "JSONata"
655
- }), a = S($, E, b);
656
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
657
- return w([
658
- "`",
659
- c,
660
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [w(a)] : Mt([w(a)]),
661
- p,
662
- "`"
663
- ]);
664
- const h = c.length ? Tt : At, v = p.length ? Tt : At;
665
- return w([
666
- "`",
667
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, w(a)] : Mt([h, w(a)]),
668
- v,
669
- "`"
670
- ]);
671
- }, $e = "embeddedJsonata", Gs = ["jsonata"], Ns = D($e), St = A($e), kt = T($e), Os = {
672
- [Ns]: {
673
- category: "Embed",
674
- type: "string",
675
- array: !0,
676
- default: [{ value: [...Gs] }],
677
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.",
678
- deprecated: `Please use \`${St}\` or \`${kt}\`.`
679
- },
680
- [St]: {
681
- category: "Embed",
682
- type: "string",
683
- array: !0,
684
- default: [{ value: [_] }],
685
- description: "Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
686
- },
687
- [kt]: {
688
- category: "Embed",
689
- type: "string",
690
- array: !0,
691
- default: [{ value: [_] }],
692
- description: "Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
693
- }
694
- }, xs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
695
- __proto__: null,
696
- embedder: Ls,
697
- language: $e,
698
- options: Os
699
- }, Symbol.toStringTag, { value: "Module" })), { line: Lt, group: F, indent: Gt, softline: Nt } = M, Is = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
700
- const i = {
701
- ...r,
702
- ...o
703
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
704
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
705
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
706
- c.length,
707
- -p.length || void 0
708
- ), b = k(n, t), $ = await e(f, {
709
- ...i,
710
- parser: "latex-parser"
711
- }), a = S($, E, b);
712
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
713
- return F([
714
- "`",
715
- c,
716
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [F(a)] : Gt([F(a)]),
717
- p,
718
- "`"
719
- ]);
720
- const h = c.length ? Lt : Nt, v = p.length ? Lt : Nt;
721
- return F([
722
- "`",
723
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, F(a)] : Gt([h, F(a)]),
724
- v,
725
- "`"
726
- ]);
727
- }, ve = "embeddedLatex", Ps = [
728
- "latex",
729
- "tex",
730
- "aux",
731
- "cls",
732
- "bbl",
733
- "bib",
734
- "toc",
735
- "sty"
736
- ], Bs = D(ve), Ot = A(ve), xt = T(ve), qs = {
737
- [Bs]: {
738
- category: "Embed",
739
- type: "string",
740
- array: !0,
741
- default: [{ value: [...Ps] }],
742
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.",
743
- deprecated: `Please use \`${Ot}\` or \`${xt}\`.`
744
- },
745
- [Ot]: {
746
- category: "Embed",
747
- type: "string",
748
- array: !0,
749
- default: [{ value: [_] }],
750
- description: "Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
751
- },
752
- [xt]: {
753
- category: "Embed",
754
- type: "string",
755
- array: !0,
756
- default: [{ value: [_] }],
757
- description: "Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
758
- }
759
- }, js = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
760
- __proto__: null,
761
- embedder: Is,
762
- language: ve,
763
- options: qs
764
- }, Symbol.toStringTag, { value: "Module" }));
765
- function It(e, t) {
766
- var n = Object.keys(e);
767
- if (Object.getOwnPropertySymbols) {
768
- var r = Object.getOwnPropertySymbols(e);
769
- t && (r = r.filter(function(s) {
770
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
771
- })), n.push.apply(n, r);
772
- }
773
- return n;
505
+ function _t() {
506
+ let e = x(), t = x();
507
+ return {
508
+ createPlaceholder: (n) => `'0${e}${n}${t}'`,
509
+ placeholderRegex: RegExp(`["']?0${e}(\\d+)${t}['"]?`, "ig")
510
+ };
774
511
  }
775
- function Pt(e) {
776
- for (var t = 1; t < arguments.length; t++) {
777
- var n = arguments[t] != null ? arguments[t] : {};
778
- t % 2 ? It(Object(n), !0).forEach(function(r) {
779
- Us(e, r, n[r]);
780
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : It(Object(n)).forEach(function(r) {
781
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
782
- });
783
- }
784
- return e;
512
+ //#endregion
513
+ //#region src/embedded/json/language.ts
514
+ var F = "embeddedJson", vt = ["json", "jsonl"], yt = [
515
+ "json",
516
+ "json5",
517
+ "jsonc",
518
+ "json-stringify"
519
+ ], bt = C(F), xt = w(F), St = T(F), Ct = E(F), wt = {
520
+ [bt]: {
521
+ category: "Embed",
522
+ type: "string",
523
+ array: !0,
524
+ default: [{ value: [...vt] }],
525
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language.",
526
+ deprecated: `Please use \`${xt}\` or \`${St}\`.`
527
+ },
528
+ [xt]: {
529
+ category: "Embed",
530
+ type: "string",
531
+ array: !0,
532
+ default: [{ value: [D] }],
533
+ description: "Block comments that make their subsequent template literals be identified as embedded JSON language."
534
+ },
535
+ [St]: {
536
+ category: "Embed",
537
+ type: "string",
538
+ array: !0,
539
+ default: [{ value: [D] }],
540
+ description: "Tags that make their subsequent template literals be identified as embedded JSON language."
541
+ },
542
+ [Ct]: {
543
+ category: "Embed",
544
+ type: "choice",
545
+ default: "json",
546
+ description: "The parser used to parse the embedded JSON language.",
547
+ choices: yt.map((e) => ({
548
+ value: e,
549
+ description: `Use the "${e}" parser.`
550
+ }))
551
+ }
552
+ }, Tt = /* @__PURE__ */ p({
553
+ embedder: () => gt,
554
+ language: () => F,
555
+ options: () => wt
556
+ }), Et = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
557
+ let o = {
558
+ ...r,
559
+ ...a
560
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S("$p"), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
561
+ return v(b(await e(u, {
562
+ ...o,
563
+ parser: "JSONata"
564
+ }), l, p), o, i, d, f);
565
+ }, I = "embeddedJsonata", Dt = ["jsonata"], Ot = C(I), kt = w(I), At = T(I), jt = {
566
+ [Ot]: {
567
+ category: "Embed",
568
+ type: "string",
569
+ array: !0,
570
+ default: [{ value: [...Dt] }],
571
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin.",
572
+ deprecated: `Please use \`${kt}\` or \`${At}\`.`
573
+ },
574
+ [kt]: {
575
+ category: "Embed",
576
+ type: "string",
577
+ array: !0,
578
+ default: [{ value: [D] }],
579
+ description: "Block comments that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
580
+ },
581
+ [At]: {
582
+ category: "Embed",
583
+ type: "string",
584
+ array: !0,
585
+ default: [{ value: [D] }],
586
+ description: "Tags that make their subsequent template literals be identified as embedded JSONata language. This option requires the `@stedi/prettier-plugin-jsonata` plugin."
587
+ }
588
+ }, Mt = /* @__PURE__ */ p({
589
+ embedder: () => Et,
590
+ language: () => I,
591
+ options: () => jt
592
+ }), Nt = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
593
+ let o = {
594
+ ...r,
595
+ ...a
596
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
597
+ return v(b(await e(u, {
598
+ ...o,
599
+ parser: "latex-parser"
600
+ }), l, p), o, i, d, f);
601
+ }, L = "embeddedLatex", Pt = [
602
+ "latex",
603
+ "tex",
604
+ "aux",
605
+ "cls",
606
+ "bbl",
607
+ "bib",
608
+ "toc",
609
+ "sty"
610
+ ], Ft = C(L), It = w(L), Lt = T(L), Rt = {
611
+ [Ft]: {
612
+ category: "Embed",
613
+ type: "string",
614
+ array: !0,
615
+ default: [{ value: [...Pt] }],
616
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin.",
617
+ deprecated: `Please use \`${It}\` or \`${Lt}\`.`
618
+ },
619
+ [It]: {
620
+ category: "Embed",
621
+ type: "string",
622
+ array: !0,
623
+ default: [{ value: [D] }],
624
+ description: "Block comments that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
625
+ },
626
+ [Lt]: {
627
+ category: "Embed",
628
+ type: "string",
629
+ array: !0,
630
+ default: [{ value: [D] }],
631
+ description: "Tags that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
632
+ }
633
+ }, zt = /* @__PURE__ */ p({
634
+ embedder: () => Nt,
635
+ language: () => L,
636
+ options: () => Rt
637
+ });
638
+ //#endregion
639
+ //#region node_modules/.pnpm/dedent@1.7.2/node_modules/dedent/dist/dedent.mjs
640
+ function Bt(e, t) {
641
+ var n = Object.keys(e);
642
+ if (Object.getOwnPropertySymbols) {
643
+ var r = Object.getOwnPropertySymbols(e);
644
+ t && (r = r.filter(function(t) {
645
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
646
+ })), n.push.apply(n, r);
647
+ }
648
+ return n;
785
649
  }
786
- function Us(e, t, n) {
787
- return t = Rs(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
650
+ function Vt(e) {
651
+ for (var t = 1; t < arguments.length; t++) {
652
+ var n = arguments[t] == null ? {} : arguments[t];
653
+ t % 2 ? Bt(Object(n), !0).forEach(function(t) {
654
+ Ht(e, t, n[t]);
655
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Bt(Object(n)).forEach(function(t) {
656
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
657
+ });
658
+ }
659
+ return e;
788
660
  }
789
- function Rs(e) {
790
- var t = Cs(e, "string");
791
- return typeof t == "symbol" ? t : String(t);
661
+ function Ht(e, t, n) {
662
+ return t = Ut(t), t in e ? Object.defineProperty(e, t, {
663
+ value: n,
664
+ enumerable: !0,
665
+ configurable: !0,
666
+ writable: !0
667
+ }) : e[t] = n, e;
792
668
  }
793
- function Cs(e, t) {
794
- if (typeof e != "object" || e === null) return e;
795
- var n = e[Symbol.toPrimitive];
796
- if (n !== void 0) {
797
- var r = n.call(e, t);
798
- if (typeof r != "object") return r;
799
- throw new TypeError("@@toPrimitive must return a primitive value.");
800
- }
801
- return (t === "string" ? String : Number)(e);
669
+ function Ut(e) {
670
+ var t = Wt(e, "string");
671
+ return typeof t == "symbol" ? t : String(t);
802
672
  }
803
- const ri = oi({});
804
- function oi(e) {
805
- return t.withOptions = (n) => oi(Pt(Pt({}, e), n)), t;
806
- function t(n, ...r) {
807
- const s = typeof n == "string" ? [n] : n.raw, {
808
- escapeSpecialCharacters: o = Array.isArray(n)
809
- } = e;
810
- let i = "";
811
- for (let E = 0; E < s.length; E++) {
812
- let d = s[E];
813
- o && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), i += d, E < r.length && (i += r[E]);
814
- }
815
- const l = i.split(`
816
- `);
817
- let u = null;
818
- for (const E of l) {
819
- const d = E.match(/^(\s+)\S+/);
820
- if (d) {
821
- const c = d[1].length;
822
- u ? u = Math.min(u, c) : u = c;
823
- }
824
- }
825
- if (u !== null) {
826
- const E = u;
827
- i = l.map((d) => d[0] === " " || d[0] === " " ? d.slice(E) : d).join(`
828
- `);
829
- }
830
- return i = i.trim(), o && (i = i.replace(/\\n/g, `
831
- `)), i;
832
- }
673
+ function Wt(e, t) {
674
+ if (typeof e != "object" || !e) return e;
675
+ var n = e[Symbol.toPrimitive];
676
+ if (n !== void 0) {
677
+ var r = n.call(e, t || "default");
678
+ if (typeof r != "object") return r;
679
+ throw TypeError("@@toPrimitive must return a primitive value.");
680
+ }
681
+ return (t === "string" ? String : Number)(e);
833
682
  }
834
- const { line: Bt, group: W, indent: qt, softline: jt } = M, ws = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
835
- const i = {
836
- ...r,
837
- ...o
838
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
839
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
840
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
841
- c.length,
842
- -p.length || void 0
843
- ), b = k(n, t), $ = await e(
844
- // use `dedent` to fix unstable embedded markdown indentation with the `useTabs` option
845
- // https://github.com/Sec-ant/prettier-plugin-embed/pull/91#issuecomment-1963760555
846
- // https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-js/embed/markdown.js#L15-L19
847
- ri(f),
848
- {
849
- ...i,
850
- parser: i.embeddedMarkdownParser ?? "markdown",
851
- // this will change the code fence delimiter from ``` to ~~~
852
- // https://github.com/prettier/prettier/blob/1079517b32e5bb145afa7acba448af51f8a7b6e6/src/language-markdown/embed.js#L15
853
- __inJsTemplate: !0
854
- }
855
- ), a = S(
856
- $,
857
- E,
858
- b,
859
- !0
860
- );
861
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
862
- return W([
863
- "`",
864
- c,
865
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [W(a)] : qt([W(a)]),
866
- p,
867
- "`"
868
- ]);
869
- const h = c.length ? Bt : jt, v = p.length ? Bt : jt;
870
- return W([
871
- "`",
872
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, W(a)] : qt([h, W(a)]),
873
- v,
874
- "`"
875
- ]);
876
- }, le = "embeddedMarkdown", Fs = ["md", "markdown"], Ws = ["markdown", "mdx", "remark"], zs = D(le), Ut = A(le), Rt = T(le), Ks = O(le), Js = {
877
- [zs]: {
878
- category: "Embed",
879
- type: "string",
880
- array: !0,
881
- default: [{ value: [...Fs] }],
882
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.",
883
- deprecated: `Please use \`${Ut}\` or \`${Rt}\`.`
884
- },
885
- [Ut]: {
886
- category: "Embed",
887
- type: "string",
888
- array: !0,
889
- default: [{ value: [_] }],
890
- description: "Block comments that make their subsequent template literals be identified as embedded Markdown language."
891
- },
892
- [Rt]: {
893
- category: "Embed",
894
- type: "string",
895
- array: !0,
896
- default: [{ value: [_] }],
897
- description: "Tags that make their subsequent template literals be identified as embedded Markdown language."
898
- },
899
- [Ks]: {
900
- category: "Embed",
901
- type: "choice",
902
- default: "markdown",
903
- description: "The parser used to parse the embedded Markdown language.",
904
- choices: Ws.map((e) => ({
905
- value: e,
906
- description: `Use the "${e}" parser.`
907
- }))
908
- }
909
- }, Hs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
910
- __proto__: null,
911
- embedder: ws,
912
- language: le,
913
- options: Js
914
- }, Symbol.toStringTag, { value: "Module" })), { line: Ct, group: z, indent: wt, softline: Ft } = M, Xs = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
915
- const i = {
916
- ...r,
917
- ...o
918
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
919
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
920
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
921
- c.length,
922
- -p.length || void 0
923
- ), b = k(n, t), $ = await e(f, {
924
- ...i,
925
- parser: "nginx"
926
- }), a = S($, E, b);
927
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
928
- return z([
929
- "`",
930
- c,
931
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [z(a)] : wt([z(a)]),
932
- p,
933
- "`"
934
- ]);
935
- const h = c.length ? Ct : Ft, v = p.length ? Ct : Ft;
936
- return z([
937
- "`",
938
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, z(a)] : wt([h, z(a)]),
939
- v,
940
- "`"
941
- ]);
942
- }, De = "embeddedNginx", Qs = ["nginx"], Ys = D(De), Wt = A(De), zt = T(De), Vs = {
943
- [Ys]: {
944
- category: "Embed",
945
- type: "string",
946
- array: !0,
947
- default: [{ value: [...Qs] }],
948
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.",
949
- deprecated: `Please use \`${Wt}\` or \`${zt}\`.`
950
- },
951
- [Wt]: {
952
- category: "Embed",
953
- type: "string",
954
- array: !0,
955
- default: [{ value: [_] }],
956
- description: "Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
957
- },
958
- [zt]: {
959
- category: "Embed",
960
- type: "string",
961
- array: !0,
962
- default: [{ value: [_] }],
963
- description: "Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
964
- }
965
- }, Zs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
966
- __proto__: null,
967
- embedder: Xs,
968
- language: De,
969
- options: Vs
970
- }, Symbol.toStringTag, { value: "Module" })), ce = "embeddedNoop", er = D(ce), Kt = A(ce), Jt = T(ce), tr = {
971
- [er]: {
972
- category: "Embed",
973
- type: "string",
974
- array: !0,
975
- default: [{ value: [] }],
976
- description: "Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.",
977
- deprecated: `Please use \`${Kt}\` or \`${Jt}\`.`
978
- },
979
- [Kt]: {
980
- category: "Embed",
981
- type: "string",
982
- array: !0,
983
- default: [{ value: [_] }],
984
- description: "Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
985
- },
986
- [Jt]: {
987
- category: "Embed",
988
- type: "string",
989
- array: !0,
990
- default: [{ value: [_] }],
991
- description: "Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
992
- }
993
- }, nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
994
- __proto__: null,
995
- language: ce,
996
- options: tr
997
- }, Symbol.toStringTag, { value: "Module" })), { line: Ht, group: K, indent: Xt, softline: Qt } = M, ir = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
998
- const i = {
999
- ...r,
1000
- ...o
1001
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1002
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1003
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1004
- c.length,
1005
- -p.length || void 0
1006
- ), b = k(n, t), $ = await e(f, {
1007
- ...i,
1008
- parser: "pegjs-parser"
1009
- }), a = S($, E, b);
1010
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1011
- return K([
1012
- "`",
1013
- c,
1014
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [K(a)] : Xt([K(a)]),
1015
- p,
1016
- "`"
1017
- ]);
1018
- const h = c.length ? Ht : Qt, v = p.length ? Ht : Qt;
1019
- return K([
1020
- "`",
1021
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, K(a)] : Xt([h, K(a)]),
1022
- v,
1023
- "`"
1024
- ]);
1025
- }, Te = "embeddedPegjs", sr = ["pegjs", "peggy", "peg"], rr = D(Te), Yt = A(Te), Vt = T(Te), or = {
1026
- [rr]: {
1027
- category: "Embed",
1028
- type: "string",
1029
- array: !0,
1030
- default: [{ value: [...sr] }],
1031
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.",
1032
- deprecated: `Please use \`${Yt}\` or \`${Vt}\`.`
1033
- },
1034
- [Yt]: {
1035
- category: "Embed",
1036
- type: "string",
1037
- array: !0,
1038
- default: [{ value: [_] }],
1039
- description: "Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
1040
- },
1041
- [Vt]: {
1042
- category: "Embed",
1043
- type: "string",
1044
- array: !0,
1045
- default: [{ value: [_] }],
1046
- description: "Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
1047
- }
1048
- }, ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1049
- __proto__: null,
1050
- embedder: ir,
1051
- language: Te,
1052
- options: or
1053
- }, Symbol.toStringTag, { value: "Module" })), { line: Zt, group: J, indent: en, softline: tn } = M, dr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1054
- const i = {
1055
- ...r,
1056
- ...o
1057
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L("$p"), d = l.quasis.map(
1058
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1059
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1060
- c.length,
1061
- -p.length || void 0
1062
- ), b = k(n, t), $ = await e(f, {
1063
- ...i,
1064
- parser: "php"
1065
- }), a = S($, E, b);
1066
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1067
- return J([
1068
- "`",
1069
- c,
1070
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [J(a)] : en([J(a)]),
1071
- p,
1072
- "`"
1073
- ]);
1074
- const h = c.length ? Zt : tn, v = p.length ? Zt : tn;
1075
- return J([
1076
- "`",
1077
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, J(a)] : en([h, J(a)]),
1078
- v,
1079
- "`"
1080
- ]);
1081
- }, Me = "embeddedPhp", lr = ["php", "php5"], cr = D(Me), nn = A(Me), sn = T(Me), ur = {
1082
- [cr]: {
1083
- category: "Embed",
1084
- type: "string",
1085
- array: !0,
1086
- default: [{ value: [...lr] }],
1087
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.",
1088
- deprecated: `Please use \`${nn}\` or \`${sn}\`.`
1089
- },
1090
- [nn]: {
1091
- category: "Embed",
1092
- type: "string",
1093
- array: !0,
1094
- default: [{ value: [_] }],
1095
- description: "Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
1096
- },
1097
- [sn]: {
1098
- category: "Embed",
1099
- type: "string",
1100
- array: !0,
1101
- default: [{ value: [_] }],
1102
- description: "Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
1103
- }
1104
- }, pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1105
- __proto__: null,
1106
- embedder: dr,
1107
- language: Me,
1108
- options: ur
1109
- }, Symbol.toStringTag, { value: "Module" })), { line: rn, group: H, indent: on, softline: an } = M, gr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1110
- const i = {
1111
- ...r,
1112
- ...o
1113
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1114
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1115
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1116
- c.length,
1117
- -p.length || void 0
1118
- ), b = k(n, t), $ = await e(f, {
1119
- ...i,
1120
- parser: "prisma-parse"
1121
- }), a = S($, E, b);
1122
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1123
- return H([
1124
- "`",
1125
- c,
1126
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [H(a)] : on([H(a)]),
1127
- p,
1128
- "`"
1129
- ]);
1130
- const h = c.length ? rn : an, v = p.length ? rn : an;
1131
- return H([
1132
- "`",
1133
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, H(a)] : on([h, H(a)]),
1134
- v,
1135
- "`"
1136
- ]);
1137
- }, Ae = "embeddedPrisma", mr = ["prisma"], hr = D(Ae), dn = A(Ae), ln = T(Ae), Er = {
1138
- [hr]: {
1139
- category: "Embed",
1140
- type: "string",
1141
- array: !0,
1142
- default: [{ value: [...mr] }],
1143
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.",
1144
- deprecated: `Please use \`${dn}\` or \`${ln}\`.`
1145
- },
1146
- [dn]: {
1147
- category: "Embed",
1148
- type: "string",
1149
- array: !0,
1150
- default: [{ value: [_] }],
1151
- description: "Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
1152
- },
1153
- [ln]: {
1154
- category: "Embed",
1155
- type: "string",
1156
- array: !0,
1157
- default: [{ value: [_] }],
1158
- description: "Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
1159
- }
1160
- }, br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1161
- __proto__: null,
1162
- embedder: gr,
1163
- language: Ae,
1164
- options: Er
1165
- }, Symbol.toStringTag, { value: "Module" })), { line: cn, group: X, indent: un, softline: pn } = M, fr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1166
- const i = {
1167
- ...r,
1168
- ...o
1169
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1170
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1171
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1172
- c.length,
1173
- -p.length || void 0
1174
- ), b = k(n, t), $ = await e(f, {
1175
- ...i,
1176
- parser: "dot-properties"
1177
- }), a = S($, E, b);
1178
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1179
- return X([
1180
- "`",
1181
- c,
1182
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [X(a)] : un([X(a)]),
1183
- p,
1184
- "`"
1185
- ]);
1186
- const h = c.length ? cn : pn, v = p.length ? cn : pn;
1187
- return X([
1188
- "`",
1189
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, X(a)] : un([h, X(a)]),
1190
- v,
1191
- "`"
1192
- ]);
1193
- }, Se = "embeddedProperties", yr = ["properties"], _r = D(Se), gn = A(Se), mn = T(Se), $r = {
1194
- [_r]: {
1195
- category: "Embed",
1196
- type: "string",
1197
- array: !0,
1198
- default: [{ value: [...yr] }],
1199
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.",
1200
- deprecated: `Please use \`${gn}\` or \`${mn}\`.`
1201
- },
1202
- [gn]: {
1203
- category: "Embed",
1204
- type: "string",
1205
- array: !0,
1206
- default: [{ value: [_] }],
1207
- description: "Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
1208
- },
1209
- [mn]: {
1210
- category: "Embed",
1211
- type: "string",
1212
- array: !0,
1213
- default: [{ value: [_] }],
1214
- description: "Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
1215
- }
1216
- }, vr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1217
- __proto__: null,
1218
- embedder: fr,
1219
- language: Se,
1220
- options: $r
1221
- }, Symbol.toStringTag, { value: "Module" })), { group: Q, line: hn, softline: En, indent: bn } = M, Dr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1222
- const i = {
1223
- ...r,
1224
- ...o
1225
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1226
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1227
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1228
- c.length,
1229
- -p.length || void 0
1230
- ), b = k(n, t), $ = await e(f, {
1231
- ...i,
1232
- parser: "pug"
1233
- }), a = S(
1234
- $,
1235
- E,
1236
- b,
1237
- !0
1238
- );
1239
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1240
- return Q([
1241
- "`",
1242
- c,
1243
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [Q(a)] : bn([Q(a)]),
1244
- p,
1245
- "`"
1246
- ]);
1247
- const h = c.length ? hn : En, v = p.length ? hn : En;
1248
- return Q([
1249
- "`",
1250
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Q(a)] : bn([h, Q(a)]),
1251
- v,
1252
- "`"
1253
- ]);
1254
- }, ke = "embeddedPug", Tr = ["pug", "jade"], Mr = D(ke), fn = A(ke), yn = T(ke), Ar = {
1255
- [Mr]: {
1256
- category: "Embed",
1257
- type: "string",
1258
- array: !0,
1259
- default: [{ value: [...Tr] }],
1260
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.",
1261
- deprecated: `Please use \`${fn}\` or \`${yn}\`.`
1262
- },
1263
- [fn]: {
1264
- category: "Embed",
1265
- type: "string",
1266
- array: !0,
1267
- default: [{ value: [_] }],
1268
- description: "Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
1269
- },
1270
- [yn]: {
1271
- category: "Embed",
1272
- type: "string",
1273
- array: !0,
1274
- default: [{ value: [_] }],
1275
- description: "Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
1276
- }
1277
- }, Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1278
- __proto__: null,
1279
- embedder: Dr,
1280
- language: ke,
1281
- options: Ar
1282
- }, Symbol.toStringTag, { value: "Module" })), { line: _n, group: Y, indent: $n, softline: vn } = M, kr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1283
- const i = {
1284
- ...r,
1285
- ...o
1286
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1287
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1288
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1289
- c.length,
1290
- -p.length || void 0
1291
- ), b = k(n, t), $ = await e(f, {
1292
- ...i,
1293
- parser: i.embeddedRubyParser ?? "ruby"
1294
- }), a = S($, E, b);
1295
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1296
- return Y([
1297
- "`",
1298
- c,
1299
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [Y(a)] : $n([Y(a)]),
1300
- p,
1301
- "`"
1302
- ]);
1303
- const h = c.length ? _n : vn, v = p.length ? _n : vn;
1304
- return Y([
1305
- "`",
1306
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Y(a)] : $n([h, Y(a)]),
1307
- v,
1308
- "`"
1309
- ]);
1310
- }, ue = "embeddedRuby", Lr = ["ruby"], Gr = ["ruby", "rbs", "haml"], Nr = D(ue), Dn = A(ue), Tn = T(ue), Or = O(ue), xr = {
1311
- [Nr]: {
1312
- category: "Embed",
1313
- type: "string",
1314
- array: !0,
1315
- default: [{ value: [...Lr] }],
1316
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
1317
- deprecated: `Please use \`${Dn}\` or \`${Tn}\`.`
1318
- },
1319
- [Dn]: {
1320
- category: "Embed",
1321
- type: "string",
1322
- array: !0,
1323
- default: [{ value: [_] }],
1324
- description: "Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
1325
- },
1326
- [Tn]: {
1327
- category: "Embed",
1328
- type: "string",
1329
- array: !0,
1330
- default: [{ value: [_] }],
1331
- description: "Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
1332
- },
1333
- [Or]: {
1334
- category: "Embed",
1335
- type: "choice",
1336
- default: "ruby",
1337
- description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
1338
- choices: Gr.map((e) => ({
1339
- value: e,
1340
- description: `Use the "${e}" parser.`
1341
- }))
1342
- }
1343
- }, Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1344
- __proto__: null,
1345
- embedder: kr,
1346
- language: ue,
1347
- options: xr
1348
- }, Symbol.toStringTag, { value: "Module" })), { group: V, line: Mn, softline: An, indent: Sn } = M, Pr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1349
- const i = {
1350
- ...r,
1351
- ...o
1352
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1353
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1354
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1355
- c.length,
1356
- -p.length || void 0
1357
- ), b = k(n, t), $ = await e(f, {
1358
- ...i,
1359
- parser: "sh"
1360
- }), a = S(
1361
- $,
1362
- E,
1363
- b,
1364
- !0
1365
- );
1366
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1367
- return V([
1368
- "`",
1369
- c,
1370
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [V(a)] : Sn([V(a)]),
1371
- p,
1372
- "`"
1373
- ]);
1374
- const h = c.length ? Mn : An, v = p.length ? Mn : An;
1375
- return V([
1376
- "`",
1377
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, V(a)] : Sn([h, V(a)]),
1378
- v,
1379
- "`"
1380
- ]);
1381
- }, Le = "embeddedSh", Br = ["sh"], qr = D(Le), kn = A(Le), Ln = T(Le), jr = {
1382
- [qr]: {
1383
- category: "Embed",
1384
- type: "string",
1385
- array: !0,
1386
- default: [{ value: [...Br] }],
1387
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.",
1388
- deprecated: `Please use \`${kn}\` or \`${Ln}\`.`
1389
- },
1390
- [kn]: {
1391
- category: "Embed",
1392
- type: "string",
1393
- array: !0,
1394
- default: [{ value: [_] }],
1395
- description: "Block comments that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
1396
- },
1397
- [Ln]: {
1398
- category: "Embed",
1399
- type: "string",
1400
- array: !0,
1401
- default: [{ value: [_] }],
1402
- description: "Tags that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
1403
- }
1404
- }, Ur = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1405
- __proto__: null,
1406
- embedder: Pr,
1407
- language: Le,
1408
- options: jr
1409
- }, Symbol.toStringTag, { value: "Module" })), { group: Z, line: Gn, softline: Nn, indent: On } = M, Rr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1410
- const i = {
1411
- ...r,
1412
- ...o
1413
- }, l = i.embeddedSqlPlugin ?? "prettier-plugin-sql", { node: u } = n, { createPlaceholder: E, placeholderRegex: d } = L(), c = u.quasis.map(
1414
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + E(g)
1415
- ).join(""), p = c.match(/^\s+/)?.[0] ?? "", f = c.match(/\s+$/)?.[0] ?? "", b = c.slice(
1416
- p.length,
1417
- -f.length || void 0
1418
- ), $ = k(n, t);
1419
- let a;
1420
- if (l === "prettier-plugin-sql-cst") {
1421
- const m = await e(b, {
1422
- ...i,
1423
- parser: i.embeddedSqlParser ?? "sqlite"
1424
- });
1425
- a = S(m, d, $);
1426
- } else {
1427
- const m = await e(ri(b), {
1428
- ...i,
1429
- parser: "sql"
1430
- });
1431
- a = S(
1432
- m,
1433
- d,
1434
- $,
1435
- !0
1436
- );
1437
- }
1438
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1439
- return Z([
1440
- "`",
1441
- p,
1442
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [Z(a)] : On([Z(a)]),
1443
- f,
1444
- "`"
1445
- ]);
1446
- const h = p.length ? Gn : Nn, v = f.length ? Gn : Nn;
1447
- return Z([
1448
- "`",
1449
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, Z(a)] : On([h, Z(a)]),
1450
- v,
1451
- "`"
1452
- ]);
1453
- }, se = "embeddedSql", Cr = ["sql"], wr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Fr = [
1454
- "sqlite",
1455
- "bigquery",
1456
- "mysql",
1457
- "mariadb",
1458
- "postgresql"
1459
- ], Wr = D(se), xn = A(se), In = T(se), zr = Oi(se), Kr = O(se), Jr = {
1460
- [Wr]: {
1461
- category: "Embed",
1462
- type: "string",
1463
- array: !0,
1464
- default: [{ value: [...Cr] }],
1465
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.",
1466
- deprecated: `Please use \`${xn}\` or \`${In}\`.`
1467
- },
1468
- [xn]: {
1469
- category: "Embed",
1470
- type: "string",
1471
- array: !0,
1472
- default: [{ value: [_] }],
1473
- description: "Block comments that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin."
1474
- },
1475
- [In]: {
1476
- category: "Embed",
1477
- type: "string",
1478
- array: !0,
1479
- default: [{ value: [_] }],
1480
- description: "Tags that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin."
1481
- },
1482
- [zr]: {
1483
- category: "Embed",
1484
- type: "choice",
1485
- default: "prettier-plugin-sql",
1486
- description: "The plugin used to format the embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.",
1487
- choices: wr.map((e) => ({
1488
- value: e,
1489
- description: `Use the "${e}" plugin.`
1490
- }))
1491
- },
1492
- [Kr]: {
1493
- category: "Embed",
1494
- type: "choice",
1495
- default: "sqlite",
1496
- description: "Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.",
1497
- choices: Fr.map((e) => ({
1498
- value: e,
1499
- description: `Use the "${e}" parser.`
1500
- }))
1501
- }
1502
- }, Hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1503
- __proto__: null,
1504
- embedder: Rr,
1505
- language: se,
1506
- options: Jr
1507
- }, Symbol.toStringTag, { value: "Module" })), { line: Pn, group: ee, indent: Bn, softline: qn } = M, Xr = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1508
- const i = {
1509
- ...r,
1510
- ...o
1511
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1512
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1513
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1514
- c.length,
1515
- -p.length || void 0
1516
- ), b = k(n, t), $ = await e(f, {
1517
- ...i,
1518
- parser: "toml"
1519
- }), a = S(
1520
- $,
1521
- E,
1522
- b,
1523
- !0
1524
- );
1525
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1526
- return ee([
1527
- "`",
1528
- c,
1529
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [ee(a)] : Bn([ee(a)]),
1530
- p,
1531
- "`"
1532
- ]);
1533
- const h = c.length ? Pn : qn, v = p.length ? Pn : qn;
1534
- return ee([
1535
- "`",
1536
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, ee(a)] : Bn([h, ee(a)]),
1537
- v,
1538
- "`"
1539
- ]);
1540
- }, Ge = "embeddedToml", Qr = ["toml"], Yr = D(Ge), jn = A(Ge), Un = T(Ge), Vr = {
1541
- [Yr]: {
1542
- category: "Embed",
1543
- type: "string",
1544
- array: !0,
1545
- default: [{ value: [...Qr] }],
1546
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.",
1547
- deprecated: `Please use \`${jn}\` or \`${Un}\`.`
1548
- },
1549
- [jn]: {
1550
- category: "Embed",
1551
- type: "string",
1552
- array: !0,
1553
- default: [{ value: [_] }],
1554
- description: "Block comments that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin."
1555
- },
1556
- [Un]: {
1557
- category: "Embed",
1558
- type: "string",
1559
- array: !0,
1560
- default: [{ value: [_] }],
1561
- description: "Tags that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin."
1562
- }
1563
- }, Zr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1564
- __proto__: null,
1565
- embedder: Xr,
1566
- language: Ge,
1567
- options: Vr
1568
- }, Symbol.toStringTag, { value: "Module" })), { line: Rn, group: te, indent: Cn, softline: wn } = M, eo = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1569
- const i = {
1570
- ...r,
1571
- ...o
1572
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1573
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1574
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1575
- c.length,
1576
- -p.length || void 0
1577
- ), b = k(n, t), $ = await e(f, {
1578
- ...i,
1579
- parser: i.embeddedTsParser ?? "typescript",
1580
- // set filepath to undefined to enable jsx auto detection:
1581
- // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
1582
- filepath: void 0
1583
- }), a = S($, E, b);
1584
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1585
- return te([
1586
- "`",
1587
- c,
1588
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [te(a)] : Cn([te(a)]),
1589
- p,
1590
- "`"
1591
- ]);
1592
- const h = c.length ? Rn : wn, v = p.length ? Rn : wn;
1593
- return te([
1594
- "`",
1595
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, te(a)] : Cn([h, te(a)]),
1596
- v,
1597
- "`"
1598
- ]);
1599
- }, pe = "embeddedTs", to = [
1600
- "ts",
1601
- "tsx",
1602
- "cts",
1603
- "mts",
1604
- "typescript"
1605
- ], no = ["typescript", "babel-ts"], io = D(pe), Fn = A(pe), Wn = T(pe), so = O(pe), ro = {
1606
- [io]: {
1607
- category: "Embed",
1608
- type: "string",
1609
- array: !0,
1610
- default: [{ value: [...to] }],
1611
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language.",
1612
- deprecated: `Please use \`${Fn}\` or \`${Wn}\`.`
1613
- },
1614
- [Fn]: {
1615
- category: "Embed",
1616
- type: "string",
1617
- array: !0,
1618
- default: [{ value: [_] }],
1619
- description: "Block comments that make their subsequent template literals be identified as embedded TypeScript language."
1620
- },
1621
- [Wn]: {
1622
- category: "Embed",
1623
- type: "string",
1624
- array: !0,
1625
- default: [{ value: [_] }],
1626
- description: "Tags that make their subsequent template literals be identified as embedded TypeScript language."
1627
- },
1628
- [so]: {
1629
- category: "Embed",
1630
- type: "choice",
1631
- default: "typescript",
1632
- description: "The parser used to parse the embedded TypeScript language.",
1633
- choices: no.map((e) => ({
1634
- value: e,
1635
- description: `Use the "${e}" parser.`
1636
- }))
1637
- }
1638
- }, oo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1639
- __proto__: null,
1640
- embedder: eo,
1641
- language: pe,
1642
- options: ro
1643
- }, Symbol.toStringTag, { value: "Module" })), ge = "embeddedXml", { line: zn, group: ne, indent: Kn, softline: Oe } = M, ao = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1644
- const i = {
1645
- ...r,
1646
- ...o
1647
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1648
- (g, y, { length: G }) => y === G - 1 ? g.value.cooked : g.value.cooked + u(y)
1649
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1650
- c.length,
1651
- -p.length || void 0
1652
- ), b = k(n, t), $ = [];
1653
- let a = 0;
1654
- for (; a !== void 0; ) {
1655
- const g = f.slice(a);
1656
- if (g.length === 0)
1657
- break;
1658
- a > 0 && i.xmlWhitespaceSensitivity !== "strict" && $.push(Oe), i.__embeddedXmlFragmentRecoverIndex?.splice(
1659
- 0,
1660
- i.__embeddedXmlFragmentRecoverIndex.length
1661
- );
1662
- let y = await e(g, {
1663
- ...i,
1664
- parser: ge
1665
- });
1666
- const [G, N] = i.__embeddedXmlFragmentRecoverIndex ?? [];
1667
- G === void 0 ? a = void 0 : N === void 0 ? a += G : (y = g.slice(G, N + 1), a += N + 1), $.push(y);
1668
- }
1669
- const h = S($, E, b);
1670
- if (i.xmlWhitespaceSensitivity === "strict" || i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1671
- return ne([
1672
- "`",
1673
- c,
1674
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [ne(h)] : Kn([ne(h)]),
1675
- p,
1676
- "`"
1677
- ]);
1678
- const v = c.length ? zn : Oe, m = p.length ? zn : Oe;
1679
- return ne([
1680
- "`",
1681
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [v, ne(h)] : Kn([v, ne(h)]),
1682
- m,
1683
- "`"
1684
- ]);
1685
- }, lo = ["xml", "opml", "rss", "svg"], co = D(ge), Jn = A(ge), Hn = T(ge), uo = {
1686
- [co]: {
1687
- category: "Embed",
1688
- type: "string",
1689
- array: !0,
1690
- default: [{ value: [...lo] }],
1691
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin.",
1692
- deprecated: `Please use \`${Jn}\` or \`${Hn}\`.`
1693
- },
1694
- [Jn]: {
1695
- category: "Embed",
1696
- type: "string",
1697
- array: !0,
1698
- default: [{ value: [_] }],
1699
- description: "Block comments that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin."
1700
- },
1701
- [Hn]: {
1702
- category: "Embed",
1703
- type: "string",
1704
- array: !0,
1705
- default: [{ value: [_] }],
1706
- description: "Tags that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin."
1707
- },
1708
- /**
1709
- * @internal
1710
- */
1711
- __embeddedXmlFragmentRecoverIndex: {
1712
- category: "Embed",
1713
- type: "int",
1714
- array: !0,
1715
- default: [{ value: [] }],
1716
- description: "This option is read only and is used internally as a workaround to support xml fragments"
1717
- }
1718
- };
1719
- function po(e) {
1720
- const t = {
1721
- loc: {
1722
- start: {
1723
- line: e.line,
1724
- column: e.column
1725
- },
1726
- end: {
1727
- line: e.line,
1728
- column: e.column + e.length
1729
- }
1730
- }
1731
- }, n = new SyntaxError(
1732
- `${e.message} (${t.loc.start.line}:${t.loc.start.column})`,
1733
- {
1734
- cause: e
1735
- }
1736
- );
1737
- return Object.assign(n, t), n;
683
+ var Gt = Kt({});
684
+ function Kt(e) {
685
+ return t.withOptions = (t) => Kt(Vt(Vt({}, e), t)), t;
686
+ function t(t, ...n) {
687
+ let r = typeof t == "string" ? [t] : t.raw, { alignValues: i = !1, escapeSpecialCharacters: a = Array.isArray(t), trimWhitespace: o = !0 } = e, s = "";
688
+ for (let e = 0; e < r.length; e++) {
689
+ let t = r[e];
690
+ if (a && (t = t.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), s += t, e < n.length) {
691
+ let t = i ? qt(n[e], s) : n[e];
692
+ s += t;
693
+ }
694
+ }
695
+ let c = s.split("\n"), l = null;
696
+ for (let e of c) {
697
+ let t = e.match(/^(\s+)\S+/);
698
+ if (t) {
699
+ let e = t[1].length;
700
+ l = l ? Math.min(l, e) : e;
701
+ }
702
+ }
703
+ if (l !== null) {
704
+ let e = l;
705
+ s = c.map((t) => t[0] === " " || t[0] === " " ? t.slice(e) : t).join("\n");
706
+ }
707
+ return o && (s = s.trim()), a && (s = s.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (e, t) => String.fromCharCode(parseInt(t, 16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g, (e, t) => String.fromCodePoint(parseInt(t, 16))).replace(/\\u([\da-fA-F]{4})/g, (e, t) => String.fromCharCode(parseInt(t, 16)))), typeof Bun < "u" && (s = s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g, (e, t, n) => {
708
+ let r = t ?? n ?? "";
709
+ return String.fromCodePoint(parseInt(r, 16));
710
+ })), s;
711
+ }
1738
712
  }
1739
- function Xn(e) {
1740
- const t = {
1741
- loc: {
1742
- start: {
1743
- line: e.token.startLine ?? Number.NaN,
1744
- column: e.token.startColumn ?? Number.NaN
1745
- },
1746
- end: {
1747
- line: e.token.endLine ?? Number.NaN,
1748
- column: e.token.endColumn ?? Number.NaN
1749
- }
1750
- }
1751
- }, n = new SyntaxError(
1752
- `${e.message} (${t.loc.start.line}:${t.loc.start.column})`,
1753
- {
1754
- cause: e
1755
- }
1756
- );
1757
- return Object.assign(n, t), n;
713
+ function qt(e, t) {
714
+ if (typeof e != "string" || !e.includes("\n")) return e;
715
+ let n = t.slice(t.lastIndexOf("\n") + 1).match(/^(\s+)/);
716
+ if (n) {
717
+ let t = n[1];
718
+ return e.replace(/\n/g, `\n${t}`);
719
+ }
720
+ return e;
1758
721
  }
1759
- const go = {
1760
- async parse(e, t) {
1761
- const { parse: n } = await import("@xml-tools/parser"), { lexErrors: r, parseErrors: s, cst: o } = n(e);
1762
- if (r.length > 0) {
1763
- const i = r[0];
1764
- throw po(i);
1765
- }
1766
- if (s.length > 0) {
1767
- let i = !1;
1768
- for (const l of s) {
1769
- if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
1770
- l.name
1771
- ))
1772
- throw Xn(l);
1773
- if (l.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
1774
- i = !0;
1775
- continue;
1776
- }
1777
- if (/Expecting token of type --> EOF <-- but found --> '[\s\S]+' <--/.test(
1778
- l.message
1779
- ) || /Redundant input, expecting EOF but found: /.test(l.message)) {
1780
- t.__embeddedXmlFragmentRecoverIndex?.splice(
1781
- 0,
1782
- t.__embeddedXmlFragmentRecoverIndex.length,
1783
- l.token.startOffset
1784
- );
1785
- break;
1786
- }
1787
- if (/Expecting token of type --> OPEN <-- but found --> '[\s\S]+' <--/.test(
1788
- l.message
1789
- )) {
1790
- if (l.token.endOffset === void 0 || Number.isNaN(l.token.endOffset))
1791
- break;
1792
- t.__embeddedXmlFragmentRecoverIndex?.splice(
1793
- 0,
1794
- t.__embeddedXmlFragmentRecoverIndex.length,
1795
- l.token.startOffset,
1796
- l.token.endOffset
1797
- ), i = !0;
1798
- break;
1799
- }
1800
- throw Xn(l);
1801
- }
1802
- i && ai(o);
1803
- }
1804
- return o;
1805
- },
1806
- astFormat: "xml",
1807
- locStart(e) {
1808
- return e.location.startOffset;
1809
- },
1810
- locEnd(e) {
1811
- return e.location.endOffset ?? Number.NaN;
1812
- }
722
+ //#endregion
723
+ //#region src/embedded/markdown/embedder.ts
724
+ var { line: Jt, group: R, indent: Yt, softline: Xt, dedentToRoot: Zt, literalline: Qt } = e, $t = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
725
+ let o = {
726
+ ...r,
727
+ ...a
728
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t), m = b(await e(Gt(u), {
729
+ ...o,
730
+ parser: o.embeddedMarkdownParser ?? "markdown",
731
+ __inJsTemplate: !0
732
+ }), l, p, "hardline");
733
+ if (o.preserveEmbeddedExteriorWhitespaces?.includes(i)) return R([
734
+ "`",
735
+ d,
736
+ o.noEmbeddedMultiLineIndentation?.includes(i) ? Zt(R(m)) : Yt([R(m)]),
737
+ f,
738
+ "`"
739
+ ]);
740
+ let h = d.length ? Jt : Xt, ee = f.length ? Jt : Xt;
741
+ return o.noEmbeddedMultiLineIndentation?.includes(i) ? [
742
+ "`",
743
+ Qt,
744
+ Zt(m),
745
+ Xt,
746
+ "`"
747
+ ] : R([
748
+ "`",
749
+ Yt([h, R(m)]),
750
+ ee,
751
+ "`"
752
+ ]);
753
+ }, z = "embeddedMarkdown", en = ["md", "markdown"], tn = [
754
+ "markdown",
755
+ "mdx",
756
+ "remark"
757
+ ], nn = C(z), rn = w(z), an = T(z), on = E(z), sn = {
758
+ [nn]: {
759
+ category: "Embed",
760
+ type: "string",
761
+ array: !0,
762
+ default: [{ value: [...en] }],
763
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language.",
764
+ deprecated: `Please use \`${rn}\` or \`${an}\`.`
765
+ },
766
+ [rn]: {
767
+ category: "Embed",
768
+ type: "string",
769
+ array: !0,
770
+ default: [{ value: [D] }],
771
+ description: "Block comments that make their subsequent template literals be identified as embedded Markdown language."
772
+ },
773
+ [an]: {
774
+ category: "Embed",
775
+ type: "string",
776
+ array: !0,
777
+ default: [{ value: [D] }],
778
+ description: "Tags that make their subsequent template literals be identified as embedded Markdown language."
779
+ },
780
+ [on]: {
781
+ category: "Embed",
782
+ type: "choice",
783
+ default: "markdown",
784
+ description: "The parser used to parse the embedded Markdown language.",
785
+ choices: tn.map((e) => ({
786
+ value: e,
787
+ description: `Use the "${e}" parser.`
788
+ }))
789
+ }
790
+ }, cn = /* @__PURE__ */ p({
791
+ embedder: () => $t,
792
+ language: () => z,
793
+ options: () => sn
794
+ }), ln = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
795
+ let o = {
796
+ ...r,
797
+ ...a
798
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
799
+ return v(b(await e(u, {
800
+ ...o,
801
+ parser: "nginx"
802
+ }), l, p), o, i, d, f);
803
+ }, B = "embeddedNginx", un = ["nginx"], dn = C(B), fn = w(B), pn = T(B), mn = {
804
+ [dn]: {
805
+ category: "Embed",
806
+ type: "string",
807
+ array: !0,
808
+ default: [{ value: [...un] }],
809
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin.",
810
+ deprecated: `Please use \`${fn}\` or \`${pn}\`.`
811
+ },
812
+ [fn]: {
813
+ category: "Embed",
814
+ type: "string",
815
+ array: !0,
816
+ default: [{ value: [D] }],
817
+ description: "Block comments that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
818
+ },
819
+ [pn]: {
820
+ category: "Embed",
821
+ type: "string",
822
+ array: !0,
823
+ default: [{ value: [D] }],
824
+ description: "Tags that make their subsequent template literals be identified as embedded NGINX language. This option requires the `prettier-plugin-nginx` plugin."
825
+ }
826
+ }, hn = /* @__PURE__ */ p({
827
+ embedder: () => ln,
828
+ language: () => B,
829
+ options: () => mn
830
+ }), V = "embeddedNoop", gn = C(V), _n = w(V), vn = T(V), yn = {
831
+ [gn]: {
832
+ category: "Embed",
833
+ type: "string",
834
+ array: !0,
835
+ default: [{ value: [] }],
836
+ description: "Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted.",
837
+ deprecated: `Please use \`${_n}\` or \`${vn}\`.`
838
+ },
839
+ [_n]: {
840
+ category: "Embed",
841
+ type: "string",
842
+ array: !0,
843
+ default: [{ value: [D] }],
844
+ description: "Block comments that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
845
+ },
846
+ [vn]: {
847
+ category: "Embed",
848
+ type: "string",
849
+ array: !0,
850
+ default: [{ value: [D] }],
851
+ description: "Tags that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
852
+ }
853
+ }, bn = /* @__PURE__ */ p({
854
+ language: () => V,
855
+ options: () => yn
856
+ }), xn = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
857
+ let o = {
858
+ ...r,
859
+ ...a
860
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
861
+ return v(b(await e(u, {
862
+ ...o,
863
+ parser: "pegjs-parser"
864
+ }), l, p), o, i, d, f);
865
+ }, H = "embeddedPegjs", Sn = [
866
+ "pegjs",
867
+ "peggy",
868
+ "peg"
869
+ ], Cn = C(H), wn = w(H), Tn = T(H), En = {
870
+ [Cn]: {
871
+ category: "Embed",
872
+ type: "string",
873
+ array: !0,
874
+ default: [{ value: [...Sn] }],
875
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin.",
876
+ deprecated: `Please use \`${wn}\` or \`${Tn}\`.`
877
+ },
878
+ [wn]: {
879
+ category: "Embed",
880
+ type: "string",
881
+ array: !0,
882
+ default: [{ value: [D] }],
883
+ description: "Block comments that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
884
+ },
885
+ [Tn]: {
886
+ category: "Embed",
887
+ type: "string",
888
+ array: !0,
889
+ default: [{ value: [D] }],
890
+ description: "Tags that make their subsequent template literals be identified as embedded Pegjs language. This option requires the `prettier-plugin-pegjs` plugin."
891
+ }
892
+ }, Dn = /* @__PURE__ */ p({
893
+ embedder: () => xn,
894
+ language: () => H,
895
+ options: () => En
896
+ }), On = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
897
+ let o = {
898
+ ...r,
899
+ ...a
900
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S("$p"), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
901
+ return v(b(await e(u, {
902
+ ...o,
903
+ parser: "php"
904
+ }), l, p), o, i, d, f);
905
+ }, U = "embeddedPhp", kn = ["php", "php5"], An = C(U), jn = w(U), Mn = T(U), Nn = {
906
+ [An]: {
907
+ category: "Embed",
908
+ type: "string",
909
+ array: !0,
910
+ default: [{ value: [...kn] }],
911
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin.",
912
+ deprecated: `Please use \`${jn}\` or \`${Mn}\`.`
913
+ },
914
+ [jn]: {
915
+ category: "Embed",
916
+ type: "string",
917
+ array: !0,
918
+ default: [{ value: [D] }],
919
+ description: "Block comments that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
920
+ },
921
+ [Mn]: {
922
+ category: "Embed",
923
+ type: "string",
924
+ array: !0,
925
+ default: [{ value: [D] }],
926
+ description: "Tags that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
927
+ }
928
+ }, Pn = /* @__PURE__ */ p({
929
+ embedder: () => On,
930
+ language: () => U,
931
+ options: () => Nn
932
+ }), Fn = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
933
+ let o = {
934
+ ...r,
935
+ ...a
936
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
937
+ return v(b(await e(u, {
938
+ ...o,
939
+ parser: "prisma-parse"
940
+ }), l, p, "hardline"), o, i, d, f);
941
+ }, W = "embeddedPrisma", In = ["prisma"], Ln = C(W), Rn = w(W), zn = T(W), Bn = {
942
+ [Ln]: {
943
+ category: "Embed",
944
+ type: "string",
945
+ array: !0,
946
+ default: [{ value: [...In] }],
947
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin.",
948
+ deprecated: `Please use \`${Rn}\` or \`${zn}\`.`
949
+ },
950
+ [Rn]: {
951
+ category: "Embed",
952
+ type: "string",
953
+ array: !0,
954
+ default: [{ value: [D] }],
955
+ description: "Block comments that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
956
+ },
957
+ [zn]: {
958
+ category: "Embed",
959
+ type: "string",
960
+ array: !0,
961
+ default: [{ value: [D] }],
962
+ description: "Tags that make their subsequent template literals be identified as embedded Prisma language. This option requires the `prettier-plugin-prisma` plugin."
963
+ }
964
+ }, Vn = /* @__PURE__ */ p({
965
+ embedder: () => Fn,
966
+ language: () => W,
967
+ options: () => Bn
968
+ }), Hn = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
969
+ let o = {
970
+ ...r,
971
+ ...a
972
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
973
+ return v(b(await e(u, {
974
+ ...o,
975
+ parser: "dot-properties"
976
+ }), l, p), o, i, d, f);
977
+ }, G = "embeddedProperties", Un = ["properties"], Wn = C(G), Gn = w(G), Kn = T(G), qn = {
978
+ [Wn]: {
979
+ category: "Embed",
980
+ type: "string",
981
+ array: !0,
982
+ default: [{ value: [...Un] }],
983
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin.",
984
+ deprecated: `Please use \`${Gn}\` or \`${Kn}\`.`
985
+ },
986
+ [Gn]: {
987
+ category: "Embed",
988
+ type: "string",
989
+ array: !0,
990
+ default: [{ value: [D] }],
991
+ description: "Block comments that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
992
+ },
993
+ [Kn]: {
994
+ category: "Embed",
995
+ type: "string",
996
+ array: !0,
997
+ default: [{ value: [D] }],
998
+ description: "Tags that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
999
+ }
1000
+ }, Jn = /* @__PURE__ */ p({
1001
+ embedder: () => Hn,
1002
+ language: () => G,
1003
+ options: () => qn
1004
+ }), Yn = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1005
+ let o = {
1006
+ ...r,
1007
+ ...a
1008
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
1009
+ return v(b(await e(u, {
1010
+ ...o,
1011
+ parser: "pug"
1012
+ }), l, p, "hardline"), o, i, d, f);
1013
+ }, K = "embeddedPug", Xn = ["pug", "jade"], Zn = C(K), Qn = w(K), $n = T(K), er = {
1014
+ [Zn]: {
1015
+ category: "Embed",
1016
+ type: "string",
1017
+ array: !0,
1018
+ default: [{ value: [...Xn] }],
1019
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin.",
1020
+ deprecated: `Please use \`${Qn}\` or \`${$n}\`.`
1021
+ },
1022
+ [Qn]: {
1023
+ category: "Embed",
1024
+ type: "string",
1025
+ array: !0,
1026
+ default: [{ value: [D] }],
1027
+ description: "Block comments that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
1028
+ },
1029
+ [$n]: {
1030
+ category: "Embed",
1031
+ type: "string",
1032
+ array: !0,
1033
+ default: [{ value: [D] }],
1034
+ description: "Tags that make their subsequent template literals be identified as embedded Pug language. This option requires the `@prettier/plugin-pug` plugin."
1035
+ }
1036
+ }, tr = /* @__PURE__ */ p({
1037
+ embedder: () => Yn,
1038
+ language: () => K,
1039
+ options: () => er
1040
+ }), nr = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1041
+ let o = {
1042
+ ...r,
1043
+ ...a
1044
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
1045
+ return v(b(await e(u, {
1046
+ ...o,
1047
+ parser: o.embeddedRubyParser ?? "ruby"
1048
+ }), l, p), o, i, d, f);
1049
+ }, q = "embeddedRuby", rr = ["ruby"], ir = [
1050
+ "ruby",
1051
+ "rbs",
1052
+ "haml"
1053
+ ], ar = C(q), or = w(q), sr = T(q), cr = E(q), lr = {
1054
+ [ar]: {
1055
+ category: "Embed",
1056
+ type: "string",
1057
+ array: !0,
1058
+ default: [{ value: [...rr] }],
1059
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
1060
+ deprecated: `Please use \`${or}\` or \`${sr}\`.`
1061
+ },
1062
+ [or]: {
1063
+ category: "Embed",
1064
+ type: "string",
1065
+ array: !0,
1066
+ default: [{ value: [D] }],
1067
+ description: "Block comments that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
1068
+ },
1069
+ [sr]: {
1070
+ category: "Embed",
1071
+ type: "string",
1072
+ array: !0,
1073
+ default: [{ value: [D] }],
1074
+ description: "Tags that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
1075
+ },
1076
+ [cr]: {
1077
+ category: "Embed",
1078
+ type: "choice",
1079
+ default: "ruby",
1080
+ description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
1081
+ choices: ir.map((e) => ({
1082
+ value: e,
1083
+ description: `Use the "${e}" parser.`
1084
+ }))
1085
+ }
1086
+ }, ur = /* @__PURE__ */ p({
1087
+ embedder: () => nr,
1088
+ language: () => q,
1089
+ options: () => lr
1090
+ }), dr = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1091
+ let o = {
1092
+ ...r,
1093
+ ...a
1094
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
1095
+ return v(b(await e(u, {
1096
+ ...o,
1097
+ parser: "sh"
1098
+ }), l, p, "hardline"), o, i, d, f);
1099
+ }, J = "embeddedSh", fr = ["sh"], pr = C(J), mr = w(J), hr = T(J), gr = {
1100
+ [pr]: {
1101
+ category: "Embed",
1102
+ type: "string",
1103
+ array: !0,
1104
+ default: [{ value: [...fr] }],
1105
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin.",
1106
+ deprecated: `Please use \`${mr}\` or \`${hr}\`.`
1107
+ },
1108
+ [mr]: {
1109
+ category: "Embed",
1110
+ type: "string",
1111
+ array: !0,
1112
+ default: [{ value: [D] }],
1113
+ description: "Block comments that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
1114
+ },
1115
+ [hr]: {
1116
+ category: "Embed",
1117
+ type: "string",
1118
+ array: !0,
1119
+ default: [{ value: [D] }],
1120
+ description: "Tags that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
1121
+ }
1122
+ }, _r = /* @__PURE__ */ p({
1123
+ embedder: () => dr,
1124
+ language: () => J,
1125
+ options: () => gr
1126
+ }), vr = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1127
+ let o = {
1128
+ ...r,
1129
+ ...a
1130
+ }, s = o.embeddedSqlPlugin ?? "prettier-plugin-sql", { node: c } = n, { createPlaceholder: l, placeholderRegex: u } = S(), { trimmedText: d, leadingWhitespaces: f, trailingWhitespaces: p } = _(c, l), m = y(n, t, o, !1), h;
1131
+ if (s === "prettier-plugin-sql-cst") h = b(await e(d, {
1132
+ ...o,
1133
+ parser: o.embeddedSqlParser ?? "sqlite"
1134
+ }), u, m);
1135
+ else {
1136
+ let t = new Set(c.quasis.slice(0, -1).flatMap((e, t) => /\n[\t ]*$/.test(e.value.raw) ? [t] : []));
1137
+ h = b(await e(Gt(d), {
1138
+ ...o,
1139
+ parser: "sql"
1140
+ }), u, m, "hardline", t, o.tabWidth ?? 2);
1141
+ }
1142
+ return v(h, o, i, f, p);
1143
+ }, Y = "embeddedSql", yr = ["sql"], br = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], xr = [
1144
+ "sqlite",
1145
+ "bigquery",
1146
+ "mysql",
1147
+ "mariadb",
1148
+ "postgresql"
1149
+ ], Sr = C(Y), Cr = w(Y), wr = T(Y), Tr = pe(Y), Er = E(Y), Dr = {
1150
+ [Sr]: {
1151
+ category: "Embed",
1152
+ type: "string",
1153
+ array: !0,
1154
+ default: [{ value: [...yr] }],
1155
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.",
1156
+ deprecated: `Please use \`${Cr}\` or \`${wr}\`.`
1157
+ },
1158
+ [Cr]: {
1159
+ category: "Embed",
1160
+ type: "string",
1161
+ array: !0,
1162
+ default: [{ value: [D] }],
1163
+ description: "Block comments that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin."
1164
+ },
1165
+ [wr]: {
1166
+ category: "Embed",
1167
+ type: "string",
1168
+ array: !0,
1169
+ default: [{ value: [D] }],
1170
+ description: "Tags that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin."
1171
+ },
1172
+ [Tr]: {
1173
+ category: "Embed",
1174
+ type: "choice",
1175
+ default: "prettier-plugin-sql",
1176
+ description: "The plugin used to format the embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.",
1177
+ choices: br.map((e) => ({
1178
+ value: e,
1179
+ description: `Use the "${e}" plugin.`
1180
+ }))
1181
+ },
1182
+ [Er]: {
1183
+ category: "Embed",
1184
+ type: "choice",
1185
+ default: "sqlite",
1186
+ description: "Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.",
1187
+ choices: xr.map((e) => ({
1188
+ value: e,
1189
+ description: `Use the "${e}" parser.`
1190
+ }))
1191
+ }
1192
+ }, Or = /* @__PURE__ */ p({
1193
+ embedder: () => vr,
1194
+ language: () => Y,
1195
+ options: () => Dr
1196
+ }), kr = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1197
+ let o = {
1198
+ ...r,
1199
+ ...a
1200
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
1201
+ return v(b(await e(u, {
1202
+ ...o,
1203
+ parser: "toml"
1204
+ }), l, p, "hardline"), o, i, d, f);
1205
+ }, X = "embeddedToml", Ar = ["toml"], jr = C(X), Mr = w(X), Nr = T(X), Pr = {
1206
+ [jr]: {
1207
+ category: "Embed",
1208
+ type: "string",
1209
+ array: !0,
1210
+ default: [{ value: [...Ar] }],
1211
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin.",
1212
+ deprecated: `Please use \`${Mr}\` or \`${Nr}\`.`
1213
+ },
1214
+ [Mr]: {
1215
+ category: "Embed",
1216
+ type: "string",
1217
+ array: !0,
1218
+ default: [{ value: [D] }],
1219
+ description: "Block comments that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin."
1220
+ },
1221
+ [Nr]: {
1222
+ category: "Embed",
1223
+ type: "string",
1224
+ array: !0,
1225
+ default: [{ value: [D] }],
1226
+ description: "Tags that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin."
1227
+ }
1228
+ }, Fr = /* @__PURE__ */ p({
1229
+ embedder: () => kr,
1230
+ language: () => X,
1231
+ options: () => Pr
1232
+ }), Ir = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1233
+ let o = {
1234
+ ...r,
1235
+ ...a
1236
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t);
1237
+ return v(b(await e(u, {
1238
+ ...o,
1239
+ parser: o.embeddedTsParser ?? "typescript",
1240
+ filepath: void 0
1241
+ }), l, p), o, i, d, f);
1242
+ }, Z = "embeddedTs", Lr = [
1243
+ "ts",
1244
+ "tsx",
1245
+ "cts",
1246
+ "mts",
1247
+ "typescript"
1248
+ ], Rr = ["typescript", "babel-ts"], zr = C(Z), Br = w(Z), Vr = T(Z), Hr = E(Z), Ur = {
1249
+ [zr]: {
1250
+ category: "Embed",
1251
+ type: "string",
1252
+ array: !0,
1253
+ default: [{ value: [...Lr] }],
1254
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language.",
1255
+ deprecated: `Please use \`${Br}\` or \`${Vr}\`.`
1256
+ },
1257
+ [Br]: {
1258
+ category: "Embed",
1259
+ type: "string",
1260
+ array: !0,
1261
+ default: [{ value: [D] }],
1262
+ description: "Block comments that make their subsequent template literals be identified as embedded TypeScript language."
1263
+ },
1264
+ [Vr]: {
1265
+ category: "Embed",
1266
+ type: "string",
1267
+ array: !0,
1268
+ default: [{ value: [D] }],
1269
+ description: "Tags that make their subsequent template literals be identified as embedded TypeScript language."
1270
+ },
1271
+ [Hr]: {
1272
+ category: "Embed",
1273
+ type: "choice",
1274
+ default: "typescript",
1275
+ description: "The parser used to parse the embedded TypeScript language.",
1276
+ choices: Rr.map((e) => ({
1277
+ value: e,
1278
+ description: `Use the "${e}" parser.`
1279
+ }))
1280
+ }
1281
+ }, Wr = /* @__PURE__ */ p({
1282
+ embedder: () => Ir,
1283
+ language: () => Z,
1284
+ options: () => Ur
1285
+ }), Q = "embeddedXml", { softline: Gr } = e, Kr = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1286
+ let o = {
1287
+ ...r,
1288
+ ...a
1289
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = y(n, t), m = [], h = 0;
1290
+ for (; h !== void 0;) {
1291
+ let t = u.slice(h);
1292
+ if (t.length === 0) break;
1293
+ h > 0 && o.xmlWhitespaceSensitivity !== "strict" && m.push(Gr), o.__embeddedXmlFragmentRecoverIndex?.splice(0, o.__embeddedXmlFragmentRecoverIndex.length);
1294
+ let n = await e(t, {
1295
+ ...o,
1296
+ parser: Q
1297
+ }), [r, i] = o.__embeddedXmlFragmentRecoverIndex ?? [];
1298
+ r === void 0 ? h = void 0 : i === void 0 ? h += r : (n = t.slice(r, i + 1), h += i + 1), m.push(n);
1299
+ }
1300
+ return v(b(m, l, p), o, i, d, f, o.xmlWhitespaceSensitivity === "strict");
1301
+ }, qr = [
1302
+ "xml",
1303
+ "opml",
1304
+ "rss",
1305
+ "svg"
1306
+ ], Jr = C(Q), Yr = w(Q), Xr = T(Q), Zr = {
1307
+ [Jr]: {
1308
+ category: "Embed",
1309
+ type: "string",
1310
+ array: !0,
1311
+ default: [{ value: [...qr] }],
1312
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin.",
1313
+ deprecated: `Please use \`${Yr}\` or \`${Xr}\`.`
1314
+ },
1315
+ [Yr]: {
1316
+ category: "Embed",
1317
+ type: "string",
1318
+ array: !0,
1319
+ default: [{ value: [D] }],
1320
+ description: "Block comments that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin."
1321
+ },
1322
+ [Xr]: {
1323
+ category: "Embed",
1324
+ type: "string",
1325
+ array: !0,
1326
+ default: [{ value: [D] }],
1327
+ description: "Tags that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin."
1328
+ },
1329
+ __embeddedXmlFragmentRecoverIndex: {
1330
+ category: "Embed",
1331
+ type: "int",
1332
+ array: !0,
1333
+ default: [{ value: [] }],
1334
+ description: "This option is read only and is used internally as a workaround to support xml fragments"
1335
+ }
1813
1336
  };
1814
- function ai(e) {
1815
- const t = e.children;
1816
- for (const n in t) {
1817
- const r = t[n] ?? [];
1818
- for (let s = r.length - 1; s >= 0; --s) {
1819
- const o = r[s];
1820
- if (mo(o)) {
1821
- if (Object.keys(o.children).length === 0) {
1822
- r.splice(s, 1), r.length === 0 && delete t[n];
1823
- continue;
1824
- }
1825
- ai(o);
1826
- }
1827
- }
1828
- }
1337
+ //#endregion
1338
+ //#region src/embedded/xml/parser.ts
1339
+ function Qr(e, t) {
1340
+ if (t && Number.isFinite(t.line) && Number.isFinite(t.column)) return e.split("\n").slice(0, t.line - 1).reduce((e, t) => e + t.length + 1, 0) + t.column - 1;
1829
1341
  }
1830
- function mo(e) {
1831
- return "name" in e && "children" in e && "location" in e;
1342
+ async function $(e, t, n) {
1343
+ try {
1344
+ return await n.parse(e, t);
1345
+ } catch (r) {
1346
+ if (!(r instanceof Error)) throw r;
1347
+ let { loc: i } = r, a = Qr(e, i?.start), o = Qr(e, i?.end), s = t, c = (...e) => s.__embeddedXmlFragmentRecoverIndex?.splice(0, s.__embeddedXmlFragmentRecoverIndex.length, ...e), l = "Expecting token of type --> OPEN <-- but found --> ";
1348
+ if (r.message.startsWith(`${l}'' <--`)) {
1349
+ let r = await n.parse(`${e}<prettier-embed-fragment />`, t);
1350
+ return r.children ? delete r.children.element : r.element = null, r.location = {
1351
+ ...r.location,
1352
+ endOffset: e.length - 1
1353
+ }, r;
1354
+ }
1355
+ if (a !== void 0 && a > 0 && (r.message.startsWith("Expecting token of type --> EOF <--") || r.message.startsWith("Redundant input, expecting EOF but found: "))) return c(a), $(e.slice(0, a), t, n);
1356
+ if (a !== void 0 && o !== void 0 && r.message.startsWith(l)) return c(a, o), $("", t, n);
1357
+ throw r;
1358
+ }
1832
1359
  }
1833
- const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1834
- __proto__: null,
1835
- embedder: ao,
1836
- language: ge,
1837
- options: uo,
1838
- parser: go
1839
- }, Symbol.toStringTag, { value: "Module" })), { line: Qn, group: ie, indent: Yn, softline: Vn } = M, Eo = async (e, t, n, r, { commentOrTag: s, embeddedOverrideOptions: o }) => {
1840
- const i = {
1841
- ...r,
1842
- ...o
1843
- }, { node: l } = n, { createPlaceholder: u, placeholderRegex: E } = L(), d = l.quasis.map(
1844
- (m, g, { length: y }) => g === y - 1 ? m.value.cooked : m.value.cooked + u(g)
1845
- ).join(""), c = d.match(/^\s+/)?.[0] ?? "", p = d.match(/\s+$/)?.[0] ?? "", f = d.slice(
1846
- c.length,
1847
- -p.length || void 0
1848
- ), b = k(n, t), $ = await e(f, {
1849
- ...i,
1850
- parser: "yaml"
1851
- }), a = S($, E, b);
1852
- if (i.preserveEmbeddedExteriorWhitespaces?.includes(s))
1853
- return ie([
1854
- "`",
1855
- c,
1856
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [ie(a)] : Yn([ie(a)]),
1857
- p,
1858
- "`"
1859
- ]);
1860
- const h = c.length ? Qn : Vn, v = p.length ? Qn : Vn;
1861
- return ie([
1862
- "`",
1863
- i.noEmbeddedMultiLineIndentation?.includes(s) ? [h, ie(a)] : Yn([h, ie(a)]),
1864
- v,
1865
- "`"
1866
- ]);
1867
- }, Ne = "embeddedYaml", bo = ["yaml", "yml"], fo = D(Ne), Zn = A(Ne), ei = T(Ne), yo = {
1868
- [fo]: {
1869
- category: "Embed",
1870
- type: "string",
1871
- array: !0,
1872
- default: [{ value: [...bo] }],
1873
- description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded YAML language.",
1874
- deprecated: `Please use \`${Zn}\` or \`${ei}\`.`
1875
- },
1876
- [Zn]: {
1877
- category: "Embed",
1878
- type: "string",
1879
- array: !0,
1880
- default: [{ value: [_] }],
1881
- description: "Block comments that make their subsequent template literals be identified as embedded YAML language."
1882
- },
1883
- [ei]: {
1884
- category: "Embed",
1885
- type: "string",
1886
- array: !0,
1887
- default: [{ value: [_] }],
1888
- description: "Tags that make their subsequent template literals be identified as embedded YAML language."
1889
- }
1890
- }, _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1891
- __proto__: null,
1892
- embedder: Eo,
1893
- language: Ne,
1894
- options: yo
1895
- }, Symbol.toStringTag, { value: "Module" })), me = [], di = {}, li = {}, ci = {}, $o = /* @__PURE__ */ Object.assign({
1896
- "./css/index.ts": Ui,
1897
- "./es/index.ts": Ki,
1898
- "./glsl/index.ts": Yi,
1899
- "./graphql/index.ts": ns,
1900
- "./html/index.ts": cs,
1901
- "./ini/index.ts": hs,
1902
- "./java/index.ts": _s,
1903
- "./json/index.ts": ks,
1904
- "./jsonata/index.ts": xs,
1905
- "./latex/index.ts": js,
1906
- "./markdown/index.ts": Hs,
1907
- "./nginx/index.ts": Zs,
1908
- "./noop/index.ts": nr,
1909
- "./pegjs/index.ts": ar,
1910
- "./php/index.ts": pr,
1911
- "./prisma/index.ts": br,
1912
- "./properties/index.ts": vr,
1913
- "./pug/index.ts": Sr,
1914
- "./ruby/index.ts": Ir,
1915
- "./sh/index.ts": Ur,
1916
- "./sql/index.ts": Hr,
1917
- "./toml/index.ts": Zr,
1918
- "./ts/index.ts": oo,
1919
- "./xml/index.ts": ho,
1920
- "./yaml/index.ts": _o
1921
- });
1922
- for (const { language: e, parser: t, embedder: n, options: r } of Object.values($o))
1923
- Ni(me, e, ce), t && (di[e] = t), n && (li[e] = n), Object.assign(ci, r);
1924
- const vo = "noEmbeddedIdentificationByComment", Do = "noEmbeddedIdentificationByTag", To = "preserveEmbeddedExteriorWhitespaces", Mo = "noEmbeddedMultiLineIndentation", Ao = "embeddedOverrides", sa = {
1925
- ...ci,
1926
- /**
1927
- * @deprecated Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore.
1928
- */
1929
- [vo]: {
1930
- category: "Embed",
1931
- type: "string",
1932
- array: !0,
1933
- default: [{ value: [] }],
1934
- description: "Turns off `` /* comment */ `...` `` comment-based embedded language identification for the specified identifiers.",
1935
- deprecated: "Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore."
1936
- },
1937
- /**
1938
- * @deprecated Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore.
1939
- */
1940
- [Do]: {
1941
- category: "Embed",
1942
- type: "string",
1943
- array: !0,
1944
- default: [{ value: [] }],
1945
- description: "Turns off `` tag`...` `` tag-based embedded language identification for the specified identifiers.",
1946
- deprecated: "Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore."
1947
- },
1948
- [To]: {
1949
- category: "Embed",
1950
- type: "string",
1951
- array: !0,
1952
- default: [{ value: [] }],
1953
- description: "Preserves leading and trailing whitespaces in the formatting results for the specified comments or tags."
1954
- },
1955
- [Mo]: {
1956
- category: "Embed",
1957
- type: "string",
1958
- array: !0,
1959
- default: [{ value: [] }],
1960
- description: "Turns off auto indentation in the formatting results for the specified comments or tags when they are formatted to span multi lines."
1961
- },
1962
- [Ao]: {
1963
- category: "Embed",
1964
- type: "string",
1965
- array: !1,
1966
- default: void 0,
1967
- description: "Option overrides for the specified comments or tags. It should either be a stringified JSON or an absolute filepath to the option overrides file."
1968
- }
1969
- }, So = {
1970
- // parsers from internal
1971
- ...fi.parsers,
1972
- ...yi.parsers,
1973
- ..._i.parsers,
1974
- ...vi.parsers,
1975
- ...$i.parsers,
1976
- // parsers from this plugin
1977
- ...di
1978
- };
1979
- var ko = {
1980
- isEqual: !0,
1981
- isMatchingKey: !0,
1982
- isPromise: !0,
1983
- maxSize: !0,
1984
- onCacheAdd: !0,
1985
- onCacheChange: !0,
1986
- onCacheHit: !0,
1987
- transformKey: !0
1988
- }, Lo = Array.prototype.slice;
1989
- function Ee(e) {
1990
- var t = e.length;
1991
- return t ? t === 1 ? [e[0]] : t === 2 ? [e[0], e[1]] : t === 3 ? [e[0], e[1], e[2]] : Lo.call(e, 0) : [];
1360
+ function $r(e) {
1361
+ if (typeof e == "object" && e && "parsers" in e) return e.parsers?.xml;
1992
1362
  }
1993
- function Go(e) {
1994
- var t = {};
1995
- for (var n in e)
1996
- ko[n] || (t[n] = e[n]);
1997
- return t;
1363
+ function ei(e) {
1364
+ let t = $r(typeof e == "object" && e && "default" in e ? e.default : e);
1365
+ if (!t) throw Error("The XML plugin must provide the \"xml\" parser.");
1366
+ return t;
1998
1367
  }
1999
- function No(e) {
2000
- return typeof e == "function" && e.isMemoized;
1368
+ async function ti(e, t = () => import("@prettier/plugin-xml"), a = import.meta.url) {
1369
+ try {
1370
+ return ei(await t());
1371
+ } catch (t) {
1372
+ for (let t of [a, e ? r.resolve(e) : `${process.cwd()}/package.json`]) try {
1373
+ let e = n(t).resolve("@prettier/plugin-xml");
1374
+ return ei(await import(i(e).href));
1375
+ } catch {}
1376
+ throw Error("Formatting embedded XML requires the consumer to install and load \"@prettier/plugin-xml\".", { cause: t });
1377
+ }
2001
1378
  }
2002
- function Oo(e, t) {
2003
- return e === t || e !== e && t !== t;
1379
+ async function ni(e, t, n = ti) {
1380
+ for (let n = (t.plugins?.length ?? 0) - 1; n >= 0; n--) {
1381
+ let r = $r(t.plugins[n]);
1382
+ if (r) return $(e, t, r);
1383
+ }
1384
+ return $(e, t, await n(t.filepath));
2004
1385
  }
2005
- function ti(e, t) {
2006
- var n = {};
2007
- for (var r in e)
2008
- n[r] = e[r];
2009
- for (var r in t)
2010
- n[r] = t[r];
2011
- return n;
1386
+ var ri = {
1387
+ parse: ni,
1388
+ astFormat: "xml",
1389
+ locStart(e) {
1390
+ return e.location?.startOffset ?? 0;
1391
+ },
1392
+ locEnd(e) {
1393
+ return e.location?.endOffset ?? NaN;
1394
+ }
1395
+ }, ii = /* @__PURE__ */ p({
1396
+ embedder: () => Kr,
1397
+ language: () => Q,
1398
+ loadXmlParser: () => ti,
1399
+ options: () => Zr,
1400
+ parseWithXmlPlugin: () => $,
1401
+ parseXml: () => ni,
1402
+ parser: () => ri
1403
+ }), ai = async (e, t, n, r, { commentOrTag: i, embeddedOverrideOptions: a }) => {
1404
+ let o = {
1405
+ ...r,
1406
+ ...a
1407
+ }, { node: s } = n, { createPlaceholder: c, placeholderRegex: l } = S(), { trimmedText: u, leadingWhitespaces: d, trailingWhitespaces: f } = _(s, c), p = d.slice(d.lastIndexOf("\n") + 1), m = y(n, t);
1408
+ return v(b(await e(p ? u.replace(RegExp(`(\\r?\\n)${fe(p)}`, "g"), "$1") : u, {
1409
+ ...o,
1410
+ parser: "yaml"
1411
+ }), l, m), o, i, d, f);
1412
+ }, oi = "embeddedYaml", si = ["yaml", "yml"], ci = C(oi), li = w(oi), ui = T(oi), di = {
1413
+ [ci]: {
1414
+ category: "Embed",
1415
+ type: "string",
1416
+ array: !0,
1417
+ default: [{ value: [...si] }],
1418
+ description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded YAML language.",
1419
+ deprecated: `Please use \`${li}\` or \`${ui}\`.`
1420
+ },
1421
+ [li]: {
1422
+ category: "Embed",
1423
+ type: "string",
1424
+ array: !0,
1425
+ default: [{ value: [D] }],
1426
+ description: "Block comments that make their subsequent template literals be identified as embedded YAML language."
1427
+ },
1428
+ [ui]: {
1429
+ category: "Embed",
1430
+ type: "string",
1431
+ array: !0,
1432
+ default: [{ value: [D] }],
1433
+ description: "Tags that make their subsequent template literals be identified as embedded YAML language."
1434
+ }
1435
+ }, fi = /* @__PURE__ */ p({
1436
+ embedder: () => ai,
1437
+ language: () => oi,
1438
+ options: () => di
1439
+ }), pi = [], mi = {}, hi = {}, gi = {}, _i = /* #__PURE__ */ Object.assign({
1440
+ "./css/index.ts": Se,
1441
+ "./es/index.ts": je,
1442
+ "./glsl/index.ts": Re,
1443
+ "./graphql/index.ts": Ge,
1444
+ "./html/index.ts": tt,
1445
+ "./ini/index.ts": ct,
1446
+ "./java/index.ts": ht,
1447
+ "./json/index.ts": Tt,
1448
+ "./jsonata/index.ts": Mt,
1449
+ "./latex/index.ts": zt,
1450
+ "./markdown/index.ts": cn,
1451
+ "./nginx/index.ts": hn,
1452
+ "./noop/index.ts": bn,
1453
+ "./pegjs/index.ts": Dn,
1454
+ "./php/index.ts": Pn,
1455
+ "./prisma/index.ts": Vn,
1456
+ "./properties/index.ts": Jn,
1457
+ "./pug/index.ts": tr,
1458
+ "./ruby/index.ts": ur,
1459
+ "./sh/index.ts": _r,
1460
+ "./sql/index.ts": Or,
1461
+ "./toml/index.ts": Fr,
1462
+ "./ts/index.ts": Wr,
1463
+ "./xml/index.ts": ii,
1464
+ "./yaml/index.ts": fi
1465
+ });
1466
+ for (let { language: e, parser: t, embedder: n, options: r } of Object.values(_i)) de(pi, e, V), t && (mi[e] = t), n && (hi[e] = n), Object.assign(gi, r);
1467
+ //#endregion
1468
+ //#region src/options.ts
1469
+ var vi = "noEmbeddedIdentificationByComment", yi = "noEmbeddedIdentificationByTag", bi = "preserveEmbeddedExteriorWhitespaces", xi = "noEmbeddedMultiLineIndentation", Si = "embeddedOverrides", Ci = {
1470
+ ...gi,
1471
+ [vi]: {
1472
+ category: "Embed",
1473
+ type: "string",
1474
+ array: !0,
1475
+ default: [{ value: [] }],
1476
+ description: "Turns off `` /* comment */ `...` `` comment-based embedded language identification for the specified identifiers.",
1477
+ deprecated: "Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore."
1478
+ },
1479
+ [yi]: {
1480
+ category: "Embed",
1481
+ type: "string",
1482
+ array: !0,
1483
+ default: [{ value: [] }],
1484
+ description: "Turns off `` tag`...` `` tag-based embedded language identification for the specified identifiers.",
1485
+ deprecated: "Please use `embedded<Language>Comments` or `embedded<Language>Tags` to configure each embedded language, and you won't need this option anymore."
1486
+ },
1487
+ [bi]: {
1488
+ category: "Embed",
1489
+ type: "string",
1490
+ array: !0,
1491
+ default: [{ value: [] }],
1492
+ description: "Preserves leading and trailing whitespaces in the formatting results for the specified comments or tags."
1493
+ },
1494
+ [xi]: {
1495
+ category: "Embed",
1496
+ type: "string",
1497
+ array: !0,
1498
+ default: [{ value: [] }],
1499
+ description: "Turns off auto indentation in the formatting results for the specified comments or tags when they are formatted to span multi lines."
1500
+ },
1501
+ [Si]: {
1502
+ category: "Embed",
1503
+ type: "string",
1504
+ array: !1,
1505
+ default: void 0,
1506
+ description: "Option overrides for the specified comments or tags. It should either be a stringified JSON or an absolute filepath to the option overrides file."
1507
+ }
1508
+ }, wi = {
1509
+ ...a.parsers,
1510
+ ...o.parsers,
1511
+ ...s.parsers,
1512
+ ...l.parsers,
1513
+ ...c.parsers,
1514
+ ...mi
1515
+ }, Ti = /("(?:\\?[^])*?")|(\/\/.*)|(\/\*[^]*?\*\/)/g, Ei = /("(?:\\?[^])*?")|(,\s*)(?=]|})/g, Di = { parse: (e) => {
1516
+ e = String(e);
1517
+ try {
1518
+ return JSON.parse(e);
1519
+ } catch {
1520
+ return JSON.parse(e.replace(Ti, "$1").replace(Ei, "$1"));
1521
+ }
1522
+ } }, { label: Oi } = e;
1523
+ async function ki(e) {
1524
+ try {
1525
+ let { readFile: t } = await import("node:fs/promises"), n = await t(e, { encoding: "utf-8" });
1526
+ return Di.parse(n);
1527
+ } catch {}
2012
1528
  }
2013
- var xo = (
2014
- /** @class */
2015
- function() {
2016
- function e(t) {
2017
- this.keys = [], this.values = [], this.options = t;
2018
- var n = typeof t.isMatchingKey == "function";
2019
- n ? this.getKeyIndex = this._getKeyIndexFromMatchingKey : t.maxSize > 1 ? this.getKeyIndex = this._getKeyIndexForMany : this.getKeyIndex = this._getKeyIndexForSingle, this.canTransformKey = typeof t.transformKey == "function", this.shouldCloneArguments = this.canTransformKey || n, this.shouldUpdateOnAdd = typeof t.onCacheAdd == "function", this.shouldUpdateOnChange = typeof t.onCacheChange == "function", this.shouldUpdateOnHit = typeof t.onCacheHit == "function";
2020
- }
2021
- return Object.defineProperty(e.prototype, "size", {
2022
- /**
2023
- * The number of cached [key,value] results.
2024
- */
2025
- get: function() {
2026
- return this.keys.length;
2027
- },
2028
- enumerable: !1,
2029
- configurable: !0
2030
- }), Object.defineProperty(e.prototype, "snapshot", {
2031
- /**
2032
- * A copy of the cache at a moment in time. This is useful
2033
- * to compare changes over time, since the cache mutates
2034
- * internally for performance reasons.
2035
- */
2036
- get: function() {
2037
- return {
2038
- keys: Ee(this.keys),
2039
- size: this.size,
2040
- values: Ee(this.values)
2041
- };
2042
- },
2043
- enumerable: !1,
2044
- configurable: !0
2045
- }), e.prototype._getKeyIndexFromMatchingKey = function(t) {
2046
- var n = this.options, r = n.isMatchingKey, s = n.maxSize, o = this.keys, i = o.length;
2047
- if (!i)
2048
- return -1;
2049
- if (r(o[0], t))
2050
- return 0;
2051
- if (s > 1) {
2052
- for (var l = 1; l < i; l++)
2053
- if (r(o[l], t))
2054
- return l;
2055
- }
2056
- return -1;
2057
- }, e.prototype._getKeyIndexForMany = function(t) {
2058
- var n = this.options.isEqual, r = this.keys, s = r.length;
2059
- if (!s)
2060
- return -1;
2061
- if (s === 1)
2062
- return this._getKeyIndexForSingle(t);
2063
- var o = t.length, i, l;
2064
- if (o > 1) {
2065
- for (var u = 0; u < s; u++)
2066
- if (i = r[u], i.length === o) {
2067
- for (l = 0; l < o && n(i[l], t[l]); l++)
2068
- ;
2069
- if (l === o)
2070
- return u;
2071
- }
2072
- } else
2073
- for (var u = 0; u < s; u++)
2074
- if (i = r[u], i.length === o && n(i[0], t[0]))
2075
- return u;
2076
- return -1;
2077
- }, e.prototype._getKeyIndexForSingle = function(t) {
2078
- var n = this.keys;
2079
- if (!n.length)
2080
- return -1;
2081
- var r = n[0], s = r.length;
2082
- if (t.length !== s)
2083
- return -1;
2084
- var o = this.options.isEqual;
2085
- if (s > 1) {
2086
- for (var i = 0; i < s; i++)
2087
- if (!o(r[i], t[i]))
2088
- return -1;
2089
- return 0;
2090
- }
2091
- return o(r[0], t[0]) ? 0 : -1;
2092
- }, e.prototype.orderByLru = function(t, n, r) {
2093
- for (var s = this.keys, o = this.values, i = s.length, l = r; l--; )
2094
- s[l + 1] = s[l], o[l + 1] = o[l];
2095
- s[0] = t, o[0] = n;
2096
- var u = this.options.maxSize;
2097
- i === u && r === i ? (s.pop(), o.pop()) : r >= u && (s.length = o.length = u);
2098
- }, e.prototype.updateAsyncCache = function(t) {
2099
- var n = this, r = this.options, s = r.onCacheChange, o = r.onCacheHit, i = this.keys[0], l = this.values[0];
2100
- this.values[0] = l.then(function(u) {
2101
- return n.shouldUpdateOnHit && o(n, n.options, t), n.shouldUpdateOnChange && s(n, n.options, t), u;
2102
- }, function(u) {
2103
- var E = n.getKeyIndex(i);
2104
- throw E !== -1 && (n.keys.splice(E, 1), n.values.splice(E, 1)), u;
2105
- });
2106
- }, e;
2107
- }()
2108
- );
2109
- function ui(e, t) {
2110
- if (t === void 0 && (t = {}), No(e))
2111
- return ui(e.fn, ti(e.options, t));
2112
- if (typeof e != "function")
2113
- throw new TypeError("You must pass a function to `memoize`.");
2114
- var n = t.isEqual, r = n === void 0 ? Oo : n, s = t.isMatchingKey, o = t.isPromise, i = o === void 0 ? !1 : o, l = t.maxSize, u = l === void 0 ? 1 : l, E = t.onCacheAdd, d = t.onCacheChange, c = t.onCacheHit, p = t.transformKey, f = ti({
2115
- isEqual: r,
2116
- isMatchingKey: s,
2117
- isPromise: i,
2118
- maxSize: u,
2119
- onCacheAdd: E,
2120
- onCacheChange: d,
2121
- onCacheHit: c,
2122
- transformKey: p
2123
- }, Go(t)), b = new xo(f), $ = b.keys, a = b.values, h = b.canTransformKey, v = b.shouldCloneArguments, m = b.shouldUpdateOnAdd, g = b.shouldUpdateOnChange, y = b.shouldUpdateOnHit, G = function() {
2124
- var N = v ? Ee(arguments) : arguments;
2125
- h && (N = p(N));
2126
- var x = $.length ? b.getKeyIndex(N) : -1;
2127
- if (x !== -1)
2128
- y && c(b, f, G), x && (b.orderByLru($[x], a[x], x), g && d(b, f, G));
2129
- else {
2130
- var Ei = e.apply(this, arguments), bi = v ? N : Ee(arguments);
2131
- b.orderByLru(bi, Ei, $.length), i && b.updateAsyncCache(G), m && E(b, f, G), g && d(b, f, G);
2132
- }
2133
- return a[0];
2134
- };
2135
- return G.cache = b, G.fn = e, G.isMemoized = !0, G.options = f, G;
1529
+ var Ai = /* @__PURE__ */ new URL("./import-module-worker.js", import.meta.url);
1530
+ async function ji(e) {
1531
+ let { Worker: t } = await import("node:worker_threads");
1532
+ return new Promise((n) => {
1533
+ let r = new t(Ai, { workerData: { absolutePath: e } });
1534
+ r.once("message", (e) => {
1535
+ r.terminate(), e.error && console.error(e.error), n(e.overrides);
1536
+ }), r.once("error", (e) => {
1537
+ console.error(e), n(void 0);
1538
+ }), r.once("exit", () => {
1539
+ n(void 0);
1540
+ });
1541
+ });
2136
1542
  }
2137
- const Io = /("(?:\\?[^])*?")|(\/\/.*)|(\/\*[^]*?\*\/)/g, Po = /("(?:\\?[^])*?")|(,\s*)(?=]|})/g, Pe = {
2138
- parse: (e) => {
2139
- e = String(e);
2140
- try {
2141
- return JSON.parse(e);
2142
- } catch {
2143
- return JSON.parse(e.replace(Io, "$1").replace(Po, "$1"));
2144
- }
2145
- }
2146
- }, { label: Bo } = M;
2147
- async function ni(e) {
2148
- try {
2149
- const { readFile: t } = await import("node:fs/promises"), n = await t(e, { encoding: "utf-8" });
2150
- return Pe.parse(n);
2151
- } catch {
2152
- }
1543
+ async function Mi(e, t) {
1544
+ let { isAbsolute: n, dirname: r, resolve: i } = await import("node:path");
1545
+ if (n(e)) return e;
1546
+ let a = await d(t);
1547
+ return i(typeof a == "string" ? r(a) : process.env.PWD ?? process.cwd(), e);
2153
1548
  }
2154
- const qo = /* @__PURE__ */ new URL(
2155
- `data:text/javascript,${encodeURIComponent('import{pathToFileURL as o}from"node:url";import{parentPort as t,workerData as a}from"node:worker_threads";const s=async({absolutePath:r})=>{try{const e=await import(o(r).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}};s(a);')}`
2156
- ), jo = /* @__PURE__ */ new URL(
2157
- `data:text/javascript,${encodeURIComponent('import{register as a}from"node:module";import{pathToFileURL as s}from"node:url";import{parentPort as t,workerData as i}from"node:worker_threads";const d=async({absolutePath:r,importMetaUrl:o})=>{a("tsx/esm",{parentURL:o,data:!0});try{const e=await import(s(r).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}};d(i);')}`
2158
- );
2159
- async function Uo(e) {
2160
- const { Worker: t } = await import("node:worker_threads");
2161
- return new Promise((n) => {
2162
- const r = new t(qo, {
2163
- workerData: {
2164
- absolutePath: e
2165
- }
2166
- });
2167
- r.once("message", (s) => {
2168
- n(s);
2169
- }), r.once("error", (s) => {
2170
- console.error(s), n(void 0);
2171
- });
2172
- });
1549
+ var Ni = async (e, t) => {
1550
+ let n;
1551
+ try {
1552
+ n = (await import("node:path")).extname(e);
1553
+ } catch {
1554
+ try {
1555
+ return Di.parse(e);
1556
+ } catch {
1557
+ console.error("Failed to parse embeddedOverrides as a json object");
1558
+ return;
1559
+ }
1560
+ }
1561
+ let r = Mi(e, t);
1562
+ if (n === ".json" || n === ".jsonc") {
1563
+ let e = await r, t = await ki(e);
1564
+ if (t !== void 0) return t;
1565
+ console.error(`Failed to parse the json file: ${e}`);
1566
+ } else if (n === ".mjs" || n === ".cjs" || n === ".js") {
1567
+ let e = await r, t = await ji(e);
1568
+ if (t !== void 0) return t;
1569
+ console.error(`Failed to parse the js module file: ${e}`);
1570
+ } else if (n === ".mts" || n === ".cts" || n === ".ts") {
1571
+ let e = await r, t = await ji(e);
1572
+ if (t !== void 0) return t;
1573
+ console.error(`Failed to parse the ts module file: ${e}`);
1574
+ } else {
1575
+ if (n === "") {
1576
+ let e = await ki(await r);
1577
+ if (e !== void 0) return e;
1578
+ }
1579
+ try {
1580
+ return Di.parse(e);
1581
+ } catch {
1582
+ console.error("Failed to parse embeddedOverrides as a json object");
1583
+ }
1584
+ }
1585
+ }, Pi = /* @__PURE__ */ new WeakMap();
1586
+ async function Fi(e, { commentOrTag: t, kind: n }) {
1587
+ if (e.embeddedOverrides === void 0) return;
1588
+ let r = Pi.get(e);
1589
+ r === void 0 && (r = Ni(e.embeddedOverrides, e.filepath), Pi.set(e, r));
1590
+ let i = await r;
1591
+ if (i !== void 0) for (let { [`${n}s`]: e, identifiers: r, options: a } of i) {
1592
+ let n = e ?? [];
1593
+ if (n.length === 0 && r?.includes(t) || n.includes(t)) return a;
1594
+ }
2173
1595
  }
2174
- async function Ro(e) {
2175
- const { Worker: t } = await import("node:worker_threads");
2176
- return new Promise((n) => {
2177
- const r = new t(jo, {
2178
- workerData: {
2179
- absolutePath: e,
2180
- importMetaUrl: import.meta.url
2181
- }
2182
- });
2183
- r.once("message", (s) => {
2184
- n(s);
2185
- }), r.once("error", (s) => {
2186
- console.error(s), n(void 0);
2187
- });
2188
- });
1596
+ function* Ii(e) {
1597
+ yield e, e.type === "CallExpression" && (yield* Ii(e.callee));
2189
1598
  }
2190
- const Co = ui(
2191
- async (e, t) => {
2192
- const { isAbsolute: n, dirname: r, resolve: s } = await import("node:path");
2193
- if (n(e))
2194
- return e;
2195
- const o = await Ti(t);
2196
- let i;
2197
- return typeof o != "string" ? i = process.env.PWD ?? process.cwd() : i = r(o), s(i, e);
2198
- }
2199
- ), wo = async (e, t) => {
2200
- let n;
2201
- try {
2202
- n = (await import("node:path")).extname(
2203
- e
2204
- );
2205
- } catch {
2206
- try {
2207
- return Pe.parse(e);
2208
- } catch {
2209
- console.error("Failed to parse embeddedOverrides as a json object");
2210
- return;
2211
- }
2212
- }
2213
- const r = Co(
2214
- e,
2215
- t
2216
- );
2217
- if (n === ".json" || n === ".jsonc") {
2218
- const s = await r, o = await ni(s);
2219
- if (o !== void 0)
2220
- return o;
2221
- console.error(`Failed to parse the json file: ${s}`);
2222
- return;
2223
- }
2224
- if (n === ".mjs" || n === ".cjs" || n === ".js") {
2225
- const s = await r, o = await Uo(s);
2226
- if (o !== void 0)
2227
- return o;
2228
- console.error(`Failed to parse the js module file: ${s}`);
2229
- return;
2230
- }
2231
- if (n === ".mts" || n === ".cts" || n === ".ts") {
2232
- const s = await r, o = await Ro(s);
2233
- if (o !== void 0)
2234
- return o;
2235
- console.error(`Failed to parse the ts module file: ${s}`);
2236
- return;
2237
- }
2238
- if (n === "") {
2239
- const s = await r, o = await ni(s);
2240
- if (o !== void 0)
2241
- return o;
2242
- }
2243
- try {
2244
- return Pe.parse(e);
2245
- } catch {
2246
- console.error("Failed to parse embeddedOverrides as a json object");
2247
- }
2248
- };
2249
- async function Fo(e, {
2250
- commentOrTag: t,
2251
- kind: n,
2252
- filepath: r
2253
- }) {
2254
- if (e === void 0)
2255
- return;
2256
- const s = await wo(
2257
- e,
2258
- r
2259
- );
2260
- if (s !== void 0)
2261
- for (const {
2262
- [`${n}s`]: o,
2263
- identifiers: i,
2264
- options: l
2265
- } of s) {
2266
- const u = o ?? [];
2267
- if (u.length === 0 && i?.includes(t) || u.includes(t))
2268
- return l;
2269
- }
1599
+ function Li(e) {
1600
+ if (e.type === "Identifier") return e.name;
1601
+ if (e.type === "ThisExpression") return "this";
1602
+ if (e.type === "MemberExpression") {
1603
+ let t = Li(e.object);
1604
+ if (t === void 0) return;
1605
+ let n = "optional" in e && e.optional;
1606
+ return !e.computed && e.property.type === "Identifier" ? `${t}${n ? "?." : "."}${e.property.name}` : e.property.type === "Literal" ? `${t}${n ? "?." : ""}[${JSON.stringify(e.property.value)}]` : e.property.type === "Identifier" ? `${t}${n ? "?." : ""}[${e.property.name}]` : void 0;
1607
+ }
1608
+ if (e.type === "CallExpression") {
1609
+ let t = Li(e.callee);
1610
+ return t === void 0 ? void 0 : `${t}()`;
1611
+ }
1612
+ if (e.type === "ChainExpression") return Li(e.expression);
2270
1613
  }
2271
- function* pi(e) {
2272
- yield e, e.type === "CallExpression" && (yield* pi(e.callee));
1614
+ function Ri(e, t) {
1615
+ let n = /^\/(.*)\/([dgimsuvy]*)$/.exec(t);
1616
+ if (!n) return !1;
1617
+ try {
1618
+ let t = Li(e);
1619
+ return t !== void 0 && new RegExp(n[1], n[2]).test(t);
1620
+ } catch {
1621
+ return !1;
1622
+ }
2273
1623
  }
2274
- const Wo = /* @__PURE__ */ (() => {
2275
- const e = /* @__PURE__ */ new Set([
2276
- "start",
2277
- "end",
2278
- "loc",
2279
- "range",
2280
- "filename",
2281
- "typeAnnotation",
2282
- "decorators"
2283
- ]);
2284
- return (t, n, r) => {
2285
- let s;
2286
- try {
2287
- const i = r(`${n}\`\``);
2288
- if (i instanceof Promise)
2289
- throw new TypeError("Async parse function hasn't been supported yet.");
2290
- s = i;
2291
- } catch {
2292
- return !1;
2293
- }
2294
- if (s.type === "File" && (s = s.program), !(s.type === "Program" && s.body[0]?.type === "ExpressionStatement"))
2295
- return !1;
2296
- const o = s.body[0]?.expression;
2297
- if (o?.type !== "TaggedTemplateExpression")
2298
- return !1;
2299
- for (const i of pi(t))
2300
- if (mi(
2301
- i,
2302
- o.tag,
2303
- e
2304
- ))
2305
- return !0;
2306
- return !1;
2307
- };
1624
+ var zi = (() => {
1625
+ let e = /* @__PURE__ */ new Set([
1626
+ "start",
1627
+ "end",
1628
+ "loc",
1629
+ "range",
1630
+ "filename",
1631
+ "typeAnnotation",
1632
+ "decorators"
1633
+ ]);
1634
+ return (t, n, r) => {
1635
+ if (/^\/.*\/[dgimsuvy]*$/.test(n)) return Ri(t, n);
1636
+ let i;
1637
+ try {
1638
+ let e = r(`${n}\`\``);
1639
+ if (e instanceof Promise) throw TypeError("Async parse function hasn't been supported yet.");
1640
+ i = e;
1641
+ } catch {
1642
+ return !1;
1643
+ }
1644
+ if (i.type === "File" && (i = i.program), i.type !== "Program" || i.body[0]?.type !== "ExpressionStatement") return !1;
1645
+ let a = i.body[0]?.expression;
1646
+ if (a?.type !== "TaggedTemplateExpression") return !1;
1647
+ for (let n of Ii(t)) if (qi(n, a.tag, e)) return !0;
1648
+ return !1;
1649
+ };
2308
1650
  })();
2309
- function zo({
2310
- node: e,
2311
- parent: t
2312
- }) {
2313
- const n = e.comments ?? t?.comments;
2314
- if (!n)
2315
- return;
2316
- const r = n[n.length - 1];
2317
- if (![
2318
- "MultiLine",
2319
- // meriyah
2320
- "Block",
2321
- // typescript, acorn, espree, flow
2322
- "CommentBlock"
2323
- // babel, babel-flow, babel-ts
2324
- ].includes(r.type) || !r.leading)
2325
- return;
2326
- const s = r.value;
2327
- if (s.length > 1 && s.startsWith(" ") && s.endsWith(" "))
2328
- return s.slice(1, -1);
1651
+ function Bi({ node: e, parent: t }) {
1652
+ let n = e.comments ?? t?.comments;
1653
+ if (!n) return;
1654
+ let r = n[n.length - 1];
1655
+ if (![
1656
+ "MultiLine",
1657
+ "Block",
1658
+ "CommentBlock"
1659
+ ].includes(r.type) || !r.leading) return;
1660
+ let i = r.value;
1661
+ if (i.length > 1 && i.startsWith(" ") && i.endsWith(" ")) return i.slice(1, -1);
2329
1662
  }
2330
- function Ko({
2331
- parent: e
2332
- }) {
2333
- if (e?.type === "TaggedTemplateExpression")
2334
- return e.tag.type === "Identifier" ? e.tag.name : e.tag;
1663
+ function Vi({ parent: e }) {
1664
+ if (e?.type === "TaggedTemplateExpression") return e.tag.type === "Identifier" ? e.tag.name : e.tag;
2335
1665
  }
2336
- function Jo(e, t) {
2337
- return e.noEmbeddedIdentificationByComment?.includes(t) ?? !1 ? function* (r) {
2338
- } : function* (r) {
2339
- const s = e[A(r)] ?? [_];
2340
- s[0] === _ ? yield* e[D(r)] ?? [] : yield* s ?? [];
2341
- };
1666
+ function Hi(e, t) {
1667
+ return e.noEmbeddedIdentificationByComment?.includes(t) ?? !1 ? function* (e) {} : function* (t) {
1668
+ let n = e[w(t)] ?? ["9ff2b366e8ca4c97b9aed1a29b5b94ed"];
1669
+ n[0] === "9ff2b366e8ca4c97b9aed1a29b5b94ed" ? yield* e[C(t)] ?? [] : yield* n;
1670
+ };
2342
1671
  }
2343
- function ii(e, t) {
2344
- return typeof t == "string" ? e.noEmbeddedIdentificationByTag?.includes(t) ?? !1 ? function* (r) {
2345
- } : function* (r) {
2346
- const s = e[T(r)] ?? [
2347
- _
2348
- ];
2349
- s[0] === _ ? yield* e[D(r)] ?? [] : yield* s ?? [];
2350
- } : function* (n) {
2351
- const r = e[T(n)] ?? [
2352
- _
2353
- ];
2354
- if (r[0] === _) {
2355
- const { noEmbeddedIdentificationByTag: s } = e;
2356
- for (const o of e[D(n)] ?? [])
2357
- s?.includes(o) || (yield o);
2358
- } else
2359
- yield* r;
2360
- };
1672
+ function Ui(e, t) {
1673
+ return typeof t == "string" ? e.noEmbeddedIdentificationByTag?.includes(t) ?? !1 ? function* (e) {} : function* (t) {
1674
+ let n = e[T(t)] ?? ["9ff2b366e8ca4c97b9aed1a29b5b94ed"];
1675
+ n[0] === "9ff2b366e8ca4c97b9aed1a29b5b94ed" ? yield* e[C(t)] ?? [] : yield* n;
1676
+ } : function* (t) {
1677
+ let n = e[T(t)] ?? ["9ff2b366e8ca4c97b9aed1a29b5b94ed"];
1678
+ if (n[0] === "9ff2b366e8ca4c97b9aed1a29b5b94ed") {
1679
+ let { noEmbeddedIdentificationByTag: n } = e;
1680
+ for (let r of e[C(t)] ?? []) n?.includes(r) || (yield r);
1681
+ } else yield* n;
1682
+ };
2361
1683
  }
2362
- function xe(e, t, n, r, s) {
2363
- const o = li[t];
2364
- if (!o)
2365
- return null;
2366
- if (e.quasis.length === 1 && e.quasis[0]?.value.raw.trim() === "")
2367
- return "``";
2368
- const i = Fo(
2369
- s.embeddedOverrides,
2370
- {
2371
- commentOrTag: n,
2372
- kind: r,
2373
- filepath: s.filepath
2374
- }
2375
- );
2376
- return async (...l) => {
2377
- try {
2378
- const u = await o(...l, {
2379
- commentOrTag: n,
2380
- kind: r,
2381
- embeddedOverrideOptions: await i
2382
- });
2383
- return Bo(
2384
- {
2385
- embed: !0,
2386
- ...u.label
2387
- },
2388
- u
2389
- );
2390
- } catch (u) {
2391
- throw console.error(u), u;
2392
- }
2393
- };
1684
+ function Wi(e, t, n, r, i) {
1685
+ let a = hi[t];
1686
+ if (!a) return null;
1687
+ if (e.quasis.length === 1 && e.quasis[0]?.value.raw.trim() === "") return "``";
1688
+ let o = Fi(i, {
1689
+ commentOrTag: n,
1690
+ kind: r
1691
+ });
1692
+ return async (...e) => {
1693
+ try {
1694
+ let t = await a(...e, {
1695
+ commentOrTag: n,
1696
+ kind: r,
1697
+ embeddedOverrideOptions: await o
1698
+ });
1699
+ return Oi({
1700
+ embed: !0,
1701
+ ...t.label
1702
+ }, t);
1703
+ } catch (e) {
1704
+ throw console.error(e), e;
1705
+ }
1706
+ };
2394
1707
  }
2395
- function gi(e, t, n) {
2396
- return Object.is(e, t) ? !0 : e === null || t === null ? !1 : Array.isArray(e) ? Ho(e, t, n) : typeof e == "object" ? mi(e, t, n) : !1;
1708
+ function Gi(e, t, n) {
1709
+ return Object.is(e, t) ? !0 : e === null || t === null ? !1 : Array.isArray(e) ? Ki(e, t, n) : typeof e == "object" && qi(e, t, n);
2397
1710
  }
2398
- function Ho(e, t, n) {
2399
- const r = e.length;
2400
- if (r !== t.length)
2401
- return !1;
2402
- for (let s = 0; s < r; s++)
2403
- if (!gi(e[s], t[s], n))
2404
- return !1;
2405
- return !0;
1711
+ function Ki(e, t, n) {
1712
+ let r = e.length;
1713
+ if (r !== t.length) return !1;
1714
+ for (let i = 0; i < r; i++) if (!Gi(e[i], t[i], n)) return !1;
1715
+ return !0;
2406
1716
  }
2407
- function mi(e, t, n) {
2408
- for (const r of Object.keys(e))
2409
- if (!n?.has(r) && !(Object.prototype.hasOwnProperty.call(t, r) && gi(e[r], t[r], n)))
2410
- return !1;
2411
- return !0;
1717
+ function qi(e, t, n) {
1718
+ for (let r of Object.keys(e)) if (!n?.has(r) && !(Object.hasOwn(t, r) && Gi(e[r], t[r], n))) return !1;
1719
+ return !0;
2412
1720
  }
2413
- const { estree: hi } = Di, { embed: Ie } = hi, Xo = (e, t) => {
2414
- const { node: n } = e;
2415
- if (n.type !== "TemplateLiteral" || n.quasis.some(({ value: { cooked: o } }) => o === null))
2416
- return null;
2417
- const r = zo(e);
2418
- if (typeof r == "string") {
2419
- const o = Jo(
2420
- t,
2421
- r
2422
- );
2423
- for (const i of me) {
2424
- let l = !1;
2425
- for (const u of o(
2426
- i
2427
- ))
2428
- if (r === u) {
2429
- l = !0;
2430
- break;
2431
- }
2432
- if (l)
2433
- return xe(
2434
- n,
2435
- i,
2436
- r,
2437
- "comment",
2438
- t
2439
- );
2440
- }
2441
- return Ie?.(e, t) ?? null;
2442
- }
2443
- const s = Ko(e);
2444
- if (typeof s == "string") {
2445
- const o = ii(t, s);
2446
- for (const i of me) {
2447
- let l = !1;
2448
- for (const u of o(i))
2449
- if (s === u) {
2450
- l = !0;
2451
- break;
2452
- }
2453
- if (l)
2454
- return xe(n, i, s, "tag", t);
2455
- }
2456
- return Ie?.(e, t) ?? null;
2457
- }
2458
- if (s !== void 0) {
2459
- const o = (l) => So[t.parser].parse(
2460
- l,
2461
- t
2462
- ), i = ii(t);
2463
- for (const l of me) {
2464
- let u;
2465
- for (const E of i(l))
2466
- if (Wo(s, E, o)) {
2467
- u = E;
2468
- break;
2469
- }
2470
- if (u !== void 0)
2471
- return xe(
2472
- n,
2473
- l,
2474
- u,
2475
- "tag",
2476
- t
2477
- );
2478
- }
2479
- }
2480
- return Ie?.(e, t) ?? null;
2481
- }, ra = {
2482
- estree: {
2483
- ...hi,
2484
- embed: Xo
2485
- }
2486
- };
2487
- export {
2488
- sa as options,
2489
- So as parsers,
2490
- ra as printers
2491
- };
1721
+ //#endregion
1722
+ //#region src/printers.ts
1723
+ var { estree: Ji } = u, { embed: Yi } = Ji, Xi = (e, t) => {
1724
+ let { node: n } = e;
1725
+ if (n.type !== "TemplateLiteral" || n.quasis.some(({ value: { cooked: e } }) => e === null)) return null;
1726
+ let r = Bi(e);
1727
+ if (typeof r == "string") {
1728
+ let i = Hi(t, r);
1729
+ for (let e of pi) {
1730
+ let a = !1;
1731
+ for (let t of i(e)) if (r === t) {
1732
+ a = !0;
1733
+ break;
1734
+ }
1735
+ if (a) return Wi(n, e, r, "comment", t);
1736
+ }
1737
+ return Yi?.(e, t) ?? null;
1738
+ }
1739
+ let i = Vi(e);
1740
+ if (typeof i == "string") {
1741
+ let r = Ui(t, i);
1742
+ for (let e of pi) {
1743
+ let a;
1744
+ for (let t of r(e)) if (i === t || Ri({
1745
+ type: "Identifier",
1746
+ name: i
1747
+ }, t)) {
1748
+ a = t;
1749
+ break;
1750
+ }
1751
+ if (a !== void 0) return Wi(n, e, a, "tag", t);
1752
+ }
1753
+ return Yi?.(e, t) ?? null;
1754
+ }
1755
+ if (i !== void 0) {
1756
+ let e = (e) => wi[t.parser].parse(e, t), r = Ui(t);
1757
+ for (let a of pi) {
1758
+ let o;
1759
+ for (let t of r(a)) if (zi(i, t, e)) {
1760
+ o = t;
1761
+ break;
1762
+ }
1763
+ if (o !== void 0) return Wi(n, a, o, "tag", t);
1764
+ }
1765
+ }
1766
+ return Yi?.(e, t) ?? null;
1767
+ }, Zi = { estree: {
1768
+ ...Ji,
1769
+ embed: Xi
1770
+ } };
1771
+ //#endregion
1772
+ export { Ci as options, wi as parsers, Zi as printers };