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