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