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