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