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