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