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/README.md +16 -5
- package/dist/embedded/css/options.d.ts +2 -2
- package/dist/embedded/es/options.d.ts +4 -4
- package/dist/embedded/markdown/options.d.ts +2 -2
- package/dist/embedded/register.d.ts +4 -4
- package/dist/embedded/sql/options.d.ts +6 -8
- package/dist/embedded/ts/options.d.ts +3 -3
- package/dist/index.js +399 -498
- package/dist/options.d.ts +1 -1
- package/package.json +17 -17
package/dist/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { utils as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { printers as
|
|
8
|
-
import { readFile as
|
|
9
|
-
import { isAbsolute as
|
|
10
|
-
import { Worker as
|
|
11
|
-
import { resolveConfigFile as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
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 =
|
|
16
|
+
return r?.comments?.length && (e = dt([ct([V, e]), V])), ["${", e, lt, "}"];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function D(t, n) {
|
|
19
19
|
return t.map(
|
|
20
|
-
(r) =>
|
|
20
|
+
(r) => mt(r, n),
|
|
21
21
|
"expressions"
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
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
|
|
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
|
|
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
|
|
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
|
|
77
|
-
const r =
|
|
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
|
|
86
|
+
function Z(t) {
|
|
87
87
|
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function $(t) {
|
|
90
90
|
return `${t}Identifiers`;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function Me(t) {
|
|
93
93
|
return `${t}Parser`;
|
|
94
94
|
}
|
|
95
|
-
const { line:
|
|
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 } =
|
|
101
|
-
(f,
|
|
102
|
-
).join(""),
|
|
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 =
|
|
105
|
+
}), d = L(b, c, v);
|
|
106
106
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
107
|
-
return
|
|
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
|
|
115
|
-
return
|
|
114
|
+
const m = p.length ? ee : ne, y = u.length ? ee : ne;
|
|
115
|
+
return k([
|
|
116
116
|
"`",
|
|
117
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
117
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, k(d)] : te([m, k(d)]),
|
|
118
118
|
y,
|
|
119
119
|
"`"
|
|
120
120
|
]);
|
|
121
|
-
},
|
|
122
|
-
[
|
|
121
|
+
}, ft = ["css"], ht = $(Pe), bt = {
|
|
122
|
+
[ht]: {
|
|
123
123
|
category: "Global",
|
|
124
124
|
type: "string",
|
|
125
125
|
array: !0,
|
|
126
|
-
default: [{ value: [...
|
|
126
|
+
default: [{ value: [...ft] }],
|
|
127
127
|
description: "Specify embedded CSS language identifiers."
|
|
128
128
|
}
|
|
129
|
-
},
|
|
129
|
+
}, yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
130
130
|
__proto__: null,
|
|
131
|
-
embeddedLanguage:
|
|
132
|
-
embedder:
|
|
133
|
-
options:
|
|
134
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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 } =
|
|
140
|
-
(f,
|
|
141
|
-
).join(""),
|
|
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 =
|
|
144
|
+
}), d = L(b, c, v);
|
|
145
145
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
146
|
-
return
|
|
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
|
|
154
|
-
return
|
|
153
|
+
const m = p.length ? re : oe, y = u.length ? re : oe;
|
|
154
|
+
return T([
|
|
155
155
|
"`",
|
|
156
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
156
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, T(d)] : se([m, T(d)]),
|
|
157
157
|
y,
|
|
158
158
|
"`"
|
|
159
159
|
]);
|
|
160
|
-
},
|
|
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
|
-
],
|
|
170
|
-
[
|
|
169
|
+
], _t = $(H), xt = Me(H), It = {
|
|
170
|
+
[_t]: {
|
|
171
171
|
category: "Global",
|
|
172
172
|
type: "string",
|
|
173
173
|
array: !0,
|
|
174
|
-
default: [{ value: [...
|
|
174
|
+
default: [{ value: [...Et] }],
|
|
175
175
|
description: "Specify embedded ES language identifiers."
|
|
176
176
|
},
|
|
177
|
-
[
|
|
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
|
-
},
|
|
184
|
+
}, $t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
185
185
|
__proto__: null,
|
|
186
|
-
embeddedLanguage:
|
|
187
|
-
embedder:
|
|
188
|
-
options:
|
|
189
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
190
|
-
|
|
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 } =
|
|
195
|
-
(
|
|
196
|
-
).join(""),
|
|
197
|
-
|
|
198
|
-
-
|
|
199
|
-
), b =
|
|
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
|
-
}),
|
|
202
|
+
}), m = L(d, c, b);
|
|
203
203
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
204
|
-
return
|
|
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 =
|
|
212
|
-
return
|
|
211
|
+
const y = p.length ? ie : de, f = u.length ? ie : de;
|
|
212
|
+
return O([
|
|
213
213
|
"`",
|
|
214
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y,
|
|
214
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, O(m)] : ae([y, O(m)]),
|
|
215
215
|
f,
|
|
216
216
|
"`"
|
|
217
217
|
]);
|
|
218
|
-
},
|
|
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
|
-
],
|
|
242
|
-
[
|
|
241
|
+
], Lt = $(Re), kt = {
|
|
242
|
+
[Lt]: {
|
|
243
243
|
category: "Global",
|
|
244
244
|
type: "string",
|
|
245
245
|
array: !0,
|
|
246
|
-
default: [{ value: [...
|
|
246
|
+
default: [{ value: [...St] }],
|
|
247
247
|
description: 'Specify embedded GLSL language identifiers. This requires "prettier-plugin-glsl".'
|
|
248
248
|
}
|
|
249
|
-
},
|
|
249
|
+
}, Tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
250
250
|
__proto__: null,
|
|
251
|
-
embeddedLanguage:
|
|
252
|
-
embedder:
|
|
253
|
-
options:
|
|
254
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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 } =
|
|
260
|
-
(f,
|
|
261
|
-
).join(""),
|
|
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 =
|
|
264
|
+
}), d = Ot(b, (f) => {
|
|
265
265
|
if (typeof f != "string")
|
|
266
266
|
return f;
|
|
267
|
-
const
|
|
268
|
-
for (let
|
|
269
|
-
let
|
|
270
|
-
if (
|
|
271
|
-
if (!
|
|
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
|
-
|
|
273
|
+
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), g.push(_);
|
|
274
274
|
} else {
|
|
275
|
-
const x = Number(
|
|
276
|
-
|
|
275
|
+
const x = Number(_);
|
|
276
|
+
g.push(v[x]);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
return
|
|
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
|
|
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
|
|
291
|
-
return
|
|
290
|
+
const m = p.length ? ce : ue, y = u.length ? ce : ue;
|
|
291
|
+
return w([
|
|
292
292
|
"`",
|
|
293
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
293
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, w(d)] : le([m, w(d)]),
|
|
294
294
|
y,
|
|
295
295
|
"`"
|
|
296
296
|
]);
|
|
297
|
-
},
|
|
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
|
-
],
|
|
311
|
-
[
|
|
310
|
+
], Mt = $(Ne), Rt = {
|
|
311
|
+
[Mt]: {
|
|
312
312
|
category: "Global",
|
|
313
313
|
type: "string",
|
|
314
314
|
array: !0,
|
|
315
|
-
default: [{ value: [...
|
|
315
|
+
default: [{ value: [...Pt] }],
|
|
316
316
|
description: "Specify embedded HTML language identifiers."
|
|
317
317
|
}
|
|
318
|
-
},
|
|
318
|
+
}, Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
319
319
|
__proto__: null,
|
|
320
|
-
embeddedLanguage:
|
|
321
|
-
embedder:
|
|
322
|
-
options:
|
|
323
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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 } =
|
|
329
|
-
(f,
|
|
330
|
-
).join(""),
|
|
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 =
|
|
334
|
+
}), d = L(b, c, v);
|
|
335
335
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
336
|
-
return
|
|
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
|
|
344
|
-
return
|
|
343
|
+
const m = p.length ? me : pe, y = u.length ? me : pe;
|
|
344
|
+
return P([
|
|
345
345
|
"`",
|
|
346
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
346
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, P(d)] : ge([m, P(d)]),
|
|
347
347
|
y,
|
|
348
348
|
"`"
|
|
349
349
|
]);
|
|
350
|
-
},
|
|
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
|
-
],
|
|
363
|
-
[
|
|
362
|
+
], jt = $(Fe), At = {
|
|
363
|
+
[jt]: {
|
|
364
364
|
category: "Global",
|
|
365
365
|
type: "string",
|
|
366
366
|
array: !0,
|
|
367
|
-
default: [{ value: [...
|
|
367
|
+
default: [{ value: [...Ct] }],
|
|
368
368
|
description: "Specify embedded Markdown language identifiers."
|
|
369
369
|
}
|
|
370
|
-
},
|
|
370
|
+
}, Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
371
371
|
__proto__: null,
|
|
372
|
-
embeddedLanguage:
|
|
373
|
-
embedder:
|
|
374
|
-
options:
|
|
375
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
376
|
-
[
|
|
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
|
-
},
|
|
383
|
+
}, Gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
384
384
|
__proto__: null,
|
|
385
|
-
embeddedLanguage:
|
|
386
|
-
options:
|
|
387
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
388
|
-
|
|
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 } =
|
|
393
|
-
(
|
|
394
|
-
).join(""),
|
|
395
|
-
|
|
396
|
-
-
|
|
397
|
-
), b =
|
|
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
|
-
}),
|
|
400
|
+
}), m = L(d, c, b);
|
|
401
401
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
402
|
-
return
|
|
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 =
|
|
410
|
-
return
|
|
409
|
+
const y = p.length ? fe : be, f = u.length ? fe : be;
|
|
410
|
+
return M([
|
|
411
411
|
"`",
|
|
412
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y,
|
|
412
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [y, M(m)] : he([y, M(m)]),
|
|
413
413
|
f,
|
|
414
414
|
"`"
|
|
415
415
|
]);
|
|
416
|
-
},
|
|
417
|
-
[
|
|
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: [...
|
|
421
|
+
default: [{ value: [...zt] }],
|
|
422
422
|
description: 'Specify embedded PHP language identifiers. This requires "@prettier/plugin-php".'
|
|
423
423
|
}
|
|
424
|
-
},
|
|
424
|
+
}, Xt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
425
425
|
__proto__: null,
|
|
426
|
-
embeddedLanguage:
|
|
427
|
-
embedder:
|
|
428
|
-
options:
|
|
429
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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
|
-
],
|
|
456
|
-
...K,
|
|
455
|
+
], G = ["rbs"], K = ["haml"], Jt = [
|
|
457
456
|
...U,
|
|
458
|
-
...
|
|
459
|
-
|
|
460
|
-
|
|
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: [...
|
|
464
|
+
default: [{ value: [...Jt] }],
|
|
465
465
|
description: 'Specify embedded Ruby language identifiers. This requires "@prettier/plugin-ruby".'
|
|
466
466
|
},
|
|
467
|
-
[
|
|
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:
|
|
475
|
-
|
|
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 } =
|
|
480
|
-
(
|
|
481
|
-
).join(""),
|
|
482
|
-
|
|
483
|
-
-
|
|
484
|
-
), d =
|
|
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:
|
|
487
|
-
}), f =
|
|
486
|
+
parser: m
|
|
487
|
+
}), f = L(y, l, d);
|
|
488
488
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
489
|
-
return
|
|
489
|
+
return R([
|
|
490
490
|
"`",
|
|
491
|
-
|
|
492
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
493
|
-
|
|
491
|
+
u,
|
|
492
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(f)] : ve([R(f)]),
|
|
493
|
+
v,
|
|
494
494
|
"`"
|
|
495
495
|
]);
|
|
496
|
-
const
|
|
497
|
-
return
|
|
496
|
+
const g = u.length ? ye : Ee, h = v.length ? ye : Ee;
|
|
497
|
+
return R([
|
|
498
498
|
"`",
|
|
499
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
500
|
-
|
|
499
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [g, R(f)] : ve([g, R(f)]),
|
|
500
|
+
h,
|
|
501
501
|
"`"
|
|
502
502
|
]);
|
|
503
503
|
};
|
|
504
|
-
function
|
|
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 (
|
|
510
|
-
return K[0];
|
|
511
|
-
if (an(n))
|
|
509
|
+
if (tn(n))
|
|
512
510
|
return U[0];
|
|
513
|
-
if (
|
|
514
|
-
return
|
|
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
|
|
519
|
-
return K.includes(t);
|
|
520
|
-
}
|
|
521
|
-
function an(t) {
|
|
518
|
+
function tn(t) {
|
|
522
519
|
return U.includes(t);
|
|
523
520
|
}
|
|
524
|
-
function
|
|
525
|
-
return
|
|
521
|
+
function nn(t) {
|
|
522
|
+
return G.includes(t);
|
|
526
523
|
}
|
|
527
|
-
|
|
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:
|
|
530
|
-
RBS_PARSER_IDENTIFIERS:
|
|
531
|
-
RUBY_PARSER_IDENTIFIERS:
|
|
532
|
-
embeddedLanguage:
|
|
533
|
-
embedder:
|
|
534
|
-
options:
|
|
535
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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
|
-
...
|
|
538
|
+
...o
|
|
577
539
|
};
|
|
578
|
-
const { node:
|
|
579
|
-
(
|
|
580
|
-
).join(""),
|
|
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
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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
|
-
|
|
598
|
-
` ?
|
|
554
|
+
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((x) => x === `
|
|
555
|
+
` ? g.push(on) : g.push(x));
|
|
599
556
|
} else {
|
|
600
|
-
const
|
|
601
|
-
|
|
557
|
+
const x = Number(_);
|
|
558
|
+
g.push(v[x]);
|
|
602
559
|
}
|
|
603
560
|
}
|
|
604
|
-
return
|
|
561
|
+
return g;
|
|
605
562
|
});
|
|
606
563
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
607
564
|
return N([
|
|
608
565
|
"`",
|
|
609
|
-
|
|
610
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(
|
|
611
|
-
|
|
566
|
+
p,
|
|
567
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(d)] : Ie([N(d)]),
|
|
568
|
+
u,
|
|
612
569
|
"`"
|
|
613
570
|
]);
|
|
614
|
-
const
|
|
571
|
+
const m = p.length ? _e : xe, y = u.length ? _e : xe;
|
|
615
572
|
return N([
|
|
616
573
|
"`",
|
|
617
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
618
|
-
|
|
574
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, N(d)] : Ie([m, N(d)]),
|
|
575
|
+
y,
|
|
619
576
|
"`"
|
|
620
577
|
]);
|
|
621
|
-
},
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
627
|
-
|
|
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
|
-
|
|
686
|
-
|
|
687
|
-
embeddedLanguage: qe,
|
|
688
|
-
embedder: pn,
|
|
588
|
+
embeddedLanguage: Ae,
|
|
589
|
+
embedder: dn,
|
|
689
590
|
options: un
|
|
690
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
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 } =
|
|
696
|
-
(f,
|
|
697
|
-
).join(""),
|
|
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 =
|
|
604
|
+
}), d = L(b, c, v);
|
|
704
605
|
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
705
|
-
return
|
|
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
|
|
713
|
-
return
|
|
613
|
+
const m = p.length ? $e : Se, y = u.length ? $e : Se;
|
|
614
|
+
return F([
|
|
714
615
|
"`",
|
|
715
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [
|
|
616
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [m, F(d)] : De([m, F(d)]),
|
|
716
617
|
y,
|
|
717
618
|
"`"
|
|
718
619
|
]);
|
|
719
|
-
},
|
|
720
|
-
[
|
|
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: [...
|
|
625
|
+
default: [{ value: [...pn] }],
|
|
725
626
|
description: "Specify embedded TS language parsers."
|
|
726
627
|
},
|
|
727
|
-
[
|
|
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
|
-
},
|
|
635
|
+
}, yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
735
636
|
__proto__: null,
|
|
736
|
-
embeddedLanguage:
|
|
737
|
-
embedder:
|
|
738
|
-
options:
|
|
739
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
740
|
-
|
|
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 } =
|
|
745
|
-
(
|
|
746
|
-
).join(""),
|
|
747
|
-
|
|
748
|
-
-
|
|
749
|
-
), b =
|
|
750
|
-
let
|
|
751
|
-
for (;
|
|
752
|
-
const
|
|
753
|
-
if (
|
|
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
|
-
|
|
656
|
+
m > 0 && e.xmlWhitespaceSensitivity !== "strict" && d.push(z), e.__embeddedXmlFragmentRecoverIndex?.splice(
|
|
756
657
|
0,
|
|
757
658
|
e.__embeddedXmlFragmentRecoverIndex.length
|
|
758
659
|
);
|
|
759
|
-
let
|
|
660
|
+
let E = await t(h, {
|
|
760
661
|
...e,
|
|
761
|
-
parser:
|
|
662
|
+
parser: Y
|
|
762
663
|
});
|
|
763
|
-
const [
|
|
764
|
-
|
|
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 =
|
|
667
|
+
const y = L(d, c, b);
|
|
767
668
|
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
768
|
-
return
|
|
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 =
|
|
776
|
-
return
|
|
676
|
+
const f = p.length ? Le : z, g = u.length ? Le : z;
|
|
677
|
+
return C([
|
|
777
678
|
"`",
|
|
778
|
-
e.noEmbeddedMultiLineIndentation?.includes(s) ? [f,
|
|
779
|
-
|
|
679
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [f, C(y)] : ke([f, C(y)]),
|
|
680
|
+
g,
|
|
780
681
|
"`"
|
|
781
682
|
]);
|
|
782
|
-
},
|
|
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
|
-
],
|
|
840
|
-
[
|
|
740
|
+
], _n = $(Y), xn = {
|
|
741
|
+
[_n]: {
|
|
841
742
|
category: "Global",
|
|
842
743
|
type: "string",
|
|
843
744
|
array: !0,
|
|
844
|
-
default: [{ value: [...
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
838
|
+
throw Te(i);
|
|
938
839
|
}
|
|
939
|
-
a &&
|
|
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
|
|
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
|
-
|
|
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
|
|
871
|
+
const Sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
971
872
|
__proto__: null,
|
|
972
|
-
embeddedLanguage:
|
|
973
|
-
embedder:
|
|
974
|
-
options:
|
|
975
|
-
parser:
|
|
976
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
977
|
-
"./css/index.ts":
|
|
978
|
-
"./es/index.ts":
|
|
979
|
-
"./glsl/index.ts":
|
|
980
|
-
"./html/index.ts":
|
|
981
|
-
"./markdown/index.ts":
|
|
982
|
-
"./noop/index.ts":
|
|
983
|
-
"./php/index.ts":
|
|
984
|
-
"./ruby/index.ts":
|
|
985
|
-
"./sql/index.ts":
|
|
986
|
-
"./ts/index.ts":
|
|
987
|
-
"./xml/index.ts":
|
|
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(
|
|
890
|
+
Object.values(Ln).forEach(
|
|
990
891
|
({ embeddedLanguage: t, parser: n, embedder: r, options: e }) => {
|
|
991
|
-
|
|
892
|
+
gt(We, t, X), n && (Ue[t] = n), r && (Ge[t] = r), Object.assign(Ke, e);
|
|
992
893
|
}
|
|
993
894
|
);
|
|
994
|
-
const
|
|
995
|
-
...
|
|
996
|
-
[
|
|
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
|
-
[
|
|
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
|
-
[
|
|
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
|
-
[
|
|
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
|
-
[
|
|
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
|
-
},
|
|
932
|
+
}, ir = {
|
|
1032
933
|
// parsers from internal
|
|
1033
|
-
...
|
|
934
|
+
...Je.parsers,
|
|
935
|
+
...Ye.parsers,
|
|
936
|
+
...Ve.parsers,
|
|
1034
937
|
...Ze.parsers,
|
|
1035
|
-
...
|
|
1036
|
-
...nt.parsers,
|
|
1037
|
-
...tt.parsers,
|
|
938
|
+
...Qe.parsers,
|
|
1038
939
|
// parsers from this plugin
|
|
1039
|
-
...
|
|
940
|
+
...Ue
|
|
1040
941
|
};
|
|
1041
|
-
var
|
|
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
|
-
},
|
|
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]] :
|
|
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
|
|
956
|
+
function Nn(t) {
|
|
1056
957
|
var n = {};
|
|
1057
958
|
for (var r in t)
|
|
1058
|
-
|
|
959
|
+
Mn[r] || (n[r] = t[r]);
|
|
1059
960
|
return n;
|
|
1060
961
|
}
|
|
1061
|
-
function
|
|
962
|
+
function Fn(t) {
|
|
1062
963
|
return typeof t == "function" && t.isMemoized;
|
|
1063
964
|
}
|
|
1064
|
-
function
|
|
965
|
+
function Cn(t, n) {
|
|
1065
966
|
return t === n || t !== t && n !== n;
|
|
1066
967
|
}
|
|
1067
|
-
function
|
|
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
|
|
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
|
|
1172
|
-
if (n === void 0 && (n = {}),
|
|
1173
|
-
return
|
|
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 ?
|
|
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:
|
|
1183
|
-
onCacheHit:
|
|
1184
|
-
transformKey:
|
|
1185
|
-
},
|
|
1186
|
-
var
|
|
1187
|
-
f && (
|
|
1188
|
-
var
|
|
1189
|
-
if (
|
|
1190
|
-
|
|
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
|
|
1193
|
-
d.orderByLru(
|
|
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
|
|
1100
|
+
async function we(t) {
|
|
1200
1101
|
try {
|
|
1201
|
-
const n = await
|
|
1102
|
+
const n = await tt(t, { encoding: "utf-8" });
|
|
1202
1103
|
return JSON.parse(n);
|
|
1203
1104
|
} catch {
|
|
1204
1105
|
}
|
|
1205
1106
|
}
|
|
1206
|
-
const
|
|
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
|
|
1110
|
+
async function Bn(t) {
|
|
1210
1111
|
return new Promise((n) => {
|
|
1211
|
-
const r = new
|
|
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
|
|
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
|
|
1129
|
+
const Un = ze(
|
|
1229
1130
|
async (t, n) => {
|
|
1230
|
-
if (
|
|
1131
|
+
if (nt(t))
|
|
1231
1132
|
return t;
|
|
1232
|
-
const r = await
|
|
1133
|
+
const r = await at(n);
|
|
1233
1134
|
let e;
|
|
1234
|
-
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e =
|
|
1135
|
+
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = rt(r), st(e, t);
|
|
1235
1136
|
}
|
|
1236
|
-
),
|
|
1237
|
-
const r =
|
|
1137
|
+
), Gn = async (t, n) => {
|
|
1138
|
+
const r = Un(
|
|
1238
1139
|
t,
|
|
1239
1140
|
n
|
|
1240
|
-
), e =
|
|
1141
|
+
), e = ot(t);
|
|
1241
1142
|
if (e === ".json") {
|
|
1242
|
-
const s = await r, o = await
|
|
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
|
|
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
|
|
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
|
|
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
|
-
},
|
|
1170
|
+
}, Kn = async (t, n, r) => {
|
|
1270
1171
|
if (t === void 0)
|
|
1271
1172
|
return;
|
|
1272
|
-
const e = await
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
1317
|
-
const s = n[
|
|
1217
|
+
for (const e of We) {
|
|
1218
|
+
const s = n[$(e)];
|
|
1318
1219
|
if (!s)
|
|
1319
1220
|
continue;
|
|
1320
|
-
const o =
|
|
1221
|
+
const o = zn(
|
|
1321
1222
|
t,
|
|
1322
1223
|
s,
|
|
1323
1224
|
n.noEmbeddedIdentificationByComment ?? []
|
|
1324
|
-
) ??
|
|
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,
|
|
1336
|
-
const
|
|
1337
|
-
|
|
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
|
-
|
|
1240
|
+
u.filepath
|
|
1340
1241
|
);
|
|
1341
1242
|
try {
|
|
1342
|
-
const b = await a(c, l,
|
|
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
|
|
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
|
|
1357
|
-
},
|
|
1257
|
+
return qe.embed?.(t, n) ?? null;
|
|
1258
|
+
}, ar = {
|
|
1358
1259
|
estree: {
|
|
1359
|
-
...
|
|
1360
|
-
embed:
|
|
1260
|
+
...qe,
|
|
1261
|
+
embed: Hn
|
|
1361
1262
|
}
|
|
1362
1263
|
};
|
|
1363
1264
|
export {
|
|
1364
1265
|
Ge as embeddedEmbedders,
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
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
|
};
|