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