prettier-plugin-embed 0.3.0-rc.1 → 0.3.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,37 +1,34 @@
1
- import { utils as J, builders as $ } from "prettier/doc";
2
- import tt from "prettier/parser-babel";
3
- import nt from "prettier/parser-espree";
4
- import rt from "prettier/parser-flow";
5
- import st from "prettier/parser-meriyah";
6
- import ot from "prettier/parser-typescript";
7
- import { printers as it } from "prettier/plugins/estree.mjs";
8
- import at, { readFile as dt } from "node:fs/promises";
9
- import T, { isAbsolute as ct, dirname as lt, resolve as ut, extname as mt } from "node:path";
10
- import { Worker as gt } from "node:worker_threads";
11
- import Me from "node:process";
12
- import { fileURLToPath as pt } from "node:url";
13
- import "node:fs";
14
- import { resolveConfigFile as ft } from "prettier";
15
- const Fe = "embeddedCss", { group: ht, indent: bt, softline: Z, lineSuffixBoundary: yt } = $, { mapDoc: vt } = J;
16
- function _t(e, n) {
17
- const { node: r } = e;
18
- let t = n();
19
- return r?.comments?.length && (t = ht([bt([Z, t]), Z])), ["${", t, yt, "}"];
1
+ import { utils as X, builders as $ } from "prettier/doc";
2
+ import Qe from "prettier/parser-babel";
3
+ import Ze from "prettier/parser-espree";
4
+ import et from "prettier/parser-flow";
5
+ import tt from "prettier/parser-meriyah";
6
+ import nt from "prettier/parser-typescript";
7
+ import { printers as rt } from "prettier/plugins/estree.mjs";
8
+ import { readFile as st } from "node:fs/promises";
9
+ import { isAbsolute as ot, dirname as it, resolve as at, extname as dt } from "node:path";
10
+ import { Worker as ct } from "node:worker_threads";
11
+ import { resolveConfigFile as lt } from "prettier";
12
+ const Me = "embeddedCss", { group: ut, indent: mt, softline: Q, lineSuffixBoundary: gt } = $, { mapDoc: pt } = X;
13
+ function ft(t, n) {
14
+ const { node: r } = t;
15
+ let e = n();
16
+ return r?.comments?.length && (e = ut([mt([Q, e]), Q])), ["${", e, gt, "}"];
20
17
  }
21
- function k(e, n) {
22
- return e.map(
23
- (r) => _t(r, n),
18
+ function O(t, n) {
19
+ return t.map(
20
+ (r) => ft(r, n),
24
21
  "expressions"
25
22
  );
26
23
  }
27
- function w(e, n, r) {
28
- return vt(e, (s) => {
24
+ function T(t, n, r) {
25
+ return pt(t, (s) => {
29
26
  if (typeof s != "string")
30
27
  return s;
31
- const o = [], i = s.split(n);
32
- for (let a = 0; a < i.length; a++) {
33
- let c = i[a];
34
- if (a % 2 == 0) {
28
+ const o = [], a = s.split(n);
29
+ for (let i = 0; i < a.length; i++) {
30
+ let c = a[i];
31
+ if (i % 2 == 0) {
35
32
  if (!c)
36
33
  continue;
37
34
  c = c.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(c);
@@ -43,124 +40,124 @@ function w(e, n, r) {
43
40
  return o;
44
41
  });
45
42
  }
46
- function B(e, n, r) {
43
+ function q(t, n, r) {
47
44
  if (!(n.plugins?.some(
48
- (t) => t.name?.includes(e) ?? !1
45
+ (e) => e.name?.includes(t) ?? !1
49
46
  ) ?? !1))
50
47
  throw new Error(
51
- `Cannot format embedded language identified by "${r}", because plugin "${e}" is not loaded.`
48
+ `Cannot format embedded language identified by "${r}", because plugin "${t}" is not loaded.`
52
49
  );
53
50
  }
54
- function Et(e, n, r) {
51
+ function ht(t, n, r) {
55
52
  if (n === r) {
56
- e.unshift(n);
53
+ t.unshift(n);
57
54
  return;
58
55
  }
59
- let t = 0, s = e.length;
60
- for (; t < s; ) {
61
- const o = t + s >>> 1;
62
- if (e[o] === r) {
63
- e.push(n);
56
+ let e = 0, s = t.length;
57
+ for (; e < s; ) {
58
+ const o = e + s >>> 1;
59
+ if (t[o] === r) {
60
+ t.push(n);
64
61
  return;
65
62
  }
66
- e[o] < n ? t = o + 1 : s = o;
63
+ t[o] < n ? e = o + 1 : s = o;
67
64
  }
68
- e.splice(t, 0, n);
65
+ t.splice(e, 0, n);
69
66
  }
70
- const ee = (() => {
71
- const e = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`));
67
+ const Z = (() => {
68
+ const t = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`));
72
69
  return () => {
73
70
  let r = "";
74
- for (let t = 0; t < 16; ++t)
75
- r += e[parseInt((Math.random() * e.length).toFixed(0), 10) % e.length];
71
+ for (let e = 0; e < 16; ++e)
72
+ r += t[parseInt((Math.random() * t.length).toFixed(0), 10) % t.length];
76
73
  return r;
77
74
  };
78
75
  })();
79
- function O(e = "p", n = "") {
80
- const r = ee(), t = ee(), s = te(e), o = te(n), i = (c) => `${e}${r}${c}${t}${n}`, a = new RegExp(
81
- `${s}${r}(\\d+)${t}${o}`,
76
+ function k(t = "p", n = "") {
77
+ const r = Z(), e = Z(), s = ee(t), o = ee(n), a = (c) => `${t}${r}${c}${e}${n}`, i = new RegExp(
78
+ `${s}${r}(\\d+)${e}${o}`,
82
79
  "g"
83
80
  );
84
81
  return {
85
- createPlaceholder: i,
86
- placeholderRegex: a
82
+ createPlaceholder: a,
83
+ placeholderRegex: i
87
84
  };
88
85
  }
89
- function te(e) {
90
- return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
86
+ function ee(t) {
87
+ return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
91
88
  }
92
- function I(e) {
93
- return `${e}Identifiers`;
89
+ function I(t) {
90
+ return `${t}Identifiers`;
94
91
  }
95
- function xt(e) {
96
- return `${e}Parser`;
92
+ function bt(t) {
93
+ return `${t}Parser`;
97
94
  }
98
- const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
99
- t = {
100
- ...t,
95
+ const { line: te, group: D, indent: ne, softline: re } = $, yt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
96
+ e = {
97
+ ...e,
101
98
  ...o
102
99
  };
103
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O("@p"), l = i.quasis.map(
104
- (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + a(h)
105
- ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = k(r, n), b = await e(l, {
106
- ...t,
100
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k("@p"), l = a.quasis.map(
101
+ (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + i(h)
102
+ ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = O(r, n), b = await t(l, {
103
+ ...e,
107
104
  parser: "scss"
108
- }), d = w(b, c, _);
109
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
105
+ }), d = T(b, c, _);
106
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
110
107
  return D([
111
108
  "`",
112
109
  u,
113
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [D(d)] : re([D(d)]),
110
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [D(d)] : ne([D(d)]),
114
111
  m,
115
112
  "`"
116
113
  ]);
117
- const g = u.length ? ne : se, y = m.length ? ne : se;
114
+ const g = u.length ? te : re, y = m.length ? te : re;
118
115
  return D([
119
116
  "`",
120
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [g, D(d)] : re([g, D(d)]),
117
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, D(d)] : ne([g, D(d)]),
121
118
  y,
122
119
  "`"
123
120
  ]);
124
- }, It = ["css"], St = I(Fe), Lt = {
125
- [St]: {
121
+ }, vt = ["css"], _t = I(Me), Et = {
122
+ [_t]: {
126
123
  category: "Global",
127
124
  type: "string",
128
125
  array: !0,
129
- default: [{ value: [...It] }],
126
+ default: [{ value: [...vt] }],
130
127
  description: "Specify embedded CSS language identifiers."
131
128
  }
132
- }, kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
129
+ }, xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
133
130
  __proto__: null,
134
- embeddedLanguage: Fe,
135
- embedder: $t,
136
- options: Lt
137
- }, Symbol.toStringTag, { value: "Module" })), Y = "embeddedEs", { line: oe, group: P, indent: ie, softline: ae } = $, Ot = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
138
- t = {
139
- ...t,
131
+ embeddedLanguage: Me,
132
+ embedder: yt,
133
+ options: Et
134
+ }, Symbol.toStringTag, { value: "Module" })), J = "embeddedEs", { line: se, group: w, indent: oe, softline: ie } = $, $t = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
135
+ e = {
136
+ ...e,
140
137
  ...o
141
138
  };
142
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
143
- (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + a(h)
144
- ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = k(r, n), b = await e(l, {
145
- ...t,
146
- parser: t.embeddedEsParser ?? "babel"
147
- }), d = w(b, c, _);
148
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
149
- return P([
139
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
140
+ (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + i(h)
141
+ ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = O(r, n), b = await t(l, {
142
+ ...e,
143
+ parser: e.embeddedEsParser ?? "babel"
144
+ }), d = T(b, c, _);
145
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
146
+ return w([
150
147
  "`",
151
148
  u,
152
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [P(d)] : ie([P(d)]),
149
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(d)] : oe([w(d)]),
153
150
  m,
154
151
  "`"
155
152
  ]);
156
- const g = u.length ? oe : ae, y = m.length ? oe : ae;
157
- return P([
153
+ const g = u.length ? se : ie, y = m.length ? se : ie;
154
+ return w([
158
155
  "`",
159
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [g, P(d)] : ie([g, P(d)]),
156
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, w(d)] : oe([g, w(d)]),
160
157
  y,
161
158
  "`"
162
159
  ]);
163
- }, wt = [
160
+ }, It = [
164
161
  "js",
165
162
  "jsx",
166
163
  "es",
@@ -169,56 +166,56 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
169
166
  "cjs",
170
167
  "pac",
171
168
  "javascript"
172
- ], Tt = I(Y), Dt = xt(Y), Pt = {
173
- [Tt]: {
169
+ ], St = I(J), Lt = bt(J), Ot = {
170
+ [St]: {
174
171
  category: "Global",
175
172
  type: "string",
176
173
  array: !0,
177
- default: [{ value: [...wt] }],
174
+ default: [{ value: [...It] }],
178
175
  description: "Specify embedded ES language identifiers."
179
176
  },
180
- [Dt]: {
177
+ [Lt]: {
181
178
  category: "Global",
182
179
  type: "string",
183
180
  array: !1,
184
181
  default: "babel",
185
182
  description: "Specify the embedded ES language parser."
186
183
  }
187
- }, Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
184
+ }, kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
188
185
  __proto__: null,
189
- embeddedLanguage: Y,
190
- embedder: Ot,
191
- options: Pt
192
- }, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedGlsl", { line: de, group: R, indent: ce, softline: le } = $, jt = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
193
- B("prettier-plugin-glsl", t, s), t = {
194
- ...t,
186
+ embeddedLanguage: J,
187
+ embedder: $t,
188
+ options: Ot
189
+ }, Symbol.toStringTag, { value: "Module" })), Fe = "embeddedGlsl", { line: ae, group: P, indent: de, softline: ce } = $, Tt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
190
+ q("prettier-plugin-glsl", e, s), e = {
191
+ ...e,
195
192
  ...o
196
193
  };
197
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
198
- (h, p, { length: v }) => p === v - 1 ? h.value.cooked : h.value.cooked + a(p)
194
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
195
+ (h, p, { length: v }) => p === v - 1 ? h.value.cooked : h.value.cooked + i(p)
199
196
  ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = l.slice(
200
197
  u.length,
201
198
  -m.length || void 0
202
- ), b = k(r, n), d = await e(_, {
203
- ...t,
199
+ ), b = O(r, n), d = await t(_, {
200
+ ...e,
204
201
  parser: "glsl-parser"
205
- }), g = w(d, c, b);
206
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
207
- return R([
202
+ }), g = T(d, c, b);
203
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
204
+ return P([
208
205
  "`",
209
206
  u,
210
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [R(g)] : ce([R(g)]),
207
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(g)] : de([P(g)]),
211
208
  m,
212
209
  "`"
213
210
  ]);
214
- const y = u.length ? de : le, f = m.length ? de : le;
215
- return R([
211
+ const y = u.length ? ae : ce, f = m.length ? ae : ce;
212
+ return P([
216
213
  "`",
217
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [y, R(g)] : ce([y, R(g)]),
214
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, P(g)] : de([y, P(g)]),
218
215
  f,
219
216
  "`"
220
217
  ]);
221
- }, Mt = [
218
+ }, Dt = [
222
219
  "glsl",
223
220
  "fp",
224
221
  "frag",
@@ -241,30 +238,30 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
241
238
  "vrx",
242
239
  "vsh",
243
240
  "vshader"
244
- ], Ft = I(Ce), Ct = {
245
- [Ft]: {
241
+ ], wt = I(Fe), Pt = {
242
+ [wt]: {
246
243
  category: "Global",
247
244
  type: "string",
248
245
  array: !0,
249
- default: [{ value: [...Mt] }],
246
+ default: [{ value: [...Dt] }],
250
247
  description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".'
251
248
  }
252
- }, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
249
+ }, Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
253
250
  __proto__: null,
254
- embeddedLanguage: Ce,
255
- embedder: jt,
256
- options: Ct
257
- }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedHtml", { line: ue, group: j, indent: me, softline: ge } = $, { mapDoc: At } = J, qt = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
258
- t = {
259
- ...t,
251
+ embeddedLanguage: Fe,
252
+ embedder: Tt,
253
+ options: Pt
254
+ }, Symbol.toStringTag, { value: "Module" })), Ce = "embeddedHtml", { line: le, group: R, indent: ue, softline: me } = $, { mapDoc: Mt } = X, Ft = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
255
+ e = {
256
+ ...e,
260
257
  ...o
261
258
  };
262
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
263
- (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + a(h)
264
- ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = k(r, n), b = await e(l, {
265
- ...t,
259
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
260
+ (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + i(h)
261
+ ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = O(r, n), b = await t(l, {
262
+ ...e,
266
263
  parser: "html"
267
- }), d = At(b, (f) => {
264
+ }), d = Mt(b, (f) => {
268
265
  if (typeof f != "string")
269
266
  return f;
270
267
  const h = [], p = f.split(c);
@@ -273,7 +270,7 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
273
270
  if (v % 2 == 0) {
274
271
  if (!E)
275
272
  continue;
276
- E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), t.__embeddedInHtml && (E = E.replaceAll(/<\/(?=script\b)/gi, "<\\/")), h.push(E);
273
+ E = E.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (E = E.replaceAll(/<\/(?=script\b)/gi, "<\\/")), h.push(E);
277
274
  } else {
278
275
  const x = Number(E);
279
276
  h.push(_[x]);
@@ -281,23 +278,23 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
281
278
  }
282
279
  return h;
283
280
  });
284
- if (t.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
285
- t.htmlWhitespaceSensitivity === "css" || t.preserveEmbeddedExteriorWhitespaces?.includes(s))
286
- return j([
281
+ if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
282
+ e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
283
+ return R([
287
284
  "`",
288
285
  u,
289
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [j(d)] : me([j(d)]),
286
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(d)] : ue([R(d)]),
290
287
  m,
291
288
  "`"
292
289
  ]);
293
- const g = u.length ? ue : ge, y = m.length ? ue : ge;
294
- return j([
290
+ const g = u.length ? le : me, y = m.length ? le : me;
291
+ return R([
295
292
  "`",
296
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [g, j(d)] : me([g, j(d)]),
293
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, R(d)] : ue([g, R(d)]),
297
294
  y,
298
295
  "`"
299
296
  ]);
300
- }, Bt = [
297
+ }, Ct = [
301
298
  "html",
302
299
  "htm",
303
300
  "shtml",
@@ -310,47 +307,47 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
310
307
  "jshtm",
311
308
  "volt",
312
309
  "rhtml"
313
- ], Wt = I(Ne), Ut = {
314
- [Wt]: {
310
+ ], Nt = I(Ce), jt = {
311
+ [Nt]: {
315
312
  category: "Global",
316
313
  type: "string",
317
314
  array: !0,
318
- default: [{ value: [...Bt] }],
315
+ default: [{ value: [...Ct] }],
319
316
  description: "Specify embedded HTML language identifiers."
320
317
  }
321
- }, Kt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
318
+ }, At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
322
319
  __proto__: null,
323
- embeddedLanguage: Ne,
324
- embedder: qt,
325
- options: Ut
326
- }, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedMarkdown", { line: pe, group: M, indent: fe, softline: he } = $, zt = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
327
- t = {
328
- ...t,
320
+ embeddedLanguage: Ce,
321
+ embedder: Ft,
322
+ options: jt
323
+ }, Symbol.toStringTag, { value: "Module" })), Ne = "embeddedMarkdown", { line: ge, group: M, indent: pe, softline: fe } = $, qt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
324
+ e = {
325
+ ...e,
329
326
  ...o
330
327
  };
331
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
332
- (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + a(h)
333
- ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = k(r, n), b = await e(l, {
334
- ...t,
328
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
329
+ (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + i(h)
330
+ ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = O(r, n), b = await t(l, {
331
+ ...e,
335
332
  parser: "markdown",
336
333
  __inJsTemplate: !0
337
- }), d = w(b, c, _);
338
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
334
+ }), d = T(b, c, _);
335
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
339
336
  return M([
340
337
  "`",
341
338
  u,
342
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [M(d)] : fe([M(d)]),
339
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(d)] : pe([M(d)]),
343
340
  m,
344
341
  "`"
345
342
  ]);
346
- const g = u.length ? pe : he, y = m.length ? pe : he;
343
+ const g = u.length ? ge : fe, y = m.length ? ge : fe;
347
344
  return M([
348
345
  "`",
349
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [g, M(d)] : fe([g, M(d)]),
346
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, M(d)] : pe([g, M(d)]),
350
347
  y,
351
348
  "`"
352
349
  ]);
353
- }, Gt = [
350
+ }, Bt = [
354
351
  "md",
355
352
  "livemd",
356
353
  "markdown",
@@ -362,74 +359,74 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
362
359
  "ronn",
363
360
  "scd",
364
361
  "workbook"
365
- ], Ht = I(Ae), Xt = {
366
- [Ht]: {
362
+ ], Wt = I(Ne), Kt = {
363
+ [Wt]: {
367
364
  category: "Global",
368
365
  type: "string",
369
366
  array: !0,
370
- default: [{ value: [...Gt] }],
367
+ default: [{ value: [...Bt] }],
371
368
  description: "Specify embedded Markdown language identifiers."
372
369
  }
373
- }, Jt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
370
+ }, Ut = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
374
371
  __proto__: null,
375
- embeddedLanguage: Ae,
376
- embedder: zt,
377
- options: Xt
378
- }, Symbol.toStringTag, { value: "Module" })), V = "embeddedNoop", Yt = I(V), Vt = {
379
- [Yt]: {
372
+ embeddedLanguage: Ne,
373
+ embedder: qt,
374
+ options: Kt
375
+ }, Symbol.toStringTag, { value: "Module" })), Y = "embeddedNoop", zt = I(Y), Gt = {
376
+ [zt]: {
380
377
  category: "Global",
381
378
  type: "string",
382
379
  array: !0,
383
380
  default: [{ value: [] }],
384
381
  description: "Specify embedded language identifiers that will not be formatted."
385
382
  }
386
- }, Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
383
+ }, Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
387
384
  __proto__: null,
388
- embeddedLanguage: V,
389
- options: Vt
390
- }, Symbol.toStringTag, { value: "Module" })), qe = "embeddedPhp", { line: be, group: F, indent: ye, softline: ve } = $, Zt = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
391
- B("@prettier/plugin-php", t, s), t = {
392
- ...t,
385
+ embeddedLanguage: Y,
386
+ options: Gt
387
+ }, Symbol.toStringTag, { value: "Module" })), je = "embeddedPhp", { line: he, group: F, indent: be, softline: ye } = $, Xt = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
388
+ q("@prettier/plugin-php", e, s), e = {
389
+ ...e,
393
390
  ...o
394
391
  };
395
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O("$p"), l = i.quasis.map(
396
- (h, p, { length: v }) => p === v - 1 ? h.value.cooked : h.value.cooked + a(p)
392
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k("$p"), l = a.quasis.map(
393
+ (h, p, { length: v }) => p === v - 1 ? h.value.cooked : h.value.cooked + i(p)
397
394
  ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = l.slice(
398
395
  u.length,
399
396
  -m.length || void 0
400
- ), b = k(r, n), d = await e(_, {
401
- ...t,
397
+ ), b = O(r, n), d = await t(_, {
398
+ ...e,
402
399
  parser: "php"
403
- }), g = w(d, c, b);
404
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
400
+ }), g = T(d, c, b);
401
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
405
402
  return F([
406
403
  "`",
407
404
  u,
408
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [F(g)] : ye([F(g)]),
405
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(g)] : be([F(g)]),
409
406
  m,
410
407
  "`"
411
408
  ]);
412
- const y = u.length ? be : ve, f = m.length ? be : ve;
409
+ const y = u.length ? he : ye, f = m.length ? he : ye;
413
410
  return F([
414
411
  "`",
415
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [y, F(g)] : ye([y, F(g)]),
412
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, F(g)] : be([y, F(g)]),
416
413
  f,
417
414
  "`"
418
415
  ]);
419
- }, en = ["php", "php5", "phtml", "ctp"], tn = I(qe), nn = {
420
- [tn]: {
416
+ }, Jt = ["php", "php5", "phtml", "ctp"], Yt = I(je), Vt = {
417
+ [Yt]: {
421
418
  category: "Global",
422
419
  type: "string",
423
420
  array: !0,
424
- default: [{ value: [...en] }],
421
+ default: [{ value: [...Jt] }],
425
422
  description: 'Specify embedded PHP language identifiers. This requires "@prettier/plugin-php".'
426
423
  }
427
- }, rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
424
+ }, Qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
428
425
  __proto__: null,
429
- embeddedLanguage: qe,
430
- embedder: Zt,
431
- options: nn
432
- }, Symbol.toStringTag, { value: "Module" })), Be = "embeddedRuby", U = [
426
+ embeddedLanguage: je,
427
+ embedder: Xt,
428
+ options: Vt
429
+ }, Symbol.toStringTag, { value: "Module" })), Ae = "embeddedRuby", K = [
433
430
  "ruby",
434
431
  "arb",
435
432
  "axlsx",
@@ -455,87 +452,87 @@ const { line: ne, group: D, indent: re, softline: se } = $, $t = async (e, n, r,
455
452
  "ru",
456
453
  "thor",
457
454
  "watchr"
458
- ], K = ["rbs"], z = ["haml"], sn = [
459
- ...U,
455
+ ], U = ["rbs"], z = ["haml"], Zt = [
460
456
  ...K,
457
+ ...U,
461
458
  ...z
462
- ], on = "embeddedRubyParser", an = I(Be), dn = {
463
- [an]: {
459
+ ], en = "embeddedRubyParser", tn = I(Ae), nn = {
460
+ [tn]: {
464
461
  category: "Global",
465
462
  type: "string",
466
463
  array: !0,
467
- default: [{ value: [...sn] }],
464
+ default: [{ value: [...Zt] }],
468
465
  description: 'Specify embedded Ruby language identifiers. This requires "@prettier/plugin-ruby".'
469
466
  },
470
- [on]: {
467
+ [en]: {
471
468
  category: "Global",
472
469
  type: "string",
473
470
  array: !1,
474
471
  default: void 0,
475
472
  description: "Specify the embedded Ruby language parser."
476
473
  }
477
- }, { line: _e, group: C, indent: Ee, softline: xe } = $, cn = async (e, n, r, t, { identifier: s, identifiers: o, embeddedOverrideOptions: i }) => {
478
- B("@prettier/plugin-ruby", t, s), t = {
479
- ...t,
480
- ...i
474
+ }, { line: ve, group: C, indent: _e, softline: Ee } = $, rn = async (t, n, r, e, { identifier: s, identifiers: o, embeddedOverrideOptions: a }) => {
475
+ q("@prettier/plugin-ruby", e, s), e = {
476
+ ...e,
477
+ ...a
481
478
  };
482
- const { node: a } = r, { createPlaceholder: c, placeholderRegex: l } = O(), u = a.quasis.map(
479
+ const { node: i } = r, { createPlaceholder: c, placeholderRegex: l } = k(), u = i.quasis.map(
483
480
  (v, E, { length: x }) => E === x - 1 ? v.value.cooked : v.value.cooked + c(E)
484
481
  ).join(""), m = u.match(/^\s+/)?.[0] ?? "", _ = u.match(/\s+$/)?.[0] ?? "", b = u.slice(
485
482
  m.length,
486
483
  -_.length || void 0
487
- ), d = k(r, n), g = ln(t, s, o), y = await e(b, {
488
- ...t,
484
+ ), d = O(r, n), g = sn(e, s, o), y = await t(b, {
485
+ ...e,
489
486
  parser: g
490
- }), f = w(y, l, d);
491
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
487
+ }), f = T(y, l, d);
488
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
492
489
  return C([
493
490
  "`",
494
491
  m,
495
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [C(f)] : Ee([C(f)]),
492
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(f)] : _e([C(f)]),
496
493
  _,
497
494
  "`"
498
495
  ]);
499
- const h = m.length ? _e : xe, p = _.length ? _e : xe;
496
+ const h = m.length ? ve : Ee, p = _.length ? ve : Ee;
500
497
  return C([
501
498
  "`",
502
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(f)] : Ee([h, C(f)]),
499
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(f)] : _e([h, C(f)]),
503
500
  p,
504
501
  "`"
505
502
  ]);
506
503
  };
507
- function ln(e, n, r) {
508
- if (typeof e.embeddedRubyParser == "string")
509
- return e.embeddedRubyParser;
510
- const t = r.indexOf(n);
511
- for (let s = t; s >= 0; --s) {
512
- if (un(n))
513
- return U[0];
514
- if (mn(n))
504
+ function sn(t, n, r) {
505
+ if (typeof t.embeddedRubyParser == "string")
506
+ return t.embeddedRubyParser;
507
+ const e = r.indexOf(n);
508
+ for (let s = e; s >= 0; --s) {
509
+ if (on(n))
515
510
  return K[0];
516
- if (gn(n))
511
+ if (an(n))
512
+ return U[0];
513
+ if (dn(n))
517
514
  return z[0];
518
515
  }
519
516
  throw new SyntaxError(`Unrecognized ruby identifier: ${n}`);
520
517
  }
521
- function un(e) {
522
- return U.includes(e);
518
+ function on(t) {
519
+ return K.includes(t);
523
520
  }
524
- function mn(e) {
525
- return K.includes(e);
521
+ function an(t) {
522
+ return U.includes(t);
526
523
  }
527
- function gn(e) {
528
- return z.includes(e);
524
+ function dn(t) {
525
+ return z.includes(t);
529
526
  }
530
- const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
527
+ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
531
528
  __proto__: null,
532
529
  HAML_PARSER_IDENTIFIERS: z,
533
- RBS_PARSER_IDENTIFIERS: K,
534
- RUBY_PARSER_IDENTIFIERS: U,
535
- embeddedLanguage: Be,
536
- embedder: cn,
537
- options: dn
538
- }, Symbol.toStringTag, { value: "Module" })), We = "embeddedSql", Ue = [
530
+ RBS_PARSER_IDENTIFIERS: U,
531
+ RUBY_PARSER_IDENTIFIERS: K,
532
+ embeddedLanguage: Ae,
533
+ embedder: rn,
534
+ options: nn
535
+ }, Symbol.toStringTag, { value: "Module" })), qe = "embeddedSql", H = [
539
536
  "sql",
540
537
  "bigquery",
541
538
  "db2",
@@ -554,7 +551,7 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
554
551
  "transactsql",
555
552
  "tsql",
556
553
  "trino"
557
- ], Ke = [
554
+ ], Be = [
558
555
  "bigquery",
559
556
  "db2",
560
557
  "hive",
@@ -564,8 +561,8 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
564
561
  "transactsql",
565
562
  "flinksql",
566
563
  "snowflake"
567
- ], fn = I(We), hn = {
568
- [fn]: {
564
+ ], ln = I(qe), un = {
565
+ [ln]: {
569
566
  category: "Global",
570
567
  type: "string",
571
568
  array: !0,
@@ -573,22 +570,22 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
573
570
  default: [{ value: ["sql", "mysql", "mariadb", "postgresql"] }],
574
571
  description: 'Specify embedded SQL language identifiers. This requires "prettier-plugin-sql".'
575
572
  }
576
- }, { hardline: bn, group: N, line: $e, softline: Ie, indent: Se } = $, { mapDoc: yn } = J, vn = async (e, n, r, t, { identifier: s, identifiers: o, embeddedOverrideOptions: i }) => {
577
- B("prettier-plugin-sql", t, s), t = {
578
- ...t,
579
- ...i
573
+ }, { hardline: mn, group: N, line: xe, softline: $e, indent: Ie } = $, { mapDoc: gn } = X, pn = async (t, n, r, e, { identifier: s, identifiers: o, embeddedOverrideOptions: a }) => {
574
+ q("prettier-plugin-sql", e, s), e = {
575
+ ...e,
576
+ ...a
580
577
  };
581
- const { node: a } = r, { createPlaceholder: c, placeholderRegex: l } = O(), u = a.quasis.map(
578
+ const { node: i } = r, { createPlaceholder: c, placeholderRegex: l } = k(), u = i.quasis.map(
582
579
  (p, v, { length: E }) => v === E - 1 ? p.value.cooked : p.value.cooked + c(v)
583
- ).join(""), m = u.match(/^\s+/)?.[0] ?? "", _ = u.match(/\s+$/)?.[0] ?? "", b = k(r, n), d = En(t, s, o);
580
+ ).join(""), m = u.match(/^\s+/)?.[0] ?? "", _ = u.match(/\s+$/)?.[0] ?? "", b = O(r, n), d = hn(e, s, o);
584
581
  if (typeof d > "u")
585
582
  throw new SyntaxError(`Unrecognized identifier: ${s}`);
586
- const g = await e(u, {
587
- ...t,
583
+ const g = await t(u, {
584
+ ...e,
588
585
  parser: "sql",
589
586
  ...d,
590
- ...i
591
- }), y = yn(g, (p) => {
587
+ ...a
588
+ }), y = gn(g, (p) => {
592
589
  if (typeof p != "string")
593
590
  return p;
594
591
  const v = [], E = p.split(l);
@@ -598,7 +595,7 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
598
595
  if (!S)
599
596
  continue;
600
597
  S = S.replaceAll(/([\\`]|\${)/g, "\\$1"), S.split(/(\n)/).forEach((L) => L === `
601
- ` ? v.push(bn) : v.push(L));
598
+ ` ? v.push(mn) : v.push(L));
602
599
  } else {
603
600
  const L = Number(S);
604
601
  v.push(b[L]);
@@ -606,175 +603,183 @@ const pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
606
603
  }
607
604
  return v;
608
605
  });
609
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
606
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
610
607
  return N([
611
608
  "`",
612
609
  m,
613
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [N(y)] : Se([N(y)]),
610
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(y)] : Ie([N(y)]),
614
611
  _,
615
612
  "`"
616
613
  ]);
617
- const f = m.length ? $e : Ie, h = _.length ? $e : Ie;
614
+ const f = m.length ? xe : $e, h = _.length ? xe : $e;
618
615
  return N([
619
616
  "`",
620
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [f, N(y)] : Se([f, N(y)]),
617
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, N(y)] : Ie([f, N(y)]),
621
618
  h,
622
619
  "`"
623
620
  ]);
624
- }, _n = {
625
- "sql-formatter": (e) => Ue.includes(e),
626
- "node-sql-parser": (e) => Ke.includes(e)
621
+ }, fn = {
622
+ "sql-formatter": (t) => H.includes(t),
623
+ "node-sql-parser": (t) => Be.includes(t),
624
+ // TODO: This seems not implemented yet
625
+ "sql-cst": (t) => H.includes(t)
627
626
  };
628
- function Le(e, n) {
627
+ function Se(t, n) {
629
628
  for (const r of n)
630
- if (_n[r](e))
629
+ if (fn[r](t))
631
630
  switch (r) {
632
631
  case "sql-formatter":
633
632
  return {
634
633
  formatter: r,
635
- language: e
634
+ language: t
636
635
  };
637
636
  case "node-sql-parser":
638
637
  return {
639
638
  formatter: r,
640
- database: e
639
+ database: t
641
640
  };
642
641
  }
643
642
  }
644
- function G(e, n, r) {
645
- let t = Le(e, r);
646
- if (t)
647
- return t;
648
- const s = n.indexOf(e);
643
+ function B(t, n, r) {
644
+ let e = Se(t, r);
645
+ if (e)
646
+ return e;
647
+ const s = n.indexOf(t);
649
648
  for (let o = s - 1; o >= 0; --o)
650
- if (t = Le(
649
+ if (e = Se(
651
650
  n[o],
652
651
  r
653
- ), t)
654
- return t;
652
+ ), e)
653
+ return e;
655
654
  }
656
- function En(e, n, r) {
657
- switch (e.formatter ?? "sql-formatter") {
655
+ function hn(t, n, r) {
656
+ switch (t.formatter ?? "sql-formatter") {
658
657
  case "sql-formatter":
659
- return G(
658
+ return B(
660
659
  n,
661
660
  r,
662
661
  ["sql-formatter", "node-sql-parser"]
663
662
  );
664
663
  case "node-sql-parser":
665
- return G(
664
+ return B(
666
665
  n,
667
666
  r,
668
667
  ["node-sql-parser", "sql-formatter"]
669
668
  );
669
+ case "sql-cst":
670
+ return B(
671
+ n,
672
+ r,
673
+ ["sql-formatter", "node-sql-parser"]
674
+ );
670
675
  default:
671
- return G(
676
+ return B(
672
677
  n,
673
678
  r,
674
679
  ["sql-formatter", "node-sql-parser"]
675
680
  );
676
681
  }
677
682
  }
678
- const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
683
+ const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
679
684
  __proto__: null,
680
- NODE_SQL_PARSER_DATABASES: Ke,
681
- SQL_FORMATTER_LANGUAGES: Ue,
682
- embeddedLanguage: We,
683
- embedder: vn,
684
- options: hn
685
- }, Symbol.toStringTag, { value: "Module" })), ze = "embeddedTs", { line: ke, group: A, indent: Oe, softline: we } = $, $n = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
686
- t = {
687
- ...t,
685
+ NODE_SQL_PARSER_DATABASES: Be,
686
+ SQL_FORMATTER_LANGUAGES: H,
687
+ embeddedLanguage: qe,
688
+ embedder: pn,
689
+ options: un
690
+ }, Symbol.toStringTag, { value: "Module" })), We = "embeddedTs", { line: Le, group: j, indent: Oe, softline: ke } = $, yn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
691
+ e = {
692
+ ...e,
688
693
  ...o
689
694
  };
690
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
691
- (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + a(h)
692
- ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = k(r, n), b = await e(l, {
693
- ...t,
694
- parser: t.embeddedTsParser ?? "typescript",
695
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
696
+ (f, h, { length: p }) => h === p - 1 ? f.value.cooked : f.value.cooked + i(h)
697
+ ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = O(r, n), b = await t(l, {
698
+ ...e,
699
+ parser: e.embeddedTsParser ?? "typescript",
695
700
  // set filepath to undefined to enable jsx auto detection:
696
701
  // https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
697
702
  filepath: void 0
698
- }), d = w(b, c, _);
699
- if (t.preserveEmbeddedExteriorWhitespaces?.includes(s))
700
- return A([
703
+ }), d = T(b, c, _);
704
+ if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
705
+ return j([
701
706
  "`",
702
707
  u,
703
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [A(d)] : Oe([A(d)]),
708
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(d)] : Oe([j(d)]),
704
709
  m,
705
710
  "`"
706
711
  ]);
707
- const g = u.length ? ke : we, y = m.length ? ke : we;
708
- return A([
712
+ const g = u.length ? Le : ke, y = m.length ? Le : ke;
713
+ return j([
709
714
  "`",
710
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [g, A(d)] : Oe([g, A(d)]),
715
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, j(d)] : Oe([g, j(d)]),
711
716
  y,
712
717
  "`"
713
718
  ]);
714
- }, In = ["ts", "tsx", "cts", "mts", "typescript"], Sn = "embeddedTsParser", Ln = I(ze), kn = {
715
- [Ln]: {
719
+ }, vn = ["ts", "tsx", "cts", "mts", "typescript"], _n = "embeddedTsParser", En = I(We), xn = {
720
+ [En]: {
716
721
  category: "Global",
717
722
  type: "string",
718
723
  array: !0,
719
- default: [{ value: [...In] }],
724
+ default: [{ value: [...vn] }],
720
725
  description: "Specify embedded TS language parsers."
721
726
  },
722
- [Sn]: {
727
+ [_n]: {
723
728
  category: "Global",
724
729
  type: "string",
725
730
  array: !1,
726
731
  default: "typescript",
727
732
  description: "Specify the embedded TS language parser."
728
733
  }
729
- }, On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
734
+ }, $n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
730
735
  __proto__: null,
731
- embeddedLanguage: ze,
732
- embedder: $n,
733
- options: kn
734
- }, Symbol.toStringTag, { value: "Module" })), Q = "embeddedXml", { line: Te, group: q, indent: De, softline: H } = $, wn = async (e, n, r, t, { identifier: s, embeddedOverrideOptions: o }) => {
735
- B("@prettier/plugin-xml", t, s), t = {
736
- ...t,
736
+ embeddedLanguage: We,
737
+ embedder: yn,
738
+ options: xn
739
+ }, Symbol.toStringTag, { value: "Module" })), V = "embeddedXml", { line: Te, group: A, indent: De, softline: G } = $, In = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
740
+ q("@prettier/plugin-xml", e, s), e = {
741
+ ...e,
737
742
  ...o
738
743
  };
739
- const { node: i } = r, { createPlaceholder: a, placeholderRegex: c } = O(), l = i.quasis.map(
740
- (p, v, { length: E }) => v === E - 1 ? p.value.cooked : p.value.cooked + a(v)
744
+ const { node: a } = r, { createPlaceholder: i, placeholderRegex: c } = k(), l = a.quasis.map(
745
+ (p, v, { length: E }) => v === E - 1 ? p.value.cooked : p.value.cooked + i(v)
741
746
  ).join(""), u = l.match(/^\s+/)?.[0] ?? "", m = l.match(/\s+$/)?.[0] ?? "", _ = l.slice(
742
747
  u.length,
743
748
  -m.length || void 0
744
- ), b = k(r, n), d = [];
749
+ ), b = O(r, n), d = [];
745
750
  let g = 0;
746
751
  for (; g !== void 0; ) {
747
752
  const p = _.slice(g);
748
753
  if (p.length === 0)
749
754
  break;
750
- g > 0 && t.xmlWhitespaceSensitivity !== "strict" && d.push(H), t.__embeddedXmlFragmentRecoverIndex?.splice(
755
+ g > 0 && e.xmlWhitespaceSensitivity !== "strict" && d.push(G), e.__embeddedXmlFragmentRecoverIndex?.splice(
751
756
  0,
752
- t.__embeddedXmlFragmentRecoverIndex.length
757
+ e.__embeddedXmlFragmentRecoverIndex.length
753
758
  );
754
- let v = await e(p, {
755
- ...t,
756
- parser: Q
759
+ let v = await t(p, {
760
+ ...e,
761
+ parser: V
757
762
  });
758
- const [E, x] = t.__embeddedXmlFragmentRecoverIndex ?? [];
763
+ const [E, x] = e.__embeddedXmlFragmentRecoverIndex ?? [];
759
764
  E === void 0 ? g = void 0 : x === void 0 ? g += E : (v = p.slice(E, x + 1), g += x + 1), d.push(v);
760
765
  }
761
- const y = w(d, c, b);
762
- if (t.xmlWhitespaceSensitivity === "strict" || t.preserveEmbeddedExteriorWhitespaces?.includes(s))
763
- return q([
766
+ const y = T(d, c, b);
767
+ if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
768
+ return A([
764
769
  "`",
765
770
  u,
766
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [q(y)] : De([q(y)]),
771
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [A(y)] : De([A(y)]),
767
772
  m,
768
773
  "`"
769
774
  ]);
770
- const f = u.length ? Te : H, h = m.length ? Te : H;
771
- return q([
775
+ const f = u.length ? Te : G, h = m.length ? Te : G;
776
+ return A([
772
777
  "`",
773
- t.noEmbeddedMultiLineIndentation?.includes(s) ? [f, q(y)] : De([f, q(y)]),
778
+ e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, A(y)] : De([f, A(y)]),
774
779
  h,
775
780
  "`"
776
781
  ]);
777
- }, Tn = [
782
+ }, Sn = [
778
783
  "xml",
779
784
  "xsd",
780
785
  "ascx",
@@ -831,12 +836,12 @@ const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
831
836
  "xpdl",
832
837
  "xul",
833
838
  "xoml"
834
- ], Dn = I(Q), Pn = {
835
- [Dn]: {
839
+ ], Ln = I(V), On = {
840
+ [Ln]: {
836
841
  category: "Global",
837
842
  type: "string",
838
843
  array: !0,
839
- default: [{ value: [...Tn] }],
844
+ default: [{ value: [...Sn] }],
840
845
  description: 'Specify embedded XML language identifiers. This requires "@prettier/plugin-xml".'
841
846
  },
842
847
  /** @internal */
@@ -848,192 +853,192 @@ const xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
848
853
  description: "This option is read only and used as a workaround to support xml fragments"
849
854
  }
850
855
  };
851
- function Rn(e) {
856
+ function kn(t) {
852
857
  const n = {
853
858
  loc: {
854
859
  start: {
855
- line: e.line,
856
- column: e.column
860
+ line: t.line,
861
+ column: t.column
857
862
  },
858
863
  end: {
859
- line: e.line,
860
- column: e.column + e.length
864
+ line: t.line,
865
+ column: t.column + t.length
861
866
  }
862
867
  }
863
868
  }, r = new SyntaxError(
864
- `${e.message} (${n.loc.start.line}:${n.loc.start.column})`,
869
+ `${t.message} (${n.loc.start.line}:${n.loc.start.column})`,
865
870
  {
866
- cause: e
871
+ cause: t
867
872
  }
868
873
  );
869
874
  return Object.assign(r, n), r;
870
875
  }
871
- function Pe(e) {
876
+ function we(t) {
872
877
  const n = {
873
878
  loc: {
874
879
  start: {
875
- line: e.token.startLine ?? NaN,
876
- column: e.token.startColumn ?? NaN
880
+ line: t.token.startLine ?? NaN,
881
+ column: t.token.startColumn ?? NaN
877
882
  },
878
883
  end: {
879
- line: e.token.endLine ?? NaN,
880
- column: e.token.endColumn ?? NaN
884
+ line: t.token.endLine ?? NaN,
885
+ column: t.token.endColumn ?? NaN
881
886
  }
882
887
  }
883
888
  }, r = new SyntaxError(
884
- `${e.message} (${n.loc.start.line}:${n.loc.start.column})`,
889
+ `${t.message} (${n.loc.start.line}:${n.loc.start.column})`,
885
890
  {
886
- cause: e
891
+ cause: t
887
892
  }
888
893
  );
889
894
  return Object.assign(r, n), r;
890
895
  }
891
- const jn = {
892
- async parse(e, n) {
893
- const { parse: r } = await import("@xml-tools/parser"), { lexErrors: t, parseErrors: s, cst: o } = r(e);
894
- if (t.length > 0) {
895
- const i = t[0];
896
- throw Rn(i);
896
+ const Tn = {
897
+ async parse(t, n) {
898
+ const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t);
899
+ if (e.length > 0) {
900
+ const a = e[0];
901
+ throw kn(a);
897
902
  }
898
903
  if (s.length > 0) {
899
- let i = !1;
900
- for (const a of s) {
904
+ let a = !1;
905
+ for (const i of s) {
901
906
  if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
902
- a.name
907
+ i.name
903
908
  ))
904
- throw Pe(a);
905
- if (a.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
906
- i = !0;
909
+ throw we(i);
910
+ if (i.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
911
+ a = !0;
907
912
  continue;
908
913
  }
909
914
  if (/Expecting token of type --> EOF <-- but found --> '[\s\S]+' <--/.test(
910
- a.message
911
- ) || /Redundant input, expecting EOF but found: /.test(a.message)) {
915
+ i.message
916
+ ) || /Redundant input, expecting EOF but found: /.test(i.message)) {
912
917
  n.__embeddedXmlFragmentRecoverIndex?.splice(
913
918
  0,
914
919
  n.__embeddedXmlFragmentRecoverIndex.length,
915
- a.token.startOffset
920
+ i.token.startOffset
916
921
  );
917
922
  break;
918
923
  }
919
924
  if (/Expecting token of type --> OPEN <-- but found --> '[\s\S]+' <--/.test(
920
- a.message
925
+ i.message
921
926
  )) {
922
- if (a.token.endOffset === void 0 || Number.isNaN(a.token.endOffset))
927
+ if (i.token.endOffset === void 0 || Number.isNaN(i.token.endOffset))
923
928
  break;
924
929
  n.__embeddedXmlFragmentRecoverIndex?.splice(
925
930
  0,
926
931
  n.__embeddedXmlFragmentRecoverIndex.length,
927
- a.token.startOffset,
928
- a.token.endOffset
929
- ), i = !0;
932
+ i.token.startOffset,
933
+ i.token.endOffset
934
+ ), a = !0;
930
935
  break;
931
936
  }
932
- throw Pe(a);
937
+ throw we(i);
933
938
  }
934
- i && Ge(o);
939
+ a && Ke(o);
935
940
  }
936
941
  return o;
937
942
  },
938
943
  astFormat: "xml",
939
- locStart(e) {
940
- return e.location.startOffset;
944
+ locStart(t) {
945
+ return t.location.startOffset;
941
946
  },
942
- locEnd(e) {
943
- return e.location.endOffset ?? NaN;
947
+ locEnd(t) {
948
+ return t.location.endOffset ?? NaN;
944
949
  }
945
950
  };
946
- function Ge(e) {
947
- const n = e.children;
951
+ function Ke(t) {
952
+ const n = t.children;
948
953
  for (const r in n) {
949
- const t = n[r] ?? [];
950
- for (let s = t.length - 1; s >= 0; --s) {
951
- const o = t[s];
952
- if (Mn(o)) {
954
+ const e = n[r] ?? [];
955
+ for (let s = e.length - 1; s >= 0; --s) {
956
+ const o = e[s];
957
+ if (Dn(o)) {
953
958
  if (Object.keys(o.children).length === 0) {
954
- t.splice(s, 1), t.length === 0 && delete n[r];
959
+ e.splice(s, 1), e.length === 0 && delete n[r];
955
960
  continue;
956
961
  }
957
- Ge(o);
962
+ Ke(o);
958
963
  }
959
964
  }
960
965
  }
961
966
  }
962
- function Mn(e) {
963
- return "name" in e && "children" in e && "location" in e;
967
+ function Dn(t) {
968
+ return "name" in t && "children" in t && "location" in t;
964
969
  }
965
- const Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
970
+ const wn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
966
971
  __proto__: null,
967
- embeddedLanguage: Q,
968
- embedder: wn,
969
- options: Pn,
970
- parser: jn
971
- }, Symbol.toStringTag, { value: "Module" })), He = [], Xe = {}, Je = {}, Ye = {}, Cn = /* @__PURE__ */ Object.assign({
972
- "./css/index.ts": kt,
973
- "./es/index.ts": Rt,
974
- "./glsl/index.ts": Nt,
975
- "./html/index.ts": Kt,
976
- "./markdown/index.ts": Jt,
977
- "./noop/index.ts": Qt,
978
- "./php/index.ts": rn,
979
- "./ruby/index.ts": pn,
980
- "./sql/index.ts": xn,
981
- "./ts/index.ts": On,
982
- "./xml/index.ts": Fn
972
+ embeddedLanguage: V,
973
+ embedder: In,
974
+ options: On,
975
+ parser: Tn
976
+ }, Symbol.toStringTag, { value: "Module" })), Ue = [], ze = {}, Ge = {}, He = {}, Pn = /* @__PURE__ */ Object.assign({
977
+ "./css/index.ts": xt,
978
+ "./es/index.ts": kt,
979
+ "./glsl/index.ts": Rt,
980
+ "./html/index.ts": At,
981
+ "./markdown/index.ts": Ut,
982
+ "./noop/index.ts": Ht,
983
+ "./php/index.ts": Qt,
984
+ "./ruby/index.ts": cn,
985
+ "./sql/index.ts": bn,
986
+ "./ts/index.ts": $n,
987
+ "./xml/index.ts": wn
983
988
  });
984
- Object.values(Cn).forEach(
985
- ({ embeddedLanguage: e, parser: n, embedder: r, options: t }) => {
986
- Et(He, e, V), n && (Xe[e] = n), r && (Je[e] = r), Object.assign(Ye, t);
989
+ Object.values(Pn).forEach(
990
+ ({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => {
991
+ ht(Ue, t, Y), n && (ze[t] = n), r && (Ge[t] = r), Object.assign(He, e);
987
992
  }
988
993
  );
989
- const Nn = "noEmbeddedIdentificationByComment", An = "noEmbeddedIdentificationByTag", qn = "preserveEmbeddedExteriorWhitespaces", Bn = "noEmbeddedMultiLineIndentation", Wn = "embeddedOverrides", _r = {
990
- ...Ye,
991
- [Nn]: {
994
+ const Rn = "noEmbeddedIdentificationByComment", Mn = "noEmbeddedIdentificationByTag", Fn = "preserveEmbeddedExteriorWhitespaces", Cn = "noEmbeddedMultiLineIndentation", Nn = "embeddedOverrides", lr = {
995
+ ...He,
996
+ [Rn]: {
992
997
  category: "Global",
993
998
  type: "string",
994
999
  array: !0,
995
1000
  default: [{ value: [] }],
996
1001
  description: 'This option turns off "/* identifier */ `...`" comment-based language identification for the specified identifiers.'
997
1002
  },
998
- [An]: {
1003
+ [Mn]: {
999
1004
  category: "Global",
1000
1005
  type: "string",
1001
1006
  array: !0,
1002
1007
  default: [{ value: [] }],
1003
1008
  description: 'This option turns off "identifier`...`" tag-based language identification for the specified identifiers.'
1004
1009
  },
1005
- [qn]: {
1010
+ [Fn]: {
1006
1011
  category: "Config",
1007
1012
  type: "string",
1008
1013
  array: !0,
1009
1014
  default: [{ value: [] }],
1010
1015
  description: "This option preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
1011
1016
  },
1012
- [Bn]: {
1017
+ [Cn]: {
1013
1018
  category: "Global",
1014
1019
  type: "string",
1015
1020
  array: !0,
1016
1021
  default: [{ value: [] }],
1017
1022
  description: "This option turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
1018
1023
  },
1019
- [Wn]: {
1024
+ [Nn]: {
1020
1025
  category: "Global",
1021
1026
  type: "string",
1022
1027
  array: !1,
1023
1028
  default: void 0,
1024
1029
  description: "This option accepts option overrides for the specified identifiers. It should either be a stringified JSON or an absolute filepath to the option overrides file."
1025
1030
  }
1026
- }, Er = {
1031
+ }, ur = {
1027
1032
  // parsers from internal
1028
- ...tt.parsers,
1033
+ ...Qe.parsers,
1034
+ ...Ze.parsers,
1035
+ ...et.parsers,
1029
1036
  ...nt.parsers,
1030
- ...rt.parsers,
1031
- ...ot.parsers,
1032
- ...st.parsers,
1037
+ ...tt.parsers,
1033
1038
  // parsers from this plugin
1034
- ...Xe
1039
+ ...ze
1035
1040
  };
1036
- var Un = {
1041
+ var jn = {
1037
1042
  isEqual: !0,
1038
1043
  isMatchingKey: !0,
1039
1044
  isPromise: !0,
@@ -1042,40 +1047,40 @@ var Un = {
1042
1047
  onCacheChange: !0,
1043
1048
  onCacheHit: !0,
1044
1049
  transformKey: !0
1045
- }, Kn = Array.prototype.slice;
1046
- function W(e) {
1047
- var n = e.length;
1048
- return n ? n === 1 ? [e[0]] : n === 2 ? [e[0], e[1]] : n === 3 ? [e[0], e[1], e[2]] : Kn.call(e, 0) : [];
1050
+ }, An = Array.prototype.slice;
1051
+ function W(t) {
1052
+ var n = t.length;
1053
+ return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : An.call(t, 0) : [];
1049
1054
  }
1050
- function zn(e) {
1055
+ function qn(t) {
1051
1056
  var n = {};
1052
- for (var r in e)
1053
- Un[r] || (n[r] = e[r]);
1057
+ for (var r in t)
1058
+ jn[r] || (n[r] = t[r]);
1054
1059
  return n;
1055
1060
  }
1056
- function Gn(e) {
1057
- return typeof e == "function" && e.isMemoized;
1061
+ function Bn(t) {
1062
+ return typeof t == "function" && t.isMemoized;
1058
1063
  }
1059
- function Hn(e, n) {
1060
- return e === n || e !== e && n !== n;
1064
+ function Wn(t, n) {
1065
+ return t === n || t !== t && n !== n;
1061
1066
  }
1062
- function Re(e, n) {
1067
+ function Pe(t, n) {
1063
1068
  var r = {};
1064
- for (var t in e)
1065
- r[t] = e[t];
1066
- for (var t in n)
1067
- r[t] = n[t];
1069
+ for (var e in t)
1070
+ r[e] = t[e];
1071
+ for (var e in n)
1072
+ r[e] = n[e];
1068
1073
  return r;
1069
1074
  }
1070
- var Xn = (
1075
+ var Kn = (
1071
1076
  /** @class */
1072
1077
  function() {
1073
- function e(n) {
1078
+ function t(n) {
1074
1079
  this.keys = [], this.values = [], this.options = n;
1075
1080
  var r = typeof n.isMatchingKey == "function";
1076
1081
  r ? this.getKeyIndex = this._getKeyIndexFromMatchingKey : n.maxSize > 1 ? this.getKeyIndex = this._getKeyIndexForMany : this.getKeyIndex = this._getKeyIndexForSingle, this.canTransformKey = typeof n.transformKey == "function", this.shouldCloneArguments = this.canTransformKey || r, this.shouldUpdateOnAdd = typeof n.onCacheAdd == "function", this.shouldUpdateOnChange = typeof n.onCacheChange == "function", this.shouldUpdateOnHit = typeof n.onCacheHit == "function";
1077
1082
  }
1078
- return Object.defineProperty(e.prototype, "size", {
1083
+ return Object.defineProperty(t.prototype, "size", {
1079
1084
  /**
1080
1085
  * The number of cached [key,value] results.
1081
1086
  */
@@ -1084,7 +1089,7 @@ var Xn = (
1084
1089
  },
1085
1090
  enumerable: !1,
1086
1091
  configurable: !0
1087
- }), Object.defineProperty(e.prototype, "snapshot", {
1092
+ }), Object.defineProperty(t.prototype, "snapshot", {
1088
1093
  /**
1089
1094
  * A copy of the cache at a moment in time. This is useful
1090
1095
  * to compare changes over time, since the cache mutates
@@ -1099,218 +1104,188 @@ var Xn = (
1099
1104
  },
1100
1105
  enumerable: !1,
1101
1106
  configurable: !0
1102
- }), e.prototype._getKeyIndexFromMatchingKey = function(n) {
1103
- var r = this.options, t = r.isMatchingKey, s = r.maxSize, o = this.keys, i = o.length;
1104
- if (!i)
1107
+ }), t.prototype._getKeyIndexFromMatchingKey = function(n) {
1108
+ var r = this.options, e = r.isMatchingKey, s = r.maxSize, o = this.keys, a = o.length;
1109
+ if (!a)
1105
1110
  return -1;
1106
- if (t(o[0], n))
1111
+ if (e(o[0], n))
1107
1112
  return 0;
1108
1113
  if (s > 1) {
1109
- for (var a = 1; a < i; a++)
1110
- if (t(o[a], n))
1111
- return a;
1114
+ for (var i = 1; i < a; i++)
1115
+ if (e(o[i], n))
1116
+ return i;
1112
1117
  }
1113
1118
  return -1;
1114
- }, e.prototype._getKeyIndexForMany = function(n) {
1115
- var r = this.options.isEqual, t = this.keys, s = t.length;
1119
+ }, t.prototype._getKeyIndexForMany = function(n) {
1120
+ var r = this.options.isEqual, e = this.keys, s = e.length;
1116
1121
  if (!s)
1117
1122
  return -1;
1118
1123
  if (s === 1)
1119
1124
  return this._getKeyIndexForSingle(n);
1120
- var o = n.length, i, a;
1125
+ var o = n.length, a, i;
1121
1126
  if (o > 1) {
1122
1127
  for (var c = 0; c < s; c++)
1123
- if (i = t[c], i.length === o) {
1124
- for (a = 0; a < o && r(i[a], n[a]); a++)
1128
+ if (a = e[c], a.length === o) {
1129
+ for (i = 0; i < o && r(a[i], n[i]); i++)
1125
1130
  ;
1126
- if (a === o)
1131
+ if (i === o)
1127
1132
  return c;
1128
1133
  }
1129
1134
  } else
1130
1135
  for (var c = 0; c < s; c++)
1131
- if (i = t[c], i.length === o && r(i[0], n[0]))
1136
+ if (a = e[c], a.length === o && r(a[0], n[0]))
1132
1137
  return c;
1133
1138
  return -1;
1134
- }, e.prototype._getKeyIndexForSingle = function(n) {
1139
+ }, t.prototype._getKeyIndexForSingle = function(n) {
1135
1140
  var r = this.keys;
1136
1141
  if (!r.length)
1137
1142
  return -1;
1138
- var t = r[0], s = t.length;
1143
+ var e = r[0], s = e.length;
1139
1144
  if (n.length !== s)
1140
1145
  return -1;
1141
1146
  var o = this.options.isEqual;
1142
1147
  if (s > 1) {
1143
- for (var i = 0; i < s; i++)
1144
- if (!o(t[i], n[i]))
1148
+ for (var a = 0; a < s; a++)
1149
+ if (!o(e[a], n[a]))
1145
1150
  return -1;
1146
1151
  return 0;
1147
1152
  }
1148
- return o(t[0], n[0]) ? 0 : -1;
1149
- }, e.prototype.orderByLru = function(n, r, t) {
1150
- for (var s = this.keys, o = this.values, i = s.length, a = t; a--; )
1151
- s[a + 1] = s[a], o[a + 1] = o[a];
1153
+ return o(e[0], n[0]) ? 0 : -1;
1154
+ }, t.prototype.orderByLru = function(n, r, e) {
1155
+ for (var s = this.keys, o = this.values, a = s.length, i = e; i--; )
1156
+ s[i + 1] = s[i], o[i + 1] = o[i];
1152
1157
  s[0] = n, o[0] = r;
1153
1158
  var c = this.options.maxSize;
1154
- i === c && t === i ? (s.pop(), o.pop()) : t >= c && (s.length = o.length = c);
1155
- }, e.prototype.updateAsyncCache = function(n) {
1156
- var r = this, t = this.options, s = t.onCacheChange, o = t.onCacheHit, i = this.keys[0], a = this.values[0];
1157
- this.values[0] = a.then(function(c) {
1159
+ a === c && e === a ? (s.pop(), o.pop()) : e >= c && (s.length = o.length = c);
1160
+ }, t.prototype.updateAsyncCache = function(n) {
1161
+ var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, a = this.keys[0], i = this.values[0];
1162
+ this.values[0] = i.then(function(c) {
1158
1163
  return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), c;
1159
1164
  }, function(c) {
1160
- var l = r.getKeyIndex(i);
1165
+ var l = r.getKeyIndex(a);
1161
1166
  throw l !== -1 && (r.keys.splice(l, 1), r.values.splice(l, 1)), c;
1162
1167
  });
1163
- }, e;
1168
+ }, t;
1164
1169
  }()
1165
1170
  );
1166
- function Ve(e, n) {
1167
- if (n === void 0 && (n = {}), Gn(e))
1168
- return Ve(e.fn, Re(e.options, n));
1169
- if (typeof e != "function")
1171
+ function Xe(t, n) {
1172
+ if (n === void 0 && (n = {}), Bn(t))
1173
+ return Xe(t.fn, Pe(t.options, n));
1174
+ if (typeof t != "function")
1170
1175
  throw new TypeError("You must pass a function to `memoize`.");
1171
- var r = n.isEqual, t = r === void 0 ? Hn : r, s = n.isMatchingKey, o = n.isPromise, i = o === void 0 ? !1 : o, a = n.maxSize, c = a === void 0 ? 1 : a, l = n.onCacheAdd, u = n.onCacheChange, m = n.onCacheHit, _ = n.transformKey, b = Re({
1172
- isEqual: t,
1176
+ var r = n.isEqual, e = r === void 0 ? Wn : r, s = n.isMatchingKey, o = n.isPromise, a = o === void 0 ? !1 : o, i = n.maxSize, c = i === void 0 ? 1 : i, l = n.onCacheAdd, u = n.onCacheChange, m = n.onCacheHit, _ = n.transformKey, b = Pe({
1177
+ isEqual: e,
1173
1178
  isMatchingKey: s,
1174
- isPromise: i,
1179
+ isPromise: a,
1175
1180
  maxSize: c,
1176
1181
  onCacheAdd: l,
1177
1182
  onCacheChange: u,
1178
1183
  onCacheHit: m,
1179
1184
  transformKey: _
1180
- }, zn(n)), d = new Xn(b), g = d.keys, y = d.values, f = d.canTransformKey, h = d.shouldCloneArguments, p = d.shouldUpdateOnAdd, v = d.shouldUpdateOnChange, E = d.shouldUpdateOnHit, x = function() {
1185
+ }, qn(n)), d = new Kn(b), g = d.keys, y = d.values, f = d.canTransformKey, h = d.shouldCloneArguments, p = d.shouldUpdateOnAdd, v = d.shouldUpdateOnChange, E = d.shouldUpdateOnHit, x = function() {
1181
1186
  var S = h ? W(arguments) : arguments;
1182
1187
  f && (S = _(S));
1183
1188
  var L = g.length ? d.getKeyIndex(S) : -1;
1184
1189
  if (L !== -1)
1185
1190
  E && m(d, b, x), L && (d.orderByLru(g[L], y[L], L), v && u(d, b, x));
1186
1191
  else {
1187
- var Ze = e.apply(this, arguments), et = h ? S : W(arguments);
1188
- d.orderByLru(et, Ze, g.length), i && d.updateAsyncCache(x), p && l(d, b, x), v && u(d, b, x);
1192
+ var Ye = t.apply(this, arguments), Ve = h ? S : W(arguments);
1193
+ d.orderByLru(Ve, Ye, g.length), a && d.updateAsyncCache(x), p && l(d, b, x), v && u(d, b, x);
1189
1194
  }
1190
1195
  return y[0];
1191
1196
  };
1192
- return x.cache = d, x.fn = e, x.isMemoized = !0, x.options = b, x;
1197
+ return x.cache = d, x.fn = t, x.isMemoized = !0, x.options = b, x;
1193
1198
  }
1194
- const je = (e) => e instanceof URL ? pt(e) : e;
1195
- async function Jn(e, {
1196
- cwd: n = Me.cwd(),
1197
- type: r = "file",
1198
- stopAt: t
1199
- } = {}) {
1200
- let s = T.resolve(je(n) ?? "");
1201
- const { root: o } = T.parse(s);
1202
- for (t = T.resolve(s, je(t ?? o)); s && s !== t && s !== o; ) {
1203
- const i = T.isAbsolute(e) ? e : T.join(s, e);
1204
- try {
1205
- const a = await at.stat(i);
1206
- if (r === "file" && a.isFile() || r === "directory" && a.isDirectory())
1207
- return i;
1208
- } catch {
1209
- }
1210
- s = T.dirname(s);
1211
- }
1212
- }
1213
- async function Yn({ cwd: e = Me.cwd() } = {}) {
1214
- return Jn("package.json", { cwd: e });
1215
- }
1216
- async function X(e) {
1199
+ async function Re(t) {
1217
1200
  try {
1218
- const n = await dt(e, { encoding: "utf-8" });
1201
+ const n = await st(t, { encoding: "utf-8" });
1219
1202
  return JSON.parse(n);
1220
1203
  } catch {
1221
1204
  }
1222
1205
  }
1223
- const Vn = new URL(
1224
- "data:text/javascript," + encodeURIComponent(
1225
- 'import{workerData as r,parentPort as t}from"node:worker_threads";import{pathToFileURL as a}from"node:url";async function d({absolutePath:o}){try{const e=await import(a(o).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}}d(r);'
1226
- )
1206
+ const Un = /* @__PURE__ */ new URL(
1207
+ "data:text/javascript," + encodeURIComponent('import{pathToFileURL as r}from"node:url";import{parentPort as t,workerData as a}from"node:worker_threads";const s=async({absolutePath:o})=>{try{const e=await import(r(o).href);t?.postMessage(e.embeddedOverrides??e.default??void 0)}catch{t?.postMessage(void 0)}};s(a);')
1227
1208
  );
1228
- async function Qn(e) {
1209
+ async function zn(t) {
1229
1210
  return new Promise((n) => {
1230
- const r = new gt(Vn, {
1211
+ const r = new ct(Un, {
1231
1212
  workerData: {
1232
- absolutePath: e
1213
+ absolutePath: t
1233
1214
  }
1234
1215
  });
1235
- r.once("message", (t) => {
1236
- n(t);
1237
- }), r.once("error", (t) => {
1238
- console.error(t), n(void 0);
1216
+ r.once("message", (e) => {
1217
+ n(e);
1218
+ }), r.once("error", (e) => {
1219
+ console.error(e), n(void 0);
1239
1220
  });
1240
1221
  });
1241
1222
  }
1242
- async function Zn(e) {
1243
- const n = await Yn({ cwd: e });
1244
- if (n === void 0)
1245
- return "cjs";
1246
- switch ((await X(n))?.type) {
1247
- case "module":
1248
- return "es";
1249
- case "commonjs":
1250
- return "cjs";
1251
- default:
1252
- return "cjs";
1253
- }
1223
+ async function Gn(t) {
1224
+ console.error(
1225
+ "Ts module type embeddedOverrides has not been implemented yet."
1226
+ );
1254
1227
  }
1255
- const er = Ve(
1256
- async (e, n) => {
1257
- if (ct(e))
1258
- return e;
1259
- const r = await ft(n);
1260
- let t;
1261
- return typeof r != "string" ? t = process.env.PWD ?? process.cwd() : t = lt(r), ut(t, e);
1228
+ const Hn = Xe(
1229
+ async (t, n) => {
1230
+ if (ot(t))
1231
+ return t;
1232
+ const r = await lt(n);
1233
+ let e;
1234
+ return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = it(r), at(e, t);
1262
1235
  }
1263
- ), tr = async (e, n) => {
1264
- const r = er(
1265
- e,
1236
+ ), Xn = async (t, n) => {
1237
+ const r = Hn(
1238
+ t,
1266
1239
  n
1267
- ), t = Zn(n), s = mt(e);
1268
- if (s === ".json") {
1269
- const o = await r, i = await X(o);
1270
- if (i !== void 0)
1271
- return i;
1272
- console.error(`Failed to parse the json file: ${o}`);
1240
+ ), e = dt(t);
1241
+ if (e === ".json") {
1242
+ const s = await r, o = await Re(s);
1243
+ if (o !== void 0)
1244
+ return o;
1245
+ console.error(`Failed to parse the json file: ${s}`);
1273
1246
  return;
1274
- } else if (s === ".mjs" || s === ".cjs" || s === ".js") {
1275
- const o = await r, i = await Qn(o);
1276
- if (i !== void 0)
1277
- return i;
1278
- console.error(`Failed to parse the js module file: ${o}`);
1247
+ } else if (e === ".mjs" || e === ".cjs" || e === ".js") {
1248
+ const s = await r, o = await zn(s);
1249
+ if (o !== void 0)
1250
+ return o;
1251
+ console.error(`Failed to parse the js module file: ${s}`);
1279
1252
  return;
1280
- } else if (!(s === ".mts" || s === ".ts" && await t === "es")) {
1281
- if (!(s === ".cts" || s === ".ts" && await t === "cjs")) {
1282
- if (s === "") {
1283
- const o = await r, i = await X(o);
1284
- if (i !== void 0)
1285
- return i;
1286
- }
1287
- }
1253
+ } else if (e === ".mts" || e === ".cts" || e === ".ts") {
1254
+ const s = await r, o = await Gn();
1255
+ if (o !== void 0)
1256
+ return o;
1257
+ console.error(`Failed to parse the ts module file: ${s}`);
1258
+ return;
1259
+ } else if (e === "") {
1260
+ const s = await r, o = await Re(s);
1261
+ if (o !== void 0)
1262
+ return o;
1288
1263
  }
1289
1264
  try {
1290
- return JSON.parse(e);
1265
+ return JSON.parse(t);
1291
1266
  } catch {
1292
1267
  console.error("Failed to parse embeddedOverrides as a json object");
1293
1268
  }
1294
- }, nr = async (e, n, r) => {
1295
- if (e === void 0)
1269
+ }, Jn = async (t, n, r) => {
1270
+ if (t === void 0)
1296
1271
  return;
1297
- const t = await tr(
1298
- e,
1272
+ const e = await Xn(
1273
+ t,
1299
1274
  r
1300
1275
  );
1301
- if (t !== void 0)
1276
+ if (e !== void 0)
1302
1277
  try {
1303
- for (const { identifiers: s, options: o } of t)
1278
+ for (const { identifiers: s, options: o } of e)
1304
1279
  if (s.includes(n))
1305
1280
  return o;
1306
1281
  } catch {
1307
1282
  console.error("Error parsing embedded override options.");
1308
1283
  }
1309
1284
  };
1310
- function rr({ node: e, parent: n }, r, t) {
1311
- if (r.length === 0 || e.type !== "TemplateLiteral")
1285
+ function Yn({ node: t, parent: n }, r, e) {
1286
+ if (r.length === 0 || t.type !== "TemplateLiteral")
1312
1287
  return;
1313
- const s = e.comments ?? n?.comments;
1288
+ const s = t.comments ?? n?.comments;
1314
1289
  if (!s)
1315
1290
  return;
1316
1291
  const o = s[s.length - 1];
@@ -1322,49 +1297,49 @@ function rr({ node: e, parent: n }, r, t) {
1322
1297
  "CommentBlock"
1323
1298
  // babel, babel-flow, babel-ts
1324
1299
  ].includes(o.type) || !o.leading)) {
1325
- for (const i of r)
1326
- if (` ${i} ` === o.value && !t.includes(i))
1327
- return i;
1300
+ for (const a of r)
1301
+ if (` ${a} ` === o.value && !e.includes(a))
1302
+ return a;
1328
1303
  }
1329
1304
  }
1330
- function sr({ node: e, parent: n }, r, t) {
1331
- if (r.length !== 0 && !(e.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1305
+ function Vn({ node: t, parent: n }, r, e) {
1306
+ if (r.length !== 0 && !(t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression" || n.tag.type !== "Identifier")) {
1332
1307
  for (const s of r)
1333
- if (n.tag.name === s && !t.includes(s))
1308
+ if (n.tag.name === s && !e.includes(s))
1334
1309
  return s;
1335
1310
  }
1336
1311
  }
1337
- const { estree: Qe } = it, or = function(e, n) {
1338
- const { node: r } = e;
1339
- if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: t } }) => t === null))
1312
+ const { estree: Je } = rt, Qn = function(t, n) {
1313
+ const { node: r } = t;
1314
+ if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
1340
1315
  return null;
1341
- for (const t of He) {
1342
- const s = n[I(t)];
1316
+ for (const e of Ue) {
1317
+ const s = n[I(e)];
1343
1318
  if (!s)
1344
1319
  continue;
1345
- const o = rr(
1346
- e,
1320
+ const o = Yn(
1321
+ t,
1347
1322
  s,
1348
1323
  n.noEmbeddedIdentificationByComment ?? []
1349
- ) ?? sr(
1350
- e,
1324
+ ) ?? Vn(
1325
+ t,
1351
1326
  s,
1352
1327
  n.noEmbeddedIdentificationByTag ?? []
1353
1328
  );
1354
1329
  if (o === void 0)
1355
1330
  continue;
1356
- const i = Je[t];
1357
- if (!i)
1331
+ const a = Ge[e];
1332
+ if (!a)
1358
1333
  return null;
1359
- const a = e.node;
1360
- return a.quasis.length === 1 && a.quasis[0].value.raw.trim() === "" ? "``" : async (c, l, u, m) => {
1361
- const _ = await nr(
1334
+ const i = t.node;
1335
+ return i.quasis.length === 1 && i.quasis[0].value.raw.trim() === "" ? "``" : async (c, l, u, m) => {
1336
+ const _ = await Jn(
1362
1337
  m.embeddedOverrides,
1363
1338
  o,
1364
1339
  m.filepath
1365
1340
  );
1366
1341
  try {
1367
- const b = await i(c, l, u, m, {
1342
+ const b = await a(c, l, u, m, {
1368
1343
  identifier: o,
1369
1344
  identifiers: s,
1370
1345
  embeddedOverrideOptions: _
@@ -1378,20 +1353,20 @@ const { estree: Qe } = it, or = function(e, n) {
1378
1353
  }
1379
1354
  };
1380
1355
  }
1381
- return Qe.embed?.(e, n) ?? null;
1382
- }, xr = {
1356
+ return Je.embed?.(t, n) ?? null;
1357
+ }, mr = {
1383
1358
  estree: {
1384
- ...Qe,
1385
- embed: or
1359
+ ...Je,
1360
+ embed: Qn
1386
1361
  }
1387
1362
  };
1388
1363
  export {
1389
- Je as embeddedEmbedders,
1390
- He as embeddedLanguages,
1391
- Ye as embeddedOptions,
1392
- Xe as embeddedParsers,
1364
+ Ge as embeddedEmbedders,
1365
+ Ue as embeddedLanguages,
1366
+ He as embeddedOptions,
1367
+ ze as embeddedParsers,
1393
1368
  I as makeIdentifiersOptionName,
1394
- _r as options,
1395
- Er as parsers,
1396
- xr as printers
1369
+ lr as options,
1370
+ ur as parsers,
1371
+ mr as printers
1397
1372
  };