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