prettier-plugin-embed 0.4.5 → 0.4.7
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 +155 -103
- package/dist/embedded/css/options.d.ts +15 -1
- package/dist/embedded/es/options.d.ts +1 -1
- package/dist/embedded/glsl/options.d.ts +1 -1
- package/dist/embedded/graphql/options.d.ts +1 -1
- package/dist/embedded/html/options.d.ts +15 -1
- package/dist/embedded/ini/options.d.ts +1 -1
- package/dist/embedded/json/options.d.ts +1 -1
- package/dist/embedded/latex/options.d.ts +1 -1
- package/dist/embedded/markdown/options.d.ts +15 -1
- package/dist/embedded/noop/options.d.ts +1 -1
- package/dist/embedded/php/options.d.ts +1 -1
- package/dist/embedded/properties/options.d.ts +1 -1
- package/dist/embedded/register.d.ts +5 -5
- package/dist/embedded/ruby/options.d.ts +1 -1
- package/dist/embedded/sh/options.d.ts +3 -3
- package/dist/embedded/sql/options.d.ts +1 -1
- package/dist/embedded/toml/options.d.ts +3 -3
- package/dist/embedded/ts/options.d.ts +1 -1
- package/dist/embedded/xml/options.d.ts +2 -2
- package/dist/embedded/yaml/options.d.ts +1 -1
- package/dist/index.js +754 -724
- package/dist/options.d.ts +55 -25
- package/dist/types.d.ts +2 -1
- package/dist/utils.d.ts +4 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { utils as
|
|
1
|
+
import { utils as Y, builders as I } from "prettier/doc";
|
|
2
2
|
import wt from "prettier/parser-babel";
|
|
3
3
|
import Bt from "prettier/parser-espree";
|
|
4
4
|
import Ut from "prettier/parser-flow";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { printers as
|
|
8
|
-
import { readFile as
|
|
5
|
+
import qt from "prettier/parser-meriyah";
|
|
6
|
+
import Ct from "prettier/parser-typescript";
|
|
7
|
+
import { printers as Wt } from "prettier/plugins/estree.mjs";
|
|
8
|
+
import { readFile as Gt } from "node:fs/promises";
|
|
9
9
|
import { isAbsolute as zt, dirname as Kt, resolve as Ht, extname as Jt } from "node:path";
|
|
10
10
|
import { Worker as Xt } from "node:worker_threads";
|
|
11
11
|
import { resolveConfigFile as Yt } from "prettier";
|
|
12
|
-
const { group: Qt, indent: Vt, softline:
|
|
12
|
+
const { group: Qt, indent: Vt, softline: le, lineSuffixBoundary: Zt } = I, { mapDoc: en } = Y;
|
|
13
13
|
function tn(t, n) {
|
|
14
14
|
const { node: r } = t;
|
|
15
15
|
let e = n();
|
|
16
|
-
return r?.comments?.length && (e = Qt([Vt([
|
|
16
|
+
return r?.comments?.length && (e = Qt([Vt([le, e]), le])), ["${", e, Zt, "}"];
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function S(t, n) {
|
|
19
19
|
return t.map(
|
|
20
20
|
(r) => tn(r, n),
|
|
21
21
|
"expressions"
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return en(t, (
|
|
26
|
-
if (typeof
|
|
27
|
-
return
|
|
28
|
-
const
|
|
29
|
-
for (let
|
|
30
|
-
let g = l[
|
|
31
|
-
if (
|
|
24
|
+
function L(t, n, r) {
|
|
25
|
+
return en(t, (s) => {
|
|
26
|
+
if (typeof s != "string")
|
|
27
|
+
return s;
|
|
28
|
+
const o = [], l = s.split(n);
|
|
29
|
+
for (let a = 0; a < l.length; a++) {
|
|
30
|
+
let g = l[a];
|
|
31
|
+
if (a % 2 == 0) {
|
|
32
32
|
if (!g)
|
|
33
33
|
continue;
|
|
34
|
-
g = g.replaceAll(/([\\`]|\${)/g, "\\$1"),
|
|
34
|
+
g = g.replaceAll(/([\\`]|\${)/g, "\\$1"), o.push(g);
|
|
35
35
|
} else {
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
const c = Number(g);
|
|
37
|
+
o.push(r[c]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
return
|
|
40
|
+
return o;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function A(t, n, r) {
|
|
@@ -55,18 +55,18 @@ function nn(t, n, r) {
|
|
|
55
55
|
t.unshift(n);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
let e = 0,
|
|
59
|
-
for (; e <
|
|
60
|
-
const
|
|
61
|
-
if (t[
|
|
58
|
+
let e = 0, s = t.length;
|
|
59
|
+
for (; e < s; ) {
|
|
60
|
+
const o = e + s >>> 1;
|
|
61
|
+
if (t[o] === r) {
|
|
62
62
|
t.push(n);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
t[
|
|
65
|
+
t[o] < n ? e = o + 1 : s = o;
|
|
66
66
|
}
|
|
67
67
|
t.splice(e, 0, n);
|
|
68
68
|
}
|
|
69
|
-
const
|
|
69
|
+
const Q = (() => {
|
|
70
70
|
const t = [...Array(26).keys()].map((n) => String.fromCharCode(n + 97)).concat([...Array(10).keys()].map((n) => `${n}`));
|
|
71
71
|
return () => {
|
|
72
72
|
let r = "";
|
|
@@ -75,100 +75,110 @@ const Y = (() => {
|
|
|
75
75
|
return r;
|
|
76
76
|
};
|
|
77
77
|
})();
|
|
78
|
-
function
|
|
79
|
-
const r =
|
|
80
|
-
`${
|
|
78
|
+
function x(t = "p", n = "") {
|
|
79
|
+
const r = Q(), e = Q(), s = te(t), o = te(n), l = (g) => `${t}${r}${g}${e}${n}`, a = new RegExp(
|
|
80
|
+
`${s}${r}(\\d+)${e}${o}`,
|
|
81
81
|
"ig"
|
|
82
82
|
);
|
|
83
83
|
return {
|
|
84
84
|
createPlaceholder: l,
|
|
85
|
-
placeholderRegex:
|
|
85
|
+
placeholderRegex: a
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
function te(t) {
|
|
89
89
|
return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function T(t) {
|
|
92
92
|
return `${t}Identifiers`;
|
|
93
93
|
}
|
|
94
94
|
function rn(t) {
|
|
95
95
|
return `${t}Plugin`;
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function O(t) {
|
|
98
98
|
return `${t}Parser`;
|
|
99
99
|
}
|
|
100
|
-
const { line:
|
|
100
|
+
const { line: ue, group: P, indent: ge, softline: me } = I, sn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
101
101
|
e = {
|
|
102
102
|
...e,
|
|
103
|
-
...
|
|
103
|
+
...o
|
|
104
104
|
};
|
|
105
|
-
const { node: l } = r, { createPlaceholder:
|
|
106
|
-
(
|
|
107
|
-
).join(""), d =
|
|
105
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x("@p"), c = l.quasis.map(
|
|
106
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
107
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
108
108
|
d.length,
|
|
109
109
|
-u.length || void 0
|
|
110
|
-
), E =
|
|
110
|
+
), E = S(r, n), b = await t(y, {
|
|
111
111
|
...e,
|
|
112
|
-
parser: "scss"
|
|
113
|
-
}), i =
|
|
114
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
112
|
+
parser: e.embeddedCssParser ?? "scss"
|
|
113
|
+
}), i = L(b, g, E);
|
|
114
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
115
115
|
return P([
|
|
116
116
|
"`",
|
|
117
117
|
d,
|
|
118
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
118
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [P(i)] : ge([P(i)]),
|
|
119
119
|
u,
|
|
120
120
|
"`"
|
|
121
121
|
]);
|
|
122
|
-
const
|
|
122
|
+
const h = d.length ? ue : me, v = u.length ? ue : me;
|
|
123
123
|
return P([
|
|
124
124
|
"`",
|
|
125
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
125
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, P(i)] : ge([h, P(i)]),
|
|
126
126
|
v,
|
|
127
127
|
"`"
|
|
128
128
|
]);
|
|
129
|
-
},
|
|
129
|
+
}, ne = "embeddedCss", on = ["css"], an = ["css", "less", "scss"], cn = T(ne), dn = O(ne), ln = {
|
|
130
130
|
[cn]: {
|
|
131
131
|
category: "Embed",
|
|
132
132
|
type: "string",
|
|
133
133
|
array: !0,
|
|
134
|
-
default: [{ value: [...
|
|
135
|
-
description: "
|
|
134
|
+
default: [{ value: [...on] }],
|
|
135
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded CSS language."
|
|
136
|
+
},
|
|
137
|
+
[dn]: {
|
|
138
|
+
category: "Embed",
|
|
139
|
+
type: "choice",
|
|
140
|
+
default: "scss",
|
|
141
|
+
description: "The parser used to parse the embedded CSS language.",
|
|
142
|
+
choices: an.map((t) => ({
|
|
143
|
+
value: t,
|
|
144
|
+
description: `Use the "${t}" parser.`
|
|
145
|
+
}))
|
|
136
146
|
}
|
|
137
|
-
},
|
|
147
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
138
148
|
__proto__: null,
|
|
139
|
-
embedder:
|
|
140
|
-
language:
|
|
141
|
-
options:
|
|
142
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
149
|
+
embedder: sn,
|
|
150
|
+
language: ne,
|
|
151
|
+
options: ln
|
|
152
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: pe, group: M, indent: he, softline: fe } = I, gn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
143
153
|
e = {
|
|
144
154
|
...e,
|
|
145
|
-
...
|
|
155
|
+
...o
|
|
146
156
|
};
|
|
147
|
-
const { node: l } = r, { createPlaceholder:
|
|
148
|
-
(
|
|
149
|
-
).join(""), d =
|
|
157
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
158
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
159
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
150
160
|
d.length,
|
|
151
161
|
-u.length || void 0
|
|
152
|
-
), E =
|
|
162
|
+
), E = S(r, n), b = await t(y, {
|
|
153
163
|
...e,
|
|
154
164
|
parser: e.embeddedEsParser ?? "babel"
|
|
155
|
-
}), i =
|
|
156
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
157
|
-
return
|
|
165
|
+
}), i = L(b, g, E);
|
|
166
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
167
|
+
return M([
|
|
158
168
|
"`",
|
|
159
169
|
d,
|
|
160
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
170
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [M(i)] : he([M(i)]),
|
|
161
171
|
u,
|
|
162
172
|
"`"
|
|
163
173
|
]);
|
|
164
|
-
const
|
|
165
|
-
return
|
|
174
|
+
const h = d.length ? pe : fe, v = u.length ? pe : fe;
|
|
175
|
+
return M([
|
|
166
176
|
"`",
|
|
167
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
177
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, M(i)] : he([h, M(i)]),
|
|
168
178
|
v,
|
|
169
179
|
"`"
|
|
170
180
|
]);
|
|
171
|
-
},
|
|
181
|
+
}, re = "embeddedEs", mn = [
|
|
172
182
|
"js",
|
|
173
183
|
"jsx",
|
|
174
184
|
"es",
|
|
@@ -177,253 +187,263 @@ const { line: ae, group: P, indent: de, softline: le } = D, on = async (t, n, r,
|
|
|
177
187
|
"cjs",
|
|
178
188
|
"pac",
|
|
179
189
|
"javascript"
|
|
180
|
-
],
|
|
190
|
+
], pn = [
|
|
181
191
|
"babel",
|
|
182
192
|
"babel-flow",
|
|
183
193
|
"acorn",
|
|
184
194
|
"espree",
|
|
185
195
|
"flow",
|
|
186
196
|
"meriyah"
|
|
187
|
-
],
|
|
188
|
-
[
|
|
197
|
+
], hn = T(re), fn = O(re), bn = {
|
|
198
|
+
[hn]: {
|
|
189
199
|
category: "Embed",
|
|
190
200
|
type: "string",
|
|
191
201
|
array: !0,
|
|
192
|
-
default: [{ value: [...
|
|
193
|
-
description: "
|
|
202
|
+
default: [{ value: [...mn] }],
|
|
203
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded ECMAScript/JavaScript language."
|
|
194
204
|
},
|
|
195
|
-
[
|
|
205
|
+
[fn]: {
|
|
196
206
|
category: "Embed",
|
|
197
207
|
type: "choice",
|
|
198
208
|
default: "babel",
|
|
199
|
-
description:
|
|
200
|
-
choices:
|
|
209
|
+
description: "The parser used to parse the embedded ECMASCript/JavaScript language.",
|
|
210
|
+
choices: pn.map((t) => ({
|
|
201
211
|
value: t,
|
|
202
|
-
description: `Use "${t}".`
|
|
212
|
+
description: `Use the "${t}" parser.`
|
|
203
213
|
}))
|
|
204
214
|
}
|
|
205
|
-
},
|
|
215
|
+
}, En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
206
216
|
__proto__: null,
|
|
207
|
-
embedder:
|
|
208
|
-
language:
|
|
209
|
-
options:
|
|
210
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
211
|
-
A("prettier-plugin-glsl", e,
|
|
217
|
+
embedder: gn,
|
|
218
|
+
language: re,
|
|
219
|
+
options: bn
|
|
220
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: be, group: N, indent: Ee, softline: ye } = I, yn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
221
|
+
A("prettier-plugin-glsl", e, s), e = {
|
|
212
222
|
...e,
|
|
213
|
-
...
|
|
223
|
+
...o
|
|
214
224
|
};
|
|
215
|
-
const { node: l } = r, { createPlaceholder:
|
|
216
|
-
(
|
|
217
|
-
).join(""), d =
|
|
225
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
226
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
227
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
218
228
|
d.length,
|
|
219
229
|
-u.length || void 0
|
|
220
|
-
), E =
|
|
230
|
+
), E = S(r, n), b = await t(y, {
|
|
221
231
|
...e,
|
|
222
232
|
parser: "glsl-parser"
|
|
223
|
-
}), i =
|
|
224
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
233
|
+
}), i = L(b, g, E);
|
|
234
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
225
235
|
return N([
|
|
226
236
|
"`",
|
|
227
237
|
d,
|
|
228
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
238
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [N(i)] : Ee([N(i)]),
|
|
229
239
|
u,
|
|
230
240
|
"`"
|
|
231
241
|
]);
|
|
232
|
-
const
|
|
242
|
+
const h = d.length ? be : ye, v = u.length ? be : ye;
|
|
233
243
|
return N([
|
|
234
244
|
"`",
|
|
235
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
245
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, N(i)] : Ee([h, N(i)]),
|
|
236
246
|
v,
|
|
237
247
|
"`"
|
|
238
248
|
]);
|
|
239
|
-
},
|
|
240
|
-
[
|
|
249
|
+
}, ft = "embeddedGlsl", _n = ["glsl", "shader"], vn = T(ft), $n = {
|
|
250
|
+
[vn]: {
|
|
241
251
|
category: "Embed",
|
|
242
252
|
type: "string",
|
|
243
253
|
array: !0,
|
|
244
|
-
default: [{ value: [...
|
|
245
|
-
description:
|
|
254
|
+
default: [{ value: [..._n] }],
|
|
255
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GLSL language. This option requires the `prettier-plugin-glsl` plugin."
|
|
246
256
|
}
|
|
247
|
-
},
|
|
257
|
+
}, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
248
258
|
__proto__: null,
|
|
249
|
-
embedder:
|
|
250
|
-
language:
|
|
251
|
-
options:
|
|
252
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
259
|
+
embedder: yn,
|
|
260
|
+
language: ft,
|
|
261
|
+
options: $n
|
|
262
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: _e, group: R, indent: ve, softline: $e } = I, In = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
253
263
|
e = {
|
|
254
264
|
...e,
|
|
255
|
-
...
|
|
265
|
+
...o
|
|
256
266
|
};
|
|
257
|
-
const { node: l } = r, { createPlaceholder:
|
|
258
|
-
(
|
|
259
|
-
).join(""), d =
|
|
267
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
268
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
269
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
260
270
|
d.length,
|
|
261
271
|
-u.length || void 0
|
|
262
|
-
), E =
|
|
272
|
+
), E = S(r, n), b = await t(y, {
|
|
263
273
|
...e,
|
|
264
274
|
parser: "graphql"
|
|
265
|
-
}), i =
|
|
266
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
267
|
-
return
|
|
275
|
+
}), i = L(b, g, E);
|
|
276
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
277
|
+
return R([
|
|
268
278
|
"`",
|
|
269
279
|
d,
|
|
270
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
280
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [R(i)] : ve([R(i)]),
|
|
271
281
|
u,
|
|
272
282
|
"`"
|
|
273
283
|
]);
|
|
274
|
-
const
|
|
275
|
-
return
|
|
284
|
+
const h = d.length ? _e : $e, v = u.length ? _e : $e;
|
|
285
|
+
return R([
|
|
276
286
|
"`",
|
|
277
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
287
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, R(i)] : ve([h, R(i)]),
|
|
278
288
|
v,
|
|
279
289
|
"`"
|
|
280
290
|
]);
|
|
281
|
-
},
|
|
282
|
-
[
|
|
291
|
+
}, bt = "embeddedGraphql", Tn = ["graphql", "gql"], Sn = T(bt), xn = {
|
|
292
|
+
[Sn]: {
|
|
283
293
|
category: "Embed",
|
|
284
294
|
type: "string",
|
|
285
295
|
array: !0,
|
|
286
|
-
default: [{ value: [...
|
|
287
|
-
description: "
|
|
296
|
+
default: [{ value: [...Tn] }],
|
|
297
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded GraphQL language."
|
|
288
298
|
}
|
|
289
|
-
},
|
|
299
|
+
}, Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
290
300
|
__proto__: null,
|
|
291
|
-
embedder:
|
|
292
|
-
language:
|
|
293
|
-
options:
|
|
294
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
301
|
+
embedder: In,
|
|
302
|
+
language: bt,
|
|
303
|
+
options: xn
|
|
304
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: De, group: F, indent: Ie, softline: Te } = I, { mapDoc: kn } = Y, An = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
295
305
|
e = {
|
|
296
306
|
...e,
|
|
297
|
-
...
|
|
307
|
+
...o
|
|
298
308
|
};
|
|
299
|
-
const { node: l } = r, { createPlaceholder:
|
|
300
|
-
(
|
|
301
|
-
).join(""), d =
|
|
309
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
310
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
311
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
302
312
|
d.length,
|
|
303
313
|
-u.length || void 0
|
|
304
|
-
), E =
|
|
314
|
+
), E = S(r, n), b = await t(y, {
|
|
305
315
|
...e,
|
|
306
|
-
parser: "html"
|
|
307
|
-
}), i =
|
|
308
|
-
if (typeof
|
|
309
|
-
return
|
|
310
|
-
const
|
|
311
|
-
for (let $ = 0; $ <
|
|
312
|
-
let _ =
|
|
316
|
+
parser: e.embeddedHtmlParser ?? "html"
|
|
317
|
+
}), i = kn(b, (p) => {
|
|
318
|
+
if (typeof p != "string")
|
|
319
|
+
return p;
|
|
320
|
+
const m = [], f = p.split(g);
|
|
321
|
+
for (let $ = 0; $ < f.length; $++) {
|
|
322
|
+
let _ = f[$];
|
|
313
323
|
if ($ % 2 == 0) {
|
|
314
324
|
if (!_)
|
|
315
325
|
continue;
|
|
316
|
-
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")),
|
|
326
|
+
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), e.__embeddedInHtml && (_ = _.replaceAll(/<\/(?=script\b)/gi, "<\\/")), m.push(_);
|
|
317
327
|
} else {
|
|
318
|
-
const
|
|
319
|
-
|
|
328
|
+
const D = Number(_);
|
|
329
|
+
m.push(E[D]);
|
|
320
330
|
}
|
|
321
331
|
}
|
|
322
|
-
return
|
|
332
|
+
return m;
|
|
323
333
|
});
|
|
324
334
|
if (e.htmlWhitespaceSensitivity === "strict" || // TODO: is css mode should be included here?
|
|
325
|
-
e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
326
|
-
return
|
|
335
|
+
e.htmlWhitespaceSensitivity === "css" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
336
|
+
return F([
|
|
327
337
|
"`",
|
|
328
338
|
d,
|
|
329
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
339
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [F(i)] : Ie([F(i)]),
|
|
330
340
|
u,
|
|
331
341
|
"`"
|
|
332
342
|
]);
|
|
333
|
-
const
|
|
334
|
-
return
|
|
343
|
+
const h = d.length ? De : Te, v = u.length ? De : Te;
|
|
344
|
+
return F([
|
|
335
345
|
"`",
|
|
336
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
346
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, F(i)] : Ie([h, F(i)]),
|
|
337
347
|
v,
|
|
338
348
|
"`"
|
|
339
349
|
]);
|
|
340
|
-
},
|
|
341
|
-
[
|
|
350
|
+
}, se = "embeddedHtml", On = ["html", "xhtml"], Pn = ["html", "vue", "angular", "lwc"], Mn = T(se), Nn = O(se), Rn = {
|
|
351
|
+
[Mn]: {
|
|
342
352
|
category: "Embed",
|
|
343
353
|
type: "string",
|
|
344
354
|
array: !0,
|
|
345
355
|
default: [{ value: [...On] }],
|
|
346
|
-
description: "
|
|
356
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded HTML language."
|
|
357
|
+
},
|
|
358
|
+
[Nn]: {
|
|
359
|
+
category: "Embed",
|
|
360
|
+
type: "choice",
|
|
361
|
+
default: "html",
|
|
362
|
+
description: "The parser used to parse the embedded HTML language.",
|
|
363
|
+
choices: Pn.map((t) => ({
|
|
364
|
+
value: t,
|
|
365
|
+
description: `Use the "${t}" parser.`
|
|
366
|
+
}))
|
|
347
367
|
}
|
|
348
|
-
},
|
|
368
|
+
}, Fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
349
369
|
__proto__: null,
|
|
350
|
-
embedder:
|
|
351
|
-
language:
|
|
352
|
-
options:
|
|
353
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
354
|
-
A("prettier-plugin-ini", e,
|
|
370
|
+
embedder: An,
|
|
371
|
+
language: se,
|
|
372
|
+
options: Rn
|
|
373
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Se, group: j, indent: xe, softline: Le } = I, jn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
374
|
+
A("prettier-plugin-ini", e, s), e = {
|
|
355
375
|
...e,
|
|
356
|
-
...
|
|
376
|
+
...o
|
|
357
377
|
};
|
|
358
|
-
const { node: l } = r, { createPlaceholder:
|
|
359
|
-
(
|
|
360
|
-
).join(""), d =
|
|
378
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
379
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
380
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
361
381
|
d.length,
|
|
362
382
|
-u.length || void 0
|
|
363
|
-
), E =
|
|
383
|
+
), E = S(r, n), b = await t(y, {
|
|
364
384
|
...e,
|
|
365
385
|
parser: "ini"
|
|
366
|
-
}), i =
|
|
367
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
368
|
-
return
|
|
386
|
+
}), i = L(b, g, E);
|
|
387
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
388
|
+
return j([
|
|
369
389
|
"`",
|
|
370
390
|
d,
|
|
371
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
391
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [j(i)] : xe([j(i)]),
|
|
372
392
|
u,
|
|
373
393
|
"`"
|
|
374
394
|
]);
|
|
375
|
-
const
|
|
376
|
-
return
|
|
395
|
+
const h = d.length ? Se : Le, v = u.length ? Se : Le;
|
|
396
|
+
return j([
|
|
377
397
|
"`",
|
|
378
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
398
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, j(i)] : xe([h, j(i)]),
|
|
379
399
|
v,
|
|
380
400
|
"`"
|
|
381
401
|
]);
|
|
382
|
-
},
|
|
383
|
-
[
|
|
402
|
+
}, Et = "embeddedIni", wn = ["ini", "cfg", "pro"], Bn = T(Et), Un = {
|
|
403
|
+
[Bn]: {
|
|
384
404
|
category: "Embed",
|
|
385
405
|
type: "string",
|
|
386
406
|
array: !0,
|
|
387
|
-
default: [{ value: [...
|
|
388
|
-
description:
|
|
407
|
+
default: [{ value: [...wn] }],
|
|
408
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded INI language. This option requires the `prettier-plugin-ini` plugin."
|
|
389
409
|
}
|
|
390
|
-
},
|
|
410
|
+
}, qn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
391
411
|
__proto__: null,
|
|
392
|
-
embedder:
|
|
393
|
-
language:
|
|
394
|
-
options:
|
|
395
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
412
|
+
embedder: jn,
|
|
413
|
+
language: Et,
|
|
414
|
+
options: Un
|
|
415
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: ke, group: w, indent: Ae, softline: Oe } = I, Cn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
396
416
|
e = {
|
|
397
417
|
...e,
|
|
398
|
-
...
|
|
418
|
+
...o
|
|
399
419
|
};
|
|
400
|
-
const { node: l } = r, { createPlaceholder:
|
|
401
|
-
(
|
|
402
|
-
).join(""), d =
|
|
420
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = Wn(), c = l.quasis.map(
|
|
421
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
422
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
403
423
|
d.length,
|
|
404
424
|
-u.length || void 0
|
|
405
|
-
), E =
|
|
425
|
+
), E = S(r, n), b = await t(y, {
|
|
406
426
|
...e,
|
|
407
427
|
parser: e.embeddedJsonParser ?? "json"
|
|
408
|
-
}), i =
|
|
409
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
410
|
-
return
|
|
428
|
+
}), i = L(b, g, E);
|
|
429
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
430
|
+
return w([
|
|
411
431
|
"`",
|
|
412
432
|
d,
|
|
413
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
433
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [w(i)] : Ae([w(i)]),
|
|
414
434
|
u,
|
|
415
435
|
"`"
|
|
416
436
|
]);
|
|
417
|
-
const
|
|
418
|
-
return
|
|
437
|
+
const h = d.length ? ke : Oe, v = u.length ? ke : Oe;
|
|
438
|
+
return w([
|
|
419
439
|
"`",
|
|
420
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
440
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, w(i)] : Ae([h, w(i)]),
|
|
421
441
|
v,
|
|
422
442
|
"`"
|
|
423
443
|
]);
|
|
424
444
|
};
|
|
425
|
-
function
|
|
426
|
-
const t =
|
|
445
|
+
function Wn() {
|
|
446
|
+
const t = Q(), n = Q(), r = (s) => `'0${t}${s}${n}'`, e = new RegExp(
|
|
427
447
|
`["']?0${t}(\\d+)${n}['"]?`,
|
|
428
448
|
"ig"
|
|
429
449
|
);
|
|
@@ -432,59 +452,59 @@ function Bn() {
|
|
|
432
452
|
placeholderRegex: e
|
|
433
453
|
};
|
|
434
454
|
}
|
|
435
|
-
const
|
|
436
|
-
[
|
|
455
|
+
const oe = "embeddedJson", Gn = ["json", "jsonl"], zn = ["json", "json5", "jsonc", "json-stringify"], Kn = O(oe), Hn = T(oe), Jn = {
|
|
456
|
+
[Hn]: {
|
|
437
457
|
category: "Embed",
|
|
438
458
|
type: "string",
|
|
439
459
|
array: !0,
|
|
440
|
-
default: [{ value: [...
|
|
441
|
-
description: "
|
|
460
|
+
default: [{ value: [...Gn] }],
|
|
461
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded JSON language."
|
|
442
462
|
},
|
|
443
|
-
[
|
|
463
|
+
[Kn]: {
|
|
444
464
|
category: "Embed",
|
|
445
465
|
type: "choice",
|
|
446
466
|
default: "json",
|
|
447
|
-
description:
|
|
448
|
-
choices:
|
|
467
|
+
description: "The parser used to parse the embedded JSON language.",
|
|
468
|
+
choices: zn.map((t) => ({
|
|
449
469
|
value: t,
|
|
450
|
-
description: `Use "${t}".`
|
|
470
|
+
description: `Use the "${t}" parser.`
|
|
451
471
|
}))
|
|
452
472
|
}
|
|
453
|
-
},
|
|
473
|
+
}, Xn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
454
474
|
__proto__: null,
|
|
455
|
-
embedder:
|
|
456
|
-
language:
|
|
457
|
-
options:
|
|
458
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
459
|
-
A("prettier-plugin-latex", e,
|
|
475
|
+
embedder: Cn,
|
|
476
|
+
language: oe,
|
|
477
|
+
options: Jn
|
|
478
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Pe, group: B, indent: Me, softline: Ne } = I, Yn = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
479
|
+
A("prettier-plugin-latex", e, s), e = {
|
|
460
480
|
...e,
|
|
461
|
-
...
|
|
481
|
+
...o
|
|
462
482
|
};
|
|
463
|
-
const { node: l } = r, { createPlaceholder:
|
|
464
|
-
(
|
|
465
|
-
).join(""), d =
|
|
483
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
484
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
485
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
466
486
|
d.length,
|
|
467
487
|
-u.length || void 0
|
|
468
|
-
), E =
|
|
488
|
+
), E = S(r, n), b = await t(y, {
|
|
469
489
|
...e,
|
|
470
490
|
parser: "latex-parser"
|
|
471
|
-
}), i =
|
|
472
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
473
|
-
return
|
|
491
|
+
}), i = L(b, g, E);
|
|
492
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
493
|
+
return B([
|
|
474
494
|
"`",
|
|
475
495
|
d,
|
|
476
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
496
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [B(i)] : Me([B(i)]),
|
|
477
497
|
u,
|
|
478
498
|
"`"
|
|
479
499
|
]);
|
|
480
|
-
const
|
|
481
|
-
return
|
|
500
|
+
const h = d.length ? Pe : Ne, v = u.length ? Pe : Ne;
|
|
501
|
+
return B([
|
|
482
502
|
"`",
|
|
483
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
503
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, B(i)] : Me([h, B(i)]),
|
|
484
504
|
v,
|
|
485
505
|
"`"
|
|
486
506
|
]);
|
|
487
|
-
},
|
|
507
|
+
}, yt = "embeddedLatex", Qn = [
|
|
488
508
|
"latex",
|
|
489
509
|
"tex",
|
|
490
510
|
"aux",
|
|
@@ -493,299 +513,309 @@ const re = "embeddedJson", Un = ["json", "jsonl"], Cn = ["json", "json5", "jsonc
|
|
|
493
513
|
"bib",
|
|
494
514
|
"toc",
|
|
495
515
|
"sty"
|
|
496
|
-
],
|
|
497
|
-
[
|
|
516
|
+
], Vn = T(yt), Zn = {
|
|
517
|
+
[Vn]: {
|
|
498
518
|
category: "Embed",
|
|
499
519
|
type: "string",
|
|
500
520
|
array: !0,
|
|
501
|
-
default: [{ value: [...
|
|
502
|
-
description:
|
|
521
|
+
default: [{ value: [...Qn] }],
|
|
522
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded LaTeX language. This option requires the `prettier-plugin-latex` plugin."
|
|
503
523
|
}
|
|
504
|
-
},
|
|
524
|
+
}, er = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
505
525
|
__proto__: null,
|
|
506
|
-
embedder:
|
|
507
|
-
language:
|
|
508
|
-
options:
|
|
509
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
526
|
+
embedder: Yn,
|
|
527
|
+
language: yt,
|
|
528
|
+
options: Zn
|
|
529
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Re, group: U, indent: Fe, softline: je } = I, tr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
510
530
|
e = {
|
|
511
531
|
...e,
|
|
512
|
-
...
|
|
532
|
+
...o
|
|
513
533
|
};
|
|
514
|
-
const { node: l } = r, { createPlaceholder:
|
|
515
|
-
(
|
|
516
|
-
).join(""), d =
|
|
534
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
535
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
536
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
517
537
|
d.length,
|
|
518
538
|
-u.length || void 0
|
|
519
|
-
), E =
|
|
539
|
+
), E = S(r, n), b = await t(y, {
|
|
520
540
|
...e,
|
|
521
|
-
parser: "markdown",
|
|
541
|
+
parser: e.embeddedMarkdownParser ?? "markdown",
|
|
522
542
|
__inJsTemplate: !0
|
|
523
|
-
}), i =
|
|
524
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
525
|
-
return
|
|
543
|
+
}), i = L(b, g, E);
|
|
544
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
545
|
+
return U([
|
|
526
546
|
"`",
|
|
527
547
|
d,
|
|
528
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
548
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [U(i)] : Fe([U(i)]),
|
|
529
549
|
u,
|
|
530
550
|
"`"
|
|
531
551
|
]);
|
|
532
|
-
const
|
|
533
|
-
return
|
|
552
|
+
const h = d.length ? Re : je, v = u.length ? Re : je;
|
|
553
|
+
return U([
|
|
534
554
|
"`",
|
|
535
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
555
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, U(i)] : Fe([h, U(i)]),
|
|
536
556
|
v,
|
|
537
557
|
"`"
|
|
538
558
|
]);
|
|
539
|
-
},
|
|
540
|
-
[
|
|
559
|
+
}, ie = "embeddedMarkdown", nr = ["md", "markdown"], rr = ["markdown", "mdx", "remark"], sr = T(ie), or = O(ie), ir = {
|
|
560
|
+
[sr]: {
|
|
541
561
|
category: "Embed",
|
|
542
562
|
type: "string",
|
|
543
563
|
array: !0,
|
|
544
|
-
default: [{ value: [...
|
|
545
|
-
description: "
|
|
564
|
+
default: [{ value: [...nr] }],
|
|
565
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Markdown language."
|
|
566
|
+
},
|
|
567
|
+
[or]: {
|
|
568
|
+
category: "Embed",
|
|
569
|
+
type: "choice",
|
|
570
|
+
default: "markdown",
|
|
571
|
+
description: "The parser used to parse the embedded Markdown language.",
|
|
572
|
+
choices: rr.map((t) => ({
|
|
573
|
+
value: t,
|
|
574
|
+
description: `Use the "${t}" parser.`
|
|
575
|
+
}))
|
|
546
576
|
}
|
|
547
|
-
},
|
|
577
|
+
}, ar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
548
578
|
__proto__: null,
|
|
549
|
-
embedder:
|
|
550
|
-
language:
|
|
551
|
-
options:
|
|
552
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
553
|
-
[
|
|
579
|
+
embedder: tr,
|
|
580
|
+
language: ie,
|
|
581
|
+
options: ir
|
|
582
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = "embeddedNoop", cr = T(ae), dr = {
|
|
583
|
+
[cr]: {
|
|
554
584
|
category: "Embed",
|
|
555
585
|
type: "string",
|
|
556
586
|
array: !0,
|
|
557
587
|
default: [{ value: [] }],
|
|
558
|
-
description: "
|
|
588
|
+
description: "Tag or comment identifiers that prevent their subsequent template literals from being identified as embedded languages and thus from being formatted."
|
|
559
589
|
}
|
|
560
|
-
},
|
|
590
|
+
}, lr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
561
591
|
__proto__: null,
|
|
562
|
-
language:
|
|
563
|
-
options:
|
|
564
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
565
|
-
A("@prettier/plugin-php", e,
|
|
592
|
+
language: ae,
|
|
593
|
+
options: dr
|
|
594
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: we, group: q, indent: Be, softline: Ue } = I, ur = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
595
|
+
A("@prettier/plugin-php", e, s), e = {
|
|
566
596
|
...e,
|
|
567
|
-
...
|
|
597
|
+
...o
|
|
568
598
|
};
|
|
569
|
-
const { node: l } = r, { createPlaceholder:
|
|
570
|
-
(
|
|
571
|
-
).join(""), d =
|
|
599
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x("$p"), c = l.quasis.map(
|
|
600
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
601
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
572
602
|
d.length,
|
|
573
603
|
-u.length || void 0
|
|
574
|
-
), E =
|
|
604
|
+
), E = S(r, n), b = await t(y, {
|
|
575
605
|
...e,
|
|
576
606
|
parser: "php"
|
|
577
|
-
}), i =
|
|
578
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
579
|
-
return
|
|
607
|
+
}), i = L(b, g, E);
|
|
608
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
609
|
+
return q([
|
|
580
610
|
"`",
|
|
581
611
|
d,
|
|
582
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
612
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [q(i)] : Be([q(i)]),
|
|
583
613
|
u,
|
|
584
614
|
"`"
|
|
585
615
|
]);
|
|
586
|
-
const
|
|
587
|
-
return
|
|
616
|
+
const h = d.length ? we : Ue, v = u.length ? we : Ue;
|
|
617
|
+
return q([
|
|
588
618
|
"`",
|
|
589
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
619
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, q(i)] : Be([h, q(i)]),
|
|
590
620
|
v,
|
|
591
621
|
"`"
|
|
592
622
|
]);
|
|
593
|
-
}, _t = "embeddedPhp",
|
|
594
|
-
[
|
|
623
|
+
}, _t = "embeddedPhp", gr = ["php", "php5"], mr = T(_t), pr = {
|
|
624
|
+
[mr]: {
|
|
595
625
|
category: "Embed",
|
|
596
626
|
type: "string",
|
|
597
627
|
array: !0,
|
|
598
|
-
default: [{ value: [...
|
|
599
|
-
description:
|
|
628
|
+
default: [{ value: [...gr] }],
|
|
629
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded PHP language. This option requires the `@prettier/plugin-php` plugin."
|
|
600
630
|
}
|
|
601
|
-
},
|
|
631
|
+
}, hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
602
632
|
__proto__: null,
|
|
603
|
-
embedder:
|
|
633
|
+
embedder: ur,
|
|
604
634
|
language: _t,
|
|
605
|
-
options:
|
|
606
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
607
|
-
A("prettier-plugin-properties", e,
|
|
635
|
+
options: pr
|
|
636
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: qe, group: C, indent: Ce, softline: We } = I, fr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
637
|
+
A("prettier-plugin-properties", e, s), e = {
|
|
608
638
|
...e,
|
|
609
|
-
...
|
|
639
|
+
...o
|
|
610
640
|
};
|
|
611
|
-
const { node: l } = r, { createPlaceholder:
|
|
612
|
-
(
|
|
613
|
-
).join(""), d =
|
|
641
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
642
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
643
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
614
644
|
d.length,
|
|
615
645
|
-u.length || void 0
|
|
616
|
-
), E =
|
|
646
|
+
), E = S(r, n), b = await t(y, {
|
|
617
647
|
...e,
|
|
618
648
|
parser: "dot-properties"
|
|
619
|
-
}), i =
|
|
620
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
649
|
+
}), i = L(b, g, E);
|
|
650
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
621
651
|
return C([
|
|
622
652
|
"`",
|
|
623
653
|
d,
|
|
624
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
654
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [C(i)] : Ce([C(i)]),
|
|
625
655
|
u,
|
|
626
656
|
"`"
|
|
627
657
|
]);
|
|
628
|
-
const
|
|
658
|
+
const h = d.length ? qe : We, v = u.length ? qe : We;
|
|
629
659
|
return C([
|
|
630
660
|
"`",
|
|
631
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
661
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, C(i)] : Ce([h, C(i)]),
|
|
632
662
|
v,
|
|
633
663
|
"`"
|
|
634
664
|
]);
|
|
635
|
-
}, vt = "embeddedProperties",
|
|
636
|
-
[
|
|
665
|
+
}, vt = "embeddedProperties", br = ["properties"], Er = T(vt), yr = {
|
|
666
|
+
[Er]: {
|
|
637
667
|
category: "Embed",
|
|
638
668
|
type: "string",
|
|
639
669
|
array: !0,
|
|
640
|
-
default: [{ value: [...
|
|
641
|
-
description:
|
|
670
|
+
default: [{ value: [...br] }],
|
|
671
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Properties language. This option requires the `prettier-plugin-properties` plugin."
|
|
642
672
|
}
|
|
643
|
-
},
|
|
673
|
+
}, _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
644
674
|
__proto__: null,
|
|
645
|
-
embedder:
|
|
675
|
+
embedder: fr,
|
|
646
676
|
language: vt,
|
|
647
|
-
options:
|
|
648
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
649
|
-
A("@prettier/plugin-ruby", e,
|
|
677
|
+
options: yr
|
|
678
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: Ge, group: W, indent: ze, softline: Ke } = I, vr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
679
|
+
A("@prettier/plugin-ruby", e, s), e = {
|
|
650
680
|
...e,
|
|
651
|
-
...
|
|
681
|
+
...o
|
|
652
682
|
};
|
|
653
|
-
const { node: l } = r, { createPlaceholder:
|
|
654
|
-
(
|
|
655
|
-
).join(""), d =
|
|
683
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
684
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
685
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
656
686
|
d.length,
|
|
657
687
|
-u.length || void 0
|
|
658
|
-
), E =
|
|
688
|
+
), E = S(r, n), b = await t(y, {
|
|
659
689
|
...e,
|
|
660
690
|
parser: e.embeddedRubyParser ?? "ruby"
|
|
661
|
-
}), i =
|
|
662
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
691
|
+
}), i = L(b, g, E);
|
|
692
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
663
693
|
return W([
|
|
664
694
|
"`",
|
|
665
695
|
d,
|
|
666
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
696
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [W(i)] : ze([W(i)]),
|
|
667
697
|
u,
|
|
668
698
|
"`"
|
|
669
699
|
]);
|
|
670
|
-
const
|
|
700
|
+
const h = d.length ? Ge : Ke, v = u.length ? Ge : Ke;
|
|
671
701
|
return W([
|
|
672
702
|
"`",
|
|
673
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
703
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, W(i)] : ze([h, W(i)]),
|
|
674
704
|
v,
|
|
675
705
|
"`"
|
|
676
706
|
]);
|
|
677
|
-
}, $t = "embeddedRuby",
|
|
678
|
-
[
|
|
707
|
+
}, $t = "embeddedRuby", $r = ["ruby"], Dr = ["ruby", "rbs", "haml"], Ir = "embeddedRubyParser", Tr = T($t), Sr = {
|
|
708
|
+
[Tr]: {
|
|
679
709
|
category: "Embed",
|
|
680
710
|
type: "string",
|
|
681
711
|
array: !0,
|
|
682
|
-
default: [{ value: [
|
|
683
|
-
description:
|
|
712
|
+
default: [{ value: [...$r] }],
|
|
713
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin."
|
|
684
714
|
},
|
|
685
|
-
[
|
|
715
|
+
[Ir]: {
|
|
686
716
|
category: "Embed",
|
|
687
717
|
type: "choice",
|
|
688
718
|
default: "ruby",
|
|
689
|
-
description:
|
|
690
|
-
choices:
|
|
719
|
+
description: "The parser used to parse the embedded Ruby language. This option requires the `@prettier/plugin-ruby` plugin.",
|
|
720
|
+
choices: Dr.map((t) => ({
|
|
691
721
|
value: t,
|
|
692
|
-
description: `Use "${t}".`
|
|
722
|
+
description: `Use the "${t}" parser.`
|
|
693
723
|
}))
|
|
694
724
|
}
|
|
695
|
-
},
|
|
725
|
+
}, xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
696
726
|
__proto__: null,
|
|
697
|
-
embedder:
|
|
727
|
+
embedder: vr,
|
|
698
728
|
language: $t,
|
|
699
|
-
options:
|
|
700
|
-
}, Symbol.toStringTag, { value: "Module" })), { hardline:
|
|
729
|
+
options: Sr
|
|
730
|
+
}, Symbol.toStringTag, { value: "Module" })), { hardline: Lr, group: G, line: He, softline: Je, indent: Xe } = I, { mapDoc: kr } = Y, Ar = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
701
731
|
e = {
|
|
702
732
|
...e,
|
|
703
|
-
...
|
|
733
|
+
...o
|
|
704
734
|
};
|
|
705
|
-
const { node: l } = r, { createPlaceholder:
|
|
706
|
-
(
|
|
707
|
-
).join(""), d =
|
|
735
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
736
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
737
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
708
738
|
d.length,
|
|
709
739
|
-u.length || void 0
|
|
710
|
-
), E =
|
|
740
|
+
), E = S(r, n), b = await t(y, {
|
|
711
741
|
...e,
|
|
712
742
|
parser: "sh"
|
|
713
|
-
}), i =
|
|
714
|
-
if (typeof
|
|
715
|
-
return
|
|
716
|
-
const
|
|
717
|
-
for (let $ = 0; $ <
|
|
718
|
-
let _ =
|
|
743
|
+
}), i = kr(b, (p) => {
|
|
744
|
+
if (typeof p != "string")
|
|
745
|
+
return p;
|
|
746
|
+
const m = [], f = p.split(g);
|
|
747
|
+
for (let $ = 0; $ < f.length; $++) {
|
|
748
|
+
let _ = f[$];
|
|
719
749
|
if ($ % 2 == 0) {
|
|
720
750
|
if (!_)
|
|
721
751
|
continue;
|
|
722
|
-
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((
|
|
723
|
-
` ?
|
|
752
|
+
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === `
|
|
753
|
+
` ? m.push(Lr) : m.push(D));
|
|
724
754
|
} else {
|
|
725
|
-
const
|
|
726
|
-
|
|
755
|
+
const D = Number(_);
|
|
756
|
+
m.push(E[D]);
|
|
727
757
|
}
|
|
728
758
|
}
|
|
729
|
-
return
|
|
759
|
+
return m;
|
|
730
760
|
});
|
|
731
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
761
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
732
762
|
return G([
|
|
733
763
|
"`",
|
|
734
764
|
d,
|
|
735
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
765
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [G(i)] : Xe([G(i)]),
|
|
736
766
|
u,
|
|
737
767
|
"`"
|
|
738
768
|
]);
|
|
739
|
-
const
|
|
769
|
+
const h = d.length ? He : Je, v = u.length ? He : Je;
|
|
740
770
|
return G([
|
|
741
771
|
"`",
|
|
742
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
772
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, G(i)] : Xe([h, G(i)]),
|
|
743
773
|
v,
|
|
744
774
|
"`"
|
|
745
775
|
]);
|
|
746
|
-
},
|
|
747
|
-
[
|
|
776
|
+
}, Dt = "embeddedSh", Or = ["sh"], Pr = T(Dt), Mr = {
|
|
777
|
+
[Pr]: {
|
|
748
778
|
category: "Embed",
|
|
749
779
|
type: "string",
|
|
750
780
|
array: !0,
|
|
751
|
-
default: [{ value: [...
|
|
752
|
-
description: "
|
|
781
|
+
default: [{ value: [...Or] }],
|
|
782
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded Shell language. This option requires the `prettier-plugin-sh` plugin."
|
|
753
783
|
}
|
|
754
|
-
},
|
|
784
|
+
}, Nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
755
785
|
__proto__: null,
|
|
756
|
-
embedder:
|
|
757
|
-
language:
|
|
758
|
-
options:
|
|
786
|
+
embedder: Ar,
|
|
787
|
+
language: Dt,
|
|
788
|
+
options: Mr
|
|
759
789
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
760
|
-
function
|
|
790
|
+
function Ye(t, n) {
|
|
761
791
|
var r = Object.keys(t);
|
|
762
792
|
if (Object.getOwnPropertySymbols) {
|
|
763
793
|
var e = Object.getOwnPropertySymbols(t);
|
|
764
|
-
n && (e = e.filter(function(
|
|
765
|
-
return Object.getOwnPropertyDescriptor(t,
|
|
794
|
+
n && (e = e.filter(function(s) {
|
|
795
|
+
return Object.getOwnPropertyDescriptor(t, s).enumerable;
|
|
766
796
|
})), r.push.apply(r, e);
|
|
767
797
|
}
|
|
768
798
|
return r;
|
|
769
799
|
}
|
|
770
|
-
function
|
|
800
|
+
function Qe(t) {
|
|
771
801
|
for (var n = 1; n < arguments.length; n++) {
|
|
772
802
|
var r = arguments[n] != null ? arguments[n] : {};
|
|
773
|
-
n % 2 ?
|
|
774
|
-
|
|
775
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) :
|
|
803
|
+
n % 2 ? Ye(Object(r), !0).forEach(function(e) {
|
|
804
|
+
Rr(t, e, r[e]);
|
|
805
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(r)) : Ye(Object(r)).forEach(function(e) {
|
|
776
806
|
Object.defineProperty(t, e, Object.getOwnPropertyDescriptor(r, e));
|
|
777
807
|
});
|
|
778
808
|
}
|
|
779
809
|
return t;
|
|
780
810
|
}
|
|
781
|
-
function
|
|
782
|
-
return n =
|
|
811
|
+
function Rr(t, n, r) {
|
|
812
|
+
return n = Fr(n), n in t ? Object.defineProperty(t, n, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = r, t;
|
|
783
813
|
}
|
|
784
|
-
function
|
|
785
|
-
var n =
|
|
814
|
+
function Fr(t) {
|
|
815
|
+
var n = jr(t, "string");
|
|
786
816
|
return typeof n == "symbol" ? n : String(n);
|
|
787
817
|
}
|
|
788
|
-
function
|
|
818
|
+
function jr(t, n) {
|
|
789
819
|
if (typeof t != "object" || t === null)
|
|
790
820
|
return t;
|
|
791
821
|
var r = t[Symbol.toPrimitive];
|
|
@@ -797,301 +827,301 @@ function Pr(t, n) {
|
|
|
797
827
|
}
|
|
798
828
|
return (n === "string" ? String : Number)(t);
|
|
799
829
|
}
|
|
800
|
-
const
|
|
801
|
-
function
|
|
802
|
-
return n.withOptions = (r) =>
|
|
830
|
+
const wr = It({});
|
|
831
|
+
function It(t) {
|
|
832
|
+
return n.withOptions = (r) => It(Qe(Qe({}, t), r)), n;
|
|
803
833
|
function n(r, ...e) {
|
|
804
|
-
const
|
|
805
|
-
escapeSpecialCharacters:
|
|
834
|
+
const s = typeof r == "string" ? [r] : r.raw, {
|
|
835
|
+
escapeSpecialCharacters: o = Array.isArray(r)
|
|
806
836
|
} = t;
|
|
807
837
|
let l = "";
|
|
808
|
-
for (let
|
|
809
|
-
let d =
|
|
810
|
-
|
|
838
|
+
for (let c = 0; c < s.length; c++) {
|
|
839
|
+
let d = s[c];
|
|
840
|
+
o && (d = d.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\{/g, "{")), l += d, c < e.length && (l += e[c]);
|
|
811
841
|
}
|
|
812
|
-
const
|
|
842
|
+
const a = l.split(`
|
|
813
843
|
`);
|
|
814
844
|
let g = null;
|
|
815
|
-
for (const
|
|
816
|
-
const d =
|
|
845
|
+
for (const c of a) {
|
|
846
|
+
const d = c.match(/^(\s+)\S+/);
|
|
817
847
|
if (d) {
|
|
818
848
|
const u = d[1].length;
|
|
819
849
|
g ? g = Math.min(g, u) : g = u;
|
|
820
850
|
}
|
|
821
851
|
}
|
|
822
852
|
if (g !== null) {
|
|
823
|
-
const
|
|
824
|
-
l =
|
|
853
|
+
const c = g;
|
|
854
|
+
l = a.map((d) => d[0] === " " || d[0] === " " ? d.slice(c) : d).join(`
|
|
825
855
|
`);
|
|
826
856
|
}
|
|
827
857
|
return l.trim().replace(/\\n/g, `
|
|
828
858
|
`);
|
|
829
859
|
}
|
|
830
860
|
}
|
|
831
|
-
const { hardline:
|
|
861
|
+
const { hardline: Br, group: z, line: Ve, softline: Ze, indent: et } = I, { mapDoc: Ur } = Y, qr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
832
862
|
e = {
|
|
833
863
|
...e,
|
|
834
|
-
...
|
|
864
|
+
...o
|
|
835
865
|
};
|
|
836
866
|
const l = e.embeddedSqlPlugin ?? "prettier-plugin-sql";
|
|
837
|
-
A(l, e,
|
|
838
|
-
const { node:
|
|
839
|
-
(
|
|
867
|
+
A(l, e, s);
|
|
868
|
+
const { node: a } = r, { createPlaceholder: g, placeholderRegex: c } = x(), d = a.quasis.map(
|
|
869
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + g(m)
|
|
840
870
|
).join(""), u = d.match(/^\s+/)?.[0] ?? "", y = d.match(/\s+$/)?.[0] ?? "", E = d.slice(
|
|
841
871
|
u.length,
|
|
842
872
|
-y.length || void 0
|
|
843
|
-
), b =
|
|
873
|
+
), b = S(r, n);
|
|
844
874
|
let i;
|
|
845
875
|
if (l === "prettier-plugin-sql-cst") {
|
|
846
|
-
const
|
|
876
|
+
const p = await t(E, {
|
|
847
877
|
...e,
|
|
848
878
|
parser: e.embeddedSqlParser ?? "sqlite"
|
|
849
879
|
});
|
|
850
|
-
i =
|
|
880
|
+
i = L(p, c, b);
|
|
851
881
|
} else {
|
|
852
|
-
const
|
|
882
|
+
const p = await t(wr(E), {
|
|
853
883
|
...e,
|
|
854
884
|
parser: "sql"
|
|
855
885
|
});
|
|
856
|
-
i =
|
|
857
|
-
if (typeof
|
|
858
|
-
return
|
|
859
|
-
const
|
|
886
|
+
i = Ur(p, (m) => {
|
|
887
|
+
if (typeof m != "string")
|
|
888
|
+
return m;
|
|
889
|
+
const f = [], $ = m.split(c);
|
|
860
890
|
for (let _ = 0; _ < $.length; _++) {
|
|
861
|
-
let
|
|
891
|
+
let D = $[_];
|
|
862
892
|
if (_ % 2 == 0) {
|
|
863
|
-
if (!
|
|
893
|
+
if (!D)
|
|
864
894
|
continue;
|
|
865
|
-
|
|
866
|
-
(
|
|
867
|
-
` ?
|
|
895
|
+
D = D.replaceAll(/([\\`]|\${)/g, "\\$1"), D.split(/(\n)/).forEach(
|
|
896
|
+
(k) => k === `
|
|
897
|
+
` ? f.push(Br) : f.push(k)
|
|
868
898
|
);
|
|
869
899
|
} else {
|
|
870
|
-
const
|
|
871
|
-
|
|
900
|
+
const k = Number(D);
|
|
901
|
+
f.push(b[k]);
|
|
872
902
|
}
|
|
873
903
|
}
|
|
874
|
-
return
|
|
904
|
+
return f;
|
|
875
905
|
});
|
|
876
906
|
}
|
|
877
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
878
|
-
return
|
|
907
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
908
|
+
return z([
|
|
879
909
|
"`",
|
|
880
910
|
u,
|
|
881
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
911
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [z(i)] : et([z(i)]),
|
|
882
912
|
y,
|
|
883
913
|
"`"
|
|
884
914
|
]);
|
|
885
|
-
const
|
|
886
|
-
return
|
|
915
|
+
const h = u.length ? Ve : Ze, v = y.length ? Ve : Ze;
|
|
916
|
+
return z([
|
|
887
917
|
"`",
|
|
888
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
918
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, z(i)] : et([h, z(i)]),
|
|
889
919
|
v,
|
|
890
920
|
"`"
|
|
891
921
|
]);
|
|
892
|
-
}, Z = "embeddedSql",
|
|
922
|
+
}, Z = "embeddedSql", Cr = ["sql"], Wr = ["prettier-plugin-sql", "prettier-plugin-sql-cst"], Gr = [
|
|
893
923
|
"sqlite",
|
|
894
924
|
"bigquery",
|
|
895
925
|
"mysql",
|
|
896
926
|
"mariadb",
|
|
897
927
|
"postgresql"
|
|
898
|
-
],
|
|
899
|
-
[
|
|
928
|
+
], zr = T(Z), Kr = rn(Z), Hr = O(Z), Jr = {
|
|
929
|
+
[zr]: {
|
|
900
930
|
category: "Embed",
|
|
901
931
|
type: "string",
|
|
902
932
|
array: !0,
|
|
903
|
-
default: [{ value: [...
|
|
904
|
-
description:
|
|
933
|
+
default: [{ value: [...Cr] }],
|
|
934
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin."
|
|
905
935
|
},
|
|
906
|
-
[
|
|
936
|
+
[Kr]: {
|
|
907
937
|
category: "Embed",
|
|
908
938
|
type: "choice",
|
|
909
939
|
default: "prettier-plugin-sql",
|
|
910
|
-
description:
|
|
911
|
-
choices:
|
|
940
|
+
description: "The plugin used to format the embedded SQL language. This option requires the `prettier-plugin-sql` plugin or the `prettier-plugin-sql-cst` plugin.",
|
|
941
|
+
choices: Wr.map((t) => ({
|
|
912
942
|
value: t,
|
|
913
|
-
description: `Use "${t}".`
|
|
943
|
+
description: `Use the "${t}" plugin.`
|
|
914
944
|
}))
|
|
915
945
|
},
|
|
916
|
-
[
|
|
946
|
+
[Hr]: {
|
|
917
947
|
category: "Embed",
|
|
918
948
|
type: "choice",
|
|
919
949
|
default: "sqlite",
|
|
920
|
-
description:
|
|
921
|
-
choices:
|
|
950
|
+
description: "Specify the embedded SQL language parser. This option is only needed with the `prettier-plugin-sql-cst` plugin.",
|
|
951
|
+
choices: Gr.map((t) => ({
|
|
922
952
|
value: t,
|
|
923
|
-
description: `Use "${t}" parser.`
|
|
953
|
+
description: `Use the "${t}" parser.`
|
|
924
954
|
}))
|
|
925
955
|
}
|
|
926
|
-
},
|
|
956
|
+
}, Xr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
927
957
|
__proto__: null,
|
|
928
|
-
embedder:
|
|
958
|
+
embedder: qr,
|
|
929
959
|
language: Z,
|
|
930
|
-
options:
|
|
931
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
932
|
-
A("prettier-plugin-toml", e,
|
|
960
|
+
options: Jr
|
|
961
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: tt, group: K, indent: nt, softline: rt, hardline: Yr } = I, { mapDoc: Qr } = Y, Vr = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
962
|
+
A("prettier-plugin-toml", e, s), e = {
|
|
933
963
|
...e,
|
|
934
|
-
...
|
|
964
|
+
...o
|
|
935
965
|
};
|
|
936
|
-
const { node: l } = r, { createPlaceholder:
|
|
937
|
-
(
|
|
938
|
-
).join(""), d =
|
|
966
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
967
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
968
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
939
969
|
d.length,
|
|
940
970
|
-u.length || void 0
|
|
941
|
-
), E =
|
|
971
|
+
), E = S(r, n), b = await t(y, {
|
|
942
972
|
...e,
|
|
943
973
|
parser: "toml"
|
|
944
|
-
}), i =
|
|
945
|
-
if (typeof
|
|
946
|
-
return
|
|
947
|
-
const
|
|
948
|
-
for (let $ = 0; $ <
|
|
949
|
-
let _ =
|
|
974
|
+
}), i = Qr(b, (p) => {
|
|
975
|
+
if (typeof p != "string")
|
|
976
|
+
return p;
|
|
977
|
+
const m = [], f = p.split(g);
|
|
978
|
+
for (let $ = 0; $ < f.length; $++) {
|
|
979
|
+
let _ = f[$];
|
|
950
980
|
if ($ % 2 == 0) {
|
|
951
981
|
if (!_)
|
|
952
982
|
continue;
|
|
953
|
-
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((
|
|
954
|
-
` ?
|
|
983
|
+
_ = _.replaceAll(/([\\`]|\${)/g, "\\$1"), _.split(/(\n)/).forEach((D) => D === `
|
|
984
|
+
` ? m.push(Yr) : m.push(D));
|
|
955
985
|
} else {
|
|
956
|
-
const
|
|
957
|
-
|
|
986
|
+
const D = Number(_);
|
|
987
|
+
m.push(E[D]);
|
|
958
988
|
}
|
|
959
989
|
}
|
|
960
|
-
return
|
|
990
|
+
return m;
|
|
961
991
|
});
|
|
962
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
963
|
-
return
|
|
992
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
993
|
+
return K([
|
|
964
994
|
"`",
|
|
965
995
|
d,
|
|
966
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
996
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [K(i)] : nt([K(i)]),
|
|
967
997
|
u,
|
|
968
998
|
"`"
|
|
969
999
|
]);
|
|
970
|
-
const
|
|
971
|
-
return
|
|
1000
|
+
const h = d.length ? tt : rt, v = u.length ? tt : rt;
|
|
1001
|
+
return K([
|
|
972
1002
|
"`",
|
|
973
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1003
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, K(i)] : nt([h, K(i)]),
|
|
974
1004
|
v,
|
|
975
1005
|
"`"
|
|
976
1006
|
]);
|
|
977
|
-
},
|
|
978
|
-
[
|
|
1007
|
+
}, Tt = "embeddedToml", Zr = ["toml"], es = T(Tt), ts = {
|
|
1008
|
+
[es]: {
|
|
979
1009
|
category: "Embed",
|
|
980
1010
|
type: "string",
|
|
981
1011
|
array: !0,
|
|
982
|
-
default: [{ value: [...
|
|
983
|
-
description:
|
|
1012
|
+
default: [{ value: [...Zr] }],
|
|
1013
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TOML language. This option requires the `prettier-plugin-toml` plugin."
|
|
984
1014
|
}
|
|
985
|
-
},
|
|
1015
|
+
}, ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
986
1016
|
__proto__: null,
|
|
987
|
-
embedder:
|
|
988
|
-
language:
|
|
989
|
-
options:
|
|
990
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
1017
|
+
embedder: Vr,
|
|
1018
|
+
language: Tt,
|
|
1019
|
+
options: ts
|
|
1020
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: st, group: H, indent: ot, softline: it } = I, rs = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
991
1021
|
e = {
|
|
992
1022
|
...e,
|
|
993
|
-
...
|
|
1023
|
+
...o
|
|
994
1024
|
};
|
|
995
|
-
const { node: l } = r, { createPlaceholder:
|
|
996
|
-
(
|
|
997
|
-
).join(""), d =
|
|
1025
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
1026
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
1027
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
998
1028
|
d.length,
|
|
999
1029
|
-u.length || void 0
|
|
1000
|
-
), E =
|
|
1030
|
+
), E = S(r, n), b = await t(y, {
|
|
1001
1031
|
...e,
|
|
1002
1032
|
parser: e.embeddedTsParser ?? "typescript",
|
|
1003
1033
|
// set filepath to undefined to enable jsx auto detection:
|
|
1004
1034
|
// https://github.com/prettier/prettier/blob/427a84d24203e2d54160cde153a1e6a6390fe65a/src/language-js/parse/typescript.js#L49-L53
|
|
1005
1035
|
filepath: void 0
|
|
1006
|
-
}), i =
|
|
1007
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
1008
|
-
return
|
|
1036
|
+
}), i = L(b, g, E);
|
|
1037
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
1038
|
+
return H([
|
|
1009
1039
|
"`",
|
|
1010
1040
|
d,
|
|
1011
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1041
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [H(i)] : ot([H(i)]),
|
|
1012
1042
|
u,
|
|
1013
1043
|
"`"
|
|
1014
1044
|
]);
|
|
1015
|
-
const
|
|
1016
|
-
return
|
|
1045
|
+
const h = d.length ? st : it, v = u.length ? st : it;
|
|
1046
|
+
return H([
|
|
1017
1047
|
"`",
|
|
1018
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1048
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, H(i)] : ot([h, H(i)]),
|
|
1019
1049
|
v,
|
|
1020
1050
|
"`"
|
|
1021
1051
|
]);
|
|
1022
|
-
},
|
|
1023
|
-
[
|
|
1052
|
+
}, ce = "embeddedTs", ss = ["ts", "tsx", "cts", "mts", "typescript"], os = ["typescript", "babel-ts"], is = O(ce), as = T(ce), cs = {
|
|
1053
|
+
[as]: {
|
|
1024
1054
|
category: "Embed",
|
|
1025
1055
|
type: "string",
|
|
1026
1056
|
array: !0,
|
|
1027
|
-
default: [{ value: [...
|
|
1028
|
-
description: "
|
|
1057
|
+
default: [{ value: [...ss] }],
|
|
1058
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded TypeScript language."
|
|
1029
1059
|
},
|
|
1030
|
-
[
|
|
1060
|
+
[is]: {
|
|
1031
1061
|
category: "Embed",
|
|
1032
1062
|
type: "choice",
|
|
1033
1063
|
default: "typescript",
|
|
1034
|
-
description:
|
|
1035
|
-
choices:
|
|
1064
|
+
description: "The parser used to parse the embedded TypeScript language.",
|
|
1065
|
+
choices: os.map((t) => ({
|
|
1036
1066
|
value: t,
|
|
1037
|
-
description: `Use "${t}".`
|
|
1067
|
+
description: `Use the "${t}" parser.`
|
|
1038
1068
|
}))
|
|
1039
1069
|
}
|
|
1040
|
-
},
|
|
1070
|
+
}, ds = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1041
1071
|
__proto__: null,
|
|
1042
|
-
embedder:
|
|
1043
|
-
language:
|
|
1044
|
-
options:
|
|
1045
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1046
|
-
A("@prettier/plugin-xml", e,
|
|
1072
|
+
embedder: rs,
|
|
1073
|
+
language: ce,
|
|
1074
|
+
options: cs
|
|
1075
|
+
}, Symbol.toStringTag, { value: "Module" })), de = "embeddedXml", { line: at, group: J, indent: ct, softline: ee } = I, ls = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
1076
|
+
A("@prettier/plugin-xml", e, s), e = {
|
|
1047
1077
|
...e,
|
|
1048
|
-
...
|
|
1078
|
+
...o
|
|
1049
1079
|
};
|
|
1050
|
-
const { node: l } = r, { createPlaceholder:
|
|
1051
|
-
(
|
|
1052
|
-
).join(""), d =
|
|
1080
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
1081
|
+
(m, f, { length: $ }) => f === $ - 1 ? m.value.cooked : m.value.cooked + a(f)
|
|
1082
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
1053
1083
|
d.length,
|
|
1054
1084
|
-u.length || void 0
|
|
1055
|
-
), E =
|
|
1085
|
+
), E = S(r, n), b = [];
|
|
1056
1086
|
let i = 0;
|
|
1057
1087
|
for (; i !== void 0; ) {
|
|
1058
|
-
const
|
|
1059
|
-
if (
|
|
1088
|
+
const m = y.slice(i);
|
|
1089
|
+
if (m.length === 0)
|
|
1060
1090
|
break;
|
|
1061
1091
|
i > 0 && e.xmlWhitespaceSensitivity !== "strict" && b.push(ee), e.__embeddedXmlFragmentRecoverIndex?.splice(
|
|
1062
1092
|
0,
|
|
1063
1093
|
e.__embeddedXmlFragmentRecoverIndex.length
|
|
1064
1094
|
);
|
|
1065
|
-
let
|
|
1095
|
+
let f = await t(m, {
|
|
1066
1096
|
...e,
|
|
1067
|
-
parser:
|
|
1097
|
+
parser: de
|
|
1068
1098
|
});
|
|
1069
1099
|
const [$, _] = e.__embeddedXmlFragmentRecoverIndex ?? [];
|
|
1070
|
-
$ === void 0 ? i = void 0 : _ === void 0 ? i += $ : (
|
|
1100
|
+
$ === void 0 ? i = void 0 : _ === void 0 ? i += $ : (f = m.slice($, _ + 1), i += _ + 1), b.push(f);
|
|
1071
1101
|
}
|
|
1072
|
-
const
|
|
1073
|
-
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
1074
|
-
return
|
|
1102
|
+
const h = L(b, g, E);
|
|
1103
|
+
if (e.xmlWhitespaceSensitivity === "strict" || e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
1104
|
+
return J([
|
|
1075
1105
|
"`",
|
|
1076
1106
|
d,
|
|
1077
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1107
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [J(h)] : ct([J(h)]),
|
|
1078
1108
|
u,
|
|
1079
1109
|
"`"
|
|
1080
1110
|
]);
|
|
1081
|
-
const v = d.length ?
|
|
1082
|
-
return
|
|
1111
|
+
const v = d.length ? at : ee, p = u.length ? at : ee;
|
|
1112
|
+
return J([
|
|
1083
1113
|
"`",
|
|
1084
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1085
|
-
|
|
1114
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [v, J(h)] : ct([v, J(h)]),
|
|
1115
|
+
p,
|
|
1086
1116
|
"`"
|
|
1087
1117
|
]);
|
|
1088
|
-
},
|
|
1089
|
-
[
|
|
1118
|
+
}, us = ["xml", "opml", "rss", "svg"], gs = T(de), ms = {
|
|
1119
|
+
[gs]: {
|
|
1090
1120
|
category: "Embed",
|
|
1091
1121
|
type: "string",
|
|
1092
1122
|
array: !0,
|
|
1093
|
-
default: [{ value: [...
|
|
1094
|
-
description:
|
|
1123
|
+
default: [{ value: [...us] }],
|
|
1124
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded XML language. This option requires the `@prettier/plugin-xml` plugin."
|
|
1095
1125
|
},
|
|
1096
1126
|
/**
|
|
1097
1127
|
* @internal
|
|
@@ -1101,10 +1131,10 @@ const { hardline: Nr, group: q, line: Xe, softline: Ye, indent: Qe } = D, { mapD
|
|
|
1101
1131
|
type: "int",
|
|
1102
1132
|
array: !0,
|
|
1103
1133
|
default: [{ value: [] }],
|
|
1104
|
-
description: "This option is read only and used as a workaround to support xml fragments"
|
|
1134
|
+
description: "This option is read only and is used internally as a workaround to support xml fragments"
|
|
1105
1135
|
}
|
|
1106
1136
|
};
|
|
1107
|
-
function
|
|
1137
|
+
function ps(t) {
|
|
1108
1138
|
const n = {
|
|
1109
1139
|
loc: {
|
|
1110
1140
|
start: {
|
|
@@ -1124,7 +1154,7 @@ function ao(t) {
|
|
|
1124
1154
|
);
|
|
1125
1155
|
return Object.assign(r, n), r;
|
|
1126
1156
|
}
|
|
1127
|
-
function
|
|
1157
|
+
function dt(t) {
|
|
1128
1158
|
const n = {
|
|
1129
1159
|
loc: {
|
|
1130
1160
|
start: {
|
|
@@ -1144,52 +1174,52 @@ function it(t) {
|
|
|
1144
1174
|
);
|
|
1145
1175
|
return Object.assign(r, n), r;
|
|
1146
1176
|
}
|
|
1147
|
-
const
|
|
1177
|
+
const hs = {
|
|
1148
1178
|
async parse(t, n) {
|
|
1149
|
-
const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors:
|
|
1179
|
+
const { parse: r } = await import("@xml-tools/parser"), { lexErrors: e, parseErrors: s, cst: o } = r(t);
|
|
1150
1180
|
if (e.length > 0) {
|
|
1151
1181
|
const l = e[0];
|
|
1152
|
-
throw
|
|
1182
|
+
throw ps(l);
|
|
1153
1183
|
}
|
|
1154
|
-
if (
|
|
1184
|
+
if (s.length > 0) {
|
|
1155
1185
|
let l = !1;
|
|
1156
|
-
for (const
|
|
1186
|
+
for (const a of s) {
|
|
1157
1187
|
if (!["MismatchedTokenException", "NotAllInputParsedException"].includes(
|
|
1158
|
-
|
|
1188
|
+
a.name
|
|
1159
1189
|
))
|
|
1160
|
-
throw
|
|
1161
|
-
if (
|
|
1190
|
+
throw dt(a);
|
|
1191
|
+
if (a.message === "Expecting token of type --> OPEN <-- but found --> '' <--") {
|
|
1162
1192
|
l = !0;
|
|
1163
1193
|
continue;
|
|
1164
1194
|
}
|
|
1165
1195
|
if (/Expecting token of type --> EOF <-- but found --> '[\s\S]+' <--/.test(
|
|
1166
|
-
|
|
1167
|
-
) || /Redundant input, expecting EOF but found: /.test(
|
|
1196
|
+
a.message
|
|
1197
|
+
) || /Redundant input, expecting EOF but found: /.test(a.message)) {
|
|
1168
1198
|
n.__embeddedXmlFragmentRecoverIndex?.splice(
|
|
1169
1199
|
0,
|
|
1170
1200
|
n.__embeddedXmlFragmentRecoverIndex.length,
|
|
1171
|
-
|
|
1201
|
+
a.token.startOffset
|
|
1172
1202
|
);
|
|
1173
1203
|
break;
|
|
1174
1204
|
}
|
|
1175
1205
|
if (/Expecting token of type --> OPEN <-- but found --> '[\s\S]+' <--/.test(
|
|
1176
|
-
|
|
1206
|
+
a.message
|
|
1177
1207
|
)) {
|
|
1178
|
-
if (
|
|
1208
|
+
if (a.token.endOffset === void 0 || Number.isNaN(a.token.endOffset))
|
|
1179
1209
|
break;
|
|
1180
1210
|
n.__embeddedXmlFragmentRecoverIndex?.splice(
|
|
1181
1211
|
0,
|
|
1182
1212
|
n.__embeddedXmlFragmentRecoverIndex.length,
|
|
1183
|
-
|
|
1184
|
-
|
|
1213
|
+
a.token.startOffset,
|
|
1214
|
+
a.token.endOffset
|
|
1185
1215
|
), l = !0;
|
|
1186
1216
|
break;
|
|
1187
1217
|
}
|
|
1188
|
-
throw
|
|
1218
|
+
throw dt(a);
|
|
1189
1219
|
}
|
|
1190
|
-
l &&
|
|
1220
|
+
l && St(o);
|
|
1191
1221
|
}
|
|
1192
|
-
return
|
|
1222
|
+
return o;
|
|
1193
1223
|
},
|
|
1194
1224
|
astFormat: "xml",
|
|
1195
1225
|
locStart(t) {
|
|
@@ -1199,145 +1229,145 @@ const lo = {
|
|
|
1199
1229
|
return t.location.endOffset ?? NaN;
|
|
1200
1230
|
}
|
|
1201
1231
|
};
|
|
1202
|
-
function
|
|
1232
|
+
function St(t) {
|
|
1203
1233
|
const n = t.children;
|
|
1204
1234
|
for (const r in n) {
|
|
1205
1235
|
const e = n[r] ?? [];
|
|
1206
|
-
for (let
|
|
1207
|
-
const
|
|
1208
|
-
if (
|
|
1209
|
-
if (Object.keys(
|
|
1210
|
-
e.splice(
|
|
1236
|
+
for (let s = e.length - 1; s >= 0; --s) {
|
|
1237
|
+
const o = e[s];
|
|
1238
|
+
if (fs(o)) {
|
|
1239
|
+
if (Object.keys(o.children).length === 0) {
|
|
1240
|
+
e.splice(s, 1), e.length === 0 && delete n[r];
|
|
1211
1241
|
continue;
|
|
1212
1242
|
}
|
|
1213
|
-
|
|
1243
|
+
St(o);
|
|
1214
1244
|
}
|
|
1215
1245
|
}
|
|
1216
1246
|
}
|
|
1217
1247
|
}
|
|
1218
|
-
function
|
|
1248
|
+
function fs(t) {
|
|
1219
1249
|
return "name" in t && "children" in t && "location" in t;
|
|
1220
1250
|
}
|
|
1221
|
-
const
|
|
1251
|
+
const bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1222
1252
|
__proto__: null,
|
|
1223
|
-
embedder:
|
|
1224
|
-
language:
|
|
1225
|
-
options:
|
|
1226
|
-
parser:
|
|
1227
|
-
}, Symbol.toStringTag, { value: "Module" })), { line:
|
|
1253
|
+
embedder: ls,
|
|
1254
|
+
language: de,
|
|
1255
|
+
options: ms,
|
|
1256
|
+
parser: hs
|
|
1257
|
+
}, Symbol.toStringTag, { value: "Module" })), { line: lt, group: X, indent: ut, softline: gt } = I, Es = async (t, n, r, e, { identifier: s, embeddedOverrideOptions: o }) => {
|
|
1228
1258
|
e = {
|
|
1229
1259
|
...e,
|
|
1230
|
-
...
|
|
1260
|
+
...o
|
|
1231
1261
|
};
|
|
1232
|
-
const { node: l } = r, { createPlaceholder:
|
|
1233
|
-
(
|
|
1234
|
-
).join(""), d =
|
|
1262
|
+
const { node: l } = r, { createPlaceholder: a, placeholderRegex: g } = x(), c = l.quasis.map(
|
|
1263
|
+
(p, m, { length: f }) => m === f - 1 ? p.value.cooked : p.value.cooked + a(m)
|
|
1264
|
+
).join(""), d = c.match(/^\s+/)?.[0] ?? "", u = c.match(/\s+$/)?.[0] ?? "", y = c.slice(
|
|
1235
1265
|
d.length,
|
|
1236
1266
|
-u.length || void 0
|
|
1237
|
-
), E =
|
|
1267
|
+
), E = S(r, n), b = await t(y, {
|
|
1238
1268
|
...e,
|
|
1239
1269
|
parser: "yaml"
|
|
1240
|
-
}), i =
|
|
1241
|
-
if (e.preserveEmbeddedExteriorWhitespaces?.includes(
|
|
1242
|
-
return
|
|
1270
|
+
}), i = L(b, g, E);
|
|
1271
|
+
if (e.preserveEmbeddedExteriorWhitespaces?.includes(s))
|
|
1272
|
+
return X([
|
|
1243
1273
|
"`",
|
|
1244
1274
|
d,
|
|
1245
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1275
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [X(i)] : ut([X(i)]),
|
|
1246
1276
|
u,
|
|
1247
1277
|
"`"
|
|
1248
1278
|
]);
|
|
1249
|
-
const
|
|
1250
|
-
return
|
|
1279
|
+
const h = d.length ? lt : gt, v = u.length ? lt : gt;
|
|
1280
|
+
return X([
|
|
1251
1281
|
"`",
|
|
1252
|
-
e.noEmbeddedMultiLineIndentation?.includes(
|
|
1282
|
+
e.noEmbeddedMultiLineIndentation?.includes(s) ? [h, X(i)] : ut([h, X(i)]),
|
|
1253
1283
|
v,
|
|
1254
1284
|
"`"
|
|
1255
1285
|
]);
|
|
1256
|
-
},
|
|
1257
|
-
[
|
|
1286
|
+
}, xt = "embeddedYaml", ys = ["yaml", "yml"], _s = T(xt), vs = {
|
|
1287
|
+
[_s]: {
|
|
1258
1288
|
category: "Embed",
|
|
1259
1289
|
type: "string",
|
|
1260
1290
|
array: !0,
|
|
1261
|
-
default: [{ value: [...
|
|
1262
|
-
description: "
|
|
1291
|
+
default: [{ value: [...ys] }],
|
|
1292
|
+
description: "Tag or comment identifiers that make their subsequent template literals be identified as embedded YAML language."
|
|
1263
1293
|
}
|
|
1264
|
-
},
|
|
1294
|
+
}, $s = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1265
1295
|
__proto__: null,
|
|
1266
|
-
embedder:
|
|
1267
|
-
language:
|
|
1268
|
-
options:
|
|
1269
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1270
|
-
"./css/index.ts":
|
|
1271
|
-
"./es/index.ts":
|
|
1272
|
-
"./glsl/index.ts":
|
|
1273
|
-
"./graphql/index.ts":
|
|
1274
|
-
"./html/index.ts":
|
|
1275
|
-
"./ini/index.ts":
|
|
1276
|
-
"./json/index.ts":
|
|
1277
|
-
"./latex/index.ts":
|
|
1278
|
-
"./markdown/index.ts":
|
|
1279
|
-
"./noop/index.ts":
|
|
1280
|
-
"./php/index.ts":
|
|
1281
|
-
"./properties/index.ts":
|
|
1282
|
-
"./ruby/index.ts":
|
|
1283
|
-
"./sh/index.ts":
|
|
1284
|
-
"./sql/index.ts":
|
|
1285
|
-
"./toml/index.ts":
|
|
1286
|
-
"./ts/index.ts":
|
|
1287
|
-
"./xml/index.ts":
|
|
1288
|
-
"./yaml/index.ts":
|
|
1296
|
+
embedder: Es,
|
|
1297
|
+
language: xt,
|
|
1298
|
+
options: vs
|
|
1299
|
+
}, Symbol.toStringTag, { value: "Module" })), Lt = [], kt = {}, At = {}, Ot = {}, Ds = /* @__PURE__ */ Object.assign({
|
|
1300
|
+
"./css/index.ts": un,
|
|
1301
|
+
"./es/index.ts": En,
|
|
1302
|
+
"./glsl/index.ts": Dn,
|
|
1303
|
+
"./graphql/index.ts": Ln,
|
|
1304
|
+
"./html/index.ts": Fn,
|
|
1305
|
+
"./ini/index.ts": qn,
|
|
1306
|
+
"./json/index.ts": Xn,
|
|
1307
|
+
"./latex/index.ts": er,
|
|
1308
|
+
"./markdown/index.ts": ar,
|
|
1309
|
+
"./noop/index.ts": lr,
|
|
1310
|
+
"./php/index.ts": hr,
|
|
1311
|
+
"./properties/index.ts": _r,
|
|
1312
|
+
"./ruby/index.ts": xr,
|
|
1313
|
+
"./sh/index.ts": Nr,
|
|
1314
|
+
"./sql/index.ts": Xr,
|
|
1315
|
+
"./toml/index.ts": ns,
|
|
1316
|
+
"./ts/index.ts": ds,
|
|
1317
|
+
"./xml/index.ts": bs,
|
|
1318
|
+
"./yaml/index.ts": $s
|
|
1289
1319
|
});
|
|
1290
|
-
Object.values(
|
|
1291
|
-
nn(
|
|
1320
|
+
Object.values(Ds).forEach(({ language: t, parser: n, embedder: r, options: e }) => {
|
|
1321
|
+
nn(Lt, t, ae), n && (kt[t] = n), r && (At[t] = r), Object.assign(Ot, e);
|
|
1292
1322
|
});
|
|
1293
|
-
const
|
|
1294
|
-
...
|
|
1295
|
-
[
|
|
1323
|
+
const Is = "noEmbeddedIdentificationByComment", Ts = "noEmbeddedIdentificationByTag", Ss = "preserveEmbeddedExteriorWhitespaces", xs = "noEmbeddedMultiLineIndentation", Ls = "embeddedOverrides", ro = {
|
|
1324
|
+
...Ot,
|
|
1325
|
+
[Is]: {
|
|
1296
1326
|
category: "Embed",
|
|
1297
1327
|
type: "string",
|
|
1298
1328
|
array: !0,
|
|
1299
1329
|
default: [{ value: [] }],
|
|
1300
|
-
description:
|
|
1330
|
+
description: "Turns off `` /* identifier */ `...` `` comment-based embedded language identification for the specified identifiers."
|
|
1301
1331
|
},
|
|
1302
|
-
[
|
|
1332
|
+
[Ts]: {
|
|
1303
1333
|
category: "Embed",
|
|
1304
1334
|
type: "string",
|
|
1305
1335
|
array: !0,
|
|
1306
1336
|
default: [{ value: [] }],
|
|
1307
|
-
description:
|
|
1337
|
+
description: "Turns off `` identifier`...` `` tag-based embedded language identification for the specified identifiers."
|
|
1308
1338
|
},
|
|
1309
|
-
[
|
|
1339
|
+
[Ss]: {
|
|
1310
1340
|
category: "Embed",
|
|
1311
1341
|
type: "string",
|
|
1312
1342
|
array: !0,
|
|
1313
1343
|
default: [{ value: [] }],
|
|
1314
|
-
description: "
|
|
1344
|
+
description: "Preserves leading and trailing whitespaces in the formatting results for the specified identifiers."
|
|
1315
1345
|
},
|
|
1316
|
-
[
|
|
1346
|
+
[xs]: {
|
|
1317
1347
|
category: "Embed",
|
|
1318
1348
|
type: "string",
|
|
1319
1349
|
array: !0,
|
|
1320
1350
|
default: [{ value: [] }],
|
|
1321
|
-
description: "
|
|
1351
|
+
description: "Turns off auto indentation in the formatting results for the specified identifiers when they are formatted to span multi lines."
|
|
1322
1352
|
},
|
|
1323
|
-
[
|
|
1353
|
+
[Ls]: {
|
|
1324
1354
|
category: "Embed",
|
|
1325
1355
|
type: "string",
|
|
1326
1356
|
array: !1,
|
|
1327
1357
|
default: void 0,
|
|
1328
|
-
description: "
|
|
1358
|
+
description: "Option overrides for the specified identifiers. It should either be a stringified JSON or an absolute filepath to the option overrides file."
|
|
1329
1359
|
}
|
|
1330
|
-
},
|
|
1360
|
+
}, mt = {
|
|
1331
1361
|
// parsers from internal
|
|
1332
1362
|
...wt.parsers,
|
|
1333
1363
|
...Bt.parsers,
|
|
1334
1364
|
...Ut.parsers,
|
|
1335
|
-
...Wt.parsers,
|
|
1336
1365
|
...Ct.parsers,
|
|
1366
|
+
...qt.parsers,
|
|
1337
1367
|
// parsers from this plugin
|
|
1338
|
-
...
|
|
1368
|
+
...kt
|
|
1339
1369
|
};
|
|
1340
|
-
var
|
|
1370
|
+
var ks = {
|
|
1341
1371
|
isEqual: !0,
|
|
1342
1372
|
isMatchingKey: !0,
|
|
1343
1373
|
isPromise: !0,
|
|
@@ -1346,24 +1376,24 @@ var Do = {
|
|
|
1346
1376
|
onCacheChange: !0,
|
|
1347
1377
|
onCacheHit: !0,
|
|
1348
1378
|
transformKey: !0
|
|
1349
|
-
},
|
|
1350
|
-
function
|
|
1379
|
+
}, As = Array.prototype.slice;
|
|
1380
|
+
function V(t) {
|
|
1351
1381
|
var n = t.length;
|
|
1352
|
-
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] :
|
|
1382
|
+
return n ? n === 1 ? [t[0]] : n === 2 ? [t[0], t[1]] : n === 3 ? [t[0], t[1], t[2]] : As.call(t, 0) : [];
|
|
1353
1383
|
}
|
|
1354
|
-
function
|
|
1384
|
+
function Os(t) {
|
|
1355
1385
|
var n = {};
|
|
1356
1386
|
for (var r in t)
|
|
1357
|
-
|
|
1387
|
+
ks[r] || (n[r] = t[r]);
|
|
1358
1388
|
return n;
|
|
1359
1389
|
}
|
|
1360
|
-
function
|
|
1390
|
+
function Ps(t) {
|
|
1361
1391
|
return typeof t == "function" && t.isMemoized;
|
|
1362
1392
|
}
|
|
1363
|
-
function
|
|
1393
|
+
function Ms(t, n) {
|
|
1364
1394
|
return t === n || t !== t && n !== n;
|
|
1365
1395
|
}
|
|
1366
|
-
function
|
|
1396
|
+
function pt(t, n) {
|
|
1367
1397
|
var r = {};
|
|
1368
1398
|
for (var e in t)
|
|
1369
1399
|
r[e] = t[e];
|
|
@@ -1371,7 +1401,7 @@ function ut(t, n) {
|
|
|
1371
1401
|
r[e] = n[e];
|
|
1372
1402
|
return r;
|
|
1373
1403
|
}
|
|
1374
|
-
var
|
|
1404
|
+
var Ns = (
|
|
1375
1405
|
/** @class */
|
|
1376
1406
|
function() {
|
|
1377
1407
|
function t(n) {
|
|
@@ -1396,118 +1426,118 @@ var Oo = (
|
|
|
1396
1426
|
*/
|
|
1397
1427
|
get: function() {
|
|
1398
1428
|
return {
|
|
1399
|
-
keys:
|
|
1429
|
+
keys: V(this.keys),
|
|
1400
1430
|
size: this.size,
|
|
1401
|
-
values:
|
|
1431
|
+
values: V(this.values)
|
|
1402
1432
|
};
|
|
1403
1433
|
},
|
|
1404
1434
|
enumerable: !1,
|
|
1405
1435
|
configurable: !0
|
|
1406
1436
|
}), t.prototype._getKeyIndexFromMatchingKey = function(n) {
|
|
1407
|
-
var r = this.options, e = r.isMatchingKey,
|
|
1437
|
+
var r = this.options, e = r.isMatchingKey, s = r.maxSize, o = this.keys, l = o.length;
|
|
1408
1438
|
if (!l)
|
|
1409
1439
|
return -1;
|
|
1410
|
-
if (e(
|
|
1440
|
+
if (e(o[0], n))
|
|
1411
1441
|
return 0;
|
|
1412
|
-
if (
|
|
1413
|
-
for (var
|
|
1414
|
-
if (e(
|
|
1415
|
-
return
|
|
1442
|
+
if (s > 1) {
|
|
1443
|
+
for (var a = 1; a < l; a++)
|
|
1444
|
+
if (e(o[a], n))
|
|
1445
|
+
return a;
|
|
1416
1446
|
}
|
|
1417
1447
|
return -1;
|
|
1418
1448
|
}, t.prototype._getKeyIndexForMany = function(n) {
|
|
1419
|
-
var r = this.options.isEqual, e = this.keys,
|
|
1420
|
-
if (!
|
|
1449
|
+
var r = this.options.isEqual, e = this.keys, s = e.length;
|
|
1450
|
+
if (!s)
|
|
1421
1451
|
return -1;
|
|
1422
|
-
if (
|
|
1452
|
+
if (s === 1)
|
|
1423
1453
|
return this._getKeyIndexForSingle(n);
|
|
1424
|
-
var
|
|
1425
|
-
if (
|
|
1426
|
-
for (var g = 0; g <
|
|
1427
|
-
if (l = e[g], l.length ===
|
|
1428
|
-
for (
|
|
1454
|
+
var o = n.length, l, a;
|
|
1455
|
+
if (o > 1) {
|
|
1456
|
+
for (var g = 0; g < s; g++)
|
|
1457
|
+
if (l = e[g], l.length === o) {
|
|
1458
|
+
for (a = 0; a < o && r(l[a], n[a]); a++)
|
|
1429
1459
|
;
|
|
1430
|
-
if (
|
|
1460
|
+
if (a === o)
|
|
1431
1461
|
return g;
|
|
1432
1462
|
}
|
|
1433
1463
|
} else
|
|
1434
|
-
for (var g = 0; g <
|
|
1435
|
-
if (l = e[g], l.length ===
|
|
1464
|
+
for (var g = 0; g < s; g++)
|
|
1465
|
+
if (l = e[g], l.length === o && r(l[0], n[0]))
|
|
1436
1466
|
return g;
|
|
1437
1467
|
return -1;
|
|
1438
1468
|
}, t.prototype._getKeyIndexForSingle = function(n) {
|
|
1439
1469
|
var r = this.keys;
|
|
1440
1470
|
if (!r.length)
|
|
1441
1471
|
return -1;
|
|
1442
|
-
var e = r[0],
|
|
1443
|
-
if (n.length !==
|
|
1472
|
+
var e = r[0], s = e.length;
|
|
1473
|
+
if (n.length !== s)
|
|
1444
1474
|
return -1;
|
|
1445
|
-
var
|
|
1446
|
-
if (
|
|
1447
|
-
for (var l = 0; l <
|
|
1448
|
-
if (!
|
|
1475
|
+
var o = this.options.isEqual;
|
|
1476
|
+
if (s > 1) {
|
|
1477
|
+
for (var l = 0; l < s; l++)
|
|
1478
|
+
if (!o(e[l], n[l]))
|
|
1449
1479
|
return -1;
|
|
1450
1480
|
return 0;
|
|
1451
1481
|
}
|
|
1452
|
-
return
|
|
1482
|
+
return o(e[0], n[0]) ? 0 : -1;
|
|
1453
1483
|
}, t.prototype.orderByLru = function(n, r, e) {
|
|
1454
|
-
for (var
|
|
1455
|
-
|
|
1456
|
-
|
|
1484
|
+
for (var s = this.keys, o = this.values, l = s.length, a = e; a--; )
|
|
1485
|
+
s[a + 1] = s[a], o[a + 1] = o[a];
|
|
1486
|
+
s[0] = n, o[0] = r;
|
|
1457
1487
|
var g = this.options.maxSize;
|
|
1458
|
-
l === g && e === l ? (
|
|
1488
|
+
l === g && e === l ? (s.pop(), o.pop()) : e >= g && (s.length = o.length = g);
|
|
1459
1489
|
}, t.prototype.updateAsyncCache = function(n) {
|
|
1460
|
-
var r = this, e = this.options,
|
|
1461
|
-
this.values[0] =
|
|
1462
|
-
return r.shouldUpdateOnHit &&
|
|
1490
|
+
var r = this, e = this.options, s = e.onCacheChange, o = e.onCacheHit, l = this.keys[0], a = this.values[0];
|
|
1491
|
+
this.values[0] = a.then(function(g) {
|
|
1492
|
+
return r.shouldUpdateOnHit && o(r, r.options, n), r.shouldUpdateOnChange && s(r, r.options, n), g;
|
|
1463
1493
|
}, function(g) {
|
|
1464
|
-
var
|
|
1465
|
-
throw
|
|
1494
|
+
var c = r.getKeyIndex(l);
|
|
1495
|
+
throw c !== -1 && (r.keys.splice(c, 1), r.values.splice(c, 1)), g;
|
|
1466
1496
|
});
|
|
1467
1497
|
}, t;
|
|
1468
1498
|
}()
|
|
1469
1499
|
);
|
|
1470
|
-
function
|
|
1471
|
-
if (n === void 0 && (n = {}),
|
|
1472
|
-
return
|
|
1500
|
+
function Pt(t, n) {
|
|
1501
|
+
if (n === void 0 && (n = {}), Ps(t))
|
|
1502
|
+
return Pt(t.fn, pt(t.options, n));
|
|
1473
1503
|
if (typeof t != "function")
|
|
1474
1504
|
throw new TypeError("You must pass a function to `memoize`.");
|
|
1475
|
-
var r = n.isEqual, e = r === void 0 ?
|
|
1505
|
+
var r = n.isEqual, e = r === void 0 ? Ms : r, s = n.isMatchingKey, o = n.isPromise, l = o === void 0 ? !1 : o, a = n.maxSize, g = a === void 0 ? 1 : a, c = n.onCacheAdd, d = n.onCacheChange, u = n.onCacheHit, y = n.transformKey, E = pt({
|
|
1476
1506
|
isEqual: e,
|
|
1477
|
-
isMatchingKey:
|
|
1507
|
+
isMatchingKey: s,
|
|
1478
1508
|
isPromise: l,
|
|
1479
1509
|
maxSize: g,
|
|
1480
|
-
onCacheAdd:
|
|
1510
|
+
onCacheAdd: c,
|
|
1481
1511
|
onCacheChange: d,
|
|
1482
1512
|
onCacheHit: u,
|
|
1483
1513
|
transformKey: y
|
|
1484
|
-
},
|
|
1485
|
-
var
|
|
1486
|
-
v && (
|
|
1487
|
-
var
|
|
1488
|
-
if (
|
|
1489
|
-
$ && u(b, E, _),
|
|
1514
|
+
}, Os(n)), b = new Ns(E), i = b.keys, h = b.values, v = b.canTransformKey, p = b.shouldCloneArguments, m = b.shouldUpdateOnAdd, f = b.shouldUpdateOnChange, $ = b.shouldUpdateOnHit, _ = function() {
|
|
1515
|
+
var D = p ? V(arguments) : arguments;
|
|
1516
|
+
v && (D = y(D));
|
|
1517
|
+
var k = i.length ? b.getKeyIndex(D) : -1;
|
|
1518
|
+
if (k !== -1)
|
|
1519
|
+
$ && u(b, E, _), k && (b.orderByLru(i[k], h[k], k), f && d(b, E, _));
|
|
1490
1520
|
else {
|
|
1491
|
-
var Ft = t.apply(this, arguments), jt =
|
|
1492
|
-
b.orderByLru(jt, Ft, i.length), l && b.updateAsyncCache(_),
|
|
1521
|
+
var Ft = t.apply(this, arguments), jt = p ? D : V(arguments);
|
|
1522
|
+
b.orderByLru(jt, Ft, i.length), l && b.updateAsyncCache(_), m && c(b, E, _), f && d(b, E, _);
|
|
1493
1523
|
}
|
|
1494
|
-
return
|
|
1524
|
+
return h[0];
|
|
1495
1525
|
};
|
|
1496
1526
|
return _.cache = b, _.fn = t, _.isMemoized = !0, _.options = E, _;
|
|
1497
1527
|
}
|
|
1498
|
-
async function
|
|
1528
|
+
async function ht(t) {
|
|
1499
1529
|
try {
|
|
1500
|
-
const n = await
|
|
1530
|
+
const n = await Gt(t, { encoding: "utf-8" });
|
|
1501
1531
|
return JSON.parse(n);
|
|
1502
1532
|
} catch {
|
|
1503
1533
|
}
|
|
1504
1534
|
}
|
|
1505
|
-
const
|
|
1535
|
+
const Rs = /* @__PURE__ */ new URL(
|
|
1506
1536
|
"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);')
|
|
1507
1537
|
);
|
|
1508
|
-
async function
|
|
1538
|
+
async function Fs(t) {
|
|
1509
1539
|
return new Promise((n) => {
|
|
1510
|
-
const r = new Xt(
|
|
1540
|
+
const r = new Xt(Rs, {
|
|
1511
1541
|
workerData: {
|
|
1512
1542
|
absolutePath: t
|
|
1513
1543
|
}
|
|
@@ -1519,12 +1549,12 @@ async function Po(t) {
|
|
|
1519
1549
|
});
|
|
1520
1550
|
});
|
|
1521
1551
|
}
|
|
1522
|
-
async function
|
|
1552
|
+
async function js(t) {
|
|
1523
1553
|
console.error(
|
|
1524
1554
|
"Ts module type embeddedOverrides has not been implemented yet."
|
|
1525
1555
|
);
|
|
1526
1556
|
}
|
|
1527
|
-
const
|
|
1557
|
+
const ws = Pt(
|
|
1528
1558
|
async (t, n) => {
|
|
1529
1559
|
if (zt(t))
|
|
1530
1560
|
return t;
|
|
@@ -1532,62 +1562,62 @@ const No = kt(
|
|
|
1532
1562
|
let e;
|
|
1533
1563
|
return typeof r != "string" ? e = process.env.PWD ?? process.cwd() : e = Kt(r), Ht(e, t);
|
|
1534
1564
|
}
|
|
1535
|
-
),
|
|
1536
|
-
const r =
|
|
1565
|
+
), Bs = async (t, n) => {
|
|
1566
|
+
const r = ws(
|
|
1537
1567
|
t,
|
|
1538
1568
|
n
|
|
1539
1569
|
), e = Jt(t);
|
|
1540
1570
|
if (e === ".json") {
|
|
1541
|
-
const
|
|
1542
|
-
if (
|
|
1543
|
-
return
|
|
1544
|
-
console.error(`Failed to parse the json file: ${
|
|
1571
|
+
const s = await r, o = await ht(s);
|
|
1572
|
+
if (o !== void 0)
|
|
1573
|
+
return o;
|
|
1574
|
+
console.error(`Failed to parse the json file: ${s}`);
|
|
1545
1575
|
return;
|
|
1546
1576
|
} else if (e === ".mjs" || e === ".cjs" || e === ".js") {
|
|
1547
|
-
const
|
|
1548
|
-
if (
|
|
1549
|
-
return
|
|
1550
|
-
console.error(`Failed to parse the js module file: ${
|
|
1577
|
+
const s = await r, o = await Fs(s);
|
|
1578
|
+
if (o !== void 0)
|
|
1579
|
+
return o;
|
|
1580
|
+
console.error(`Failed to parse the js module file: ${s}`);
|
|
1551
1581
|
return;
|
|
1552
1582
|
} else if (e === ".mts" || e === ".cts" || e === ".ts") {
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1555
|
-
return
|
|
1556
|
-
console.error(`Failed to parse the ts module file: ${
|
|
1583
|
+
const s = await r, o = await js();
|
|
1584
|
+
if (o !== void 0)
|
|
1585
|
+
return o;
|
|
1586
|
+
console.error(`Failed to parse the ts module file: ${s}`);
|
|
1557
1587
|
return;
|
|
1558
1588
|
} else if (e === "") {
|
|
1559
|
-
const
|
|
1560
|
-
if (
|
|
1561
|
-
return
|
|
1589
|
+
const s = await r, o = await ht(s);
|
|
1590
|
+
if (o !== void 0)
|
|
1591
|
+
return o;
|
|
1562
1592
|
}
|
|
1563
1593
|
try {
|
|
1564
1594
|
return JSON.parse(t);
|
|
1565
1595
|
} catch {
|
|
1566
1596
|
console.error("Failed to parse embeddedOverrides as a json object");
|
|
1567
1597
|
}
|
|
1568
|
-
},
|
|
1598
|
+
}, Us = async (t, n, r) => {
|
|
1569
1599
|
if (t === void 0)
|
|
1570
1600
|
return;
|
|
1571
|
-
const e = await
|
|
1601
|
+
const e = await Bs(
|
|
1572
1602
|
t,
|
|
1573
1603
|
r
|
|
1574
1604
|
);
|
|
1575
1605
|
if (e !== void 0)
|
|
1576
1606
|
try {
|
|
1577
|
-
for (const { identifiers:
|
|
1578
|
-
if (
|
|
1579
|
-
return
|
|
1607
|
+
for (const { identifiers: s, options: o } of e)
|
|
1608
|
+
if (s.includes(n))
|
|
1609
|
+
return o;
|
|
1580
1610
|
} catch {
|
|
1581
1611
|
console.error("Error parsing embedded override options.");
|
|
1582
1612
|
}
|
|
1583
1613
|
};
|
|
1584
|
-
function
|
|
1614
|
+
function qs({ node: t, parent: n }, r, e) {
|
|
1585
1615
|
if (r.length === 0 || t.type !== "TemplateLiteral")
|
|
1586
1616
|
return;
|
|
1587
|
-
const
|
|
1588
|
-
if (!
|
|
1617
|
+
const s = t.comments ?? n?.comments;
|
|
1618
|
+
if (!s)
|
|
1589
1619
|
return;
|
|
1590
|
-
const
|
|
1620
|
+
const o = s[s.length - 1];
|
|
1591
1621
|
if (![
|
|
1592
1622
|
"MultiLine",
|
|
1593
1623
|
// meriyah
|
|
@@ -1595,18 +1625,18 @@ function Fo({ node: t, parent: n }, r, e) {
|
|
|
1595
1625
|
// typescript, acorn, espree, flow
|
|
1596
1626
|
"CommentBlock"
|
|
1597
1627
|
// babel, babel-flow, babel-ts
|
|
1598
|
-
].includes(
|
|
1628
|
+
].includes(o.type) || !o.leading)
|
|
1599
1629
|
return;
|
|
1600
1630
|
const l = e.noEmbeddedIdentificationByComment ?? [];
|
|
1601
|
-
for (const
|
|
1602
|
-
if (!l.includes(
|
|
1603
|
-
return
|
|
1631
|
+
for (const a of r)
|
|
1632
|
+
if (!l.includes(a) && ` ${a} ` === o.value)
|
|
1633
|
+
return a;
|
|
1604
1634
|
}
|
|
1605
|
-
function
|
|
1635
|
+
function Cs({ node: t, parent: n }, r, e) {
|
|
1606
1636
|
if (r.length === 0 || t.type !== "TemplateLiteral" || n?.type !== "TaggedTemplateExpression")
|
|
1607
1637
|
return;
|
|
1608
1638
|
e.parser;
|
|
1609
|
-
const
|
|
1639
|
+
const s = e.parser in mt, o = e.noEmbeddedIdentificationByTag ?? [], l = /* @__PURE__ */ new Set([
|
|
1610
1640
|
"start",
|
|
1611
1641
|
"end",
|
|
1612
1642
|
"loc",
|
|
@@ -1615,18 +1645,18 @@ function jo({ node: t, parent: n }, r, e) {
|
|
|
1615
1645
|
"typeAnnotation",
|
|
1616
1646
|
"decorators"
|
|
1617
1647
|
]);
|
|
1618
|
-
for (const
|
|
1619
|
-
if (!
|
|
1620
|
-
if (
|
|
1621
|
-
if (n.tag.type === "Identifier" && n.tag.name ===
|
|
1622
|
-
return
|
|
1648
|
+
for (const a of r)
|
|
1649
|
+
if (!o.includes(a))
|
|
1650
|
+
if (Ws(a)) {
|
|
1651
|
+
if (n.tag.type === "Identifier" && n.tag.name === a)
|
|
1652
|
+
return a;
|
|
1623
1653
|
} else {
|
|
1624
|
-
if (!
|
|
1654
|
+
if (!s)
|
|
1625
1655
|
return;
|
|
1626
1656
|
let g;
|
|
1627
1657
|
try {
|
|
1628
|
-
const d =
|
|
1629
|
-
`${
|
|
1658
|
+
const d = mt[e.parser].parse(
|
|
1659
|
+
`${a}\`\``,
|
|
1630
1660
|
e
|
|
1631
1661
|
);
|
|
1632
1662
|
if (d instanceof Promise)
|
|
@@ -1639,66 +1669,66 @@ function jo({ node: t, parent: n }, r, e) {
|
|
|
1639
1669
|
}
|
|
1640
1670
|
if (g.type === "File" && (g = g.program), !(g.type === "Program" && g.body[0]?.type === "ExpressionStatement"))
|
|
1641
1671
|
continue;
|
|
1642
|
-
const
|
|
1643
|
-
if (
|
|
1672
|
+
const c = g.body[0]?.expression;
|
|
1673
|
+
if (c?.type !== "TaggedTemplateExpression")
|
|
1644
1674
|
continue;
|
|
1645
|
-
if (n.tag,
|
|
1646
|
-
return
|
|
1675
|
+
if (n.tag, c.tag, Nt(n.tag, c.tag, l))
|
|
1676
|
+
return a;
|
|
1647
1677
|
}
|
|
1648
1678
|
}
|
|
1649
|
-
function
|
|
1679
|
+
function Ws(t) {
|
|
1650
1680
|
return /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(t);
|
|
1651
1681
|
}
|
|
1652
|
-
function
|
|
1653
|
-
return Object.is(t, n) ? !0 : Array.isArray(t) ?
|
|
1682
|
+
function Mt(t, n, r = /* @__PURE__ */ new Set()) {
|
|
1683
|
+
return Object.is(t, n) ? !0 : Array.isArray(t) ? Gs(t, n, r) : typeof t == "object" ? Nt(
|
|
1654
1684
|
t,
|
|
1655
1685
|
n,
|
|
1656
1686
|
r
|
|
1657
1687
|
) : !1;
|
|
1658
1688
|
}
|
|
1659
|
-
function
|
|
1689
|
+
function Gs(t, n, r = /* @__PURE__ */ new Set()) {
|
|
1660
1690
|
const e = t.length;
|
|
1661
1691
|
if (e != n.length)
|
|
1662
1692
|
return !1;
|
|
1663
|
-
for (let
|
|
1664
|
-
if (!
|
|
1693
|
+
for (let s = 0; s < e; s++)
|
|
1694
|
+
if (!Mt(t[s], n[s], r))
|
|
1665
1695
|
return !1;
|
|
1666
1696
|
return !0;
|
|
1667
1697
|
}
|
|
1668
|
-
function
|
|
1698
|
+
function Nt(t, n, r = /* @__PURE__ */ new Set()) {
|
|
1669
1699
|
for (const e of Object.keys(t))
|
|
1670
|
-
if (!r.has(e) && !(Object.prototype.hasOwnProperty.call(n, e) &&
|
|
1700
|
+
if (!r.has(e) && !(Object.prototype.hasOwnProperty.call(n, e) && Mt(t[e], n[e], r)))
|
|
1671
1701
|
return !1;
|
|
1672
1702
|
return !0;
|
|
1673
1703
|
}
|
|
1674
|
-
const { estree: Rt } =
|
|
1704
|
+
const { estree: Rt } = Wt, zs = function(t, n) {
|
|
1675
1705
|
const { node: r } = t;
|
|
1676
1706
|
if (r.type !== "TemplateLiteral" || r.quasis.some(({ value: { cooked: e } }) => e === null))
|
|
1677
1707
|
return null;
|
|
1678
|
-
for (const e of
|
|
1679
|
-
const
|
|
1680
|
-
if (!
|
|
1708
|
+
for (const e of Lt) {
|
|
1709
|
+
const s = n[T(e)];
|
|
1710
|
+
if (!s)
|
|
1681
1711
|
continue;
|
|
1682
|
-
const
|
|
1683
|
-
if (
|
|
1712
|
+
const o = qs(t, s, n) ?? Cs(t, s, n);
|
|
1713
|
+
if (o === void 0)
|
|
1684
1714
|
continue;
|
|
1685
1715
|
const l = At[e];
|
|
1686
1716
|
if (!l)
|
|
1687
1717
|
return null;
|
|
1688
|
-
const
|
|
1689
|
-
return
|
|
1690
|
-
const y = await
|
|
1718
|
+
const a = t.node;
|
|
1719
|
+
return a.quasis.length === 1 && a.quasis[0]?.value.raw.trim() === "" ? "``" : async (g, c, d, u) => {
|
|
1720
|
+
const y = await Us(
|
|
1691
1721
|
u.embeddedOverrides,
|
|
1692
|
-
|
|
1722
|
+
o,
|
|
1693
1723
|
u.filepath
|
|
1694
1724
|
);
|
|
1695
1725
|
try {
|
|
1696
|
-
const E = await l(g,
|
|
1697
|
-
identifier:
|
|
1698
|
-
identifiers:
|
|
1726
|
+
const E = await l(g, c, d, u, {
|
|
1727
|
+
identifier: o,
|
|
1728
|
+
identifiers: s,
|
|
1699
1729
|
embeddedOverrideOptions: y
|
|
1700
1730
|
});
|
|
1701
|
-
return
|
|
1731
|
+
return I.label(
|
|
1702
1732
|
{ embed: !0, ...E.label },
|
|
1703
1733
|
E
|
|
1704
1734
|
);
|
|
@@ -1708,19 +1738,19 @@ const { estree: Rt } = Gt, Uo = function(t, n) {
|
|
|
1708
1738
|
};
|
|
1709
1739
|
}
|
|
1710
1740
|
return Rt.embed?.(t, n) ?? null;
|
|
1711
|
-
},
|
|
1741
|
+
}, so = {
|
|
1712
1742
|
estree: {
|
|
1713
1743
|
...Rt,
|
|
1714
|
-
embed:
|
|
1744
|
+
embed: zs
|
|
1715
1745
|
}
|
|
1716
1746
|
};
|
|
1717
1747
|
export {
|
|
1718
1748
|
At as embeddedEmbedders,
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1749
|
+
Lt as embeddedLanguages,
|
|
1750
|
+
Ot as embeddedOptions,
|
|
1751
|
+
kt as embeddedParsers,
|
|
1752
|
+
T as makeIdentifiersOptionName,
|
|
1753
|
+
ro as options,
|
|
1754
|
+
mt as parsers,
|
|
1755
|
+
so as printers
|
|
1726
1756
|
};
|