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

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