1 | "use strict";
|
2 | var __getOwnPropNames = Object.getOwnPropertyNames;
|
3 | var __commonJS = (cb, mod) => function __require() {
|
4 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
5 | };
|
6 |
|
7 |
|
8 | var require_global = __commonJS({
|
9 | "node_modules/core-js/internals/global.js"(exports2, module2) {
|
10 | var check = function(it) {
|
11 | return it && it.Math == Math && it;
|
12 | };
|
13 | module2.exports = check(typeof globalThis == "object" && globalThis) || check(typeof window == "object" && window) || check(typeof self == "object" && self) || check(typeof global == "object" && global) || function() {
|
14 | return this;
|
15 | }() || Function("return this")();
|
16 | }
|
17 | });
|
18 |
|
19 |
|
20 | var require_fails = __commonJS({
|
21 | "node_modules/core-js/internals/fails.js"(exports2, module2) {
|
22 | module2.exports = function(exec) {
|
23 | try {
|
24 | return !!exec();
|
25 | } catch (error) {
|
26 | return true;
|
27 | }
|
28 | };
|
29 | }
|
30 | });
|
31 |
|
32 |
|
33 | var require_descriptors = __commonJS({
|
34 | "node_modules/core-js/internals/descriptors.js"(exports2, module2) {
|
35 | var fails = require_fails();
|
36 | module2.exports = !fails(function() {
|
37 | return Object.defineProperty({}, 1, { get: function() {
|
38 | return 7;
|
39 | } })[1] != 7;
|
40 | });
|
41 | }
|
42 | });
|
43 |
|
44 |
|
45 | var require_function_bind_native = __commonJS({
|
46 | "node_modules/core-js/internals/function-bind-native.js"(exports2, module2) {
|
47 | var fails = require_fails();
|
48 | module2.exports = !fails(function() {
|
49 | var test = function() {
|
50 | }.bind();
|
51 | return typeof test != "function" || test.hasOwnProperty("prototype");
|
52 | });
|
53 | }
|
54 | });
|
55 |
|
56 |
|
57 | var require_function_call = __commonJS({
|
58 | "node_modules/core-js/internals/function-call.js"(exports2, module2) {
|
59 | var NATIVE_BIND = require_function_bind_native();
|
60 | var call = Function.prototype.call;
|
61 | module2.exports = NATIVE_BIND ? call.bind(call) : function() {
|
62 | return call.apply(call, arguments);
|
63 | };
|
64 | }
|
65 | });
|
66 |
|
67 |
|
68 | var require_object_property_is_enumerable = __commonJS({
|
69 | "node_modules/core-js/internals/object-property-is-enumerable.js"(exports2) {
|
70 | "use strict";
|
71 | var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
72 | var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
73 | var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
|
74 | exports2.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
75 | var descriptor = getOwnPropertyDescriptor(this, V);
|
76 | return !!descriptor && descriptor.enumerable;
|
77 | } : $propertyIsEnumerable;
|
78 | }
|
79 | });
|
80 |
|
81 |
|
82 | var require_create_property_descriptor = __commonJS({
|
83 | "node_modules/core-js/internals/create-property-descriptor.js"(exports2, module2) {
|
84 | module2.exports = function(bitmap, value) {
|
85 | return {
|
86 | enumerable: !(bitmap & 1),
|
87 | configurable: !(bitmap & 2),
|
88 | writable: !(bitmap & 4),
|
89 | value
|
90 | };
|
91 | };
|
92 | }
|
93 | });
|
94 |
|
95 |
|
96 | var require_function_uncurry_this = __commonJS({
|
97 | "node_modules/core-js/internals/function-uncurry-this.js"(exports2, module2) {
|
98 | var NATIVE_BIND = require_function_bind_native();
|
99 | var FunctionPrototype = Function.prototype;
|
100 | var bind = FunctionPrototype.bind;
|
101 | var call = FunctionPrototype.call;
|
102 | var uncurryThis = NATIVE_BIND && bind.bind(call, call);
|
103 | module2.exports = NATIVE_BIND ? function(fn) {
|
104 | return fn && uncurryThis(fn);
|
105 | } : function(fn) {
|
106 | return fn && function() {
|
107 | return call.apply(fn, arguments);
|
108 | };
|
109 | };
|
110 | }
|
111 | });
|
112 |
|
113 |
|
114 | var require_classof_raw = __commonJS({
|
115 | "node_modules/core-js/internals/classof-raw.js"(exports2, module2) {
|
116 | var uncurryThis = require_function_uncurry_this();
|
117 | var toString = uncurryThis({}.toString);
|
118 | var stringSlice = uncurryThis("".slice);
|
119 | module2.exports = function(it) {
|
120 | return stringSlice(toString(it), 8, -1);
|
121 | };
|
122 | }
|
123 | });
|
124 |
|
125 |
|
126 | var require_indexed_object = __commonJS({
|
127 | "node_modules/core-js/internals/indexed-object.js"(exports2, module2) {
|
128 | var global2 = require_global();
|
129 | var uncurryThis = require_function_uncurry_this();
|
130 | var fails = require_fails();
|
131 | var classof = require_classof_raw();
|
132 | var Object2 = global2.Object;
|
133 | var split = uncurryThis("".split);
|
134 | module2.exports = fails(function() {
|
135 | return !Object2("z").propertyIsEnumerable(0);
|
136 | }) ? function(it) {
|
137 | return classof(it) == "String" ? split(it, "") : Object2(it);
|
138 | } : Object2;
|
139 | }
|
140 | });
|
141 |
|
142 |
|
143 | var require_require_object_coercible = __commonJS({
|
144 | "node_modules/core-js/internals/require-object-coercible.js"(exports2, module2) {
|
145 | var global2 = require_global();
|
146 | var TypeError2 = global2.TypeError;
|
147 | module2.exports = function(it) {
|
148 | if (it == void 0)
|
149 | throw TypeError2("Can't call method on " + it);
|
150 | return it;
|
151 | };
|
152 | }
|
153 | });
|
154 |
|
155 |
|
156 | var require_to_indexed_object = __commonJS({
|
157 | "node_modules/core-js/internals/to-indexed-object.js"(exports2, module2) {
|
158 | var IndexedObject = require_indexed_object();
|
159 | var requireObjectCoercible = require_require_object_coercible();
|
160 | module2.exports = function(it) {
|
161 | return IndexedObject(requireObjectCoercible(it));
|
162 | };
|
163 | }
|
164 | });
|
165 |
|
166 |
|
167 | var require_is_callable = __commonJS({
|
168 | "node_modules/core-js/internals/is-callable.js"(exports2, module2) {
|
169 | module2.exports = function(argument) {
|
170 | return typeof argument == "function";
|
171 | };
|
172 | }
|
173 | });
|
174 |
|
175 |
|
176 | var require_is_object = __commonJS({
|
177 | "node_modules/core-js/internals/is-object.js"(exports2, module2) {
|
178 | var isCallable = require_is_callable();
|
179 | module2.exports = function(it) {
|
180 | return typeof it == "object" ? it !== null : isCallable(it);
|
181 | };
|
182 | }
|
183 | });
|
184 |
|
185 |
|
186 | var require_get_built_in = __commonJS({
|
187 | "node_modules/core-js/internals/get-built-in.js"(exports2, module2) {
|
188 | var global2 = require_global();
|
189 | var isCallable = require_is_callable();
|
190 | var aFunction = function(argument) {
|
191 | return isCallable(argument) ? argument : void 0;
|
192 | };
|
193 | module2.exports = function(namespace, method) {
|
194 | return arguments.length < 2 ? aFunction(global2[namespace]) : global2[namespace] && global2[namespace][method];
|
195 | };
|
196 | }
|
197 | });
|
198 |
|
199 |
|
200 | var require_object_is_prototype_of = __commonJS({
|
201 | "node_modules/core-js/internals/object-is-prototype-of.js"(exports2, module2) {
|
202 | var uncurryThis = require_function_uncurry_this();
|
203 | module2.exports = uncurryThis({}.isPrototypeOf);
|
204 | }
|
205 | });
|
206 |
|
207 |
|
208 | var require_engine_user_agent = __commonJS({
|
209 | "node_modules/core-js/internals/engine-user-agent.js"(exports2, module2) {
|
210 | var getBuiltIn = require_get_built_in();
|
211 | module2.exports = getBuiltIn("navigator", "userAgent") || "";
|
212 | }
|
213 | });
|
214 |
|
215 |
|
216 | var require_engine_v8_version = __commonJS({
|
217 | "node_modules/core-js/internals/engine-v8-version.js"(exports2, module2) {
|
218 | var global2 = require_global();
|
219 | var userAgent = require_engine_user_agent();
|
220 | var process2 = global2.process;
|
221 | var Deno = global2.Deno;
|
222 | var versions = process2 && process2.versions || Deno && Deno.version;
|
223 | var v8 = versions && versions.v8;
|
224 | var match;
|
225 | var version2;
|
226 | if (v8) {
|
227 | match = v8.split(".");
|
228 | version2 = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
|
229 | }
|
230 | if (!version2 && userAgent) {
|
231 | match = userAgent.match(/Edge\/(\d+)/);
|
232 | if (!match || match[1] >= 74) {
|
233 | match = userAgent.match(/Chrome\/(\d+)/);
|
234 | if (match)
|
235 | version2 = +match[1];
|
236 | }
|
237 | }
|
238 | module2.exports = version2;
|
239 | }
|
240 | });
|
241 |
|
242 |
|
243 | var require_native_symbol = __commonJS({
|
244 | "node_modules/core-js/internals/native-symbol.js"(exports2, module2) {
|
245 | var V8_VERSION = require_engine_v8_version();
|
246 | var fails = require_fails();
|
247 | module2.exports = !!Object.getOwnPropertySymbols && !fails(function() {
|
248 | var symbol = Symbol();
|
249 | return !String(symbol) || !(Object(symbol) instanceof Symbol) || !Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
250 | });
|
251 | }
|
252 | });
|
253 |
|
254 |
|
255 | var require_use_symbol_as_uid = __commonJS({
|
256 | "node_modules/core-js/internals/use-symbol-as-uid.js"(exports2, module2) {
|
257 | var NATIVE_SYMBOL = require_native_symbol();
|
258 | module2.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == "symbol";
|
259 | }
|
260 | });
|
261 |
|
262 |
|
263 | var require_is_symbol = __commonJS({
|
264 | "node_modules/core-js/internals/is-symbol.js"(exports2, module2) {
|
265 | var global2 = require_global();
|
266 | var getBuiltIn = require_get_built_in();
|
267 | var isCallable = require_is_callable();
|
268 | var isPrototypeOf = require_object_is_prototype_of();
|
269 | var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
|
270 | var Object2 = global2.Object;
|
271 | module2.exports = USE_SYMBOL_AS_UID ? function(it) {
|
272 | return typeof it == "symbol";
|
273 | } : function(it) {
|
274 | var $Symbol = getBuiltIn("Symbol");
|
275 | return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object2(it));
|
276 | };
|
277 | }
|
278 | });
|
279 |
|
280 |
|
281 | var require_try_to_string = __commonJS({
|
282 | "node_modules/core-js/internals/try-to-string.js"(exports2, module2) {
|
283 | var global2 = require_global();
|
284 | var String2 = global2.String;
|
285 | module2.exports = function(argument) {
|
286 | try {
|
287 | return String2(argument);
|
288 | } catch (error) {
|
289 | return "Object";
|
290 | }
|
291 | };
|
292 | }
|
293 | });
|
294 |
|
295 |
|
296 | var require_a_callable = __commonJS({
|
297 | "node_modules/core-js/internals/a-callable.js"(exports2, module2) {
|
298 | var global2 = require_global();
|
299 | var isCallable = require_is_callable();
|
300 | var tryToString = require_try_to_string();
|
301 | var TypeError2 = global2.TypeError;
|
302 | module2.exports = function(argument) {
|
303 | if (isCallable(argument))
|
304 | return argument;
|
305 | throw TypeError2(tryToString(argument) + " is not a function");
|
306 | };
|
307 | }
|
308 | });
|
309 |
|
310 |
|
311 | var require_get_method = __commonJS({
|
312 | "node_modules/core-js/internals/get-method.js"(exports2, module2) {
|
313 | var aCallable = require_a_callable();
|
314 | module2.exports = function(V, P) {
|
315 | var func = V[P];
|
316 | return func == null ? void 0 : aCallable(func);
|
317 | };
|
318 | }
|
319 | });
|
320 |
|
321 |
|
322 | var require_ordinary_to_primitive = __commonJS({
|
323 | "node_modules/core-js/internals/ordinary-to-primitive.js"(exports2, module2) {
|
324 | var global2 = require_global();
|
325 | var call = require_function_call();
|
326 | var isCallable = require_is_callable();
|
327 | var isObject = require_is_object();
|
328 | var TypeError2 = global2.TypeError;
|
329 | module2.exports = function(input, pref) {
|
330 | var fn, val;
|
331 | if (pref === "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
|
332 | return val;
|
333 | if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input)))
|
334 | return val;
|
335 | if (pref !== "string" && isCallable(fn = input.toString) && !isObject(val = call(fn, input)))
|
336 | return val;
|
337 | throw TypeError2("Can't convert object to primitive value");
|
338 | };
|
339 | }
|
340 | });
|
341 |
|
342 |
|
343 | var require_is_pure = __commonJS({
|
344 | "node_modules/core-js/internals/is-pure.js"(exports2, module2) {
|
345 | module2.exports = false;
|
346 | }
|
347 | });
|
348 |
|
349 |
|
350 | var require_set_global = __commonJS({
|
351 | "node_modules/core-js/internals/set-global.js"(exports2, module2) {
|
352 | var global2 = require_global();
|
353 | var defineProperty = Object.defineProperty;
|
354 | module2.exports = function(key, value) {
|
355 | try {
|
356 | defineProperty(global2, key, { value, configurable: true, writable: true });
|
357 | } catch (error) {
|
358 | global2[key] = value;
|
359 | }
|
360 | return value;
|
361 | };
|
362 | }
|
363 | });
|
364 |
|
365 |
|
366 | var require_shared_store = __commonJS({
|
367 | "node_modules/core-js/internals/shared-store.js"(exports2, module2) {
|
368 | var global2 = require_global();
|
369 | var setGlobal = require_set_global();
|
370 | var SHARED = "__core-js_shared__";
|
371 | var store = global2[SHARED] || setGlobal(SHARED, {});
|
372 | module2.exports = store;
|
373 | }
|
374 | });
|
375 |
|
376 |
|
377 | var require_shared = __commonJS({
|
378 | "node_modules/core-js/internals/shared.js"(exports2, module2) {
|
379 | var IS_PURE = require_is_pure();
|
380 | var store = require_shared_store();
|
381 | (module2.exports = function(key, value) {
|
382 | return store[key] || (store[key] = value !== void 0 ? value : {});
|
383 | })("versions", []).push({
|
384 | version: "3.22.2",
|
385 | mode: IS_PURE ? "pure" : "global",
|
386 | copyright: "\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",
|
387 | license: "https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE",
|
388 | source: "https://github.com/zloirock/core-js"
|
389 | });
|
390 | }
|
391 | });
|
392 |
|
393 |
|
394 | var require_to_object = __commonJS({
|
395 | "node_modules/core-js/internals/to-object.js"(exports2, module2) {
|
396 | var global2 = require_global();
|
397 | var requireObjectCoercible = require_require_object_coercible();
|
398 | var Object2 = global2.Object;
|
399 | module2.exports = function(argument) {
|
400 | return Object2(requireObjectCoercible(argument));
|
401 | };
|
402 | }
|
403 | });
|
404 |
|
405 |
|
406 | var require_has_own_property = __commonJS({
|
407 | "node_modules/core-js/internals/has-own-property.js"(exports2, module2) {
|
408 | var uncurryThis = require_function_uncurry_this();
|
409 | var toObject = require_to_object();
|
410 | var hasOwnProperty = uncurryThis({}.hasOwnProperty);
|
411 | module2.exports = Object.hasOwn || function hasOwn(it, key) {
|
412 | return hasOwnProperty(toObject(it), key);
|
413 | };
|
414 | }
|
415 | });
|
416 |
|
417 |
|
418 | var require_uid = __commonJS({
|
419 | "node_modules/core-js/internals/uid.js"(exports2, module2) {
|
420 | var uncurryThis = require_function_uncurry_this();
|
421 | var id = 0;
|
422 | var postfix = Math.random();
|
423 | var toString = uncurryThis(1 .toString);
|
424 | module2.exports = function(key) {
|
425 | return "Symbol(" + (key === void 0 ? "" : key) + ")_" + toString(++id + postfix, 36);
|
426 | };
|
427 | }
|
428 | });
|
429 |
|
430 |
|
431 | var require_well_known_symbol = __commonJS({
|
432 | "node_modules/core-js/internals/well-known-symbol.js"(exports2, module2) {
|
433 | var global2 = require_global();
|
434 | var shared = require_shared();
|
435 | var hasOwn = require_has_own_property();
|
436 | var uid = require_uid();
|
437 | var NATIVE_SYMBOL = require_native_symbol();
|
438 | var USE_SYMBOL_AS_UID = require_use_symbol_as_uid();
|
439 | var WellKnownSymbolsStore = shared("wks");
|
440 | var Symbol2 = global2.Symbol;
|
441 | var symbolFor = Symbol2 && Symbol2["for"];
|
442 | var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol2 : Symbol2 && Symbol2.withoutSetter || uid;
|
443 | module2.exports = function(name) {
|
444 | if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == "string")) {
|
445 | var description = "Symbol." + name;
|
446 | if (NATIVE_SYMBOL && hasOwn(Symbol2, name)) {
|
447 | WellKnownSymbolsStore[name] = Symbol2[name];
|
448 | } else if (USE_SYMBOL_AS_UID && symbolFor) {
|
449 | WellKnownSymbolsStore[name] = symbolFor(description);
|
450 | } else {
|
451 | WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
|
452 | }
|
453 | }
|
454 | return WellKnownSymbolsStore[name];
|
455 | };
|
456 | }
|
457 | });
|
458 |
|
459 |
|
460 | var require_to_primitive = __commonJS({
|
461 | "node_modules/core-js/internals/to-primitive.js"(exports2, module2) {
|
462 | var global2 = require_global();
|
463 | var call = require_function_call();
|
464 | var isObject = require_is_object();
|
465 | var isSymbol = require_is_symbol();
|
466 | var getMethod = require_get_method();
|
467 | var ordinaryToPrimitive = require_ordinary_to_primitive();
|
468 | var wellKnownSymbol = require_well_known_symbol();
|
469 | var TypeError2 = global2.TypeError;
|
470 | var TO_PRIMITIVE = wellKnownSymbol("toPrimitive");
|
471 | module2.exports = function(input, pref) {
|
472 | if (!isObject(input) || isSymbol(input))
|
473 | return input;
|
474 | var exoticToPrim = getMethod(input, TO_PRIMITIVE);
|
475 | var result;
|
476 | if (exoticToPrim) {
|
477 | if (pref === void 0)
|
478 | pref = "default";
|
479 | result = call(exoticToPrim, input, pref);
|
480 | if (!isObject(result) || isSymbol(result))
|
481 | return result;
|
482 | throw TypeError2("Can't convert object to primitive value");
|
483 | }
|
484 | if (pref === void 0)
|
485 | pref = "number";
|
486 | return ordinaryToPrimitive(input, pref);
|
487 | };
|
488 | }
|
489 | });
|
490 |
|
491 |
|
492 | var require_to_property_key = __commonJS({
|
493 | "node_modules/core-js/internals/to-property-key.js"(exports2, module2) {
|
494 | var toPrimitive = require_to_primitive();
|
495 | var isSymbol = require_is_symbol();
|
496 | module2.exports = function(argument) {
|
497 | var key = toPrimitive(argument, "string");
|
498 | return isSymbol(key) ? key : key + "";
|
499 | };
|
500 | }
|
501 | });
|
502 |
|
503 |
|
504 | var require_document_create_element = __commonJS({
|
505 | "node_modules/core-js/internals/document-create-element.js"(exports2, module2) {
|
506 | var global2 = require_global();
|
507 | var isObject = require_is_object();
|
508 | var document = global2.document;
|
509 | var EXISTS = isObject(document) && isObject(document.createElement);
|
510 | module2.exports = function(it) {
|
511 | return EXISTS ? document.createElement(it) : {};
|
512 | };
|
513 | }
|
514 | });
|
515 |
|
516 |
|
517 | var require_ie8_dom_define = __commonJS({
|
518 | "node_modules/core-js/internals/ie8-dom-define.js"(exports2, module2) {
|
519 | var DESCRIPTORS = require_descriptors();
|
520 | var fails = require_fails();
|
521 | var createElement = require_document_create_element();
|
522 | module2.exports = !DESCRIPTORS && !fails(function() {
|
523 | return Object.defineProperty(createElement("div"), "a", {
|
524 | get: function() {
|
525 | return 7;
|
526 | }
|
527 | }).a != 7;
|
528 | });
|
529 | }
|
530 | });
|
531 |
|
532 |
|
533 | var require_object_get_own_property_descriptor = __commonJS({
|
534 | "node_modules/core-js/internals/object-get-own-property-descriptor.js"(exports2) {
|
535 | var DESCRIPTORS = require_descriptors();
|
536 | var call = require_function_call();
|
537 | var propertyIsEnumerableModule = require_object_property_is_enumerable();
|
538 | var createPropertyDescriptor = require_create_property_descriptor();
|
539 | var toIndexedObject = require_to_indexed_object();
|
540 | var toPropertyKey = require_to_property_key();
|
541 | var hasOwn = require_has_own_property();
|
542 | var IE8_DOM_DEFINE = require_ie8_dom_define();
|
543 | var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
544 | exports2.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
|
545 | O = toIndexedObject(O);
|
546 | P = toPropertyKey(P);
|
547 | if (IE8_DOM_DEFINE)
|
548 | try {
|
549 | return $getOwnPropertyDescriptor(O, P);
|
550 | } catch (error) {
|
551 | }
|
552 | if (hasOwn(O, P))
|
553 | return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
554 | };
|
555 | }
|
556 | });
|
557 |
|
558 |
|
559 | var require_v8_prototype_define_bug = __commonJS({
|
560 | "node_modules/core-js/internals/v8-prototype-define-bug.js"(exports2, module2) {
|
561 | var DESCRIPTORS = require_descriptors();
|
562 | var fails = require_fails();
|
563 | module2.exports = DESCRIPTORS && fails(function() {
|
564 | return Object.defineProperty(function() {
|
565 | }, "prototype", {
|
566 | value: 42,
|
567 | writable: false
|
568 | }).prototype != 42;
|
569 | });
|
570 | }
|
571 | });
|
572 |
|
573 |
|
574 | var require_an_object = __commonJS({
|
575 | "node_modules/core-js/internals/an-object.js"(exports2, module2) {
|
576 | var global2 = require_global();
|
577 | var isObject = require_is_object();
|
578 | var String2 = global2.String;
|
579 | var TypeError2 = global2.TypeError;
|
580 | module2.exports = function(argument) {
|
581 | if (isObject(argument))
|
582 | return argument;
|
583 | throw TypeError2(String2(argument) + " is not an object");
|
584 | };
|
585 | }
|
586 | });
|
587 |
|
588 |
|
589 | var require_object_define_property = __commonJS({
|
590 | "node_modules/core-js/internals/object-define-property.js"(exports2) {
|
591 | var global2 = require_global();
|
592 | var DESCRIPTORS = require_descriptors();
|
593 | var IE8_DOM_DEFINE = require_ie8_dom_define();
|
594 | var V8_PROTOTYPE_DEFINE_BUG = require_v8_prototype_define_bug();
|
595 | var anObject = require_an_object();
|
596 | var toPropertyKey = require_to_property_key();
|
597 | var TypeError2 = global2.TypeError;
|
598 | var $defineProperty = Object.defineProperty;
|
599 | var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
600 | var ENUMERABLE = "enumerable";
|
601 | var CONFIGURABLE = "configurable";
|
602 | var WRITABLE = "writable";
|
603 | exports2.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
604 | anObject(O);
|
605 | P = toPropertyKey(P);
|
606 | anObject(Attributes);
|
607 | if (typeof O === "function" && P === "prototype" && "value" in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
608 | var current = $getOwnPropertyDescriptor(O, P);
|
609 | if (current && current[WRITABLE]) {
|
610 | O[P] = Attributes.value;
|
611 | Attributes = {
|
612 | configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],
|
613 | enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
|
614 | writable: false
|
615 | };
|
616 | }
|
617 | }
|
618 | return $defineProperty(O, P, Attributes);
|
619 | } : $defineProperty : function defineProperty(O, P, Attributes) {
|
620 | anObject(O);
|
621 | P = toPropertyKey(P);
|
622 | anObject(Attributes);
|
623 | if (IE8_DOM_DEFINE)
|
624 | try {
|
625 | return $defineProperty(O, P, Attributes);
|
626 | } catch (error) {
|
627 | }
|
628 | if ("get" in Attributes || "set" in Attributes)
|
629 | throw TypeError2("Accessors not supported");
|
630 | if ("value" in Attributes)
|
631 | O[P] = Attributes.value;
|
632 | return O;
|
633 | };
|
634 | }
|
635 | });
|
636 |
|
637 |
|
638 | var require_create_non_enumerable_property = __commonJS({
|
639 | "node_modules/core-js/internals/create-non-enumerable-property.js"(exports2, module2) {
|
640 | var DESCRIPTORS = require_descriptors();
|
641 | var definePropertyModule = require_object_define_property();
|
642 | var createPropertyDescriptor = require_create_property_descriptor();
|
643 | module2.exports = DESCRIPTORS ? function(object, key, value) {
|
644 | return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
645 | } : function(object, key, value) {
|
646 | object[key] = value;
|
647 | return object;
|
648 | };
|
649 | }
|
650 | });
|
651 |
|
652 |
|
653 | var require_inspect_source = __commonJS({
|
654 | "node_modules/core-js/internals/inspect-source.js"(exports2, module2) {
|
655 | var uncurryThis = require_function_uncurry_this();
|
656 | var isCallable = require_is_callable();
|
657 | var store = require_shared_store();
|
658 | var functionToString = uncurryThis(Function.toString);
|
659 | if (!isCallable(store.inspectSource)) {
|
660 | store.inspectSource = function(it) {
|
661 | return functionToString(it);
|
662 | };
|
663 | }
|
664 | module2.exports = store.inspectSource;
|
665 | }
|
666 | });
|
667 |
|
668 |
|
669 | var require_native_weak_map = __commonJS({
|
670 | "node_modules/core-js/internals/native-weak-map.js"(exports2, module2) {
|
671 | var global2 = require_global();
|
672 | var isCallable = require_is_callable();
|
673 | var inspectSource = require_inspect_source();
|
674 | var WeakMap2 = global2.WeakMap;
|
675 | module2.exports = isCallable(WeakMap2) && /native code/.test(inspectSource(WeakMap2));
|
676 | }
|
677 | });
|
678 |
|
679 |
|
680 | var require_shared_key = __commonJS({
|
681 | "node_modules/core-js/internals/shared-key.js"(exports2, module2) {
|
682 | var shared = require_shared();
|
683 | var uid = require_uid();
|
684 | var keys = shared("keys");
|
685 | module2.exports = function(key) {
|
686 | return keys[key] || (keys[key] = uid(key));
|
687 | };
|
688 | }
|
689 | });
|
690 |
|
691 |
|
692 | var require_hidden_keys = __commonJS({
|
693 | "node_modules/core-js/internals/hidden-keys.js"(exports2, module2) {
|
694 | module2.exports = {};
|
695 | }
|
696 | });
|
697 |
|
698 |
|
699 | var require_internal_state = __commonJS({
|
700 | "node_modules/core-js/internals/internal-state.js"(exports2, module2) {
|
701 | var NATIVE_WEAK_MAP = require_native_weak_map();
|
702 | var global2 = require_global();
|
703 | var uncurryThis = require_function_uncurry_this();
|
704 | var isObject = require_is_object();
|
705 | var createNonEnumerableProperty = require_create_non_enumerable_property();
|
706 | var hasOwn = require_has_own_property();
|
707 | var shared = require_shared_store();
|
708 | var sharedKey = require_shared_key();
|
709 | var hiddenKeys = require_hidden_keys();
|
710 | var OBJECT_ALREADY_INITIALIZED = "Object already initialized";
|
711 | var TypeError2 = global2.TypeError;
|
712 | var WeakMap2 = global2.WeakMap;
|
713 | var set;
|
714 | var get;
|
715 | var has;
|
716 | var enforce = function(it) {
|
717 | return has(it) ? get(it) : set(it, {});
|
718 | };
|
719 | var getterFor = function(TYPE) {
|
720 | return function(it) {
|
721 | var state;
|
722 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
723 | throw TypeError2("Incompatible receiver, " + TYPE + " required");
|
724 | }
|
725 | return state;
|
726 | };
|
727 | };
|
728 | if (NATIVE_WEAK_MAP || shared.state) {
|
729 | store = shared.state || (shared.state = new WeakMap2());
|
730 | wmget = uncurryThis(store.get);
|
731 | wmhas = uncurryThis(store.has);
|
732 | wmset = uncurryThis(store.set);
|
733 | set = function(it, metadata) {
|
734 | if (wmhas(store, it))
|
735 | throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
|
736 | metadata.facade = it;
|
737 | wmset(store, it, metadata);
|
738 | return metadata;
|
739 | };
|
740 | get = function(it) {
|
741 | return wmget(store, it) || {};
|
742 | };
|
743 | has = function(it) {
|
744 | return wmhas(store, it);
|
745 | };
|
746 | } else {
|
747 | STATE = sharedKey("state");
|
748 | hiddenKeys[STATE] = true;
|
749 | set = function(it, metadata) {
|
750 | if (hasOwn(it, STATE))
|
751 | throw new TypeError2(OBJECT_ALREADY_INITIALIZED);
|
752 | metadata.facade = it;
|
753 | createNonEnumerableProperty(it, STATE, metadata);
|
754 | return metadata;
|
755 | };
|
756 | get = function(it) {
|
757 | return hasOwn(it, STATE) ? it[STATE] : {};
|
758 | };
|
759 | has = function(it) {
|
760 | return hasOwn(it, STATE);
|
761 | };
|
762 | }
|
763 | var store;
|
764 | var wmget;
|
765 | var wmhas;
|
766 | var wmset;
|
767 | var STATE;
|
768 | module2.exports = {
|
769 | set,
|
770 | get,
|
771 | has,
|
772 | enforce,
|
773 | getterFor
|
774 | };
|
775 | }
|
776 | });
|
777 |
|
778 | // node_modules/core-js/internals/function-name.js
|
779 | var require_function_name = __commonJS({
|
780 | "node_modules/core-js/internals/function-name.js"(exports2, module2) {
|
781 | var DESCRIPTORS = require_descriptors();
|
782 | var hasOwn = require_has_own_property();
|
783 | var FunctionPrototype = Function.prototype;
|
784 | var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
785 | var EXISTS = hasOwn(FunctionPrototype, "name");
|
786 | var PROPER = EXISTS && function something() {
|
787 | }.name === "something";
|
788 | var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, "name").configurable);
|
789 | module2.exports = {
|
790 | EXISTS,
|
791 | PROPER,
|
792 | CONFIGURABLE
|
793 | };
|
794 | }
|
795 | });
|
796 |
|
797 |
|
798 | var require_redefine = __commonJS({
|
799 | "node_modules/core-js/internals/redefine.js"(exports2, module2) {
|
800 | var global2 = require_global();
|
801 | var isCallable = require_is_callable();
|
802 | var hasOwn = require_has_own_property();
|
803 | var createNonEnumerableProperty = require_create_non_enumerable_property();
|
804 | var setGlobal = require_set_global();
|
805 | var inspectSource = require_inspect_source();
|
806 | var InternalStateModule = require_internal_state();
|
807 | var CONFIGURABLE_FUNCTION_NAME = require_function_name().CONFIGURABLE;
|
808 | var getInternalState = InternalStateModule.get;
|
809 | var enforceInternalState = InternalStateModule.enforce;
|
810 | var TEMPLATE = String(String).split("String");
|
811 | (module2.exports = function(O, key, value, options) {
|
812 | var unsafe = options ? !!options.unsafe : false;
|
813 | var simple = options ? !!options.enumerable : false;
|
814 | var noTargetGet = options ? !!options.noTargetGet : false;
|
815 | var name = options && options.name !== void 0 ? options.name : key;
|
816 | var state;
|
817 | if (isCallable(value)) {
|
818 | if (String(name).slice(0, 7) === "Symbol(") {
|
819 | name = "[" + String(name).replace(/^Symbol\(([^)]*)\)/, "$1") + "]";
|
820 | }
|
821 | if (!hasOwn(value, "name") || CONFIGURABLE_FUNCTION_NAME && value.name !== name) {
|
822 | createNonEnumerableProperty(value, "name", name);
|
823 | }
|
824 | state = enforceInternalState(value);
|
825 | if (!state.source) {
|
826 | state.source = TEMPLATE.join(typeof name == "string" ? name : "");
|
827 | }
|
828 | }
|
829 | if (O === global2) {
|
830 | if (simple)
|
831 | O[key] = value;
|
832 | else
|
833 | setGlobal(key, value);
|
834 | return;
|
835 | } else if (!unsafe) {
|
836 | delete O[key];
|
837 | } else if (!noTargetGet && O[key]) {
|
838 | simple = true;
|
839 | }
|
840 | if (simple)
|
841 | O[key] = value;
|
842 | else
|
843 | createNonEnumerableProperty(O, key, value);
|
844 | })(Function.prototype, "toString", function toString() {
|
845 | return isCallable(this) && getInternalState(this).source || inspectSource(this);
|
846 | });
|
847 | }
|
848 | });
|
849 |
|
850 |
|
851 | var require_to_integer_or_infinity = __commonJS({
|
852 | "node_modules/core-js/internals/to-integer-or-infinity.js"(exports2, module2) {
|
853 | var ceil = Math.ceil;
|
854 | var floor = Math.floor;
|
855 | module2.exports = function(argument) {
|
856 | var number = +argument;
|
857 | return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number);
|
858 | };
|
859 | }
|
860 | });
|
861 |
|
862 |
|
863 | var require_to_absolute_index = __commonJS({
|
864 | "node_modules/core-js/internals/to-absolute-index.js"(exports2, module2) {
|
865 | var toIntegerOrInfinity = require_to_integer_or_infinity();
|
866 | var max = Math.max;
|
867 | var min = Math.min;
|
868 | module2.exports = function(index, length) {
|
869 | var integer = toIntegerOrInfinity(index);
|
870 | return integer < 0 ? max(integer + length, 0) : min(integer, length);
|
871 | };
|
872 | }
|
873 | });
|
874 |
|
875 |
|
876 | var require_to_length = __commonJS({
|
877 | "node_modules/core-js/internals/to-length.js"(exports2, module2) {
|
878 | var toIntegerOrInfinity = require_to_integer_or_infinity();
|
879 | var min = Math.min;
|
880 | module2.exports = function(argument) {
|
881 | return argument > 0 ? min(toIntegerOrInfinity(argument), 9007199254740991) : 0;
|
882 | };
|
883 | }
|
884 | });
|
885 |
|
886 |
|
887 | var require_length_of_array_like = __commonJS({
|
888 | "node_modules/core-js/internals/length-of-array-like.js"(exports2, module2) {
|
889 | var toLength = require_to_length();
|
890 | module2.exports = function(obj) {
|
891 | return toLength(obj.length);
|
892 | };
|
893 | }
|
894 | });
|
895 |
|
896 |
|
897 | var require_array_includes = __commonJS({
|
898 | "node_modules/core-js/internals/array-includes.js"(exports2, module2) {
|
899 | var toIndexedObject = require_to_indexed_object();
|
900 | var toAbsoluteIndex = require_to_absolute_index();
|
901 | var lengthOfArrayLike = require_length_of_array_like();
|
902 | var createMethod = function(IS_INCLUDES) {
|
903 | return function($this, el, fromIndex) {
|
904 | var O = toIndexedObject($this);
|
905 | var length = lengthOfArrayLike(O);
|
906 | var index = toAbsoluteIndex(fromIndex, length);
|
907 | var value;
|
908 | if (IS_INCLUDES && el != el)
|
909 | while (length > index) {
|
910 | value = O[index++];
|
911 | if (value != value)
|
912 | return true;
|
913 | }
|
914 | else
|
915 | for (; length > index; index++) {
|
916 | if ((IS_INCLUDES || index in O) && O[index] === el)
|
917 | return IS_INCLUDES || index || 0;
|
918 | }
|
919 | return !IS_INCLUDES && -1;
|
920 | };
|
921 | };
|
922 | module2.exports = {
|
923 | includes: createMethod(true),
|
924 | indexOf: createMethod(false)
|
925 | };
|
926 | }
|
927 | });
|
928 |
|
929 |
|
930 | var require_object_keys_internal = __commonJS({
|
931 | "node_modules/core-js/internals/object-keys-internal.js"(exports2, module2) {
|
932 | var uncurryThis = require_function_uncurry_this();
|
933 | var hasOwn = require_has_own_property();
|
934 | var toIndexedObject = require_to_indexed_object();
|
935 | var indexOf = require_array_includes().indexOf;
|
936 | var hiddenKeys = require_hidden_keys();
|
937 | var push = uncurryThis([].push);
|
938 | module2.exports = function(object, names) {
|
939 | var O = toIndexedObject(object);
|
940 | var i = 0;
|
941 | var result = [];
|
942 | var key;
|
943 | for (key in O)
|
944 | !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);
|
945 | while (names.length > i)
|
946 | if (hasOwn(O, key = names[i++])) {
|
947 | ~indexOf(result, key) || push(result, key);
|
948 | }
|
949 | return result;
|
950 | };
|
951 | }
|
952 | });
|
953 |
|
954 |
|
955 | var require_enum_bug_keys = __commonJS({
|
956 | "node_modules/core-js/internals/enum-bug-keys.js"(exports2, module2) {
|
957 | module2.exports = [
|
958 | "constructor",
|
959 | "hasOwnProperty",
|
960 | "isPrototypeOf",
|
961 | "propertyIsEnumerable",
|
962 | "toLocaleString",
|
963 | "toString",
|
964 | "valueOf"
|
965 | ];
|
966 | }
|
967 | });
|
968 |
|
969 |
|
970 | var require_object_get_own_property_names = __commonJS({
|
971 | "node_modules/core-js/internals/object-get-own-property-names.js"(exports2) {
|
972 | var internalObjectKeys = require_object_keys_internal();
|
973 | var enumBugKeys = require_enum_bug_keys();
|
974 | var hiddenKeys = enumBugKeys.concat("length", "prototype");
|
975 | exports2.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
976 | return internalObjectKeys(O, hiddenKeys);
|
977 | };
|
978 | }
|
979 | });
|
980 |
|
981 |
|
982 | var require_object_get_own_property_symbols = __commonJS({
|
983 | "node_modules/core-js/internals/object-get-own-property-symbols.js"(exports2) {
|
984 | exports2.f = Object.getOwnPropertySymbols;
|
985 | }
|
986 | });
|
987 |
|
988 |
|
989 | var require_own_keys = __commonJS({
|
990 | "node_modules/core-js/internals/own-keys.js"(exports2, module2) {
|
991 | var getBuiltIn = require_get_built_in();
|
992 | var uncurryThis = require_function_uncurry_this();
|
993 | var getOwnPropertyNamesModule = require_object_get_own_property_names();
|
994 | var getOwnPropertySymbolsModule = require_object_get_own_property_symbols();
|
995 | var anObject = require_an_object();
|
996 | var concat = uncurryThis([].concat);
|
997 | module2.exports = getBuiltIn("Reflect", "ownKeys") || function ownKeys(it) {
|
998 | var keys = getOwnPropertyNamesModule.f(anObject(it));
|
999 | var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
|
1000 | return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;
|
1001 | };
|
1002 | }
|
1003 | });
|
1004 |
|
1005 |
|
1006 | var require_copy_constructor_properties = __commonJS({
|
1007 | "node_modules/core-js/internals/copy-constructor-properties.js"(exports2, module2) {
|
1008 | var hasOwn = require_has_own_property();
|
1009 | var ownKeys = require_own_keys();
|
1010 | var getOwnPropertyDescriptorModule = require_object_get_own_property_descriptor();
|
1011 | var definePropertyModule = require_object_define_property();
|
1012 | module2.exports = function(target, source, exceptions) {
|
1013 | var keys = ownKeys(source);
|
1014 | var defineProperty = definePropertyModule.f;
|
1015 | var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
|
1016 | for (var i = 0; i < keys.length; i++) {
|
1017 | var key = keys[i];
|
1018 | if (!hasOwn(target, key) && !(exceptions && hasOwn(exceptions, key))) {
|
1019 | defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
1020 | }
|
1021 | }
|
1022 | };
|
1023 | }
|
1024 | });
|
1025 |
|
1026 |
|
1027 | var require_is_forced = __commonJS({
|
1028 | "node_modules/core-js/internals/is-forced.js"(exports2, module2) {
|
1029 | var fails = require_fails();
|
1030 | var isCallable = require_is_callable();
|
1031 | var replacement = /#|\.prototype\./;
|
1032 | var isForced = function(feature, detection) {
|
1033 | var value = data[normalize(feature)];
|
1034 | return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection;
|
1035 | };
|
1036 | var normalize = isForced.normalize = function(string) {
|
1037 | return String(string).replace(replacement, ".").toLowerCase();
|
1038 | };
|
1039 | var data = isForced.data = {};
|
1040 | var NATIVE = isForced.NATIVE = "N";
|
1041 | var POLYFILL = isForced.POLYFILL = "P";
|
1042 | module2.exports = isForced;
|
1043 | }
|
1044 | });
|
1045 |
|
1046 |
|
1047 | var require_export = __commonJS({
|
1048 | "node_modules/core-js/internals/export.js"(exports2, module2) {
|
1049 | var global2 = require_global();
|
1050 | var getOwnPropertyDescriptor = require_object_get_own_property_descriptor().f;
|
1051 | var createNonEnumerableProperty = require_create_non_enumerable_property();
|
1052 | var redefine = require_redefine();
|
1053 | var setGlobal = require_set_global();
|
1054 | var copyConstructorProperties = require_copy_constructor_properties();
|
1055 | var isForced = require_is_forced();
|
1056 | module2.exports = function(options, source) {
|
1057 | var TARGET = options.target;
|
1058 | var GLOBAL = options.global;
|
1059 | var STATIC = options.stat;
|
1060 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
1061 | if (GLOBAL) {
|
1062 | target = global2;
|
1063 | } else if (STATIC) {
|
1064 | target = global2[TARGET] || setGlobal(TARGET, {});
|
1065 | } else {
|
1066 | target = (global2[TARGET] || {}).prototype;
|
1067 | }
|
1068 | if (target)
|
1069 | for (key in source) {
|
1070 | sourceProperty = source[key];
|
1071 | if (options.noTargetGet) {
|
1072 | descriptor = getOwnPropertyDescriptor(target, key);
|
1073 | targetProperty = descriptor && descriptor.value;
|
1074 | } else
|
1075 | targetProperty = target[key];
|
1076 | FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced);
|
1077 | if (!FORCED && targetProperty !== void 0) {
|
1078 | if (typeof sourceProperty == typeof targetProperty)
|
1079 | continue;
|
1080 | copyConstructorProperties(sourceProperty, targetProperty);
|
1081 | }
|
1082 | if (options.sham || targetProperty && targetProperty.sham) {
|
1083 | createNonEnumerableProperty(sourceProperty, "sham", true);
|
1084 | }
|
1085 | redefine(target, key, sourceProperty, options);
|
1086 | }
|
1087 | };
|
1088 | }
|
1089 | });
|
1090 |
|
1091 |
|
1092 | var require_is_array = __commonJS({
|
1093 | "node_modules/core-js/internals/is-array.js"(exports2, module2) {
|
1094 | var classof = require_classof_raw();
|
1095 | module2.exports = Array.isArray || function isArray(argument) {
|
1096 | return classof(argument) == "Array";
|
1097 | };
|
1098 | }
|
1099 | });
|
1100 |
|
1101 |
|
1102 | var require_function_bind_context = __commonJS({
|
1103 | "node_modules/core-js/internals/function-bind-context.js"(exports2, module2) {
|
1104 | var uncurryThis = require_function_uncurry_this();
|
1105 | var aCallable = require_a_callable();
|
1106 | var NATIVE_BIND = require_function_bind_native();
|
1107 | var bind = uncurryThis(uncurryThis.bind);
|
1108 | module2.exports = function(fn, that) {
|
1109 | aCallable(fn);
|
1110 | return that === void 0 ? fn : NATIVE_BIND ? bind(fn, that) : function() {
|
1111 | return fn.apply(that, arguments);
|
1112 | };
|
1113 | };
|
1114 | }
|
1115 | });
|
1116 |
|
1117 |
|
1118 | var require_flatten_into_array = __commonJS({
|
1119 | "node_modules/core-js/internals/flatten-into-array.js"(exports2, module2) {
|
1120 | "use strict";
|
1121 | var global2 = require_global();
|
1122 | var isArray = require_is_array();
|
1123 | var lengthOfArrayLike = require_length_of_array_like();
|
1124 | var bind = require_function_bind_context();
|
1125 | var TypeError2 = global2.TypeError;
|
1126 | var flattenIntoArray = function(target, original, source, sourceLen, start, depth, mapper, thisArg) {
|
1127 | var targetIndex = start;
|
1128 | var sourceIndex = 0;
|
1129 | var mapFn = mapper ? bind(mapper, thisArg) : false;
|
1130 | var element, elementLen;
|
1131 | while (sourceIndex < sourceLen) {
|
1132 | if (sourceIndex in source) {
|
1133 | element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
|
1134 | if (depth > 0 && isArray(element)) {
|
1135 | elementLen = lengthOfArrayLike(element);
|
1136 | targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1;
|
1137 | } else {
|
1138 | if (targetIndex >= 9007199254740991)
|
1139 | throw TypeError2("Exceed the acceptable array length");
|
1140 | target[targetIndex] = element;
|
1141 | }
|
1142 | targetIndex++;
|
1143 | }
|
1144 | sourceIndex++;
|
1145 | }
|
1146 | return targetIndex;
|
1147 | };
|
1148 | module2.exports = flattenIntoArray;
|
1149 | }
|
1150 | });
|
1151 |
|
1152 |
|
1153 | var require_to_string_tag_support = __commonJS({
|
1154 | "node_modules/core-js/internals/to-string-tag-support.js"(exports2, module2) {
|
1155 | var wellKnownSymbol = require_well_known_symbol();
|
1156 | var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
1157 | var test = {};
|
1158 | test[TO_STRING_TAG] = "z";
|
1159 | module2.exports = String(test) === "[object z]";
|
1160 | }
|
1161 | });
|
1162 |
|
1163 |
|
1164 | var require_classof = __commonJS({
|
1165 | "node_modules/core-js/internals/classof.js"(exports2, module2) {
|
1166 | var global2 = require_global();
|
1167 | var TO_STRING_TAG_SUPPORT = require_to_string_tag_support();
|
1168 | var isCallable = require_is_callable();
|
1169 | var classofRaw = require_classof_raw();
|
1170 | var wellKnownSymbol = require_well_known_symbol();
|
1171 | var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
1172 | var Object2 = global2.Object;
|
1173 | var CORRECT_ARGUMENTS = classofRaw(function() {
|
1174 | return arguments;
|
1175 | }()) == "Arguments";
|
1176 | var tryGet = function(it, key) {
|
1177 | try {
|
1178 | return it[key];
|
1179 | } catch (error) {
|
1180 | }
|
1181 | };
|
1182 | module2.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
1183 | var O, tag, result;
|
1184 | return it === void 0 ? "Undefined" : it === null ? "Null" : typeof (tag = tryGet(O = Object2(it), TO_STRING_TAG)) == "string" ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : (result = classofRaw(O)) == "Object" && isCallable(O.callee) ? "Arguments" : result;
|
1185 | };
|
1186 | }
|
1187 | });
|
1188 |
|
1189 |
|
1190 | var require_is_constructor = __commonJS({
|
1191 | "node_modules/core-js/internals/is-constructor.js"(exports2, module2) {
|
1192 | var uncurryThis = require_function_uncurry_this();
|
1193 | var fails = require_fails();
|
1194 | var isCallable = require_is_callable();
|
1195 | var classof = require_classof();
|
1196 | var getBuiltIn = require_get_built_in();
|
1197 | var inspectSource = require_inspect_source();
|
1198 | var noop = function() {
|
1199 | };
|
1200 | var empty = [];
|
1201 | var construct = getBuiltIn("Reflect", "construct");
|
1202 | var constructorRegExp = /^\s*(?:class|function)\b/;
|
1203 | var exec = uncurryThis(constructorRegExp.exec);
|
1204 | var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
|
1205 | var isConstructorModern = function isConstructor(argument) {
|
1206 | if (!isCallable(argument))
|
1207 | return false;
|
1208 | try {
|
1209 | construct(noop, empty, argument);
|
1210 | return true;
|
1211 | } catch (error) {
|
1212 | return false;
|
1213 | }
|
1214 | };
|
1215 | var isConstructorLegacy = function isConstructor(argument) {
|
1216 | if (!isCallable(argument))
|
1217 | return false;
|
1218 | switch (classof(argument)) {
|
1219 | case "AsyncFunction":
|
1220 | case "GeneratorFunction":
|
1221 | case "AsyncGeneratorFunction":
|
1222 | return false;
|
1223 | }
|
1224 | try {
|
1225 | return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));
|
1226 | } catch (error) {
|
1227 | return true;
|
1228 | }
|
1229 | };
|
1230 | isConstructorLegacy.sham = true;
|
1231 | module2.exports = !construct || fails(function() {
|
1232 | var called;
|
1233 | return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function() {
|
1234 | called = true;
|
1235 | }) || called;
|
1236 | }) ? isConstructorLegacy : isConstructorModern;
|
1237 | }
|
1238 | });
|
1239 |
|
1240 |
|
1241 | var require_array_species_constructor = __commonJS({
|
1242 | "node_modules/core-js/internals/array-species-constructor.js"(exports2, module2) {
|
1243 | var global2 = require_global();
|
1244 | var isArray = require_is_array();
|
1245 | var isConstructor = require_is_constructor();
|
1246 | var isObject = require_is_object();
|
1247 | var wellKnownSymbol = require_well_known_symbol();
|
1248 | var SPECIES = wellKnownSymbol("species");
|
1249 | var Array2 = global2.Array;
|
1250 | module2.exports = function(originalArray) {
|
1251 | var C;
|
1252 | if (isArray(originalArray)) {
|
1253 | C = originalArray.constructor;
|
1254 | if (isConstructor(C) && (C === Array2 || isArray(C.prototype)))
|
1255 | C = void 0;
|
1256 | else if (isObject(C)) {
|
1257 | C = C[SPECIES];
|
1258 | if (C === null)
|
1259 | C = void 0;
|
1260 | }
|
1261 | }
|
1262 | return C === void 0 ? Array2 : C;
|
1263 | };
|
1264 | }
|
1265 | });
|
1266 |
|
1267 |
|
1268 | var require_array_species_create = __commonJS({
|
1269 | "node_modules/core-js/internals/array-species-create.js"(exports2, module2) {
|
1270 | var arraySpeciesConstructor = require_array_species_constructor();
|
1271 | module2.exports = function(originalArray, length) {
|
1272 | return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
|
1273 | };
|
1274 | }
|
1275 | });
|
1276 |
|
1277 |
|
1278 | var require_es_array_flat_map = __commonJS({
|
1279 | "node_modules/core-js/modules/es.array.flat-map.js"() {
|
1280 | "use strict";
|
1281 | var $ = require_export();
|
1282 | var flattenIntoArray = require_flatten_into_array();
|
1283 | var aCallable = require_a_callable();
|
1284 | var toObject = require_to_object();
|
1285 | var lengthOfArrayLike = require_length_of_array_like();
|
1286 | var arraySpeciesCreate = require_array_species_create();
|
1287 | $({ target: "Array", proto: true }, {
|
1288 | flatMap: function flatMap(callbackfn) {
|
1289 | var O = toObject(this);
|
1290 | var sourceLen = lengthOfArrayLike(O);
|
1291 | var A;
|
1292 | aCallable(callbackfn);
|
1293 | A = arraySpeciesCreate(O, 0);
|
1294 | A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : void 0);
|
1295 | return A;
|
1296 | }
|
1297 | });
|
1298 | }
|
1299 | });
|
1300 |
|
1301 |
|
1302 | var require_iterators = __commonJS({
|
1303 | "node_modules/core-js/internals/iterators.js"(exports2, module2) {
|
1304 | module2.exports = {};
|
1305 | }
|
1306 | });
|
1307 |
|
1308 |
|
1309 | var require_is_array_iterator_method = __commonJS({
|
1310 | "node_modules/core-js/internals/is-array-iterator-method.js"(exports2, module2) {
|
1311 | var wellKnownSymbol = require_well_known_symbol();
|
1312 | var Iterators = require_iterators();
|
1313 | var ITERATOR = wellKnownSymbol("iterator");
|
1314 | var ArrayPrototype = Array.prototype;
|
1315 | module2.exports = function(it) {
|
1316 | return it !== void 0 && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
|
1317 | };
|
1318 | }
|
1319 | });
|
1320 |
|
1321 |
|
1322 | var require_get_iterator_method = __commonJS({
|
1323 | "node_modules/core-js/internals/get-iterator-method.js"(exports2, module2) {
|
1324 | var classof = require_classof();
|
1325 | var getMethod = require_get_method();
|
1326 | var Iterators = require_iterators();
|
1327 | var wellKnownSymbol = require_well_known_symbol();
|
1328 | var ITERATOR = wellKnownSymbol("iterator");
|
1329 | module2.exports = function(it) {
|
1330 | if (it != void 0)
|
1331 | return getMethod(it, ITERATOR) || getMethod(it, "@@iterator") || Iterators[classof(it)];
|
1332 | };
|
1333 | }
|
1334 | });
|
1335 |
|
1336 |
|
1337 | var require_get_iterator = __commonJS({
|
1338 | "node_modules/core-js/internals/get-iterator.js"(exports2, module2) {
|
1339 | var global2 = require_global();
|
1340 | var call = require_function_call();
|
1341 | var aCallable = require_a_callable();
|
1342 | var anObject = require_an_object();
|
1343 | var tryToString = require_try_to_string();
|
1344 | var getIteratorMethod = require_get_iterator_method();
|
1345 | var TypeError2 = global2.TypeError;
|
1346 | module2.exports = function(argument, usingIterator) {
|
1347 | var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;
|
1348 | if (aCallable(iteratorMethod))
|
1349 | return anObject(call(iteratorMethod, argument));
|
1350 | throw TypeError2(tryToString(argument) + " is not iterable");
|
1351 | };
|
1352 | }
|
1353 | });
|
1354 |
|
1355 |
|
1356 | var require_iterator_close = __commonJS({
|
1357 | "node_modules/core-js/internals/iterator-close.js"(exports2, module2) {
|
1358 | var call = require_function_call();
|
1359 | var anObject = require_an_object();
|
1360 | var getMethod = require_get_method();
|
1361 | module2.exports = function(iterator, kind, value) {
|
1362 | var innerResult, innerError;
|
1363 | anObject(iterator);
|
1364 | try {
|
1365 | innerResult = getMethod(iterator, "return");
|
1366 | if (!innerResult) {
|
1367 | if (kind === "throw")
|
1368 | throw value;
|
1369 | return value;
|
1370 | }
|
1371 | innerResult = call(innerResult, iterator);
|
1372 | } catch (error) {
|
1373 | innerError = true;
|
1374 | innerResult = error;
|
1375 | }
|
1376 | if (kind === "throw")
|
1377 | throw value;
|
1378 | if (innerError)
|
1379 | throw innerResult;
|
1380 | anObject(innerResult);
|
1381 | return value;
|
1382 | };
|
1383 | }
|
1384 | });
|
1385 |
|
1386 |
|
1387 | var require_iterate = __commonJS({
|
1388 | "node_modules/core-js/internals/iterate.js"(exports2, module2) {
|
1389 | var global2 = require_global();
|
1390 | var bind = require_function_bind_context();
|
1391 | var call = require_function_call();
|
1392 | var anObject = require_an_object();
|
1393 | var tryToString = require_try_to_string();
|
1394 | var isArrayIteratorMethod = require_is_array_iterator_method();
|
1395 | var lengthOfArrayLike = require_length_of_array_like();
|
1396 | var isPrototypeOf = require_object_is_prototype_of();
|
1397 | var getIterator = require_get_iterator();
|
1398 | var getIteratorMethod = require_get_iterator_method();
|
1399 | var iteratorClose = require_iterator_close();
|
1400 | var TypeError2 = global2.TypeError;
|
1401 | var Result = function(stopped, result) {
|
1402 | this.stopped = stopped;
|
1403 | this.result = result;
|
1404 | };
|
1405 | var ResultPrototype = Result.prototype;
|
1406 | module2.exports = function(iterable, unboundFunction, options) {
|
1407 | var that = options && options.that;
|
1408 | var AS_ENTRIES = !!(options && options.AS_ENTRIES);
|
1409 | var IS_ITERATOR = !!(options && options.IS_ITERATOR);
|
1410 | var INTERRUPTED = !!(options && options.INTERRUPTED);
|
1411 | var fn = bind(unboundFunction, that);
|
1412 | var iterator, iterFn, index, length, result, next, step;
|
1413 | var stop = function(condition) {
|
1414 | if (iterator)
|
1415 | iteratorClose(iterator, "normal", condition);
|
1416 | return new Result(true, condition);
|
1417 | };
|
1418 | var callFn = function(value) {
|
1419 | if (AS_ENTRIES) {
|
1420 | anObject(value);
|
1421 | return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
|
1422 | }
|
1423 | return INTERRUPTED ? fn(value, stop) : fn(value);
|
1424 | };
|
1425 | if (IS_ITERATOR) {
|
1426 | iterator = iterable;
|
1427 | } else {
|
1428 | iterFn = getIteratorMethod(iterable);
|
1429 | if (!iterFn)
|
1430 | throw TypeError2(tryToString(iterable) + " is not iterable");
|
1431 | if (isArrayIteratorMethod(iterFn)) {
|
1432 | for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {
|
1433 | result = callFn(iterable[index]);
|
1434 | if (result && isPrototypeOf(ResultPrototype, result))
|
1435 | return result;
|
1436 | }
|
1437 | return new Result(false);
|
1438 | }
|
1439 | iterator = getIterator(iterable, iterFn);
|
1440 | }
|
1441 | next = iterator.next;
|
1442 | while (!(step = call(next, iterator)).done) {
|
1443 | try {
|
1444 | result = callFn(step.value);
|
1445 | } catch (error) {
|
1446 | iteratorClose(iterator, "throw", error);
|
1447 | }
|
1448 | if (typeof result == "object" && result && isPrototypeOf(ResultPrototype, result))
|
1449 | return result;
|
1450 | }
|
1451 | return new Result(false);
|
1452 | };
|
1453 | }
|
1454 | });
|
1455 |
|
1456 |
|
1457 | var require_create_property = __commonJS({
|
1458 | "node_modules/core-js/internals/create-property.js"(exports2, module2) {
|
1459 | "use strict";
|
1460 | var toPropertyKey = require_to_property_key();
|
1461 | var definePropertyModule = require_object_define_property();
|
1462 | var createPropertyDescriptor = require_create_property_descriptor();
|
1463 | module2.exports = function(object, key, value) {
|
1464 | var propertyKey = toPropertyKey(key);
|
1465 | if (propertyKey in object)
|
1466 | definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
|
1467 | else
|
1468 | object[propertyKey] = value;
|
1469 | };
|
1470 | }
|
1471 | });
|
1472 |
|
1473 |
|
1474 | var require_es_object_from_entries = __commonJS({
|
1475 | "node_modules/core-js/modules/es.object.from-entries.js"() {
|
1476 | var $ = require_export();
|
1477 | var iterate = require_iterate();
|
1478 | var createProperty = require_create_property();
|
1479 | $({ target: "Object", stat: true }, {
|
1480 | fromEntries: function fromEntries(iterable) {
|
1481 | var obj = {};
|
1482 | iterate(iterable, function(k, v) {
|
1483 | createProperty(obj, k, v);
|
1484 | }, { AS_ENTRIES: true });
|
1485 | return obj;
|
1486 | }
|
1487 | });
|
1488 | }
|
1489 | });
|
1490 |
|
1491 |
|
1492 | var require_es_array_flat = __commonJS({
|
1493 | "node_modules/core-js/modules/es.array.flat.js"() {
|
1494 | "use strict";
|
1495 | var $ = require_export();
|
1496 | var flattenIntoArray = require_flatten_into_array();
|
1497 | var toObject = require_to_object();
|
1498 | var lengthOfArrayLike = require_length_of_array_like();
|
1499 | var toIntegerOrInfinity = require_to_integer_or_infinity();
|
1500 | var arraySpeciesCreate = require_array_species_create();
|
1501 | $({ target: "Array", proto: true }, {
|
1502 | flat: function flat() {
|
1503 | var depthArg = arguments.length ? arguments[0] : void 0;
|
1504 | var O = toObject(this);
|
1505 | var sourceLen = lengthOfArrayLike(O);
|
1506 | var A = arraySpeciesCreate(O, 0);
|
1507 | A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === void 0 ? 1 : toIntegerOrInfinity(depthArg));
|
1508 | return A;
|
1509 | }
|
1510 | });
|
1511 | }
|
1512 | });
|
1513 |
|
1514 |
|
1515 | var _excluded = ["cliName", "cliCategory", "cliDescription"];
|
1516 | var _excluded2 = ["_"];
|
1517 | var _excluded3 = ["overrides"];
|
1518 | var _excluded4 = ["languageId"];
|
1519 | function _objectWithoutProperties(source, excluded) {
|
1520 | if (source == null)
|
1521 | return {};
|
1522 | var target = _objectWithoutPropertiesLoose(source, excluded);
|
1523 | var key, i;
|
1524 | if (Object.getOwnPropertySymbols) {
|
1525 | var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
1526 | for (i = 0; i < sourceSymbolKeys.length; i++) {
|
1527 | key = sourceSymbolKeys[i];
|
1528 | if (excluded.indexOf(key) >= 0)
|
1529 | continue;
|
1530 | if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
1531 | continue;
|
1532 | target[key] = source[key];
|
1533 | }
|
1534 | }
|
1535 | return target;
|
1536 | }
|
1537 | function _objectWithoutPropertiesLoose(source, excluded) {
|
1538 | if (source == null)
|
1539 | return {};
|
1540 | var target = {};
|
1541 | var sourceKeys = Object.keys(source);
|
1542 | var key, i;
|
1543 | for (i = 0; i < sourceKeys.length; i++) {
|
1544 | key = sourceKeys[i];
|
1545 | if (excluded.indexOf(key) >= 0)
|
1546 | continue;
|
1547 | target[key] = source[key];
|
1548 | }
|
1549 | return target;
|
1550 | }
|
1551 | require_es_array_flat_map();
|
1552 | require_es_object_from_entries();
|
1553 | require_es_array_flat();
|
1554 | var __create = Object.create;
|
1555 | var __defProp = Object.defineProperty;
|
1556 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
1557 | var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
1558 | var __getProtoOf = Object.getPrototypeOf;
|
1559 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
1560 | var __esm = (fn, res) => function __init() {
|
1561 | return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
1562 | };
|
1563 | var __commonJS2 = (cb, mod) => function __require() {
|
1564 | return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = {
|
1565 | exports: {}
|
1566 | }).exports, mod), mod.exports;
|
1567 | };
|
1568 | var __export = (target, all) => {
|
1569 | for (var name in all)
|
1570 | __defProp(target, name, {
|
1571 | get: all[name],
|
1572 | enumerable: true
|
1573 | });
|
1574 | };
|
1575 | var __copyProps = (to, from, except, desc) => {
|
1576 | if (from && typeof from === "object" || typeof from === "function") {
|
1577 | for (let key of __getOwnPropNames2(from))
|
1578 | if (!__hasOwnProp.call(to, key) && key !== except)
|
1579 | __defProp(to, key, {
|
1580 | get: () => from[key],
|
1581 | enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
1582 | });
|
1583 | }
|
1584 | return to;
|
1585 | };
|
1586 | var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
1587 | value: mod,
|
1588 | enumerable: true
|
1589 | }) : target, mod));
|
1590 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", {
|
1591 | value: true
|
1592 | }), mod);
|
1593 | var require_base = __commonJS2({
|
1594 | "node_modules/diff/lib/diff/base.js"(exports2) {
|
1595 | "use strict";
|
1596 | Object.defineProperty(exports2, "__esModule", {
|
1597 | value: true
|
1598 | });
|
1599 | exports2["default"] = Diff;
|
1600 | function Diff() {
|
1601 | }
|
1602 | Diff.prototype = {
|
1603 | diff: function diff(oldString, newString) {
|
1604 | var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
1605 | var callback = options.callback;
|
1606 | if (typeof options === "function") {
|
1607 | callback = options;
|
1608 | options = {};
|
1609 | }
|
1610 | this.options = options;
|
1611 | var self2 = this;
|
1612 | function done(value) {
|
1613 | if (callback) {
|
1614 | setTimeout(function() {
|
1615 | callback(void 0, value);
|
1616 | }, 0);
|
1617 | return true;
|
1618 | } else {
|
1619 | return value;
|
1620 | }
|
1621 | }
|
1622 | oldString = this.castInput(oldString);
|
1623 | newString = this.castInput(newString);
|
1624 | oldString = this.removeEmpty(this.tokenize(oldString));
|
1625 | newString = this.removeEmpty(this.tokenize(newString));
|
1626 | var newLen = newString.length, oldLen = oldString.length;
|
1627 | var editLength = 1;
|
1628 | var maxEditLength = newLen + oldLen;
|
1629 | var bestPath = [{
|
1630 | newPos: -1,
|
1631 | components: []
|
1632 | }];
|
1633 | var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
1634 | if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
1635 | return done([{
|
1636 | value: this.join(newString),
|
1637 | count: newString.length
|
1638 | }]);
|
1639 | }
|
1640 | function execEditLength() {
|
1641 | for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
1642 | var basePath = void 0;
|
1643 | var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
1644 | if (addPath) {
|
1645 | bestPath[diagonalPath - 1] = void 0;
|
1646 | }
|
1647 | var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
1648 | if (!canAdd && !canRemove) {
|
1649 | bestPath[diagonalPath] = void 0;
|
1650 | continue;
|
1651 | }
|
1652 | if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
1653 | basePath = clonePath(removePath);
|
1654 | self2.pushComponent(basePath.components, void 0, true);
|
1655 | } else {
|
1656 | basePath = addPath;
|
1657 | basePath.newPos++;
|
1658 | self2.pushComponent(basePath.components, true, void 0);
|
1659 | }
|
1660 | _oldPos = self2.extractCommon(basePath, newString, oldString, diagonalPath);
|
1661 | if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
1662 | return done(buildValues(self2, basePath.components, newString, oldString, self2.useLongestToken));
|
1663 | } else {
|
1664 | bestPath[diagonalPath] = basePath;
|
1665 | }
|
1666 | }
|
1667 | editLength++;
|
1668 | }
|
1669 | if (callback) {
|
1670 | (function exec() {
|
1671 | setTimeout(function() {
|
1672 | if (editLength > maxEditLength) {
|
1673 | return callback();
|
1674 | }
|
1675 | if (!execEditLength()) {
|
1676 | exec();
|
1677 | }
|
1678 | }, 0);
|
1679 | })();
|
1680 | } else {
|
1681 | while (editLength <= maxEditLength) {
|
1682 | var ret = execEditLength();
|
1683 | if (ret) {
|
1684 | return ret;
|
1685 | }
|
1686 | }
|
1687 | }
|
1688 | },
|
1689 | pushComponent: function pushComponent(components, added, removed) {
|
1690 | var last = components[components.length - 1];
|
1691 | if (last && last.added === added && last.removed === removed) {
|
1692 | components[components.length - 1] = {
|
1693 | count: last.count + 1,
|
1694 | added,
|
1695 | removed
|
1696 | };
|
1697 | } else {
|
1698 | components.push({
|
1699 | count: 1,
|
1700 | added,
|
1701 | removed
|
1702 | });
|
1703 | }
|
1704 | },
|
1705 | extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
1706 | var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
|
1707 | while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
1708 | newPos++;
|
1709 | oldPos++;
|
1710 | commonCount++;
|
1711 | }
|
1712 | if (commonCount) {
|
1713 | basePath.components.push({
|
1714 | count: commonCount
|
1715 | });
|
1716 | }
|
1717 | basePath.newPos = newPos;
|
1718 | return oldPos;
|
1719 | },
|
1720 | equals: function equals(left, right) {
|
1721 | if (this.options.comparator) {
|
1722 | return this.options.comparator(left, right);
|
1723 | } else {
|
1724 | return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
1725 | }
|
1726 | },
|
1727 | removeEmpty: function removeEmpty(array) {
|
1728 | var ret = [];
|
1729 | for (var i = 0; i < array.length; i++) {
|
1730 | if (array[i]) {
|
1731 | ret.push(array[i]);
|
1732 | }
|
1733 | }
|
1734 | return ret;
|
1735 | },
|
1736 | castInput: function castInput(value) {
|
1737 | return value;
|
1738 | },
|
1739 | tokenize: function tokenize(value) {
|
1740 | return value.split("");
|
1741 | },
|
1742 | join: function join(chars) {
|
1743 | return chars.join("");
|
1744 | }
|
1745 | };
|
1746 | function buildValues(diff, components, newString, oldString, useLongestToken) {
|
1747 | var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
1748 | for (; componentPos < componentLen; componentPos++) {
|
1749 | var component = components[componentPos];
|
1750 | if (!component.removed) {
|
1751 | if (!component.added && useLongestToken) {
|
1752 | var value = newString.slice(newPos, newPos + component.count);
|
1753 | value = value.map(function(value2, i) {
|
1754 | var oldValue = oldString[oldPos + i];
|
1755 | return oldValue.length > value2.length ? oldValue : value2;
|
1756 | });
|
1757 | component.value = diff.join(value);
|
1758 | } else {
|
1759 | component.value = diff.join(newString.slice(newPos, newPos + component.count));
|
1760 | }
|
1761 | newPos += component.count;
|
1762 | if (!component.added) {
|
1763 | oldPos += component.count;
|
1764 | }
|
1765 | } else {
|
1766 | component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
|
1767 | oldPos += component.count;
|
1768 | if (componentPos && components[componentPos - 1].added) {
|
1769 | var tmp = components[componentPos - 1];
|
1770 | components[componentPos - 1] = components[componentPos];
|
1771 | components[componentPos] = tmp;
|
1772 | }
|
1773 | }
|
1774 | }
|
1775 | var lastComponent = components[componentLen - 1];
|
1776 | if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff.equals("", lastComponent.value)) {
|
1777 | components[componentLen - 2].value += lastComponent.value;
|
1778 | components.pop();
|
1779 | }
|
1780 | return components;
|
1781 | }
|
1782 | function clonePath(path) {
|
1783 | return {
|
1784 | newPos: path.newPos,
|
1785 | components: path.components.slice(0)
|
1786 | };
|
1787 | }
|
1788 | }
|
1789 | });
|
1790 | var require_array = __commonJS2({
|
1791 | "node_modules/diff/lib/diff/array.js"(exports2) {
|
1792 | "use strict";
|
1793 | Object.defineProperty(exports2, "__esModule", {
|
1794 | value: true
|
1795 | });
|
1796 | exports2.diffArrays = diffArrays;
|
1797 | exports2.arrayDiff = void 0;
|
1798 | var _base = _interopRequireDefault(require_base());
|
1799 | function _interopRequireDefault(obj) {
|
1800 | return obj && obj.__esModule ? obj : {
|
1801 | "default": obj
|
1802 | };
|
1803 | }
|
1804 | var arrayDiff = new _base["default"]();
|
1805 | exports2.arrayDiff = arrayDiff;
|
1806 | arrayDiff.tokenize = function(value) {
|
1807 | return value.slice();
|
1808 | };
|
1809 | arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
1810 | return value;
|
1811 | };
|
1812 | function diffArrays(oldArr, newArr, callback) {
|
1813 | return arrayDiff.diff(oldArr, newArr, callback);
|
1814 | }
|
1815 | }
|
1816 | });
|
1817 | var escape_string_regexp_exports = {};
|
1818 | __export(escape_string_regexp_exports, {
|
1819 | default: () => escapeStringRegexp
|
1820 | });
|
1821 | function escapeStringRegexp(string) {
|
1822 | if (typeof string !== "string") {
|
1823 | throw new TypeError("Expected a string");
|
1824 | }
|
1825 | return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
1826 | }
|
1827 | var init_escape_string_regexp = __esm({
|
1828 | "node_modules/escape-string-regexp/index.js"() {
|
1829 | }
|
1830 | });
|
1831 | var require_get_last = __commonJS2({
|
1832 | "src/utils/get-last.js"(exports2, module2) {
|
1833 | "use strict";
|
1834 | var getLast = (arr) => arr[arr.length - 1];
|
1835 | module2.exports = getLast;
|
1836 | }
|
1837 | });
|
1838 | var require_debug = __commonJS2({
|
1839 | "node_modules/semver/internal/debug.js"(exports2, module2) {
|
1840 | var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
1841 | };
|
1842 | module2.exports = debug;
|
1843 | }
|
1844 | });
|
1845 | var require_constants = __commonJS2({
|
1846 | "node_modules/semver/internal/constants.js"(exports2, module2) {
|
1847 | var SEMVER_SPEC_VERSION = "2.0.0";
|
1848 | var MAX_LENGTH = 256;
|
1849 | var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
1850 | var MAX_SAFE_COMPONENT_LENGTH = 16;
|
1851 | module2.exports = {
|
1852 | SEMVER_SPEC_VERSION,
|
1853 | MAX_LENGTH,
|
1854 | MAX_SAFE_INTEGER,
|
1855 | MAX_SAFE_COMPONENT_LENGTH
|
1856 | };
|
1857 | }
|
1858 | });
|
1859 | var require_re = __commonJS2({
|
1860 | "node_modules/semver/internal/re.js"(exports2, module2) {
|
1861 | var {
|
1862 | MAX_SAFE_COMPONENT_LENGTH
|
1863 | } = require_constants();
|
1864 | var debug = require_debug();
|
1865 | exports2 = module2.exports = {};
|
1866 | var re = exports2.re = [];
|
1867 | var src = exports2.src = [];
|
1868 | var t = exports2.t = {};
|
1869 | var R = 0;
|
1870 | var createToken = (name, value, isGlobal) => {
|
1871 | const index = R++;
|
1872 | debug(name, index, value);
|
1873 | t[name] = index;
|
1874 | src[index] = value;
|
1875 | re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
1876 | };
|
1877 | createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
1878 | createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
|
1879 | createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
|
1880 | createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
1881 | createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
1882 | createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
1883 | createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
1884 | createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
1885 | createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
1886 | createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
|
1887 | createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
1888 | createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
1889 | createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
1890 | createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
1891 | createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
1892 | createToken("GTLT", "((?:<|>)?=?)");
|
1893 | createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
1894 | createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
1895 | createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
1896 | createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
1897 | createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
1898 | createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
1899 | createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
|
1900 | createToken("COERCERTL", src[t.COERCE], true);
|
1901 | createToken("LONETILDE", "(?:~>?)");
|
1902 | createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
1903 | exports2.tildeTrimReplace = "$1~";
|
1904 | createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
1905 | createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
1906 | createToken("LONECARET", "(?:\\^)");
|
1907 | createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
1908 | exports2.caretTrimReplace = "$1^";
|
1909 | createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
1910 | createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
1911 | createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
1912 | createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
1913 | createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
1914 | exports2.comparatorTrimReplace = "$1$2$3";
|
1915 | createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
1916 | createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
1917 | createToken("STAR", "(<|>)?=?\\s*\\*");
|
1918 | createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
1919 | createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
1920 | }
|
1921 | });
|
1922 | var require_parse_options = __commonJS2({
|
1923 | "node_modules/semver/internal/parse-options.js"(exports2, module2) {
|
1924 | var opts = ["includePrerelease", "loose", "rtl"];
|
1925 | var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {
|
1926 | loose: true
|
1927 | } : opts.filter((k) => options[k]).reduce((o, k) => {
|
1928 | o[k] = true;
|
1929 | return o;
|
1930 | }, {});
|
1931 | module2.exports = parseOptions;
|
1932 | }
|
1933 | });
|
1934 | var require_identifiers = __commonJS2({
|
1935 | "node_modules/semver/internal/identifiers.js"(exports2, module2) {
|
1936 | var numeric = /^[0-9]+$/;
|
1937 | var compareIdentifiers = (a, b) => {
|
1938 | const anum = numeric.test(a);
|
1939 | const bnum = numeric.test(b);
|
1940 | if (anum && bnum) {
|
1941 | a = +a;
|
1942 | b = +b;
|
1943 | }
|
1944 | return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
1945 | };
|
1946 | var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
1947 | module2.exports = {
|
1948 | compareIdentifiers,
|
1949 | rcompareIdentifiers
|
1950 | };
|
1951 | }
|
1952 | });
|
1953 | var require_semver = __commonJS2({
|
1954 | "node_modules/semver/classes/semver.js"(exports2, module2) {
|
1955 | var debug = require_debug();
|
1956 | var {
|
1957 | MAX_LENGTH,
|
1958 | MAX_SAFE_INTEGER
|
1959 | } = require_constants();
|
1960 | var {
|
1961 | re,
|
1962 | t
|
1963 | } = require_re();
|
1964 | var parseOptions = require_parse_options();
|
1965 | var {
|
1966 | compareIdentifiers
|
1967 | } = require_identifiers();
|
1968 | var SemVer = class {
|
1969 | constructor(version2, options) {
|
1970 | options = parseOptions(options);
|
1971 | if (version2 instanceof SemVer) {
|
1972 | if (version2.loose === !!options.loose && version2.includePrerelease === !!options.includePrerelease) {
|
1973 | return version2;
|
1974 | } else {
|
1975 | version2 = version2.version;
|
1976 | }
|
1977 | } else if (typeof version2 !== "string") {
|
1978 | throw new TypeError(`Invalid Version: ${version2}`);
|
1979 | }
|
1980 | if (version2.length > MAX_LENGTH) {
|
1981 | throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
1982 | }
|
1983 | debug("SemVer", version2, options);
|
1984 | this.options = options;
|
1985 | this.loose = !!options.loose;
|
1986 | this.includePrerelease = !!options.includePrerelease;
|
1987 | const m = version2.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
1988 | if (!m) {
|
1989 | throw new TypeError(`Invalid Version: ${version2}`);
|
1990 | }
|
1991 | this.raw = version2;
|
1992 | this.major = +m[1];
|
1993 | this.minor = +m[2];
|
1994 | this.patch = +m[3];
|
1995 | if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
1996 | throw new TypeError("Invalid major version");
|
1997 | }
|
1998 | if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
1999 | throw new TypeError("Invalid minor version");
|
2000 | }
|
2001 | if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
2002 | throw new TypeError("Invalid patch version");
|
2003 | }
|
2004 | if (!m[4]) {
|
2005 | this.prerelease = [];
|
2006 | } else {
|
2007 | this.prerelease = m[4].split(".").map((id) => {
|
2008 | if (/^[0-9]+$/.test(id)) {
|
2009 | const num = +id;
|
2010 | if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
2011 | return num;
|
2012 | }
|
2013 | }
|
2014 | return id;
|
2015 | });
|
2016 | }
|
2017 | this.build = m[5] ? m[5].split(".") : [];
|
2018 | this.format();
|
2019 | }
|
2020 | format() {
|
2021 | this.version = `${this.major}.${this.minor}.${this.patch}`;
|
2022 | if (this.prerelease.length) {
|
2023 | this.version += `-${this.prerelease.join(".")}`;
|
2024 | }
|
2025 | return this.version;
|
2026 | }
|
2027 | toString() {
|
2028 | return this.version;
|
2029 | }
|
2030 | compare(other) {
|
2031 | debug("SemVer.compare", this.version, this.options, other);
|
2032 | if (!(other instanceof SemVer)) {
|
2033 | if (typeof other === "string" && other === this.version) {
|
2034 | return 0;
|
2035 | }
|
2036 | other = new SemVer(other, this.options);
|
2037 | }
|
2038 | if (other.version === this.version) {
|
2039 | return 0;
|
2040 | }
|
2041 | return this.compareMain(other) || this.comparePre(other);
|
2042 | }
|
2043 | compareMain(other) {
|
2044 | if (!(other instanceof SemVer)) {
|
2045 | other = new SemVer(other, this.options);
|
2046 | }
|
2047 | return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
2048 | }
|
2049 | comparePre(other) {
|
2050 | if (!(other instanceof SemVer)) {
|
2051 | other = new SemVer(other, this.options);
|
2052 | }
|
2053 | if (this.prerelease.length && !other.prerelease.length) {
|
2054 | return -1;
|
2055 | } else if (!this.prerelease.length && other.prerelease.length) {
|
2056 | return 1;
|
2057 | } else if (!this.prerelease.length && !other.prerelease.length) {
|
2058 | return 0;
|
2059 | }
|
2060 | let i = 0;
|
2061 | do {
|
2062 | const a = this.prerelease[i];
|
2063 | const b = other.prerelease[i];
|
2064 | debug("prerelease compare", i, a, b);
|
2065 | if (a === void 0 && b === void 0) {
|
2066 | return 0;
|
2067 | } else if (b === void 0) {
|
2068 | return 1;
|
2069 | } else if (a === void 0) {
|
2070 | return -1;
|
2071 | } else if (a === b) {
|
2072 | continue;
|
2073 | } else {
|
2074 | return compareIdentifiers(a, b);
|
2075 | }
|
2076 | } while (++i);
|
2077 | }
|
2078 | compareBuild(other) {
|
2079 | if (!(other instanceof SemVer)) {
|
2080 | other = new SemVer(other, this.options);
|
2081 | }
|
2082 | let i = 0;
|
2083 | do {
|
2084 | const a = this.build[i];
|
2085 | const b = other.build[i];
|
2086 | debug("prerelease compare", i, a, b);
|
2087 | if (a === void 0 && b === void 0) {
|
2088 | return 0;
|
2089 | } else if (b === void 0) {
|
2090 | return 1;
|
2091 | } else if (a === void 0) {
|
2092 | return -1;
|
2093 | } else if (a === b) {
|
2094 | continue;
|
2095 | } else {
|
2096 | return compareIdentifiers(a, b);
|
2097 | }
|
2098 | } while (++i);
|
2099 | }
|
2100 | inc(release, identifier) {
|
2101 | switch (release) {
|
2102 | case "premajor":
|
2103 | this.prerelease.length = 0;
|
2104 | this.patch = 0;
|
2105 | this.minor = 0;
|
2106 | this.major++;
|
2107 | this.inc("pre", identifier);
|
2108 | break;
|
2109 | case "preminor":
|
2110 | this.prerelease.length = 0;
|
2111 | this.patch = 0;
|
2112 | this.minor++;
|
2113 | this.inc("pre", identifier);
|
2114 | break;
|
2115 | case "prepatch":
|
2116 | this.prerelease.length = 0;
|
2117 | this.inc("patch", identifier);
|
2118 | this.inc("pre", identifier);
|
2119 | break;
|
2120 | case "prerelease":
|
2121 | if (this.prerelease.length === 0) {
|
2122 | this.inc("patch", identifier);
|
2123 | }
|
2124 | this.inc("pre", identifier);
|
2125 | break;
|
2126 | case "major":
|
2127 | if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
2128 | this.major++;
|
2129 | }
|
2130 | this.minor = 0;
|
2131 | this.patch = 0;
|
2132 | this.prerelease = [];
|
2133 | break;
|
2134 | case "minor":
|
2135 | if (this.patch !== 0 || this.prerelease.length === 0) {
|
2136 | this.minor++;
|
2137 | }
|
2138 | this.patch = 0;
|
2139 | this.prerelease = [];
|
2140 | break;
|
2141 | case "patch":
|
2142 | if (this.prerelease.length === 0) {
|
2143 | this.patch++;
|
2144 | }
|
2145 | this.prerelease = [];
|
2146 | break;
|
2147 | case "pre":
|
2148 | if (this.prerelease.length === 0) {
|
2149 | this.prerelease = [0];
|
2150 | } else {
|
2151 | let i = this.prerelease.length;
|
2152 | while (--i >= 0) {
|
2153 | if (typeof this.prerelease[i] === "number") {
|
2154 | this.prerelease[i]++;
|
2155 | i = -2;
|
2156 | }
|
2157 | }
|
2158 | if (i === -1) {
|
2159 | this.prerelease.push(0);
|
2160 | }
|
2161 | }
|
2162 | if (identifier) {
|
2163 | if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
2164 | if (isNaN(this.prerelease[1])) {
|
2165 | this.prerelease = [identifier, 0];
|
2166 | }
|
2167 | } else {
|
2168 | this.prerelease = [identifier, 0];
|
2169 | }
|
2170 | }
|
2171 | break;
|
2172 | default:
|
2173 | throw new Error(`invalid increment argument: ${release}`);
|
2174 | }
|
2175 | this.format();
|
2176 | this.raw = this.version;
|
2177 | return this;
|
2178 | }
|
2179 | };
|
2180 | module2.exports = SemVer;
|
2181 | }
|
2182 | });
|
2183 | var require_compare = __commonJS2({
|
2184 | "node_modules/semver/functions/compare.js"(exports2, module2) {
|
2185 | var SemVer = require_semver();
|
2186 | var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
2187 | module2.exports = compare;
|
2188 | }
|
2189 | });
|
2190 | var require_lt = __commonJS2({
|
2191 | "node_modules/semver/functions/lt.js"(exports2, module2) {
|
2192 | var compare = require_compare();
|
2193 | var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
2194 | module2.exports = lt;
|
2195 | }
|
2196 | });
|
2197 | var require_gte = __commonJS2({
|
2198 | "node_modules/semver/functions/gte.js"(exports2, module2) {
|
2199 | var compare = require_compare();
|
2200 | var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
2201 | module2.exports = gte;
|
2202 | }
|
2203 | });
|
2204 | var require_arrayify = __commonJS2({
|
2205 | "src/utils/arrayify.js"(exports2, module2) {
|
2206 | "use strict";
|
2207 | module2.exports = (object, keyName) => Object.entries(object).map(([key, value]) => Object.assign({
|
2208 | [keyName]: key
|
2209 | }, value));
|
2210 | }
|
2211 | });
|
2212 | var require_lib = __commonJS2({
|
2213 | "node_modules/outdent/lib/index.js"(exports2, module2) {
|
2214 | "use strict";
|
2215 | Object.defineProperty(exports2, "__esModule", {
|
2216 | value: true
|
2217 | });
|
2218 | exports2.outdent = void 0;
|
2219 | function noop() {
|
2220 | var args = [];
|
2221 | for (var _i = 0; _i < arguments.length; _i++) {
|
2222 | args[_i] = arguments[_i];
|
2223 | }
|
2224 | }
|
2225 | function createWeakMap() {
|
2226 | if (typeof WeakMap !== "undefined") {
|
2227 | return new WeakMap();
|
2228 | } else {
|
2229 | return fakeSetOrMap();
|
2230 | }
|
2231 | }
|
2232 | function fakeSetOrMap() {
|
2233 | return {
|
2234 | add: noop,
|
2235 | delete: noop,
|
2236 | get: noop,
|
2237 | set: noop,
|
2238 | has: function(k) {
|
2239 | return false;
|
2240 | }
|
2241 | };
|
2242 | }
|
2243 | var hop = Object.prototype.hasOwnProperty;
|
2244 | var has = function(obj, prop) {
|
2245 | return hop.call(obj, prop);
|
2246 | };
|
2247 | function extend(target, source) {
|
2248 | for (var prop in source) {
|
2249 | if (has(source, prop)) {
|
2250 | target[prop] = source[prop];
|
2251 | }
|
2252 | }
|
2253 | return target;
|
2254 | }
|
2255 | var reLeadingNewline = /^[ \t]*(?:\r\n|\r|\n)/;
|
2256 | var reTrailingNewline = /(?:\r\n|\r|\n)[ \t]*$/;
|
2257 | var reStartsWithNewlineOrIsEmpty = /^(?:[\r\n]|$)/;
|
2258 | var reDetectIndentation = /(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/;
|
2259 | var reOnlyWhitespaceWithAtLeastOneNewline = /^[ \t]*[\r\n][ \t\r\n]*$/;
|
2260 | function _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options) {
|
2261 | var indentationLevel = 0;
|
2262 | var match = strings[0].match(reDetectIndentation);
|
2263 | if (match) {
|
2264 | indentationLevel = match[1].length;
|
2265 | }
|
2266 | var reSource = "(\\r\\n|\\r|\\n).{0," + indentationLevel + "}";
|
2267 | var reMatchIndent = new RegExp(reSource, "g");
|
2268 | if (firstInterpolatedValueSetsIndentationLevel) {
|
2269 | strings = strings.slice(1);
|
2270 | }
|
2271 | var newline = options.newline, trimLeadingNewline = options.trimLeadingNewline, trimTrailingNewline = options.trimTrailingNewline;
|
2272 | var normalizeNewlines = typeof newline === "string";
|
2273 | var l = strings.length;
|
2274 | var outdentedStrings = strings.map(function(v, i) {
|
2275 | v = v.replace(reMatchIndent, "$1");
|
2276 | if (i === 0 && trimLeadingNewline) {
|
2277 | v = v.replace(reLeadingNewline, "");
|
2278 | }
|
2279 | if (i === l - 1 && trimTrailingNewline) {
|
2280 | v = v.replace(reTrailingNewline, "");
|
2281 | }
|
2282 | if (normalizeNewlines) {
|
2283 | v = v.replace(/\r\n|\n|\r/g, function(_) {
|
2284 | return newline;
|
2285 | });
|
2286 | }
|
2287 | return v;
|
2288 | });
|
2289 | return outdentedStrings;
|
2290 | }
|
2291 | function concatStringsAndValues(strings, values) {
|
2292 | var ret = "";
|
2293 | for (var i = 0, l = strings.length; i < l; i++) {
|
2294 | ret += strings[i];
|
2295 | if (i < l - 1) {
|
2296 | ret += values[i];
|
2297 | }
|
2298 | }
|
2299 | return ret;
|
2300 | }
|
2301 | function isTemplateStringsArray(v) {
|
2302 | return has(v, "raw") && has(v, "length");
|
2303 | }
|
2304 | function createInstance(options) {
|
2305 | var arrayAutoIndentCache = createWeakMap();
|
2306 | var arrayFirstInterpSetsIndentCache = createWeakMap();
|
2307 | function outdent(stringsOrOptions) {
|
2308 | var values = [];
|
2309 | for (var _i = 1; _i < arguments.length; _i++) {
|
2310 | values[_i - 1] = arguments[_i];
|
2311 | }
|
2312 | if (isTemplateStringsArray(stringsOrOptions)) {
|
2313 | var strings = stringsOrOptions;
|
2314 | var firstInterpolatedValueSetsIndentationLevel = (values[0] === outdent || values[0] === defaultOutdent) && reOnlyWhitespaceWithAtLeastOneNewline.test(strings[0]) && reStartsWithNewlineOrIsEmpty.test(strings[1]);
|
2315 | var cache = firstInterpolatedValueSetsIndentationLevel ? arrayFirstInterpSetsIndentCache : arrayAutoIndentCache;
|
2316 | var renderedArray = cache.get(strings);
|
2317 | if (!renderedArray) {
|
2318 | renderedArray = _outdentArray(strings, firstInterpolatedValueSetsIndentationLevel, options);
|
2319 | cache.set(strings, renderedArray);
|
2320 | }
|
2321 | if (values.length === 0) {
|
2322 | return renderedArray[0];
|
2323 | }
|
2324 | var rendered = concatStringsAndValues(renderedArray, firstInterpolatedValueSetsIndentationLevel ? values.slice(1) : values);
|
2325 | return rendered;
|
2326 | } else {
|
2327 | return createInstance(extend(extend({}, options), stringsOrOptions || {}));
|
2328 | }
|
2329 | }
|
2330 | var fullOutdent = extend(outdent, {
|
2331 | string: function(str) {
|
2332 | return _outdentArray([str], false, options)[0];
|
2333 | }
|
2334 | });
|
2335 | return fullOutdent;
|
2336 | }
|
2337 | var defaultOutdent = createInstance({
|
2338 | trimLeadingNewline: true,
|
2339 | trimTrailingNewline: true
|
2340 | });
|
2341 | exports2.outdent = defaultOutdent;
|
2342 | exports2.default = defaultOutdent;
|
2343 | if (typeof module2 !== "undefined") {
|
2344 | try {
|
2345 | module2.exports = defaultOutdent;
|
2346 | Object.defineProperty(defaultOutdent, "__esModule", {
|
2347 | value: true
|
2348 | });
|
2349 | defaultOutdent.default = defaultOutdent;
|
2350 | defaultOutdent.outdent = defaultOutdent;
|
2351 | } catch (e) {
|
2352 | }
|
2353 | }
|
2354 | }
|
2355 | });
|
2356 | var require_core_options = __commonJS2({
|
2357 | "src/main/core-options.js"(exports2, module2) {
|
2358 | "use strict";
|
2359 | var {
|
2360 | outdent
|
2361 | } = require_lib();
|
2362 | var CATEGORY_CONFIG = "Config";
|
2363 | var CATEGORY_EDITOR = "Editor";
|
2364 | var CATEGORY_FORMAT = "Format";
|
2365 | var CATEGORY_OTHER = "Other";
|
2366 | var CATEGORY_OUTPUT = "Output";
|
2367 | var CATEGORY_GLOBAL = "Global";
|
2368 | var CATEGORY_SPECIAL = "Special";
|
2369 | var options = {
|
2370 | cursorOffset: {
|
2371 | since: "1.4.0",
|
2372 | category: CATEGORY_SPECIAL,
|
2373 | type: "int",
|
2374 | default: -1,
|
2375 | range: {
|
2376 | start: -1,
|
2377 | end: Number.POSITIVE_INFINITY,
|
2378 | step: 1
|
2379 | },
|
2380 | description: outdent`
|
2381 | Print (to stderr) where a cursor at the given position would move to after formatting.
|
2382 | This option cannot be used with --range-start and --range-end.
|
2383 | `,
|
2384 | cliCategory: CATEGORY_EDITOR
|
2385 | },
|
2386 | endOfLine: {
|
2387 | since: "1.15.0",
|
2388 | category: CATEGORY_GLOBAL,
|
2389 | type: "choice",
|
2390 | default: [{
|
2391 | since: "1.15.0",
|
2392 | value: "auto"
|
2393 | }, {
|
2394 | since: "2.0.0",
|
2395 | value: "lf"
|
2396 | }],
|
2397 | description: "Which end of line characters to apply.",
|
2398 | choices: [{
|
2399 | value: "lf",
|
2400 | description: "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
|
2401 | }, {
|
2402 | value: "crlf",
|
2403 | description: "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
|
2404 | }, {
|
2405 | value: "cr",
|
2406 | description: "Carriage Return character only (\\r), used very rarely"
|
2407 | }, {
|
2408 | value: "auto",
|
2409 | description: outdent`
|
2410 | Maintain existing
|
2411 | (mixed values within one file are normalised by looking at what's used after the first line)
|
2412 | `
|
2413 | }]
|
2414 | },
|
2415 | filepath: {
|
2416 | since: "1.4.0",
|
2417 | category: CATEGORY_SPECIAL,
|
2418 | type: "path",
|
2419 | description: "Specify the input filepath. This will be used to do parser inference.",
|
2420 | cliName: "stdin-filepath",
|
2421 | cliCategory: CATEGORY_OTHER,
|
2422 | cliDescription: "Path to the file to pretend that stdin comes from."
|
2423 | },
|
2424 | insertPragma: {
|
2425 | since: "1.8.0",
|
2426 | category: CATEGORY_SPECIAL,
|
2427 | type: "boolean",
|
2428 | default: false,
|
2429 | description: "Insert @format pragma into file's first docblock comment.",
|
2430 | cliCategory: CATEGORY_OTHER
|
2431 | },
|
2432 | parser: {
|
2433 | since: "0.0.10",
|
2434 | category: CATEGORY_GLOBAL,
|
2435 | type: "choice",
|
2436 | default: [{
|
2437 | since: "0.0.10",
|
2438 | value: "babylon"
|
2439 | }, {
|
2440 | since: "1.13.0",
|
2441 | value: void 0
|
2442 | }],
|
2443 | description: "Which parser to use.",
|
2444 | exception: (value) => typeof value === "string" || typeof value === "function",
|
2445 | choices: [{
|
2446 | value: "flow",
|
2447 | description: "Flow"
|
2448 | }, {
|
2449 | value: "babel",
|
2450 | since: "1.16.0",
|
2451 | description: "JavaScript"
|
2452 | }, {
|
2453 | value: "babel-flow",
|
2454 | since: "1.16.0",
|
2455 | description: "Flow"
|
2456 | }, {
|
2457 | value: "babel-ts",
|
2458 | since: "2.0.0",
|
2459 | description: "TypeScript"
|
2460 | }, {
|
2461 | value: "typescript",
|
2462 | since: "1.4.0",
|
2463 | description: "TypeScript"
|
2464 | }, {
|
2465 | value: "acorn",
|
2466 | since: "2.6.0",
|
2467 | description: "JavaScript"
|
2468 | }, {
|
2469 | value: "espree",
|
2470 | since: "2.2.0",
|
2471 | description: "JavaScript"
|
2472 | }, {
|
2473 | value: "meriyah",
|
2474 | since: "2.2.0",
|
2475 | description: "JavaScript"
|
2476 | }, {
|
2477 | value: "css",
|
2478 | since: "1.7.1",
|
2479 | description: "CSS"
|
2480 | }, {
|
2481 | value: "less",
|
2482 | since: "1.7.1",
|
2483 | description: "Less"
|
2484 | }, {
|
2485 | value: "scss",
|
2486 | since: "1.7.1",
|
2487 | description: "SCSS"
|
2488 | }, {
|
2489 | value: "json",
|
2490 | since: "1.5.0",
|
2491 | description: "JSON"
|
2492 | }, {
|
2493 | value: "json5",
|
2494 | since: "1.13.0",
|
2495 | description: "JSON5"
|
2496 | }, {
|
2497 | value: "json-stringify",
|
2498 | since: "1.13.0",
|
2499 | description: "JSON.stringify"
|
2500 | }, {
|
2501 | value: "graphql",
|
2502 | since: "1.5.0",
|
2503 | description: "GraphQL"
|
2504 | }, {
|
2505 | value: "markdown",
|
2506 | since: "1.8.0",
|
2507 | description: "Markdown"
|
2508 | }, {
|
2509 | value: "mdx",
|
2510 | since: "1.15.0",
|
2511 | description: "MDX"
|
2512 | }, {
|
2513 | value: "vue",
|
2514 | since: "1.10.0",
|
2515 | description: "Vue"
|
2516 | }, {
|
2517 | value: "yaml",
|
2518 | since: "1.14.0",
|
2519 | description: "YAML"
|
2520 | }, {
|
2521 | value: "glimmer",
|
2522 | since: "2.3.0",
|
2523 | description: "Ember / Handlebars"
|
2524 | }, {
|
2525 | value: "html",
|
2526 | since: "1.15.0",
|
2527 | description: "HTML"
|
2528 | }, {
|
2529 | value: "angular",
|
2530 | since: "1.15.0",
|
2531 | description: "Angular"
|
2532 | }, {
|
2533 | value: "lwc",
|
2534 | since: "1.17.0",
|
2535 | description: "Lightning Web Components"
|
2536 | }]
|
2537 | },
|
2538 | plugins: {
|
2539 | since: "1.10.0",
|
2540 | type: "path",
|
2541 | array: true,
|
2542 | default: [{
|
2543 | value: []
|
2544 | }],
|
2545 | category: CATEGORY_GLOBAL,
|
2546 | description: "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
|
2547 | exception: (value) => typeof value === "string" || typeof value === "object",
|
2548 | cliName: "plugin",
|
2549 | cliCategory: CATEGORY_CONFIG
|
2550 | },
|
2551 | pluginSearchDirs: {
|
2552 | since: "1.13.0",
|
2553 | type: "path",
|
2554 | array: true,
|
2555 | default: [{
|
2556 | value: []
|
2557 | }],
|
2558 | category: CATEGORY_GLOBAL,
|
2559 | description: outdent`
|
2560 | Custom directory that contains prettier plugins in node_modules subdirectory.
|
2561 | Overrides default behavior when plugins are searched relatively to the location of Prettier.
|
2562 | Multiple values are accepted.
|
2563 | `,
|
2564 | exception: (value) => typeof value === "string" || typeof value === "object",
|
2565 | cliName: "plugin-search-dir",
|
2566 | cliCategory: CATEGORY_CONFIG
|
2567 | },
|
2568 | printWidth: {
|
2569 | since: "0.0.0",
|
2570 | category: CATEGORY_GLOBAL,
|
2571 | type: "int",
|
2572 | default: 80,
|
2573 | description: "The line length where Prettier will try wrap.",
|
2574 | range: {
|
2575 | start: 0,
|
2576 | end: Number.POSITIVE_INFINITY,
|
2577 | step: 1
|
2578 | }
|
2579 | },
|
2580 | rangeEnd: {
|
2581 | since: "1.4.0",
|
2582 | category: CATEGORY_SPECIAL,
|
2583 | type: "int",
|
2584 | default: Number.POSITIVE_INFINITY,
|
2585 | range: {
|
2586 | start: 0,
|
2587 | end: Number.POSITIVE_INFINITY,
|
2588 | step: 1
|
2589 | },
|
2590 | description: outdent`
|
2591 | Format code ending at a given character offset (exclusive).
|
2592 | The range will extend forwards to the end of the selected statement.
|
2593 | This option cannot be used with --cursor-offset.
|
2594 | `,
|
2595 | cliCategory: CATEGORY_EDITOR
|
2596 | },
|
2597 | rangeStart: {
|
2598 | since: "1.4.0",
|
2599 | category: CATEGORY_SPECIAL,
|
2600 | type: "int",
|
2601 | default: 0,
|
2602 | range: {
|
2603 | start: 0,
|
2604 | end: Number.POSITIVE_INFINITY,
|
2605 | step: 1
|
2606 | },
|
2607 | description: outdent`
|
2608 | Format code starting at a given character offset.
|
2609 | The range will extend backwards to the start of the first line containing the selected statement.
|
2610 | This option cannot be used with --cursor-offset.
|
2611 | `,
|
2612 | cliCategory: CATEGORY_EDITOR
|
2613 | },
|
2614 | requirePragma: {
|
2615 | since: "1.7.0",
|
2616 | category: CATEGORY_SPECIAL,
|
2617 | type: "boolean",
|
2618 | default: false,
|
2619 | description: outdent`
|
2620 | Require either '@prettier' or '@format' to be present in the file's first docblock comment
|
2621 | in order for it to be formatted.
|
2622 | `,
|
2623 | cliCategory: CATEGORY_OTHER
|
2624 | },
|
2625 | tabWidth: {
|
2626 | type: "int",
|
2627 | category: CATEGORY_GLOBAL,
|
2628 | default: 2,
|
2629 | description: "Number of spaces per indentation level.",
|
2630 | range: {
|
2631 | start: 0,
|
2632 | end: Number.POSITIVE_INFINITY,
|
2633 | step: 1
|
2634 | }
|
2635 | },
|
2636 | useTabs: {
|
2637 | since: "1.0.0",
|
2638 | category: CATEGORY_GLOBAL,
|
2639 | type: "boolean",
|
2640 | default: false,
|
2641 | description: "Indent with tabs instead of spaces."
|
2642 | },
|
2643 | embeddedLanguageFormatting: {
|
2644 | since: "2.1.0",
|
2645 | category: CATEGORY_GLOBAL,
|
2646 | type: "choice",
|
2647 | default: [{
|
2648 | since: "2.1.0",
|
2649 | value: "auto"
|
2650 | }],
|
2651 | description: "Control how Prettier formats quoted code embedded in the file.",
|
2652 | choices: [{
|
2653 | value: "auto",
|
2654 | description: "Format embedded code if Prettier can automatically identify it."
|
2655 | }, {
|
2656 | value: "off",
|
2657 | description: "Never automatically format embedded code."
|
2658 | }]
|
2659 | }
|
2660 | };
|
2661 | module2.exports = {
|
2662 | CATEGORY_CONFIG,
|
2663 | CATEGORY_EDITOR,
|
2664 | CATEGORY_FORMAT,
|
2665 | CATEGORY_OTHER,
|
2666 | CATEGORY_OUTPUT,
|
2667 | CATEGORY_GLOBAL,
|
2668 | CATEGORY_SPECIAL,
|
2669 | options
|
2670 | };
|
2671 | }
|
2672 | });
|
2673 | var require_support = __commonJS2({
|
2674 | "src/main/support.js"(exports2, module2) {
|
2675 | "use strict";
|
2676 | var semver = {
|
2677 | compare: require_compare(),
|
2678 | lt: require_lt(),
|
2679 | gte: require_gte()
|
2680 | };
|
2681 | var arrayify = require_arrayify();
|
2682 | var currentVersion = require("./package.json").version;
|
2683 | var coreOptions = require_core_options().options;
|
2684 | function getSupportInfo2({
|
2685 | plugins: plugins2 = [],
|
2686 | showUnreleased = false,
|
2687 | showDeprecated = false,
|
2688 | showInternal = false
|
2689 | } = {}) {
|
2690 | const version2 = currentVersion.split("-", 1)[0];
|
2691 | const languages = plugins2.flatMap((plugin) => plugin.languages || []).filter(filterSince);
|
2692 | const options = arrayify(Object.assign({}, ...plugins2.map(({
|
2693 | options: options2
|
2694 | }) => options2), coreOptions), "name").filter((option) => filterSince(option) && filterDeprecated(option)).sort((a, b) => a.name === b.name ? 0 : a.name < b.name ? -1 : 1).map(mapInternal).map((option) => {
|
2695 | option = Object.assign({}, option);
|
2696 | if (Array.isArray(option.default)) {
|
2697 | option.default = option.default.length === 1 ? option.default[0].value : option.default.filter(filterSince).sort((info1, info2) => semver.compare(info2.since, info1.since))[0].value;
|
2698 | }
|
2699 | if (Array.isArray(option.choices)) {
|
2700 | option.choices = option.choices.filter((option2) => filterSince(option2) && filterDeprecated(option2));
|
2701 | if (option.name === "parser") {
|
2702 | collectParsersFromLanguages(option, languages, plugins2);
|
2703 | }
|
2704 | }
|
2705 | const pluginDefaults = Object.fromEntries(plugins2.filter((plugin) => plugin.defaultOptions && plugin.defaultOptions[option.name] !== void 0).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]]));
|
2706 | return Object.assign(Object.assign({}, option), {}, {
|
2707 | pluginDefaults
|
2708 | });
|
2709 | });
|
2710 | return {
|
2711 | languages,
|
2712 | options
|
2713 | };
|
2714 | function filterSince(object) {
|
2715 | return showUnreleased || !("since" in object) || object.since && semver.gte(version2, object.since);
|
2716 | }
|
2717 | function filterDeprecated(object) {
|
2718 | return showDeprecated || !("deprecated" in object) || object.deprecated && semver.lt(version2, object.deprecated);
|
2719 | }
|
2720 | function mapInternal(object) {
|
2721 | if (showInternal) {
|
2722 | return object;
|
2723 | }
|
2724 | const {
|
2725 | cliName,
|
2726 | cliCategory,
|
2727 | cliDescription
|
2728 | } = object, newObject = _objectWithoutProperties(object, _excluded);
|
2729 | return newObject;
|
2730 | }
|
2731 | }
|
2732 | function collectParsersFromLanguages(option, languages, plugins2) {
|
2733 | const existingValues = new Set(option.choices.map((choice) => choice.value));
|
2734 | for (const language of languages) {
|
2735 | if (language.parsers) {
|
2736 | for (const value of language.parsers) {
|
2737 | if (!existingValues.has(value)) {
|
2738 | existingValues.add(value);
|
2739 | const plugin = plugins2.find((plugin2) => plugin2.parsers && plugin2.parsers[value]);
|
2740 | let description = language.name;
|
2741 | if (plugin && plugin.name) {
|
2742 | description += ` (plugin: ${plugin.name})`;
|
2743 | }
|
2744 | option.choices.push({
|
2745 | value,
|
2746 | description
|
2747 | });
|
2748 | }
|
2749 | }
|
2750 | }
|
2751 | }
|
2752 | }
|
2753 | module2.exports = {
|
2754 | getSupportInfo: getSupportInfo2
|
2755 | };
|
2756 | }
|
2757 | });
|
2758 | var require_is_non_empty_array = __commonJS2({
|
2759 | "src/utils/is-non-empty-array.js"(exports2, module2) {
|
2760 | "use strict";
|
2761 | function isNonEmptyArray(object) {
|
2762 | return Array.isArray(object) && object.length > 0;
|
2763 | }
|
2764 | module2.exports = isNonEmptyArray;
|
2765 | }
|
2766 | });
|
2767 | function ansiRegex({
|
2768 | onlyFirst = false
|
2769 | } = {}) {
|
2770 | const pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");
|
2771 | return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
2772 | }
|
2773 | var init_ansi_regex = __esm({
|
2774 | "node_modules/strip-ansi/node_modules/ansi-regex/index.js"() {
|
2775 | }
|
2776 | });
|
2777 | function stripAnsi(string) {
|
2778 | if (typeof string !== "string") {
|
2779 | throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
2780 | }
|
2781 | return string.replace(ansiRegex(), "");
|
2782 | }
|
2783 | var init_strip_ansi = __esm({
|
2784 | "node_modules/strip-ansi/index.js"() {
|
2785 | init_ansi_regex();
|
2786 | }
|
2787 | });
|
2788 | function isFullwidthCodePoint(codePoint) {
|
2789 | if (!Number.isInteger(codePoint)) {
|
2790 | return false;
|
2791 | }
|
2792 | return codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141);
|
2793 | }
|
2794 | var init_is_fullwidth_code_point = __esm({
|
2795 | "node_modules/is-fullwidth-code-point/index.js"() {
|
2796 | }
|
2797 | });
|
2798 | var require_emoji_regex = __commonJS2({
|
2799 | "node_modules/emoji-regex/index.js"(exports2, module2) {
|
2800 | "use strict";
|
2801 | module2.exports = function() {
|
2802 | return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
2803 | };
|
2804 | }
|
2805 | });
|
2806 | var string_width_exports = {};
|
2807 | __export(string_width_exports, {
|
2808 | default: () => stringWidth
|
2809 | });
|
2810 | function stringWidth(string) {
|
2811 | if (typeof string !== "string" || string.length === 0) {
|
2812 | return 0;
|
2813 | }
|
2814 | string = stripAnsi(string);
|
2815 | if (string.length === 0) {
|
2816 | return 0;
|
2817 | }
|
2818 | string = string.replace((0, import_emoji_regex.default)(), " ");
|
2819 | let width = 0;
|
2820 | for (let index = 0; index < string.length; index++) {
|
2821 | const codePoint = string.codePointAt(index);
|
2822 | if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
2823 | continue;
|
2824 | }
|
2825 | if (codePoint >= 768 && codePoint <= 879) {
|
2826 | continue;
|
2827 | }
|
2828 | if (codePoint > 65535) {
|
2829 | index++;
|
2830 | }
|
2831 | width += isFullwidthCodePoint(codePoint) ? 2 : 1;
|
2832 | }
|
2833 | return width;
|
2834 | }
|
2835 | var import_emoji_regex;
|
2836 | var init_string_width = __esm({
|
2837 | "node_modules/string-width/index.js"() {
|
2838 | init_strip_ansi();
|
2839 | init_is_fullwidth_code_point();
|
2840 | import_emoji_regex = __toESM(require_emoji_regex());
|
2841 | }
|
2842 | });
|
2843 | var require_get_string_width = __commonJS2({
|
2844 | "src/utils/get-string-width.js"(exports2, module2) {
|
2845 | "use strict";
|
2846 | var stringWidth2 = (init_string_width(), __toCommonJS(string_width_exports)).default;
|
2847 | var notAsciiRegex = /[^\x20-\x7F]/;
|
2848 | function getStringWidth(text) {
|
2849 | if (!text) {
|
2850 | return 0;
|
2851 | }
|
2852 | if (!notAsciiRegex.test(text)) {
|
2853 | return text.length;
|
2854 | }
|
2855 | return stringWidth2(text);
|
2856 | }
|
2857 | module2.exports = getStringWidth;
|
2858 | }
|
2859 | });
|
2860 | var require_skip = __commonJS2({
|
2861 | "src/utils/text/skip.js"(exports2, module2) {
|
2862 | "use strict";
|
2863 | function skip(chars) {
|
2864 | return (text, index, opts) => {
|
2865 | const backwards = opts && opts.backwards;
|
2866 | if (index === false) {
|
2867 | return false;
|
2868 | }
|
2869 | const {
|
2870 | length
|
2871 | } = text;
|
2872 | let cursor = index;
|
2873 | while (cursor >= 0 && cursor < length) {
|
2874 | const c = text.charAt(cursor);
|
2875 | if (chars instanceof RegExp) {
|
2876 | if (!chars.test(c)) {
|
2877 | return cursor;
|
2878 | }
|
2879 | } else if (!chars.includes(c)) {
|
2880 | return cursor;
|
2881 | }
|
2882 | backwards ? cursor-- : cursor++;
|
2883 | }
|
2884 | if (cursor === -1 || cursor === length) {
|
2885 | return cursor;
|
2886 | }
|
2887 | return false;
|
2888 | };
|
2889 | }
|
2890 | var skipWhitespace = skip(/\s/);
|
2891 | var skipSpaces = skip(" ");
|
2892 | var skipToLineEnd = skip(",; ");
|
2893 | var skipEverythingButNewLine = skip(/[^\n\r]/);
|
2894 | module2.exports = {
|
2895 | skipWhitespace,
|
2896 | skipSpaces,
|
2897 | skipToLineEnd,
|
2898 | skipEverythingButNewLine
|
2899 | };
|
2900 | }
|
2901 | });
|
2902 | var require_skip_inline_comment = __commonJS2({
|
2903 | "src/utils/text/skip-inline-comment.js"(exports2, module2) {
|
2904 | "use strict";
|
2905 | function skipInlineComment(text, index) {
|
2906 | if (index === false) {
|
2907 | return false;
|
2908 | }
|
2909 | if (text.charAt(index) === "/" && text.charAt(index + 1) === "*") {
|
2910 | for (let i = index + 2; i < text.length; ++i) {
|
2911 | if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
|
2912 | return i + 2;
|
2913 | }
|
2914 | }
|
2915 | }
|
2916 | return index;
|
2917 | }
|
2918 | module2.exports = skipInlineComment;
|
2919 | }
|
2920 | });
|
2921 | var require_skip_trailing_comment = __commonJS2({
|
2922 | "src/utils/text/skip-trailing-comment.js"(exports2, module2) {
|
2923 | "use strict";
|
2924 | var {
|
2925 | skipEverythingButNewLine
|
2926 | } = require_skip();
|
2927 | function skipTrailingComment(text, index) {
|
2928 | if (index === false) {
|
2929 | return false;
|
2930 | }
|
2931 | if (text.charAt(index) === "/" && text.charAt(index + 1) === "/") {
|
2932 | return skipEverythingButNewLine(text, index);
|
2933 | }
|
2934 | return index;
|
2935 | }
|
2936 | module2.exports = skipTrailingComment;
|
2937 | }
|
2938 | });
|
2939 | var require_skip_newline = __commonJS2({
|
2940 | "src/utils/text/skip-newline.js"(exports2, module2) {
|
2941 | "use strict";
|
2942 | function skipNewline(text, index, opts) {
|
2943 | const backwards = opts && opts.backwards;
|
2944 | if (index === false) {
|
2945 | return false;
|
2946 | }
|
2947 | const atIndex = text.charAt(index);
|
2948 | if (backwards) {
|
2949 | if (text.charAt(index - 1) === "\r" && atIndex === "\n") {
|
2950 | return index - 2;
|
2951 | }
|
2952 | if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
|
2953 | return index - 1;
|
2954 | }
|
2955 | } else {
|
2956 | if (atIndex === "\r" && text.charAt(index + 1) === "\n") {
|
2957 | return index + 2;
|
2958 | }
|
2959 | if (atIndex === "\n" || atIndex === "\r" || atIndex === "\u2028" || atIndex === "\u2029") {
|
2960 | return index + 1;
|
2961 | }
|
2962 | }
|
2963 | return index;
|
2964 | }
|
2965 | module2.exports = skipNewline;
|
2966 | }
|
2967 | });
|
2968 | var require_get_next_non_space_non_comment_character_index_with_start_index = __commonJS2({
|
2969 | "src/utils/text/get-next-non-space-non-comment-character-index-with-start-index.js"(exports2, module2) {
|
2970 | "use strict";
|
2971 | var skipInlineComment = require_skip_inline_comment();
|
2972 | var skipNewline = require_skip_newline();
|
2973 | var skipTrailingComment = require_skip_trailing_comment();
|
2974 | var {
|
2975 | skipSpaces
|
2976 | } = require_skip();
|
2977 | function getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, idx) {
|
2978 | let oldIdx = null;
|
2979 | let nextIdx = idx;
|
2980 | while (nextIdx !== oldIdx) {
|
2981 | oldIdx = nextIdx;
|
2982 | nextIdx = skipSpaces(text, nextIdx);
|
2983 | nextIdx = skipInlineComment(text, nextIdx);
|
2984 | nextIdx = skipTrailingComment(text, nextIdx);
|
2985 | nextIdx = skipNewline(text, nextIdx);
|
2986 | }
|
2987 | return nextIdx;
|
2988 | }
|
2989 | module2.exports = getNextNonSpaceNonCommentCharacterIndexWithStartIndex;
|
2990 | }
|
2991 | });
|
2992 | var require_util = __commonJS2({
|
2993 | "src/common/util.js"(exports2, module2) {
|
2994 | "use strict";
|
2995 | var {
|
2996 | default: escapeStringRegexp2
|
2997 | } = (init_escape_string_regexp(), __toCommonJS(escape_string_regexp_exports));
|
2998 | var getLast = require_get_last();
|
2999 | var {
|
3000 | getSupportInfo: getSupportInfo2
|
3001 | } = require_support();
|
3002 | var isNonEmptyArray = require_is_non_empty_array();
|
3003 | var getStringWidth = require_get_string_width();
|
3004 | var {
|
3005 | skipWhitespace,
|
3006 | skipSpaces,
|
3007 | skipToLineEnd,
|
3008 | skipEverythingButNewLine
|
3009 | } = require_skip();
|
3010 | var skipInlineComment = require_skip_inline_comment();
|
3011 | var skipTrailingComment = require_skip_trailing_comment();
|
3012 | var skipNewline = require_skip_newline();
|
3013 | var getNextNonSpaceNonCommentCharacterIndexWithStartIndex = require_get_next_non_space_non_comment_character_index_with_start_index();
|
3014 | var getPenultimate = (arr) => arr[arr.length - 2];
|
3015 | function skip(chars) {
|
3016 | return (text, index, opts) => {
|
3017 | const backwards = opts && opts.backwards;
|
3018 | if (index === false) {
|
3019 | return false;
|
3020 | }
|
3021 | const {
|
3022 | length
|
3023 | } = text;
|
3024 | let cursor = index;
|
3025 | while (cursor >= 0 && cursor < length) {
|
3026 | const c = text.charAt(cursor);
|
3027 | if (chars instanceof RegExp) {
|
3028 | if (!chars.test(c)) {
|
3029 | return cursor;
|
3030 | }
|
3031 | } else if (!chars.includes(c)) {
|
3032 | return cursor;
|
3033 | }
|
3034 | backwards ? cursor-- : cursor++;
|
3035 | }
|
3036 | if (cursor === -1 || cursor === length) {
|
3037 | return cursor;
|
3038 | }
|
3039 | return false;
|
3040 | };
|
3041 | }
|
3042 | function hasNewline(text, index, opts = {}) {
|
3043 | const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
|
3044 | const idx2 = skipNewline(text, idx, opts);
|
3045 | return idx !== idx2;
|
3046 | }
|
3047 | function hasNewlineInRange(text, start, end) {
|
3048 | for (let i = start; i < end; ++i) {
|
3049 | if (text.charAt(i) === "\n") {
|
3050 | return true;
|
3051 | }
|
3052 | }
|
3053 | return false;
|
3054 | }
|
3055 | function isPreviousLineEmpty(text, node, locStart) {
|
3056 | let idx = locStart(node) - 1;
|
3057 | idx = skipSpaces(text, idx, {
|
3058 | backwards: true
|
3059 | });
|
3060 | idx = skipNewline(text, idx, {
|
3061 | backwards: true
|
3062 | });
|
3063 | idx = skipSpaces(text, idx, {
|
3064 | backwards: true
|
3065 | });
|
3066 | const idx2 = skipNewline(text, idx, {
|
3067 | backwards: true
|
3068 | });
|
3069 | return idx !== idx2;
|
3070 | }
|
3071 | function isNextLineEmptyAfterIndex(text, index) {
|
3072 | let oldIdx = null;
|
3073 | let idx = index;
|
3074 | while (idx !== oldIdx) {
|
3075 | oldIdx = idx;
|
3076 | idx = skipToLineEnd(text, idx);
|
3077 | idx = skipInlineComment(text, idx);
|
3078 | idx = skipSpaces(text, idx);
|
3079 | }
|
3080 | idx = skipTrailingComment(text, idx);
|
3081 | idx = skipNewline(text, idx);
|
3082 | return idx !== false && hasNewline(text, idx);
|
3083 | }
|
3084 | function isNextLineEmpty(text, node, locEnd) {
|
3085 | return isNextLineEmptyAfterIndex(text, locEnd(node));
|
3086 | }
|
3087 | function getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
|
3088 | return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(node));
|
3089 | }
|
3090 | function getNextNonSpaceNonCommentCharacter(text, node, locEnd) {
|
3091 | return text.charAt(getNextNonSpaceNonCommentCharacterIndex(text, node, locEnd));
|
3092 | }
|
3093 | function hasSpaces(text, index, opts = {}) {
|
3094 | const idx = skipSpaces(text, opts.backwards ? index - 1 : index, opts);
|
3095 | return idx !== index;
|
3096 | }
|
3097 | function getAlignmentSize(value, tabWidth, startIndex = 0) {
|
3098 | let size = 0;
|
3099 | for (let i = startIndex; i < value.length; ++i) {
|
3100 | if (value[i] === " ") {
|
3101 | size = size + tabWidth - size % tabWidth;
|
3102 | } else {
|
3103 | size++;
|
3104 | }
|
3105 | }
|
3106 | return size;
|
3107 | }
|
3108 | function getIndentSize(value, tabWidth) {
|
3109 | const lastNewlineIndex = value.lastIndexOf("\n");
|
3110 | if (lastNewlineIndex === -1) {
|
3111 | return 0;
|
3112 | }
|
3113 | return getAlignmentSize(value.slice(lastNewlineIndex + 1).match(/^[\t ]*/)[0], tabWidth);
|
3114 | }
|
3115 | function getPreferredQuote(rawContent, preferredQuote) {
|
3116 | const double = {
|
3117 | quote: '"',
|
3118 | regex: /"/g,
|
3119 | escaped: """
|
3120 | };
|
3121 | const single = {
|
3122 | quote: "'",
|
3123 | regex: /'/g,
|
3124 | escaped: "'"
|
3125 | };
|
3126 | const preferred = preferredQuote === "'" ? single : double;
|
3127 | const alternate = preferred === single ? double : single;
|
3128 | let result = preferred;
|
3129 | if (rawContent.includes(preferred.quote) || rawContent.includes(alternate.quote)) {
|
3130 | const numPreferredQuotes = (rawContent.match(preferred.regex) || []).length;
|
3131 | const numAlternateQuotes = (rawContent.match(alternate.regex) || []).length;
|
3132 | result = numPreferredQuotes > numAlternateQuotes ? alternate : preferred;
|
3133 | }
|
3134 | return result;
|
3135 | }
|
3136 | function printString(raw, options) {
|
3137 | const rawContent = raw.slice(1, -1);
|
3138 | const enclosingQuote = options.parser === "json" || options.parser === "json5" && options.quoteProps === "preserve" && !options.singleQuote ? '"' : options.__isInHtmlAttribute ? "'" : getPreferredQuote(rawContent, options.singleQuote ? "'" : '"').quote;
|
3139 | return makeString(rawContent, enclosingQuote, !(options.parser === "css" || options.parser === "less" || options.parser === "scss" || options.__embeddedInHtml));
|
3140 | }
|
3141 | function makeString(rawContent, enclosingQuote, unescapeUnnecessaryEscapes) {
|
3142 | const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
3143 | const regex = /\\(.)|(["'])/gs;
|
3144 | const newContent = rawContent.replace(regex, (match, escaped, quote) => {
|
3145 | if (escaped === otherQuote) {
|
3146 | return escaped;
|
3147 | }
|
3148 | if (quote === enclosingQuote) {
|
3149 | return "\\" + quote;
|
3150 | }
|
3151 | if (quote) {
|
3152 | return quote;
|
3153 | }
|
3154 | return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/.test(escaped) ? escaped : "\\" + escaped;
|
3155 | });
|
3156 | return enclosingQuote + newContent + enclosingQuote;
|
3157 | }
|
3158 | function printNumber(rawNumber) {
|
3159 | return rawNumber.toLowerCase().replace(/^([+-]?[\d.]+e)(?:\+|(-))?0*(\d)/, "$1$2$3").replace(/^([+-]?[\d.]+)e[+-]?0+$/, "$1").replace(/^([+-])?\./, "$10.").replace(/(\.\d+?)0+(?=e|$)/, "$1").replace(/\.(?=e|$)/, "");
|
3160 | }
|
3161 | function getMaxContinuousCount(str, target) {
|
3162 | const results = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
|
3163 | if (results === null) {
|
3164 | return 0;
|
3165 | }
|
3166 | return results.reduce((maxCount, result) => Math.max(maxCount, result.length / target.length), 0);
|
3167 | }
|
3168 | function getMinNotPresentContinuousCount(str, target) {
|
3169 | const matches = str.match(new RegExp(`(${escapeStringRegexp2(target)})+`, "g"));
|
3170 | if (matches === null) {
|
3171 | return 0;
|
3172 | }
|
3173 | const countPresent = new Map();
|
3174 | let max = 0;
|
3175 | for (const match of matches) {
|
3176 | const count = match.length / target.length;
|
3177 | countPresent.set(count, true);
|
3178 | if (count > max) {
|
3179 | max = count;
|
3180 | }
|
3181 | }
|
3182 | for (let i = 1; i < max; i++) {
|
3183 | if (!countPresent.get(i)) {
|
3184 | return i;
|
3185 | }
|
3186 | }
|
3187 | return max + 1;
|
3188 | }
|
3189 | function addCommentHelper(node, comment) {
|
3190 | const comments = node.comments || (node.comments = []);
|
3191 | comments.push(comment);
|
3192 | comment.printed = false;
|
3193 | comment.nodeDescription = describeNodeForDebugging(node);
|
3194 | }
|
3195 | function addLeadingComment(node, comment) {
|
3196 | comment.leading = true;
|
3197 | comment.trailing = false;
|
3198 | addCommentHelper(node, comment);
|
3199 | }
|
3200 | function addDanglingComment(node, comment, marker) {
|
3201 | comment.leading = false;
|
3202 | comment.trailing = false;
|
3203 | if (marker) {
|
3204 | comment.marker = marker;
|
3205 | }
|
3206 | addCommentHelper(node, comment);
|
3207 | }
|
3208 | function addTrailingComment(node, comment) {
|
3209 | comment.leading = false;
|
3210 | comment.trailing = true;
|
3211 | addCommentHelper(node, comment);
|
3212 | }
|
3213 | function inferParserByLanguage(language, options) {
|
3214 | const {
|
3215 | languages
|
3216 | } = getSupportInfo2({
|
3217 | plugins: options.plugins
|
3218 | });
|
3219 | const matched = languages.find(({
|
3220 | name
|
3221 | }) => name.toLowerCase() === language) || languages.find(({
|
3222 | aliases
|
3223 | }) => Array.isArray(aliases) && aliases.includes(language)) || languages.find(({
|
3224 | extensions
|
3225 | }) => Array.isArray(extensions) && extensions.includes(`.${language}`));
|
3226 | return matched && matched.parsers[0];
|
3227 | }
|
3228 | function isFrontMatterNode(node) {
|
3229 | return node && node.type === "front-matter";
|
3230 | }
|
3231 | function createGroupIdMapper(description) {
|
3232 | const groupIds = new WeakMap();
|
3233 | return function(node) {
|
3234 | if (!groupIds.has(node)) {
|
3235 | groupIds.set(node, Symbol(description));
|
3236 | }
|
3237 | return groupIds.get(node);
|
3238 | };
|
3239 | }
|
3240 | function describeNodeForDebugging(node) {
|
3241 | const nodeType = node.type || node.kind || "(unknown type)";
|
3242 | let nodeName = String(node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || "");
|
3243 | if (nodeName.length > 20) {
|
3244 | nodeName = nodeName.slice(0, 19) + "\u2026";
|
3245 | }
|
3246 | return nodeType + (nodeName ? " " + nodeName : "");
|
3247 | }
|
3248 | module2.exports = {
|
3249 | inferParserByLanguage,
|
3250 | getStringWidth,
|
3251 | getMaxContinuousCount,
|
3252 | getMinNotPresentContinuousCount,
|
3253 | getPenultimate,
|
3254 | getLast,
|
3255 | getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
|
3256 | getNextNonSpaceNonCommentCharacterIndex,
|
3257 | getNextNonSpaceNonCommentCharacter,
|
3258 | skip,
|
3259 | skipWhitespace,
|
3260 | skipSpaces,
|
3261 | skipToLineEnd,
|
3262 | skipEverythingButNewLine,
|
3263 | skipInlineComment,
|
3264 | skipTrailingComment,
|
3265 | skipNewline,
|
3266 | isNextLineEmptyAfterIndex,
|
3267 | isNextLineEmpty,
|
3268 | isPreviousLineEmpty,
|
3269 | hasNewline,
|
3270 | hasNewlineInRange,
|
3271 | hasSpaces,
|
3272 | getAlignmentSize,
|
3273 | getIndentSize,
|
3274 | getPreferredQuote,
|
3275 | printString,
|
3276 | printNumber,
|
3277 | makeString,
|
3278 | addLeadingComment,
|
3279 | addDanglingComment,
|
3280 | addTrailingComment,
|
3281 | isFrontMatterNode,
|
3282 | isNonEmptyArray,
|
3283 | createGroupIdMapper
|
3284 | };
|
3285 | }
|
3286 | });
|
3287 | var require_end_of_line = __commonJS2({
|
3288 | "src/common/end-of-line.js"(exports2, module2) {
|
3289 | "use strict";
|
3290 | function guessEndOfLine(text) {
|
3291 | const index = text.indexOf("\r");
|
3292 | if (index >= 0) {
|
3293 | return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
|
3294 | }
|
3295 | return "lf";
|
3296 | }
|
3297 | function convertEndOfLineToChars(value) {
|
3298 | switch (value) {
|
3299 | case "cr":
|
3300 | return "\r";
|
3301 | case "crlf":
|
3302 | return "\r\n";
|
3303 | default:
|
3304 | return "\n";
|
3305 | }
|
3306 | }
|
3307 | function countEndOfLineChars(text, eol) {
|
3308 | let regex;
|
3309 | switch (eol) {
|
3310 | case "\n":
|
3311 | regex = /\n/g;
|
3312 | break;
|
3313 | case "\r":
|
3314 | regex = /\r/g;
|
3315 | break;
|
3316 | case "\r\n":
|
3317 | regex = /\r\n/g;
|
3318 | break;
|
3319 | default:
|
3320 | throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
|
3321 | }
|
3322 | const endOfLines = text.match(regex);
|
3323 | return endOfLines ? endOfLines.length : 0;
|
3324 | }
|
3325 | function normalizeEndOfLine(text) {
|
3326 | return text.replace(/\r\n?/g, "\n");
|
3327 | }
|
3328 | module2.exports = {
|
3329 | guessEndOfLine,
|
3330 | convertEndOfLineToChars,
|
3331 | countEndOfLineChars,
|
3332 | normalizeEndOfLine
|
3333 | };
|
3334 | }
|
3335 | });
|
3336 | var require_errors = __commonJS2({
|
3337 | "src/common/errors.js"(exports2, module2) {
|
3338 | "use strict";
|
3339 | var ConfigError = class extends Error {
|
3340 | };
|
3341 | var DebugError = class extends Error {
|
3342 | };
|
3343 | var UndefinedParserError = class extends Error {
|
3344 | };
|
3345 | var ArgExpansionBailout = class extends Error {
|
3346 | };
|
3347 | module2.exports = {
|
3348 | ConfigError,
|
3349 | DebugError,
|
3350 | UndefinedParserError,
|
3351 | ArgExpansionBailout
|
3352 | };
|
3353 | }
|
3354 | });
|
3355 | var tslib_es6_exports = {};
|
3356 | __export(tslib_es6_exports, {
|
3357 | __assign: () => __assign,
|
3358 | __asyncDelegator: () => __asyncDelegator,
|
3359 | __asyncGenerator: () => __asyncGenerator,
|
3360 | __asyncValues: () => __asyncValues,
|
3361 | __await: () => __await,
|
3362 | __awaiter: () => __awaiter,
|
3363 | __classPrivateFieldGet: () => __classPrivateFieldGet,
|
3364 | __classPrivateFieldSet: () => __classPrivateFieldSet,
|
3365 | __createBinding: () => __createBinding,
|
3366 | __decorate: () => __decorate,
|
3367 | __exportStar: () => __exportStar,
|
3368 | __extends: () => __extends,
|
3369 | __generator: () => __generator,
|
3370 | __importDefault: () => __importDefault,
|
3371 | __importStar: () => __importStar,
|
3372 | __makeTemplateObject: () => __makeTemplateObject,
|
3373 | __metadata: () => __metadata,
|
3374 | __param: () => __param,
|
3375 | __read: () => __read,
|
3376 | __rest: () => __rest,
|
3377 | __spread: () => __spread,
|
3378 | __spreadArrays: () => __spreadArrays,
|
3379 | __values: () => __values
|
3380 | });
|
3381 | function __extends(d, b) {
|
3382 | extendStatics(d, b);
|
3383 | function __() {
|
3384 | this.constructor = d;
|
3385 | }
|
3386 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
3387 | }
|
3388 | function __rest(s, e) {
|
3389 | var t = {};
|
3390 | for (var p in s)
|
3391 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
3392 | t[p] = s[p];
|
3393 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
3394 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
3395 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
3396 | t[p[i]] = s[p[i]];
|
3397 | }
|
3398 | return t;
|
3399 | }
|
3400 | function __decorate(decorators, target, key, desc) {
|
3401 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3402 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
3403 | r = Reflect.decorate(decorators, target, key, desc);
|
3404 | else
|
3405 | for (var i = decorators.length - 1; i >= 0; i--)
|
3406 | if (d = decorators[i])
|
3407 | r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
3408 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
3409 | }
|
3410 | function __param(paramIndex, decorator) {
|
3411 | return function(target, key) {
|
3412 | decorator(target, key, paramIndex);
|
3413 | };
|
3414 | }
|
3415 | function __metadata(metadataKey, metadataValue) {
|
3416 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
3417 | return Reflect.metadata(metadataKey, metadataValue);
|
3418 | }
|
3419 | function __awaiter(thisArg, _arguments, P, generator) {
|
3420 | function adopt(value) {
|
3421 | return value instanceof P ? value : new P(function(resolve) {
|
3422 | resolve(value);
|
3423 | });
|
3424 | }
|
3425 | return new (P || (P = Promise))(function(resolve, reject) {
|
3426 | function fulfilled(value) {
|
3427 | try {
|
3428 | step(generator.next(value));
|
3429 | } catch (e) {
|
3430 | reject(e);
|
3431 | }
|
3432 | }
|
3433 | function rejected(value) {
|
3434 | try {
|
3435 | step(generator["throw"](value));
|
3436 | } catch (e) {
|
3437 | reject(e);
|
3438 | }
|
3439 | }
|
3440 | function step(result) {
|
3441 | result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
3442 | }
|
3443 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
3444 | });
|
3445 | }
|
3446 | function __generator(thisArg, body) {
|
3447 | var _ = {
|
3448 | label: 0,
|
3449 | sent: function() {
|
3450 | if (t[0] & 1)
|
3451 | throw t[1];
|
3452 | return t[1];
|
3453 | },
|
3454 | trys: [],
|
3455 | ops: []
|
3456 | }, f, y, t, g;
|
3457 | return g = {
|
3458 | next: verb(0),
|
3459 | "throw": verb(1),
|
3460 | "return": verb(2)
|
3461 | }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
3462 | return this;
|
3463 | }), g;
|
3464 | function verb(n) {
|
3465 | return function(v) {
|
3466 | return step([n, v]);
|
3467 | };
|
3468 | }
|
3469 | function step(op) {
|
3470 | if (f)
|
3471 | throw new TypeError("Generator is already executing.");
|
3472 | while (_)
|
3473 | try {
|
3474 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
3475 | return t;
|
3476 | if (y = 0, t)
|
3477 | op = [op[0] & 2, t.value];
|
3478 | switch (op[0]) {
|
3479 | case 0:
|
3480 | case 1:
|
3481 | t = op;
|
3482 | break;
|
3483 | case 4:
|
3484 | _.label++;
|
3485 | return {
|
3486 | value: op[1],
|
3487 | done: false
|
3488 | };
|
3489 | case 5:
|
3490 | _.label++;
|
3491 | y = op[1];
|
3492 | op = [0];
|
3493 | continue;
|
3494 | case 7:
|
3495 | op = _.ops.pop();
|
3496 | _.trys.pop();
|
3497 | continue;
|
3498 | default:
|
3499 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
3500 | _ = 0;
|
3501 | continue;
|
3502 | }
|
3503 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
3504 | _.label = op[1];
|
3505 | break;
|
3506 | }
|
3507 | if (op[0] === 6 && _.label < t[1]) {
|
3508 | _.label = t[1];
|
3509 | t = op;
|
3510 | break;
|
3511 | }
|
3512 | if (t && _.label < t[2]) {
|
3513 | _.label = t[2];
|
3514 | _.ops.push(op);
|
3515 | break;
|
3516 | }
|
3517 | if (t[2])
|
3518 | _.ops.pop();
|
3519 | _.trys.pop();
|
3520 | continue;
|
3521 | }
|
3522 | op = body.call(thisArg, _);
|
3523 | } catch (e) {
|
3524 | op = [6, e];
|
3525 | y = 0;
|
3526 | } finally {
|
3527 | f = t = 0;
|
3528 | }
|
3529 | if (op[0] & 5)
|
3530 | throw op[1];
|
3531 | return {
|
3532 | value: op[0] ? op[1] : void 0,
|
3533 | done: true
|
3534 | };
|
3535 | }
|
3536 | }
|
3537 | function __createBinding(o, m, k, k2) {
|
3538 | if (k2 === void 0)
|
3539 | k2 = k;
|
3540 | o[k2] = m[k];
|
3541 | }
|
3542 | function __exportStar(m, exports2) {
|
3543 | for (var p in m)
|
3544 | if (p !== "default" && !exports2.hasOwnProperty(p))
|
3545 | exports2[p] = m[p];
|
3546 | }
|
3547 | function __values(o) {
|
3548 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
3549 | if (m)
|
3550 | return m.call(o);
|
3551 | if (o && typeof o.length === "number")
|
3552 | return {
|
3553 | next: function() {
|
3554 | if (o && i >= o.length)
|
3555 | o = void 0;
|
3556 | return {
|
3557 | value: o && o[i++],
|
3558 | done: !o
|
3559 | };
|
3560 | }
|
3561 | };
|
3562 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
3563 | }
|
3564 | function __read(o, n) {
|
3565 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
3566 | if (!m)
|
3567 | return o;
|
3568 | var i = m.call(o), r, ar = [], e;
|
3569 | try {
|
3570 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
3571 | ar.push(r.value);
|
3572 | } catch (error) {
|
3573 | e = {
|
3574 | error
|
3575 | };
|
3576 | } finally {
|
3577 | try {
|
3578 | if (r && !r.done && (m = i["return"]))
|
3579 | m.call(i);
|
3580 | } finally {
|
3581 | if (e)
|
3582 | throw e.error;
|
3583 | }
|
3584 | }
|
3585 | return ar;
|
3586 | }
|
3587 | function __spread() {
|
3588 | for (var ar = [], i = 0; i < arguments.length; i++)
|
3589 | ar = ar.concat(__read(arguments[i]));
|
3590 | return ar;
|
3591 | }
|
3592 | function __spreadArrays() {
|
3593 | for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
3594 | s += arguments[i].length;
|
3595 | for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
3596 | for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
3597 | r[k] = a[j];
|
3598 | return r;
|
3599 | }
|
3600 | function __await(v) {
|
3601 | return this instanceof __await ? (this.v = v, this) : new __await(v);
|
3602 | }
|
3603 | function __asyncGenerator(thisArg, _arguments, generator) {
|
3604 | if (!Symbol.asyncIterator)
|
3605 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
3606 | var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
3607 | return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
3608 | return this;
|
3609 | }, i;
|
3610 | function verb(n) {
|
3611 | if (g[n])
|
3612 | i[n] = function(v) {
|
3613 | return new Promise(function(a, b) {
|
3614 | q.push([n, v, a, b]) > 1 || resume(n, v);
|
3615 | });
|
3616 | };
|
3617 | }
|
3618 | function resume(n, v) {
|
3619 | try {
|
3620 | step(g[n](v));
|
3621 | } catch (e) {
|
3622 | settle(q[0][3], e);
|
3623 | }
|
3624 | }
|
3625 | function step(r) {
|
3626 | r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
3627 | }
|
3628 | function fulfill(value) {
|
3629 | resume("next", value);
|
3630 | }
|
3631 | function reject(value) {
|
3632 | resume("throw", value);
|
3633 | }
|
3634 | function settle(f, v) {
|
3635 | if (f(v), q.shift(), q.length)
|
3636 | resume(q[0][0], q[0][1]);
|
3637 | }
|
3638 | }
|
3639 | function __asyncDelegator(o) {
|
3640 | var i, p;
|
3641 | return i = {}, verb("next"), verb("throw", function(e) {
|
3642 | throw e;
|
3643 | }), verb("return"), i[Symbol.iterator] = function() {
|
3644 | return this;
|
3645 | }, i;
|
3646 | function verb(n, f) {
|
3647 | i[n] = o[n] ? function(v) {
|
3648 | return (p = !p) ? {
|
3649 | value: __await(o[n](v)),
|
3650 | done: n === "return"
|
3651 | } : f ? f(v) : v;
|
3652 | } : f;
|
3653 | }
|
3654 | }
|
3655 | function __asyncValues(o) {
|
3656 | if (!Symbol.asyncIterator)
|
3657 | throw new TypeError("Symbol.asyncIterator is not defined.");
|
3658 | var m = o[Symbol.asyncIterator], i;
|
3659 | return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
3660 | return this;
|
3661 | }, i);
|
3662 | function verb(n) {
|
3663 | i[n] = o[n] && function(v) {
|
3664 | return new Promise(function(resolve, reject) {
|
3665 | v = o[n](v), settle(resolve, reject, v.done, v.value);
|
3666 | });
|
3667 | };
|
3668 | }
|
3669 | function settle(resolve, reject, d, v) {
|
3670 | Promise.resolve(v).then(function(v2) {
|
3671 | resolve({
|
3672 | value: v2,
|
3673 | done: d
|
3674 | });
|
3675 | }, reject);
|
3676 | }
|
3677 | }
|
3678 | function __makeTemplateObject(cooked, raw) {
|
3679 | if (Object.defineProperty) {
|
3680 | Object.defineProperty(cooked, "raw", {
|
3681 | value: raw
|
3682 | });
|
3683 | } else {
|
3684 | cooked.raw = raw;
|
3685 | }
|
3686 | return cooked;
|
3687 | }
|
3688 | function __importStar(mod) {
|
3689 | if (mod && mod.__esModule)
|
3690 | return mod;
|
3691 | var result = {};
|
3692 | if (mod != null) {
|
3693 | for (var k in mod)
|
3694 | if (Object.hasOwnProperty.call(mod, k))
|
3695 | result[k] = mod[k];
|
3696 | }
|
3697 | result.default = mod;
|
3698 | return result;
|
3699 | }
|
3700 | function __importDefault(mod) {
|
3701 | return mod && mod.__esModule ? mod : {
|
3702 | default: mod
|
3703 | };
|
3704 | }
|
3705 | function __classPrivateFieldGet(receiver, privateMap) {
|
3706 | if (!privateMap.has(receiver)) {
|
3707 | throw new TypeError("attempted to get private field on non-instance");
|
3708 | }
|
3709 | return privateMap.get(receiver);
|
3710 | }
|
3711 | function __classPrivateFieldSet(receiver, privateMap, value) {
|
3712 | if (!privateMap.has(receiver)) {
|
3713 | throw new TypeError("attempted to set private field on non-instance");
|
3714 | }
|
3715 | privateMap.set(receiver, value);
|
3716 | return value;
|
3717 | }
|
3718 | var extendStatics;
|
3719 | var __assign;
|
3720 | var init_tslib_es6 = __esm({
|
3721 | "node_modules/tslib/tslib.es6.js"() {
|
3722 | extendStatics = function(d, b) {
|
3723 | extendStatics = Object.setPrototypeOf || {
|
3724 | __proto__: []
|
3725 | } instanceof Array && function(d2, b2) {
|
3726 | d2.__proto__ = b2;
|
3727 | } || function(d2, b2) {
|
3728 | for (var p in b2)
|
3729 | if (b2.hasOwnProperty(p))
|
3730 | d2[p] = b2[p];
|
3731 | };
|
3732 | return extendStatics(d, b);
|
3733 | };
|
3734 | __assign = function() {
|
3735 | __assign = Object.assign || function __assign2(t) {
|
3736 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
3737 | s = arguments[i];
|
3738 | for (var p in s)
|
3739 | if (Object.prototype.hasOwnProperty.call(s, p))
|
3740 | t[p] = s[p];
|
3741 | }
|
3742 | return t;
|
3743 | };
|
3744 | return __assign.apply(this, arguments);
|
3745 | };
|
3746 | }
|
3747 | });
|
3748 | var require_api = __commonJS2({
|
3749 | "node_modules/vnopts/lib/descriptors/api.js"(exports2) {
|
3750 | "use strict";
|
3751 | Object.defineProperty(exports2, "__esModule", {
|
3752 | value: true
|
3753 | });
|
3754 | exports2.apiDescriptor = {
|
3755 | key: (key) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key) ? key : JSON.stringify(key),
|
3756 | value(value) {
|
3757 | if (value === null || typeof value !== "object") {
|
3758 | return JSON.stringify(value);
|
3759 | }
|
3760 | if (Array.isArray(value)) {
|
3761 | return `[${value.map((subValue) => exports2.apiDescriptor.value(subValue)).join(", ")}]`;
|
3762 | }
|
3763 | const keys = Object.keys(value);
|
3764 | return keys.length === 0 ? "{}" : `{ ${keys.map((key) => `${exports2.apiDescriptor.key(key)}: ${exports2.apiDescriptor.value(value[key])}`).join(", ")} }`;
|
3765 | },
|
3766 | pair: ({
|
3767 | key,
|
3768 | value
|
3769 | }) => exports2.apiDescriptor.value({
|
3770 | [key]: value
|
3771 | })
|
3772 | };
|
3773 | }
|
3774 | });
|
3775 | var require_descriptors2 = __commonJS2({
|
3776 | "node_modules/vnopts/lib/descriptors/index.js"(exports2) {
|
3777 | "use strict";
|
3778 | Object.defineProperty(exports2, "__esModule", {
|
3779 | value: true
|
3780 | });
|
3781 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
3782 | tslib_1.__exportStar(require_api(), exports2);
|
3783 | }
|
3784 | });
|
3785 | var require_escape_string_regexp = __commonJS2({
|
3786 | "node_modules/vnopts/node_modules/escape-string-regexp/index.js"(exports2, module2) {
|
3787 | "use strict";
|
3788 | var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
3789 | module2.exports = function(str) {
|
3790 | if (typeof str !== "string") {
|
3791 | throw new TypeError("Expected a string");
|
3792 | }
|
3793 | return str.replace(matchOperatorsRe, "\\$&");
|
3794 | };
|
3795 | }
|
3796 | });
|
3797 | var require_color_name = __commonJS2({
|
3798 | "node_modules/color-name/index.js"(exports2, module2) {
|
3799 | "use strict";
|
3800 | module2.exports = {
|
3801 | "aliceblue": [240, 248, 255],
|
3802 | "antiquewhite": [250, 235, 215],
|
3803 | "aqua": [0, 255, 255],
|
3804 | "aquamarine": [127, 255, 212],
|
3805 | "azure": [240, 255, 255],
|
3806 | "beige": [245, 245, 220],
|
3807 | "bisque": [255, 228, 196],
|
3808 | "black": [0, 0, 0],
|
3809 | "blanchedalmond": [255, 235, 205],
|
3810 | "blue": [0, 0, 255],
|
3811 | "blueviolet": [138, 43, 226],
|
3812 | "brown": [165, 42, 42],
|
3813 | "burlywood": [222, 184, 135],
|
3814 | "cadetblue": [95, 158, 160],
|
3815 | "chartreuse": [127, 255, 0],
|
3816 | "chocolate": [210, 105, 30],
|
3817 | "coral": [255, 127, 80],
|
3818 | "cornflowerblue": [100, 149, 237],
|
3819 | "cornsilk": [255, 248, 220],
|
3820 | "crimson": [220, 20, 60],
|
3821 | "cyan": [0, 255, 255],
|
3822 | "darkblue": [0, 0, 139],
|
3823 | "darkcyan": [0, 139, 139],
|
3824 | "darkgoldenrod": [184, 134, 11],
|
3825 | "darkgray": [169, 169, 169],
|
3826 | "darkgreen": [0, 100, 0],
|
3827 | "darkgrey": [169, 169, 169],
|
3828 | "darkkhaki": [189, 183, 107],
|
3829 | "darkmagenta": [139, 0, 139],
|
3830 | "darkolivegreen": [85, 107, 47],
|
3831 | "darkorange": [255, 140, 0],
|
3832 | "darkorchid": [153, 50, 204],
|
3833 | "darkred": [139, 0, 0],
|
3834 | "darksalmon": [233, 150, 122],
|
3835 | "darkseagreen": [143, 188, 143],
|
3836 | "darkslateblue": [72, 61, 139],
|
3837 | "darkslategray": [47, 79, 79],
|
3838 | "darkslategrey": [47, 79, 79],
|
3839 | "darkturquoise": [0, 206, 209],
|
3840 | "darkviolet": [148, 0, 211],
|
3841 | "deeppink": [255, 20, 147],
|
3842 | "deepskyblue": [0, 191, 255],
|
3843 | "dimgray": [105, 105, 105],
|
3844 | "dimgrey": [105, 105, 105],
|
3845 | "dodgerblue": [30, 144, 255],
|
3846 | "firebrick": [178, 34, 34],
|
3847 | "floralwhite": [255, 250, 240],
|
3848 | "forestgreen": [34, 139, 34],
|
3849 | "fuchsia": [255, 0, 255],
|
3850 | "gainsboro": [220, 220, 220],
|
3851 | "ghostwhite": [248, 248, 255],
|
3852 | "gold": [255, 215, 0],
|
3853 | "goldenrod": [218, 165, 32],
|
3854 | "gray": [128, 128, 128],
|
3855 | "green": [0, 128, 0],
|
3856 | "greenyellow": [173, 255, 47],
|
3857 | "grey": [128, 128, 128],
|
3858 | "honeydew": [240, 255, 240],
|
3859 | "hotpink": [255, 105, 180],
|
3860 | "indianred": [205, 92, 92],
|
3861 | "indigo": [75, 0, 130],
|
3862 | "ivory": [255, 255, 240],
|
3863 | "khaki": [240, 230, 140],
|
3864 | "lavender": [230, 230, 250],
|
3865 | "lavenderblush": [255, 240, 245],
|
3866 | "lawngreen": [124, 252, 0],
|
3867 | "lemonchiffon": [255, 250, 205],
|
3868 | "lightblue": [173, 216, 230],
|
3869 | "lightcoral": [240, 128, 128],
|
3870 | "lightcyan": [224, 255, 255],
|
3871 | "lightgoldenrodyellow": [250, 250, 210],
|
3872 | "lightgray": [211, 211, 211],
|
3873 | "lightgreen": [144, 238, 144],
|
3874 | "lightgrey": [211, 211, 211],
|
3875 | "lightpink": [255, 182, 193],
|
3876 | "lightsalmon": [255, 160, 122],
|
3877 | "lightseagreen": [32, 178, 170],
|
3878 | "lightskyblue": [135, 206, 250],
|
3879 | "lightslategray": [119, 136, 153],
|
3880 | "lightslategrey": [119, 136, 153],
|
3881 | "lightsteelblue": [176, 196, 222],
|
3882 | "lightyellow": [255, 255, 224],
|
3883 | "lime": [0, 255, 0],
|
3884 | "limegreen": [50, 205, 50],
|
3885 | "linen": [250, 240, 230],
|
3886 | "magenta": [255, 0, 255],
|
3887 | "maroon": [128, 0, 0],
|
3888 | "mediumaquamarine": [102, 205, 170],
|
3889 | "mediumblue": [0, 0, 205],
|
3890 | "mediumorchid": [186, 85, 211],
|
3891 | "mediumpurple": [147, 112, 219],
|
3892 | "mediumseagreen": [60, 179, 113],
|
3893 | "mediumslateblue": [123, 104, 238],
|
3894 | "mediumspringgreen": [0, 250, 154],
|
3895 | "mediumturquoise": [72, 209, 204],
|
3896 | "mediumvioletred": [199, 21, 133],
|
3897 | "midnightblue": [25, 25, 112],
|
3898 | "mintcream": [245, 255, 250],
|
3899 | "mistyrose": [255, 228, 225],
|
3900 | "moccasin": [255, 228, 181],
|
3901 | "navajowhite": [255, 222, 173],
|
3902 | "navy": [0, 0, 128],
|
3903 | "oldlace": [253, 245, 230],
|
3904 | "olive": [128, 128, 0],
|
3905 | "olivedrab": [107, 142, 35],
|
3906 | "orange": [255, 165, 0],
|
3907 | "orangered": [255, 69, 0],
|
3908 | "orchid": [218, 112, 214],
|
3909 | "palegoldenrod": [238, 232, 170],
|
3910 | "palegreen": [152, 251, 152],
|
3911 | "paleturquoise": [175, 238, 238],
|
3912 | "palevioletred": [219, 112, 147],
|
3913 | "papayawhip": [255, 239, 213],
|
3914 | "peachpuff": [255, 218, 185],
|
3915 | "peru": [205, 133, 63],
|
3916 | "pink": [255, 192, 203],
|
3917 | "plum": [221, 160, 221],
|
3918 | "powderblue": [176, 224, 230],
|
3919 | "purple": [128, 0, 128],
|
3920 | "rebeccapurple": [102, 51, 153],
|
3921 | "red": [255, 0, 0],
|
3922 | "rosybrown": [188, 143, 143],
|
3923 | "royalblue": [65, 105, 225],
|
3924 | "saddlebrown": [139, 69, 19],
|
3925 | "salmon": [250, 128, 114],
|
3926 | "sandybrown": [244, 164, 96],
|
3927 | "seagreen": [46, 139, 87],
|
3928 | "seashell": [255, 245, 238],
|
3929 | "sienna": [160, 82, 45],
|
3930 | "silver": [192, 192, 192],
|
3931 | "skyblue": [135, 206, 235],
|
3932 | "slateblue": [106, 90, 205],
|
3933 | "slategray": [112, 128, 144],
|
3934 | "slategrey": [112, 128, 144],
|
3935 | "snow": [255, 250, 250],
|
3936 | "springgreen": [0, 255, 127],
|
3937 | "steelblue": [70, 130, 180],
|
3938 | "tan": [210, 180, 140],
|
3939 | "teal": [0, 128, 128],
|
3940 | "thistle": [216, 191, 216],
|
3941 | "tomato": [255, 99, 71],
|
3942 | "turquoise": [64, 224, 208],
|
3943 | "violet": [238, 130, 238],
|
3944 | "wheat": [245, 222, 179],
|
3945 | "white": [255, 255, 255],
|
3946 | "whitesmoke": [245, 245, 245],
|
3947 | "yellow": [255, 255, 0],
|
3948 | "yellowgreen": [154, 205, 50]
|
3949 | };
|
3950 | }
|
3951 | });
|
3952 | var require_conversions = __commonJS2({
|
3953 | "node_modules/color-convert/conversions.js"(exports2, module2) {
|
3954 | var cssKeywords = require_color_name();
|
3955 | var reverseKeywords = {};
|
3956 | for (key in cssKeywords) {
|
3957 | if (cssKeywords.hasOwnProperty(key)) {
|
3958 | reverseKeywords[cssKeywords[key]] = key;
|
3959 | }
|
3960 | }
|
3961 | var key;
|
3962 | var convert = module2.exports = {
|
3963 | rgb: {
|
3964 | channels: 3,
|
3965 | labels: "rgb"
|
3966 | },
|
3967 | hsl: {
|
3968 | channels: 3,
|
3969 | labels: "hsl"
|
3970 | },
|
3971 | hsv: {
|
3972 | channels: 3,
|
3973 | labels: "hsv"
|
3974 | },
|
3975 | hwb: {
|
3976 | channels: 3,
|
3977 | labels: "hwb"
|
3978 | },
|
3979 | cmyk: {
|
3980 | channels: 4,
|
3981 | labels: "cmyk"
|
3982 | },
|
3983 | xyz: {
|
3984 | channels: 3,
|
3985 | labels: "xyz"
|
3986 | },
|
3987 | lab: {
|
3988 | channels: 3,
|
3989 | labels: "lab"
|
3990 | },
|
3991 | lch: {
|
3992 | channels: 3,
|
3993 | labels: "lch"
|
3994 | },
|
3995 | hex: {
|
3996 | channels: 1,
|
3997 | labels: ["hex"]
|
3998 | },
|
3999 | keyword: {
|
4000 | channels: 1,
|
4001 | labels: ["keyword"]
|
4002 | },
|
4003 | ansi16: {
|
4004 | channels: 1,
|
4005 | labels: ["ansi16"]
|
4006 | },
|
4007 | ansi256: {
|
4008 | channels: 1,
|
4009 | labels: ["ansi256"]
|
4010 | },
|
4011 | hcg: {
|
4012 | channels: 3,
|
4013 | labels: ["h", "c", "g"]
|
4014 | },
|
4015 | apple: {
|
4016 | channels: 3,
|
4017 | labels: ["r16", "g16", "b16"]
|
4018 | },
|
4019 | gray: {
|
4020 | channels: 1,
|
4021 | labels: ["gray"]
|
4022 | }
|
4023 | };
|
4024 | for (model in convert) {
|
4025 | if (convert.hasOwnProperty(model)) {
|
4026 | if (!("channels" in convert[model])) {
|
4027 | throw new Error("missing channels property: " + model);
|
4028 | }
|
4029 | if (!("labels" in convert[model])) {
|
4030 | throw new Error("missing channel labels property: " + model);
|
4031 | }
|
4032 | if (convert[model].labels.length !== convert[model].channels) {
|
4033 | throw new Error("channel and label counts mismatch: " + model);
|
4034 | }
|
4035 | channels = convert[model].channels;
|
4036 | labels = convert[model].labels;
|
4037 | delete convert[model].channels;
|
4038 | delete convert[model].labels;
|
4039 | Object.defineProperty(convert[model], "channels", {
|
4040 | value: channels
|
4041 | });
|
4042 | Object.defineProperty(convert[model], "labels", {
|
4043 | value: labels
|
4044 | });
|
4045 | }
|
4046 | }
|
4047 | var channels;
|
4048 | var labels;
|
4049 | var model;
|
4050 | convert.rgb.hsl = function(rgb) {
|
4051 | var r = rgb[0] / 255;
|
4052 | var g = rgb[1] / 255;
|
4053 | var b = rgb[2] / 255;
|
4054 | var min = Math.min(r, g, b);
|
4055 | var max = Math.max(r, g, b);
|
4056 | var delta = max - min;
|
4057 | var h;
|
4058 | var s;
|
4059 | var l;
|
4060 | if (max === min) {
|
4061 | h = 0;
|
4062 | } else if (r === max) {
|
4063 | h = (g - b) / delta;
|
4064 | } else if (g === max) {
|
4065 | h = 2 + (b - r) / delta;
|
4066 | } else if (b === max) {
|
4067 | h = 4 + (r - g) / delta;
|
4068 | }
|
4069 | h = Math.min(h * 60, 360);
|
4070 | if (h < 0) {
|
4071 | h += 360;
|
4072 | }
|
4073 | l = (min + max) / 2;
|
4074 | if (max === min) {
|
4075 | s = 0;
|
4076 | } else if (l <= 0.5) {
|
4077 | s = delta / (max + min);
|
4078 | } else {
|
4079 | s = delta / (2 - max - min);
|
4080 | }
|
4081 | return [h, s * 100, l * 100];
|
4082 | };
|
4083 | convert.rgb.hsv = function(rgb) {
|
4084 | var rdif;
|
4085 | var gdif;
|
4086 | var bdif;
|
4087 | var h;
|
4088 | var s;
|
4089 | var r = rgb[0] / 255;
|
4090 | var g = rgb[1] / 255;
|
4091 | var b = rgb[2] / 255;
|
4092 | var v = Math.max(r, g, b);
|
4093 | var diff = v - Math.min(r, g, b);
|
4094 | var diffc = function(c) {
|
4095 | return (v - c) / 6 / diff + 1 / 2;
|
4096 | };
|
4097 | if (diff === 0) {
|
4098 | h = s = 0;
|
4099 | } else {
|
4100 | s = diff / v;
|
4101 | rdif = diffc(r);
|
4102 | gdif = diffc(g);
|
4103 | bdif = diffc(b);
|
4104 | if (r === v) {
|
4105 | h = bdif - gdif;
|
4106 | } else if (g === v) {
|
4107 | h = 1 / 3 + rdif - bdif;
|
4108 | } else if (b === v) {
|
4109 | h = 2 / 3 + gdif - rdif;
|
4110 | }
|
4111 | if (h < 0) {
|
4112 | h += 1;
|
4113 | } else if (h > 1) {
|
4114 | h -= 1;
|
4115 | }
|
4116 | }
|
4117 | return [h * 360, s * 100, v * 100];
|
4118 | };
|
4119 | convert.rgb.hwb = function(rgb) {
|
4120 | var r = rgb[0];
|
4121 | var g = rgb[1];
|
4122 | var b = rgb[2];
|
4123 | var h = convert.rgb.hsl(rgb)[0];
|
4124 | var w = 1 / 255 * Math.min(r, Math.min(g, b));
|
4125 | b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
4126 | return [h, w * 100, b * 100];
|
4127 | };
|
4128 | convert.rgb.cmyk = function(rgb) {
|
4129 | var r = rgb[0] / 255;
|
4130 | var g = rgb[1] / 255;
|
4131 | var b = rgb[2] / 255;
|
4132 | var c;
|
4133 | var m;
|
4134 | var y;
|
4135 | var k;
|
4136 | k = Math.min(1 - r, 1 - g, 1 - b);
|
4137 | c = (1 - r - k) / (1 - k) || 0;
|
4138 | m = (1 - g - k) / (1 - k) || 0;
|
4139 | y = (1 - b - k) / (1 - k) || 0;
|
4140 | return [c * 100, m * 100, y * 100, k * 100];
|
4141 | };
|
4142 | function comparativeDistance(x, y) {
|
4143 | return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
|
4144 | }
|
4145 | convert.rgb.keyword = function(rgb) {
|
4146 | var reversed = reverseKeywords[rgb];
|
4147 | if (reversed) {
|
4148 | return reversed;
|
4149 | }
|
4150 | var currentClosestDistance = Infinity;
|
4151 | var currentClosestKeyword;
|
4152 | for (var keyword in cssKeywords) {
|
4153 | if (cssKeywords.hasOwnProperty(keyword)) {
|
4154 | var value = cssKeywords[keyword];
|
4155 | var distance = comparativeDistance(rgb, value);
|
4156 | if (distance < currentClosestDistance) {
|
4157 | currentClosestDistance = distance;
|
4158 | currentClosestKeyword = keyword;
|
4159 | }
|
4160 | }
|
4161 | }
|
4162 | return currentClosestKeyword;
|
4163 | };
|
4164 | convert.keyword.rgb = function(keyword) {
|
4165 | return cssKeywords[keyword];
|
4166 | };
|
4167 | convert.rgb.xyz = function(rgb) {
|
4168 | var r = rgb[0] / 255;
|
4169 | var g = rgb[1] / 255;
|
4170 | var b = rgb[2] / 255;
|
4171 | r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
|
4172 | g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
|
4173 | b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
|
4174 | var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
4175 | var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
4176 | var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
4177 | return [x * 100, y * 100, z * 100];
|
4178 | };
|
4179 | convert.rgb.lab = function(rgb) {
|
4180 | var xyz = convert.rgb.xyz(rgb);
|
4181 | var x = xyz[0];
|
4182 | var y = xyz[1];
|
4183 | var z = xyz[2];
|
4184 | var l;
|
4185 | var a;
|
4186 | var b;
|
4187 | x /= 95.047;
|
4188 | y /= 100;
|
4189 | z /= 108.883;
|
4190 | x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
4191 | y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
4192 | z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
|
4193 | l = 116 * y - 16;
|
4194 | a = 500 * (x - y);
|
4195 | b = 200 * (y - z);
|
4196 | return [l, a, b];
|
4197 | };
|
4198 | convert.hsl.rgb = function(hsl) {
|
4199 | var h = hsl[0] / 360;
|
4200 | var s = hsl[1] / 100;
|
4201 | var l = hsl[2] / 100;
|
4202 | var t1;
|
4203 | var t2;
|
4204 | var t3;
|
4205 | var rgb;
|
4206 | var val;
|
4207 | if (s === 0) {
|
4208 | val = l * 255;
|
4209 | return [val, val, val];
|
4210 | }
|
4211 | if (l < 0.5) {
|
4212 | t2 = l * (1 + s);
|
4213 | } else {
|
4214 | t2 = l + s - l * s;
|
4215 | }
|
4216 | t1 = 2 * l - t2;
|
4217 | rgb = [0, 0, 0];
|
4218 | for (var i = 0; i < 3; i++) {
|
4219 | t3 = h + 1 / 3 * -(i - 1);
|
4220 | if (t3 < 0) {
|
4221 | t3++;
|
4222 | }
|
4223 | if (t3 > 1) {
|
4224 | t3--;
|
4225 | }
|
4226 | if (6 * t3 < 1) {
|
4227 | val = t1 + (t2 - t1) * 6 * t3;
|
4228 | } else if (2 * t3 < 1) {
|
4229 | val = t2;
|
4230 | } else if (3 * t3 < 2) {
|
4231 | val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
4232 | } else {
|
4233 | val = t1;
|
4234 | }
|
4235 | rgb[i] = val * 255;
|
4236 | }
|
4237 | return rgb;
|
4238 | };
|
4239 | convert.hsl.hsv = function(hsl) {
|
4240 | var h = hsl[0];
|
4241 | var s = hsl[1] / 100;
|
4242 | var l = hsl[2] / 100;
|
4243 | var smin = s;
|
4244 | var lmin = Math.max(l, 0.01);
|
4245 | var sv;
|
4246 | var v;
|
4247 | l *= 2;
|
4248 | s *= l <= 1 ? l : 2 - l;
|
4249 | smin *= lmin <= 1 ? lmin : 2 - lmin;
|
4250 | v = (l + s) / 2;
|
4251 | sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
4252 | return [h, sv * 100, v * 100];
|
4253 | };
|
4254 | convert.hsv.rgb = function(hsv) {
|
4255 | var h = hsv[0] / 60;
|
4256 | var s = hsv[1] / 100;
|
4257 | var v = hsv[2] / 100;
|
4258 | var hi = Math.floor(h) % 6;
|
4259 | var f = h - Math.floor(h);
|
4260 | var p = 255 * v * (1 - s);
|
4261 | var q = 255 * v * (1 - s * f);
|
4262 | var t = 255 * v * (1 - s * (1 - f));
|
4263 | v *= 255;
|
4264 | switch (hi) {
|
4265 | case 0:
|
4266 | return [v, t, p];
|
4267 | case 1:
|
4268 | return [q, v, p];
|
4269 | case 2:
|
4270 | return [p, v, t];
|
4271 | case 3:
|
4272 | return [p, q, v];
|
4273 | case 4:
|
4274 | return [t, p, v];
|
4275 | case 5:
|
4276 | return [v, p, q];
|
4277 | }
|
4278 | };
|
4279 | convert.hsv.hsl = function(hsv) {
|
4280 | var h = hsv[0];
|
4281 | var s = hsv[1] / 100;
|
4282 | var v = hsv[2] / 100;
|
4283 | var vmin = Math.max(v, 0.01);
|
4284 | var lmin;
|
4285 | var sl;
|
4286 | var l;
|
4287 | l = (2 - s) * v;
|
4288 | lmin = (2 - s) * vmin;
|
4289 | sl = s * vmin;
|
4290 | sl /= lmin <= 1 ? lmin : 2 - lmin;
|
4291 | sl = sl || 0;
|
4292 | l /= 2;
|
4293 | return [h, sl * 100, l * 100];
|
4294 | };
|
4295 | convert.hwb.rgb = function(hwb) {
|
4296 | var h = hwb[0] / 360;
|
4297 | var wh = hwb[1] / 100;
|
4298 | var bl = hwb[2] / 100;
|
4299 | var ratio = wh + bl;
|
4300 | var i;
|
4301 | var v;
|
4302 | var f;
|
4303 | var n;
|
4304 | if (ratio > 1) {
|
4305 | wh /= ratio;
|
4306 | bl /= ratio;
|
4307 | }
|
4308 | i = Math.floor(6 * h);
|
4309 | v = 1 - bl;
|
4310 | f = 6 * h - i;
|
4311 | if ((i & 1) !== 0) {
|
4312 | f = 1 - f;
|
4313 | }
|
4314 | n = wh + f * (v - wh);
|
4315 | var r;
|
4316 | var g;
|
4317 | var b;
|
4318 | switch (i) {
|
4319 | default:
|
4320 | case 6:
|
4321 | case 0:
|
4322 | r = v;
|
4323 | g = n;
|
4324 | b = wh;
|
4325 | break;
|
4326 | case 1:
|
4327 | r = n;
|
4328 | g = v;
|
4329 | b = wh;
|
4330 | break;
|
4331 | case 2:
|
4332 | r = wh;
|
4333 | g = v;
|
4334 | b = n;
|
4335 | break;
|
4336 | case 3:
|
4337 | r = wh;
|
4338 | g = n;
|
4339 | b = v;
|
4340 | break;
|
4341 | case 4:
|
4342 | r = n;
|
4343 | g = wh;
|
4344 | b = v;
|
4345 | break;
|
4346 | case 5:
|
4347 | r = v;
|
4348 | g = wh;
|
4349 | b = n;
|
4350 | break;
|
4351 | }
|
4352 | return [r * 255, g * 255, b * 255];
|
4353 | };
|
4354 | convert.cmyk.rgb = function(cmyk) {
|
4355 | var c = cmyk[0] / 100;
|
4356 | var m = cmyk[1] / 100;
|
4357 | var y = cmyk[2] / 100;
|
4358 | var k = cmyk[3] / 100;
|
4359 | var r;
|
4360 | var g;
|
4361 | var b;
|
4362 | r = 1 - Math.min(1, c * (1 - k) + k);
|
4363 | g = 1 - Math.min(1, m * (1 - k) + k);
|
4364 | b = 1 - Math.min(1, y * (1 - k) + k);
|
4365 | return [r * 255, g * 255, b * 255];
|
4366 | };
|
4367 | convert.xyz.rgb = function(xyz) {
|
4368 | var x = xyz[0] / 100;
|
4369 | var y = xyz[1] / 100;
|
4370 | var z = xyz[2] / 100;
|
4371 | var r;
|
4372 | var g;
|
4373 | var b;
|
4374 | r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
4375 | g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
4376 | b = x * 0.0557 + y * -0.204 + z * 1.057;
|
4377 | r = r > 31308e-7 ? 1.055 * Math.pow(r, 1 / 2.4) - 0.055 : r * 12.92;
|
4378 | g = g > 31308e-7 ? 1.055 * Math.pow(g, 1 / 2.4) - 0.055 : g * 12.92;
|
4379 | b = b > 31308e-7 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : b * 12.92;
|
4380 | r = Math.min(Math.max(0, r), 1);
|
4381 | g = Math.min(Math.max(0, g), 1);
|
4382 | b = Math.min(Math.max(0, b), 1);
|
4383 | return [r * 255, g * 255, b * 255];
|
4384 | };
|
4385 | convert.xyz.lab = function(xyz) {
|
4386 | var x = xyz[0];
|
4387 | var y = xyz[1];
|
4388 | var z = xyz[2];
|
4389 | var l;
|
4390 | var a;
|
4391 | var b;
|
4392 | x /= 95.047;
|
4393 | y /= 100;
|
4394 | z /= 108.883;
|
4395 | x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
|
4396 | y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
|
4397 | z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
|
4398 | l = 116 * y - 16;
|
4399 | a = 500 * (x - y);
|
4400 | b = 200 * (y - z);
|
4401 | return [l, a, b];
|
4402 | };
|
4403 | convert.lab.xyz = function(lab) {
|
4404 | var l = lab[0];
|
4405 | var a = lab[1];
|
4406 | var b = lab[2];
|
4407 | var x;
|
4408 | var y;
|
4409 | var z;
|
4410 | y = (l + 16) / 116;
|
4411 | x = a / 500 + y;
|
4412 | z = y - b / 200;
|
4413 | var y2 = Math.pow(y, 3);
|
4414 | var x2 = Math.pow(x, 3);
|
4415 | var z2 = Math.pow(z, 3);
|
4416 | y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
4417 | x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
4418 | z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
4419 | x *= 95.047;
|
4420 | y *= 100;
|
4421 | z *= 108.883;
|
4422 | return [x, y, z];
|
4423 | };
|
4424 | convert.lab.lch = function(lab) {
|
4425 | var l = lab[0];
|
4426 | var a = lab[1];
|
4427 | var b = lab[2];
|
4428 | var hr;
|
4429 | var h;
|
4430 | var c;
|
4431 | hr = Math.atan2(b, a);
|
4432 | h = hr * 360 / 2 / Math.PI;
|
4433 | if (h < 0) {
|
4434 | h += 360;
|
4435 | }
|
4436 | c = Math.sqrt(a * a + b * b);
|
4437 | return [l, c, h];
|
4438 | };
|
4439 | convert.lch.lab = function(lch) {
|
4440 | var l = lch[0];
|
4441 | var c = lch[1];
|
4442 | var h = lch[2];
|
4443 | var a;
|
4444 | var b;
|
4445 | var hr;
|
4446 | hr = h / 360 * 2 * Math.PI;
|
4447 | a = c * Math.cos(hr);
|
4448 | b = c * Math.sin(hr);
|
4449 | return [l, a, b];
|
4450 | };
|
4451 | convert.rgb.ansi16 = function(args) {
|
4452 | var r = args[0];
|
4453 | var g = args[1];
|
4454 | var b = args[2];
|
4455 | var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2];
|
4456 | value = Math.round(value / 50);
|
4457 | if (value === 0) {
|
4458 | return 30;
|
4459 | }
|
4460 | var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
4461 | if (value === 2) {
|
4462 | ansi += 60;
|
4463 | }
|
4464 | return ansi;
|
4465 | };
|
4466 | convert.hsv.ansi16 = function(args) {
|
4467 | return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
4468 | };
|
4469 | convert.rgb.ansi256 = function(args) {
|
4470 | var r = args[0];
|
4471 | var g = args[1];
|
4472 | var b = args[2];
|
4473 | if (r === g && g === b) {
|
4474 | if (r < 8) {
|
4475 | return 16;
|
4476 | }
|
4477 | if (r > 248) {
|
4478 | return 231;
|
4479 | }
|
4480 | return Math.round((r - 8) / 247 * 24) + 232;
|
4481 | }
|
4482 | var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
4483 | return ansi;
|
4484 | };
|
4485 | convert.ansi16.rgb = function(args) {
|
4486 | var color = args % 10;
|
4487 | if (color === 0 || color === 7) {
|
4488 | if (args > 50) {
|
4489 | color += 3.5;
|
4490 | }
|
4491 | color = color / 10.5 * 255;
|
4492 | return [color, color, color];
|
4493 | }
|
4494 | var mult = (~~(args > 50) + 1) * 0.5;
|
4495 | var r = (color & 1) * mult * 255;
|
4496 | var g = (color >> 1 & 1) * mult * 255;
|
4497 | var b = (color >> 2 & 1) * mult * 255;
|
4498 | return [r, g, b];
|
4499 | };
|
4500 | convert.ansi256.rgb = function(args) {
|
4501 | if (args >= 232) {
|
4502 | var c = (args - 232) * 10 + 8;
|
4503 | return [c, c, c];
|
4504 | }
|
4505 | args -= 16;
|
4506 | var rem;
|
4507 | var r = Math.floor(args / 36) / 5 * 255;
|
4508 | var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
4509 | var b = rem % 6 / 5 * 255;
|
4510 | return [r, g, b];
|
4511 | };
|
4512 | convert.rgb.hex = function(args) {
|
4513 | var integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
4514 | var string = integer.toString(16).toUpperCase();
|
4515 | return "000000".substring(string.length) + string;
|
4516 | };
|
4517 | convert.hex.rgb = function(args) {
|
4518 | var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
4519 | if (!match) {
|
4520 | return [0, 0, 0];
|
4521 | }
|
4522 | var colorString = match[0];
|
4523 | if (match[0].length === 3) {
|
4524 | colorString = colorString.split("").map(function(char) {
|
4525 | return char + char;
|
4526 | }).join("");
|
4527 | }
|
4528 | var integer = parseInt(colorString, 16);
|
4529 | var r = integer >> 16 & 255;
|
4530 | var g = integer >> 8 & 255;
|
4531 | var b = integer & 255;
|
4532 | return [r, g, b];
|
4533 | };
|
4534 | convert.rgb.hcg = function(rgb) {
|
4535 | var r = rgb[0] / 255;
|
4536 | var g = rgb[1] / 255;
|
4537 | var b = rgb[2] / 255;
|
4538 | var max = Math.max(Math.max(r, g), b);
|
4539 | var min = Math.min(Math.min(r, g), b);
|
4540 | var chroma = max - min;
|
4541 | var grayscale;
|
4542 | var hue;
|
4543 | if (chroma < 1) {
|
4544 | grayscale = min / (1 - chroma);
|
4545 | } else {
|
4546 | grayscale = 0;
|
4547 | }
|
4548 | if (chroma <= 0) {
|
4549 | hue = 0;
|
4550 | } else if (max === r) {
|
4551 | hue = (g - b) / chroma % 6;
|
4552 | } else if (max === g) {
|
4553 | hue = 2 + (b - r) / chroma;
|
4554 | } else {
|
4555 | hue = 4 + (r - g) / chroma + 4;
|
4556 | }
|
4557 | hue /= 6;
|
4558 | hue %= 1;
|
4559 | return [hue * 360, chroma * 100, grayscale * 100];
|
4560 | };
|
4561 | convert.hsl.hcg = function(hsl) {
|
4562 | var s = hsl[1] / 100;
|
4563 | var l = hsl[2] / 100;
|
4564 | var c = 1;
|
4565 | var f = 0;
|
4566 | if (l < 0.5) {
|
4567 | c = 2 * s * l;
|
4568 | } else {
|
4569 | c = 2 * s * (1 - l);
|
4570 | }
|
4571 | if (c < 1) {
|
4572 | f = (l - 0.5 * c) / (1 - c);
|
4573 | }
|
4574 | return [hsl[0], c * 100, f * 100];
|
4575 | };
|
4576 | convert.hsv.hcg = function(hsv) {
|
4577 | var s = hsv[1] / 100;
|
4578 | var v = hsv[2] / 100;
|
4579 | var c = s * v;
|
4580 | var f = 0;
|
4581 | if (c < 1) {
|
4582 | f = (v - c) / (1 - c);
|
4583 | }
|
4584 | return [hsv[0], c * 100, f * 100];
|
4585 | };
|
4586 | convert.hcg.rgb = function(hcg) {
|
4587 | var h = hcg[0] / 360;
|
4588 | var c = hcg[1] / 100;
|
4589 | var g = hcg[2] / 100;
|
4590 | if (c === 0) {
|
4591 | return [g * 255, g * 255, g * 255];
|
4592 | }
|
4593 | var pure = [0, 0, 0];
|
4594 | var hi = h % 1 * 6;
|
4595 | var v = hi % 1;
|
4596 | var w = 1 - v;
|
4597 | var mg = 0;
|
4598 | switch (Math.floor(hi)) {
|
4599 | case 0:
|
4600 | pure[0] = 1;
|
4601 | pure[1] = v;
|
4602 | pure[2] = 0;
|
4603 | break;
|
4604 | case 1:
|
4605 | pure[0] = w;
|
4606 | pure[1] = 1;
|
4607 | pure[2] = 0;
|
4608 | break;
|
4609 | case 2:
|
4610 | pure[0] = 0;
|
4611 | pure[1] = 1;
|
4612 | pure[2] = v;
|
4613 | break;
|
4614 | case 3:
|
4615 | pure[0] = 0;
|
4616 | pure[1] = w;
|
4617 | pure[2] = 1;
|
4618 | break;
|
4619 | case 4:
|
4620 | pure[0] = v;
|
4621 | pure[1] = 0;
|
4622 | pure[2] = 1;
|
4623 | break;
|
4624 | default:
|
4625 | pure[0] = 1;
|
4626 | pure[1] = 0;
|
4627 | pure[2] = w;
|
4628 | }
|
4629 | mg = (1 - c) * g;
|
4630 | return [(c * pure[0] + mg) * 255, (c * pure[1] + mg) * 255, (c * pure[2] + mg) * 255];
|
4631 | };
|
4632 | convert.hcg.hsv = function(hcg) {
|
4633 | var c = hcg[1] / 100;
|
4634 | var g = hcg[2] / 100;
|
4635 | var v = c + g * (1 - c);
|
4636 | var f = 0;
|
4637 | if (v > 0) {
|
4638 | f = c / v;
|
4639 | }
|
4640 | return [hcg[0], f * 100, v * 100];
|
4641 | };
|
4642 | convert.hcg.hsl = function(hcg) {
|
4643 | var c = hcg[1] / 100;
|
4644 | var g = hcg[2] / 100;
|
4645 | var l = g * (1 - c) + 0.5 * c;
|
4646 | var s = 0;
|
4647 | if (l > 0 && l < 0.5) {
|
4648 | s = c / (2 * l);
|
4649 | } else if (l >= 0.5 && l < 1) {
|
4650 | s = c / (2 * (1 - l));
|
4651 | }
|
4652 | return [hcg[0], s * 100, l * 100];
|
4653 | };
|
4654 | convert.hcg.hwb = function(hcg) {
|
4655 | var c = hcg[1] / 100;
|
4656 | var g = hcg[2] / 100;
|
4657 | var v = c + g * (1 - c);
|
4658 | return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
4659 | };
|
4660 | convert.hwb.hcg = function(hwb) {
|
4661 | var w = hwb[1] / 100;
|
4662 | var b = hwb[2] / 100;
|
4663 | var v = 1 - b;
|
4664 | var c = v - w;
|
4665 | var g = 0;
|
4666 | if (c < 1) {
|
4667 | g = (v - c) / (1 - c);
|
4668 | }
|
4669 | return [hwb[0], c * 100, g * 100];
|
4670 | };
|
4671 | convert.apple.rgb = function(apple) {
|
4672 | return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
4673 | };
|
4674 | convert.rgb.apple = function(rgb) {
|
4675 | return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
4676 | };
|
4677 | convert.gray.rgb = function(args) {
|
4678 | return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
4679 | };
|
4680 | convert.gray.hsl = convert.gray.hsv = function(args) {
|
4681 | return [0, 0, args[0]];
|
4682 | };
|
4683 | convert.gray.hwb = function(gray) {
|
4684 | return [0, 100, gray[0]];
|
4685 | };
|
4686 | convert.gray.cmyk = function(gray) {
|
4687 | return [0, 0, 0, gray[0]];
|
4688 | };
|
4689 | convert.gray.lab = function(gray) {
|
4690 | return [gray[0], 0, 0];
|
4691 | };
|
4692 | convert.gray.hex = function(gray) {
|
4693 | var val = Math.round(gray[0] / 100 * 255) & 255;
|
4694 | var integer = (val << 16) + (val << 8) + val;
|
4695 | var string = integer.toString(16).toUpperCase();
|
4696 | return "000000".substring(string.length) + string;
|
4697 | };
|
4698 | convert.rgb.gray = function(rgb) {
|
4699 | var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
4700 | return [val / 255 * 100];
|
4701 | };
|
4702 | }
|
4703 | });
|
4704 | var require_route = __commonJS2({
|
4705 | "node_modules/color-convert/route.js"(exports2, module2) {
|
4706 | var conversions = require_conversions();
|
4707 | function buildGraph() {
|
4708 | var graph = {};
|
4709 | var models = Object.keys(conversions);
|
4710 | for (var len = models.length, i = 0; i < len; i++) {
|
4711 | graph[models[i]] = {
|
4712 | distance: -1,
|
4713 | parent: null
|
4714 | };
|
4715 | }
|
4716 | return graph;
|
4717 | }
|
4718 | function deriveBFS(fromModel) {
|
4719 | var graph = buildGraph();
|
4720 | var queue = [fromModel];
|
4721 | graph[fromModel].distance = 0;
|
4722 | while (queue.length) {
|
4723 | var current = queue.pop();
|
4724 | var adjacents = Object.keys(conversions[current]);
|
4725 | for (var len = adjacents.length, i = 0; i < len; i++) {
|
4726 | var adjacent = adjacents[i];
|
4727 | var node = graph[adjacent];
|
4728 | if (node.distance === -1) {
|
4729 | node.distance = graph[current].distance + 1;
|
4730 | node.parent = current;
|
4731 | queue.unshift(adjacent);
|
4732 | }
|
4733 | }
|
4734 | }
|
4735 | return graph;
|
4736 | }
|
4737 | function link(from, to) {
|
4738 | return function(args) {
|
4739 | return to(from(args));
|
4740 | };
|
4741 | }
|
4742 | function wrapConversion(toModel, graph) {
|
4743 | var path = [graph[toModel].parent, toModel];
|
4744 | var fn = conversions[graph[toModel].parent][toModel];
|
4745 | var cur = graph[toModel].parent;
|
4746 | while (graph[cur].parent) {
|
4747 | path.unshift(graph[cur].parent);
|
4748 | fn = link(conversions[graph[cur].parent][cur], fn);
|
4749 | cur = graph[cur].parent;
|
4750 | }
|
4751 | fn.conversion = path;
|
4752 | return fn;
|
4753 | }
|
4754 | module2.exports = function(fromModel) {
|
4755 | var graph = deriveBFS(fromModel);
|
4756 | var conversion = {};
|
4757 | var models = Object.keys(graph);
|
4758 | for (var len = models.length, i = 0; i < len; i++) {
|
4759 | var toModel = models[i];
|
4760 | var node = graph[toModel];
|
4761 | if (node.parent === null) {
|
4762 | continue;
|
4763 | }
|
4764 | conversion[toModel] = wrapConversion(toModel, graph);
|
4765 | }
|
4766 | return conversion;
|
4767 | };
|
4768 | }
|
4769 | });
|
4770 | var require_color_convert = __commonJS2({
|
4771 | "node_modules/color-convert/index.js"(exports2, module2) {
|
4772 | var conversions = require_conversions();
|
4773 | var route = require_route();
|
4774 | var convert = {};
|
4775 | var models = Object.keys(conversions);
|
4776 | function wrapRaw(fn) {
|
4777 | var wrappedFn = function(args) {
|
4778 | if (args === void 0 || args === null) {
|
4779 | return args;
|
4780 | }
|
4781 | if (arguments.length > 1) {
|
4782 | args = Array.prototype.slice.call(arguments);
|
4783 | }
|
4784 | return fn(args);
|
4785 | };
|
4786 | if ("conversion" in fn) {
|
4787 | wrappedFn.conversion = fn.conversion;
|
4788 | }
|
4789 | return wrappedFn;
|
4790 | }
|
4791 | function wrapRounded(fn) {
|
4792 | var wrappedFn = function(args) {
|
4793 | if (args === void 0 || args === null) {
|
4794 | return args;
|
4795 | }
|
4796 | if (arguments.length > 1) {
|
4797 | args = Array.prototype.slice.call(arguments);
|
4798 | }
|
4799 | var result = fn(args);
|
4800 | if (typeof result === "object") {
|
4801 | for (var len = result.length, i = 0; i < len; i++) {
|
4802 | result[i] = Math.round(result[i]);
|
4803 | }
|
4804 | }
|
4805 | return result;
|
4806 | };
|
4807 | if ("conversion" in fn) {
|
4808 | wrappedFn.conversion = fn.conversion;
|
4809 | }
|
4810 | return wrappedFn;
|
4811 | }
|
4812 | models.forEach(function(fromModel) {
|
4813 | convert[fromModel] = {};
|
4814 | Object.defineProperty(convert[fromModel], "channels", {
|
4815 | value: conversions[fromModel].channels
|
4816 | });
|
4817 | Object.defineProperty(convert[fromModel], "labels", {
|
4818 | value: conversions[fromModel].labels
|
4819 | });
|
4820 | var routes = route(fromModel);
|
4821 | var routeModels = Object.keys(routes);
|
4822 | routeModels.forEach(function(toModel) {
|
4823 | var fn = routes[toModel];
|
4824 | convert[fromModel][toModel] = wrapRounded(fn);
|
4825 | convert[fromModel][toModel].raw = wrapRaw(fn);
|
4826 | });
|
4827 | });
|
4828 | module2.exports = convert;
|
4829 | }
|
4830 | });
|
4831 | var require_ansi_styles = __commonJS2({
|
4832 | "node_modules/ansi-styles/index.js"(exports2, module2) {
|
4833 | "use strict";
|
4834 | var colorConvert = require_color_convert();
|
4835 | var wrapAnsi16 = (fn, offset) => function() {
|
4836 | const code = fn.apply(colorConvert, arguments);
|
4837 | return `\x1B[${code + offset}m`;
|
4838 | };
|
4839 | var wrapAnsi256 = (fn, offset) => function() {
|
4840 | const code = fn.apply(colorConvert, arguments);
|
4841 | return `\x1B[${38 + offset};5;${code}m`;
|
4842 | };
|
4843 | var wrapAnsi16m = (fn, offset) => function() {
|
4844 | const rgb = fn.apply(colorConvert, arguments);
|
4845 | return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
4846 | };
|
4847 | function assembleStyles() {
|
4848 | const codes = new Map();
|
4849 | const styles = {
|
4850 | modifier: {
|
4851 | reset: [0, 0],
|
4852 | bold: [1, 22],
|
4853 | dim: [2, 22],
|
4854 | italic: [3, 23],
|
4855 | underline: [4, 24],
|
4856 | inverse: [7, 27],
|
4857 | hidden: [8, 28],
|
4858 | strikethrough: [9, 29]
|
4859 | },
|
4860 | color: {
|
4861 | black: [30, 39],
|
4862 | red: [31, 39],
|
4863 | green: [32, 39],
|
4864 | yellow: [33, 39],
|
4865 | blue: [34, 39],
|
4866 | magenta: [35, 39],
|
4867 | cyan: [36, 39],
|
4868 | white: [37, 39],
|
4869 | gray: [90, 39],
|
4870 | redBright: [91, 39],
|
4871 | greenBright: [92, 39],
|
4872 | yellowBright: [93, 39],
|
4873 | blueBright: [94, 39],
|
4874 | magentaBright: [95, 39],
|
4875 | cyanBright: [96, 39],
|
4876 | whiteBright: [97, 39]
|
4877 | },
|
4878 | bgColor: {
|
4879 | bgBlack: [40, 49],
|
4880 | bgRed: [41, 49],
|
4881 | bgGreen: [42, 49],
|
4882 | bgYellow: [43, 49],
|
4883 | bgBlue: [44, 49],
|
4884 | bgMagenta: [45, 49],
|
4885 | bgCyan: [46, 49],
|
4886 | bgWhite: [47, 49],
|
4887 | bgBlackBright: [100, 49],
|
4888 | bgRedBright: [101, 49],
|
4889 | bgGreenBright: [102, 49],
|
4890 | bgYellowBright: [103, 49],
|
4891 | bgBlueBright: [104, 49],
|
4892 | bgMagentaBright: [105, 49],
|
4893 | bgCyanBright: [106, 49],
|
4894 | bgWhiteBright: [107, 49]
|
4895 | }
|
4896 | };
|
4897 | styles.color.grey = styles.color.gray;
|
4898 | for (const groupName of Object.keys(styles)) {
|
4899 | const group = styles[groupName];
|
4900 | for (const styleName of Object.keys(group)) {
|
4901 | const style = group[styleName];
|
4902 | styles[styleName] = {
|
4903 | open: `\x1B[${style[0]}m`,
|
4904 | close: `\x1B[${style[1]}m`
|
4905 | };
|
4906 | group[styleName] = styles[styleName];
|
4907 | codes.set(style[0], style[1]);
|
4908 | }
|
4909 | Object.defineProperty(styles, groupName, {
|
4910 | value: group,
|
4911 | enumerable: false
|
4912 | });
|
4913 | Object.defineProperty(styles, "codes", {
|
4914 | value: codes,
|
4915 | enumerable: false
|
4916 | });
|
4917 | }
|
4918 | const ansi2ansi = (n) => n;
|
4919 | const rgb2rgb = (r, g, b) => [r, g, b];
|
4920 | styles.color.close = "\x1B[39m";
|
4921 | styles.bgColor.close = "\x1B[49m";
|
4922 | styles.color.ansi = {
|
4923 | ansi: wrapAnsi16(ansi2ansi, 0)
|
4924 | };
|
4925 | styles.color.ansi256 = {
|
4926 | ansi256: wrapAnsi256(ansi2ansi, 0)
|
4927 | };
|
4928 | styles.color.ansi16m = {
|
4929 | rgb: wrapAnsi16m(rgb2rgb, 0)
|
4930 | };
|
4931 | styles.bgColor.ansi = {
|
4932 | ansi: wrapAnsi16(ansi2ansi, 10)
|
4933 | };
|
4934 | styles.bgColor.ansi256 = {
|
4935 | ansi256: wrapAnsi256(ansi2ansi, 10)
|
4936 | };
|
4937 | styles.bgColor.ansi16m = {
|
4938 | rgb: wrapAnsi16m(rgb2rgb, 10)
|
4939 | };
|
4940 | for (let key of Object.keys(colorConvert)) {
|
4941 | if (typeof colorConvert[key] !== "object") {
|
4942 | continue;
|
4943 | }
|
4944 | const suite = colorConvert[key];
|
4945 | if (key === "ansi16") {
|
4946 | key = "ansi";
|
4947 | }
|
4948 | if ("ansi16" in suite) {
|
4949 | styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
|
4950 | styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
|
4951 | }
|
4952 | if ("ansi256" in suite) {
|
4953 | styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
|
4954 | styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
|
4955 | }
|
4956 | if ("rgb" in suite) {
|
4957 | styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
|
4958 | styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
|
4959 | }
|
4960 | }
|
4961 | return styles;
|
4962 | }
|
4963 | Object.defineProperty(module2, "exports", {
|
4964 | enumerable: true,
|
4965 | get: assembleStyles
|
4966 | });
|
4967 | }
|
4968 | });
|
4969 | var require_has_flag = __commonJS2({
|
4970 | "node_modules/vnopts/node_modules/has-flag/index.js"(exports2, module2) {
|
4971 | "use strict";
|
4972 | module2.exports = (flag, argv) => {
|
4973 | argv = argv || process.argv;
|
4974 | const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
4975 | const pos = argv.indexOf(prefix + flag);
|
4976 | const terminatorPos = argv.indexOf("--");
|
4977 | return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
4978 | };
|
4979 | }
|
4980 | });
|
4981 | var require_supports_color = __commonJS2({
|
4982 | "node_modules/vnopts/node_modules/supports-color/index.js"(exports2, module2) {
|
4983 | "use strict";
|
4984 | var os = require("os");
|
4985 | var hasFlag = require_has_flag();
|
4986 | var env = process.env;
|
4987 | var forceColor;
|
4988 | if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
4989 | forceColor = false;
|
4990 | } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
4991 | forceColor = true;
|
4992 | }
|
4993 | if ("FORCE_COLOR" in env) {
|
4994 | forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
4995 | }
|
4996 | function translateLevel(level) {
|
4997 | if (level === 0) {
|
4998 | return false;
|
4999 | }
|
5000 | return {
|
5001 | level,
|
5002 | hasBasic: true,
|
5003 | has256: level >= 2,
|
5004 | has16m: level >= 3
|
5005 | };
|
5006 | }
|
5007 | function supportsColor(stream) {
|
5008 | if (forceColor === false) {
|
5009 | return 0;
|
5010 | }
|
5011 | if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
5012 | return 3;
|
5013 | }
|
5014 | if (hasFlag("color=256")) {
|
5015 | return 2;
|
5016 | }
|
5017 | if (stream && !stream.isTTY && forceColor !== true) {
|
5018 | return 0;
|
5019 | }
|
5020 | const min = forceColor ? 1 : 0;
|
5021 | if (process.platform === "win32") {
|
5022 | const osRelease = os.release().split(".");
|
5023 | if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
5024 | return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
5025 | }
|
5026 | return 1;
|
5027 | }
|
5028 | if ("CI" in env) {
|
5029 | if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
5030 | return 1;
|
5031 | }
|
5032 | return min;
|
5033 | }
|
5034 | if ("TEAMCITY_VERSION" in env) {
|
5035 | return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
5036 | }
|
5037 | if (env.COLORTERM === "truecolor") {
|
5038 | return 3;
|
5039 | }
|
5040 | if ("TERM_PROGRAM" in env) {
|
5041 | const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
5042 | switch (env.TERM_PROGRAM) {
|
5043 | case "iTerm.app":
|
5044 | return version2 >= 3 ? 3 : 2;
|
5045 | case "Apple_Terminal":
|
5046 | return 2;
|
5047 | }
|
5048 | }
|
5049 | if (/-256(color)?$/i.test(env.TERM)) {
|
5050 | return 2;
|
5051 | }
|
5052 | if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
5053 | return 1;
|
5054 | }
|
5055 | if ("COLORTERM" in env) {
|
5056 | return 1;
|
5057 | }
|
5058 | if (env.TERM === "dumb") {
|
5059 | return min;
|
5060 | }
|
5061 | return min;
|
5062 | }
|
5063 | function getSupportLevel(stream) {
|
5064 | const level = supportsColor(stream);
|
5065 | return translateLevel(level);
|
5066 | }
|
5067 | module2.exports = {
|
5068 | supportsColor: getSupportLevel,
|
5069 | stdout: getSupportLevel(process.stdout),
|
5070 | stderr: getSupportLevel(process.stderr)
|
5071 | };
|
5072 | }
|
5073 | });
|
5074 | var require_templates = __commonJS2({
|
5075 | "node_modules/vnopts/node_modules/chalk/templates.js"(exports2, module2) {
|
5076 | "use strict";
|
5077 | var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
5078 | var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
5079 | var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
5080 | var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
|
5081 | var ESCAPES = new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
|
5082 | function unescape(c) {
|
5083 | if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
|
5084 | return String.fromCharCode(parseInt(c.slice(1), 16));
|
5085 | }
|
5086 | return ESCAPES.get(c) || c;
|
5087 | }
|
5088 | function parseArguments(name, args) {
|
5089 | const results = [];
|
5090 | const chunks = args.trim().split(/\s*,\s*/g);
|
5091 | let matches;
|
5092 | for (const chunk of chunks) {
|
5093 | if (!isNaN(chunk)) {
|
5094 | results.push(Number(chunk));
|
5095 | } else if (matches = chunk.match(STRING_REGEX)) {
|
5096 | results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
|
5097 | } else {
|
5098 | throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
5099 | }
|
5100 | }
|
5101 | return results;
|
5102 | }
|
5103 | function parseStyle(style) {
|
5104 | STYLE_REGEX.lastIndex = 0;
|
5105 | const results = [];
|
5106 | let matches;
|
5107 | while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
5108 | const name = matches[1];
|
5109 | if (matches[2]) {
|
5110 | const args = parseArguments(name, matches[2]);
|
5111 | results.push([name].concat(args));
|
5112 | } else {
|
5113 | results.push([name]);
|
5114 | }
|
5115 | }
|
5116 | return results;
|
5117 | }
|
5118 | function buildStyle(chalk, styles) {
|
5119 | const enabled = {};
|
5120 | for (const layer of styles) {
|
5121 | for (const style of layer.styles) {
|
5122 | enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
5123 | }
|
5124 | }
|
5125 | let current = chalk;
|
5126 | for (const styleName of Object.keys(enabled)) {
|
5127 | if (Array.isArray(enabled[styleName])) {
|
5128 | if (!(styleName in current)) {
|
5129 | throw new Error(`Unknown Chalk style: ${styleName}`);
|
5130 | }
|
5131 | if (enabled[styleName].length > 0) {
|
5132 | current = current[styleName].apply(current, enabled[styleName]);
|
5133 | } else {
|
5134 | current = current[styleName];
|
5135 | }
|
5136 | }
|
5137 | }
|
5138 | return current;
|
5139 | }
|
5140 | module2.exports = (chalk, tmp) => {
|
5141 | const styles = [];
|
5142 | const chunks = [];
|
5143 | let chunk = [];
|
5144 | tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
|
5145 | if (escapeChar) {
|
5146 | chunk.push(unescape(escapeChar));
|
5147 | } else if (style) {
|
5148 | const str = chunk.join("");
|
5149 | chunk = [];
|
5150 | chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
|
5151 | styles.push({
|
5152 | inverse,
|
5153 | styles: parseStyle(style)
|
5154 | });
|
5155 | } else if (close) {
|
5156 | if (styles.length === 0) {
|
5157 | throw new Error("Found extraneous } in Chalk template literal");
|
5158 | }
|
5159 | chunks.push(buildStyle(chalk, styles)(chunk.join("")));
|
5160 | chunk = [];
|
5161 | styles.pop();
|
5162 | } else {
|
5163 | chunk.push(chr);
|
5164 | }
|
5165 | });
|
5166 | chunks.push(chunk.join(""));
|
5167 | if (styles.length > 0) {
|
5168 | const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
5169 | throw new Error(errMsg);
|
5170 | }
|
5171 | return chunks.join("");
|
5172 | };
|
5173 | }
|
5174 | });
|
5175 | var require_chalk = __commonJS2({
|
5176 | "node_modules/vnopts/node_modules/chalk/index.js"(exports2, module2) {
|
5177 | "use strict";
|
5178 | var escapeStringRegexp2 = require_escape_string_regexp();
|
5179 | var ansiStyles = require_ansi_styles();
|
5180 | var stdoutColor = require_supports_color().stdout;
|
5181 | var template = require_templates();
|
5182 | var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
|
5183 | var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
|
5184 | var skipModels = new Set(["gray"]);
|
5185 | var styles = Object.create(null);
|
5186 | function applyOptions(obj, options) {
|
5187 | options = options || {};
|
5188 | const scLevel = stdoutColor ? stdoutColor.level : 0;
|
5189 | obj.level = options.level === void 0 ? scLevel : options.level;
|
5190 | obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
|
5191 | }
|
5192 | function Chalk(options) {
|
5193 | if (!this || !(this instanceof Chalk) || this.template) {
|
5194 | const chalk = {};
|
5195 | applyOptions(chalk, options);
|
5196 | chalk.template = function() {
|
5197 | const args = [].slice.call(arguments);
|
5198 | return chalkTag.apply(null, [chalk.template].concat(args));
|
5199 | };
|
5200 | Object.setPrototypeOf(chalk, Chalk.prototype);
|
5201 | Object.setPrototypeOf(chalk.template, chalk);
|
5202 | chalk.template.constructor = Chalk;
|
5203 | return chalk.template;
|
5204 | }
|
5205 | applyOptions(this, options);
|
5206 | }
|
5207 | if (isSimpleWindowsTerm) {
|
5208 | ansiStyles.blue.open = "\x1B[94m";
|
5209 | }
|
5210 | for (const key of Object.keys(ansiStyles)) {
|
5211 | ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
|
5212 | styles[key] = {
|
5213 | get() {
|
5214 | const codes = ansiStyles[key];
|
5215 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
5216 | }
|
5217 | };
|
5218 | }
|
5219 | styles.visible = {
|
5220 | get() {
|
5221 | return build.call(this, this._styles || [], true, "visible");
|
5222 | }
|
5223 | };
|
5224 | ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
|
5225 | for (const model of Object.keys(ansiStyles.color.ansi)) {
|
5226 | if (skipModels.has(model)) {
|
5227 | continue;
|
5228 | }
|
5229 | styles[model] = {
|
5230 | get() {
|
5231 | const level = this.level;
|
5232 | return function() {
|
5233 | const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
|
5234 | const codes = {
|
5235 | open,
|
5236 | close: ansiStyles.color.close,
|
5237 | closeRe: ansiStyles.color.closeRe
|
5238 | };
|
5239 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
5240 | };
|
5241 | }
|
5242 | };
|
5243 | }
|
5244 | ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
|
5245 | for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
5246 | if (skipModels.has(model)) {
|
5247 | continue;
|
5248 | }
|
5249 | const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
5250 | styles[bgModel] = {
|
5251 | get() {
|
5252 | const level = this.level;
|
5253 | return function() {
|
5254 | const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
|
5255 | const codes = {
|
5256 | open,
|
5257 | close: ansiStyles.bgColor.close,
|
5258 | closeRe: ansiStyles.bgColor.closeRe
|
5259 | };
|
5260 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
5261 | };
|
5262 | }
|
5263 | };
|
5264 | }
|
5265 | var proto = Object.defineProperties(() => {
|
5266 | }, styles);
|
5267 | function build(_styles, _empty, key) {
|
5268 | const builder = function() {
|
5269 | return applyStyle.apply(builder, arguments);
|
5270 | };
|
5271 | builder._styles = _styles;
|
5272 | builder._empty = _empty;
|
5273 | const self2 = this;
|
5274 | Object.defineProperty(builder, "level", {
|
5275 | enumerable: true,
|
5276 | get() {
|
5277 | return self2.level;
|
5278 | },
|
5279 | set(level) {
|
5280 | self2.level = level;
|
5281 | }
|
5282 | });
|
5283 | Object.defineProperty(builder, "enabled", {
|
5284 | enumerable: true,
|
5285 | get() {
|
5286 | return self2.enabled;
|
5287 | },
|
5288 | set(enabled) {
|
5289 | self2.enabled = enabled;
|
5290 | }
|
5291 | });
|
5292 | builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
|
5293 | builder.__proto__ = proto;
|
5294 | return builder;
|
5295 | }
|
5296 | function applyStyle() {
|
5297 | const args = arguments;
|
5298 | const argsLen = args.length;
|
5299 | let str = String(arguments[0]);
|
5300 | if (argsLen === 0) {
|
5301 | return "";
|
5302 | }
|
5303 | if (argsLen > 1) {
|
5304 | for (let a = 1; a < argsLen; a++) {
|
5305 | str += " " + args[a];
|
5306 | }
|
5307 | }
|
5308 | if (!this.enabled || this.level <= 0 || !str) {
|
5309 | return this._empty ? "" : str;
|
5310 | }
|
5311 | const originalDim = ansiStyles.dim.open;
|
5312 | if (isSimpleWindowsTerm && this.hasGrey) {
|
5313 | ansiStyles.dim.open = "";
|
5314 | }
|
5315 | for (const code of this._styles.slice().reverse()) {
|
5316 | str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
5317 | str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
|
5318 | }
|
5319 | ansiStyles.dim.open = originalDim;
|
5320 | return str;
|
5321 | }
|
5322 | function chalkTag(chalk, strings) {
|
5323 | if (!Array.isArray(strings)) {
|
5324 | return [].slice.call(arguments, 1).join(" ");
|
5325 | }
|
5326 | const args = [].slice.call(arguments, 2);
|
5327 | const parts = [strings.raw[0]];
|
5328 | for (let i = 1; i < strings.length; i++) {
|
5329 | parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
5330 | parts.push(String(strings.raw[i]));
|
5331 | }
|
5332 | return template(chalk, parts.join(""));
|
5333 | }
|
5334 | Object.defineProperties(Chalk.prototype, styles);
|
5335 | module2.exports = Chalk();
|
5336 | module2.exports.supportsColor = stdoutColor;
|
5337 | module2.exports.default = module2.exports;
|
5338 | }
|
5339 | });
|
5340 | var require_common = __commonJS2({
|
5341 | "node_modules/vnopts/lib/handlers/deprecated/common.js"(exports2) {
|
5342 | "use strict";
|
5343 | Object.defineProperty(exports2, "__esModule", {
|
5344 | value: true
|
5345 | });
|
5346 | var chalk_1 = require_chalk();
|
5347 | exports2.commonDeprecatedHandler = (keyOrPair, redirectTo, {
|
5348 | descriptor
|
5349 | }) => {
|
5350 | const messages = [`${chalk_1.default.yellow(typeof keyOrPair === "string" ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`];
|
5351 | if (redirectTo) {
|
5352 | messages.push(`we now treat it as ${chalk_1.default.blue(typeof redirectTo === "string" ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
|
5353 | }
|
5354 | return messages.join("; ") + ".";
|
5355 | };
|
5356 | }
|
5357 | });
|
5358 | var require_deprecated = __commonJS2({
|
5359 | "node_modules/vnopts/lib/handlers/deprecated/index.js"(exports2) {
|
5360 | "use strict";
|
5361 | Object.defineProperty(exports2, "__esModule", {
|
5362 | value: true
|
5363 | });
|
5364 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5365 | tslib_1.__exportStar(require_common(), exports2);
|
5366 | }
|
5367 | });
|
5368 | var require_common2 = __commonJS2({
|
5369 | "node_modules/vnopts/lib/handlers/invalid/common.js"(exports2) {
|
5370 | "use strict";
|
5371 | Object.defineProperty(exports2, "__esModule", {
|
5372 | value: true
|
5373 | });
|
5374 | var chalk_1 = require_chalk();
|
5375 | exports2.commonInvalidHandler = (key, value, utils) => [`Invalid ${chalk_1.default.red(utils.descriptor.key(key))} value.`, `Expected ${chalk_1.default.blue(utils.schemas[key].expected(utils))},`, `but received ${chalk_1.default.red(utils.descriptor.value(value))}.`].join(" ");
|
5376 | }
|
5377 | });
|
5378 | var require_invalid = __commonJS2({
|
5379 | "node_modules/vnopts/lib/handlers/invalid/index.js"(exports2) {
|
5380 | "use strict";
|
5381 | Object.defineProperty(exports2, "__esModule", {
|
5382 | value: true
|
5383 | });
|
5384 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5385 | tslib_1.__exportStar(require_common2(), exports2);
|
5386 | }
|
5387 | });
|
5388 | var require_leven = __commonJS2({
|
5389 | "node_modules/vnopts/node_modules/leven/index.js"(exports2, module2) {
|
5390 | "use strict";
|
5391 | var arr = [];
|
5392 | var charCodeCache = [];
|
5393 | module2.exports = function(a, b) {
|
5394 | if (a === b) {
|
5395 | return 0;
|
5396 | }
|
5397 | var swap = a;
|
5398 | if (a.length > b.length) {
|
5399 | a = b;
|
5400 | b = swap;
|
5401 | }
|
5402 | var aLen = a.length;
|
5403 | var bLen = b.length;
|
5404 | if (aLen === 0) {
|
5405 | return bLen;
|
5406 | }
|
5407 | if (bLen === 0) {
|
5408 | return aLen;
|
5409 | }
|
5410 | while (aLen > 0 && a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen)) {
|
5411 | aLen--;
|
5412 | bLen--;
|
5413 | }
|
5414 | if (aLen === 0) {
|
5415 | return bLen;
|
5416 | }
|
5417 | var start = 0;
|
5418 | while (start < aLen && a.charCodeAt(start) === b.charCodeAt(start)) {
|
5419 | start++;
|
5420 | }
|
5421 | aLen -= start;
|
5422 | bLen -= start;
|
5423 | if (aLen === 0) {
|
5424 | return bLen;
|
5425 | }
|
5426 | var bCharCode;
|
5427 | var ret;
|
5428 | var tmp;
|
5429 | var tmp2;
|
5430 | var i = 0;
|
5431 | var j = 0;
|
5432 | while (i < aLen) {
|
5433 | charCodeCache[start + i] = a.charCodeAt(start + i);
|
5434 | arr[i] = ++i;
|
5435 | }
|
5436 | while (j < bLen) {
|
5437 | bCharCode = b.charCodeAt(start + j);
|
5438 | tmp = j++;
|
5439 | ret = j;
|
5440 | for (i = 0; i < aLen; i++) {
|
5441 | tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
|
5442 | tmp = arr[i];
|
5443 | ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
|
5444 | }
|
5445 | }
|
5446 | return ret;
|
5447 | };
|
5448 | }
|
5449 | });
|
5450 | var require_leven2 = __commonJS2({
|
5451 | "node_modules/vnopts/lib/handlers/unknown/leven.js"(exports2) {
|
5452 | "use strict";
|
5453 | Object.defineProperty(exports2, "__esModule", {
|
5454 | value: true
|
5455 | });
|
5456 | var chalk_1 = require_chalk();
|
5457 | var leven = require_leven();
|
5458 | exports2.levenUnknownHandler = (key, value, {
|
5459 | descriptor,
|
5460 | logger,
|
5461 | schemas
|
5462 | }) => {
|
5463 | const messages = [`Ignored unknown option ${chalk_1.default.yellow(descriptor.pair({
|
5464 | key,
|
5465 | value
|
5466 | }))}.`];
|
5467 | const suggestion = Object.keys(schemas).sort().find((knownKey) => leven(key, knownKey) < 3);
|
5468 | if (suggestion) {
|
5469 | messages.push(`Did you mean ${chalk_1.default.blue(descriptor.key(suggestion))}?`);
|
5470 | }
|
5471 | logger.warn(messages.join(" "));
|
5472 | };
|
5473 | }
|
5474 | });
|
5475 | var require_unknown = __commonJS2({
|
5476 | "node_modules/vnopts/lib/handlers/unknown/index.js"(exports2) {
|
5477 | "use strict";
|
5478 | Object.defineProperty(exports2, "__esModule", {
|
5479 | value: true
|
5480 | });
|
5481 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5482 | tslib_1.__exportStar(require_leven2(), exports2);
|
5483 | }
|
5484 | });
|
5485 | var require_handlers = __commonJS2({
|
5486 | "node_modules/vnopts/lib/handlers/index.js"(exports2) {
|
5487 | "use strict";
|
5488 | Object.defineProperty(exports2, "__esModule", {
|
5489 | value: true
|
5490 | });
|
5491 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5492 | tslib_1.__exportStar(require_deprecated(), exports2);
|
5493 | tslib_1.__exportStar(require_invalid(), exports2);
|
5494 | tslib_1.__exportStar(require_unknown(), exports2);
|
5495 | }
|
5496 | });
|
5497 | var require_schema = __commonJS2({
|
5498 | "node_modules/vnopts/lib/schema.js"(exports2) {
|
5499 | "use strict";
|
5500 | Object.defineProperty(exports2, "__esModule", {
|
5501 | value: true
|
5502 | });
|
5503 | var HANDLER_KEYS = ["default", "expected", "validate", "deprecated", "forward", "redirect", "overlap", "preprocess", "postprocess"];
|
5504 | function createSchema(SchemaConstructor, parameters) {
|
5505 | const schema = new SchemaConstructor(parameters);
|
5506 | const subSchema = Object.create(schema);
|
5507 | for (const handlerKey of HANDLER_KEYS) {
|
5508 | if (handlerKey in parameters) {
|
5509 | subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema, Schema.prototype[handlerKey].length);
|
5510 | }
|
5511 | }
|
5512 | return subSchema;
|
5513 | }
|
5514 | exports2.createSchema = createSchema;
|
5515 | var Schema = class {
|
5516 | constructor(parameters) {
|
5517 | this.name = parameters.name;
|
5518 | }
|
5519 | static create(parameters) {
|
5520 | return createSchema(this, parameters);
|
5521 | }
|
5522 | default(_utils) {
|
5523 | return void 0;
|
5524 | }
|
5525 | expected(_utils) {
|
5526 | return "nothing";
|
5527 | }
|
5528 | validate(_value, _utils) {
|
5529 | return false;
|
5530 | }
|
5531 | deprecated(_value, _utils) {
|
5532 | return false;
|
5533 | }
|
5534 | forward(_value, _utils) {
|
5535 | return void 0;
|
5536 | }
|
5537 | redirect(_value, _utils) {
|
5538 | return void 0;
|
5539 | }
|
5540 | overlap(currentValue, _newValue, _utils) {
|
5541 | return currentValue;
|
5542 | }
|
5543 | preprocess(value, _utils) {
|
5544 | return value;
|
5545 | }
|
5546 | postprocess(value, _utils) {
|
5547 | return value;
|
5548 | }
|
5549 | };
|
5550 | exports2.Schema = Schema;
|
5551 | function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
|
5552 | return typeof handler === "function" ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
|
5553 | }
|
5554 | }
|
5555 | });
|
5556 | var require_alias = __commonJS2({
|
5557 | "node_modules/vnopts/lib/schemas/alias.js"(exports2) {
|
5558 | "use strict";
|
5559 | Object.defineProperty(exports2, "__esModule", {
|
5560 | value: true
|
5561 | });
|
5562 | var schema_1 = require_schema();
|
5563 | var AliasSchema = class extends schema_1.Schema {
|
5564 | constructor(parameters) {
|
5565 | super(parameters);
|
5566 | this._sourceName = parameters.sourceName;
|
5567 | }
|
5568 | expected(utils) {
|
5569 | return utils.schemas[this._sourceName].expected(utils);
|
5570 | }
|
5571 | validate(value, utils) {
|
5572 | return utils.schemas[this._sourceName].validate(value, utils);
|
5573 | }
|
5574 | redirect(_value, _utils) {
|
5575 | return this._sourceName;
|
5576 | }
|
5577 | };
|
5578 | exports2.AliasSchema = AliasSchema;
|
5579 | }
|
5580 | });
|
5581 | var require_any = __commonJS2({
|
5582 | "node_modules/vnopts/lib/schemas/any.js"(exports2) {
|
5583 | "use strict";
|
5584 | Object.defineProperty(exports2, "__esModule", {
|
5585 | value: true
|
5586 | });
|
5587 | var schema_1 = require_schema();
|
5588 | var AnySchema = class extends schema_1.Schema {
|
5589 | expected() {
|
5590 | return "anything";
|
5591 | }
|
5592 | validate() {
|
5593 | return true;
|
5594 | }
|
5595 | };
|
5596 | exports2.AnySchema = AnySchema;
|
5597 | }
|
5598 | });
|
5599 | var require_array2 = __commonJS2({
|
5600 | "node_modules/vnopts/lib/schemas/array.js"(exports2) {
|
5601 | "use strict";
|
5602 | Object.defineProperty(exports2, "__esModule", {
|
5603 | value: true
|
5604 | });
|
5605 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5606 | var schema_1 = require_schema();
|
5607 | var ArraySchema = class extends schema_1.Schema {
|
5608 | constructor(_a) {
|
5609 | var {
|
5610 | valueSchema,
|
5611 | name = valueSchema.name
|
5612 | } = _a, handlers = tslib_1.__rest(_a, ["valueSchema", "name"]);
|
5613 | super(Object.assign({}, handlers, {
|
5614 | name
|
5615 | }));
|
5616 | this._valueSchema = valueSchema;
|
5617 | }
|
5618 | expected(utils) {
|
5619 | return `an array of ${this._valueSchema.expected(utils)}`;
|
5620 | }
|
5621 | validate(value, utils) {
|
5622 | if (!Array.isArray(value)) {
|
5623 | return false;
|
5624 | }
|
5625 | const invalidValues = [];
|
5626 | for (const subValue of value) {
|
5627 | const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
|
5628 | if (subValidateResult !== true) {
|
5629 | invalidValues.push(subValidateResult.value);
|
5630 | }
|
5631 | }
|
5632 | return invalidValues.length === 0 ? true : {
|
5633 | value: invalidValues
|
5634 | };
|
5635 | }
|
5636 | deprecated(value, utils) {
|
5637 | const deprecatedResult = [];
|
5638 | for (const subValue of value) {
|
5639 | const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
|
5640 | if (subDeprecatedResult !== false) {
|
5641 | deprecatedResult.push(...subDeprecatedResult.map(({
|
5642 | value: deprecatedValue
|
5643 | }) => ({
|
5644 | value: [deprecatedValue]
|
5645 | })));
|
5646 | }
|
5647 | }
|
5648 | return deprecatedResult;
|
5649 | }
|
5650 | forward(value, utils) {
|
5651 | const forwardResult = [];
|
5652 | for (const subValue of value) {
|
5653 | const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
|
5654 | forwardResult.push(...subForwardResult.map(wrapTransferResult));
|
5655 | }
|
5656 | return forwardResult;
|
5657 | }
|
5658 | redirect(value, utils) {
|
5659 | const remain = [];
|
5660 | const redirect = [];
|
5661 | for (const subValue of value) {
|
5662 | const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
|
5663 | if ("remain" in subRedirectResult) {
|
5664 | remain.push(subRedirectResult.remain);
|
5665 | }
|
5666 | redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
|
5667 | }
|
5668 | return remain.length === 0 ? {
|
5669 | redirect
|
5670 | } : {
|
5671 | redirect,
|
5672 | remain
|
5673 | };
|
5674 | }
|
5675 | overlap(currentValue, newValue) {
|
5676 | return currentValue.concat(newValue);
|
5677 | }
|
5678 | };
|
5679 | exports2.ArraySchema = ArraySchema;
|
5680 | function wrapTransferResult({
|
5681 | from,
|
5682 | to
|
5683 | }) {
|
5684 | return {
|
5685 | from: [from],
|
5686 | to
|
5687 | };
|
5688 | }
|
5689 | }
|
5690 | });
|
5691 | var require_boolean = __commonJS2({
|
5692 | "node_modules/vnopts/lib/schemas/boolean.js"(exports2) {
|
5693 | "use strict";
|
5694 | Object.defineProperty(exports2, "__esModule", {
|
5695 | value: true
|
5696 | });
|
5697 | var schema_1 = require_schema();
|
5698 | var BooleanSchema = class extends schema_1.Schema {
|
5699 | expected() {
|
5700 | return "true or false";
|
5701 | }
|
5702 | validate(value) {
|
5703 | return typeof value === "boolean";
|
5704 | }
|
5705 | };
|
5706 | exports2.BooleanSchema = BooleanSchema;
|
5707 | }
|
5708 | });
|
5709 | var require_utils = __commonJS2({
|
5710 | "node_modules/vnopts/lib/utils.js"(exports2) {
|
5711 | "use strict";
|
5712 | Object.defineProperty(exports2, "__esModule", {
|
5713 | value: true
|
5714 | });
|
5715 | function recordFromArray(array, mainKey) {
|
5716 | const record = Object.create(null);
|
5717 | for (const value of array) {
|
5718 | const key = value[mainKey];
|
5719 | if (record[key]) {
|
5720 | throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
|
5721 | }
|
5722 | record[key] = value;
|
5723 | }
|
5724 | return record;
|
5725 | }
|
5726 | exports2.recordFromArray = recordFromArray;
|
5727 | function mapFromArray(array, mainKey) {
|
5728 | const map = new Map();
|
5729 | for (const value of array) {
|
5730 | const key = value[mainKey];
|
5731 | if (map.has(key)) {
|
5732 | throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key)}`);
|
5733 | }
|
5734 | map.set(key, value);
|
5735 | }
|
5736 | return map;
|
5737 | }
|
5738 | exports2.mapFromArray = mapFromArray;
|
5739 | function createAutoChecklist() {
|
5740 | const map = Object.create(null);
|
5741 | return (id) => {
|
5742 | const idString = JSON.stringify(id);
|
5743 | if (map[idString]) {
|
5744 | return true;
|
5745 | }
|
5746 | map[idString] = true;
|
5747 | return false;
|
5748 | };
|
5749 | }
|
5750 | exports2.createAutoChecklist = createAutoChecklist;
|
5751 | function partition(array, predicate) {
|
5752 | const trueArray = [];
|
5753 | const falseArray = [];
|
5754 | for (const value of array) {
|
5755 | if (predicate(value)) {
|
5756 | trueArray.push(value);
|
5757 | } else {
|
5758 | falseArray.push(value);
|
5759 | }
|
5760 | }
|
5761 | return [trueArray, falseArray];
|
5762 | }
|
5763 | exports2.partition = partition;
|
5764 | function isInt(value) {
|
5765 | return value === Math.floor(value);
|
5766 | }
|
5767 | exports2.isInt = isInt;
|
5768 | function comparePrimitive(a, b) {
|
5769 | if (a === b) {
|
5770 | return 0;
|
5771 | }
|
5772 | const typeofA = typeof a;
|
5773 | const typeofB = typeof b;
|
5774 | const orders = ["undefined", "object", "boolean", "number", "string"];
|
5775 | if (typeofA !== typeofB) {
|
5776 | return orders.indexOf(typeofA) - orders.indexOf(typeofB);
|
5777 | }
|
5778 | if (typeofA !== "string") {
|
5779 | return Number(a) - Number(b);
|
5780 | }
|
5781 | return a.localeCompare(b);
|
5782 | }
|
5783 | exports2.comparePrimitive = comparePrimitive;
|
5784 | function normalizeDefaultResult(result) {
|
5785 | return result === void 0 ? {} : result;
|
5786 | }
|
5787 | exports2.normalizeDefaultResult = normalizeDefaultResult;
|
5788 | function normalizeValidateResult(result, value) {
|
5789 | return result === true ? true : result === false ? {
|
5790 | value
|
5791 | } : result;
|
5792 | }
|
5793 | exports2.normalizeValidateResult = normalizeValidateResult;
|
5794 | function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
|
5795 | return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{
|
5796 | value
|
5797 | }] : "value" in result ? [result] : result.length === 0 ? false : result;
|
5798 | }
|
5799 | exports2.normalizeDeprecatedResult = normalizeDeprecatedResult;
|
5800 | function normalizeTransferResult(result, value) {
|
5801 | return typeof result === "string" || "key" in result ? {
|
5802 | from: value,
|
5803 | to: result
|
5804 | } : "from" in result ? {
|
5805 | from: result.from,
|
5806 | to: result.to
|
5807 | } : {
|
5808 | from: value,
|
5809 | to: result.to
|
5810 | };
|
5811 | }
|
5812 | exports2.normalizeTransferResult = normalizeTransferResult;
|
5813 | function normalizeForwardResult(result, value) {
|
5814 | return result === void 0 ? [] : Array.isArray(result) ? result.map((transferResult) => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
|
5815 | }
|
5816 | exports2.normalizeForwardResult = normalizeForwardResult;
|
5817 | function normalizeRedirectResult(result, value) {
|
5818 | const redirect = normalizeForwardResult(typeof result === "object" && "redirect" in result ? result.redirect : result, value);
|
5819 | return redirect.length === 0 ? {
|
5820 | remain: value,
|
5821 | redirect
|
5822 | } : typeof result === "object" && "remain" in result ? {
|
5823 | remain: result.remain,
|
5824 | redirect
|
5825 | } : {
|
5826 | redirect
|
5827 | };
|
5828 | }
|
5829 | exports2.normalizeRedirectResult = normalizeRedirectResult;
|
5830 | }
|
5831 | });
|
5832 | var require_choice = __commonJS2({
|
5833 | "node_modules/vnopts/lib/schemas/choice.js"(exports2) {
|
5834 | "use strict";
|
5835 | Object.defineProperty(exports2, "__esModule", {
|
5836 | value: true
|
5837 | });
|
5838 | var schema_1 = require_schema();
|
5839 | var utils_1 = require_utils();
|
5840 | var ChoiceSchema = class extends schema_1.Schema {
|
5841 | constructor(parameters) {
|
5842 | super(parameters);
|
5843 | this._choices = utils_1.mapFromArray(parameters.choices.map((choice) => choice && typeof choice === "object" ? choice : {
|
5844 | value: choice
|
5845 | }), "value");
|
5846 | }
|
5847 | expected({
|
5848 | descriptor
|
5849 | }) {
|
5850 | const choiceValues = Array.from(this._choices.keys()).map((value) => this._choices.get(value)).filter((choiceInfo) => !choiceInfo.deprecated).map((choiceInfo) => choiceInfo.value).sort(utils_1.comparePrimitive).map(descriptor.value);
|
5851 | const head = choiceValues.slice(0, -2);
|
5852 | const tail = choiceValues.slice(-2);
|
5853 | return head.concat(tail.join(" or ")).join(", ");
|
5854 | }
|
5855 | validate(value) {
|
5856 | return this._choices.has(value);
|
5857 | }
|
5858 | deprecated(value) {
|
5859 | const choiceInfo = this._choices.get(value);
|
5860 | return choiceInfo && choiceInfo.deprecated ? {
|
5861 | value
|
5862 | } : false;
|
5863 | }
|
5864 | forward(value) {
|
5865 | const choiceInfo = this._choices.get(value);
|
5866 | return choiceInfo ? choiceInfo.forward : void 0;
|
5867 | }
|
5868 | redirect(value) {
|
5869 | const choiceInfo = this._choices.get(value);
|
5870 | return choiceInfo ? choiceInfo.redirect : void 0;
|
5871 | }
|
5872 | };
|
5873 | exports2.ChoiceSchema = ChoiceSchema;
|
5874 | }
|
5875 | });
|
5876 | var require_number = __commonJS2({
|
5877 | "node_modules/vnopts/lib/schemas/number.js"(exports2) {
|
5878 | "use strict";
|
5879 | Object.defineProperty(exports2, "__esModule", {
|
5880 | value: true
|
5881 | });
|
5882 | var schema_1 = require_schema();
|
5883 | var NumberSchema = class extends schema_1.Schema {
|
5884 | expected() {
|
5885 | return "a number";
|
5886 | }
|
5887 | validate(value, _utils) {
|
5888 | return typeof value === "number";
|
5889 | }
|
5890 | };
|
5891 | exports2.NumberSchema = NumberSchema;
|
5892 | }
|
5893 | });
|
5894 | var require_integer = __commonJS2({
|
5895 | "node_modules/vnopts/lib/schemas/integer.js"(exports2) {
|
5896 | "use strict";
|
5897 | Object.defineProperty(exports2, "__esModule", {
|
5898 | value: true
|
5899 | });
|
5900 | var utils_1 = require_utils();
|
5901 | var number_1 = require_number();
|
5902 | var IntegerSchema = class extends number_1.NumberSchema {
|
5903 | expected() {
|
5904 | return "an integer";
|
5905 | }
|
5906 | validate(value, utils) {
|
5907 | return utils.normalizeValidateResult(super.validate(value, utils), value) === true && utils_1.isInt(value);
|
5908 | }
|
5909 | };
|
5910 | exports2.IntegerSchema = IntegerSchema;
|
5911 | }
|
5912 | });
|
5913 | var require_string = __commonJS2({
|
5914 | "node_modules/vnopts/lib/schemas/string.js"(exports2) {
|
5915 | "use strict";
|
5916 | Object.defineProperty(exports2, "__esModule", {
|
5917 | value: true
|
5918 | });
|
5919 | var schema_1 = require_schema();
|
5920 | var StringSchema = class extends schema_1.Schema {
|
5921 | expected() {
|
5922 | return "a string";
|
5923 | }
|
5924 | validate(value) {
|
5925 | return typeof value === "string";
|
5926 | }
|
5927 | };
|
5928 | exports2.StringSchema = StringSchema;
|
5929 | }
|
5930 | });
|
5931 | var require_schemas = __commonJS2({
|
5932 | "node_modules/vnopts/lib/schemas/index.js"(exports2) {
|
5933 | "use strict";
|
5934 | Object.defineProperty(exports2, "__esModule", {
|
5935 | value: true
|
5936 | });
|
5937 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
5938 | tslib_1.__exportStar(require_alias(), exports2);
|
5939 | tslib_1.__exportStar(require_any(), exports2);
|
5940 | tslib_1.__exportStar(require_array2(), exports2);
|
5941 | tslib_1.__exportStar(require_boolean(), exports2);
|
5942 | tslib_1.__exportStar(require_choice(), exports2);
|
5943 | tslib_1.__exportStar(require_integer(), exports2);
|
5944 | tslib_1.__exportStar(require_number(), exports2);
|
5945 | tslib_1.__exportStar(require_string(), exports2);
|
5946 | }
|
5947 | });
|
5948 | var require_defaults = __commonJS2({
|
5949 | "node_modules/vnopts/lib/defaults.js"(exports2) {
|
5950 | "use strict";
|
5951 | Object.defineProperty(exports2, "__esModule", {
|
5952 | value: true
|
5953 | });
|
5954 | var api_1 = require_api();
|
5955 | var common_1 = require_common();
|
5956 | var invalid_1 = require_invalid();
|
5957 | var leven_1 = require_leven2();
|
5958 | exports2.defaultDescriptor = api_1.apiDescriptor;
|
5959 | exports2.defaultUnknownHandler = leven_1.levenUnknownHandler;
|
5960 | exports2.defaultInvalidHandler = invalid_1.commonInvalidHandler;
|
5961 | exports2.defaultDeprecatedHandler = common_1.commonDeprecatedHandler;
|
5962 | }
|
5963 | });
|
5964 | var require_normalize = __commonJS2({
|
5965 | "node_modules/vnopts/lib/normalize.js"(exports2) {
|
5966 | "use strict";
|
5967 | Object.defineProperty(exports2, "__esModule", {
|
5968 | value: true
|
5969 | });
|
5970 | var defaults_1 = require_defaults();
|
5971 | var utils_1 = require_utils();
|
5972 | exports2.normalize = (options, schemas, opts) => new Normalizer(schemas, opts).normalize(options);
|
5973 | var Normalizer = class {
|
5974 | constructor(schemas, opts) {
|
5975 | const {
|
5976 | logger = console,
|
5977 | descriptor = defaults_1.defaultDescriptor,
|
5978 | unknown = defaults_1.defaultUnknownHandler,
|
5979 | invalid = defaults_1.defaultInvalidHandler,
|
5980 | deprecated = defaults_1.defaultDeprecatedHandler
|
5981 | } = opts || {};
|
5982 | this._utils = {
|
5983 | descriptor,
|
5984 | logger: logger || {
|
5985 | warn: () => {
|
5986 | }
|
5987 | },
|
5988 | schemas: utils_1.recordFromArray(schemas, "name"),
|
5989 | normalizeDefaultResult: utils_1.normalizeDefaultResult,
|
5990 | normalizeDeprecatedResult: utils_1.normalizeDeprecatedResult,
|
5991 | normalizeForwardResult: utils_1.normalizeForwardResult,
|
5992 | normalizeRedirectResult: utils_1.normalizeRedirectResult,
|
5993 | normalizeValidateResult: utils_1.normalizeValidateResult
|
5994 | };
|
5995 | this._unknownHandler = unknown;
|
5996 | this._invalidHandler = invalid;
|
5997 | this._deprecatedHandler = deprecated;
|
5998 | this.cleanHistory();
|
5999 | }
|
6000 | cleanHistory() {
|
6001 | this._hasDeprecationWarned = utils_1.createAutoChecklist();
|
6002 | }
|
6003 | normalize(options) {
|
6004 | const normalized = {};
|
6005 | const restOptionsArray = [options];
|
6006 | const applyNormalization = () => {
|
6007 | while (restOptionsArray.length !== 0) {
|
6008 | const currentOptions = restOptionsArray.shift();
|
6009 | const transferredOptionsArray = this._applyNormalization(currentOptions, normalized);
|
6010 | restOptionsArray.push(...transferredOptionsArray);
|
6011 | }
|
6012 | };
|
6013 | applyNormalization();
|
6014 | for (const key of Object.keys(this._utils.schemas)) {
|
6015 | const schema = this._utils.schemas[key];
|
6016 | if (!(key in normalized)) {
|
6017 | const defaultResult = utils_1.normalizeDefaultResult(schema.default(this._utils));
|
6018 | if ("value" in defaultResult) {
|
6019 | restOptionsArray.push({
|
6020 | [key]: defaultResult.value
|
6021 | });
|
6022 | }
|
6023 | }
|
6024 | }
|
6025 | applyNormalization();
|
6026 | for (const key of Object.keys(this._utils.schemas)) {
|
6027 | const schema = this._utils.schemas[key];
|
6028 | if (key in normalized) {
|
6029 | normalized[key] = schema.postprocess(normalized[key], this._utils);
|
6030 | }
|
6031 | }
|
6032 | return normalized;
|
6033 | }
|
6034 | _applyNormalization(options, normalized) {
|
6035 | const transferredOptionsArray = [];
|
6036 | const [knownOptionNames, unknownOptionNames] = utils_1.partition(Object.keys(options), (key) => key in this._utils.schemas);
|
6037 | for (const key of knownOptionNames) {
|
6038 | const schema = this._utils.schemas[key];
|
6039 | const value = schema.preprocess(options[key], this._utils);
|
6040 | const validateResult = utils_1.normalizeValidateResult(schema.validate(value, this._utils), value);
|
6041 | if (validateResult !== true) {
|
6042 | const {
|
6043 | value: invalidValue
|
6044 | } = validateResult;
|
6045 | const errorMessageOrError = this._invalidHandler(key, invalidValue, this._utils);
|
6046 | throw typeof errorMessageOrError === "string" ? new Error(errorMessageOrError) : errorMessageOrError;
|
6047 | }
|
6048 | const appendTransferredOptions = ({
|
6049 | from,
|
6050 | to
|
6051 | }) => {
|
6052 | transferredOptionsArray.push(typeof to === "string" ? {
|
6053 | [to]: from
|
6054 | } : {
|
6055 | [to.key]: to.value
|
6056 | });
|
6057 | };
|
6058 | const warnDeprecated = ({
|
6059 | value: currentValue,
|
6060 | redirectTo
|
6061 | }) => {
|
6062 | const deprecatedResult = utils_1.normalizeDeprecatedResult(schema.deprecated(currentValue, this._utils), value, true);
|
6063 | if (deprecatedResult === false) {
|
6064 | return;
|
6065 | }
|
6066 | if (deprecatedResult === true) {
|
6067 | if (!this._hasDeprecationWarned(key)) {
|
6068 | this._utils.logger.warn(this._deprecatedHandler(key, redirectTo, this._utils));
|
6069 | }
|
6070 | } else {
|
6071 | for (const {
|
6072 | value: deprecatedValue
|
6073 | } of deprecatedResult) {
|
6074 | const pair = {
|
6075 | key,
|
6076 | value: deprecatedValue
|
6077 | };
|
6078 | if (!this._hasDeprecationWarned(pair)) {
|
6079 | const redirectToPair = typeof redirectTo === "string" ? {
|
6080 | key: redirectTo,
|
6081 | value: deprecatedValue
|
6082 | } : redirectTo;
|
6083 | this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
|
6084 | }
|
6085 | }
|
6086 | }
|
6087 | };
|
6088 | const forwardResult = utils_1.normalizeForwardResult(schema.forward(value, this._utils), value);
|
6089 | forwardResult.forEach(appendTransferredOptions);
|
6090 | const redirectResult = utils_1.normalizeRedirectResult(schema.redirect(value, this._utils), value);
|
6091 | redirectResult.redirect.forEach(appendTransferredOptions);
|
6092 | if ("remain" in redirectResult) {
|
6093 | const remainingValue = redirectResult.remain;
|
6094 | normalized[key] = key in normalized ? schema.overlap(normalized[key], remainingValue, this._utils) : remainingValue;
|
6095 | warnDeprecated({
|
6096 | value: remainingValue
|
6097 | });
|
6098 | }
|
6099 | for (const {
|
6100 | from,
|
6101 | to
|
6102 | } of redirectResult.redirect) {
|
6103 | warnDeprecated({
|
6104 | value: from,
|
6105 | redirectTo: to
|
6106 | });
|
6107 | }
|
6108 | }
|
6109 | for (const key of unknownOptionNames) {
|
6110 | const value = options[key];
|
6111 | const unknownResult = this._unknownHandler(key, value, this._utils);
|
6112 | if (unknownResult) {
|
6113 | for (const unknownKey of Object.keys(unknownResult)) {
|
6114 | const unknownOption = {
|
6115 | [unknownKey]: unknownResult[unknownKey]
|
6116 | };
|
6117 | if (unknownKey in this._utils.schemas) {
|
6118 | transferredOptionsArray.push(unknownOption);
|
6119 | } else {
|
6120 | Object.assign(normalized, unknownOption);
|
6121 | }
|
6122 | }
|
6123 | }
|
6124 | }
|
6125 | return transferredOptionsArray;
|
6126 | }
|
6127 | };
|
6128 | exports2.Normalizer = Normalizer;
|
6129 | }
|
6130 | });
|
6131 | var require_lib2 = __commonJS2({
|
6132 | "node_modules/vnopts/lib/index.js"(exports2) {
|
6133 | "use strict";
|
6134 | Object.defineProperty(exports2, "__esModule", {
|
6135 | value: true
|
6136 | });
|
6137 | var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
|
6138 | tslib_1.__exportStar(require_descriptors2(), exports2);
|
6139 | tslib_1.__exportStar(require_handlers(), exports2);
|
6140 | tslib_1.__exportStar(require_schemas(), exports2);
|
6141 | tslib_1.__exportStar(require_normalize(), exports2);
|
6142 | tslib_1.__exportStar(require_schema(), exports2);
|
6143 | }
|
6144 | });
|
6145 | var require_options_normalizer = __commonJS2({
|
6146 | "src/main/options-normalizer.js"(exports2, module2) {
|
6147 | "use strict";
|
6148 | var vnopts = require_lib2();
|
6149 | var getLast = require_get_last();
|
6150 | var cliDescriptor = {
|
6151 | key: (key) => key.length === 1 ? `-${key}` : `--${key}`,
|
6152 | value: (value) => vnopts.apiDescriptor.value(value),
|
6153 | pair: ({
|
6154 | key,
|
6155 | value
|
6156 | }) => value === false ? `--no-${key}` : value === true ? cliDescriptor.key(key) : value === "" ? `${cliDescriptor.key(key)} without an argument` : `${cliDescriptor.key(key)}=${value}`
|
6157 | };
|
6158 | var getFlagSchema = ({
|
6159 | colorsModule,
|
6160 | levenshteinDistance
|
6161 | }) => class FlagSchema extends vnopts.ChoiceSchema {
|
6162 | constructor({
|
6163 | name,
|
6164 | flags
|
6165 | }) {
|
6166 | super({
|
6167 | name,
|
6168 | choices: flags
|
6169 | });
|
6170 | this._flags = [...flags].sort();
|
6171 | }
|
6172 | preprocess(value, utils) {
|
6173 | if (typeof value === "string" && value.length > 0 && !this._flags.includes(value)) {
|
6174 | const suggestion = this._flags.find((flag) => levenshteinDistance(flag, value) < 3);
|
6175 | if (suggestion) {
|
6176 | utils.logger.warn([`Unknown flag ${colorsModule.yellow(utils.descriptor.value(value))},`, `did you mean ${colorsModule.blue(utils.descriptor.value(suggestion))}?`].join(" "));
|
6177 | return suggestion;
|
6178 | }
|
6179 | }
|
6180 | return value;
|
6181 | }
|
6182 | expected() {
|
6183 | return "a flag";
|
6184 | }
|
6185 | };
|
6186 | var hasDeprecationWarned;
|
6187 | function normalizeOptions(options, optionInfos, {
|
6188 | logger = false,
|
6189 | isCLI = false,
|
6190 | passThrough = false,
|
6191 | colorsModule = null,
|
6192 | levenshteinDistance = null
|
6193 | } = {}) {
|
6194 | const unknown = !passThrough ? (key, value, options2) => {
|
6195 | const _options2$schemas = options2.schemas, {
|
6196 | _
|
6197 | } = _options2$schemas, schemas2 = _objectWithoutProperties(_options2$schemas, _excluded2);
|
6198 | return vnopts.levenUnknownHandler(key, value, Object.assign(Object.assign({}, options2), {}, {
|
6199 | schemas: schemas2
|
6200 | }));
|
6201 | } : Array.isArray(passThrough) ? (key, value) => !passThrough.includes(key) ? void 0 : {
|
6202 | [key]: value
|
6203 | } : (key, value) => ({
|
6204 | [key]: value
|
6205 | });
|
6206 | const descriptor = isCLI ? cliDescriptor : vnopts.apiDescriptor;
|
6207 | const schemas = optionInfosToSchemas(optionInfos, {
|
6208 | isCLI,
|
6209 | colorsModule,
|
6210 | levenshteinDistance
|
6211 | });
|
6212 | const normalizer = new vnopts.Normalizer(schemas, {
|
6213 | logger,
|
6214 | unknown,
|
6215 | descriptor
|
6216 | });
|
6217 | const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
|
6218 | if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
|
6219 | normalizer._hasDeprecationWarned = hasDeprecationWarned;
|
6220 | }
|
6221 | const normalized = normalizer.normalize(options);
|
6222 | if (shouldSuppressDuplicateDeprecationWarnings) {
|
6223 | hasDeprecationWarned = normalizer._hasDeprecationWarned;
|
6224 | }
|
6225 | if (isCLI && normalized["plugin-search"] === false) {
|
6226 | normalized["plugin-search-dir"] = false;
|
6227 | }
|
6228 | return normalized;
|
6229 | }
|
6230 | function optionInfosToSchemas(optionInfos, {
|
6231 | isCLI,
|
6232 | colorsModule,
|
6233 | levenshteinDistance
|
6234 | }) {
|
6235 | const schemas = [];
|
6236 | if (isCLI) {
|
6237 | schemas.push(vnopts.AnySchema.create({
|
6238 | name: "_"
|
6239 | }));
|
6240 | }
|
6241 | for (const optionInfo of optionInfos) {
|
6242 | schemas.push(optionInfoToSchema(optionInfo, {
|
6243 | isCLI,
|
6244 | optionInfos,
|
6245 | colorsModule,
|
6246 | levenshteinDistance
|
6247 | }));
|
6248 | if (optionInfo.alias && isCLI) {
|
6249 | schemas.push(vnopts.AliasSchema.create({
|
6250 | name: optionInfo.alias,
|
6251 | sourceName: optionInfo.name
|
6252 | }));
|
6253 | }
|
6254 | }
|
6255 | return schemas;
|
6256 | }
|
6257 | function optionInfoToSchema(optionInfo, {
|
6258 | isCLI,
|
6259 | optionInfos,
|
6260 | colorsModule,
|
6261 | levenshteinDistance
|
6262 | }) {
|
6263 | const {
|
6264 | name
|
6265 | } = optionInfo;
|
6266 | if (name === "plugin-search-dir" || name === "pluginSearchDirs") {
|
6267 | return vnopts.AnySchema.create({
|
6268 | name,
|
6269 | preprocess(value) {
|
6270 | if (value === false) {
|
6271 | return value;
|
6272 | }
|
6273 | value = Array.isArray(value) ? value : [value];
|
6274 | return value;
|
6275 | },
|
6276 | validate(value) {
|
6277 | if (value === false) {
|
6278 | return true;
|
6279 | }
|
6280 | return value.every((dir) => typeof dir === "string");
|
6281 | },
|
6282 | expected() {
|
6283 | return "false or paths to plugin search dir";
|
6284 | }
|
6285 | });
|
6286 | }
|
6287 | const parameters = {
|
6288 | name
|
6289 | };
|
6290 | let SchemaConstructor;
|
6291 | const handlers = {};
|
6292 | switch (optionInfo.type) {
|
6293 | case "int":
|
6294 | SchemaConstructor = vnopts.IntegerSchema;
|
6295 | if (isCLI) {
|
6296 | parameters.preprocess = Number;
|
6297 | }
|
6298 | break;
|
6299 | case "string":
|
6300 | SchemaConstructor = vnopts.StringSchema;
|
6301 | break;
|
6302 | case "choice":
|
6303 | SchemaConstructor = vnopts.ChoiceSchema;
|
6304 | parameters.choices = optionInfo.choices.map((choiceInfo) => typeof choiceInfo === "object" && choiceInfo.redirect ? Object.assign(Object.assign({}, choiceInfo), {}, {
|
6305 | redirect: {
|
6306 | to: {
|
6307 | key: optionInfo.name,
|
6308 | value: choiceInfo.redirect
|
6309 | }
|
6310 | }
|
6311 | }) : choiceInfo);
|
6312 | break;
|
6313 | case "boolean":
|
6314 | SchemaConstructor = vnopts.BooleanSchema;
|
6315 | break;
|
6316 | case "flag":
|
6317 | SchemaConstructor = getFlagSchema({
|
6318 | colorsModule,
|
6319 | levenshteinDistance
|
6320 | });
|
6321 | parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean));
|
6322 | break;
|
6323 | case "path":
|
6324 | SchemaConstructor = vnopts.StringSchema;
|
6325 | break;
|
6326 | default:
|
6327 | throw new Error(`Unexpected type ${optionInfo.type}`);
|
6328 | }
|
6329 | if (optionInfo.exception) {
|
6330 | parameters.validate = (value, schema, utils) => optionInfo.exception(value) || schema.validate(value, utils);
|
6331 | } else {
|
6332 | parameters.validate = (value, schema, utils) => value === void 0 || schema.validate(value, utils);
|
6333 | }
|
6334 | if (optionInfo.redirect) {
|
6335 | handlers.redirect = (value) => !value ? void 0 : {
|
6336 | to: {
|
6337 | key: optionInfo.redirect.option,
|
6338 | value: optionInfo.redirect.value
|
6339 | }
|
6340 | };
|
6341 | }
|
6342 | if (optionInfo.deprecated) {
|
6343 | handlers.deprecated = true;
|
6344 | }
|
6345 | if (isCLI && !optionInfo.array) {
|
6346 | const originalPreprocess = parameters.preprocess || ((x) => x);
|
6347 | parameters.preprocess = (value, schema, utils) => schema.preprocess(originalPreprocess(Array.isArray(value) ? getLast(value) : value), utils);
|
6348 | }
|
6349 | return optionInfo.array ? vnopts.ArraySchema.create(Object.assign(Object.assign(Object.assign({}, isCLI ? {
|
6350 | preprocess: (v) => Array.isArray(v) ? v : [v]
|
6351 | } : {}), handlers), {}, {
|
6352 | valueSchema: SchemaConstructor.create(parameters)
|
6353 | })) : SchemaConstructor.create(Object.assign(Object.assign({}, parameters), handlers));
|
6354 | }
|
6355 | function normalizeApiOptions(options, optionInfos, opts) {
|
6356 | return normalizeOptions(options, optionInfos, opts);
|
6357 | }
|
6358 | function normalizeCliOptions(options, optionInfos, opts) {
|
6359 | if (false) {
|
6360 | if (!opts.colorsModule) {
|
6361 | throw new Error("'colorsModule' option is required.");
|
6362 | }
|
6363 | if (!opts.levenshteinDistance) {
|
6364 | throw new Error("'levenshteinDistance' option is required.");
|
6365 | }
|
6366 | }
|
6367 | return normalizeOptions(options, optionInfos, Object.assign({
|
6368 | isCLI: true
|
6369 | }, opts));
|
6370 | }
|
6371 | module2.exports = {
|
6372 | normalizeApiOptions,
|
6373 | normalizeCliOptions
|
6374 | };
|
6375 | }
|
6376 | });
|
6377 | var require_loc = __commonJS2({
|
6378 | "src/language-js/loc.js"(exports2, module2) {
|
6379 | "use strict";
|
6380 | var isNonEmptyArray = require_is_non_empty_array();
|
6381 | function locStart(node) {
|
6382 | var _node$declaration$dec, _node$declaration;
|
6383 | const start = node.range ? node.range[0] : node.start;
|
6384 | const decorators = (_node$declaration$dec = (_node$declaration = node.declaration) === null || _node$declaration === void 0 ? void 0 : _node$declaration.decorators) !== null && _node$declaration$dec !== void 0 ? _node$declaration$dec : node.decorators;
|
6385 | if (isNonEmptyArray(decorators)) {
|
6386 | return Math.min(locStart(decorators[0]), start);
|
6387 | }
|
6388 | return start;
|
6389 | }
|
6390 | function locEnd(node) {
|
6391 | return node.range ? node.range[1] : node.end;
|
6392 | }
|
6393 | function hasSameLocStart(nodeA, nodeB) {
|
6394 | const nodeAStart = locStart(nodeA);
|
6395 | return Number.isInteger(nodeAStart) && nodeAStart === locStart(nodeB);
|
6396 | }
|
6397 | function hasSameLocEnd(nodeA, nodeB) {
|
6398 | const nodeAEnd = locEnd(nodeA);
|
6399 | return Number.isInteger(nodeAEnd) && nodeAEnd === locEnd(nodeB);
|
6400 | }
|
6401 | function hasSameLoc(nodeA, nodeB) {
|
6402 | return hasSameLocStart(nodeA, nodeB) && hasSameLocEnd(nodeA, nodeB);
|
6403 | }
|
6404 | module2.exports = {
|
6405 | locStart,
|
6406 | locEnd,
|
6407 | hasSameLocStart,
|
6408 | hasSameLoc
|
6409 | };
|
6410 | }
|
6411 | });
|
6412 | var require_load_parser = __commonJS2({
|
6413 | "src/main/load-parser.js"(exports2, module2) {
|
6414 | "use strict";
|
6415 | var path = require("path");
|
6416 | var {
|
6417 | ConfigError
|
6418 | } = require_errors();
|
6419 | var {
|
6420 | locStart,
|
6421 | locEnd
|
6422 | } = require_loc();
|
6423 | function requireParser(parser) {
|
6424 | try {
|
6425 | return {
|
6426 | parse: require(path.resolve(process.cwd(), parser)),
|
6427 | astFormat: "estree",
|
6428 | locStart,
|
6429 | locEnd
|
6430 | };
|
6431 | } catch {
|
6432 | throw new ConfigError(`Couldn't resolve parser "${parser}"`);
|
6433 | }
|
6434 | }
|
6435 | module2.exports = requireParser;
|
6436 | }
|
6437 | });
|
6438 | var require_js_tokens = __commonJS2({
|
6439 | "node_modules/js-tokens/index.js"(exports2) {
|
6440 | Object.defineProperty(exports2, "__esModule", {
|
6441 | value: true
|
6442 | });
|
6443 | exports2.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
|
6444 | exports2.matchToToken = function(match) {
|
6445 | var token = {
|
6446 | type: "invalid",
|
6447 | value: match[0],
|
6448 | closed: void 0
|
6449 | };
|
6450 | if (match[1])
|
6451 | token.type = "string", token.closed = !!(match[3] || match[4]);
|
6452 | else if (match[5])
|
6453 | token.type = "comment";
|
6454 | else if (match[6])
|
6455 | token.type = "comment", token.closed = !!match[7];
|
6456 | else if (match[8])
|
6457 | token.type = "regex";
|
6458 | else if (match[9])
|
6459 | token.type = "number";
|
6460 | else if (match[10])
|
6461 | token.type = "name";
|
6462 | else if (match[11])
|
6463 | token.type = "punctuator";
|
6464 | else if (match[12])
|
6465 | token.type = "whitespace";
|
6466 | return token;
|
6467 | };
|
6468 | }
|
6469 | });
|
6470 | var require_identifier = __commonJS2({
|
6471 | "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports2) {
|
6472 | "use strict";
|
6473 | Object.defineProperty(exports2, "__esModule", {
|
6474 | value: true
|
6475 | });
|
6476 | exports2.isIdentifierChar = isIdentifierChar;
|
6477 | exports2.isIdentifierName = isIdentifierName;
|
6478 | exports2.isIdentifierStart = isIdentifierStart;
|
6479 | var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
|
6480 | var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
|
6481 | var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
6482 | var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
6483 | nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
6484 | var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 190, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1070, 4050, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 46, 2, 18, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 482, 44, 11, 6, 17, 0, 322, 29, 19, 43, 1269, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4152, 8, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
6485 | var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 154, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 19306, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 262, 6, 10, 9, 357, 0, 62, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
6486 | function isInAstralSet(code, set) {
|
6487 | let pos = 65536;
|
6488 | for (let i = 0, length = set.length; i < length; i += 2) {
|
6489 | pos += set[i];
|
6490 | if (pos > code)
|
6491 | return false;
|
6492 | pos += set[i + 1];
|
6493 | if (pos >= code)
|
6494 | return true;
|
6495 | }
|
6496 | return false;
|
6497 | }
|
6498 | function isIdentifierStart(code) {
|
6499 | if (code < 65)
|
6500 | return code === 36;
|
6501 | if (code <= 90)
|
6502 | return true;
|
6503 | if (code < 97)
|
6504 | return code === 95;
|
6505 | if (code <= 122)
|
6506 | return true;
|
6507 | if (code <= 65535) {
|
6508 | return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
6509 | }
|
6510 | return isInAstralSet(code, astralIdentifierStartCodes);
|
6511 | }
|
6512 | function isIdentifierChar(code) {
|
6513 | if (code < 48)
|
6514 | return code === 36;
|
6515 | if (code < 58)
|
6516 | return true;
|
6517 | if (code < 65)
|
6518 | return false;
|
6519 | if (code <= 90)
|
6520 | return true;
|
6521 | if (code < 97)
|
6522 | return code === 95;
|
6523 | if (code <= 122)
|
6524 | return true;
|
6525 | if (code <= 65535) {
|
6526 | return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
6527 | }
|
6528 | return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
6529 | }
|
6530 | function isIdentifierName(name) {
|
6531 | let isFirst = true;
|
6532 | for (let i = 0; i < name.length; i++) {
|
6533 | let cp = name.charCodeAt(i);
|
6534 | if ((cp & 64512) === 55296 && i + 1 < name.length) {
|
6535 | const trail = name.charCodeAt(++i);
|
6536 | if ((trail & 64512) === 56320) {
|
6537 | cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
|
6538 | }
|
6539 | }
|
6540 | if (isFirst) {
|
6541 | isFirst = false;
|
6542 | if (!isIdentifierStart(cp)) {
|
6543 | return false;
|
6544 | }
|
6545 | } else if (!isIdentifierChar(cp)) {
|
6546 | return false;
|
6547 | }
|
6548 | }
|
6549 | return !isFirst;
|
6550 | }
|
6551 | }
|
6552 | });
|
6553 | var require_keyword = __commonJS2({
|
6554 | "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports2) {
|
6555 | "use strict";
|
6556 | Object.defineProperty(exports2, "__esModule", {
|
6557 | value: true
|
6558 | });
|
6559 | exports2.isKeyword = isKeyword;
|
6560 | exports2.isReservedWord = isReservedWord;
|
6561 | exports2.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
6562 | exports2.isStrictBindReservedWord = isStrictBindReservedWord;
|
6563 | exports2.isStrictReservedWord = isStrictReservedWord;
|
6564 | var reservedWords = {
|
6565 | keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
6566 | strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
6567 | strictBind: ["eval", "arguments"]
|
6568 | };
|
6569 | var keywords = new Set(reservedWords.keyword);
|
6570 | var reservedWordsStrictSet = new Set(reservedWords.strict);
|
6571 | var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
6572 | function isReservedWord(word, inModule) {
|
6573 | return inModule && word === "await" || word === "enum";
|
6574 | }
|
6575 | function isStrictReservedWord(word, inModule) {
|
6576 | return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
6577 | }
|
6578 | function isStrictBindOnlyReservedWord(word) {
|
6579 | return reservedWordsStrictBindSet.has(word);
|
6580 | }
|
6581 | function isStrictBindReservedWord(word, inModule) {
|
6582 | return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
6583 | }
|
6584 | function isKeyword(word) {
|
6585 | return keywords.has(word);
|
6586 | }
|
6587 | }
|
6588 | });
|
6589 | var require_lib3 = __commonJS2({
|
6590 | "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports2) {
|
6591 | "use strict";
|
6592 | Object.defineProperty(exports2, "__esModule", {
|
6593 | value: true
|
6594 | });
|
6595 | Object.defineProperty(exports2, "isIdentifierChar", {
|
6596 | enumerable: true,
|
6597 | get: function() {
|
6598 | return _identifier.isIdentifierChar;
|
6599 | }
|
6600 | });
|
6601 | Object.defineProperty(exports2, "isIdentifierName", {
|
6602 | enumerable: true,
|
6603 | get: function() {
|
6604 | return _identifier.isIdentifierName;
|
6605 | }
|
6606 | });
|
6607 | Object.defineProperty(exports2, "isIdentifierStart", {
|
6608 | enumerable: true,
|
6609 | get: function() {
|
6610 | return _identifier.isIdentifierStart;
|
6611 | }
|
6612 | });
|
6613 | Object.defineProperty(exports2, "isKeyword", {
|
6614 | enumerable: true,
|
6615 | get: function() {
|
6616 | return _keyword.isKeyword;
|
6617 | }
|
6618 | });
|
6619 | Object.defineProperty(exports2, "isReservedWord", {
|
6620 | enumerable: true,
|
6621 | get: function() {
|
6622 | return _keyword.isReservedWord;
|
6623 | }
|
6624 | });
|
6625 | Object.defineProperty(exports2, "isStrictBindOnlyReservedWord", {
|
6626 | enumerable: true,
|
6627 | get: function() {
|
6628 | return _keyword.isStrictBindOnlyReservedWord;
|
6629 | }
|
6630 | });
|
6631 | Object.defineProperty(exports2, "isStrictBindReservedWord", {
|
6632 | enumerable: true,
|
6633 | get: function() {
|
6634 | return _keyword.isStrictBindReservedWord;
|
6635 | }
|
6636 | });
|
6637 | Object.defineProperty(exports2, "isStrictReservedWord", {
|
6638 | enumerable: true,
|
6639 | get: function() {
|
6640 | return _keyword.isStrictReservedWord;
|
6641 | }
|
6642 | });
|
6643 | var _identifier = require_identifier();
|
6644 | var _keyword = require_keyword();
|
6645 | }
|
6646 | });
|
6647 | var require_escape_string_regexp2 = __commonJS2({
|
6648 | "node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js"(exports2, module2) {
|
6649 | "use strict";
|
6650 | var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
6651 | module2.exports = function(str) {
|
6652 | if (typeof str !== "string") {
|
6653 | throw new TypeError("Expected a string");
|
6654 | }
|
6655 | return str.replace(matchOperatorsRe, "\\$&");
|
6656 | };
|
6657 | }
|
6658 | });
|
6659 | var require_has_flag2 = __commonJS2({
|
6660 | "node_modules/@babel/highlight/node_modules/has-flag/index.js"(exports2, module2) {
|
6661 | "use strict";
|
6662 | module2.exports = (flag, argv) => {
|
6663 | argv = argv || process.argv;
|
6664 | const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
6665 | const pos = argv.indexOf(prefix + flag);
|
6666 | const terminatorPos = argv.indexOf("--");
|
6667 | return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
6668 | };
|
6669 | }
|
6670 | });
|
6671 | var require_supports_color2 = __commonJS2({
|
6672 | "node_modules/@babel/highlight/node_modules/supports-color/index.js"(exports2, module2) {
|
6673 | "use strict";
|
6674 | var os = require("os");
|
6675 | var hasFlag = require_has_flag2();
|
6676 | var env = process.env;
|
6677 | var forceColor;
|
6678 | if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false")) {
|
6679 | forceColor = false;
|
6680 | } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
6681 | forceColor = true;
|
6682 | }
|
6683 | if ("FORCE_COLOR" in env) {
|
6684 | forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
|
6685 | }
|
6686 | function translateLevel(level) {
|
6687 | if (level === 0) {
|
6688 | return false;
|
6689 | }
|
6690 | return {
|
6691 | level,
|
6692 | hasBasic: true,
|
6693 | has256: level >= 2,
|
6694 | has16m: level >= 3
|
6695 | };
|
6696 | }
|
6697 | function supportsColor(stream) {
|
6698 | if (forceColor === false) {
|
6699 | return 0;
|
6700 | }
|
6701 | if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
6702 | return 3;
|
6703 | }
|
6704 | if (hasFlag("color=256")) {
|
6705 | return 2;
|
6706 | }
|
6707 | if (stream && !stream.isTTY && forceColor !== true) {
|
6708 | return 0;
|
6709 | }
|
6710 | const min = forceColor ? 1 : 0;
|
6711 | if (process.platform === "win32") {
|
6712 | const osRelease = os.release().split(".");
|
6713 | if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
6714 | return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
6715 | }
|
6716 | return 1;
|
6717 | }
|
6718 | if ("CI" in env) {
|
6719 | if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
6720 | return 1;
|
6721 | }
|
6722 | return min;
|
6723 | }
|
6724 | if ("TEAMCITY_VERSION" in env) {
|
6725 | return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
6726 | }
|
6727 | if (env.COLORTERM === "truecolor") {
|
6728 | return 3;
|
6729 | }
|
6730 | if ("TERM_PROGRAM" in env) {
|
6731 | const version2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
6732 | switch (env.TERM_PROGRAM) {
|
6733 | case "iTerm.app":
|
6734 | return version2 >= 3 ? 3 : 2;
|
6735 | case "Apple_Terminal":
|
6736 | return 2;
|
6737 | }
|
6738 | }
|
6739 | if (/-256(color)?$/i.test(env.TERM)) {
|
6740 | return 2;
|
6741 | }
|
6742 | if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
6743 | return 1;
|
6744 | }
|
6745 | if ("COLORTERM" in env) {
|
6746 | return 1;
|
6747 | }
|
6748 | if (env.TERM === "dumb") {
|
6749 | return min;
|
6750 | }
|
6751 | return min;
|
6752 | }
|
6753 | function getSupportLevel(stream) {
|
6754 | const level = supportsColor(stream);
|
6755 | return translateLevel(level);
|
6756 | }
|
6757 | module2.exports = {
|
6758 | supportsColor: getSupportLevel,
|
6759 | stdout: getSupportLevel(process.stdout),
|
6760 | stderr: getSupportLevel(process.stderr)
|
6761 | };
|
6762 | }
|
6763 | });
|
6764 | var require_templates2 = __commonJS2({
|
6765 | "node_modules/@babel/highlight/node_modules/chalk/templates.js"(exports2, module2) {
|
6766 | "use strict";
|
6767 | var TEMPLATE_REGEX = /(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
6768 | var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
6769 | var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
6770 | var ESCAPE_REGEX = /\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;
|
6771 | var ESCAPES = new Map([["n", "\n"], ["r", "\r"], ["t", " "], ["b", "\b"], ["f", "\f"], ["v", "\v"], ["0", "\0"], ["\\", "\\"], ["e", "\x1B"], ["a", "\x07"]]);
|
6772 | function unescape(c) {
|
6773 | if (c[0] === "u" && c.length === 5 || c[0] === "x" && c.length === 3) {
|
6774 | return String.fromCharCode(parseInt(c.slice(1), 16));
|
6775 | }
|
6776 | return ESCAPES.get(c) || c;
|
6777 | }
|
6778 | function parseArguments(name, args) {
|
6779 | const results = [];
|
6780 | const chunks = args.trim().split(/\s*,\s*/g);
|
6781 | let matches;
|
6782 | for (const chunk of chunks) {
|
6783 | if (!isNaN(chunk)) {
|
6784 | results.push(Number(chunk));
|
6785 | } else if (matches = chunk.match(STRING_REGEX)) {
|
6786 | results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, chr) => escape ? unescape(escape) : chr));
|
6787 | } else {
|
6788 | throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
6789 | }
|
6790 | }
|
6791 | return results;
|
6792 | }
|
6793 | function parseStyle(style) {
|
6794 | STYLE_REGEX.lastIndex = 0;
|
6795 | const results = [];
|
6796 | let matches;
|
6797 | while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
6798 | const name = matches[1];
|
6799 | if (matches[2]) {
|
6800 | const args = parseArguments(name, matches[2]);
|
6801 | results.push([name].concat(args));
|
6802 | } else {
|
6803 | results.push([name]);
|
6804 | }
|
6805 | }
|
6806 | return results;
|
6807 | }
|
6808 | function buildStyle(chalk, styles) {
|
6809 | const enabled = {};
|
6810 | for (const layer of styles) {
|
6811 | for (const style of layer.styles) {
|
6812 | enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
6813 | }
|
6814 | }
|
6815 | let current = chalk;
|
6816 | for (const styleName of Object.keys(enabled)) {
|
6817 | if (Array.isArray(enabled[styleName])) {
|
6818 | if (!(styleName in current)) {
|
6819 | throw new Error(`Unknown Chalk style: ${styleName}`);
|
6820 | }
|
6821 | if (enabled[styleName].length > 0) {
|
6822 | current = current[styleName].apply(current, enabled[styleName]);
|
6823 | } else {
|
6824 | current = current[styleName];
|
6825 | }
|
6826 | }
|
6827 | }
|
6828 | return current;
|
6829 | }
|
6830 | module2.exports = (chalk, tmp) => {
|
6831 | const styles = [];
|
6832 | const chunks = [];
|
6833 | let chunk = [];
|
6834 | tmp.replace(TEMPLATE_REGEX, (m, escapeChar, inverse, style, close, chr) => {
|
6835 | if (escapeChar) {
|
6836 | chunk.push(unescape(escapeChar));
|
6837 | } else if (style) {
|
6838 | const str = chunk.join("");
|
6839 | chunk = [];
|
6840 | chunks.push(styles.length === 0 ? str : buildStyle(chalk, styles)(str));
|
6841 | styles.push({
|
6842 | inverse,
|
6843 | styles: parseStyle(style)
|
6844 | });
|
6845 | } else if (close) {
|
6846 | if (styles.length === 0) {
|
6847 | throw new Error("Found extraneous } in Chalk template literal");
|
6848 | }
|
6849 | chunks.push(buildStyle(chalk, styles)(chunk.join("")));
|
6850 | chunk = [];
|
6851 | styles.pop();
|
6852 | } else {
|
6853 | chunk.push(chr);
|
6854 | }
|
6855 | });
|
6856 | chunks.push(chunk.join(""));
|
6857 | if (styles.length > 0) {
|
6858 | const errMsg = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
6859 | throw new Error(errMsg);
|
6860 | }
|
6861 | return chunks.join("");
|
6862 | };
|
6863 | }
|
6864 | });
|
6865 | var require_chalk2 = __commonJS2({
|
6866 | "node_modules/@babel/highlight/node_modules/chalk/index.js"(exports2, module2) {
|
6867 | "use strict";
|
6868 | var escapeStringRegexp2 = require_escape_string_regexp2();
|
6869 | var ansiStyles = require_ansi_styles();
|
6870 | var stdoutColor = require_supports_color2().stdout;
|
6871 | var template = require_templates2();
|
6872 | var isSimpleWindowsTerm = process.platform === "win32" && !(process.env.TERM || "").toLowerCase().startsWith("xterm");
|
6873 | var levelMapping = ["ansi", "ansi", "ansi256", "ansi16m"];
|
6874 | var skipModels = new Set(["gray"]);
|
6875 | var styles = Object.create(null);
|
6876 | function applyOptions(obj, options) {
|
6877 | options = options || {};
|
6878 | const scLevel = stdoutColor ? stdoutColor.level : 0;
|
6879 | obj.level = options.level === void 0 ? scLevel : options.level;
|
6880 | obj.enabled = "enabled" in options ? options.enabled : obj.level > 0;
|
6881 | }
|
6882 | function Chalk(options) {
|
6883 | if (!this || !(this instanceof Chalk) || this.template) {
|
6884 | const chalk = {};
|
6885 | applyOptions(chalk, options);
|
6886 | chalk.template = function() {
|
6887 | const args = [].slice.call(arguments);
|
6888 | return chalkTag.apply(null, [chalk.template].concat(args));
|
6889 | };
|
6890 | Object.setPrototypeOf(chalk, Chalk.prototype);
|
6891 | Object.setPrototypeOf(chalk.template, chalk);
|
6892 | chalk.template.constructor = Chalk;
|
6893 | return chalk.template;
|
6894 | }
|
6895 | applyOptions(this, options);
|
6896 | }
|
6897 | if (isSimpleWindowsTerm) {
|
6898 | ansiStyles.blue.open = "\x1B[94m";
|
6899 | }
|
6900 | for (const key of Object.keys(ansiStyles)) {
|
6901 | ansiStyles[key].closeRe = new RegExp(escapeStringRegexp2(ansiStyles[key].close), "g");
|
6902 | styles[key] = {
|
6903 | get() {
|
6904 | const codes = ansiStyles[key];
|
6905 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, key);
|
6906 | }
|
6907 | };
|
6908 | }
|
6909 | styles.visible = {
|
6910 | get() {
|
6911 | return build.call(this, this._styles || [], true, "visible");
|
6912 | }
|
6913 | };
|
6914 | ansiStyles.color.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.color.close), "g");
|
6915 | for (const model of Object.keys(ansiStyles.color.ansi)) {
|
6916 | if (skipModels.has(model)) {
|
6917 | continue;
|
6918 | }
|
6919 | styles[model] = {
|
6920 | get() {
|
6921 | const level = this.level;
|
6922 | return function() {
|
6923 | const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
|
6924 | const codes = {
|
6925 | open,
|
6926 | close: ansiStyles.color.close,
|
6927 | closeRe: ansiStyles.color.closeRe
|
6928 | };
|
6929 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
6930 | };
|
6931 | }
|
6932 | };
|
6933 | }
|
6934 | ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp2(ansiStyles.bgColor.close), "g");
|
6935 | for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
6936 | if (skipModels.has(model)) {
|
6937 | continue;
|
6938 | }
|
6939 | const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
6940 | styles[bgModel] = {
|
6941 | get() {
|
6942 | const level = this.level;
|
6943 | return function() {
|
6944 | const open = ansiStyles.bgColor[levelMapping[level]][model].apply(null, arguments);
|
6945 | const codes = {
|
6946 | open,
|
6947 | close: ansiStyles.bgColor.close,
|
6948 | closeRe: ansiStyles.bgColor.closeRe
|
6949 | };
|
6950 | return build.call(this, this._styles ? this._styles.concat(codes) : [codes], this._empty, model);
|
6951 | };
|
6952 | }
|
6953 | };
|
6954 | }
|
6955 | var proto = Object.defineProperties(() => {
|
6956 | }, styles);
|
6957 | function build(_styles, _empty, key) {
|
6958 | const builder = function() {
|
6959 | return applyStyle.apply(builder, arguments);
|
6960 | };
|
6961 | builder._styles = _styles;
|
6962 | builder._empty = _empty;
|
6963 | const self2 = this;
|
6964 | Object.defineProperty(builder, "level", {
|
6965 | enumerable: true,
|
6966 | get() {
|
6967 | return self2.level;
|
6968 | },
|
6969 | set(level) {
|
6970 | self2.level = level;
|
6971 | }
|
6972 | });
|
6973 | Object.defineProperty(builder, "enabled", {
|
6974 | enumerable: true,
|
6975 | get() {
|
6976 | return self2.enabled;
|
6977 | },
|
6978 | set(enabled) {
|
6979 | self2.enabled = enabled;
|
6980 | }
|
6981 | });
|
6982 | builder.hasGrey = this.hasGrey || key === "gray" || key === "grey";
|
6983 | builder.__proto__ = proto;
|
6984 | return builder;
|
6985 | }
|
6986 | function applyStyle() {
|
6987 | const args = arguments;
|
6988 | const argsLen = args.length;
|
6989 | let str = String(arguments[0]);
|
6990 | if (argsLen === 0) {
|
6991 | return "";
|
6992 | }
|
6993 | if (argsLen > 1) {
|
6994 | for (let a = 1; a < argsLen; a++) {
|
6995 | str += " " + args[a];
|
6996 | }
|
6997 | }
|
6998 | if (!this.enabled || this.level <= 0 || !str) {
|
6999 | return this._empty ? "" : str;
|
7000 | }
|
7001 | const originalDim = ansiStyles.dim.open;
|
7002 | if (isSimpleWindowsTerm && this.hasGrey) {
|
7003 | ansiStyles.dim.open = "";
|
7004 | }
|
7005 | for (const code of this._styles.slice().reverse()) {
|
7006 | str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
7007 | str = str.replace(/\r?\n/g, `${code.close}$&${code.open}`);
|
7008 | }
|
7009 | ansiStyles.dim.open = originalDim;
|
7010 | return str;
|
7011 | }
|
7012 | function chalkTag(chalk, strings) {
|
7013 | if (!Array.isArray(strings)) {
|
7014 | return [].slice.call(arguments, 1).join(" ");
|
7015 | }
|
7016 | const args = [].slice.call(arguments, 2);
|
7017 | const parts = [strings.raw[0]];
|
7018 | for (let i = 1; i < strings.length; i++) {
|
7019 | parts.push(String(args[i - 1]).replace(/[{}\\]/g, "\\$&"));
|
7020 | parts.push(String(strings.raw[i]));
|
7021 | }
|
7022 | return template(chalk, parts.join(""));
|
7023 | }
|
7024 | Object.defineProperties(Chalk.prototype, styles);
|
7025 | module2.exports = Chalk();
|
7026 | module2.exports.supportsColor = stdoutColor;
|
7027 | module2.exports.default = module2.exports;
|
7028 | }
|
7029 | });
|
7030 | var require_lib4 = __commonJS2({
|
7031 | "node_modules/@babel/highlight/lib/index.js"(exports2) {
|
7032 | "use strict";
|
7033 | Object.defineProperty(exports2, "__esModule", {
|
7034 | value: true
|
7035 | });
|
7036 | exports2.default = highlight;
|
7037 | exports2.getChalk = getChalk;
|
7038 | exports2.shouldHighlight = shouldHighlight;
|
7039 | var _jsTokens = require_js_tokens();
|
7040 | var _helperValidatorIdentifier = require_lib3();
|
7041 | var _chalk = require_chalk2();
|
7042 | var sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
7043 | function getDefs(chalk) {
|
7044 | return {
|
7045 | keyword: chalk.cyan,
|
7046 | capitalized: chalk.yellow,
|
7047 | jsxIdentifier: chalk.yellow,
|
7048 | punctuator: chalk.yellow,
|
7049 | number: chalk.magenta,
|
7050 | string: chalk.green,
|
7051 | regex: chalk.magenta,
|
7052 | comment: chalk.grey,
|
7053 | invalid: chalk.white.bgRed.bold
|
7054 | };
|
7055 | }
|
7056 | var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
7057 | var BRACKET = /^[()[\]{}]$/;
|
7058 | var tokenize;
|
7059 | {
|
7060 | const JSX_TAG = /^[a-z][\w-]*$/i;
|
7061 | const getTokenType = function(token, offset, text) {
|
7062 | if (token.type === "name") {
|
7063 | if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
7064 | return "keyword";
|
7065 | }
|
7066 | if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
7067 | return "jsxIdentifier";
|
7068 | }
|
7069 | if (token.value[0] !== token.value[0].toLowerCase()) {
|
7070 | return "capitalized";
|
7071 | }
|
7072 | }
|
7073 | if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
7074 | return "bracket";
|
7075 | }
|
7076 | if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
7077 | return "punctuator";
|
7078 | }
|
7079 | return token.type;
|
7080 | };
|
7081 | tokenize = function* (text) {
|
7082 | let match;
|
7083 | while (match = _jsTokens.default.exec(text)) {
|
7084 | const token = _jsTokens.matchToToken(match);
|
7085 | yield {
|
7086 | type: getTokenType(token, match.index, text),
|
7087 | value: token.value
|
7088 | };
|
7089 | }
|
7090 | };
|
7091 | }
|
7092 | function highlightTokens(defs, text) {
|
7093 | let highlighted = "";
|
7094 | for (const {
|
7095 | type,
|
7096 | value
|
7097 | } of tokenize(text)) {
|
7098 | const colorize = defs[type];
|
7099 | if (colorize) {
|
7100 | highlighted += value.split(NEWLINE).map((str) => colorize(str)).join("\n");
|
7101 | } else {
|
7102 | highlighted += value;
|
7103 | }
|
7104 | }
|
7105 | return highlighted;
|
7106 | }
|
7107 | function shouldHighlight(options) {
|
7108 | return !!_chalk.supportsColor || options.forceColor;
|
7109 | }
|
7110 | function getChalk(options) {
|
7111 | return options.forceColor ? new _chalk.constructor({
|
7112 | enabled: true,
|
7113 | level: 1
|
7114 | }) : _chalk;
|
7115 | }
|
7116 | function highlight(code, options = {}) {
|
7117 | if (code !== "" && shouldHighlight(options)) {
|
7118 | const chalk = getChalk(options);
|
7119 | const defs = getDefs(chalk);
|
7120 | return highlightTokens(defs, code);
|
7121 | } else {
|
7122 | return code;
|
7123 | }
|
7124 | }
|
7125 | }
|
7126 | });
|
7127 | var require_lib5 = __commonJS2({
|
7128 | "node_modules/@babel/code-frame/lib/index.js"(exports2) {
|
7129 | "use strict";
|
7130 | Object.defineProperty(exports2, "__esModule", {
|
7131 | value: true
|
7132 | });
|
7133 | exports2.codeFrameColumns = codeFrameColumns;
|
7134 | exports2.default = _default;
|
7135 | var _highlight = require_lib4();
|
7136 | var deprecationWarningShown = false;
|
7137 | function getDefs(chalk) {
|
7138 | return {
|
7139 | gutter: chalk.grey,
|
7140 | marker: chalk.red.bold,
|
7141 | message: chalk.red.bold
|
7142 | };
|
7143 | }
|
7144 | var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
7145 | function getMarkerLines(loc, source, opts) {
|
7146 | const startLoc = Object.assign({
|
7147 | column: 0,
|
7148 | line: -1
|
7149 | }, loc.start);
|
7150 | const endLoc = Object.assign({}, startLoc, loc.end);
|
7151 | const {
|
7152 | linesAbove = 2,
|
7153 | linesBelow = 3
|
7154 | } = opts || {};
|
7155 | const startLine = startLoc.line;
|
7156 | const startColumn = startLoc.column;
|
7157 | const endLine = endLoc.line;
|
7158 | const endColumn = endLoc.column;
|
7159 | let start = Math.max(startLine - (linesAbove + 1), 0);
|
7160 | let end = Math.min(source.length, endLine + linesBelow);
|
7161 | if (startLine === -1) {
|
7162 | start = 0;
|
7163 | }
|
7164 | if (endLine === -1) {
|
7165 | end = source.length;
|
7166 | }
|
7167 | const lineDiff = endLine - startLine;
|
7168 | const markerLines = {};
|
7169 | if (lineDiff) {
|
7170 | for (let i = 0; i <= lineDiff; i++) {
|
7171 | const lineNumber = i + startLine;
|
7172 | if (!startColumn) {
|
7173 | markerLines[lineNumber] = true;
|
7174 | } else if (i === 0) {
|
7175 | const sourceLength = source[lineNumber - 1].length;
|
7176 | markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
7177 | } else if (i === lineDiff) {
|
7178 | markerLines[lineNumber] = [0, endColumn];
|
7179 | } else {
|
7180 | const sourceLength = source[lineNumber - i].length;
|
7181 | markerLines[lineNumber] = [0, sourceLength];
|
7182 | }
|
7183 | }
|
7184 | } else {
|
7185 | if (startColumn === endColumn) {
|
7186 | if (startColumn) {
|
7187 | markerLines[startLine] = [startColumn, 0];
|
7188 | } else {
|
7189 | markerLines[startLine] = true;
|
7190 | }
|
7191 | } else {
|
7192 | markerLines[startLine] = [startColumn, endColumn - startColumn];
|
7193 | }
|
7194 | }
|
7195 | return {
|
7196 | start,
|
7197 | end,
|
7198 | markerLines
|
7199 | };
|
7200 | }
|
7201 | function codeFrameColumns(rawLines, loc, opts = {}) {
|
7202 | const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
7203 | const chalk = (0, _highlight.getChalk)(opts);
|
7204 | const defs = getDefs(chalk);
|
7205 | const maybeHighlight = (chalkFn, string) => {
|
7206 | return highlighted ? chalkFn(string) : string;
|
7207 | };
|
7208 | const lines = rawLines.split(NEWLINE);
|
7209 | const {
|
7210 | start,
|
7211 | end,
|
7212 | markerLines
|
7213 | } = getMarkerLines(loc, lines, opts);
|
7214 | const hasColumns = loc.start && typeof loc.start.column === "number";
|
7215 | const numberMaxWidth = String(end).length;
|
7216 | const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
7217 | let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
|
7218 | const number = start + 1 + index;
|
7219 | const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
7220 | const gutter = ` ${paddedNumber} |`;
|
7221 | const hasMarker = markerLines[number];
|
7222 | const lastMarkerLine = !markerLines[number + 1];
|
7223 | if (hasMarker) {
|
7224 | let markerLine = "";
|
7225 | if (Array.isArray(hasMarker)) {
|
7226 | const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
7227 | const numberOfMarkers = hasMarker[1] || 1;
|
7228 | markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
7229 | if (lastMarkerLine && opts.message) {
|
7230 | markerLine += " " + maybeHighlight(defs.message, opts.message);
|
7231 | }
|
7232 | }
|
7233 | return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
7234 | } else {
|
7235 | return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
7236 | }
|
7237 | }).join("\n");
|
7238 | if (opts.message && !hasColumns) {
|
7239 | frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
|
7240 | ${frame}`;
|
7241 | }
|
7242 | if (highlighted) {
|
7243 | return chalk.reset(frame);
|
7244 | } else {
|
7245 | return frame;
|
7246 | }
|
7247 | }
|
7248 | function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
7249 | if (!deprecationWarningShown) {
|
7250 | deprecationWarningShown = true;
|
7251 | const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
7252 | if (process.emitWarning) {
|
7253 | process.emitWarning(message, "DeprecationWarning");
|
7254 | } else {
|
7255 | const deprecationError = new Error(message);
|
7256 | deprecationError.name = "DeprecationWarning";
|
7257 | console.warn(new Error(message));
|
7258 | }
|
7259 | }
|
7260 | colNumber = Math.max(colNumber, 0);
|
7261 | const location = {
|
7262 | start: {
|
7263 | column: colNumber,
|
7264 | line: lineNumber
|
7265 | }
|
7266 | };
|
7267 | return codeFrameColumns(rawLines, location, opts);
|
7268 | }
|
7269 | }
|
7270 | });
|
7271 | var require_parser = __commonJS2({
|
7272 | "src/main/parser.js"(exports2, module2) {
|
7273 | "use strict";
|
7274 | var {
|
7275 | ConfigError
|
7276 | } = require_errors();
|
7277 | var jsLoc = require_loc();
|
7278 | var loadParser = require_load_parser();
|
7279 | var {
|
7280 | locStart,
|
7281 | locEnd
|
7282 | } = jsLoc;
|
7283 | var ownNames = Object.getOwnPropertyNames;
|
7284 | var ownDescriptor = Object.getOwnPropertyDescriptor;
|
7285 | function getParsers(options) {
|
7286 | const parsers = {};
|
7287 | for (const plugin of options.plugins) {
|
7288 | if (!plugin.parsers) {
|
7289 | continue;
|
7290 | }
|
7291 | for (const name of ownNames(plugin.parsers)) {
|
7292 | Object.defineProperty(parsers, name, ownDescriptor(plugin.parsers, name));
|
7293 | }
|
7294 | }
|
7295 | return parsers;
|
7296 | }
|
7297 | function resolveParser(opts, parsers = getParsers(opts)) {
|
7298 | if (typeof opts.parser === "function") {
|
7299 | return {
|
7300 | parse: opts.parser,
|
7301 | astFormat: "estree",
|
7302 | locStart,
|
7303 | locEnd
|
7304 | };
|
7305 | }
|
7306 | if (typeof opts.parser === "string") {
|
7307 | if (Object.prototype.hasOwnProperty.call(parsers, opts.parser)) {
|
7308 | return parsers[opts.parser];
|
7309 | }
|
7310 | if (false) {
|
7311 | throw new ConfigError(`Couldn't resolve parser "${opts.parser}". Parsers must be explicitly added to the standalone bundle.`);
|
7312 | }
|
7313 | return loadParser(opts.parser);
|
7314 | }
|
7315 | }
|
7316 | function parse(text, opts) {
|
7317 | const parsers = getParsers(opts);
|
7318 | const parsersForCustomParserApi = Object.defineProperties({}, Object.fromEntries(Object.keys(parsers).map((parserName) => [parserName, {
|
7319 | enumerable: true,
|
7320 | get() {
|
7321 | return parsers[parserName].parse;
|
7322 | }
|
7323 | }])));
|
7324 | const parser = resolveParser(opts, parsers);
|
7325 | try {
|
7326 | if (parser.preprocess) {
|
7327 | text = parser.preprocess(text, opts);
|
7328 | }
|
7329 | return {
|
7330 | text,
|
7331 | ast: parser.parse(text, parsersForCustomParserApi, opts)
|
7332 | };
|
7333 | } catch (error) {
|
7334 | const {
|
7335 | loc
|
7336 | } = error;
|
7337 | if (loc) {
|
7338 | const {
|
7339 | codeFrameColumns
|
7340 | } = require_lib5();
|
7341 | error.codeFrame = codeFrameColumns(text, loc, {
|
7342 | highlightCode: true
|
7343 | });
|
7344 | error.message += "\n" + error.codeFrame;
|
7345 | throw error;
|
7346 | }
|
7347 | throw error;
|
7348 | }
|
7349 | }
|
7350 | module2.exports = {
|
7351 | parse,
|
7352 | resolveParser
|
7353 | };
|
7354 | }
|
7355 | });
|
7356 | var require_readlines = __commonJS2({
|
7357 | "node_modules/n-readlines/readlines.js"(exports2, module2) {
|
7358 | "use strict";
|
7359 | var fs = require("fs");
|
7360 | var LineByLine = class {
|
7361 | constructor(file, options) {
|
7362 | options = options || {};
|
7363 | if (!options.readChunk)
|
7364 | options.readChunk = 1024;
|
7365 | if (!options.newLineCharacter) {
|
7366 | options.newLineCharacter = 10;
|
7367 | } else {
|
7368 | options.newLineCharacter = options.newLineCharacter.charCodeAt(0);
|
7369 | }
|
7370 | if (typeof file === "number") {
|
7371 | this.fd = file;
|
7372 | } else {
|
7373 | this.fd = fs.openSync(file, "r");
|
7374 | }
|
7375 | this.options = options;
|
7376 | this.newLineCharacter = options.newLineCharacter;
|
7377 | this.reset();
|
7378 | }
|
7379 | _searchInBuffer(buffer, hexNeedle) {
|
7380 | let found = -1;
|
7381 | for (let i = 0; i <= buffer.length; i++) {
|
7382 | let b_byte = buffer[i];
|
7383 | if (b_byte === hexNeedle) {
|
7384 | found = i;
|
7385 | break;
|
7386 | }
|
7387 | }
|
7388 | return found;
|
7389 | }
|
7390 | reset() {
|
7391 | this.eofReached = false;
|
7392 | this.linesCache = [];
|
7393 | this.fdPosition = 0;
|
7394 | }
|
7395 | close() {
|
7396 | fs.closeSync(this.fd);
|
7397 | this.fd = null;
|
7398 | }
|
7399 | _extractLines(buffer) {
|
7400 | let line;
|
7401 | const lines = [];
|
7402 | let bufferPosition = 0;
|
7403 | let lastNewLineBufferPosition = 0;
|
7404 | while (true) {
|
7405 | let bufferPositionValue = buffer[bufferPosition++];
|
7406 | if (bufferPositionValue === this.newLineCharacter) {
|
7407 | line = buffer.slice(lastNewLineBufferPosition, bufferPosition);
|
7408 | lines.push(line);
|
7409 | lastNewLineBufferPosition = bufferPosition;
|
7410 | } else if (bufferPositionValue === void 0) {
|
7411 | break;
|
7412 | }
|
7413 | }
|
7414 | let leftovers = buffer.slice(lastNewLineBufferPosition, bufferPosition);
|
7415 | if (leftovers.length) {
|
7416 | lines.push(leftovers);
|
7417 | }
|
7418 | return lines;
|
7419 | }
|
7420 | _readChunk(lineLeftovers) {
|
7421 | let totalBytesRead = 0;
|
7422 | let bytesRead;
|
7423 | const buffers = [];
|
7424 | do {
|
7425 | const readBuffer = new Buffer(this.options.readChunk);
|
7426 | bytesRead = fs.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
|
7427 | totalBytesRead = totalBytesRead + bytesRead;
|
7428 | this.fdPosition = this.fdPosition + bytesRead;
|
7429 | buffers.push(readBuffer);
|
7430 | } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
|
7431 | let bufferData = Buffer.concat(buffers);
|
7432 | if (bytesRead < this.options.readChunk) {
|
7433 | this.eofReached = true;
|
7434 | bufferData = bufferData.slice(0, totalBytesRead);
|
7435 | }
|
7436 | if (totalBytesRead) {
|
7437 | this.linesCache = this._extractLines(bufferData);
|
7438 | if (lineLeftovers) {
|
7439 | this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
|
7440 | }
|
7441 | }
|
7442 | return totalBytesRead;
|
7443 | }
|
7444 | next() {
|
7445 | if (!this.fd)
|
7446 | return false;
|
7447 | let line = false;
|
7448 | if (this.eofReached && this.linesCache.length === 0) {
|
7449 | return line;
|
7450 | }
|
7451 | let bytesRead;
|
7452 | if (!this.linesCache.length) {
|
7453 | bytesRead = this._readChunk();
|
7454 | }
|
7455 | if (this.linesCache.length) {
|
7456 | line = this.linesCache.shift();
|
7457 | const lastLineCharacter = line[line.length - 1];
|
7458 | if (lastLineCharacter !== this.newLineCharacter) {
|
7459 | bytesRead = this._readChunk(line);
|
7460 | if (bytesRead) {
|
7461 | line = this.linesCache.shift();
|
7462 | }
|
7463 | }
|
7464 | }
|
7465 | if (this.eofReached && this.linesCache.length === 0) {
|
7466 | this.close();
|
7467 | }
|
7468 | if (line && line[line.length - 1] === this.newLineCharacter) {
|
7469 | line = line.slice(0, line.length - 1);
|
7470 | }
|
7471 | return line;
|
7472 | }
|
7473 | };
|
7474 | module2.exports = LineByLine;
|
7475 | }
|
7476 | });
|
7477 | var require_get_interpreter = __commonJS2({
|
7478 | "src/utils/get-interpreter.js"(exports2, module2) {
|
7479 | "use strict";
|
7480 | var fs = require("fs");
|
7481 | var readlines = require_readlines();
|
7482 | function getInterpreter(filepath) {
|
7483 | if (typeof filepath !== "string") {
|
7484 | return "";
|
7485 | }
|
7486 | let fd;
|
7487 | try {
|
7488 | fd = fs.openSync(filepath, "r");
|
7489 | } catch {
|
7490 | return "";
|
7491 | }
|
7492 | try {
|
7493 | const liner = new readlines(fd);
|
7494 | const firstLine = liner.next().toString("utf8");
|
7495 | const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/);
|
7496 | if (m1) {
|
7497 | return m1[1];
|
7498 | }
|
7499 | const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/);
|
7500 | if (m2) {
|
7501 | return m2[1];
|
7502 | }
|
7503 | return "";
|
7504 | } catch {
|
7505 | return "";
|
7506 | } finally {
|
7507 | try {
|
7508 | fs.closeSync(fd);
|
7509 | } catch {
|
7510 | }
|
7511 | }
|
7512 | }
|
7513 | module2.exports = getInterpreter;
|
7514 | }
|
7515 | });
|
7516 | var require_options = __commonJS2({
|
7517 | "src/main/options.js"(exports2, module2) {
|
7518 | "use strict";
|
7519 | var path = require("path");
|
7520 | var {
|
7521 | UndefinedParserError
|
7522 | } = require_errors();
|
7523 | var {
|
7524 | getSupportInfo: getSupportInfo2
|
7525 | } = require_support();
|
7526 | var normalizer = require_options_normalizer();
|
7527 | var {
|
7528 | resolveParser
|
7529 | } = require_parser();
|
7530 | var hiddenDefaults = {
|
7531 | astFormat: "estree",
|
7532 | printer: {},
|
7533 | originalText: void 0,
|
7534 | locStart: null,
|
7535 | locEnd: null
|
7536 | };
|
7537 | function normalize(options, opts = {}) {
|
7538 | const rawOptions = Object.assign({}, options);
|
7539 | const supportOptions = getSupportInfo2({
|
7540 | plugins: options.plugins,
|
7541 | showUnreleased: true,
|
7542 | showDeprecated: true
|
7543 | }).options;
|
7544 | const defaults = Object.assign(Object.assign({}, hiddenDefaults), Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default])));
|
7545 | if (!rawOptions.parser) {
|
7546 | if (!rawOptions.filepath) {
|
7547 | const logger = opts.logger || console;
|
7548 | logger.warn("No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.");
|
7549 | rawOptions.parser = "babel";
|
7550 | } else {
|
7551 | rawOptions.parser = inferParser(rawOptions.filepath, rawOptions.plugins);
|
7552 | if (!rawOptions.parser) {
|
7553 | throw new UndefinedParserError(`No parser could be inferred for file: ${rawOptions.filepath}`);
|
7554 | }
|
7555 | }
|
7556 | }
|
7557 | const parser = resolveParser(normalizer.normalizeApiOptions(rawOptions, [supportOptions.find((x) => x.name === "parser")], {
|
7558 | passThrough: true,
|
7559 | logger: false
|
7560 | }));
|
7561 | rawOptions.astFormat = parser.astFormat;
|
7562 | rawOptions.locEnd = parser.locEnd;
|
7563 | rawOptions.locStart = parser.locStart;
|
7564 | const plugin = getPlugin(rawOptions);
|
7565 | rawOptions.printer = plugin.printers[rawOptions.astFormat];
|
7566 | const pluginDefaults = Object.fromEntries(supportOptions.filter((optionInfo) => optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name] !== void 0).map((optionInfo) => [optionInfo.name, optionInfo.pluginDefaults[plugin.name]]));
|
7567 | const mixedDefaults = Object.assign(Object.assign({}, defaults), pluginDefaults);
|
7568 | for (const [k, value] of Object.entries(mixedDefaults)) {
|
7569 | if (rawOptions[k] === null || rawOptions[k] === void 0) {
|
7570 | rawOptions[k] = value;
|
7571 | }
|
7572 | }
|
7573 | if (rawOptions.parser === "json") {
|
7574 | rawOptions.trailingComma = "none";
|
7575 | }
|
7576 | return normalizer.normalizeApiOptions(rawOptions, supportOptions, Object.assign({
|
7577 | passThrough: Object.keys(hiddenDefaults)
|
7578 | }, opts));
|
7579 | }
|
7580 | function getPlugin(options) {
|
7581 | const {
|
7582 | astFormat
|
7583 | } = options;
|
7584 | if (!astFormat) {
|
7585 | throw new Error("getPlugin() requires astFormat to be set");
|
7586 | }
|
7587 | const printerPlugin = options.plugins.find((plugin) => plugin.printers && plugin.printers[astFormat]);
|
7588 | if (!printerPlugin) {
|
7589 | throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
|
7590 | }
|
7591 | return printerPlugin;
|
7592 | }
|
7593 | function inferParser(filepath, plugins2) {
|
7594 | const filename = path.basename(filepath).toLowerCase();
|
7595 | const languages = getSupportInfo2({
|
7596 | plugins: plugins2
|
7597 | }).languages.filter((language2) => language2.since !== null);
|
7598 | let language = languages.find((language2) => language2.extensions && language2.extensions.some((extension) => filename.endsWith(extension)) || language2.filenames && language2.filenames.some((name) => name.toLowerCase() === filename));
|
7599 | if (!language && !filename.includes(".")) {
|
7600 | const getInterpreter = require_get_interpreter();
|
7601 | const interpreter = getInterpreter(filepath);
|
7602 | language = languages.find((language2) => language2.interpreters && language2.interpreters.includes(interpreter));
|
7603 | }
|
7604 | return language && language.parsers[0];
|
7605 | }
|
7606 | module2.exports = {
|
7607 | normalize,
|
7608 | hiddenDefaults,
|
7609 | inferParser
|
7610 | };
|
7611 | }
|
7612 | });
|
7613 | var require_massage_ast = __commonJS2({
|
7614 | "src/main/massage-ast.js"(exports2, module2) {
|
7615 | "use strict";
|
7616 | function massageAST(ast, options, parent) {
|
7617 | if (Array.isArray(ast)) {
|
7618 | return ast.map((e) => massageAST(e, options, parent)).filter(Boolean);
|
7619 | }
|
7620 | if (!ast || typeof ast !== "object") {
|
7621 | return ast;
|
7622 | }
|
7623 | const cleanFunction = options.printer.massageAstNode;
|
7624 | let ignoredProperties;
|
7625 | if (cleanFunction && cleanFunction.ignoredProperties) {
|
7626 | ignoredProperties = cleanFunction.ignoredProperties;
|
7627 | } else {
|
7628 | ignoredProperties = new Set();
|
7629 | }
|
7630 | const newObj = {};
|
7631 | for (const [key, value] of Object.entries(ast)) {
|
7632 | if (!ignoredProperties.has(key) && typeof value !== "function") {
|
7633 | newObj[key] = massageAST(value, options, ast);
|
7634 | }
|
7635 | }
|
7636 | if (cleanFunction) {
|
7637 | const result = cleanFunction(ast, newObj, parent);
|
7638 | if (result === null) {
|
7639 | return;
|
7640 | }
|
7641 | if (result) {
|
7642 | return result;
|
7643 | }
|
7644 | }
|
7645 | return newObj;
|
7646 | }
|
7647 | module2.exports = massageAST;
|
7648 | }
|
7649 | });
|
7650 | var require_comments = __commonJS2({
|
7651 | "src/main/comments.js"(exports2, module2) {
|
7652 | "use strict";
|
7653 | var assert = require("assert");
|
7654 | var {
|
7655 | builders: {
|
7656 | line,
|
7657 | hardline,
|
7658 | breakParent,
|
7659 | indent,
|
7660 | lineSuffix,
|
7661 | join,
|
7662 | cursor
|
7663 | }
|
7664 | } = require("./doc.js");
|
7665 | var {
|
7666 | hasNewline,
|
7667 | skipNewline,
|
7668 | skipSpaces,
|
7669 | isPreviousLineEmpty,
|
7670 | addLeadingComment,
|
7671 | addDanglingComment,
|
7672 | addTrailingComment
|
7673 | } = require_util();
|
7674 | var childNodesCache = new WeakMap();
|
7675 | function getSortedChildNodes(node, options, resultArray) {
|
7676 | if (!node) {
|
7677 | return;
|
7678 | }
|
7679 | const {
|
7680 | printer,
|
7681 | locStart,
|
7682 | locEnd
|
7683 | } = options;
|
7684 | if (resultArray) {
|
7685 | if (printer.canAttachComment && printer.canAttachComment(node)) {
|
7686 | let i;
|
7687 | for (i = resultArray.length - 1; i >= 0; --i) {
|
7688 | if (locStart(resultArray[i]) <= locStart(node) && locEnd(resultArray[i]) <= locEnd(node)) {
|
7689 | break;
|
7690 | }
|
7691 | }
|
7692 | resultArray.splice(i + 1, 0, node);
|
7693 | return;
|
7694 | }
|
7695 | } else if (childNodesCache.has(node)) {
|
7696 | return childNodesCache.get(node);
|
7697 | }
|
7698 | const childNodes = printer.getCommentChildNodes && printer.getCommentChildNodes(node, options) || typeof node === "object" && Object.entries(node).filter(([key]) => key !== "enclosingNode" && key !== "precedingNode" && key !== "followingNode" && key !== "tokens" && key !== "comments" && key !== "parent").map(([, value]) => value);
|
7699 | if (!childNodes) {
|
7700 | return;
|
7701 | }
|
7702 | if (!resultArray) {
|
7703 | resultArray = [];
|
7704 | childNodesCache.set(node, resultArray);
|
7705 | }
|
7706 | for (const childNode of childNodes) {
|
7707 | getSortedChildNodes(childNode, options, resultArray);
|
7708 | }
|
7709 | return resultArray;
|
7710 | }
|
7711 | function decorateComment(node, comment, options, enclosingNode) {
|
7712 | const {
|
7713 | locStart,
|
7714 | locEnd
|
7715 | } = options;
|
7716 | const commentStart = locStart(comment);
|
7717 | const commentEnd = locEnd(comment);
|
7718 | const childNodes = getSortedChildNodes(node, options);
|
7719 | let precedingNode;
|
7720 | let followingNode;
|
7721 | let left = 0;
|
7722 | let right = childNodes.length;
|
7723 | while (left < right) {
|
7724 | const middle = left + right >> 1;
|
7725 | const child = childNodes[middle];
|
7726 | const start = locStart(child);
|
7727 | const end = locEnd(child);
|
7728 | if (start <= commentStart && commentEnd <= end) {
|
7729 | return decorateComment(child, comment, options, child);
|
7730 | }
|
7731 | if (end <= commentStart) {
|
7732 | precedingNode = child;
|
7733 | left = middle + 1;
|
7734 | continue;
|
7735 | }
|
7736 | if (commentEnd <= start) {
|
7737 | followingNode = child;
|
7738 | right = middle;
|
7739 | continue;
|
7740 | }
|
7741 | throw new Error("Comment location overlaps with node location");
|
7742 | }
|
7743 | if (enclosingNode && enclosingNode.type === "TemplateLiteral") {
|
7744 | const {
|
7745 | quasis
|
7746 | } = enclosingNode;
|
7747 | const commentIndex = findExpressionIndexForComment(quasis, comment, options);
|
7748 | if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options) !== commentIndex) {
|
7749 | precedingNode = null;
|
7750 | }
|
7751 | if (followingNode && findExpressionIndexForComment(quasis, followingNode, options) !== commentIndex) {
|
7752 | followingNode = null;
|
7753 | }
|
7754 | }
|
7755 | return {
|
7756 | enclosingNode,
|
7757 | precedingNode,
|
7758 | followingNode
|
7759 | };
|
7760 | }
|
7761 | var returnFalse = () => false;
|
7762 | function attach(comments, ast, text, options) {
|
7763 | if (!Array.isArray(comments)) {
|
7764 | return;
|
7765 | }
|
7766 | const tiesToBreak = [];
|
7767 | const {
|
7768 | locStart,
|
7769 | locEnd,
|
7770 | printer: {
|
7771 | handleComments = {}
|
7772 | }
|
7773 | } = options;
|
7774 | const {
|
7775 | avoidAstMutation,
|
7776 | ownLine: handleOwnLineComment = returnFalse,
|
7777 | endOfLine: handleEndOfLineComment = returnFalse,
|
7778 | remaining: handleRemainingComment = returnFalse
|
7779 | } = handleComments;
|
7780 | const decoratedComments = comments.map((comment, index) => Object.assign(Object.assign({}, decorateComment(ast, comment, options)), {}, {
|
7781 | comment,
|
7782 | text,
|
7783 | options,
|
7784 | ast,
|
7785 | isLastComment: comments.length - 1 === index
|
7786 | }));
|
7787 | for (const [index, context] of decoratedComments.entries()) {
|
7788 | const {
|
7789 | comment,
|
7790 | precedingNode,
|
7791 | enclosingNode,
|
7792 | followingNode,
|
7793 | text: text2,
|
7794 | options: options2,
|
7795 | ast: ast2,
|
7796 | isLastComment
|
7797 | } = context;
|
7798 | if (options2.parser === "json" || options2.parser === "json5" || options2.parser === "__js_expression" || options2.parser === "__vue_expression" || options2.parser === "__vue_ts_expression") {
|
7799 | if (locStart(comment) - locStart(ast2) <= 0) {
|
7800 | addLeadingComment(ast2, comment);
|
7801 | continue;
|
7802 | }
|
7803 | if (locEnd(comment) - locEnd(ast2) >= 0) {
|
7804 | addTrailingComment(ast2, comment);
|
7805 | continue;
|
7806 | }
|
7807 | }
|
7808 | let args;
|
7809 | if (avoidAstMutation) {
|
7810 | args = [context];
|
7811 | } else {
|
7812 | comment.enclosingNode = enclosingNode;
|
7813 | comment.precedingNode = precedingNode;
|
7814 | comment.followingNode = followingNode;
|
7815 | args = [comment, text2, options2, ast2, isLastComment];
|
7816 | }
|
7817 | if (isOwnLineComment(text2, options2, decoratedComments, index)) {
|
7818 | comment.placement = "ownLine";
|
7819 | if (handleOwnLineComment(...args)) {
|
7820 | } else if (followingNode) {
|
7821 | addLeadingComment(followingNode, comment);
|
7822 | } else if (precedingNode) {
|
7823 | addTrailingComment(precedingNode, comment);
|
7824 | } else if (enclosingNode) {
|
7825 | addDanglingComment(enclosingNode, comment);
|
7826 | } else {
|
7827 | addDanglingComment(ast2, comment);
|
7828 | }
|
7829 | } else if (isEndOfLineComment(text2, options2, decoratedComments, index)) {
|
7830 | comment.placement = "endOfLine";
|
7831 | if (handleEndOfLineComment(...args)) {
|
7832 | } else if (precedingNode) {
|
7833 | addTrailingComment(precedingNode, comment);
|
7834 | } else if (followingNode) {
|
7835 | addLeadingComment(followingNode, comment);
|
7836 | } else if (enclosingNode) {
|
7837 | addDanglingComment(enclosingNode, comment);
|
7838 | } else {
|
7839 | addDanglingComment(ast2, comment);
|
7840 | }
|
7841 | } else {
|
7842 | comment.placement = "remaining";
|
7843 | if (handleRemainingComment(...args)) {
|
7844 | } else if (precedingNode && followingNode) {
|
7845 | const tieCount = tiesToBreak.length;
|
7846 | if (tieCount > 0) {
|
7847 | const lastTie = tiesToBreak[tieCount - 1];
|
7848 | if (lastTie.followingNode !== followingNode) {
|
7849 | breakTies(tiesToBreak, text2, options2);
|
7850 | }
|
7851 | }
|
7852 | tiesToBreak.push(context);
|
7853 | } else if (precedingNode) {
|
7854 | addTrailingComment(precedingNode, comment);
|
7855 | } else if (followingNode) {
|
7856 | addLeadingComment(followingNode, comment);
|
7857 | } else if (enclosingNode) {
|
7858 | addDanglingComment(enclosingNode, comment);
|
7859 | } else {
|
7860 | addDanglingComment(ast2, comment);
|
7861 | }
|
7862 | }
|
7863 | }
|
7864 | breakTies(tiesToBreak, text, options);
|
7865 | if (!avoidAstMutation) {
|
7866 | for (const comment of comments) {
|
7867 | delete comment.precedingNode;
|
7868 | delete comment.enclosingNode;
|
7869 | delete comment.followingNode;
|
7870 | }
|
7871 | }
|
7872 | }
|
7873 | var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/.test(text);
|
7874 | function isOwnLineComment(text, options, decoratedComments, commentIndex) {
|
7875 | const {
|
7876 | comment,
|
7877 | precedingNode
|
7878 | } = decoratedComments[commentIndex];
|
7879 | const {
|
7880 | locStart,
|
7881 | locEnd
|
7882 | } = options;
|
7883 | let start = locStart(comment);
|
7884 | if (precedingNode) {
|
7885 | for (let index = commentIndex - 1; index >= 0; index--) {
|
7886 | const {
|
7887 | comment: comment2,
|
7888 | precedingNode: currentCommentPrecedingNode
|
7889 | } = decoratedComments[index];
|
7890 | if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) {
|
7891 | break;
|
7892 | }
|
7893 | start = locStart(comment2);
|
7894 | }
|
7895 | }
|
7896 | return hasNewline(text, start, {
|
7897 | backwards: true
|
7898 | });
|
7899 | }
|
7900 | function isEndOfLineComment(text, options, decoratedComments, commentIndex) {
|
7901 | const {
|
7902 | comment,
|
7903 | followingNode
|
7904 | } = decoratedComments[commentIndex];
|
7905 | const {
|
7906 | locStart,
|
7907 | locEnd
|
7908 | } = options;
|
7909 | let end = locEnd(comment);
|
7910 | if (followingNode) {
|
7911 | for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
|
7912 | const {
|
7913 | comment: comment2,
|
7914 | followingNode: currentCommentFollowingNode
|
7915 | } = decoratedComments[index];
|
7916 | if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) {
|
7917 | break;
|
7918 | }
|
7919 | end = locEnd(comment2);
|
7920 | }
|
7921 | }
|
7922 | return hasNewline(text, end);
|
7923 | }
|
7924 | function breakTies(tiesToBreak, text, options) {
|
7925 | const tieCount = tiesToBreak.length;
|
7926 | if (tieCount === 0) {
|
7927 | return;
|
7928 | }
|
7929 | const {
|
7930 | precedingNode,
|
7931 | followingNode,
|
7932 | enclosingNode
|
7933 | } = tiesToBreak[0];
|
7934 | const gapRegExp = options.printer.getGapRegex && options.printer.getGapRegex(enclosingNode) || /^[\s(]*$/;
|
7935 | let gapEndPos = options.locStart(followingNode);
|
7936 | let indexOfFirstLeadingComment;
|
7937 | for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
|
7938 | const {
|
7939 | comment,
|
7940 | precedingNode: currentCommentPrecedingNode,
|
7941 | followingNode: currentCommentFollowingNode
|
7942 | } = tiesToBreak[indexOfFirstLeadingComment - 1];
|
7943 | assert.strictEqual(currentCommentPrecedingNode, precedingNode);
|
7944 | assert.strictEqual(currentCommentFollowingNode, followingNode);
|
7945 | const gap = text.slice(options.locEnd(comment), gapEndPos);
|
7946 | if (gapRegExp.test(gap)) {
|
7947 | gapEndPos = options.locStart(comment);
|
7948 | } else {
|
7949 | break;
|
7950 | }
|
7951 | }
|
7952 | for (const [i, {
|
7953 | comment
|
7954 | }] of tiesToBreak.entries()) {
|
7955 | if (i < indexOfFirstLeadingComment) {
|
7956 | addTrailingComment(precedingNode, comment);
|
7957 | } else {
|
7958 | addLeadingComment(followingNode, comment);
|
7959 | }
|
7960 | }
|
7961 | for (const node of [precedingNode, followingNode]) {
|
7962 | if (node.comments && node.comments.length > 1) {
|
7963 | node.comments.sort((a, b) => options.locStart(a) - options.locStart(b));
|
7964 | }
|
7965 | }
|
7966 | tiesToBreak.length = 0;
|
7967 | }
|
7968 | function printComment(path, options) {
|
7969 | const comment = path.getValue();
|
7970 | comment.printed = true;
|
7971 | return options.printer.printComment(path, options);
|
7972 | }
|
7973 | function findExpressionIndexForComment(quasis, comment, options) {
|
7974 | const startPos = options.locStart(comment) - 1;
|
7975 | for (let i = 1; i < quasis.length; ++i) {
|
7976 | if (startPos < options.locStart(quasis[i])) {
|
7977 | return i - 1;
|
7978 | }
|
7979 | }
|
7980 | return 0;
|
7981 | }
|
7982 | function printLeadingComment(path, options) {
|
7983 | const comment = path.getValue();
|
7984 | const parts = [printComment(path, options)];
|
7985 | const {
|
7986 | printer,
|
7987 | originalText,
|
7988 | locStart,
|
7989 | locEnd
|
7990 | } = options;
|
7991 | const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
|
7992 | if (isBlock) {
|
7993 | const lineBreak = hasNewline(originalText, locEnd(comment)) ? hasNewline(originalText, locStart(comment), {
|
7994 | backwards: true
|
7995 | }) ? hardline : line : " ";
|
7996 | parts.push(lineBreak);
|
7997 | } else {
|
7998 | parts.push(hardline);
|
7999 | }
|
8000 | const index = skipNewline(originalText, skipSpaces(originalText, locEnd(comment)));
|
8001 | if (index !== false && hasNewline(originalText, index)) {
|
8002 | parts.push(hardline);
|
8003 | }
|
8004 | return parts;
|
8005 | }
|
8006 | function printTrailingComment(path, options) {
|
8007 | const comment = path.getValue();
|
8008 | const printed = printComment(path, options);
|
8009 | const {
|
8010 | printer,
|
8011 | originalText,
|
8012 | locStart
|
8013 | } = options;
|
8014 | const isBlock = printer.isBlockComment && printer.isBlockComment(comment);
|
8015 | if (hasNewline(originalText, locStart(comment), {
|
8016 | backwards: true
|
8017 | })) {
|
8018 | const isLineBeforeEmpty = isPreviousLineEmpty(originalText, comment, locStart);
|
8019 | return lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]);
|
8020 | }
|
8021 | let parts = [" ", printed];
|
8022 | if (!isBlock) {
|
8023 | parts = [lineSuffix(parts), breakParent];
|
8024 | }
|
8025 | return parts;
|
8026 | }
|
8027 | function printDanglingComments(path, options, sameIndent, filter) {
|
8028 | const parts = [];
|
8029 | const node = path.getValue();
|
8030 | if (!node || !node.comments) {
|
8031 | return "";
|
8032 | }
|
8033 | path.each(() => {
|
8034 | const comment = path.getValue();
|
8035 | if (!comment.leading && !comment.trailing && (!filter || filter(comment))) {
|
8036 | parts.push(printComment(path, options));
|
8037 | }
|
8038 | }, "comments");
|
8039 | if (parts.length === 0) {
|
8040 | return "";
|
8041 | }
|
8042 | if (sameIndent) {
|
8043 | return join(hardline, parts);
|
8044 | }
|
8045 | return indent([hardline, join(hardline, parts)]);
|
8046 | }
|
8047 | function printCommentsSeparately(path, options, ignored) {
|
8048 | const value = path.getValue();
|
8049 | if (!value) {
|
8050 | return {};
|
8051 | }
|
8052 | let comments = value.comments || [];
|
8053 | if (ignored) {
|
8054 | comments = comments.filter((comment) => !ignored.has(comment));
|
8055 | }
|
8056 | const isCursorNode = value === options.cursorNode;
|
8057 | if (comments.length === 0) {
|
8058 | const maybeCursor = isCursorNode ? cursor : "";
|
8059 | return {
|
8060 | leading: maybeCursor,
|
8061 | trailing: maybeCursor
|
8062 | };
|
8063 | }
|
8064 | const leadingParts = [];
|
8065 | const trailingParts = [];
|
8066 | path.each(() => {
|
8067 | const comment = path.getValue();
|
8068 | if (ignored && ignored.has(comment)) {
|
8069 | return;
|
8070 | }
|
8071 | const {
|
8072 | leading,
|
8073 | trailing
|
8074 | } = comment;
|
8075 | if (leading) {
|
8076 | leadingParts.push(printLeadingComment(path, options));
|
8077 | } else if (trailing) {
|
8078 | trailingParts.push(printTrailingComment(path, options));
|
8079 | }
|
8080 | }, "comments");
|
8081 | if (isCursorNode) {
|
8082 | leadingParts.unshift(cursor);
|
8083 | trailingParts.push(cursor);
|
8084 | }
|
8085 | return {
|
8086 | leading: leadingParts,
|
8087 | trailing: trailingParts
|
8088 | };
|
8089 | }
|
8090 | function printComments(path, doc2, options, ignored) {
|
8091 | const {
|
8092 | leading,
|
8093 | trailing
|
8094 | } = printCommentsSeparately(path, options, ignored);
|
8095 | if (!leading && !trailing) {
|
8096 | return doc2;
|
8097 | }
|
8098 | return [leading, doc2, trailing];
|
8099 | }
|
8100 | function ensureAllCommentsPrinted(astComments) {
|
8101 | if (!astComments) {
|
8102 | return;
|
8103 | }
|
8104 | for (const comment of astComments) {
|
8105 | if (!comment.printed) {
|
8106 | throw new Error('Comment "' + comment.value.trim() + '" was not printed. Please report this error!');
|
8107 | }
|
8108 | delete comment.printed;
|
8109 | }
|
8110 | }
|
8111 | module2.exports = {
|
8112 | attach,
|
8113 | printComments,
|
8114 | printCommentsSeparately,
|
8115 | printDanglingComments,
|
8116 | getSortedChildNodes,
|
8117 | ensureAllCommentsPrinted
|
8118 | };
|
8119 | }
|
8120 | });
|
8121 | var require_ast_path = __commonJS2({
|
8122 | "src/common/ast-path.js"(exports2, module2) {
|
8123 | "use strict";
|
8124 | var getLast = require_get_last();
|
8125 | function getNodeHelper(path, count) {
|
8126 | const stackIndex = getNodeStackIndexHelper(path.stack, count);
|
8127 | return stackIndex === -1 ? null : path.stack[stackIndex];
|
8128 | }
|
8129 | function getNodeStackIndexHelper(stack, count) {
|
8130 | for (let i = stack.length - 1; i >= 0; i -= 2) {
|
8131 | const value = stack[i];
|
8132 | if (value && !Array.isArray(value) && --count < 0) {
|
8133 | return i;
|
8134 | }
|
8135 | }
|
8136 | return -1;
|
8137 | }
|
8138 | var AstPath = class {
|
8139 | constructor(value) {
|
8140 | this.stack = [value];
|
8141 | }
|
8142 | getName() {
|
8143 | const {
|
8144 | stack
|
8145 | } = this;
|
8146 | const {
|
8147 | length
|
8148 | } = stack;
|
8149 | if (length > 1) {
|
8150 | return stack[length - 2];
|
8151 | }
|
8152 | return null;
|
8153 | }
|
8154 | getValue() {
|
8155 | return getLast(this.stack);
|
8156 | }
|
8157 | getNode(count = 0) {
|
8158 | return getNodeHelper(this, count);
|
8159 | }
|
8160 | getParentNode(count = 0) {
|
8161 | return getNodeHelper(this, count + 1);
|
8162 | }
|
8163 | call(callback, ...names) {
|
8164 | const {
|
8165 | stack
|
8166 | } = this;
|
8167 | const {
|
8168 | length
|
8169 | } = stack;
|
8170 | let value = getLast(stack);
|
8171 | for (const name of names) {
|
8172 | value = value[name];
|
8173 | stack.push(name, value);
|
8174 | }
|
8175 | const result = callback(this);
|
8176 | stack.length = length;
|
8177 | return result;
|
8178 | }
|
8179 | callParent(callback, count = 0) {
|
8180 | const stackIndex = getNodeStackIndexHelper(this.stack, count + 1);
|
8181 | const parentValues = this.stack.splice(stackIndex + 1);
|
8182 | const result = callback(this);
|
8183 | this.stack.push(...parentValues);
|
8184 | return result;
|
8185 | }
|
8186 | each(callback, ...names) {
|
8187 | const {
|
8188 | stack
|
8189 | } = this;
|
8190 | const {
|
8191 | length
|
8192 | } = stack;
|
8193 | let value = getLast(stack);
|
8194 | for (const name of names) {
|
8195 | value = value[name];
|
8196 | stack.push(name, value);
|
8197 | }
|
8198 | for (let i = 0; i < value.length; ++i) {
|
8199 | stack.push(i, value[i]);
|
8200 | callback(this, i, value);
|
8201 | stack.length -= 2;
|
8202 | }
|
8203 | stack.length = length;
|
8204 | }
|
8205 | map(callback, ...names) {
|
8206 | const result = [];
|
8207 | this.each((path, index, value) => {
|
8208 | result[index] = callback(path, index, value);
|
8209 | }, ...names);
|
8210 | return result;
|
8211 | }
|
8212 | try(callback) {
|
8213 | const {
|
8214 | stack
|
8215 | } = this;
|
8216 | const stackBackup = [...stack];
|
8217 | try {
|
8218 | return callback();
|
8219 | } finally {
|
8220 | stack.length = 0;
|
8221 | stack.push(...stackBackup);
|
8222 | }
|
8223 | }
|
8224 | match(...predicates) {
|
8225 | let stackPointer = this.stack.length - 1;
|
8226 | let name = null;
|
8227 | let node = this.stack[stackPointer--];
|
8228 | for (const predicate of predicates) {
|
8229 | if (node === void 0) {
|
8230 | return false;
|
8231 | }
|
8232 | let number = null;
|
8233 | if (typeof name === "number") {
|
8234 | number = name;
|
8235 | name = this.stack[stackPointer--];
|
8236 | node = this.stack[stackPointer--];
|
8237 | }
|
8238 | if (predicate && !predicate(node, name, number)) {
|
8239 | return false;
|
8240 | }
|
8241 | name = this.stack[stackPointer--];
|
8242 | node = this.stack[stackPointer--];
|
8243 | }
|
8244 | return true;
|
8245 | }
|
8246 | findAncestor(predicate) {
|
8247 | let stackPointer = this.stack.length - 1;
|
8248 | let name = null;
|
8249 | let node = this.stack[stackPointer--];
|
8250 | while (node) {
|
8251 | let number = null;
|
8252 | if (typeof name === "number") {
|
8253 | number = name;
|
8254 | name = this.stack[stackPointer--];
|
8255 | node = this.stack[stackPointer--];
|
8256 | }
|
8257 | if (name !== null && predicate(node, name, number)) {
|
8258 | return node;
|
8259 | }
|
8260 | name = this.stack[stackPointer--];
|
8261 | node = this.stack[stackPointer--];
|
8262 | }
|
8263 | }
|
8264 | };
|
8265 | module2.exports = AstPath;
|
8266 | }
|
8267 | });
|
8268 | var require_multiparser = __commonJS2({
|
8269 | "src/main/multiparser.js"(exports2, module2) {
|
8270 | "use strict";
|
8271 | var {
|
8272 | utils: {
|
8273 | stripTrailingHardline
|
8274 | }
|
8275 | } = require("./doc.js");
|
8276 | var {
|
8277 | normalize
|
8278 | } = require_options();
|
8279 | var comments = require_comments();
|
8280 | function printSubtree(path, print, options, printAstToDoc) {
|
8281 | if (options.printer.embed && options.embeddedLanguageFormatting === "auto") {
|
8282 | return options.printer.embed(path, print, (text, partialNextOptions, textToDocOptions) => textToDoc(text, partialNextOptions, options, printAstToDoc, textToDocOptions), options);
|
8283 | }
|
8284 | }
|
8285 | function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc, {
|
8286 | stripTrailingHardline: shouldStripTrailingHardline = false
|
8287 | } = {}) {
|
8288 | const nextOptions = normalize(Object.assign(Object.assign(Object.assign({}, parentOptions), partialNextOptions), {}, {
|
8289 | parentParser: parentOptions.parser,
|
8290 | originalText: text
|
8291 | }), {
|
8292 | passThrough: true
|
8293 | });
|
8294 | const result = require_parser().parse(text, nextOptions);
|
8295 | const {
|
8296 | ast
|
8297 | } = result;
|
8298 | text = result.text;
|
8299 | const astComments = ast.comments;
|
8300 | delete ast.comments;
|
8301 | comments.attach(astComments, ast, text, nextOptions);
|
8302 | nextOptions[Symbol.for("comments")] = astComments || [];
|
8303 | nextOptions[Symbol.for("tokens")] = ast.tokens || [];
|
8304 | const doc2 = printAstToDoc(ast, nextOptions);
|
8305 | comments.ensureAllCommentsPrinted(astComments);
|
8306 | if (shouldStripTrailingHardline) {
|
8307 | if (typeof doc2 === "string") {
|
8308 | return doc2.replace(/(?:\r?\n)*$/, "");
|
8309 | }
|
8310 | return stripTrailingHardline(doc2);
|
8311 | }
|
8312 | return doc2;
|
8313 | }
|
8314 | module2.exports = {
|
8315 | printSubtree
|
8316 | };
|
8317 | }
|
8318 | });
|
8319 | var require_ast_to_doc = __commonJS2({
|
8320 | "src/main/ast-to-doc.js"(exports2, module2) {
|
8321 | "use strict";
|
8322 | var AstPath = require_ast_path();
|
8323 | var {
|
8324 | builders: {
|
8325 | hardline,
|
8326 | addAlignmentToDoc
|
8327 | },
|
8328 | utils: {
|
8329 | propagateBreaks
|
8330 | }
|
8331 | } = require("./doc.js");
|
8332 | var {
|
8333 | printComments
|
8334 | } = require_comments();
|
8335 | var multiparser = require_multiparser();
|
8336 | function printAstToDoc(ast, options, alignmentSize = 0) {
|
8337 | const {
|
8338 | printer
|
8339 | } = options;
|
8340 | if (printer.preprocess) {
|
8341 | ast = printer.preprocess(ast, options);
|
8342 | }
|
8343 | const cache = new Map();
|
8344 | const path = new AstPath(ast);
|
8345 | let doc2 = mainPrint();
|
8346 | if (alignmentSize > 0) {
|
8347 | doc2 = addAlignmentToDoc([hardline, doc2], alignmentSize, options.tabWidth);
|
8348 | }
|
8349 | propagateBreaks(doc2);
|
8350 | return doc2;
|
8351 | function mainPrint(selector, args) {
|
8352 | if (selector === void 0 || selector === path) {
|
8353 | return mainPrintInternal(args);
|
8354 | }
|
8355 | if (Array.isArray(selector)) {
|
8356 | return path.call(() => mainPrintInternal(args), ...selector);
|
8357 | }
|
8358 | return path.call(() => mainPrintInternal(args), selector);
|
8359 | }
|
8360 | function mainPrintInternal(args) {
|
8361 | const value = path.getValue();
|
8362 | const shouldCache = value && typeof value === "object" && args === void 0;
|
8363 | if (shouldCache && cache.has(value)) {
|
8364 | return cache.get(value);
|
8365 | }
|
8366 | const doc3 = callPluginPrintFunction(path, options, mainPrint, args);
|
8367 | if (shouldCache) {
|
8368 | cache.set(value, doc3);
|
8369 | }
|
8370 | return doc3;
|
8371 | }
|
8372 | }
|
8373 | function printPrettierIgnoredNode(node, options) {
|
8374 | const {
|
8375 | originalText,
|
8376 | [Symbol.for("comments")]: comments,
|
8377 | locStart,
|
8378 | locEnd
|
8379 | } = options;
|
8380 | const start = locStart(node);
|
8381 | const end = locEnd(node);
|
8382 | const printedComments = new Set();
|
8383 | for (const comment of comments) {
|
8384 | if (locStart(comment) >= start && locEnd(comment) <= end) {
|
8385 | comment.printed = true;
|
8386 | printedComments.add(comment);
|
8387 | }
|
8388 | }
|
8389 | return {
|
8390 | doc: originalText.slice(start, end),
|
8391 | printedComments
|
8392 | };
|
8393 | }
|
8394 | function callPluginPrintFunction(path, options, printPath, args) {
|
8395 | const node = path.getValue();
|
8396 | const {
|
8397 | printer
|
8398 | } = options;
|
8399 | let doc2;
|
8400 | let printedComments;
|
8401 | if (printer.hasPrettierIgnore && printer.hasPrettierIgnore(path)) {
|
8402 | ({
|
8403 | doc: doc2,
|
8404 | printedComments
|
8405 | } = printPrettierIgnoredNode(node, options));
|
8406 | } else {
|
8407 | if (node) {
|
8408 | try {
|
8409 | doc2 = multiparser.printSubtree(path, printPath, options, printAstToDoc);
|
8410 | } catch (error) {
|
8411 | if (process.env.PRETTIER_DEBUG) {
|
8412 | throw error;
|
8413 | }
|
8414 | }
|
8415 | }
|
8416 | if (!doc2) {
|
8417 | doc2 = printer.print(path, options, printPath, args);
|
8418 | }
|
8419 | }
|
8420 | if (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path, options)) {
|
8421 | doc2 = printComments(path, doc2, options, printedComments);
|
8422 | }
|
8423 | return doc2;
|
8424 | }
|
8425 | module2.exports = printAstToDoc;
|
8426 | }
|
8427 | });
|
8428 | var require_range_util = __commonJS2({
|
8429 | "src/main/range-util.js"(exports2, module2) {
|
8430 | "use strict";
|
8431 | var assert = require("assert");
|
8432 | var comments = require_comments();
|
8433 | var isJsonParser = ({
|
8434 | parser
|
8435 | }) => parser === "json" || parser === "json5" || parser === "json-stringify";
|
8436 | function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
|
8437 | const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
|
8438 | const endNodeAndAncestors = new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
|
8439 | return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
|
8440 | }
|
8441 | function dropRootParents(parents) {
|
8442 | let lastParentIndex = parents.length - 1;
|
8443 | for (; ; ) {
|
8444 | const parent = parents[lastParentIndex];
|
8445 | if (parent && (parent.type === "Program" || parent.type === "File")) {
|
8446 | lastParentIndex--;
|
8447 | } else {
|
8448 | break;
|
8449 | }
|
8450 | }
|
8451 | return parents.slice(0, lastParentIndex + 1);
|
8452 | }
|
8453 | function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
|
8454 | locStart,
|
8455 | locEnd
|
8456 | }) {
|
8457 | let resultStartNode = startNodeAndParents.node;
|
8458 | let resultEndNode = endNodeAndParents.node;
|
8459 | if (resultStartNode === resultEndNode) {
|
8460 | return {
|
8461 | startNode: resultStartNode,
|
8462 | endNode: resultEndNode
|
8463 | };
|
8464 | }
|
8465 | const startNodeStart = locStart(startNodeAndParents.node);
|
8466 | for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
|
8467 | if (locStart(endParent) >= startNodeStart) {
|
8468 | resultEndNode = endParent;
|
8469 | } else {
|
8470 | break;
|
8471 | }
|
8472 | }
|
8473 | const endNodeEnd = locEnd(endNodeAndParents.node);
|
8474 | for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
|
8475 | if (locEnd(startParent) <= endNodeEnd) {
|
8476 | resultStartNode = startParent;
|
8477 | } else {
|
8478 | break;
|
8479 | }
|
8480 | if (resultStartNode === resultEndNode) {
|
8481 | break;
|
8482 | }
|
8483 | }
|
8484 | return {
|
8485 | startNode: resultStartNode,
|
8486 | endNode: resultEndNode
|
8487 | };
|
8488 | }
|
8489 | function findNodeAtOffset(node, offset, options, predicate, parentNodes = [], type) {
|
8490 | const {
|
8491 | locStart,
|
8492 | locEnd
|
8493 | } = options;
|
8494 | const start = locStart(node);
|
8495 | const end = locEnd(node);
|
8496 | if (offset > end || offset < start || type === "rangeEnd" && offset === start || type === "rangeStart" && offset === end) {
|
8497 | return;
|
8498 | }
|
8499 | for (const childNode of comments.getSortedChildNodes(node, options)) {
|
8500 | const childResult = findNodeAtOffset(childNode, offset, options, predicate, [node, ...parentNodes], type);
|
8501 | if (childResult) {
|
8502 | return childResult;
|
8503 | }
|
8504 | }
|
8505 | if (!predicate || predicate(node, parentNodes[0])) {
|
8506 | return {
|
8507 | node,
|
8508 | parentNodes
|
8509 | };
|
8510 | }
|
8511 | }
|
8512 | function isJsSourceElement(type, parentType) {
|
8513 | return parentType !== "DeclareExportDeclaration" && type !== "TypeParameterDeclaration" && (type === "Directive" || type === "TypeAlias" || type === "TSExportAssignment" || type.startsWith("Declare") || type.startsWith("TSDeclare") || type.endsWith("Statement") || type.endsWith("Declaration"));
|
8514 | }
|
8515 | var jsonSourceElements = new Set(["ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
|
8516 | var graphqlSourceElements = new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
|
8517 | function isSourceElement(opts, node, parentNode) {
|
8518 | if (!node) {
|
8519 | return false;
|
8520 | }
|
8521 | switch (opts.parser) {
|
8522 | case "flow":
|
8523 | case "babel":
|
8524 | case "babel-flow":
|
8525 | case "babel-ts":
|
8526 | case "typescript":
|
8527 | case "acorn":
|
8528 | case "espree":
|
8529 | case "meriyah":
|
8530 | case "__babel_estree":
|
8531 | return isJsSourceElement(node.type, parentNode && parentNode.type);
|
8532 | case "json":
|
8533 | case "json5":
|
8534 | case "json-stringify":
|
8535 | return jsonSourceElements.has(node.type);
|
8536 | case "graphql":
|
8537 | return graphqlSourceElements.has(node.kind);
|
8538 | case "vue":
|
8539 | return node.tag !== "root";
|
8540 | }
|
8541 | return false;
|
8542 | }
|
8543 | function calculateRange(text, opts, ast) {
|
8544 | let {
|
8545 | rangeStart: start,
|
8546 | rangeEnd: end,
|
8547 | locStart,
|
8548 | locEnd
|
8549 | } = opts;
|
8550 | assert.ok(end > start);
|
8551 | const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/);
|
8552 | const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
|
8553 | if (!isAllWhitespace) {
|
8554 | start += firstNonWhitespaceCharacterIndex;
|
8555 | for (; end > start; --end) {
|
8556 | if (/\S/.test(text[end - 1])) {
|
8557 | break;
|
8558 | }
|
8559 | }
|
8560 | }
|
8561 | const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
|
8562 | const endNodeAndParents = isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd");
|
8563 | if (!startNodeAndParents || !endNodeAndParents) {
|
8564 | return {
|
8565 | rangeStart: 0,
|
8566 | rangeEnd: 0
|
8567 | };
|
8568 | }
|
8569 | let startNode;
|
8570 | let endNode;
|
8571 | if (isJsonParser(opts)) {
|
8572 | const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
|
8573 | startNode = commonAncestor;
|
8574 | endNode = commonAncestor;
|
8575 | } else {
|
8576 | ({
|
8577 | startNode,
|
8578 | endNode
|
8579 | } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
|
8580 | }
|
8581 | return {
|
8582 | rangeStart: Math.min(locStart(startNode), locStart(endNode)),
|
8583 | rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
|
8584 | };
|
8585 | }
|
8586 | module2.exports = {
|
8587 | calculateRange,
|
8588 | findNodeAtOffset
|
8589 | };
|
8590 | }
|
8591 | });
|
8592 | var require_core = __commonJS2({
|
8593 | "src/main/core.js"(exports2, module2) {
|
8594 | "use strict";
|
8595 | var {
|
8596 | diffArrays
|
8597 | } = require_array();
|
8598 | var {
|
8599 | printer: {
|
8600 | printDocToString
|
8601 | },
|
8602 | debug: {
|
8603 | printDocToDebug
|
8604 | }
|
8605 | } = require("./doc.js");
|
8606 | var {
|
8607 | getAlignmentSize
|
8608 | } = require_util();
|
8609 | var {
|
8610 | guessEndOfLine,
|
8611 | convertEndOfLineToChars,
|
8612 | countEndOfLineChars,
|
8613 | normalizeEndOfLine
|
8614 | } = require_end_of_line();
|
8615 | var normalizeOptions = require_options().normalize;
|
8616 | var massageAST = require_massage_ast();
|
8617 | var comments = require_comments();
|
8618 | var parser = require_parser();
|
8619 | var printAstToDoc = require_ast_to_doc();
|
8620 | var rangeUtil = require_range_util();
|
8621 | var BOM = "\uFEFF";
|
8622 | var CURSOR = Symbol("cursor");
|
8623 | function attachComments(text, ast, opts) {
|
8624 | const astComments = ast.comments;
|
8625 | if (astComments) {
|
8626 | delete ast.comments;
|
8627 | comments.attach(astComments, ast, text, opts);
|
8628 | }
|
8629 | opts[Symbol.for("comments")] = astComments || [];
|
8630 | opts[Symbol.for("tokens")] = ast.tokens || [];
|
8631 | opts.originalText = text;
|
8632 | return astComments;
|
8633 | }
|
8634 | function coreFormat(originalText, opts, addAlignmentSize = 0) {
|
8635 | if (!originalText || originalText.trim().length === 0) {
|
8636 | return {
|
8637 | formatted: "",
|
8638 | cursorOffset: -1,
|
8639 | comments: []
|
8640 | };
|
8641 | }
|
8642 | const {
|
8643 | ast,
|
8644 | text
|
8645 | } = parser.parse(originalText, opts);
|
8646 | if (opts.cursorOffset >= 0) {
|
8647 | const nodeResult = rangeUtil.findNodeAtOffset(ast, opts.cursorOffset, opts);
|
8648 | if (nodeResult && nodeResult.node) {
|
8649 | opts.cursorNode = nodeResult.node;
|
8650 | }
|
8651 | }
|
8652 | const astComments = attachComments(text, ast, opts);
|
8653 | const doc2 = printAstToDoc(ast, opts, addAlignmentSize);
|
8654 | const result = printDocToString(doc2, opts);
|
8655 | comments.ensureAllCommentsPrinted(astComments);
|
8656 | if (addAlignmentSize > 0) {
|
8657 | const trimmed = result.formatted.trim();
|
8658 | if (result.cursorNodeStart !== void 0) {
|
8659 | result.cursorNodeStart -= result.formatted.indexOf(trimmed);
|
8660 | }
|
8661 | result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
|
8662 | }
|
8663 | if (opts.cursorOffset >= 0) {
|
8664 | let oldCursorNodeStart;
|
8665 | let oldCursorNodeText;
|
8666 | let cursorOffsetRelativeToOldCursorNode;
|
8667 | let newCursorNodeStart;
|
8668 | let newCursorNodeText;
|
8669 | if (opts.cursorNode && result.cursorNodeText) {
|
8670 | oldCursorNodeStart = opts.locStart(opts.cursorNode);
|
8671 | oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
|
8672 | cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
|
8673 | newCursorNodeStart = result.cursorNodeStart;
|
8674 | newCursorNodeText = result.cursorNodeText;
|
8675 | } else {
|
8676 | oldCursorNodeStart = 0;
|
8677 | oldCursorNodeText = text;
|
8678 | cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
|
8679 | newCursorNodeStart = 0;
|
8680 | newCursorNodeText = result.formatted;
|
8681 | }
|
8682 | if (oldCursorNodeText === newCursorNodeText) {
|
8683 | return {
|
8684 | formatted: result.formatted,
|
8685 | cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
|
8686 | comments: astComments
|
8687 | };
|
8688 | }
|
8689 | const oldCursorNodeCharArray = [...oldCursorNodeText];
|
8690 | oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
|
8691 | const newCursorNodeCharArray = [...newCursorNodeText];
|
8692 | const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
|
8693 | let cursorOffset = newCursorNodeStart;
|
8694 | for (const entry of cursorNodeDiff) {
|
8695 | if (entry.removed) {
|
8696 | if (entry.value.includes(CURSOR)) {
|
8697 | break;
|
8698 | }
|
8699 | } else {
|
8700 | cursorOffset += entry.count;
|
8701 | }
|
8702 | }
|
8703 | return {
|
8704 | formatted: result.formatted,
|
8705 | cursorOffset,
|
8706 | comments: astComments
|
8707 | };
|
8708 | }
|
8709 | return {
|
8710 | formatted: result.formatted,
|
8711 | cursorOffset: -1,
|
8712 | comments: astComments
|
8713 | };
|
8714 | }
|
8715 | function formatRange(originalText, opts) {
|
8716 | const {
|
8717 | ast,
|
8718 | text
|
8719 | } = parser.parse(originalText, opts);
|
8720 | const {
|
8721 | rangeStart,
|
8722 | rangeEnd
|
8723 | } = rangeUtil.calculateRange(text, opts, ast);
|
8724 | const rangeString = text.slice(rangeStart, rangeEnd);
|
8725 | const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
|
8726 | const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/)[0];
|
8727 | const alignmentSize = getAlignmentSize(indentString, opts.tabWidth);
|
8728 | const rangeResult = coreFormat(rangeString, Object.assign(Object.assign({}, opts), {}, {
|
8729 | rangeStart: 0,
|
8730 | rangeEnd: Number.POSITIVE_INFINITY,
|
8731 | cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
|
8732 | endOfLine: "lf"
|
8733 | }), alignmentSize);
|
8734 | const rangeTrimmed = rangeResult.formatted.trimEnd();
|
8735 | let {
|
8736 | cursorOffset
|
8737 | } = opts;
|
8738 | if (cursorOffset > rangeEnd) {
|
8739 | cursorOffset += rangeTrimmed.length - rangeString.length;
|
8740 | } else if (rangeResult.cursorOffset >= 0) {
|
8741 | cursorOffset = rangeResult.cursorOffset + rangeStart;
|
8742 | }
|
8743 | let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
|
8744 | if (opts.endOfLine !== "lf") {
|
8745 | const eol = convertEndOfLineToChars(opts.endOfLine);
|
8746 | if (cursorOffset >= 0 && eol === "\r\n") {
|
8747 | cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
|
8748 | }
|
8749 | formatted = formatted.replace(/\n/g, eol);
|
8750 | }
|
8751 | return {
|
8752 | formatted,
|
8753 | cursorOffset,
|
8754 | comments: rangeResult.comments
|
8755 | };
|
8756 | }
|
8757 | function ensureIndexInText(text, index, defaultValue) {
|
8758 | if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
|
8759 | return defaultValue;
|
8760 | }
|
8761 | return index;
|
8762 | }
|
8763 | function normalizeIndexes(text, options) {
|
8764 | let {
|
8765 | cursorOffset,
|
8766 | rangeStart,
|
8767 | rangeEnd
|
8768 | } = options;
|
8769 | cursorOffset = ensureIndexInText(text, cursorOffset, -1);
|
8770 | rangeStart = ensureIndexInText(text, rangeStart, 0);
|
8771 | rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
|
8772 | return Object.assign(Object.assign({}, options), {}, {
|
8773 | cursorOffset,
|
8774 | rangeStart,
|
8775 | rangeEnd
|
8776 | });
|
8777 | }
|
8778 | function normalizeInputAndOptions(text, options) {
|
8779 | let {
|
8780 | cursorOffset,
|
8781 | rangeStart,
|
8782 | rangeEnd,
|
8783 | endOfLine
|
8784 | } = normalizeIndexes(text, options);
|
8785 | const hasBOM = text.charAt(0) === BOM;
|
8786 | if (hasBOM) {
|
8787 | text = text.slice(1);
|
8788 | cursorOffset--;
|
8789 | rangeStart--;
|
8790 | rangeEnd--;
|
8791 | }
|
8792 | if (endOfLine === "auto") {
|
8793 | endOfLine = guessEndOfLine(text);
|
8794 | }
|
8795 | if (text.includes("\r")) {
|
8796 | const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
|
8797 | cursorOffset -= countCrlfBefore(cursorOffset);
|
8798 | rangeStart -= countCrlfBefore(rangeStart);
|
8799 | rangeEnd -= countCrlfBefore(rangeEnd);
|
8800 | text = normalizeEndOfLine(text);
|
8801 | }
|
8802 | return {
|
8803 | hasBOM,
|
8804 | text,
|
8805 | options: normalizeIndexes(text, Object.assign(Object.assign({}, options), {}, {
|
8806 | cursorOffset,
|
8807 | rangeStart,
|
8808 | rangeEnd,
|
8809 | endOfLine
|
8810 | }))
|
8811 | };
|
8812 | }
|
8813 | function hasPragma(text, options) {
|
8814 | const selectedParser = parser.resolveParser(options);
|
8815 | return !selectedParser.hasPragma || selectedParser.hasPragma(text);
|
8816 | }
|
8817 | function formatWithCursor2(originalText, originalOptions) {
|
8818 | let {
|
8819 | hasBOM,
|
8820 | text,
|
8821 | options
|
8822 | } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
|
8823 | if (options.rangeStart >= options.rangeEnd && text !== "" || options.requirePragma && !hasPragma(text, options)) {
|
8824 | return {
|
8825 | formatted: originalText,
|
8826 | cursorOffset: originalOptions.cursorOffset,
|
8827 | comments: []
|
8828 | };
|
8829 | }
|
8830 | let result;
|
8831 | if (options.rangeStart > 0 || options.rangeEnd < text.length) {
|
8832 | result = formatRange(text, options);
|
8833 | } else {
|
8834 | if (!options.requirePragma && options.insertPragma && options.printer.insertPragma && !hasPragma(text, options)) {
|
8835 | text = options.printer.insertPragma(text);
|
8836 | }
|
8837 | result = coreFormat(text, options);
|
8838 | }
|
8839 | if (hasBOM) {
|
8840 | result.formatted = BOM + result.formatted;
|
8841 | if (result.cursorOffset >= 0) {
|
8842 | result.cursorOffset++;
|
8843 | }
|
8844 | }
|
8845 | return result;
|
8846 | }
|
8847 | module2.exports = {
|
8848 | formatWithCursor: formatWithCursor2,
|
8849 | parse(originalText, originalOptions, massage) {
|
8850 | const {
|
8851 | text,
|
8852 | options
|
8853 | } = normalizeInputAndOptions(originalText, normalizeOptions(originalOptions));
|
8854 | const parsed = parser.parse(text, options);
|
8855 | if (massage) {
|
8856 | parsed.ast = massageAST(parsed.ast, options);
|
8857 | }
|
8858 | return parsed;
|
8859 | },
|
8860 | formatAST(ast, options) {
|
8861 | options = normalizeOptions(options);
|
8862 | const doc2 = printAstToDoc(ast, options);
|
8863 | return printDocToString(doc2, options);
|
8864 | },
|
8865 | formatDoc(doc2, options) {
|
8866 | return formatWithCursor2(printDocToDebug(doc2), Object.assign(Object.assign({}, options), {}, {
|
8867 | parser: "__js_expression"
|
8868 | })).formatted;
|
8869 | },
|
8870 | printToDoc(originalText, options) {
|
8871 | options = normalizeOptions(options);
|
8872 | const {
|
8873 | ast,
|
8874 | text
|
8875 | } = parser.parse(originalText, options);
|
8876 | attachComments(text, ast, options);
|
8877 | return printAstToDoc(ast, options);
|
8878 | },
|
8879 | printDocToString(doc2, options) {
|
8880 | return printDocToString(doc2, normalizeOptions(options));
|
8881 | }
|
8882 | };
|
8883 | }
|
8884 | });
|
8885 | var require_utils2 = __commonJS2({
|
8886 | "node_modules/braces/lib/utils.js"(exports2) {
|
8887 | "use strict";
|
8888 | exports2.isInteger = (num) => {
|
8889 | if (typeof num === "number") {
|
8890 | return Number.isInteger(num);
|
8891 | }
|
8892 | if (typeof num === "string" && num.trim() !== "") {
|
8893 | return Number.isInteger(Number(num));
|
8894 | }
|
8895 | return false;
|
8896 | };
|
8897 | exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
|
8898 | exports2.exceedsLimit = (min, max, step = 1, limit) => {
|
8899 | if (limit === false)
|
8900 | return false;
|
8901 | if (!exports2.isInteger(min) || !exports2.isInteger(max))
|
8902 | return false;
|
8903 | return (Number(max) - Number(min)) / Number(step) >= limit;
|
8904 | };
|
8905 | exports2.escapeNode = (block, n = 0, type) => {
|
8906 | let node = block.nodes[n];
|
8907 | if (!node)
|
8908 | return;
|
8909 | if (type && node.type === type || node.type === "open" || node.type === "close") {
|
8910 | if (node.escaped !== true) {
|
8911 | node.value = "\\" + node.value;
|
8912 | node.escaped = true;
|
8913 | }
|
8914 | }
|
8915 | };
|
8916 | exports2.encloseBrace = (node) => {
|
8917 | if (node.type !== "brace")
|
8918 | return false;
|
8919 | if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
8920 | node.invalid = true;
|
8921 | return true;
|
8922 | }
|
8923 | return false;
|
8924 | };
|
8925 | exports2.isInvalidBrace = (block) => {
|
8926 | if (block.type !== "brace")
|
8927 | return false;
|
8928 | if (block.invalid === true || block.dollar)
|
8929 | return true;
|
8930 | if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
8931 | block.invalid = true;
|
8932 | return true;
|
8933 | }
|
8934 | if (block.open !== true || block.close !== true) {
|
8935 | block.invalid = true;
|
8936 | return true;
|
8937 | }
|
8938 | return false;
|
8939 | };
|
8940 | exports2.isOpenOrClose = (node) => {
|
8941 | if (node.type === "open" || node.type === "close") {
|
8942 | return true;
|
8943 | }
|
8944 | return node.open === true || node.close === true;
|
8945 | };
|
8946 | exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
|
8947 | if (node.type === "text")
|
8948 | acc.push(node.value);
|
8949 | if (node.type === "range")
|
8950 | node.type = "text";
|
8951 | return acc;
|
8952 | }, []);
|
8953 | exports2.flatten = (...args) => {
|
8954 | const result = [];
|
8955 | const flat = (arr) => {
|
8956 | for (let i = 0; i < arr.length; i++) {
|
8957 | let ele = arr[i];
|
8958 | Array.isArray(ele) ? flat(ele, result) : ele !== void 0 && result.push(ele);
|
8959 | }
|
8960 | return result;
|
8961 | };
|
8962 | flat(args);
|
8963 | return result;
|
8964 | };
|
8965 | }
|
8966 | });
|
8967 | var require_stringify = __commonJS2({
|
8968 | "node_modules/braces/lib/stringify.js"(exports2, module2) {
|
8969 | "use strict";
|
8970 | var utils = require_utils2();
|
8971 | module2.exports = (ast, options = {}) => {
|
8972 | let stringify = (node, parent = {}) => {
|
8973 | let invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
8974 | let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
8975 | let output = "";
|
8976 | if (node.value) {
|
8977 | if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
8978 | return "\\" + node.value;
|
8979 | }
|
8980 | return node.value;
|
8981 | }
|
8982 | if (node.value) {
|
8983 | return node.value;
|
8984 | }
|
8985 | if (node.nodes) {
|
8986 | for (let child of node.nodes) {
|
8987 | output += stringify(child);
|
8988 | }
|
8989 | }
|
8990 | return output;
|
8991 | };
|
8992 | return stringify(ast);
|
8993 | };
|
8994 | }
|
8995 | });
|
8996 | var require_is_number = __commonJS2({
|
8997 | "node_modules/is-number/index.js"(exports2, module2) {
|
8998 | "use strict";
|
8999 | module2.exports = function(num) {
|
9000 | if (typeof num === "number") {
|
9001 | return num - num === 0;
|
9002 | }
|
9003 | if (typeof num === "string" && num.trim() !== "") {
|
9004 | return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
9005 | }
|
9006 | return false;
|
9007 | };
|
9008 | }
|
9009 | });
|
9010 | var require_to_regex_range = __commonJS2({
|
9011 | "node_modules/to-regex-range/index.js"(exports2, module2) {
|
9012 | "use strict";
|
9013 | var isNumber = require_is_number();
|
9014 | var toRegexRange = (min, max, options) => {
|
9015 | if (isNumber(min) === false) {
|
9016 | throw new TypeError("toRegexRange: expected the first argument to be a number");
|
9017 | }
|
9018 | if (max === void 0 || min === max) {
|
9019 | return String(min);
|
9020 | }
|
9021 | if (isNumber(max) === false) {
|
9022 | throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
9023 | }
|
9024 | let opts = Object.assign({
|
9025 | relaxZeros: true
|
9026 | }, options);
|
9027 | if (typeof opts.strictZeros === "boolean") {
|
9028 | opts.relaxZeros = opts.strictZeros === false;
|
9029 | }
|
9030 | let relax = String(opts.relaxZeros);
|
9031 | let shorthand = String(opts.shorthand);
|
9032 | let capture = String(opts.capture);
|
9033 | let wrap = String(opts.wrap);
|
9034 | let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
9035 | if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
9036 | return toRegexRange.cache[cacheKey].result;
|
9037 | }
|
9038 | let a = Math.min(min, max);
|
9039 | let b = Math.max(min, max);
|
9040 | if (Math.abs(a - b) === 1) {
|
9041 | let result = min + "|" + max;
|
9042 | if (opts.capture) {
|
9043 | return `(${result})`;
|
9044 | }
|
9045 | if (opts.wrap === false) {
|
9046 | return result;
|
9047 | }
|
9048 | return `(?:${result})`;
|
9049 | }
|
9050 | let isPadded = hasPadding(min) || hasPadding(max);
|
9051 | let state = {
|
9052 | min,
|
9053 | max,
|
9054 | a,
|
9055 | b
|
9056 | };
|
9057 | let positives = [];
|
9058 | let negatives = [];
|
9059 | if (isPadded) {
|
9060 | state.isPadded = isPadded;
|
9061 | state.maxLen = String(state.max).length;
|
9062 | }
|
9063 | if (a < 0) {
|
9064 | let newMin = b < 0 ? Math.abs(b) : 1;
|
9065 | negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
9066 | a = state.a = 0;
|
9067 | }
|
9068 | if (b >= 0) {
|
9069 | positives = splitToPatterns(a, b, state, opts);
|
9070 | }
|
9071 | state.negatives = negatives;
|
9072 | state.positives = positives;
|
9073 | state.result = collatePatterns(negatives, positives, opts);
|
9074 | if (opts.capture === true) {
|
9075 | state.result = `(${state.result})`;
|
9076 | } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
9077 | state.result = `(?:${state.result})`;
|
9078 | }
|
9079 | toRegexRange.cache[cacheKey] = state;
|
9080 | return state.result;
|
9081 | };
|
9082 | function collatePatterns(neg, pos, options) {
|
9083 | let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
|
9084 | let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
|
9085 | let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
|
9086 | let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
9087 | return subpatterns.join("|");
|
9088 | }
|
9089 | function splitToRanges(min, max) {
|
9090 | let nines = 1;
|
9091 | let zeros = 1;
|
9092 | let stop = countNines(min, nines);
|
9093 | let stops = new Set([max]);
|
9094 | while (min <= stop && stop <= max) {
|
9095 | stops.add(stop);
|
9096 | nines += 1;
|
9097 | stop = countNines(min, nines);
|
9098 | }
|
9099 | stop = countZeros(max + 1, zeros) - 1;
|
9100 | while (min < stop && stop <= max) {
|
9101 | stops.add(stop);
|
9102 | zeros += 1;
|
9103 | stop = countZeros(max + 1, zeros) - 1;
|
9104 | }
|
9105 | stops = [...stops];
|
9106 | stops.sort(compare);
|
9107 | return stops;
|
9108 | }
|
9109 | function rangeToPattern(start, stop, options) {
|
9110 | if (start === stop) {
|
9111 | return {
|
9112 | pattern: start,
|
9113 | count: [],
|
9114 | digits: 0
|
9115 | };
|
9116 | }
|
9117 | let zipped = zip(start, stop);
|
9118 | let digits = zipped.length;
|
9119 | let pattern = "";
|
9120 | let count = 0;
|
9121 | for (let i = 0; i < digits; i++) {
|
9122 | let [startDigit, stopDigit] = zipped[i];
|
9123 | if (startDigit === stopDigit) {
|
9124 | pattern += startDigit;
|
9125 | } else if (startDigit !== "0" || stopDigit !== "9") {
|
9126 | pattern += toCharacterClass(startDigit, stopDigit, options);
|
9127 | } else {
|
9128 | count++;
|
9129 | }
|
9130 | }
|
9131 | if (count) {
|
9132 | pattern += options.shorthand === true ? "\\d" : "[0-9]";
|
9133 | }
|
9134 | return {
|
9135 | pattern,
|
9136 | count: [count],
|
9137 | digits
|
9138 | };
|
9139 | }
|
9140 | function splitToPatterns(min, max, tok, options) {
|
9141 | let ranges = splitToRanges(min, max);
|
9142 | let tokens = [];
|
9143 | let start = min;
|
9144 | let prev;
|
9145 | for (let i = 0; i < ranges.length; i++) {
|
9146 | let max2 = ranges[i];
|
9147 | let obj = rangeToPattern(String(start), String(max2), options);
|
9148 | let zeros = "";
|
9149 | if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
9150 | if (prev.count.length > 1) {
|
9151 | prev.count.pop();
|
9152 | }
|
9153 | prev.count.push(obj.count[0]);
|
9154 | prev.string = prev.pattern + toQuantifier(prev.count);
|
9155 | start = max2 + 1;
|
9156 | continue;
|
9157 | }
|
9158 | if (tok.isPadded) {
|
9159 | zeros = padZeros(max2, tok, options);
|
9160 | }
|
9161 | obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
9162 | tokens.push(obj);
|
9163 | start = max2 + 1;
|
9164 | prev = obj;
|
9165 | }
|
9166 | return tokens;
|
9167 | }
|
9168 | function filterPatterns(arr, comparison, prefix, intersection, options) {
|
9169 | let result = [];
|
9170 | for (let ele of arr) {
|
9171 | let {
|
9172 | string
|
9173 | } = ele;
|
9174 | if (!intersection && !contains(comparison, "string", string)) {
|
9175 | result.push(prefix + string);
|
9176 | }
|
9177 | if (intersection && contains(comparison, "string", string)) {
|
9178 | result.push(prefix + string);
|
9179 | }
|
9180 | }
|
9181 | return result;
|
9182 | }
|
9183 | function zip(a, b) {
|
9184 | let arr = [];
|
9185 | for (let i = 0; i < a.length; i++)
|
9186 | arr.push([a[i], b[i]]);
|
9187 | return arr;
|
9188 | }
|
9189 | function compare(a, b) {
|
9190 | return a > b ? 1 : b > a ? -1 : 0;
|
9191 | }
|
9192 | function contains(arr, key, val) {
|
9193 | return arr.some((ele) => ele[key] === val);
|
9194 | }
|
9195 | function countNines(min, len) {
|
9196 | return Number(String(min).slice(0, -len) + "9".repeat(len));
|
9197 | }
|
9198 | function countZeros(integer, zeros) {
|
9199 | return integer - integer % Math.pow(10, zeros);
|
9200 | }
|
9201 | function toQuantifier(digits) {
|
9202 | let [start = 0, stop = ""] = digits;
|
9203 | if (stop || start > 1) {
|
9204 | return `{${start + (stop ? "," + stop : "")}}`;
|
9205 | }
|
9206 | return "";
|
9207 | }
|
9208 | function toCharacterClass(a, b, options) {
|
9209 | return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
9210 | }
|
9211 | function hasPadding(str) {
|
9212 | return /^-?(0+)\d/.test(str);
|
9213 | }
|
9214 | function padZeros(value, tok, options) {
|
9215 | if (!tok.isPadded) {
|
9216 | return value;
|
9217 | }
|
9218 | let diff = Math.abs(tok.maxLen - String(value).length);
|
9219 | let relax = options.relaxZeros !== false;
|
9220 | switch (diff) {
|
9221 | case 0:
|
9222 | return "";
|
9223 | case 1:
|
9224 | return relax ? "0?" : "0";
|
9225 | case 2:
|
9226 | return relax ? "0{0,2}" : "00";
|
9227 | default: {
|
9228 | return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
9229 | }
|
9230 | }
|
9231 | }
|
9232 | toRegexRange.cache = {};
|
9233 | toRegexRange.clearCache = () => toRegexRange.cache = {};
|
9234 | module2.exports = toRegexRange;
|
9235 | }
|
9236 | });
|
9237 | var require_fill_range = __commonJS2({
|
9238 | "node_modules/fill-range/index.js"(exports2, module2) {
|
9239 | "use strict";
|
9240 | var util = require("util");
|
9241 | var toRegexRange = require_to_regex_range();
|
9242 | var isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
9243 | var transform = (toNumber) => {
|
9244 | return (value) => toNumber === true ? Number(value) : String(value);
|
9245 | };
|
9246 | var isValidValue = (value) => {
|
9247 | return typeof value === "number" || typeof value === "string" && value !== "";
|
9248 | };
|
9249 | var isNumber = (num) => Number.isInteger(+num);
|
9250 | var zeros = (input) => {
|
9251 | let value = `${input}`;
|
9252 | let index = -1;
|
9253 | if (value[0] === "-")
|
9254 | value = value.slice(1);
|
9255 | if (value === "0")
|
9256 | return false;
|
9257 | while (value[++index] === "0")
|
9258 | ;
|
9259 | return index > 0;
|
9260 | };
|
9261 | var stringify = (start, end, options) => {
|
9262 | if (typeof start === "string" || typeof end === "string") {
|
9263 | return true;
|
9264 | }
|
9265 | return options.stringify === true;
|
9266 | };
|
9267 | var pad = (input, maxLength, toNumber) => {
|
9268 | if (maxLength > 0) {
|
9269 | let dash = input[0] === "-" ? "-" : "";
|
9270 | if (dash)
|
9271 | input = input.slice(1);
|
9272 | input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
9273 | }
|
9274 | if (toNumber === false) {
|
9275 | return String(input);
|
9276 | }
|
9277 | return input;
|
9278 | };
|
9279 | var toMaxLen = (input, maxLength) => {
|
9280 | let negative = input[0] === "-" ? "-" : "";
|
9281 | if (negative) {
|
9282 | input = input.slice(1);
|
9283 | maxLength--;
|
9284 | }
|
9285 | while (input.length < maxLength)
|
9286 | input = "0" + input;
|
9287 | return negative ? "-" + input : input;
|
9288 | };
|
9289 | var toSequence = (parts, options) => {
|
9290 | parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
9291 | parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
9292 | let prefix = options.capture ? "" : "?:";
|
9293 | let positives = "";
|
9294 | let negatives = "";
|
9295 | let result;
|
9296 | if (parts.positives.length) {
|
9297 | positives = parts.positives.join("|");
|
9298 | }
|
9299 | if (parts.negatives.length) {
|
9300 | negatives = `-(${prefix}${parts.negatives.join("|")})`;
|
9301 | }
|
9302 | if (positives && negatives) {
|
9303 | result = `${positives}|${negatives}`;
|
9304 | } else {
|
9305 | result = positives || negatives;
|
9306 | }
|
9307 | if (options.wrap) {
|
9308 | return `(${prefix}${result})`;
|
9309 | }
|
9310 | return result;
|
9311 | };
|
9312 | var toRange = (a, b, isNumbers, options) => {
|
9313 | if (isNumbers) {
|
9314 | return toRegexRange(a, b, Object.assign({
|
9315 | wrap: false
|
9316 | }, options));
|
9317 | }
|
9318 | let start = String.fromCharCode(a);
|
9319 | if (a === b)
|
9320 | return start;
|
9321 | let stop = String.fromCharCode(b);
|
9322 | return `[${start}-${stop}]`;
|
9323 | };
|
9324 | var toRegex = (start, end, options) => {
|
9325 | if (Array.isArray(start)) {
|
9326 | let wrap = options.wrap === true;
|
9327 | let prefix = options.capture ? "" : "?:";
|
9328 | return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
9329 | }
|
9330 | return toRegexRange(start, end, options);
|
9331 | };
|
9332 | var rangeError = (...args) => {
|
9333 | return new RangeError("Invalid range arguments: " + util.inspect(...args));
|
9334 | };
|
9335 | var invalidRange = (start, end, options) => {
|
9336 | if (options.strictRanges === true)
|
9337 | throw rangeError([start, end]);
|
9338 | return [];
|
9339 | };
|
9340 | var invalidStep = (step, options) => {
|
9341 | if (options.strictRanges === true) {
|
9342 | throw new TypeError(`Expected step "${step}" to be a number`);
|
9343 | }
|
9344 | return [];
|
9345 | };
|
9346 | var fillNumbers = (start, end, step = 1, options = {}) => {
|
9347 | let a = Number(start);
|
9348 | let b = Number(end);
|
9349 | if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
9350 | if (options.strictRanges === true)
|
9351 | throw rangeError([start, end]);
|
9352 | return [];
|
9353 | }
|
9354 | if (a === 0)
|
9355 | a = 0;
|
9356 | if (b === 0)
|
9357 | b = 0;
|
9358 | let descending = a > b;
|
9359 | let startString = String(start);
|
9360 | let endString = String(end);
|
9361 | let stepString = String(step);
|
9362 | step = Math.max(Math.abs(step), 1);
|
9363 | let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
9364 | let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
9365 | let toNumber = padded === false && stringify(start, end, options) === false;
|
9366 | let format = options.transform || transform(toNumber);
|
9367 | if (options.toRegex && step === 1) {
|
9368 | return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
9369 | }
|
9370 | let parts = {
|
9371 | negatives: [],
|
9372 | positives: []
|
9373 | };
|
9374 | let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
9375 | let range = [];
|
9376 | let index = 0;
|
9377 | while (descending ? a >= b : a <= b) {
|
9378 | if (options.toRegex === true && step > 1) {
|
9379 | push(a);
|
9380 | } else {
|
9381 | range.push(pad(format(a, index), maxLen, toNumber));
|
9382 | }
|
9383 | a = descending ? a - step : a + step;
|
9384 | index++;
|
9385 | }
|
9386 | if (options.toRegex === true) {
|
9387 | return step > 1 ? toSequence(parts, options) : toRegex(range, null, Object.assign({
|
9388 | wrap: false
|
9389 | }, options));
|
9390 | }
|
9391 | return range;
|
9392 | };
|
9393 | var fillLetters = (start, end, step = 1, options = {}) => {
|
9394 | if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
9395 | return invalidRange(start, end, options);
|
9396 | }
|
9397 | let format = options.transform || ((val) => String.fromCharCode(val));
|
9398 | let a = `${start}`.charCodeAt(0);
|
9399 | let b = `${end}`.charCodeAt(0);
|
9400 | let descending = a > b;
|
9401 | let min = Math.min(a, b);
|
9402 | let max = Math.max(a, b);
|
9403 | if (options.toRegex && step === 1) {
|
9404 | return toRange(min, max, false, options);
|
9405 | }
|
9406 | let range = [];
|
9407 | let index = 0;
|
9408 | while (descending ? a >= b : a <= b) {
|
9409 | range.push(format(a, index));
|
9410 | a = descending ? a - step : a + step;
|
9411 | index++;
|
9412 | }
|
9413 | if (options.toRegex === true) {
|
9414 | return toRegex(range, null, {
|
9415 | wrap: false,
|
9416 | options
|
9417 | });
|
9418 | }
|
9419 | return range;
|
9420 | };
|
9421 | var fill = (start, end, step, options = {}) => {
|
9422 | if (end == null && isValidValue(start)) {
|
9423 | return [start];
|
9424 | }
|
9425 | if (!isValidValue(start) || !isValidValue(end)) {
|
9426 | return invalidRange(start, end, options);
|
9427 | }
|
9428 | if (typeof step === "function") {
|
9429 | return fill(start, end, 1, {
|
9430 | transform: step
|
9431 | });
|
9432 | }
|
9433 | if (isObject(step)) {
|
9434 | return fill(start, end, 0, step);
|
9435 | }
|
9436 | let opts = Object.assign({}, options);
|
9437 | if (opts.capture === true)
|
9438 | opts.wrap = true;
|
9439 | step = step || opts.step || 1;
|
9440 | if (!isNumber(step)) {
|
9441 | if (step != null && !isObject(step))
|
9442 | return invalidStep(step, opts);
|
9443 | return fill(start, end, 1, step);
|
9444 | }
|
9445 | if (isNumber(start) && isNumber(end)) {
|
9446 | return fillNumbers(start, end, step, opts);
|
9447 | }
|
9448 | return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
9449 | };
|
9450 | module2.exports = fill;
|
9451 | }
|
9452 | });
|
9453 | var require_compile = __commonJS2({
|
9454 | "node_modules/braces/lib/compile.js"(exports2, module2) {
|
9455 | "use strict";
|
9456 | var fill = require_fill_range();
|
9457 | var utils = require_utils2();
|
9458 | var compile = (ast, options = {}) => {
|
9459 | let walk = (node, parent = {}) => {
|
9460 | let invalidBlock = utils.isInvalidBrace(parent);
|
9461 | let invalidNode = node.invalid === true && options.escapeInvalid === true;
|
9462 | let invalid = invalidBlock === true || invalidNode === true;
|
9463 | let prefix = options.escapeInvalid === true ? "\\" : "";
|
9464 | let output = "";
|
9465 | if (node.isOpen === true) {
|
9466 | return prefix + node.value;
|
9467 | }
|
9468 | if (node.isClose === true) {
|
9469 | return prefix + node.value;
|
9470 | }
|
9471 | if (node.type === "open") {
|
9472 | return invalid ? prefix + node.value : "(";
|
9473 | }
|
9474 | if (node.type === "close") {
|
9475 | return invalid ? prefix + node.value : ")";
|
9476 | }
|
9477 | if (node.type === "comma") {
|
9478 | return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
9479 | }
|
9480 | if (node.value) {
|
9481 | return node.value;
|
9482 | }
|
9483 | if (node.nodes && node.ranges > 0) {
|
9484 | let args = utils.reduce(node.nodes);
|
9485 | let range = fill(...args, Object.assign(Object.assign({}, options), {}, {
|
9486 | wrap: false,
|
9487 | toRegex: true
|
9488 | }));
|
9489 | if (range.length !== 0) {
|
9490 | return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
9491 | }
|
9492 | }
|
9493 | if (node.nodes) {
|
9494 | for (let child of node.nodes) {
|
9495 | output += walk(child, node);
|
9496 | }
|
9497 | }
|
9498 | return output;
|
9499 | };
|
9500 | return walk(ast);
|
9501 | };
|
9502 | module2.exports = compile;
|
9503 | }
|
9504 | });
|
9505 | var require_expand = __commonJS2({
|
9506 | "node_modules/braces/lib/expand.js"(exports2, module2) {
|
9507 | "use strict";
|
9508 | var fill = require_fill_range();
|
9509 | var stringify = require_stringify();
|
9510 | var utils = require_utils2();
|
9511 | var append = (queue = "", stash = "", enclose = false) => {
|
9512 | let result = [];
|
9513 | queue = [].concat(queue);
|
9514 | stash = [].concat(stash);
|
9515 | if (!stash.length)
|
9516 | return queue;
|
9517 | if (!queue.length) {
|
9518 | return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
9519 | }
|
9520 | for (let item of queue) {
|
9521 | if (Array.isArray(item)) {
|
9522 | for (let value of item) {
|
9523 | result.push(append(value, stash, enclose));
|
9524 | }
|
9525 | } else {
|
9526 | for (let ele of stash) {
|
9527 | if (enclose === true && typeof ele === "string")
|
9528 | ele = `{${ele}}`;
|
9529 | result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
9530 | }
|
9531 | }
|
9532 | }
|
9533 | return utils.flatten(result);
|
9534 | };
|
9535 | var expand = (ast, options = {}) => {
|
9536 | let rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
9537 | let walk = (node, parent = {}) => {
|
9538 | node.queue = [];
|
9539 | let p = parent;
|
9540 | let q = parent.queue;
|
9541 | while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
9542 | p = p.parent;
|
9543 | q = p.queue;
|
9544 | }
|
9545 | if (node.invalid || node.dollar) {
|
9546 | q.push(append(q.pop(), stringify(node, options)));
|
9547 | return;
|
9548 | }
|
9549 | if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
9550 | q.push(append(q.pop(), ["{}"]));
|
9551 | return;
|
9552 | }
|
9553 | if (node.nodes && node.ranges > 0) {
|
9554 | let args = utils.reduce(node.nodes);
|
9555 | if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
9556 | throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
9557 | }
|
9558 | let range = fill(...args, options);
|
9559 | if (range.length === 0) {
|
9560 | range = stringify(node, options);
|
9561 | }
|
9562 | q.push(append(q.pop(), range));
|
9563 | node.nodes = [];
|
9564 | return;
|
9565 | }
|
9566 | let enclose = utils.encloseBrace(node);
|
9567 | let queue = node.queue;
|
9568 | let block = node;
|
9569 | while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
9570 | block = block.parent;
|
9571 | queue = block.queue;
|
9572 | }
|
9573 | for (let i = 0; i < node.nodes.length; i++) {
|
9574 | let child = node.nodes[i];
|
9575 | if (child.type === "comma" && node.type === "brace") {
|
9576 | if (i === 1)
|
9577 | queue.push("");
|
9578 | queue.push("");
|
9579 | continue;
|
9580 | }
|
9581 | if (child.type === "close") {
|
9582 | q.push(append(q.pop(), queue, enclose));
|
9583 | continue;
|
9584 | }
|
9585 | if (child.value && child.type !== "open") {
|
9586 | queue.push(append(queue.pop(), child.value));
|
9587 | continue;
|
9588 | }
|
9589 | if (child.nodes) {
|
9590 | walk(child, node);
|
9591 | }
|
9592 | }
|
9593 | return queue;
|
9594 | };
|
9595 | return utils.flatten(walk(ast));
|
9596 | };
|
9597 | module2.exports = expand;
|
9598 | }
|
9599 | });
|
9600 | var require_constants2 = __commonJS2({
|
9601 | "node_modules/braces/lib/constants.js"(exports2, module2) {
|
9602 | "use strict";
|
9603 | module2.exports = {
|
9604 | MAX_LENGTH: 1024 * 64,
|
9605 | CHAR_0: "0",
|
9606 | CHAR_9: "9",
|
9607 | CHAR_UPPERCASE_A: "A",
|
9608 | CHAR_LOWERCASE_A: "a",
|
9609 | CHAR_UPPERCASE_Z: "Z",
|
9610 | CHAR_LOWERCASE_Z: "z",
|
9611 | CHAR_LEFT_PARENTHESES: "(",
|
9612 | CHAR_RIGHT_PARENTHESES: ")",
|
9613 | CHAR_ASTERISK: "*",
|
9614 | CHAR_AMPERSAND: "&",
|
9615 | CHAR_AT: "@",
|
9616 | CHAR_BACKSLASH: "\\",
|
9617 | CHAR_BACKTICK: "`",
|
9618 | CHAR_CARRIAGE_RETURN: "\r",
|
9619 | CHAR_CIRCUMFLEX_ACCENT: "^",
|
9620 | CHAR_COLON: ":",
|
9621 | CHAR_COMMA: ",",
|
9622 | CHAR_DOLLAR: "$",
|
9623 | CHAR_DOT: ".",
|
9624 | CHAR_DOUBLE_QUOTE: '"',
|
9625 | CHAR_EQUAL: "=",
|
9626 | CHAR_EXCLAMATION_MARK: "!",
|
9627 | CHAR_FORM_FEED: "\f",
|
9628 | CHAR_FORWARD_SLASH: "/",
|
9629 | CHAR_HASH: "#",
|
9630 | CHAR_HYPHEN_MINUS: "-",
|
9631 | CHAR_LEFT_ANGLE_BRACKET: "<",
|
9632 | CHAR_LEFT_CURLY_BRACE: "{",
|
9633 | CHAR_LEFT_SQUARE_BRACKET: "[",
|
9634 | CHAR_LINE_FEED: "\n",
|
9635 | CHAR_NO_BREAK_SPACE: "\xA0",
|
9636 | CHAR_PERCENT: "%",
|
9637 | CHAR_PLUS: "+",
|
9638 | CHAR_QUESTION_MARK: "?",
|
9639 | CHAR_RIGHT_ANGLE_BRACKET: ">",
|
9640 | CHAR_RIGHT_CURLY_BRACE: "}",
|
9641 | CHAR_RIGHT_SQUARE_BRACKET: "]",
|
9642 | CHAR_SEMICOLON: ";",
|
9643 | CHAR_SINGLE_QUOTE: "'",
|
9644 | CHAR_SPACE: " ",
|
9645 | CHAR_TAB: " ",
|
9646 | CHAR_UNDERSCORE: "_",
|
9647 | CHAR_VERTICAL_LINE: "|",
|
9648 | CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
9649 | };
|
9650 | }
|
9651 | });
|
9652 | var require_parse = __commonJS2({
|
9653 | "node_modules/braces/lib/parse.js"(exports2, module2) {
|
9654 | "use strict";
|
9655 | var stringify = require_stringify();
|
9656 | var {
|
9657 | MAX_LENGTH,
|
9658 | CHAR_BACKSLASH,
|
9659 | CHAR_BACKTICK,
|
9660 | CHAR_COMMA,
|
9661 | CHAR_DOT,
|
9662 | CHAR_LEFT_PARENTHESES,
|
9663 | CHAR_RIGHT_PARENTHESES,
|
9664 | CHAR_LEFT_CURLY_BRACE,
|
9665 | CHAR_RIGHT_CURLY_BRACE,
|
9666 | CHAR_LEFT_SQUARE_BRACKET,
|
9667 | CHAR_RIGHT_SQUARE_BRACKET,
|
9668 | CHAR_DOUBLE_QUOTE,
|
9669 | CHAR_SINGLE_QUOTE,
|
9670 | CHAR_NO_BREAK_SPACE,
|
9671 | CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
9672 | } = require_constants2();
|
9673 | var parse = (input, options = {}) => {
|
9674 | if (typeof input !== "string") {
|
9675 | throw new TypeError("Expected a string");
|
9676 | }
|
9677 | let opts = options || {};
|
9678 | let max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
9679 | if (input.length > max) {
|
9680 | throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
9681 | }
|
9682 | let ast = {
|
9683 | type: "root",
|
9684 | input,
|
9685 | nodes: []
|
9686 | };
|
9687 | let stack = [ast];
|
9688 | let block = ast;
|
9689 | let prev = ast;
|
9690 | let brackets = 0;
|
9691 | let length = input.length;
|
9692 | let index = 0;
|
9693 | let depth = 0;
|
9694 | let value;
|
9695 | let memo = {};
|
9696 | const advance = () => input[index++];
|
9697 | const push = (node) => {
|
9698 | if (node.type === "text" && prev.type === "dot") {
|
9699 | prev.type = "text";
|
9700 | }
|
9701 | if (prev && prev.type === "text" && node.type === "text") {
|
9702 | prev.value += node.value;
|
9703 | return;
|
9704 | }
|
9705 | block.nodes.push(node);
|
9706 | node.parent = block;
|
9707 | node.prev = prev;
|
9708 | prev = node;
|
9709 | return node;
|
9710 | };
|
9711 | push({
|
9712 | type: "bos"
|
9713 | });
|
9714 | while (index < length) {
|
9715 | block = stack[stack.length - 1];
|
9716 | value = advance();
|
9717 | if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
9718 | continue;
|
9719 | }
|
9720 | if (value === CHAR_BACKSLASH) {
|
9721 | push({
|
9722 | type: "text",
|
9723 | value: (options.keepEscaping ? value : "") + advance()
|
9724 | });
|
9725 | continue;
|
9726 | }
|
9727 | if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
9728 | push({
|
9729 | type: "text",
|
9730 | value: "\\" + value
|
9731 | });
|
9732 | continue;
|
9733 | }
|
9734 | if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
9735 | brackets++;
|
9736 | let closed = true;
|
9737 | let next;
|
9738 | while (index < length && (next = advance())) {
|
9739 | value += next;
|
9740 | if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
9741 | brackets++;
|
9742 | continue;
|
9743 | }
|
9744 | if (next === CHAR_BACKSLASH) {
|
9745 | value += advance();
|
9746 | continue;
|
9747 | }
|
9748 | if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
9749 | brackets--;
|
9750 | if (brackets === 0) {
|
9751 | break;
|
9752 | }
|
9753 | }
|
9754 | }
|
9755 | push({
|
9756 | type: "text",
|
9757 | value
|
9758 | });
|
9759 | continue;
|
9760 | }
|
9761 | if (value === CHAR_LEFT_PARENTHESES) {
|
9762 | block = push({
|
9763 | type: "paren",
|
9764 | nodes: []
|
9765 | });
|
9766 | stack.push(block);
|
9767 | push({
|
9768 | type: "text",
|
9769 | value
|
9770 | });
|
9771 | continue;
|
9772 | }
|
9773 | if (value === CHAR_RIGHT_PARENTHESES) {
|
9774 | if (block.type !== "paren") {
|
9775 | push({
|
9776 | type: "text",
|
9777 | value
|
9778 | });
|
9779 | continue;
|
9780 | }
|
9781 | block = stack.pop();
|
9782 | push({
|
9783 | type: "text",
|
9784 | value
|
9785 | });
|
9786 | block = stack[stack.length - 1];
|
9787 | continue;
|
9788 | }
|
9789 | if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
9790 | let open = value;
|
9791 | let next;
|
9792 | if (options.keepQuotes !== true) {
|
9793 | value = "";
|
9794 | }
|
9795 | while (index < length && (next = advance())) {
|
9796 | if (next === CHAR_BACKSLASH) {
|
9797 | value += next + advance();
|
9798 | continue;
|
9799 | }
|
9800 | if (next === open) {
|
9801 | if (options.keepQuotes === true)
|
9802 | value += next;
|
9803 | break;
|
9804 | }
|
9805 | value += next;
|
9806 | }
|
9807 | push({
|
9808 | type: "text",
|
9809 | value
|
9810 | });
|
9811 | continue;
|
9812 | }
|
9813 | if (value === CHAR_LEFT_CURLY_BRACE) {
|
9814 | depth++;
|
9815 | let dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
9816 | let brace = {
|
9817 | type: "brace",
|
9818 | open: true,
|
9819 | close: false,
|
9820 | dollar,
|
9821 | depth,
|
9822 | commas: 0,
|
9823 | ranges: 0,
|
9824 | nodes: []
|
9825 | };
|
9826 | block = push(brace);
|
9827 | stack.push(block);
|
9828 | push({
|
9829 | type: "open",
|
9830 | value
|
9831 | });
|
9832 | continue;
|
9833 | }
|
9834 | if (value === CHAR_RIGHT_CURLY_BRACE) {
|
9835 | if (block.type !== "brace") {
|
9836 | push({
|
9837 | type: "text",
|
9838 | value
|
9839 | });
|
9840 | continue;
|
9841 | }
|
9842 | let type = "close";
|
9843 | block = stack.pop();
|
9844 | block.close = true;
|
9845 | push({
|
9846 | type,
|
9847 | value
|
9848 | });
|
9849 | depth--;
|
9850 | block = stack[stack.length - 1];
|
9851 | continue;
|
9852 | }
|
9853 | if (value === CHAR_COMMA && depth > 0) {
|
9854 | if (block.ranges > 0) {
|
9855 | block.ranges = 0;
|
9856 | let open = block.nodes.shift();
|
9857 | block.nodes = [open, {
|
9858 | type: "text",
|
9859 | value: stringify(block)
|
9860 | }];
|
9861 | }
|
9862 | push({
|
9863 | type: "comma",
|
9864 | value
|
9865 | });
|
9866 | block.commas++;
|
9867 | continue;
|
9868 | }
|
9869 | if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
9870 | let siblings = block.nodes;
|
9871 | if (depth === 0 || siblings.length === 0) {
|
9872 | push({
|
9873 | type: "text",
|
9874 | value
|
9875 | });
|
9876 | continue;
|
9877 | }
|
9878 | if (prev.type === "dot") {
|
9879 | block.range = [];
|
9880 | prev.value += value;
|
9881 | prev.type = "range";
|
9882 | if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
9883 | block.invalid = true;
|
9884 | block.ranges = 0;
|
9885 | prev.type = "text";
|
9886 | continue;
|
9887 | }
|
9888 | block.ranges++;
|
9889 | block.args = [];
|
9890 | continue;
|
9891 | }
|
9892 | if (prev.type === "range") {
|
9893 | siblings.pop();
|
9894 | let before = siblings[siblings.length - 1];
|
9895 | before.value += prev.value + value;
|
9896 | prev = before;
|
9897 | block.ranges--;
|
9898 | continue;
|
9899 | }
|
9900 | push({
|
9901 | type: "dot",
|
9902 | value
|
9903 | });
|
9904 | continue;
|
9905 | }
|
9906 | push({
|
9907 | type: "text",
|
9908 | value
|
9909 | });
|
9910 | }
|
9911 | do {
|
9912 | block = stack.pop();
|
9913 | if (block.type !== "root") {
|
9914 | block.nodes.forEach((node) => {
|
9915 | if (!node.nodes) {
|
9916 | if (node.type === "open")
|
9917 | node.isOpen = true;
|
9918 | if (node.type === "close")
|
9919 | node.isClose = true;
|
9920 | if (!node.nodes)
|
9921 | node.type = "text";
|
9922 | node.invalid = true;
|
9923 | }
|
9924 | });
|
9925 | let parent = stack[stack.length - 1];
|
9926 | let index2 = parent.nodes.indexOf(block);
|
9927 | parent.nodes.splice(index2, 1, ...block.nodes);
|
9928 | }
|
9929 | } while (stack.length > 0);
|
9930 | push({
|
9931 | type: "eos"
|
9932 | });
|
9933 | return ast;
|
9934 | };
|
9935 | module2.exports = parse;
|
9936 | }
|
9937 | });
|
9938 | var require_braces = __commonJS2({
|
9939 | "node_modules/braces/index.js"(exports2, module2) {
|
9940 | "use strict";
|
9941 | var stringify = require_stringify();
|
9942 | var compile = require_compile();
|
9943 | var expand = require_expand();
|
9944 | var parse = require_parse();
|
9945 | var braces = (input, options = {}) => {
|
9946 | let output = [];
|
9947 | if (Array.isArray(input)) {
|
9948 | for (let pattern of input) {
|
9949 | let result = braces.create(pattern, options);
|
9950 | if (Array.isArray(result)) {
|
9951 | output.push(...result);
|
9952 | } else {
|
9953 | output.push(result);
|
9954 | }
|
9955 | }
|
9956 | } else {
|
9957 | output = [].concat(braces.create(input, options));
|
9958 | }
|
9959 | if (options && options.expand === true && options.nodupes === true) {
|
9960 | output = [...new Set(output)];
|
9961 | }
|
9962 | return output;
|
9963 | };
|
9964 | braces.parse = (input, options = {}) => parse(input, options);
|
9965 | braces.stringify = (input, options = {}) => {
|
9966 | if (typeof input === "string") {
|
9967 | return stringify(braces.parse(input, options), options);
|
9968 | }
|
9969 | return stringify(input, options);
|
9970 | };
|
9971 | braces.compile = (input, options = {}) => {
|
9972 | if (typeof input === "string") {
|
9973 | input = braces.parse(input, options);
|
9974 | }
|
9975 | return compile(input, options);
|
9976 | };
|
9977 | braces.expand = (input, options = {}) => {
|
9978 | if (typeof input === "string") {
|
9979 | input = braces.parse(input, options);
|
9980 | }
|
9981 | let result = expand(input, options);
|
9982 | if (options.noempty === true) {
|
9983 | result = result.filter(Boolean);
|
9984 | }
|
9985 | if (options.nodupes === true) {
|
9986 | result = [...new Set(result)];
|
9987 | }
|
9988 | return result;
|
9989 | };
|
9990 | braces.create = (input, options = {}) => {
|
9991 | if (input === "" || input.length < 3) {
|
9992 | return [input];
|
9993 | }
|
9994 | return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
|
9995 | };
|
9996 | module2.exports = braces;
|
9997 | }
|
9998 | });
|
9999 | var require_constants3 = __commonJS2({
|
10000 | "node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
10001 | "use strict";
|
10002 | var path = require("path");
|
10003 | var WIN_SLASH = "\\\\/";
|
10004 | var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
10005 | var DOT_LITERAL = "\\.";
|
10006 | var PLUS_LITERAL = "\\+";
|
10007 | var QMARK_LITERAL = "\\?";
|
10008 | var SLASH_LITERAL = "\\/";
|
10009 | var ONE_CHAR = "(?=.)";
|
10010 | var QMARK = "[^/]";
|
10011 | var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
10012 | var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
10013 | var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
10014 | var NO_DOT = `(?!${DOT_LITERAL})`;
|
10015 | var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
10016 | var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
10017 | var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
10018 | var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
10019 | var STAR = `${QMARK}*?`;
|
10020 | var POSIX_CHARS = {
|
10021 | DOT_LITERAL,
|
10022 | PLUS_LITERAL,
|
10023 | QMARK_LITERAL,
|
10024 | SLASH_LITERAL,
|
10025 | ONE_CHAR,
|
10026 | QMARK,
|
10027 | END_ANCHOR,
|
10028 | DOTS_SLASH,
|
10029 | NO_DOT,
|
10030 | NO_DOTS,
|
10031 | NO_DOT_SLASH,
|
10032 | NO_DOTS_SLASH,
|
10033 | QMARK_NO_DOT,
|
10034 | STAR,
|
10035 | START_ANCHOR
|
10036 | };
|
10037 | var WINDOWS_CHARS = Object.assign(Object.assign({}, POSIX_CHARS), {}, {
|
10038 | SLASH_LITERAL: `[${WIN_SLASH}]`,
|
10039 | QMARK: WIN_NO_SLASH,
|
10040 | STAR: `${WIN_NO_SLASH}*?`,
|
10041 | DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
10042 | NO_DOT: `(?!${DOT_LITERAL})`,
|
10043 | NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
10044 | NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
10045 | NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
10046 | QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
10047 | START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
10048 | END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
10049 | });
|
10050 | var POSIX_REGEX_SOURCE = {
|
10051 | alnum: "a-zA-Z0-9",
|
10052 | alpha: "a-zA-Z",
|
10053 | ascii: "\\x00-\\x7F",
|
10054 | blank: " \\t",
|
10055 | cntrl: "\\x00-\\x1F\\x7F",
|
10056 | digit: "0-9",
|
10057 | graph: "\\x21-\\x7E",
|
10058 | lower: "a-z",
|
10059 | print: "\\x20-\\x7E ",
|
10060 | punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
10061 | space: " \\t\\r\\n\\v\\f",
|
10062 | upper: "A-Z",
|
10063 | word: "A-Za-z0-9_",
|
10064 | xdigit: "A-Fa-f0-9"
|
10065 | };
|
10066 | module2.exports = {
|
10067 | MAX_LENGTH: 1024 * 64,
|
10068 | POSIX_REGEX_SOURCE,
|
10069 | REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
10070 | REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
10071 | REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
10072 | REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
10073 | REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
10074 | REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
10075 | REPLACEMENTS: {
|
10076 | "***": "*",
|
10077 | "**/**": "**",
|
10078 | "**/**/**": "**"
|
10079 | },
|
10080 | CHAR_0: 48,
|
10081 | CHAR_9: 57,
|
10082 | CHAR_UPPERCASE_A: 65,
|
10083 | CHAR_LOWERCASE_A: 97,
|
10084 | CHAR_UPPERCASE_Z: 90,
|
10085 | CHAR_LOWERCASE_Z: 122,
|
10086 | CHAR_LEFT_PARENTHESES: 40,
|
10087 | CHAR_RIGHT_PARENTHESES: 41,
|
10088 | CHAR_ASTERISK: 42,
|
10089 | CHAR_AMPERSAND: 38,
|
10090 | CHAR_AT: 64,
|
10091 | CHAR_BACKWARD_SLASH: 92,
|
10092 | CHAR_CARRIAGE_RETURN: 13,
|
10093 | CHAR_CIRCUMFLEX_ACCENT: 94,
|
10094 | CHAR_COLON: 58,
|
10095 | CHAR_COMMA: 44,
|
10096 | CHAR_DOT: 46,
|
10097 | CHAR_DOUBLE_QUOTE: 34,
|
10098 | CHAR_EQUAL: 61,
|
10099 | CHAR_EXCLAMATION_MARK: 33,
|
10100 | CHAR_FORM_FEED: 12,
|
10101 | CHAR_FORWARD_SLASH: 47,
|
10102 | CHAR_GRAVE_ACCENT: 96,
|
10103 | CHAR_HASH: 35,
|
10104 | CHAR_HYPHEN_MINUS: 45,
|
10105 | CHAR_LEFT_ANGLE_BRACKET: 60,
|
10106 | CHAR_LEFT_CURLY_BRACE: 123,
|
10107 | CHAR_LEFT_SQUARE_BRACKET: 91,
|
10108 | CHAR_LINE_FEED: 10,
|
10109 | CHAR_NO_BREAK_SPACE: 160,
|
10110 | CHAR_PERCENT: 37,
|
10111 | CHAR_PLUS: 43,
|
10112 | CHAR_QUESTION_MARK: 63,
|
10113 | CHAR_RIGHT_ANGLE_BRACKET: 62,
|
10114 | CHAR_RIGHT_CURLY_BRACE: 125,
|
10115 | CHAR_RIGHT_SQUARE_BRACKET: 93,
|
10116 | CHAR_SEMICOLON: 59,
|
10117 | CHAR_SINGLE_QUOTE: 39,
|
10118 | CHAR_SPACE: 32,
|
10119 | CHAR_TAB: 9,
|
10120 | CHAR_UNDERSCORE: 95,
|
10121 | CHAR_VERTICAL_LINE: 124,
|
10122 | CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
10123 | SEP: path.sep,
|
10124 | extglobChars(chars) {
|
10125 | return {
|
10126 | "!": {
|
10127 | type: "negate",
|
10128 | open: "(?:(?!(?:",
|
10129 | close: `))${chars.STAR})`
|
10130 | },
|
10131 | "?": {
|
10132 | type: "qmark",
|
10133 | open: "(?:",
|
10134 | close: ")?"
|
10135 | },
|
10136 | "+": {
|
10137 | type: "plus",
|
10138 | open: "(?:",
|
10139 | close: ")+"
|
10140 | },
|
10141 | "*": {
|
10142 | type: "star",
|
10143 | open: "(?:",
|
10144 | close: ")*"
|
10145 | },
|
10146 | "@": {
|
10147 | type: "at",
|
10148 | open: "(?:",
|
10149 | close: ")"
|
10150 | }
|
10151 | };
|
10152 | },
|
10153 | globChars(win32) {
|
10154 | return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
10155 | }
|
10156 | };
|
10157 | }
|
10158 | });
|
10159 | var require_utils3 = __commonJS2({
|
10160 | "node_modules/picomatch/lib/utils.js"(exports2) {
|
10161 | "use strict";
|
10162 | var path = require("path");
|
10163 | var win32 = process.platform === "win32";
|
10164 | var {
|
10165 | REGEX_BACKSLASH,
|
10166 | REGEX_REMOVE_BACKSLASH,
|
10167 | REGEX_SPECIAL_CHARS,
|
10168 | REGEX_SPECIAL_CHARS_GLOBAL
|
10169 | } = require_constants3();
|
10170 | exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
10171 | exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
10172 | exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
|
10173 | exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
10174 | exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
10175 | exports2.removeBackslashes = (str) => {
|
10176 | return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
10177 | return match === "\\" ? "" : match;
|
10178 | });
|
10179 | };
|
10180 | exports2.supportsLookbehinds = () => {
|
10181 | const segs = process.version.slice(1).split(".").map(Number);
|
10182 | if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
10183 | return true;
|
10184 | }
|
10185 | return false;
|
10186 | };
|
10187 | exports2.isWindows = (options) => {
|
10188 | if (options && typeof options.windows === "boolean") {
|
10189 | return options.windows;
|
10190 | }
|
10191 | return win32 === true || path.sep === "\\";
|
10192 | };
|
10193 | exports2.escapeLast = (input, char, lastIdx) => {
|
10194 | const idx = input.lastIndexOf(char, lastIdx);
|
10195 | if (idx === -1)
|
10196 | return input;
|
10197 | if (input[idx - 1] === "\\")
|
10198 | return exports2.escapeLast(input, char, idx - 1);
|
10199 | return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
10200 | };
|
10201 | exports2.removePrefix = (input, state = {}) => {
|
10202 | let output = input;
|
10203 | if (output.startsWith("./")) {
|
10204 | output = output.slice(2);
|
10205 | state.prefix = "./";
|
10206 | }
|
10207 | return output;
|
10208 | };
|
10209 | exports2.wrapOutput = (input, state = {}, options = {}) => {
|
10210 | const prepend = options.contains ? "" : "^";
|
10211 | const append = options.contains ? "" : "$";
|
10212 | let output = `${prepend}(?:${input})${append}`;
|
10213 | if (state.negated === true) {
|
10214 | output = `(?:^(?!${output}).*$)`;
|
10215 | }
|
10216 | return output;
|
10217 | };
|
10218 | }
|
10219 | });
|
10220 | var require_scan = __commonJS2({
|
10221 | "node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
10222 | "use strict";
|
10223 | var utils = require_utils3();
|
10224 | var {
|
10225 | CHAR_ASTERISK,
|
10226 | CHAR_AT,
|
10227 | CHAR_BACKWARD_SLASH,
|
10228 | CHAR_COMMA,
|
10229 | CHAR_DOT,
|
10230 | CHAR_EXCLAMATION_MARK,
|
10231 | CHAR_FORWARD_SLASH,
|
10232 | CHAR_LEFT_CURLY_BRACE,
|
10233 | CHAR_LEFT_PARENTHESES,
|
10234 | CHAR_LEFT_SQUARE_BRACKET,
|
10235 | CHAR_PLUS,
|
10236 | CHAR_QUESTION_MARK,
|
10237 | CHAR_RIGHT_CURLY_BRACE,
|
10238 | CHAR_RIGHT_PARENTHESES,
|
10239 | CHAR_RIGHT_SQUARE_BRACKET
|
10240 | } = require_constants3();
|
10241 | var isPathSeparator = (code) => {
|
10242 | return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
10243 | };
|
10244 | var depth = (token) => {
|
10245 | if (token.isPrefix !== true) {
|
10246 | token.depth = token.isGlobstar ? Infinity : 1;
|
10247 | }
|
10248 | };
|
10249 | var scan = (input, options) => {
|
10250 | const opts = options || {};
|
10251 | const length = input.length - 1;
|
10252 | const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
10253 | const slashes = [];
|
10254 | const tokens = [];
|
10255 | const parts = [];
|
10256 | let str = input;
|
10257 | let index = -1;
|
10258 | let start = 0;
|
10259 | let lastIndex = 0;
|
10260 | let isBrace = false;
|
10261 | let isBracket = false;
|
10262 | let isGlob = false;
|
10263 | let isExtglob = false;
|
10264 | let isGlobstar = false;
|
10265 | let braceEscaped = false;
|
10266 | let backslashes = false;
|
10267 | let negated = false;
|
10268 | let negatedExtglob = false;
|
10269 | let finished = false;
|
10270 | let braces = 0;
|
10271 | let prev;
|
10272 | let code;
|
10273 | let token = {
|
10274 | value: "",
|
10275 | depth: 0,
|
10276 | isGlob: false
|
10277 | };
|
10278 | const eos = () => index >= length;
|
10279 | const peek = () => str.charCodeAt(index + 1);
|
10280 | const advance = () => {
|
10281 | prev = code;
|
10282 | return str.charCodeAt(++index);
|
10283 | };
|
10284 | while (index < length) {
|
10285 | code = advance();
|
10286 | let next;
|
10287 | if (code === CHAR_BACKWARD_SLASH) {
|
10288 | backslashes = token.backslashes = true;
|
10289 | code = advance();
|
10290 | if (code === CHAR_LEFT_CURLY_BRACE) {
|
10291 | braceEscaped = true;
|
10292 | }
|
10293 | continue;
|
10294 | }
|
10295 | if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
10296 | braces++;
|
10297 | while (eos() !== true && (code = advance())) {
|
10298 | if (code === CHAR_BACKWARD_SLASH) {
|
10299 | backslashes = token.backslashes = true;
|
10300 | advance();
|
10301 | continue;
|
10302 | }
|
10303 | if (code === CHAR_LEFT_CURLY_BRACE) {
|
10304 | braces++;
|
10305 | continue;
|
10306 | }
|
10307 | if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
10308 | isBrace = token.isBrace = true;
|
10309 | isGlob = token.isGlob = true;
|
10310 | finished = true;
|
10311 | if (scanToEnd === true) {
|
10312 | continue;
|
10313 | }
|
10314 | break;
|
10315 | }
|
10316 | if (braceEscaped !== true && code === CHAR_COMMA) {
|
10317 | isBrace = token.isBrace = true;
|
10318 | isGlob = token.isGlob = true;
|
10319 | finished = true;
|
10320 | if (scanToEnd === true) {
|
10321 | continue;
|
10322 | }
|
10323 | break;
|
10324 | }
|
10325 | if (code === CHAR_RIGHT_CURLY_BRACE) {
|
10326 | braces--;
|
10327 | if (braces === 0) {
|
10328 | braceEscaped = false;
|
10329 | isBrace = token.isBrace = true;
|
10330 | finished = true;
|
10331 | break;
|
10332 | }
|
10333 | }
|
10334 | }
|
10335 | if (scanToEnd === true) {
|
10336 | continue;
|
10337 | }
|
10338 | break;
|
10339 | }
|
10340 | if (code === CHAR_FORWARD_SLASH) {
|
10341 | slashes.push(index);
|
10342 | tokens.push(token);
|
10343 | token = {
|
10344 | value: "",
|
10345 | depth: 0,
|
10346 | isGlob: false
|
10347 | };
|
10348 | if (finished === true)
|
10349 | continue;
|
10350 | if (prev === CHAR_DOT && index === start + 1) {
|
10351 | start += 2;
|
10352 | continue;
|
10353 | }
|
10354 | lastIndex = index + 1;
|
10355 | continue;
|
10356 | }
|
10357 | if (opts.noext !== true) {
|
10358 | const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
10359 | if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
10360 | isGlob = token.isGlob = true;
|
10361 | isExtglob = token.isExtglob = true;
|
10362 | finished = true;
|
10363 | if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
10364 | negatedExtglob = true;
|
10365 | }
|
10366 | if (scanToEnd === true) {
|
10367 | while (eos() !== true && (code = advance())) {
|
10368 | if (code === CHAR_BACKWARD_SLASH) {
|
10369 | backslashes = token.backslashes = true;
|
10370 | code = advance();
|
10371 | continue;
|
10372 | }
|
10373 | if (code === CHAR_RIGHT_PARENTHESES) {
|
10374 | isGlob = token.isGlob = true;
|
10375 | finished = true;
|
10376 | break;
|
10377 | }
|
10378 | }
|
10379 | continue;
|
10380 | }
|
10381 | break;
|
10382 | }
|
10383 | }
|
10384 | if (code === CHAR_ASTERISK) {
|
10385 | if (prev === CHAR_ASTERISK)
|
10386 | isGlobstar = token.isGlobstar = true;
|
10387 | isGlob = token.isGlob = true;
|
10388 | finished = true;
|
10389 | if (scanToEnd === true) {
|
10390 | continue;
|
10391 | }
|
10392 | break;
|
10393 | }
|
10394 | if (code === CHAR_QUESTION_MARK) {
|
10395 | isGlob = token.isGlob = true;
|
10396 | finished = true;
|
10397 | if (scanToEnd === true) {
|
10398 | continue;
|
10399 | }
|
10400 | break;
|
10401 | }
|
10402 | if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
10403 | while (eos() !== true && (next = advance())) {
|
10404 | if (next === CHAR_BACKWARD_SLASH) {
|
10405 | backslashes = token.backslashes = true;
|
10406 | advance();
|
10407 | continue;
|
10408 | }
|
10409 | if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
10410 | isBracket = token.isBracket = true;
|
10411 | isGlob = token.isGlob = true;
|
10412 | finished = true;
|
10413 | break;
|
10414 | }
|
10415 | }
|
10416 | if (scanToEnd === true) {
|
10417 | continue;
|
10418 | }
|
10419 | break;
|
10420 | }
|
10421 | if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
10422 | negated = token.negated = true;
|
10423 | start++;
|
10424 | continue;
|
10425 | }
|
10426 | if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
10427 | isGlob = token.isGlob = true;
|
10428 | if (scanToEnd === true) {
|
10429 | while (eos() !== true && (code = advance())) {
|
10430 | if (code === CHAR_LEFT_PARENTHESES) {
|
10431 | backslashes = token.backslashes = true;
|
10432 | code = advance();
|
10433 | continue;
|
10434 | }
|
10435 | if (code === CHAR_RIGHT_PARENTHESES) {
|
10436 | finished = true;
|
10437 | break;
|
10438 | }
|
10439 | }
|
10440 | continue;
|
10441 | }
|
10442 | break;
|
10443 | }
|
10444 | if (isGlob === true) {
|
10445 | finished = true;
|
10446 | if (scanToEnd === true) {
|
10447 | continue;
|
10448 | }
|
10449 | break;
|
10450 | }
|
10451 | }
|
10452 | if (opts.noext === true) {
|
10453 | isExtglob = false;
|
10454 | isGlob = false;
|
10455 | }
|
10456 | let base = str;
|
10457 | let prefix = "";
|
10458 | let glob = "";
|
10459 | if (start > 0) {
|
10460 | prefix = str.slice(0, start);
|
10461 | str = str.slice(start);
|
10462 | lastIndex -= start;
|
10463 | }
|
10464 | if (base && isGlob === true && lastIndex > 0) {
|
10465 | base = str.slice(0, lastIndex);
|
10466 | glob = str.slice(lastIndex);
|
10467 | } else if (isGlob === true) {
|
10468 | base = "";
|
10469 | glob = str;
|
10470 | } else {
|
10471 | base = str;
|
10472 | }
|
10473 | if (base && base !== "" && base !== "/" && base !== str) {
|
10474 | if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
10475 | base = base.slice(0, -1);
|
10476 | }
|
10477 | }
|
10478 | if (opts.unescape === true) {
|
10479 | if (glob)
|
10480 | glob = utils.removeBackslashes(glob);
|
10481 | if (base && backslashes === true) {
|
10482 | base = utils.removeBackslashes(base);
|
10483 | }
|
10484 | }
|
10485 | const state = {
|
10486 | prefix,
|
10487 | input,
|
10488 | start,
|
10489 | base,
|
10490 | glob,
|
10491 | isBrace,
|
10492 | isBracket,
|
10493 | isGlob,
|
10494 | isExtglob,
|
10495 | isGlobstar,
|
10496 | negated,
|
10497 | negatedExtglob
|
10498 | };
|
10499 | if (opts.tokens === true) {
|
10500 | state.maxDepth = 0;
|
10501 | if (!isPathSeparator(code)) {
|
10502 | tokens.push(token);
|
10503 | }
|
10504 | state.tokens = tokens;
|
10505 | }
|
10506 | if (opts.parts === true || opts.tokens === true) {
|
10507 | let prevIndex;
|
10508 | for (let idx = 0; idx < slashes.length; idx++) {
|
10509 | const n = prevIndex ? prevIndex + 1 : start;
|
10510 | const i = slashes[idx];
|
10511 | const value = input.slice(n, i);
|
10512 | if (opts.tokens) {
|
10513 | if (idx === 0 && start !== 0) {
|
10514 | tokens[idx].isPrefix = true;
|
10515 | tokens[idx].value = prefix;
|
10516 | } else {
|
10517 | tokens[idx].value = value;
|
10518 | }
|
10519 | depth(tokens[idx]);
|
10520 | state.maxDepth += tokens[idx].depth;
|
10521 | }
|
10522 | if (idx !== 0 || value !== "") {
|
10523 | parts.push(value);
|
10524 | }
|
10525 | prevIndex = i;
|
10526 | }
|
10527 | if (prevIndex && prevIndex + 1 < input.length) {
|
10528 | const value = input.slice(prevIndex + 1);
|
10529 | parts.push(value);
|
10530 | if (opts.tokens) {
|
10531 | tokens[tokens.length - 1].value = value;
|
10532 | depth(tokens[tokens.length - 1]);
|
10533 | state.maxDepth += tokens[tokens.length - 1].depth;
|
10534 | }
|
10535 | }
|
10536 | state.slashes = slashes;
|
10537 | state.parts = parts;
|
10538 | }
|
10539 | return state;
|
10540 | };
|
10541 | module2.exports = scan;
|
10542 | }
|
10543 | });
|
10544 | var require_parse2 = __commonJS2({
|
10545 | "node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
10546 | "use strict";
|
10547 | var constants = require_constants3();
|
10548 | var utils = require_utils3();
|
10549 | var {
|
10550 | MAX_LENGTH,
|
10551 | POSIX_REGEX_SOURCE,
|
10552 | REGEX_NON_SPECIAL_CHARS,
|
10553 | REGEX_SPECIAL_CHARS_BACKREF,
|
10554 | REPLACEMENTS
|
10555 | } = constants;
|
10556 | var expandRange = (args, options) => {
|
10557 | if (typeof options.expandRange === "function") {
|
10558 | return options.expandRange(...args, options);
|
10559 | }
|
10560 | args.sort();
|
10561 | const value = `[${args.join("-")}]`;
|
10562 | try {
|
10563 | new RegExp(value);
|
10564 | } catch (ex) {
|
10565 | return args.map((v) => utils.escapeRegex(v)).join("..");
|
10566 | }
|
10567 | return value;
|
10568 | };
|
10569 | var syntaxError = (type, char) => {
|
10570 | return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
10571 | };
|
10572 | var parse = (input, options) => {
|
10573 | if (typeof input !== "string") {
|
10574 | throw new TypeError("Expected a string");
|
10575 | }
|
10576 | input = REPLACEMENTS[input] || input;
|
10577 | const opts = Object.assign({}, options);
|
10578 | const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
10579 | let len = input.length;
|
10580 | if (len > max) {
|
10581 | throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
10582 | }
|
10583 | const bos = {
|
10584 | type: "bos",
|
10585 | value: "",
|
10586 | output: opts.prepend || ""
|
10587 | };
|
10588 | const tokens = [bos];
|
10589 | const capture = opts.capture ? "" : "?:";
|
10590 | const win32 = utils.isWindows(options);
|
10591 | const PLATFORM_CHARS = constants.globChars(win32);
|
10592 | const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
10593 | const {
|
10594 | DOT_LITERAL,
|
10595 | PLUS_LITERAL,
|
10596 | SLASH_LITERAL,
|
10597 | ONE_CHAR,
|
10598 | DOTS_SLASH,
|
10599 | NO_DOT,
|
10600 | NO_DOT_SLASH,
|
10601 | NO_DOTS_SLASH,
|
10602 | QMARK,
|
10603 | QMARK_NO_DOT,
|
10604 | STAR,
|
10605 | START_ANCHOR
|
10606 | } = PLATFORM_CHARS;
|
10607 | const globstar = (opts2) => {
|
10608 | return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
10609 | };
|
10610 | const nodot = opts.dot ? "" : NO_DOT;
|
10611 | const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
10612 | let star = opts.bash === true ? globstar(opts) : STAR;
|
10613 | if (opts.capture) {
|
10614 | star = `(${star})`;
|
10615 | }
|
10616 | if (typeof opts.noext === "boolean") {
|
10617 | opts.noextglob = opts.noext;
|
10618 | }
|
10619 | const state = {
|
10620 | input,
|
10621 | index: -1,
|
10622 | start: 0,
|
10623 | dot: opts.dot === true,
|
10624 | consumed: "",
|
10625 | output: "",
|
10626 | prefix: "",
|
10627 | backtrack: false,
|
10628 | negated: false,
|
10629 | brackets: 0,
|
10630 | braces: 0,
|
10631 | parens: 0,
|
10632 | quotes: 0,
|
10633 | globstar: false,
|
10634 | tokens
|
10635 | };
|
10636 | input = utils.removePrefix(input, state);
|
10637 | len = input.length;
|
10638 | const extglobs = [];
|
10639 | const braces = [];
|
10640 | const stack = [];
|
10641 | let prev = bos;
|
10642 | let value;
|
10643 | const eos = () => state.index === len - 1;
|
10644 | const peek = state.peek = (n = 1) => input[state.index + n];
|
10645 | const advance = state.advance = () => input[++state.index] || "";
|
10646 | const remaining = () => input.slice(state.index + 1);
|
10647 | const consume = (value2 = "", num = 0) => {
|
10648 | state.consumed += value2;
|
10649 | state.index += num;
|
10650 | };
|
10651 | const append = (token) => {
|
10652 | state.output += token.output != null ? token.output : token.value;
|
10653 | consume(token.value);
|
10654 | };
|
10655 | const negate = () => {
|
10656 | let count = 1;
|
10657 | while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
10658 | advance();
|
10659 | state.start++;
|
10660 | count++;
|
10661 | }
|
10662 | if (count % 2 === 0) {
|
10663 | return false;
|
10664 | }
|
10665 | state.negated = true;
|
10666 | state.start++;
|
10667 | return true;
|
10668 | };
|
10669 | const increment = (type) => {
|
10670 | state[type]++;
|
10671 | stack.push(type);
|
10672 | };
|
10673 | const decrement = (type) => {
|
10674 | state[type]--;
|
10675 | stack.pop();
|
10676 | };
|
10677 | const push = (tok) => {
|
10678 | if (prev.type === "globstar") {
|
10679 | const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
10680 | const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
10681 | if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
10682 | state.output = state.output.slice(0, -prev.output.length);
|
10683 | prev.type = "star";
|
10684 | prev.value = "*";
|
10685 | prev.output = star;
|
10686 | state.output += prev.output;
|
10687 | }
|
10688 | }
|
10689 | if (extglobs.length && tok.type !== "paren") {
|
10690 | extglobs[extglobs.length - 1].inner += tok.value;
|
10691 | }
|
10692 | if (tok.value || tok.output)
|
10693 | append(tok);
|
10694 | if (prev && prev.type === "text" && tok.type === "text") {
|
10695 | prev.value += tok.value;
|
10696 | prev.output = (prev.output || "") + tok.value;
|
10697 | return;
|
10698 | }
|
10699 | tok.prev = prev;
|
10700 | tokens.push(tok);
|
10701 | prev = tok;
|
10702 | };
|
10703 | const extglobOpen = (type, value2) => {
|
10704 | const token = Object.assign(Object.assign({}, EXTGLOB_CHARS[value2]), {}, {
|
10705 | conditions: 1,
|
10706 | inner: ""
|
10707 | });
|
10708 | token.prev = prev;
|
10709 | token.parens = state.parens;
|
10710 | token.output = state.output;
|
10711 | const output = (opts.capture ? "(" : "") + token.open;
|
10712 | increment("parens");
|
10713 | push({
|
10714 | type,
|
10715 | value: value2,
|
10716 | output: state.output ? "" : ONE_CHAR
|
10717 | });
|
10718 | push({
|
10719 | type: "paren",
|
10720 | extglob: true,
|
10721 | value: advance(),
|
10722 | output
|
10723 | });
|
10724 | extglobs.push(token);
|
10725 | };
|
10726 | const extglobClose = (token) => {
|
10727 | let output = token.close + (opts.capture ? ")" : "");
|
10728 | let rest;
|
10729 | if (token.type === "negate") {
|
10730 | let extglobStar = star;
|
10731 | if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
10732 | extglobStar = globstar(opts);
|
10733 | }
|
10734 | if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
10735 | output = token.close = `)$))${extglobStar}`;
|
10736 | }
|
10737 | if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
10738 | const expression = parse(rest, Object.assign(Object.assign({}, options), {}, {
|
10739 | fastpaths: false
|
10740 | })).output;
|
10741 | output = token.close = `)${expression})${extglobStar})`;
|
10742 | }
|
10743 | if (token.prev.type === "bos") {
|
10744 | state.negatedExtglob = true;
|
10745 | }
|
10746 | }
|
10747 | push({
|
10748 | type: "paren",
|
10749 | extglob: true,
|
10750 | value,
|
10751 | output
|
10752 | });
|
10753 | decrement("parens");
|
10754 | };
|
10755 | if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
10756 | let backslashes = false;
|
10757 | let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
10758 | if (first === "\\") {
|
10759 | backslashes = true;
|
10760 | return m;
|
10761 | }
|
10762 | if (first === "?") {
|
10763 | if (esc) {
|
10764 | return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
10765 | }
|
10766 | if (index === 0) {
|
10767 | return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
10768 | }
|
10769 | return QMARK.repeat(chars.length);
|
10770 | }
|
10771 | if (first === ".") {
|
10772 | return DOT_LITERAL.repeat(chars.length);
|
10773 | }
|
10774 | if (first === "*") {
|
10775 | if (esc) {
|
10776 | return esc + first + (rest ? star : "");
|
10777 | }
|
10778 | return star;
|
10779 | }
|
10780 | return esc ? m : `\\${m}`;
|
10781 | });
|
10782 | if (backslashes === true) {
|
10783 | if (opts.unescape === true) {
|
10784 | output = output.replace(/\\/g, "");
|
10785 | } else {
|
10786 | output = output.replace(/\\+/g, (m) => {
|
10787 | return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
10788 | });
|
10789 | }
|
10790 | }
|
10791 | if (output === input && opts.contains === true) {
|
10792 | state.output = input;
|
10793 | return state;
|
10794 | }
|
10795 | state.output = utils.wrapOutput(output, state, options);
|
10796 | return state;
|
10797 | }
|
10798 | while (!eos()) {
|
10799 | value = advance();
|
10800 | if (value === "\0") {
|
10801 | continue;
|
10802 | }
|
10803 | if (value === "\\") {
|
10804 | const next = peek();
|
10805 | if (next === "/" && opts.bash !== true) {
|
10806 | continue;
|
10807 | }
|
10808 | if (next === "." || next === ";") {
|
10809 | continue;
|
10810 | }
|
10811 | if (!next) {
|
10812 | value += "\\";
|
10813 | push({
|
10814 | type: "text",
|
10815 | value
|
10816 | });
|
10817 | continue;
|
10818 | }
|
10819 | const match = /^\\+/.exec(remaining());
|
10820 | let slashes = 0;
|
10821 | if (match && match[0].length > 2) {
|
10822 | slashes = match[0].length;
|
10823 | state.index += slashes;
|
10824 | if (slashes % 2 !== 0) {
|
10825 | value += "\\";
|
10826 | }
|
10827 | }
|
10828 | if (opts.unescape === true) {
|
10829 | value = advance();
|
10830 | } else {
|
10831 | value += advance();
|
10832 | }
|
10833 | if (state.brackets === 0) {
|
10834 | push({
|
10835 | type: "text",
|
10836 | value
|
10837 | });
|
10838 | continue;
|
10839 | }
|
10840 | }
|
10841 | if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
10842 | if (opts.posix !== false && value === ":") {
|
10843 | const inner = prev.value.slice(1);
|
10844 | if (inner.includes("[")) {
|
10845 | prev.posix = true;
|
10846 | if (inner.includes(":")) {
|
10847 | const idx = prev.value.lastIndexOf("[");
|
10848 | const pre = prev.value.slice(0, idx);
|
10849 | const rest2 = prev.value.slice(idx + 2);
|
10850 | const posix = POSIX_REGEX_SOURCE[rest2];
|
10851 | if (posix) {
|
10852 | prev.value = pre + posix;
|
10853 | state.backtrack = true;
|
10854 | advance();
|
10855 | if (!bos.output && tokens.indexOf(prev) === 1) {
|
10856 | bos.output = ONE_CHAR;
|
10857 | }
|
10858 | continue;
|
10859 | }
|
10860 | }
|
10861 | }
|
10862 | }
|
10863 | if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
10864 | value = `\\${value}`;
|
10865 | }
|
10866 | if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
10867 | value = `\\${value}`;
|
10868 | }
|
10869 | if (opts.posix === true && value === "!" && prev.value === "[") {
|
10870 | value = "^";
|
10871 | }
|
10872 | prev.value += value;
|
10873 | append({
|
10874 | value
|
10875 | });
|
10876 | continue;
|
10877 | }
|
10878 | if (state.quotes === 1 && value !== '"') {
|
10879 | value = utils.escapeRegex(value);
|
10880 | prev.value += value;
|
10881 | append({
|
10882 | value
|
10883 | });
|
10884 | continue;
|
10885 | }
|
10886 | if (value === '"') {
|
10887 | state.quotes = state.quotes === 1 ? 0 : 1;
|
10888 | if (opts.keepQuotes === true) {
|
10889 | push({
|
10890 | type: "text",
|
10891 | value
|
10892 | });
|
10893 | }
|
10894 | continue;
|
10895 | }
|
10896 | if (value === "(") {
|
10897 | increment("parens");
|
10898 | push({
|
10899 | type: "paren",
|
10900 | value
|
10901 | });
|
10902 | continue;
|
10903 | }
|
10904 | if (value === ")") {
|
10905 | if (state.parens === 0 && opts.strictBrackets === true) {
|
10906 | throw new SyntaxError(syntaxError("opening", "("));
|
10907 | }
|
10908 | const extglob = extglobs[extglobs.length - 1];
|
10909 | if (extglob && state.parens === extglob.parens + 1) {
|
10910 | extglobClose(extglobs.pop());
|
10911 | continue;
|
10912 | }
|
10913 | push({
|
10914 | type: "paren",
|
10915 | value,
|
10916 | output: state.parens ? ")" : "\\)"
|
10917 | });
|
10918 | decrement("parens");
|
10919 | continue;
|
10920 | }
|
10921 | if (value === "[") {
|
10922 | if (opts.nobracket === true || !remaining().includes("]")) {
|
10923 | if (opts.nobracket !== true && opts.strictBrackets === true) {
|
10924 | throw new SyntaxError(syntaxError("closing", "]"));
|
10925 | }
|
10926 | value = `\\${value}`;
|
10927 | } else {
|
10928 | increment("brackets");
|
10929 | }
|
10930 | push({
|
10931 | type: "bracket",
|
10932 | value
|
10933 | });
|
10934 | continue;
|
10935 | }
|
10936 | if (value === "]") {
|
10937 | if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
10938 | push({
|
10939 | type: "text",
|
10940 | value,
|
10941 | output: `\\${value}`
|
10942 | });
|
10943 | continue;
|
10944 | }
|
10945 | if (state.brackets === 0) {
|
10946 | if (opts.strictBrackets === true) {
|
10947 | throw new SyntaxError(syntaxError("opening", "["));
|
10948 | }
|
10949 | push({
|
10950 | type: "text",
|
10951 | value,
|
10952 | output: `\\${value}`
|
10953 | });
|
10954 | continue;
|
10955 | }
|
10956 | decrement("brackets");
|
10957 | const prevValue = prev.value.slice(1);
|
10958 | if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
10959 | value = `/${value}`;
|
10960 | }
|
10961 | prev.value += value;
|
10962 | append({
|
10963 | value
|
10964 | });
|
10965 | if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
10966 | continue;
|
10967 | }
|
10968 | const escaped = utils.escapeRegex(prev.value);
|
10969 | state.output = state.output.slice(0, -prev.value.length);
|
10970 | if (opts.literalBrackets === true) {
|
10971 | state.output += escaped;
|
10972 | prev.value = escaped;
|
10973 | continue;
|
10974 | }
|
10975 | prev.value = `(${capture}${escaped}|${prev.value})`;
|
10976 | state.output += prev.value;
|
10977 | continue;
|
10978 | }
|
10979 | if (value === "{" && opts.nobrace !== true) {
|
10980 | increment("braces");
|
10981 | const open = {
|
10982 | type: "brace",
|
10983 | value,
|
10984 | output: "(",
|
10985 | outputIndex: state.output.length,
|
10986 | tokensIndex: state.tokens.length
|
10987 | };
|
10988 | braces.push(open);
|
10989 | push(open);
|
10990 | continue;
|
10991 | }
|
10992 | if (value === "}") {
|
10993 | const brace = braces[braces.length - 1];
|
10994 | if (opts.nobrace === true || !brace) {
|
10995 | push({
|
10996 | type: "text",
|
10997 | value,
|
10998 | output: value
|
10999 | });
|
11000 | continue;
|
11001 | }
|
11002 | let output = ")";
|
11003 | if (brace.dots === true) {
|
11004 | const arr = tokens.slice();
|
11005 | const range = [];
|
11006 | for (let i = arr.length - 1; i >= 0; i--) {
|
11007 | tokens.pop();
|
11008 | if (arr[i].type === "brace") {
|
11009 | break;
|
11010 | }
|
11011 | if (arr[i].type !== "dots") {
|
11012 | range.unshift(arr[i].value);
|
11013 | }
|
11014 | }
|
11015 | output = expandRange(range, opts);
|
11016 | state.backtrack = true;
|
11017 | }
|
11018 | if (brace.comma !== true && brace.dots !== true) {
|
11019 | const out = state.output.slice(0, brace.outputIndex);
|
11020 | const toks = state.tokens.slice(brace.tokensIndex);
|
11021 | brace.value = brace.output = "\\{";
|
11022 | value = output = "\\}";
|
11023 | state.output = out;
|
11024 | for (const t of toks) {
|
11025 | state.output += t.output || t.value;
|
11026 | }
|
11027 | }
|
11028 | push({
|
11029 | type: "brace",
|
11030 | value,
|
11031 | output
|
11032 | });
|
11033 | decrement("braces");
|
11034 | braces.pop();
|
11035 | continue;
|
11036 | }
|
11037 | if (value === "|") {
|
11038 | if (extglobs.length > 0) {
|
11039 | extglobs[extglobs.length - 1].conditions++;
|
11040 | }
|
11041 | push({
|
11042 | type: "text",
|
11043 | value
|
11044 | });
|
11045 | continue;
|
11046 | }
|
11047 | if (value === ",") {
|
11048 | let output = value;
|
11049 | const brace = braces[braces.length - 1];
|
11050 | if (brace && stack[stack.length - 1] === "braces") {
|
11051 | brace.comma = true;
|
11052 | output = "|";
|
11053 | }
|
11054 | push({
|
11055 | type: "comma",
|
11056 | value,
|
11057 | output
|
11058 | });
|
11059 | continue;
|
11060 | }
|
11061 | if (value === "/") {
|
11062 | if (prev.type === "dot" && state.index === state.start + 1) {
|
11063 | state.start = state.index + 1;
|
11064 | state.consumed = "";
|
11065 | state.output = "";
|
11066 | tokens.pop();
|
11067 | prev = bos;
|
11068 | continue;
|
11069 | }
|
11070 | push({
|
11071 | type: "slash",
|
11072 | value,
|
11073 | output: SLASH_LITERAL
|
11074 | });
|
11075 | continue;
|
11076 | }
|
11077 | if (value === ".") {
|
11078 | if (state.braces > 0 && prev.type === "dot") {
|
11079 | if (prev.value === ".")
|
11080 | prev.output = DOT_LITERAL;
|
11081 | const brace = braces[braces.length - 1];
|
11082 | prev.type = "dots";
|
11083 | prev.output += value;
|
11084 | prev.value += value;
|
11085 | brace.dots = true;
|
11086 | continue;
|
11087 | }
|
11088 | if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
11089 | push({
|
11090 | type: "text",
|
11091 | value,
|
11092 | output: DOT_LITERAL
|
11093 | });
|
11094 | continue;
|
11095 | }
|
11096 | push({
|
11097 | type: "dot",
|
11098 | value,
|
11099 | output: DOT_LITERAL
|
11100 | });
|
11101 | continue;
|
11102 | }
|
11103 | if (value === "?") {
|
11104 | const isGroup = prev && prev.value === "(";
|
11105 | if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
11106 | extglobOpen("qmark", value);
|
11107 | continue;
|
11108 | }
|
11109 | if (prev && prev.type === "paren") {
|
11110 | const next = peek();
|
11111 | let output = value;
|
11112 | if (next === "<" && !utils.supportsLookbehinds()) {
|
11113 | throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
11114 | }
|
11115 | if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
11116 | output = `\\${value}`;
|
11117 | }
|
11118 | push({
|
11119 | type: "text",
|
11120 | value,
|
11121 | output
|
11122 | });
|
11123 | continue;
|
11124 | }
|
11125 | if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
11126 | push({
|
11127 | type: "qmark",
|
11128 | value,
|
11129 | output: QMARK_NO_DOT
|
11130 | });
|
11131 | continue;
|
11132 | }
|
11133 | push({
|
11134 | type: "qmark",
|
11135 | value,
|
11136 | output: QMARK
|
11137 | });
|
11138 | continue;
|
11139 | }
|
11140 | if (value === "!") {
|
11141 | if (opts.noextglob !== true && peek() === "(") {
|
11142 | if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
11143 | extglobOpen("negate", value);
|
11144 | continue;
|
11145 | }
|
11146 | }
|
11147 | if (opts.nonegate !== true && state.index === 0) {
|
11148 | negate();
|
11149 | continue;
|
11150 | }
|
11151 | }
|
11152 | if (value === "+") {
|
11153 | if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
11154 | extglobOpen("plus", value);
|
11155 | continue;
|
11156 | }
|
11157 | if (prev && prev.value === "(" || opts.regex === false) {
|
11158 | push({
|
11159 | type: "plus",
|
11160 | value,
|
11161 | output: PLUS_LITERAL
|
11162 | });
|
11163 | continue;
|
11164 | }
|
11165 | if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
11166 | push({
|
11167 | type: "plus",
|
11168 | value
|
11169 | });
|
11170 | continue;
|
11171 | }
|
11172 | push({
|
11173 | type: "plus",
|
11174 | value: PLUS_LITERAL
|
11175 | });
|
11176 | continue;
|
11177 | }
|
11178 | if (value === "@") {
|
11179 | if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
11180 | push({
|
11181 | type: "at",
|
11182 | extglob: true,
|
11183 | value,
|
11184 | output: ""
|
11185 | });
|
11186 | continue;
|
11187 | }
|
11188 | push({
|
11189 | type: "text",
|
11190 | value
|
11191 | });
|
11192 | continue;
|
11193 | }
|
11194 | if (value !== "*") {
|
11195 | if (value === "$" || value === "^") {
|
11196 | value = `\\${value}`;
|
11197 | }
|
11198 | const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
11199 | if (match) {
|
11200 | value += match[0];
|
11201 | state.index += match[0].length;
|
11202 | }
|
11203 | push({
|
11204 | type: "text",
|
11205 | value
|
11206 | });
|
11207 | continue;
|
11208 | }
|
11209 | if (prev && (prev.type === "globstar" || prev.star === true)) {
|
11210 | prev.type = "star";
|
11211 | prev.star = true;
|
11212 | prev.value += value;
|
11213 | prev.output = star;
|
11214 | state.backtrack = true;
|
11215 | state.globstar = true;
|
11216 | consume(value);
|
11217 | continue;
|
11218 | }
|
11219 | let rest = remaining();
|
11220 | if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
11221 | extglobOpen("star", value);
|
11222 | continue;
|
11223 | }
|
11224 | if (prev.type === "star") {
|
11225 | if (opts.noglobstar === true) {
|
11226 | consume(value);
|
11227 | continue;
|
11228 | }
|
11229 | const prior = prev.prev;
|
11230 | const before = prior.prev;
|
11231 | const isStart = prior.type === "slash" || prior.type === "bos";
|
11232 | const afterStar = before && (before.type === "star" || before.type === "globstar");
|
11233 | if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
11234 | push({
|
11235 | type: "star",
|
11236 | value,
|
11237 | output: ""
|
11238 | });
|
11239 | continue;
|
11240 | }
|
11241 | const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
11242 | const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
11243 | if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
11244 | push({
|
11245 | type: "star",
|
11246 | value,
|
11247 | output: ""
|
11248 | });
|
11249 | continue;
|
11250 | }
|
11251 | while (rest.slice(0, 3) === "/**") {
|
11252 | const after = input[state.index + 4];
|
11253 | if (after && after !== "/") {
|
11254 | break;
|
11255 | }
|
11256 | rest = rest.slice(3);
|
11257 | consume("/**", 3);
|
11258 | }
|
11259 | if (prior.type === "bos" && eos()) {
|
11260 | prev.type = "globstar";
|
11261 | prev.value += value;
|
11262 | prev.output = globstar(opts);
|
11263 | state.output = prev.output;
|
11264 | state.globstar = true;
|
11265 | consume(value);
|
11266 | continue;
|
11267 | }
|
11268 | if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
11269 | state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
11270 | prior.output = `(?:${prior.output}`;
|
11271 | prev.type = "globstar";
|
11272 | prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
11273 | prev.value += value;
|
11274 | state.globstar = true;
|
11275 | state.output += prior.output + prev.output;
|
11276 | consume(value);
|
11277 | continue;
|
11278 | }
|
11279 | if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
11280 | const end = rest[1] !== void 0 ? "|$" : "";
|
11281 | state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
11282 | prior.output = `(?:${prior.output}`;
|
11283 | prev.type = "globstar";
|
11284 | prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
11285 | prev.value += value;
|
11286 | state.output += prior.output + prev.output;
|
11287 | state.globstar = true;
|
11288 | consume(value + advance());
|
11289 | push({
|
11290 | type: "slash",
|
11291 | value: "/",
|
11292 | output: ""
|
11293 | });
|
11294 | continue;
|
11295 | }
|
11296 | if (prior.type === "bos" && rest[0] === "/") {
|
11297 | prev.type = "globstar";
|
11298 | prev.value += value;
|
11299 | prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
11300 | state.output = prev.output;
|
11301 | state.globstar = true;
|
11302 | consume(value + advance());
|
11303 | push({
|
11304 | type: "slash",
|
11305 | value: "/",
|
11306 | output: ""
|
11307 | });
|
11308 | continue;
|
11309 | }
|
11310 | state.output = state.output.slice(0, -prev.output.length);
|
11311 | prev.type = "globstar";
|
11312 | prev.output = globstar(opts);
|
11313 | prev.value += value;
|
11314 | state.output += prev.output;
|
11315 | state.globstar = true;
|
11316 | consume(value);
|
11317 | continue;
|
11318 | }
|
11319 | const token = {
|
11320 | type: "star",
|
11321 | value,
|
11322 | output: star
|
11323 | };
|
11324 | if (opts.bash === true) {
|
11325 | token.output = ".*?";
|
11326 | if (prev.type === "bos" || prev.type === "slash") {
|
11327 | token.output = nodot + token.output;
|
11328 | }
|
11329 | push(token);
|
11330 | continue;
|
11331 | }
|
11332 | if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
11333 | token.output = value;
|
11334 | push(token);
|
11335 | continue;
|
11336 | }
|
11337 | if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
11338 | if (prev.type === "dot") {
|
11339 | state.output += NO_DOT_SLASH;
|
11340 | prev.output += NO_DOT_SLASH;
|
11341 | } else if (opts.dot === true) {
|
11342 | state.output += NO_DOTS_SLASH;
|
11343 | prev.output += NO_DOTS_SLASH;
|
11344 | } else {
|
11345 | state.output += nodot;
|
11346 | prev.output += nodot;
|
11347 | }
|
11348 | if (peek() !== "*") {
|
11349 | state.output += ONE_CHAR;
|
11350 | prev.output += ONE_CHAR;
|
11351 | }
|
11352 | }
|
11353 | push(token);
|
11354 | }
|
11355 | while (state.brackets > 0) {
|
11356 | if (opts.strictBrackets === true)
|
11357 | throw new SyntaxError(syntaxError("closing", "]"));
|
11358 | state.output = utils.escapeLast(state.output, "[");
|
11359 | decrement("brackets");
|
11360 | }
|
11361 | while (state.parens > 0) {
|
11362 | if (opts.strictBrackets === true)
|
11363 | throw new SyntaxError(syntaxError("closing", ")"));
|
11364 | state.output = utils.escapeLast(state.output, "(");
|
11365 | decrement("parens");
|
11366 | }
|
11367 | while (state.braces > 0) {
|
11368 | if (opts.strictBrackets === true)
|
11369 | throw new SyntaxError(syntaxError("closing", "}"));
|
11370 | state.output = utils.escapeLast(state.output, "{");
|
11371 | decrement("braces");
|
11372 | }
|
11373 | if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
11374 | push({
|
11375 | type: "maybe_slash",
|
11376 | value: "",
|
11377 | output: `${SLASH_LITERAL}?`
|
11378 | });
|
11379 | }
|
11380 | if (state.backtrack === true) {
|
11381 | state.output = "";
|
11382 | for (const token of state.tokens) {
|
11383 | state.output += token.output != null ? token.output : token.value;
|
11384 | if (token.suffix) {
|
11385 | state.output += token.suffix;
|
11386 | }
|
11387 | }
|
11388 | }
|
11389 | return state;
|
11390 | };
|
11391 | parse.fastpaths = (input, options) => {
|
11392 | const opts = Object.assign({}, options);
|
11393 | const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
11394 | const len = input.length;
|
11395 | if (len > max) {
|
11396 | throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
11397 | }
|
11398 | input = REPLACEMENTS[input] || input;
|
11399 | const win32 = utils.isWindows(options);
|
11400 | const {
|
11401 | DOT_LITERAL,
|
11402 | SLASH_LITERAL,
|
11403 | ONE_CHAR,
|
11404 | DOTS_SLASH,
|
11405 | NO_DOT,
|
11406 | NO_DOTS,
|
11407 | NO_DOTS_SLASH,
|
11408 | STAR,
|
11409 | START_ANCHOR
|
11410 | } = constants.globChars(win32);
|
11411 | const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
11412 | const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
11413 | const capture = opts.capture ? "" : "?:";
|
11414 | const state = {
|
11415 | negated: false,
|
11416 | prefix: ""
|
11417 | };
|
11418 | let star = opts.bash === true ? ".*?" : STAR;
|
11419 | if (opts.capture) {
|
11420 | star = `(${star})`;
|
11421 | }
|
11422 | const globstar = (opts2) => {
|
11423 | if (opts2.noglobstar === true)
|
11424 | return star;
|
11425 | return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
11426 | };
|
11427 | const create = (str) => {
|
11428 | switch (str) {
|
11429 | case "*":
|
11430 | return `${nodot}${ONE_CHAR}${star}`;
|
11431 | case ".*":
|
11432 | return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
11433 | case "*.*":
|
11434 | return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
11435 | case "*/*":
|
11436 | return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
11437 | case "**":
|
11438 | return nodot + globstar(opts);
|
11439 | case "**/*":
|
11440 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
11441 | case "**/*.*":
|
11442 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
11443 | case "**/.*":
|
11444 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
11445 | default: {
|
11446 | const match = /^(.*?)\.(\w+)$/.exec(str);
|
11447 | if (!match)
|
11448 | return;
|
11449 | const source2 = create(match[1]);
|
11450 | if (!source2)
|
11451 | return;
|
11452 | return source2 + DOT_LITERAL + match[2];
|
11453 | }
|
11454 | }
|
11455 | };
|
11456 | const output = utils.removePrefix(input, state);
|
11457 | let source = create(output);
|
11458 | if (source && opts.strictSlashes !== true) {
|
11459 | source += `${SLASH_LITERAL}?`;
|
11460 | }
|
11461 | return source;
|
11462 | };
|
11463 | module2.exports = parse;
|
11464 | }
|
11465 | });
|
11466 | var require_picomatch = __commonJS2({
|
11467 | "node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
11468 | "use strict";
|
11469 | var path = require("path");
|
11470 | var scan = require_scan();
|
11471 | var parse = require_parse2();
|
11472 | var utils = require_utils3();
|
11473 | var constants = require_constants3();
|
11474 | var isObject = (val) => val && typeof val === "object" && !Array.isArray(val);
|
11475 | var picomatch = (glob, options, returnState = false) => {
|
11476 | if (Array.isArray(glob)) {
|
11477 | const fns = glob.map((input) => picomatch(input, options, returnState));
|
11478 | const arrayMatcher = (str) => {
|
11479 | for (const isMatch of fns) {
|
11480 | const state2 = isMatch(str);
|
11481 | if (state2)
|
11482 | return state2;
|
11483 | }
|
11484 | return false;
|
11485 | };
|
11486 | return arrayMatcher;
|
11487 | }
|
11488 | const isState = isObject(glob) && glob.tokens && glob.input;
|
11489 | if (glob === "" || typeof glob !== "string" && !isState) {
|
11490 | throw new TypeError("Expected pattern to be a non-empty string");
|
11491 | }
|
11492 | const opts = options || {};
|
11493 | const posix = utils.isWindows(options);
|
11494 | const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
11495 | const state = regex.state;
|
11496 | delete regex.state;
|
11497 | let isIgnored = () => false;
|
11498 | if (opts.ignore) {
|
11499 | const ignoreOpts = Object.assign(Object.assign({}, options), {}, {
|
11500 | ignore: null,
|
11501 | onMatch: null,
|
11502 | onResult: null
|
11503 | });
|
11504 | isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
11505 | }
|
11506 | const matcher = (input, returnObject = false) => {
|
11507 | const {
|
11508 | isMatch,
|
11509 | match,
|
11510 | output
|
11511 | } = picomatch.test(input, regex, options, {
|
11512 | glob,
|
11513 | posix
|
11514 | });
|
11515 | const result = {
|
11516 | glob,
|
11517 | state,
|
11518 | regex,
|
11519 | posix,
|
11520 | input,
|
11521 | output,
|
11522 | match,
|
11523 | isMatch
|
11524 | };
|
11525 | if (typeof opts.onResult === "function") {
|
11526 | opts.onResult(result);
|
11527 | }
|
11528 | if (isMatch === false) {
|
11529 | result.isMatch = false;
|
11530 | return returnObject ? result : false;
|
11531 | }
|
11532 | if (isIgnored(input)) {
|
11533 | if (typeof opts.onIgnore === "function") {
|
11534 | opts.onIgnore(result);
|
11535 | }
|
11536 | result.isMatch = false;
|
11537 | return returnObject ? result : false;
|
11538 | }
|
11539 | if (typeof opts.onMatch === "function") {
|
11540 | opts.onMatch(result);
|
11541 | }
|
11542 | return returnObject ? result : true;
|
11543 | };
|
11544 | if (returnState) {
|
11545 | matcher.state = state;
|
11546 | }
|
11547 | return matcher;
|
11548 | };
|
11549 | picomatch.test = (input, regex, options, {
|
11550 | glob,
|
11551 | posix
|
11552 | } = {}) => {
|
11553 | if (typeof input !== "string") {
|
11554 | throw new TypeError("Expected input to be a string");
|
11555 | }
|
11556 | if (input === "") {
|
11557 | return {
|
11558 | isMatch: false,
|
11559 | output: ""
|
11560 | };
|
11561 | }
|
11562 | const opts = options || {};
|
11563 | const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
11564 | let match = input === glob;
|
11565 | let output = match && format ? format(input) : input;
|
11566 | if (match === false) {
|
11567 | output = format ? format(input) : input;
|
11568 | match = output === glob;
|
11569 | }
|
11570 | if (match === false || opts.capture === true) {
|
11571 | if (opts.matchBase === true || opts.basename === true) {
|
11572 | match = picomatch.matchBase(input, regex, options, posix);
|
11573 | } else {
|
11574 | match = regex.exec(output);
|
11575 | }
|
11576 | }
|
11577 | return {
|
11578 | isMatch: Boolean(match),
|
11579 | match,
|
11580 | output
|
11581 | };
|
11582 | };
|
11583 | picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
11584 | const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
11585 | return regex.test(path.basename(input));
|
11586 | };
|
11587 | picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
11588 | picomatch.parse = (pattern, options) => {
|
11589 | if (Array.isArray(pattern))
|
11590 | return pattern.map((p) => picomatch.parse(p, options));
|
11591 | return parse(pattern, Object.assign(Object.assign({}, options), {}, {
|
11592 | fastpaths: false
|
11593 | }));
|
11594 | };
|
11595 | picomatch.scan = (input, options) => scan(input, options);
|
11596 | picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
11597 | if (returnOutput === true) {
|
11598 | return state.output;
|
11599 | }
|
11600 | const opts = options || {};
|
11601 | const prepend = opts.contains ? "" : "^";
|
11602 | const append = opts.contains ? "" : "$";
|
11603 | let source = `${prepend}(?:${state.output})${append}`;
|
11604 | if (state && state.negated === true) {
|
11605 | source = `^(?!${source}).*$`;
|
11606 | }
|
11607 | const regex = picomatch.toRegex(source, options);
|
11608 | if (returnState === true) {
|
11609 | regex.state = state;
|
11610 | }
|
11611 | return regex;
|
11612 | };
|
11613 | picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
11614 | if (!input || typeof input !== "string") {
|
11615 | throw new TypeError("Expected a non-empty string");
|
11616 | }
|
11617 | let parsed = {
|
11618 | negated: false,
|
11619 | fastpaths: true
|
11620 | };
|
11621 | if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
11622 | parsed.output = parse.fastpaths(input, options);
|
11623 | }
|
11624 | if (!parsed.output) {
|
11625 | parsed = parse(input, options);
|
11626 | }
|
11627 | return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
11628 | };
|
11629 | picomatch.toRegex = (source, options) => {
|
11630 | try {
|
11631 | const opts = options || {};
|
11632 | return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
11633 | } catch (err) {
|
11634 | if (options && options.debug === true)
|
11635 | throw err;
|
11636 | return /$^/;
|
11637 | }
|
11638 | };
|
11639 | picomatch.constants = constants;
|
11640 | module2.exports = picomatch;
|
11641 | }
|
11642 | });
|
11643 | var require_picomatch2 = __commonJS2({
|
11644 | "node_modules/picomatch/index.js"(exports2, module2) {
|
11645 | "use strict";
|
11646 | module2.exports = require_picomatch();
|
11647 | }
|
11648 | });
|
11649 | var require_micromatch = __commonJS2({
|
11650 | "node_modules/micromatch/index.js"(exports2, module2) {
|
11651 | "use strict";
|
11652 | var util = require("util");
|
11653 | var braces = require_braces();
|
11654 | var picomatch = require_picomatch2();
|
11655 | var utils = require_utils3();
|
11656 | var isEmptyString = (val) => val === "" || val === "./";
|
11657 | var micromatch = (list, patterns, options) => {
|
11658 | patterns = [].concat(patterns);
|
11659 | list = [].concat(list);
|
11660 | let omit = new Set();
|
11661 | let keep = new Set();
|
11662 | let items = new Set();
|
11663 | let negatives = 0;
|
11664 | let onResult = (state) => {
|
11665 | items.add(state.output);
|
11666 | if (options && options.onResult) {
|
11667 | options.onResult(state);
|
11668 | }
|
11669 | };
|
11670 | for (let i = 0; i < patterns.length; i++) {
|
11671 | let isMatch = picomatch(String(patterns[i]), Object.assign(Object.assign({}, options), {}, {
|
11672 | onResult
|
11673 | }), true);
|
11674 | let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
11675 | if (negated)
|
11676 | negatives++;
|
11677 | for (let item of list) {
|
11678 | let matched = isMatch(item, true);
|
11679 | let match = negated ? !matched.isMatch : matched.isMatch;
|
11680 | if (!match)
|
11681 | continue;
|
11682 | if (negated) {
|
11683 | omit.add(matched.output);
|
11684 | } else {
|
11685 | omit.delete(matched.output);
|
11686 | keep.add(matched.output);
|
11687 | }
|
11688 | }
|
11689 | }
|
11690 | let result = negatives === patterns.length ? [...items] : [...keep];
|
11691 | let matches = result.filter((item) => !omit.has(item));
|
11692 | if (options && matches.length === 0) {
|
11693 | if (options.failglob === true) {
|
11694 | throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
11695 | }
|
11696 | if (options.nonull === true || options.nullglob === true) {
|
11697 | return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
11698 | }
|
11699 | }
|
11700 | return matches;
|
11701 | };
|
11702 | micromatch.match = micromatch;
|
11703 | micromatch.matcher = (pattern, options) => picomatch(pattern, options);
|
11704 | micromatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
11705 | micromatch.any = micromatch.isMatch;
|
11706 | micromatch.not = (list, patterns, options = {}) => {
|
11707 | patterns = [].concat(patterns).map(String);
|
11708 | let result = new Set();
|
11709 | let items = [];
|
11710 | let onResult = (state) => {
|
11711 | if (options.onResult)
|
11712 | options.onResult(state);
|
11713 | items.push(state.output);
|
11714 | };
|
11715 | let matches = new Set(micromatch(list, patterns, Object.assign(Object.assign({}, options), {}, {
|
11716 | onResult
|
11717 | })));
|
11718 | for (let item of items) {
|
11719 | if (!matches.has(item)) {
|
11720 | result.add(item);
|
11721 | }
|
11722 | }
|
11723 | return [...result];
|
11724 | };
|
11725 | micromatch.contains = (str, pattern, options) => {
|
11726 | if (typeof str !== "string") {
|
11727 | throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
11728 | }
|
11729 | if (Array.isArray(pattern)) {
|
11730 | return pattern.some((p) => micromatch.contains(str, p, options));
|
11731 | }
|
11732 | if (typeof pattern === "string") {
|
11733 | if (isEmptyString(str) || isEmptyString(pattern)) {
|
11734 | return false;
|
11735 | }
|
11736 | if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
|
11737 | return true;
|
11738 | }
|
11739 | }
|
11740 | return micromatch.isMatch(str, pattern, Object.assign(Object.assign({}, options), {}, {
|
11741 | contains: true
|
11742 | }));
|
11743 | };
|
11744 | micromatch.matchKeys = (obj, patterns, options) => {
|
11745 | if (!utils.isObject(obj)) {
|
11746 | throw new TypeError("Expected the first argument to be an object");
|
11747 | }
|
11748 | let keys = micromatch(Object.keys(obj), patterns, options);
|
11749 | let res = {};
|
11750 | for (let key of keys)
|
11751 | res[key] = obj[key];
|
11752 | return res;
|
11753 | };
|
11754 | micromatch.some = (list, patterns, options) => {
|
11755 | let items = [].concat(list);
|
11756 | for (let pattern of [].concat(patterns)) {
|
11757 | let isMatch = picomatch(String(pattern), options);
|
11758 | if (items.some((item) => isMatch(item))) {
|
11759 | return true;
|
11760 | }
|
11761 | }
|
11762 | return false;
|
11763 | };
|
11764 | micromatch.every = (list, patterns, options) => {
|
11765 | let items = [].concat(list);
|
11766 | for (let pattern of [].concat(patterns)) {
|
11767 | let isMatch = picomatch(String(pattern), options);
|
11768 | if (!items.every((item) => isMatch(item))) {
|
11769 | return false;
|
11770 | }
|
11771 | }
|
11772 | return true;
|
11773 | };
|
11774 | micromatch.all = (str, patterns, options) => {
|
11775 | if (typeof str !== "string") {
|
11776 | throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
|
11777 | }
|
11778 | return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
11779 | };
|
11780 | micromatch.capture = (glob, input, options) => {
|
11781 | let posix = utils.isWindows(options);
|
11782 | let regex = picomatch.makeRe(String(glob), Object.assign(Object.assign({}, options), {}, {
|
11783 | capture: true
|
11784 | }));
|
11785 | let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
11786 | if (match) {
|
11787 | return match.slice(1).map((v) => v === void 0 ? "" : v);
|
11788 | }
|
11789 | };
|
11790 | micromatch.makeRe = (...args) => picomatch.makeRe(...args);
|
11791 | micromatch.scan = (...args) => picomatch.scan(...args);
|
11792 | micromatch.parse = (patterns, options) => {
|
11793 | let res = [];
|
11794 | for (let pattern of [].concat(patterns || [])) {
|
11795 | for (let str of braces(String(pattern), options)) {
|
11796 | res.push(picomatch.parse(str, options));
|
11797 | }
|
11798 | }
|
11799 | return res;
|
11800 | };
|
11801 | micromatch.braces = (pattern, options) => {
|
11802 | if (typeof pattern !== "string")
|
11803 | throw new TypeError("Expected a string");
|
11804 | if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
|
11805 | return [pattern];
|
11806 | }
|
11807 | return braces(pattern, options);
|
11808 | };
|
11809 | micromatch.braceExpand = (pattern, options) => {
|
11810 | if (typeof pattern !== "string")
|
11811 | throw new TypeError("Expected a string");
|
11812 | return micromatch.braces(pattern, Object.assign(Object.assign({}, options), {}, {
|
11813 | expand: true
|
11814 | }));
|
11815 | };
|
11816 | module2.exports = micromatch;
|
11817 | }
|
11818 | });
|
11819 | var require_parser2 = __commonJS2({
|
11820 | "node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
|
11821 | "use strict";
|
11822 | var ParserEND = 1114112;
|
11823 | var ParserError = class extends Error {
|
11824 | constructor(msg, filename, linenumber) {
|
11825 | super("[ParserError] " + msg, filename, linenumber);
|
11826 | this.name = "ParserError";
|
11827 | this.code = "ParserError";
|
11828 | if (Error.captureStackTrace)
|
11829 | Error.captureStackTrace(this, ParserError);
|
11830 | }
|
11831 | };
|
11832 | var State = class {
|
11833 | constructor(parser) {
|
11834 | this.parser = parser;
|
11835 | this.buf = "";
|
11836 | this.returned = null;
|
11837 | this.result = null;
|
11838 | this.resultTable = null;
|
11839 | this.resultArr = null;
|
11840 | }
|
11841 | };
|
11842 | var Parser = class {
|
11843 | constructor() {
|
11844 | this.pos = 0;
|
11845 | this.col = 0;
|
11846 | this.line = 0;
|
11847 | this.obj = {};
|
11848 | this.ctx = this.obj;
|
11849 | this.stack = [];
|
11850 | this._buf = "";
|
11851 | this.char = null;
|
11852 | this.ii = 0;
|
11853 | this.state = new State(this.parseStart);
|
11854 | }
|
11855 | parse(str) {
|
11856 | if (str.length === 0 || str.length == null)
|
11857 | return;
|
11858 | this._buf = String(str);
|
11859 | this.ii = -1;
|
11860 | this.char = -1;
|
11861 | let getNext;
|
11862 | while (getNext === false || this.nextChar()) {
|
11863 | getNext = this.runOne();
|
11864 | }
|
11865 | this._buf = null;
|
11866 | }
|
11867 | nextChar() {
|
11868 | if (this.char === 10) {
|
11869 | ++this.line;
|
11870 | this.col = -1;
|
11871 | }
|
11872 | ++this.ii;
|
11873 | this.char = this._buf.codePointAt(this.ii);
|
11874 | ++this.pos;
|
11875 | ++this.col;
|
11876 | return this.haveBuffer();
|
11877 | }
|
11878 | haveBuffer() {
|
11879 | return this.ii < this._buf.length;
|
11880 | }
|
11881 | runOne() {
|
11882 | return this.state.parser.call(this, this.state.returned);
|
11883 | }
|
11884 | finish() {
|
11885 | this.char = ParserEND;
|
11886 | let last;
|
11887 | do {
|
11888 | last = this.state.parser;
|
11889 | this.runOne();
|
11890 | } while (this.state.parser !== last);
|
11891 | this.ctx = null;
|
11892 | this.state = null;
|
11893 | this._buf = null;
|
11894 | return this.obj;
|
11895 | }
|
11896 | next(fn) {
|
11897 | if (typeof fn !== "function")
|
11898 | throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
|
11899 | this.state.parser = fn;
|
11900 | }
|
11901 | goto(fn) {
|
11902 | this.next(fn);
|
11903 | return this.runOne();
|
11904 | }
|
11905 | call(fn, returnWith) {
|
11906 | if (returnWith)
|
11907 | this.next(returnWith);
|
11908 | this.stack.push(this.state);
|
11909 | this.state = new State(fn);
|
11910 | }
|
11911 | callNow(fn, returnWith) {
|
11912 | this.call(fn, returnWith);
|
11913 | return this.runOne();
|
11914 | }
|
11915 | return(value) {
|
11916 | if (this.stack.length === 0)
|
11917 | throw this.error(new ParserError("Stack underflow"));
|
11918 | if (value === void 0)
|
11919 | value = this.state.buf;
|
11920 | this.state = this.stack.pop();
|
11921 | this.state.returned = value;
|
11922 | }
|
11923 | returnNow(value) {
|
11924 | this.return(value);
|
11925 | return this.runOne();
|
11926 | }
|
11927 | consume() {
|
11928 | if (this.char === ParserEND)
|
11929 | throw this.error(new ParserError("Unexpected end-of-buffer"));
|
11930 | this.state.buf += this._buf[this.ii];
|
11931 | }
|
11932 | error(err) {
|
11933 | err.line = this.line;
|
11934 | err.col = this.col;
|
11935 | err.pos = this.pos;
|
11936 | return err;
|
11937 | }
|
11938 | parseStart() {
|
11939 | throw new ParserError("Must declare a parseStart method");
|
11940 | }
|
11941 | };
|
11942 | Parser.END = ParserEND;
|
11943 | Parser.Error = ParserError;
|
11944 | module2.exports = Parser;
|
11945 | }
|
11946 | });
|
11947 | var require_create_datetime = __commonJS2({
|
11948 | "node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
|
11949 | "use strict";
|
11950 | module2.exports = (value) => {
|
11951 | const date = new Date(value);
|
11952 | if (isNaN(date)) {
|
11953 | throw new TypeError("Invalid Datetime");
|
11954 | } else {
|
11955 | return date;
|
11956 | }
|
11957 | };
|
11958 | }
|
11959 | });
|
11960 | var require_format_num = __commonJS2({
|
11961 | "node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
|
11962 | "use strict";
|
11963 | module2.exports = (d, num) => {
|
11964 | num = String(num);
|
11965 | while (num.length < d)
|
11966 | num = "0" + num;
|
11967 | return num;
|
11968 | };
|
11969 | }
|
11970 | });
|
11971 | var require_create_datetime_float = __commonJS2({
|
11972 | "node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
|
11973 | "use strict";
|
11974 | var f = require_format_num();
|
11975 | var FloatingDateTime = class extends Date {
|
11976 | constructor(value) {
|
11977 | super(value + "Z");
|
11978 | this.isFloating = true;
|
11979 | }
|
11980 | toISOString() {
|
11981 | const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
11982 | const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
11983 | return `${date}T${time}`;
|
11984 | }
|
11985 | };
|
11986 | module2.exports = (value) => {
|
11987 | const date = new FloatingDateTime(value);
|
11988 | if (isNaN(date)) {
|
11989 | throw new TypeError("Invalid Datetime");
|
11990 | } else {
|
11991 | return date;
|
11992 | }
|
11993 | };
|
11994 | }
|
11995 | });
|
11996 | var require_create_date = __commonJS2({
|
11997 | "node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
|
11998 | "use strict";
|
11999 | var f = require_format_num();
|
12000 | var DateTime = global.Date;
|
12001 | var Date2 = class extends DateTime {
|
12002 | constructor(value) {
|
12003 | super(value);
|
12004 | this.isDate = true;
|
12005 | }
|
12006 | toISOString() {
|
12007 | return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
12008 | }
|
12009 | };
|
12010 | module2.exports = (value) => {
|
12011 | const date = new Date2(value);
|
12012 | if (isNaN(date)) {
|
12013 | throw new TypeError("Invalid Datetime");
|
12014 | } else {
|
12015 | return date;
|
12016 | }
|
12017 | };
|
12018 | }
|
12019 | });
|
12020 | var require_create_time = __commonJS2({
|
12021 | "node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
|
12022 | "use strict";
|
12023 | var f = require_format_num();
|
12024 | var Time = class extends Date {
|
12025 | constructor(value) {
|
12026 | super(`0000-01-01T${value}Z`);
|
12027 | this.isTime = true;
|
12028 | }
|
12029 | toISOString() {
|
12030 | return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
12031 | }
|
12032 | };
|
12033 | module2.exports = (value) => {
|
12034 | const date = new Time(value);
|
12035 | if (isNaN(date)) {
|
12036 | throw new TypeError("Invalid Datetime");
|
12037 | } else {
|
12038 | return date;
|
12039 | }
|
12040 | };
|
12041 | }
|
12042 | });
|
12043 | var require_toml_parser = __commonJS2({
|
12044 | "node_modules/@iarna/toml/lib/toml-parser.js"(exports2, module2) {
|
12045 | "use strict";
|
12046 | module2.exports = makeParserClass(require_parser2());
|
12047 | module2.exports.makeParserClass = makeParserClass;
|
12048 | var TomlError = class extends Error {
|
12049 | constructor(msg) {
|
12050 | super(msg);
|
12051 | this.name = "TomlError";
|
12052 | if (Error.captureStackTrace)
|
12053 | Error.captureStackTrace(this, TomlError);
|
12054 | this.fromTOML = true;
|
12055 | this.wrapped = null;
|
12056 | }
|
12057 | };
|
12058 | TomlError.wrap = (err) => {
|
12059 | const terr = new TomlError(err.message);
|
12060 | terr.code = err.code;
|
12061 | terr.wrapped = err;
|
12062 | return terr;
|
12063 | };
|
12064 | module2.exports.TomlError = TomlError;
|
12065 | var createDateTime = require_create_datetime();
|
12066 | var createDateTimeFloat = require_create_datetime_float();
|
12067 | var createDate = require_create_date();
|
12068 | var createTime = require_create_time();
|
12069 | var CTRL_I = 9;
|
12070 | var CTRL_J = 10;
|
12071 | var CTRL_M = 13;
|
12072 | var CTRL_CHAR_BOUNDARY = 31;
|
12073 | var CHAR_SP = 32;
|
12074 | var CHAR_QUOT = 34;
|
12075 | var CHAR_NUM = 35;
|
12076 | var CHAR_APOS = 39;
|
12077 | var CHAR_PLUS = 43;
|
12078 | var CHAR_COMMA = 44;
|
12079 | var CHAR_HYPHEN = 45;
|
12080 | var CHAR_PERIOD = 46;
|
12081 | var CHAR_0 = 48;
|
12082 | var CHAR_1 = 49;
|
12083 | var CHAR_7 = 55;
|
12084 | var CHAR_9 = 57;
|
12085 | var CHAR_COLON = 58;
|
12086 | var CHAR_EQUALS = 61;
|
12087 | var CHAR_A = 65;
|
12088 | var CHAR_E = 69;
|
12089 | var CHAR_F = 70;
|
12090 | var CHAR_T = 84;
|
12091 | var CHAR_U = 85;
|
12092 | var CHAR_Z = 90;
|
12093 | var CHAR_LOWBAR = 95;
|
12094 | var CHAR_a = 97;
|
12095 | var CHAR_b = 98;
|
12096 | var CHAR_e = 101;
|
12097 | var CHAR_f = 102;
|
12098 | var CHAR_i = 105;
|
12099 | var CHAR_l = 108;
|
12100 | var CHAR_n = 110;
|
12101 | var CHAR_o = 111;
|
12102 | var CHAR_r = 114;
|
12103 | var CHAR_s = 115;
|
12104 | var CHAR_t = 116;
|
12105 | var CHAR_u = 117;
|
12106 | var CHAR_x = 120;
|
12107 | var CHAR_z = 122;
|
12108 | var CHAR_LCUB = 123;
|
12109 | var CHAR_RCUB = 125;
|
12110 | var CHAR_LSQB = 91;
|
12111 | var CHAR_BSOL = 92;
|
12112 | var CHAR_RSQB = 93;
|
12113 | var CHAR_DEL = 127;
|
12114 | var SURROGATE_FIRST = 55296;
|
12115 | var SURROGATE_LAST = 57343;
|
12116 | var escapes = {
|
12117 | [CHAR_b]: "\b",
|
12118 | [CHAR_t]: " ",
|
12119 | [CHAR_n]: "\n",
|
12120 | [CHAR_f]: "\f",
|
12121 | [CHAR_r]: "\r",
|
12122 | [CHAR_QUOT]: '"',
|
12123 | [CHAR_BSOL]: "\\"
|
12124 | };
|
12125 | function isDigit(cp) {
|
12126 | return cp >= CHAR_0 && cp <= CHAR_9;
|
12127 | }
|
12128 | function isHexit(cp) {
|
12129 | return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
12130 | }
|
12131 | function isBit(cp) {
|
12132 | return cp === CHAR_1 || cp === CHAR_0;
|
12133 | }
|
12134 | function isOctit(cp) {
|
12135 | return cp >= CHAR_0 && cp <= CHAR_7;
|
12136 | }
|
12137 | function isAlphaNumQuoteHyphen(cp) {
|
12138 | return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
12139 | }
|
12140 | function isAlphaNumHyphen(cp) {
|
12141 | return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
12142 | }
|
12143 | var _type = Symbol("type");
|
12144 | var _declared = Symbol("declared");
|
12145 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
12146 | var defineProperty = Object.defineProperty;
|
12147 | var descriptor = {
|
12148 | configurable: true,
|
12149 | enumerable: true,
|
12150 | writable: true,
|
12151 | value: void 0
|
12152 | };
|
12153 | function hasKey(obj, key) {
|
12154 | if (hasOwnProperty.call(obj, key))
|
12155 | return true;
|
12156 | if (key === "__proto__")
|
12157 | defineProperty(obj, "__proto__", descriptor);
|
12158 | return false;
|
12159 | }
|
12160 | var INLINE_TABLE = Symbol("inline-table");
|
12161 | function InlineTable() {
|
12162 | return Object.defineProperties({}, {
|
12163 | [_type]: {
|
12164 | value: INLINE_TABLE
|
12165 | }
|
12166 | });
|
12167 | }
|
12168 | function isInlineTable(obj) {
|
12169 | if (obj === null || typeof obj !== "object")
|
12170 | return false;
|
12171 | return obj[_type] === INLINE_TABLE;
|
12172 | }
|
12173 | var TABLE = Symbol("table");
|
12174 | function Table() {
|
12175 | return Object.defineProperties({}, {
|
12176 | [_type]: {
|
12177 | value: TABLE
|
12178 | },
|
12179 | [_declared]: {
|
12180 | value: false,
|
12181 | writable: true
|
12182 | }
|
12183 | });
|
12184 | }
|
12185 | function isTable(obj) {
|
12186 | if (obj === null || typeof obj !== "object")
|
12187 | return false;
|
12188 | return obj[_type] === TABLE;
|
12189 | }
|
12190 | var _contentType = Symbol("content-type");
|
12191 | var INLINE_LIST = Symbol("inline-list");
|
12192 | function InlineList(type) {
|
12193 | return Object.defineProperties([], {
|
12194 | [_type]: {
|
12195 | value: INLINE_LIST
|
12196 | },
|
12197 | [_contentType]: {
|
12198 | value: type
|
12199 | }
|
12200 | });
|
12201 | }
|
12202 | function isInlineList(obj) {
|
12203 | if (obj === null || typeof obj !== "object")
|
12204 | return false;
|
12205 | return obj[_type] === INLINE_LIST;
|
12206 | }
|
12207 | var LIST = Symbol("list");
|
12208 | function List() {
|
12209 | return Object.defineProperties([], {
|
12210 | [_type]: {
|
12211 | value: LIST
|
12212 | }
|
12213 | });
|
12214 | }
|
12215 | function isList(obj) {
|
12216 | if (obj === null || typeof obj !== "object")
|
12217 | return false;
|
12218 | return obj[_type] === LIST;
|
12219 | }
|
12220 | var _custom;
|
12221 | try {
|
12222 | const utilInspect = require("util").inspect;
|
12223 | _custom = utilInspect.custom;
|
12224 | } catch (_) {
|
12225 | }
|
12226 | var _inspect = _custom || "inspect";
|
12227 | var BoxedBigInt = class {
|
12228 | constructor(value) {
|
12229 | try {
|
12230 | this.value = global.BigInt.asIntN(64, value);
|
12231 | } catch (_) {
|
12232 | this.value = null;
|
12233 | }
|
12234 | Object.defineProperty(this, _type, {
|
12235 | value: INTEGER
|
12236 | });
|
12237 | }
|
12238 | isNaN() {
|
12239 | return this.value === null;
|
12240 | }
|
12241 | toString() {
|
12242 | return String(this.value);
|
12243 | }
|
12244 | [_inspect]() {
|
12245 | return `[BigInt: ${this.toString()}]}`;
|
12246 | }
|
12247 | valueOf() {
|
12248 | return this.value;
|
12249 | }
|
12250 | };
|
12251 | var INTEGER = Symbol("integer");
|
12252 | function Integer(value) {
|
12253 | let num = Number(value);
|
12254 | if (Object.is(num, -0))
|
12255 | num = 0;
|
12256 | if (global.BigInt && !Number.isSafeInteger(num)) {
|
12257 | return new BoxedBigInt(value);
|
12258 | } else {
|
12259 | return Object.defineProperties(new Number(num), {
|
12260 | isNaN: {
|
12261 | value: function() {
|
12262 | return isNaN(this);
|
12263 | }
|
12264 | },
|
12265 | [_type]: {
|
12266 | value: INTEGER
|
12267 | },
|
12268 | [_inspect]: {
|
12269 | value: () => `[Integer: ${value}]`
|
12270 | }
|
12271 | });
|
12272 | }
|
12273 | }
|
12274 | function isInteger(obj) {
|
12275 | if (obj === null || typeof obj !== "object")
|
12276 | return false;
|
12277 | return obj[_type] === INTEGER;
|
12278 | }
|
12279 | var FLOAT = Symbol("float");
|
12280 | function Float(value) {
|
12281 | return Object.defineProperties(new Number(value), {
|
12282 | [_type]: {
|
12283 | value: FLOAT
|
12284 | },
|
12285 | [_inspect]: {
|
12286 | value: () => `[Float: ${value}]`
|
12287 | }
|
12288 | });
|
12289 | }
|
12290 | function isFloat(obj) {
|
12291 | if (obj === null || typeof obj !== "object")
|
12292 | return false;
|
12293 | return obj[_type] === FLOAT;
|
12294 | }
|
12295 | function tomlType(value) {
|
12296 | const type = typeof value;
|
12297 | if (type === "object") {
|
12298 | if (value === null)
|
12299 | return "null";
|
12300 | if (value instanceof Date)
|
12301 | return "datetime";
|
12302 | if (_type in value) {
|
12303 | switch (value[_type]) {
|
12304 | case INLINE_TABLE:
|
12305 | return "inline-table";
|
12306 | case INLINE_LIST:
|
12307 | return "inline-list";
|
12308 | case TABLE:
|
12309 | return "table";
|
12310 | case LIST:
|
12311 | return "list";
|
12312 | case FLOAT:
|
12313 | return "float";
|
12314 | case INTEGER:
|
12315 | return "integer";
|
12316 | }
|
12317 | }
|
12318 | }
|
12319 | return type;
|
12320 | }
|
12321 | function makeParserClass(Parser) {
|
12322 | class TOMLParser extends Parser {
|
12323 | constructor() {
|
12324 | super();
|
12325 | this.ctx = this.obj = Table();
|
12326 | }
|
12327 | atEndOfWord() {
|
12328 | return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
12329 | }
|
12330 | atEndOfLine() {
|
12331 | return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
12332 | }
|
12333 | parseStart() {
|
12334 | if (this.char === Parser.END) {
|
12335 | return null;
|
12336 | } else if (this.char === CHAR_LSQB) {
|
12337 | return this.call(this.parseTableOrList);
|
12338 | } else if (this.char === CHAR_NUM) {
|
12339 | return this.call(this.parseComment);
|
12340 | } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
12341 | return null;
|
12342 | } else if (isAlphaNumQuoteHyphen(this.char)) {
|
12343 | return this.callNow(this.parseAssignStatement);
|
12344 | } else {
|
12345 | throw this.error(new TomlError(`Unknown character "${this.char}"`));
|
12346 | }
|
12347 | }
|
12348 | parseWhitespaceToEOL() {
|
12349 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
12350 | return null;
|
12351 | } else if (this.char === CHAR_NUM) {
|
12352 | return this.goto(this.parseComment);
|
12353 | } else if (this.char === Parser.END || this.char === CTRL_J) {
|
12354 | return this.return();
|
12355 | } else {
|
12356 | throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
12357 | }
|
12358 | }
|
12359 | parseAssignStatement() {
|
12360 | return this.callNow(this.parseAssign, this.recordAssignStatement);
|
12361 | }
|
12362 | recordAssignStatement(kv) {
|
12363 | let target = this.ctx;
|
12364 | let finalKey = kv.key.pop();
|
12365 | for (let kw of kv.key) {
|
12366 | if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
12367 | throw this.error(new TomlError("Can't redefine existing key"));
|
12368 | }
|
12369 | target = target[kw] = target[kw] || Table();
|
12370 | }
|
12371 | if (hasKey(target, finalKey)) {
|
12372 | throw this.error(new TomlError("Can't redefine existing key"));
|
12373 | }
|
12374 | if (isInteger(kv.value) || isFloat(kv.value)) {
|
12375 | target[finalKey] = kv.value.valueOf();
|
12376 | } else {
|
12377 | target[finalKey] = kv.value;
|
12378 | }
|
12379 | return this.goto(this.parseWhitespaceToEOL);
|
12380 | }
|
12381 | parseAssign() {
|
12382 | return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
12383 | }
|
12384 | recordAssignKeyword(key) {
|
12385 | if (this.state.resultTable) {
|
12386 | this.state.resultTable.push(key);
|
12387 | } else {
|
12388 | this.state.resultTable = [key];
|
12389 | }
|
12390 | return this.goto(this.parseAssignKeywordPreDot);
|
12391 | }
|
12392 | parseAssignKeywordPreDot() {
|
12393 | if (this.char === CHAR_PERIOD) {
|
12394 | return this.next(this.parseAssignKeywordPostDot);
|
12395 | } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
12396 | return this.goto(this.parseAssignEqual);
|
12397 | }
|
12398 | }
|
12399 | parseAssignKeywordPostDot() {
|
12400 | if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
12401 | return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
12402 | }
|
12403 | }
|
12404 | parseAssignEqual() {
|
12405 | if (this.char === CHAR_EQUALS) {
|
12406 | return this.next(this.parseAssignPreValue);
|
12407 | } else {
|
12408 | throw this.error(new TomlError('Invalid character, expected "="'));
|
12409 | }
|
12410 | }
|
12411 | parseAssignPreValue() {
|
12412 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12413 | return null;
|
12414 | } else {
|
12415 | return this.callNow(this.parseValue, this.recordAssignValue);
|
12416 | }
|
12417 | }
|
12418 | recordAssignValue(value) {
|
12419 | return this.returnNow({
|
12420 | key: this.state.resultTable,
|
12421 | value
|
12422 | });
|
12423 | }
|
12424 | parseComment() {
|
12425 | do {
|
12426 | if (this.char === Parser.END || this.char === CTRL_J) {
|
12427 | return this.return();
|
12428 | }
|
12429 | } while (this.nextChar());
|
12430 | }
|
12431 | parseTableOrList() {
|
12432 | if (this.char === CHAR_LSQB) {
|
12433 | this.next(this.parseList);
|
12434 | } else {
|
12435 | return this.goto(this.parseTable);
|
12436 | }
|
12437 | }
|
12438 | parseTable() {
|
12439 | this.ctx = this.obj;
|
12440 | return this.goto(this.parseTableNext);
|
12441 | }
|
12442 | parseTableNext() {
|
12443 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12444 | return null;
|
12445 | } else {
|
12446 | return this.callNow(this.parseKeyword, this.parseTableMore);
|
12447 | }
|
12448 | }
|
12449 | parseTableMore(keyword) {
|
12450 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12451 | return null;
|
12452 | } else if (this.char === CHAR_RSQB) {
|
12453 | if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
12454 | throw this.error(new TomlError("Can't redefine existing key"));
|
12455 | } else {
|
12456 | this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
12457 | this.ctx[_declared] = true;
|
12458 | }
|
12459 | return this.next(this.parseWhitespaceToEOL);
|
12460 | } else if (this.char === CHAR_PERIOD) {
|
12461 | if (!hasKey(this.ctx, keyword)) {
|
12462 | this.ctx = this.ctx[keyword] = Table();
|
12463 | } else if (isTable(this.ctx[keyword])) {
|
12464 | this.ctx = this.ctx[keyword];
|
12465 | } else if (isList(this.ctx[keyword])) {
|
12466 | this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
12467 | } else {
|
12468 | throw this.error(new TomlError("Can't redefine existing key"));
|
12469 | }
|
12470 | return this.next(this.parseTableNext);
|
12471 | } else {
|
12472 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
12473 | }
|
12474 | }
|
12475 | parseList() {
|
12476 | this.ctx = this.obj;
|
12477 | return this.goto(this.parseListNext);
|
12478 | }
|
12479 | parseListNext() {
|
12480 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12481 | return null;
|
12482 | } else {
|
12483 | return this.callNow(this.parseKeyword, this.parseListMore);
|
12484 | }
|
12485 | }
|
12486 | parseListMore(keyword) {
|
12487 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12488 | return null;
|
12489 | } else if (this.char === CHAR_RSQB) {
|
12490 | if (!hasKey(this.ctx, keyword)) {
|
12491 | this.ctx[keyword] = List();
|
12492 | }
|
12493 | if (isInlineList(this.ctx[keyword])) {
|
12494 | throw this.error(new TomlError("Can't extend an inline array"));
|
12495 | } else if (isList(this.ctx[keyword])) {
|
12496 | const next = Table();
|
12497 | this.ctx[keyword].push(next);
|
12498 | this.ctx = next;
|
12499 | } else {
|
12500 | throw this.error(new TomlError("Can't redefine an existing key"));
|
12501 | }
|
12502 | return this.next(this.parseListEnd);
|
12503 | } else if (this.char === CHAR_PERIOD) {
|
12504 | if (!hasKey(this.ctx, keyword)) {
|
12505 | this.ctx = this.ctx[keyword] = Table();
|
12506 | } else if (isInlineList(this.ctx[keyword])) {
|
12507 | throw this.error(new TomlError("Can't extend an inline array"));
|
12508 | } else if (isInlineTable(this.ctx[keyword])) {
|
12509 | throw this.error(new TomlError("Can't extend an inline table"));
|
12510 | } else if (isList(this.ctx[keyword])) {
|
12511 | this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
12512 | } else if (isTable(this.ctx[keyword])) {
|
12513 | this.ctx = this.ctx[keyword];
|
12514 | } else {
|
12515 | throw this.error(new TomlError("Can't redefine an existing key"));
|
12516 | }
|
12517 | return this.next(this.parseListNext);
|
12518 | } else {
|
12519 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
12520 | }
|
12521 | }
|
12522 | parseListEnd(keyword) {
|
12523 | if (this.char === CHAR_RSQB) {
|
12524 | return this.next(this.parseWhitespaceToEOL);
|
12525 | } else {
|
12526 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
12527 | }
|
12528 | }
|
12529 | parseValue() {
|
12530 | if (this.char === Parser.END) {
|
12531 | throw this.error(new TomlError("Key without value"));
|
12532 | } else if (this.char === CHAR_QUOT) {
|
12533 | return this.next(this.parseDoubleString);
|
12534 | }
|
12535 | if (this.char === CHAR_APOS) {
|
12536 | return this.next(this.parseSingleString);
|
12537 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
12538 | return this.goto(this.parseNumberSign);
|
12539 | } else if (this.char === CHAR_i) {
|
12540 | return this.next(this.parseInf);
|
12541 | } else if (this.char === CHAR_n) {
|
12542 | return this.next(this.parseNan);
|
12543 | } else if (isDigit(this.char)) {
|
12544 | return this.goto(this.parseNumberOrDateTime);
|
12545 | } else if (this.char === CHAR_t || this.char === CHAR_f) {
|
12546 | return this.goto(this.parseBoolean);
|
12547 | } else if (this.char === CHAR_LSQB) {
|
12548 | return this.call(this.parseInlineList, this.recordValue);
|
12549 | } else if (this.char === CHAR_LCUB) {
|
12550 | return this.call(this.parseInlineTable, this.recordValue);
|
12551 | } else {
|
12552 | throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
12553 | }
|
12554 | }
|
12555 | recordValue(value) {
|
12556 | return this.returnNow(value);
|
12557 | }
|
12558 | parseInf() {
|
12559 | if (this.char === CHAR_n) {
|
12560 | return this.next(this.parseInf2);
|
12561 | } else {
|
12562 | throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
12563 | }
|
12564 | }
|
12565 | parseInf2() {
|
12566 | if (this.char === CHAR_f) {
|
12567 | if (this.state.buf === "-") {
|
12568 | return this.return(-Infinity);
|
12569 | } else {
|
12570 | return this.return(Infinity);
|
12571 | }
|
12572 | } else {
|
12573 | throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
12574 | }
|
12575 | }
|
12576 | parseNan() {
|
12577 | if (this.char === CHAR_a) {
|
12578 | return this.next(this.parseNan2);
|
12579 | } else {
|
12580 | throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
12581 | }
|
12582 | }
|
12583 | parseNan2() {
|
12584 | if (this.char === CHAR_n) {
|
12585 | return this.return(NaN);
|
12586 | } else {
|
12587 | throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
12588 | }
|
12589 | }
|
12590 | parseKeyword() {
|
12591 | if (this.char === CHAR_QUOT) {
|
12592 | return this.next(this.parseBasicString);
|
12593 | } else if (this.char === CHAR_APOS) {
|
12594 | return this.next(this.parseLiteralString);
|
12595 | } else {
|
12596 | return this.goto(this.parseBareKey);
|
12597 | }
|
12598 | }
|
12599 | parseBareKey() {
|
12600 | do {
|
12601 | if (this.char === Parser.END) {
|
12602 | throw this.error(new TomlError("Key ended without value"));
|
12603 | } else if (isAlphaNumHyphen(this.char)) {
|
12604 | this.consume();
|
12605 | } else if (this.state.buf.length === 0) {
|
12606 | throw this.error(new TomlError("Empty bare keys are not allowed"));
|
12607 | } else {
|
12608 | return this.returnNow();
|
12609 | }
|
12610 | } while (this.nextChar());
|
12611 | }
|
12612 | parseSingleString() {
|
12613 | if (this.char === CHAR_APOS) {
|
12614 | return this.next(this.parseLiteralMultiStringMaybe);
|
12615 | } else {
|
12616 | return this.goto(this.parseLiteralString);
|
12617 | }
|
12618 | }
|
12619 | parseLiteralString() {
|
12620 | do {
|
12621 | if (this.char === CHAR_APOS) {
|
12622 | return this.return();
|
12623 | } else if (this.atEndOfLine()) {
|
12624 | throw this.error(new TomlError("Unterminated string"));
|
12625 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
12626 | throw this.errorControlCharInString();
|
12627 | } else {
|
12628 | this.consume();
|
12629 | }
|
12630 | } while (this.nextChar());
|
12631 | }
|
12632 | parseLiteralMultiStringMaybe() {
|
12633 | if (this.char === CHAR_APOS) {
|
12634 | return this.next(this.parseLiteralMultiString);
|
12635 | } else {
|
12636 | return this.returnNow();
|
12637 | }
|
12638 | }
|
12639 | parseLiteralMultiString() {
|
12640 | if (this.char === CTRL_M) {
|
12641 | return null;
|
12642 | } else if (this.char === CTRL_J) {
|
12643 | return this.next(this.parseLiteralMultiStringContent);
|
12644 | } else {
|
12645 | return this.goto(this.parseLiteralMultiStringContent);
|
12646 | }
|
12647 | }
|
12648 | parseLiteralMultiStringContent() {
|
12649 | do {
|
12650 | if (this.char === CHAR_APOS) {
|
12651 | return this.next(this.parseLiteralMultiEnd);
|
12652 | } else if (this.char === Parser.END) {
|
12653 | throw this.error(new TomlError("Unterminated multi-line string"));
|
12654 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
12655 | throw this.errorControlCharInString();
|
12656 | } else {
|
12657 | this.consume();
|
12658 | }
|
12659 | } while (this.nextChar());
|
12660 | }
|
12661 | parseLiteralMultiEnd() {
|
12662 | if (this.char === CHAR_APOS) {
|
12663 | return this.next(this.parseLiteralMultiEnd2);
|
12664 | } else {
|
12665 | this.state.buf += "'";
|
12666 | return this.goto(this.parseLiteralMultiStringContent);
|
12667 | }
|
12668 | }
|
12669 | parseLiteralMultiEnd2() {
|
12670 | if (this.char === CHAR_APOS) {
|
12671 | return this.return();
|
12672 | } else {
|
12673 | this.state.buf += "''";
|
12674 | return this.goto(this.parseLiteralMultiStringContent);
|
12675 | }
|
12676 | }
|
12677 | parseDoubleString() {
|
12678 | if (this.char === CHAR_QUOT) {
|
12679 | return this.next(this.parseMultiStringMaybe);
|
12680 | } else {
|
12681 | return this.goto(this.parseBasicString);
|
12682 | }
|
12683 | }
|
12684 | parseBasicString() {
|
12685 | do {
|
12686 | if (this.char === CHAR_BSOL) {
|
12687 | return this.call(this.parseEscape, this.recordEscapeReplacement);
|
12688 | } else if (this.char === CHAR_QUOT) {
|
12689 | return this.return();
|
12690 | } else if (this.atEndOfLine()) {
|
12691 | throw this.error(new TomlError("Unterminated string"));
|
12692 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
12693 | throw this.errorControlCharInString();
|
12694 | } else {
|
12695 | this.consume();
|
12696 | }
|
12697 | } while (this.nextChar());
|
12698 | }
|
12699 | recordEscapeReplacement(replacement) {
|
12700 | this.state.buf += replacement;
|
12701 | return this.goto(this.parseBasicString);
|
12702 | }
|
12703 | parseMultiStringMaybe() {
|
12704 | if (this.char === CHAR_QUOT) {
|
12705 | return this.next(this.parseMultiString);
|
12706 | } else {
|
12707 | return this.returnNow();
|
12708 | }
|
12709 | }
|
12710 | parseMultiString() {
|
12711 | if (this.char === CTRL_M) {
|
12712 | return null;
|
12713 | } else if (this.char === CTRL_J) {
|
12714 | return this.next(this.parseMultiStringContent);
|
12715 | } else {
|
12716 | return this.goto(this.parseMultiStringContent);
|
12717 | }
|
12718 | }
|
12719 | parseMultiStringContent() {
|
12720 | do {
|
12721 | if (this.char === CHAR_BSOL) {
|
12722 | return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
12723 | } else if (this.char === CHAR_QUOT) {
|
12724 | return this.next(this.parseMultiEnd);
|
12725 | } else if (this.char === Parser.END) {
|
12726 | throw this.error(new TomlError("Unterminated multi-line string"));
|
12727 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
12728 | throw this.errorControlCharInString();
|
12729 | } else {
|
12730 | this.consume();
|
12731 | }
|
12732 | } while (this.nextChar());
|
12733 | }
|
12734 | errorControlCharInString() {
|
12735 | let displayCode = "\\u00";
|
12736 | if (this.char < 16) {
|
12737 | displayCode += "0";
|
12738 | }
|
12739 | displayCode += this.char.toString(16);
|
12740 | return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
|
12741 | }
|
12742 | recordMultiEscapeReplacement(replacement) {
|
12743 | this.state.buf += replacement;
|
12744 | return this.goto(this.parseMultiStringContent);
|
12745 | }
|
12746 | parseMultiEnd() {
|
12747 | if (this.char === CHAR_QUOT) {
|
12748 | return this.next(this.parseMultiEnd2);
|
12749 | } else {
|
12750 | this.state.buf += '"';
|
12751 | return this.goto(this.parseMultiStringContent);
|
12752 | }
|
12753 | }
|
12754 | parseMultiEnd2() {
|
12755 | if (this.char === CHAR_QUOT) {
|
12756 | return this.return();
|
12757 | } else {
|
12758 | this.state.buf += '""';
|
12759 | return this.goto(this.parseMultiStringContent);
|
12760 | }
|
12761 | }
|
12762 | parseMultiEscape() {
|
12763 | if (this.char === CTRL_M || this.char === CTRL_J) {
|
12764 | return this.next(this.parseMultiTrim);
|
12765 | } else if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12766 | return this.next(this.parsePreMultiTrim);
|
12767 | } else {
|
12768 | return this.goto(this.parseEscape);
|
12769 | }
|
12770 | }
|
12771 | parsePreMultiTrim() {
|
12772 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
12773 | return null;
|
12774 | } else if (this.char === CTRL_M || this.char === CTRL_J) {
|
12775 | return this.next(this.parseMultiTrim);
|
12776 | } else {
|
12777 | throw this.error(new TomlError("Can't escape whitespace"));
|
12778 | }
|
12779 | }
|
12780 | parseMultiTrim() {
|
12781 | if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
12782 | return null;
|
12783 | } else {
|
12784 | return this.returnNow();
|
12785 | }
|
12786 | }
|
12787 | parseEscape() {
|
12788 | if (this.char in escapes) {
|
12789 | return this.return(escapes[this.char]);
|
12790 | } else if (this.char === CHAR_u) {
|
12791 | return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
|
12792 | } else if (this.char === CHAR_U) {
|
12793 | return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
12794 | } else {
|
12795 | throw this.error(new TomlError("Unknown escape character: " + this.char));
|
12796 | }
|
12797 | }
|
12798 | parseUnicodeReturn(char) {
|
12799 | try {
|
12800 | const codePoint = parseInt(char, 16);
|
12801 | if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
|
12802 | throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
12803 | }
|
12804 | return this.returnNow(String.fromCodePoint(codePoint));
|
12805 | } catch (err) {
|
12806 | throw this.error(TomlError.wrap(err));
|
12807 | }
|
12808 | }
|
12809 | parseSmallUnicode() {
|
12810 | if (!isHexit(this.char)) {
|
12811 | throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
12812 | } else {
|
12813 | this.consume();
|
12814 | if (this.state.buf.length >= 4)
|
12815 | return this.return();
|
12816 | }
|
12817 | }
|
12818 | parseLargeUnicode() {
|
12819 | if (!isHexit(this.char)) {
|
12820 | throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
12821 | } else {
|
12822 | this.consume();
|
12823 | if (this.state.buf.length >= 8)
|
12824 | return this.return();
|
12825 | }
|
12826 | }
|
12827 | parseNumberSign() {
|
12828 | this.consume();
|
12829 | return this.next(this.parseMaybeSignedInfOrNan);
|
12830 | }
|
12831 | parseMaybeSignedInfOrNan() {
|
12832 | if (this.char === CHAR_i) {
|
12833 | return this.next(this.parseInf);
|
12834 | } else if (this.char === CHAR_n) {
|
12835 | return this.next(this.parseNan);
|
12836 | } else {
|
12837 | return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
12838 | }
|
12839 | }
|
12840 | parseNumberIntegerStart() {
|
12841 | if (this.char === CHAR_0) {
|
12842 | this.consume();
|
12843 | return this.next(this.parseNumberIntegerExponentOrDecimal);
|
12844 | } else {
|
12845 | return this.goto(this.parseNumberInteger);
|
12846 | }
|
12847 | }
|
12848 | parseNumberIntegerExponentOrDecimal() {
|
12849 | if (this.char === CHAR_PERIOD) {
|
12850 | this.consume();
|
12851 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
12852 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
12853 | this.consume();
|
12854 | return this.next(this.parseNumberExponentSign);
|
12855 | } else {
|
12856 | return this.returnNow(Integer(this.state.buf));
|
12857 | }
|
12858 | }
|
12859 | parseNumberInteger() {
|
12860 | if (isDigit(this.char)) {
|
12861 | this.consume();
|
12862 | } else if (this.char === CHAR_LOWBAR) {
|
12863 | return this.call(this.parseNoUnder);
|
12864 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
12865 | this.consume();
|
12866 | return this.next(this.parseNumberExponentSign);
|
12867 | } else if (this.char === CHAR_PERIOD) {
|
12868 | this.consume();
|
12869 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
12870 | } else {
|
12871 | const result = Integer(this.state.buf);
|
12872 | if (result.isNaN()) {
|
12873 | throw this.error(new TomlError("Invalid number"));
|
12874 | } else {
|
12875 | return this.returnNow(result);
|
12876 | }
|
12877 | }
|
12878 | }
|
12879 | parseNoUnder() {
|
12880 | if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
|
12881 | throw this.error(new TomlError("Unexpected character, expected digit"));
|
12882 | } else if (this.atEndOfWord()) {
|
12883 | throw this.error(new TomlError("Incomplete number"));
|
12884 | }
|
12885 | return this.returnNow();
|
12886 | }
|
12887 | parseNoUnderHexOctBinLiteral() {
|
12888 | if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
|
12889 | throw this.error(new TomlError("Unexpected character, expected digit"));
|
12890 | } else if (this.atEndOfWord()) {
|
12891 | throw this.error(new TomlError("Incomplete number"));
|
12892 | }
|
12893 | return this.returnNow();
|
12894 | }
|
12895 | parseNumberFloat() {
|
12896 | if (this.char === CHAR_LOWBAR) {
|
12897 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
12898 | } else if (isDigit(this.char)) {
|
12899 | this.consume();
|
12900 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
12901 | this.consume();
|
12902 | return this.next(this.parseNumberExponentSign);
|
12903 | } else {
|
12904 | return this.returnNow(Float(this.state.buf));
|
12905 | }
|
12906 | }
|
12907 | parseNumberExponentSign() {
|
12908 | if (isDigit(this.char)) {
|
12909 | return this.goto(this.parseNumberExponent);
|
12910 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
12911 | this.consume();
|
12912 | this.call(this.parseNoUnder, this.parseNumberExponent);
|
12913 | } else {
|
12914 | throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
|
12915 | }
|
12916 | }
|
12917 | parseNumberExponent() {
|
12918 | if (isDigit(this.char)) {
|
12919 | this.consume();
|
12920 | } else if (this.char === CHAR_LOWBAR) {
|
12921 | return this.call(this.parseNoUnder);
|
12922 | } else {
|
12923 | return this.returnNow(Float(this.state.buf));
|
12924 | }
|
12925 | }
|
12926 | parseNumberOrDateTime() {
|
12927 | if (this.char === CHAR_0) {
|
12928 | this.consume();
|
12929 | return this.next(this.parseNumberBaseOrDateTime);
|
12930 | } else {
|
12931 | return this.goto(this.parseNumberOrDateTimeOnly);
|
12932 | }
|
12933 | }
|
12934 | parseNumberOrDateTimeOnly() {
|
12935 | if (this.char === CHAR_LOWBAR) {
|
12936 | return this.call(this.parseNoUnder, this.parseNumberInteger);
|
12937 | } else if (isDigit(this.char)) {
|
12938 | this.consume();
|
12939 | if (this.state.buf.length > 4)
|
12940 | this.next(this.parseNumberInteger);
|
12941 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
12942 | this.consume();
|
12943 | return this.next(this.parseNumberExponentSign);
|
12944 | } else if (this.char === CHAR_PERIOD) {
|
12945 | this.consume();
|
12946 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
12947 | } else if (this.char === CHAR_HYPHEN) {
|
12948 | return this.goto(this.parseDateTime);
|
12949 | } else if (this.char === CHAR_COLON) {
|
12950 | return this.goto(this.parseOnlyTimeHour);
|
12951 | } else {
|
12952 | return this.returnNow(Integer(this.state.buf));
|
12953 | }
|
12954 | }
|
12955 | parseDateTimeOnly() {
|
12956 | if (this.state.buf.length < 4) {
|
12957 | if (isDigit(this.char)) {
|
12958 | return this.consume();
|
12959 | } else if (this.char === CHAR_COLON) {
|
12960 | return this.goto(this.parseOnlyTimeHour);
|
12961 | } else {
|
12962 | throw this.error(new TomlError("Expected digit while parsing year part of a date"));
|
12963 | }
|
12964 | } else {
|
12965 | if (this.char === CHAR_HYPHEN) {
|
12966 | return this.goto(this.parseDateTime);
|
12967 | } else {
|
12968 | throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
|
12969 | }
|
12970 | }
|
12971 | }
|
12972 | parseNumberBaseOrDateTime() {
|
12973 | if (this.char === CHAR_b) {
|
12974 | this.consume();
|
12975 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
|
12976 | } else if (this.char === CHAR_o) {
|
12977 | this.consume();
|
12978 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
|
12979 | } else if (this.char === CHAR_x) {
|
12980 | this.consume();
|
12981 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
|
12982 | } else if (this.char === CHAR_PERIOD) {
|
12983 | return this.goto(this.parseNumberInteger);
|
12984 | } else if (isDigit(this.char)) {
|
12985 | return this.goto(this.parseDateTimeOnly);
|
12986 | } else {
|
12987 | return this.returnNow(Integer(this.state.buf));
|
12988 | }
|
12989 | }
|
12990 | parseIntegerHex() {
|
12991 | if (isHexit(this.char)) {
|
12992 | this.consume();
|
12993 | } else if (this.char === CHAR_LOWBAR) {
|
12994 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
12995 | } else {
|
12996 | const result = Integer(this.state.buf);
|
12997 | if (result.isNaN()) {
|
12998 | throw this.error(new TomlError("Invalid number"));
|
12999 | } else {
|
13000 | return this.returnNow(result);
|
13001 | }
|
13002 | }
|
13003 | }
|
13004 | parseIntegerOct() {
|
13005 | if (isOctit(this.char)) {
|
13006 | this.consume();
|
13007 | } else if (this.char === CHAR_LOWBAR) {
|
13008 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
13009 | } else {
|
13010 | const result = Integer(this.state.buf);
|
13011 | if (result.isNaN()) {
|
13012 | throw this.error(new TomlError("Invalid number"));
|
13013 | } else {
|
13014 | return this.returnNow(result);
|
13015 | }
|
13016 | }
|
13017 | }
|
13018 | parseIntegerBin() {
|
13019 | if (isBit(this.char)) {
|
13020 | this.consume();
|
13021 | } else if (this.char === CHAR_LOWBAR) {
|
13022 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
13023 | } else {
|
13024 | const result = Integer(this.state.buf);
|
13025 | if (result.isNaN()) {
|
13026 | throw this.error(new TomlError("Invalid number"));
|
13027 | } else {
|
13028 | return this.returnNow(result);
|
13029 | }
|
13030 | }
|
13031 | }
|
13032 | parseDateTime() {
|
13033 | if (this.state.buf.length < 4) {
|
13034 | throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
|
13035 | }
|
13036 | this.state.result = this.state.buf;
|
13037 | this.state.buf = "";
|
13038 | return this.next(this.parseDateMonth);
|
13039 | }
|
13040 | parseDateMonth() {
|
13041 | if (this.char === CHAR_HYPHEN) {
|
13042 | if (this.state.buf.length < 2) {
|
13043 | throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
|
13044 | }
|
13045 | this.state.result += "-" + this.state.buf;
|
13046 | this.state.buf = "";
|
13047 | return this.next(this.parseDateDay);
|
13048 | } else if (isDigit(this.char)) {
|
13049 | this.consume();
|
13050 | } else {
|
13051 | throw this.error(new TomlError("Incomplete datetime"));
|
13052 | }
|
13053 | }
|
13054 | parseDateDay() {
|
13055 | if (this.char === CHAR_T || this.char === CHAR_SP) {
|
13056 | if (this.state.buf.length < 2) {
|
13057 | throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
|
13058 | }
|
13059 | this.state.result += "-" + this.state.buf;
|
13060 | this.state.buf = "";
|
13061 | return this.next(this.parseStartTimeHour);
|
13062 | } else if (this.atEndOfWord()) {
|
13063 | return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
|
13064 | } else if (isDigit(this.char)) {
|
13065 | this.consume();
|
13066 | } else {
|
13067 | throw this.error(new TomlError("Incomplete datetime"));
|
13068 | }
|
13069 | }
|
13070 | parseStartTimeHour() {
|
13071 | if (this.atEndOfWord()) {
|
13072 | return this.returnNow(createDate(this.state.result));
|
13073 | } else {
|
13074 | return this.goto(this.parseTimeHour);
|
13075 | }
|
13076 | }
|
13077 | parseTimeHour() {
|
13078 | if (this.char === CHAR_COLON) {
|
13079 | if (this.state.buf.length < 2) {
|
13080 | throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
13081 | }
|
13082 | this.state.result += "T" + this.state.buf;
|
13083 | this.state.buf = "";
|
13084 | return this.next(this.parseTimeMin);
|
13085 | } else if (isDigit(this.char)) {
|
13086 | this.consume();
|
13087 | } else {
|
13088 | throw this.error(new TomlError("Incomplete datetime"));
|
13089 | }
|
13090 | }
|
13091 | parseTimeMin() {
|
13092 | if (this.state.buf.length < 2 && isDigit(this.char)) {
|
13093 | this.consume();
|
13094 | } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
13095 | this.state.result += ":" + this.state.buf;
|
13096 | this.state.buf = "";
|
13097 | return this.next(this.parseTimeSec);
|
13098 | } else {
|
13099 | throw this.error(new TomlError("Incomplete datetime"));
|
13100 | }
|
13101 | }
|
13102 | parseTimeSec() {
|
13103 | if (isDigit(this.char)) {
|
13104 | this.consume();
|
13105 | if (this.state.buf.length === 2) {
|
13106 | this.state.result += ":" + this.state.buf;
|
13107 | this.state.buf = "";
|
13108 | return this.next(this.parseTimeZoneOrFraction);
|
13109 | }
|
13110 | } else {
|
13111 | throw this.error(new TomlError("Incomplete datetime"));
|
13112 | }
|
13113 | }
|
13114 | parseOnlyTimeHour() {
|
13115 | if (this.char === CHAR_COLON) {
|
13116 | if (this.state.buf.length < 2) {
|
13117 | throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
13118 | }
|
13119 | this.state.result = this.state.buf;
|
13120 | this.state.buf = "";
|
13121 | return this.next(this.parseOnlyTimeMin);
|
13122 | } else {
|
13123 | throw this.error(new TomlError("Incomplete time"));
|
13124 | }
|
13125 | }
|
13126 | parseOnlyTimeMin() {
|
13127 | if (this.state.buf.length < 2 && isDigit(this.char)) {
|
13128 | this.consume();
|
13129 | } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
13130 | this.state.result += ":" + this.state.buf;
|
13131 | this.state.buf = "";
|
13132 | return this.next(this.parseOnlyTimeSec);
|
13133 | } else {
|
13134 | throw this.error(new TomlError("Incomplete time"));
|
13135 | }
|
13136 | }
|
13137 | parseOnlyTimeSec() {
|
13138 | if (isDigit(this.char)) {
|
13139 | this.consume();
|
13140 | if (this.state.buf.length === 2) {
|
13141 | return this.next(this.parseOnlyTimeFractionMaybe);
|
13142 | }
|
13143 | } else {
|
13144 | throw this.error(new TomlError("Incomplete time"));
|
13145 | }
|
13146 | }
|
13147 | parseOnlyTimeFractionMaybe() {
|
13148 | this.state.result += ":" + this.state.buf;
|
13149 | if (this.char === CHAR_PERIOD) {
|
13150 | this.state.buf = "";
|
13151 | this.next(this.parseOnlyTimeFraction);
|
13152 | } else {
|
13153 | return this.return(createTime(this.state.result));
|
13154 | }
|
13155 | }
|
13156 | parseOnlyTimeFraction() {
|
13157 | if (isDigit(this.char)) {
|
13158 | this.consume();
|
13159 | } else if (this.atEndOfWord()) {
|
13160 | if (this.state.buf.length === 0)
|
13161 | throw this.error(new TomlError("Expected digit in milliseconds"));
|
13162 | return this.returnNow(createTime(this.state.result + "." + this.state.buf));
|
13163 | } else {
|
13164 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
13165 | }
|
13166 | }
|
13167 | parseTimeZoneOrFraction() {
|
13168 | if (this.char === CHAR_PERIOD) {
|
13169 | this.consume();
|
13170 | this.next(this.parseDateTimeFraction);
|
13171 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
13172 | this.consume();
|
13173 | this.next(this.parseTimeZoneHour);
|
13174 | } else if (this.char === CHAR_Z) {
|
13175 | this.consume();
|
13176 | return this.return(createDateTime(this.state.result + this.state.buf));
|
13177 | } else if (this.atEndOfWord()) {
|
13178 | return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
13179 | } else {
|
13180 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
13181 | }
|
13182 | }
|
13183 | parseDateTimeFraction() {
|
13184 | if (isDigit(this.char)) {
|
13185 | this.consume();
|
13186 | } else if (this.state.buf.length === 1) {
|
13187 | throw this.error(new TomlError("Expected digit in milliseconds"));
|
13188 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
13189 | this.consume();
|
13190 | this.next(this.parseTimeZoneHour);
|
13191 | } else if (this.char === CHAR_Z) {
|
13192 | this.consume();
|
13193 | return this.return(createDateTime(this.state.result + this.state.buf));
|
13194 | } else if (this.atEndOfWord()) {
|
13195 | return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
13196 | } else {
|
13197 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
13198 | }
|
13199 | }
|
13200 | parseTimeZoneHour() {
|
13201 | if (isDigit(this.char)) {
|
13202 | this.consume();
|
13203 | if (/\d\d$/.test(this.state.buf))
|
13204 | return this.next(this.parseTimeZoneSep);
|
13205 | } else {
|
13206 | throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
13207 | }
|
13208 | }
|
13209 | parseTimeZoneSep() {
|
13210 | if (this.char === CHAR_COLON) {
|
13211 | this.consume();
|
13212 | this.next(this.parseTimeZoneMin);
|
13213 | } else {
|
13214 | throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
|
13215 | }
|
13216 | }
|
13217 | parseTimeZoneMin() {
|
13218 | if (isDigit(this.char)) {
|
13219 | this.consume();
|
13220 | if (/\d\d$/.test(this.state.buf))
|
13221 | return this.return(createDateTime(this.state.result + this.state.buf));
|
13222 | } else {
|
13223 | throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
13224 | }
|
13225 | }
|
13226 | parseBoolean() {
|
13227 | if (this.char === CHAR_t) {
|
13228 | this.consume();
|
13229 | return this.next(this.parseTrue_r);
|
13230 | } else if (this.char === CHAR_f) {
|
13231 | this.consume();
|
13232 | return this.next(this.parseFalse_a);
|
13233 | }
|
13234 | }
|
13235 | parseTrue_r() {
|
13236 | if (this.char === CHAR_r) {
|
13237 | this.consume();
|
13238 | return this.next(this.parseTrue_u);
|
13239 | } else {
|
13240 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13241 | }
|
13242 | }
|
13243 | parseTrue_u() {
|
13244 | if (this.char === CHAR_u) {
|
13245 | this.consume();
|
13246 | return this.next(this.parseTrue_e);
|
13247 | } else {
|
13248 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13249 | }
|
13250 | }
|
13251 | parseTrue_e() {
|
13252 | if (this.char === CHAR_e) {
|
13253 | return this.return(true);
|
13254 | } else {
|
13255 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13256 | }
|
13257 | }
|
13258 | parseFalse_a() {
|
13259 | if (this.char === CHAR_a) {
|
13260 | this.consume();
|
13261 | return this.next(this.parseFalse_l);
|
13262 | } else {
|
13263 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13264 | }
|
13265 | }
|
13266 | parseFalse_l() {
|
13267 | if (this.char === CHAR_l) {
|
13268 | this.consume();
|
13269 | return this.next(this.parseFalse_s);
|
13270 | } else {
|
13271 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13272 | }
|
13273 | }
|
13274 | parseFalse_s() {
|
13275 | if (this.char === CHAR_s) {
|
13276 | this.consume();
|
13277 | return this.next(this.parseFalse_e);
|
13278 | } else {
|
13279 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13280 | }
|
13281 | }
|
13282 | parseFalse_e() {
|
13283 | if (this.char === CHAR_e) {
|
13284 | return this.return(false);
|
13285 | } else {
|
13286 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
13287 | }
|
13288 | }
|
13289 | parseInlineList() {
|
13290 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
13291 | return null;
|
13292 | } else if (this.char === Parser.END) {
|
13293 | throw this.error(new TomlError("Unterminated inline array"));
|
13294 | } else if (this.char === CHAR_NUM) {
|
13295 | return this.call(this.parseComment);
|
13296 | } else if (this.char === CHAR_RSQB) {
|
13297 | return this.return(this.state.resultArr || InlineList());
|
13298 | } else {
|
13299 | return this.callNow(this.parseValue, this.recordInlineListValue);
|
13300 | }
|
13301 | }
|
13302 | recordInlineListValue(value) {
|
13303 | if (this.state.resultArr) {
|
13304 | const listType = this.state.resultArr[_contentType];
|
13305 | const valueType = tomlType(value);
|
13306 | if (listType !== valueType) {
|
13307 | throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
|
13308 | }
|
13309 | } else {
|
13310 | this.state.resultArr = InlineList(tomlType(value));
|
13311 | }
|
13312 | if (isFloat(value) || isInteger(value)) {
|
13313 | this.state.resultArr.push(value.valueOf());
|
13314 | } else {
|
13315 | this.state.resultArr.push(value);
|
13316 | }
|
13317 | return this.goto(this.parseInlineListNext);
|
13318 | }
|
13319 | parseInlineListNext() {
|
13320 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
13321 | return null;
|
13322 | } else if (this.char === CHAR_NUM) {
|
13323 | return this.call(this.parseComment);
|
13324 | } else if (this.char === CHAR_COMMA) {
|
13325 | return this.next(this.parseInlineList);
|
13326 | } else if (this.char === CHAR_RSQB) {
|
13327 | return this.goto(this.parseInlineList);
|
13328 | } else {
|
13329 | throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
13330 | }
|
13331 | }
|
13332 | parseInlineTable() {
|
13333 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
13334 | return null;
|
13335 | } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
13336 | throw this.error(new TomlError("Unterminated inline array"));
|
13337 | } else if (this.char === CHAR_RCUB) {
|
13338 | return this.return(this.state.resultTable || InlineTable());
|
13339 | } else {
|
13340 | if (!this.state.resultTable)
|
13341 | this.state.resultTable = InlineTable();
|
13342 | return this.callNow(this.parseAssign, this.recordInlineTableValue);
|
13343 | }
|
13344 | }
|
13345 | recordInlineTableValue(kv) {
|
13346 | let target = this.state.resultTable;
|
13347 | let finalKey = kv.key.pop();
|
13348 | for (let kw of kv.key) {
|
13349 | if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
13350 | throw this.error(new TomlError("Can't redefine existing key"));
|
13351 | }
|
13352 | target = target[kw] = target[kw] || Table();
|
13353 | }
|
13354 | if (hasKey(target, finalKey)) {
|
13355 | throw this.error(new TomlError("Can't redefine existing key"));
|
13356 | }
|
13357 | if (isInteger(kv.value) || isFloat(kv.value)) {
|
13358 | target[finalKey] = kv.value.valueOf();
|
13359 | } else {
|
13360 | target[finalKey] = kv.value;
|
13361 | }
|
13362 | return this.goto(this.parseInlineTableNext);
|
13363 | }
|
13364 | parseInlineTableNext() {
|
13365 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
13366 | return null;
|
13367 | } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
13368 | throw this.error(new TomlError("Unterminated inline array"));
|
13369 | } else if (this.char === CHAR_COMMA) {
|
13370 | return this.next(this.parseInlineTable);
|
13371 | } else if (this.char === CHAR_RCUB) {
|
13372 | return this.goto(this.parseInlineTable);
|
13373 | } else {
|
13374 | throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
13375 | }
|
13376 | }
|
13377 | }
|
13378 | return TOMLParser;
|
13379 | }
|
13380 | }
|
13381 | });
|
13382 | var require_parse_pretty_error = __commonJS2({
|
13383 | "node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
|
13384 | "use strict";
|
13385 | module2.exports = prettyError;
|
13386 | function prettyError(err, buf) {
|
13387 | if (err.pos == null || err.line == null)
|
13388 | return err;
|
13389 | let msg = err.message;
|
13390 | msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
|
13391 | `;
|
13392 | if (buf && buf.split) {
|
13393 | const lines = buf.split(/\n/);
|
13394 | const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
|
13395 | let linePadding = " ";
|
13396 | while (linePadding.length < lineNumWidth)
|
13397 | linePadding += " ";
|
13398 | for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
|
13399 | let lineNum = String(ii + 1);
|
13400 | if (lineNum.length < lineNumWidth)
|
13401 | lineNum = " " + lineNum;
|
13402 | if (err.line === ii) {
|
13403 | msg += lineNum + "> " + lines[ii] + "\n";
|
13404 | msg += linePadding + " ";
|
13405 | for (let hh = 0; hh < err.col; ++hh) {
|
13406 | msg += " ";
|
13407 | }
|
13408 | msg += "^\n";
|
13409 | } else {
|
13410 | msg += lineNum + ": " + lines[ii] + "\n";
|
13411 | }
|
13412 | }
|
13413 | }
|
13414 | err.message = msg + "\n";
|
13415 | return err;
|
13416 | }
|
13417 | }
|
13418 | });
|
13419 | var require_parse_string = __commonJS2({
|
13420 | "node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
|
13421 | "use strict";
|
13422 | module2.exports = parseString;
|
13423 | var TOMLParser = require_toml_parser();
|
13424 | var prettyError = require_parse_pretty_error();
|
13425 | function parseString(str) {
|
13426 | if (global.Buffer && global.Buffer.isBuffer(str)) {
|
13427 | str = str.toString("utf8");
|
13428 | }
|
13429 | const parser = new TOMLParser();
|
13430 | try {
|
13431 | parser.parse(str);
|
13432 | return parser.finish();
|
13433 | } catch (err) {
|
13434 | throw prettyError(err, str);
|
13435 | }
|
13436 | }
|
13437 | }
|
13438 | });
|
13439 | var require_load_toml = __commonJS2({
|
13440 | "src/utils/load-toml.js"(exports2, module2) {
|
13441 | "use strict";
|
13442 | var parse = require_parse_string();
|
13443 | module2.exports = function(filePath, content) {
|
13444 | try {
|
13445 | return parse(content);
|
13446 | } catch (error) {
|
13447 | error.message = `TOML Error in ${filePath}:
|
13448 | ${error.message}`;
|
13449 | throw error;
|
13450 | }
|
13451 | };
|
13452 | }
|
13453 | });
|
13454 | var require_unicode = __commonJS2({
|
13455 | "node_modules/json5/lib/unicode.js"(exports2, module2) {
|
13456 | module2.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
13457 | module2.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
|
13458 | module2.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
|
13459 | }
|
13460 | });
|
13461 | var require_util2 = __commonJS2({
|
13462 | "node_modules/json5/lib/util.js"(exports2, module2) {
|
13463 | var unicode = require_unicode();
|
13464 | module2.exports = {
|
13465 | isSpaceSeparator(c) {
|
13466 | return typeof c === "string" && unicode.Space_Separator.test(c);
|
13467 | },
|
13468 | isIdStartChar(c) {
|
13469 | return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c === "$" || c === "_" || unicode.ID_Start.test(c));
|
13470 | },
|
13471 | isIdContinueChar(c) {
|
13472 | return typeof c === "string" && (c >= "a" && c <= "z" || c >= "A" && c <= "Z" || c >= "0" && c <= "9" || c === "$" || c === "_" || c === "\u200C" || c === "\u200D" || unicode.ID_Continue.test(c));
|
13473 | },
|
13474 | isDigit(c) {
|
13475 | return typeof c === "string" && /[0-9]/.test(c);
|
13476 | },
|
13477 | isHexDigit(c) {
|
13478 | return typeof c === "string" && /[0-9A-Fa-f]/.test(c);
|
13479 | }
|
13480 | };
|
13481 | }
|
13482 | });
|
13483 | var require_parse3 = __commonJS2({
|
13484 | "node_modules/json5/lib/parse.js"(exports2, module2) {
|
13485 | var util = require_util2();
|
13486 | var source;
|
13487 | var parseState;
|
13488 | var stack;
|
13489 | var pos;
|
13490 | var line;
|
13491 | var column;
|
13492 | var token;
|
13493 | var key;
|
13494 | var root;
|
13495 | module2.exports = function parse(text, reviver) {
|
13496 | source = String(text);
|
13497 | parseState = "start";
|
13498 | stack = [];
|
13499 | pos = 0;
|
13500 | line = 1;
|
13501 | column = 0;
|
13502 | token = void 0;
|
13503 | key = void 0;
|
13504 | root = void 0;
|
13505 | do {
|
13506 | token = lex();
|
13507 | parseStates[parseState]();
|
13508 | } while (token.type !== "eof");
|
13509 | if (typeof reviver === "function") {
|
13510 | return internalize({
|
13511 | "": root
|
13512 | }, "", reviver);
|
13513 | }
|
13514 | return root;
|
13515 | };
|
13516 | function internalize(holder, name, reviver) {
|
13517 | const value = holder[name];
|
13518 | if (value != null && typeof value === "object") {
|
13519 | for (const key2 in value) {
|
13520 | const replacement = internalize(value, key2, reviver);
|
13521 | if (replacement === void 0) {
|
13522 | delete value[key2];
|
13523 | } else {
|
13524 | value[key2] = replacement;
|
13525 | }
|
13526 | }
|
13527 | }
|
13528 | return reviver.call(holder, name, value);
|
13529 | }
|
13530 | var lexState;
|
13531 | var buffer;
|
13532 | var doubleQuote;
|
13533 | var sign;
|
13534 | var c;
|
13535 | function lex() {
|
13536 | lexState = "default";
|
13537 | buffer = "";
|
13538 | doubleQuote = false;
|
13539 | sign = 1;
|
13540 | for (; ; ) {
|
13541 | c = peek();
|
13542 | const token2 = lexStates[lexState]();
|
13543 | if (token2) {
|
13544 | return token2;
|
13545 | }
|
13546 | }
|
13547 | }
|
13548 | function peek() {
|
13549 | if (source[pos]) {
|
13550 | return String.fromCodePoint(source.codePointAt(pos));
|
13551 | }
|
13552 | }
|
13553 | function read() {
|
13554 | const c2 = peek();
|
13555 | if (c2 === "\n") {
|
13556 | line++;
|
13557 | column = 0;
|
13558 | } else if (c2) {
|
13559 | column += c2.length;
|
13560 | } else {
|
13561 | column++;
|
13562 | }
|
13563 | if (c2) {
|
13564 | pos += c2.length;
|
13565 | }
|
13566 | return c2;
|
13567 | }
|
13568 | var lexStates = {
|
13569 | default() {
|
13570 | switch (c) {
|
13571 | case " ":
|
13572 | case "\v":
|
13573 | case "\f":
|
13574 | case " ":
|
13575 | case "\xA0":
|
13576 | case "\uFEFF":
|
13577 | case "\n":
|
13578 | case "\r":
|
13579 | case "\u2028":
|
13580 | case "\u2029":
|
13581 | read();
|
13582 | return;
|
13583 | case "/":
|
13584 | read();
|
13585 | lexState = "comment";
|
13586 | return;
|
13587 | case void 0:
|
13588 | read();
|
13589 | return newToken("eof");
|
13590 | }
|
13591 | if (util.isSpaceSeparator(c)) {
|
13592 | read();
|
13593 | return;
|
13594 | }
|
13595 | return lexStates[parseState]();
|
13596 | },
|
13597 | comment() {
|
13598 | switch (c) {
|
13599 | case "*":
|
13600 | read();
|
13601 | lexState = "multiLineComment";
|
13602 | return;
|
13603 | case "/":
|
13604 | read();
|
13605 | lexState = "singleLineComment";
|
13606 | return;
|
13607 | }
|
13608 | throw invalidChar(read());
|
13609 | },
|
13610 | multiLineComment() {
|
13611 | switch (c) {
|
13612 | case "*":
|
13613 | read();
|
13614 | lexState = "multiLineCommentAsterisk";
|
13615 | return;
|
13616 | case void 0:
|
13617 | throw invalidChar(read());
|
13618 | }
|
13619 | read();
|
13620 | },
|
13621 | multiLineCommentAsterisk() {
|
13622 | switch (c) {
|
13623 | case "*":
|
13624 | read();
|
13625 | return;
|
13626 | case "/":
|
13627 | read();
|
13628 | lexState = "default";
|
13629 | return;
|
13630 | case void 0:
|
13631 | throw invalidChar(read());
|
13632 | }
|
13633 | read();
|
13634 | lexState = "multiLineComment";
|
13635 | },
|
13636 | singleLineComment() {
|
13637 | switch (c) {
|
13638 | case "\n":
|
13639 | case "\r":
|
13640 | case "\u2028":
|
13641 | case "\u2029":
|
13642 | read();
|
13643 | lexState = "default";
|
13644 | return;
|
13645 | case void 0:
|
13646 | read();
|
13647 | return newToken("eof");
|
13648 | }
|
13649 | read();
|
13650 | },
|
13651 | value() {
|
13652 | switch (c) {
|
13653 | case "{":
|
13654 | case "[":
|
13655 | return newToken("punctuator", read());
|
13656 | case "n":
|
13657 | read();
|
13658 | literal("ull");
|
13659 | return newToken("null", null);
|
13660 | case "t":
|
13661 | read();
|
13662 | literal("rue");
|
13663 | return newToken("boolean", true);
|
13664 | case "f":
|
13665 | read();
|
13666 | literal("alse");
|
13667 | return newToken("boolean", false);
|
13668 | case "-":
|
13669 | case "+":
|
13670 | if (read() === "-") {
|
13671 | sign = -1;
|
13672 | }
|
13673 | lexState = "sign";
|
13674 | return;
|
13675 | case ".":
|
13676 | buffer = read();
|
13677 | lexState = "decimalPointLeading";
|
13678 | return;
|
13679 | case "0":
|
13680 | buffer = read();
|
13681 | lexState = "zero";
|
13682 | return;
|
13683 | case "1":
|
13684 | case "2":
|
13685 | case "3":
|
13686 | case "4":
|
13687 | case "5":
|
13688 | case "6":
|
13689 | case "7":
|
13690 | case "8":
|
13691 | case "9":
|
13692 | buffer = read();
|
13693 | lexState = "decimalInteger";
|
13694 | return;
|
13695 | case "I":
|
13696 | read();
|
13697 | literal("nfinity");
|
13698 | return newToken("numeric", Infinity);
|
13699 | case "N":
|
13700 | read();
|
13701 | literal("aN");
|
13702 | return newToken("numeric", NaN);
|
13703 | case '"':
|
13704 | case "'":
|
13705 | doubleQuote = read() === '"';
|
13706 | buffer = "";
|
13707 | lexState = "string";
|
13708 | return;
|
13709 | }
|
13710 | throw invalidChar(read());
|
13711 | },
|
13712 | identifierNameStartEscape() {
|
13713 | if (c !== "u") {
|
13714 | throw invalidChar(read());
|
13715 | }
|
13716 | read();
|
13717 | const u = unicodeEscape();
|
13718 | switch (u) {
|
13719 | case "$":
|
13720 | case "_":
|
13721 | break;
|
13722 | default:
|
13723 | if (!util.isIdStartChar(u)) {
|
13724 | throw invalidIdentifier();
|
13725 | }
|
13726 | break;
|
13727 | }
|
13728 | buffer += u;
|
13729 | lexState = "identifierName";
|
13730 | },
|
13731 | identifierName() {
|
13732 | switch (c) {
|
13733 | case "$":
|
13734 | case "_":
|
13735 | case "\u200C":
|
13736 | case "\u200D":
|
13737 | buffer += read();
|
13738 | return;
|
13739 | case "\\":
|
13740 | read();
|
13741 | lexState = "identifierNameEscape";
|
13742 | return;
|
13743 | }
|
13744 | if (util.isIdContinueChar(c)) {
|
13745 | buffer += read();
|
13746 | return;
|
13747 | }
|
13748 | return newToken("identifier", buffer);
|
13749 | },
|
13750 | identifierNameEscape() {
|
13751 | if (c !== "u") {
|
13752 | throw invalidChar(read());
|
13753 | }
|
13754 | read();
|
13755 | const u = unicodeEscape();
|
13756 | switch (u) {
|
13757 | case "$":
|
13758 | case "_":
|
13759 | case "\u200C":
|
13760 | case "\u200D":
|
13761 | break;
|
13762 | default:
|
13763 | if (!util.isIdContinueChar(u)) {
|
13764 | throw invalidIdentifier();
|
13765 | }
|
13766 | break;
|
13767 | }
|
13768 | buffer += u;
|
13769 | lexState = "identifierName";
|
13770 | },
|
13771 | sign() {
|
13772 | switch (c) {
|
13773 | case ".":
|
13774 | buffer = read();
|
13775 | lexState = "decimalPointLeading";
|
13776 | return;
|
13777 | case "0":
|
13778 | buffer = read();
|
13779 | lexState = "zero";
|
13780 | return;
|
13781 | case "1":
|
13782 | case "2":
|
13783 | case "3":
|
13784 | case "4":
|
13785 | case "5":
|
13786 | case "6":
|
13787 | case "7":
|
13788 | case "8":
|
13789 | case "9":
|
13790 | buffer = read();
|
13791 | lexState = "decimalInteger";
|
13792 | return;
|
13793 | case "I":
|
13794 | read();
|
13795 | literal("nfinity");
|
13796 | return newToken("numeric", sign * Infinity);
|
13797 | case "N":
|
13798 | read();
|
13799 | literal("aN");
|
13800 | return newToken("numeric", NaN);
|
13801 | }
|
13802 | throw invalidChar(read());
|
13803 | },
|
13804 | zero() {
|
13805 | switch (c) {
|
13806 | case ".":
|
13807 | buffer += read();
|
13808 | lexState = "decimalPoint";
|
13809 | return;
|
13810 | case "e":
|
13811 | case "E":
|
13812 | buffer += read();
|
13813 | lexState = "decimalExponent";
|
13814 | return;
|
13815 | case "x":
|
13816 | case "X":
|
13817 | buffer += read();
|
13818 | lexState = "hexadecimal";
|
13819 | return;
|
13820 | }
|
13821 | return newToken("numeric", sign * 0);
|
13822 | },
|
13823 | decimalInteger() {
|
13824 | switch (c) {
|
13825 | case ".":
|
13826 | buffer += read();
|
13827 | lexState = "decimalPoint";
|
13828 | return;
|
13829 | case "e":
|
13830 | case "E":
|
13831 | buffer += read();
|
13832 | lexState = "decimalExponent";
|
13833 | return;
|
13834 | }
|
13835 | if (util.isDigit(c)) {
|
13836 | buffer += read();
|
13837 | return;
|
13838 | }
|
13839 | return newToken("numeric", sign * Number(buffer));
|
13840 | },
|
13841 | decimalPointLeading() {
|
13842 | if (util.isDigit(c)) {
|
13843 | buffer += read();
|
13844 | lexState = "decimalFraction";
|
13845 | return;
|
13846 | }
|
13847 | throw invalidChar(read());
|
13848 | },
|
13849 | decimalPoint() {
|
13850 | switch (c) {
|
13851 | case "e":
|
13852 | case "E":
|
13853 | buffer += read();
|
13854 | lexState = "decimalExponent";
|
13855 | return;
|
13856 | }
|
13857 | if (util.isDigit(c)) {
|
13858 | buffer += read();
|
13859 | lexState = "decimalFraction";
|
13860 | return;
|
13861 | }
|
13862 | return newToken("numeric", sign * Number(buffer));
|
13863 | },
|
13864 | decimalFraction() {
|
13865 | switch (c) {
|
13866 | case "e":
|
13867 | case "E":
|
13868 | buffer += read();
|
13869 | lexState = "decimalExponent";
|
13870 | return;
|
13871 | }
|
13872 | if (util.isDigit(c)) {
|
13873 | buffer += read();
|
13874 | return;
|
13875 | }
|
13876 | return newToken("numeric", sign * Number(buffer));
|
13877 | },
|
13878 | decimalExponent() {
|
13879 | switch (c) {
|
13880 | case "+":
|
13881 | case "-":
|
13882 | buffer += read();
|
13883 | lexState = "decimalExponentSign";
|
13884 | return;
|
13885 | }
|
13886 | if (util.isDigit(c)) {
|
13887 | buffer += read();
|
13888 | lexState = "decimalExponentInteger";
|
13889 | return;
|
13890 | }
|
13891 | throw invalidChar(read());
|
13892 | },
|
13893 | decimalExponentSign() {
|
13894 | if (util.isDigit(c)) {
|
13895 | buffer += read();
|
13896 | lexState = "decimalExponentInteger";
|
13897 | return;
|
13898 | }
|
13899 | throw invalidChar(read());
|
13900 | },
|
13901 | decimalExponentInteger() {
|
13902 | if (util.isDigit(c)) {
|
13903 | buffer += read();
|
13904 | return;
|
13905 | }
|
13906 | return newToken("numeric", sign * Number(buffer));
|
13907 | },
|
13908 | hexadecimal() {
|
13909 | if (util.isHexDigit(c)) {
|
13910 | buffer += read();
|
13911 | lexState = "hexadecimalInteger";
|
13912 | return;
|
13913 | }
|
13914 | throw invalidChar(read());
|
13915 | },
|
13916 | hexadecimalInteger() {
|
13917 | if (util.isHexDigit(c)) {
|
13918 | buffer += read();
|
13919 | return;
|
13920 | }
|
13921 | return newToken("numeric", sign * Number(buffer));
|
13922 | },
|
13923 | string() {
|
13924 | switch (c) {
|
13925 | case "\\":
|
13926 | read();
|
13927 | buffer += escape();
|
13928 | return;
|
13929 | case '"':
|
13930 | if (doubleQuote) {
|
13931 | read();
|
13932 | return newToken("string", buffer);
|
13933 | }
|
13934 | buffer += read();
|
13935 | return;
|
13936 | case "'":
|
13937 | if (!doubleQuote) {
|
13938 | read();
|
13939 | return newToken("string", buffer);
|
13940 | }
|
13941 | buffer += read();
|
13942 | return;
|
13943 | case "\n":
|
13944 | case "\r":
|
13945 | throw invalidChar(read());
|
13946 | case "\u2028":
|
13947 | case "\u2029":
|
13948 | separatorChar(c);
|
13949 | break;
|
13950 | case void 0:
|
13951 | throw invalidChar(read());
|
13952 | }
|
13953 | buffer += read();
|
13954 | },
|
13955 | start() {
|
13956 | switch (c) {
|
13957 | case "{":
|
13958 | case "[":
|
13959 | return newToken("punctuator", read());
|
13960 | }
|
13961 | lexState = "value";
|
13962 | },
|
13963 | beforePropertyName() {
|
13964 | switch (c) {
|
13965 | case "$":
|
13966 | case "_":
|
13967 | buffer = read();
|
13968 | lexState = "identifierName";
|
13969 | return;
|
13970 | case "\\":
|
13971 | read();
|
13972 | lexState = "identifierNameStartEscape";
|
13973 | return;
|
13974 | case "}":
|
13975 | return newToken("punctuator", read());
|
13976 | case '"':
|
13977 | case "'":
|
13978 | doubleQuote = read() === '"';
|
13979 | lexState = "string";
|
13980 | return;
|
13981 | }
|
13982 | if (util.isIdStartChar(c)) {
|
13983 | buffer += read();
|
13984 | lexState = "identifierName";
|
13985 | return;
|
13986 | }
|
13987 | throw invalidChar(read());
|
13988 | },
|
13989 | afterPropertyName() {
|
13990 | if (c === ":") {
|
13991 | return newToken("punctuator", read());
|
13992 | }
|
13993 | throw invalidChar(read());
|
13994 | },
|
13995 | beforePropertyValue() {
|
13996 | lexState = "value";
|
13997 | },
|
13998 | afterPropertyValue() {
|
13999 | switch (c) {
|
14000 | case ",":
|
14001 | case "}":
|
14002 | return newToken("punctuator", read());
|
14003 | }
|
14004 | throw invalidChar(read());
|
14005 | },
|
14006 | beforeArrayValue() {
|
14007 | if (c === "]") {
|
14008 | return newToken("punctuator", read());
|
14009 | }
|
14010 | lexState = "value";
|
14011 | },
|
14012 | afterArrayValue() {
|
14013 | switch (c) {
|
14014 | case ",":
|
14015 | case "]":
|
14016 | return newToken("punctuator", read());
|
14017 | }
|
14018 | throw invalidChar(read());
|
14019 | },
|
14020 | end() {
|
14021 | throw invalidChar(read());
|
14022 | }
|
14023 | };
|
14024 | function newToken(type, value) {
|
14025 | return {
|
14026 | type,
|
14027 | value,
|
14028 | line,
|
14029 | column
|
14030 | };
|
14031 | }
|
14032 | function literal(s) {
|
14033 | for (const c2 of s) {
|
14034 | const p = peek();
|
14035 | if (p !== c2) {
|
14036 | throw invalidChar(read());
|
14037 | }
|
14038 | read();
|
14039 | }
|
14040 | }
|
14041 | function escape() {
|
14042 | const c2 = peek();
|
14043 | switch (c2) {
|
14044 | case "b":
|
14045 | read();
|
14046 | return "\b";
|
14047 | case "f":
|
14048 | read();
|
14049 | return "\f";
|
14050 | case "n":
|
14051 | read();
|
14052 | return "\n";
|
14053 | case "r":
|
14054 | read();
|
14055 | return "\r";
|
14056 | case "t":
|
14057 | read();
|
14058 | return " ";
|
14059 | case "v":
|
14060 | read();
|
14061 | return "\v";
|
14062 | case "0":
|
14063 | read();
|
14064 | if (util.isDigit(peek())) {
|
14065 | throw invalidChar(read());
|
14066 | }
|
14067 | return "\0";
|
14068 | case "x":
|
14069 | read();
|
14070 | return hexEscape();
|
14071 | case "u":
|
14072 | read();
|
14073 | return unicodeEscape();
|
14074 | case "\n":
|
14075 | case "\u2028":
|
14076 | case "\u2029":
|
14077 | read();
|
14078 | return "";
|
14079 | case "\r":
|
14080 | read();
|
14081 | if (peek() === "\n") {
|
14082 | read();
|
14083 | }
|
14084 | return "";
|
14085 | case "1":
|
14086 | case "2":
|
14087 | case "3":
|
14088 | case "4":
|
14089 | case "5":
|
14090 | case "6":
|
14091 | case "7":
|
14092 | case "8":
|
14093 | case "9":
|
14094 | throw invalidChar(read());
|
14095 | case void 0:
|
14096 | throw invalidChar(read());
|
14097 | }
|
14098 | return read();
|
14099 | }
|
14100 | function hexEscape() {
|
14101 | let buffer2 = "";
|
14102 | let c2 = peek();
|
14103 | if (!util.isHexDigit(c2)) {
|
14104 | throw invalidChar(read());
|
14105 | }
|
14106 | buffer2 += read();
|
14107 | c2 = peek();
|
14108 | if (!util.isHexDigit(c2)) {
|
14109 | throw invalidChar(read());
|
14110 | }
|
14111 | buffer2 += read();
|
14112 | return String.fromCodePoint(parseInt(buffer2, 16));
|
14113 | }
|
14114 | function unicodeEscape() {
|
14115 | let buffer2 = "";
|
14116 | let count = 4;
|
14117 | while (count-- > 0) {
|
14118 | const c2 = peek();
|
14119 | if (!util.isHexDigit(c2)) {
|
14120 | throw invalidChar(read());
|
14121 | }
|
14122 | buffer2 += read();
|
14123 | }
|
14124 | return String.fromCodePoint(parseInt(buffer2, 16));
|
14125 | }
|
14126 | var parseStates = {
|
14127 | start() {
|
14128 | if (token.type === "eof") {
|
14129 | throw invalidEOF();
|
14130 | }
|
14131 | push();
|
14132 | },
|
14133 | beforePropertyName() {
|
14134 | switch (token.type) {
|
14135 | case "identifier":
|
14136 | case "string":
|
14137 | key = token.value;
|
14138 | parseState = "afterPropertyName";
|
14139 | return;
|
14140 | case "punctuator":
|
14141 | pop();
|
14142 | return;
|
14143 | case "eof":
|
14144 | throw invalidEOF();
|
14145 | }
|
14146 | },
|
14147 | afterPropertyName() {
|
14148 | if (token.type === "eof") {
|
14149 | throw invalidEOF();
|
14150 | }
|
14151 | parseState = "beforePropertyValue";
|
14152 | },
|
14153 | beforePropertyValue() {
|
14154 | if (token.type === "eof") {
|
14155 | throw invalidEOF();
|
14156 | }
|
14157 | push();
|
14158 | },
|
14159 | beforeArrayValue() {
|
14160 | if (token.type === "eof") {
|
14161 | throw invalidEOF();
|
14162 | }
|
14163 | if (token.type === "punctuator" && token.value === "]") {
|
14164 | pop();
|
14165 | return;
|
14166 | }
|
14167 | push();
|
14168 | },
|
14169 | afterPropertyValue() {
|
14170 | if (token.type === "eof") {
|
14171 | throw invalidEOF();
|
14172 | }
|
14173 | switch (token.value) {
|
14174 | case ",":
|
14175 | parseState = "beforePropertyName";
|
14176 | return;
|
14177 | case "}":
|
14178 | pop();
|
14179 | }
|
14180 | },
|
14181 | afterArrayValue() {
|
14182 | if (token.type === "eof") {
|
14183 | throw invalidEOF();
|
14184 | }
|
14185 | switch (token.value) {
|
14186 | case ",":
|
14187 | parseState = "beforeArrayValue";
|
14188 | return;
|
14189 | case "]":
|
14190 | pop();
|
14191 | }
|
14192 | },
|
14193 | end() {
|
14194 | }
|
14195 | };
|
14196 | function push() {
|
14197 | let value;
|
14198 | switch (token.type) {
|
14199 | case "punctuator":
|
14200 | switch (token.value) {
|
14201 | case "{":
|
14202 | value = {};
|
14203 | break;
|
14204 | case "[":
|
14205 | value = [];
|
14206 | break;
|
14207 | }
|
14208 | break;
|
14209 | case "null":
|
14210 | case "boolean":
|
14211 | case "numeric":
|
14212 | case "string":
|
14213 | value = token.value;
|
14214 | break;
|
14215 | }
|
14216 | if (root === void 0) {
|
14217 | root = value;
|
14218 | } else {
|
14219 | const parent = stack[stack.length - 1];
|
14220 | if (Array.isArray(parent)) {
|
14221 | parent.push(value);
|
14222 | } else {
|
14223 | parent[key] = value;
|
14224 | }
|
14225 | }
|
14226 | if (value !== null && typeof value === "object") {
|
14227 | stack.push(value);
|
14228 | if (Array.isArray(value)) {
|
14229 | parseState = "beforeArrayValue";
|
14230 | } else {
|
14231 | parseState = "beforePropertyName";
|
14232 | }
|
14233 | } else {
|
14234 | const current = stack[stack.length - 1];
|
14235 | if (current == null) {
|
14236 | parseState = "end";
|
14237 | } else if (Array.isArray(current)) {
|
14238 | parseState = "afterArrayValue";
|
14239 | } else {
|
14240 | parseState = "afterPropertyValue";
|
14241 | }
|
14242 | }
|
14243 | }
|
14244 | function pop() {
|
14245 | stack.pop();
|
14246 | const current = stack[stack.length - 1];
|
14247 | if (current == null) {
|
14248 | parseState = "end";
|
14249 | } else if (Array.isArray(current)) {
|
14250 | parseState = "afterArrayValue";
|
14251 | } else {
|
14252 | parseState = "afterPropertyValue";
|
14253 | }
|
14254 | }
|
14255 | function invalidChar(c2) {
|
14256 | if (c2 === void 0) {
|
14257 | return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
14258 | }
|
14259 | return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
|
14260 | }
|
14261 | function invalidEOF() {
|
14262 | return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
14263 | }
|
14264 | function invalidIdentifier() {
|
14265 | column -= 5;
|
14266 | return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
|
14267 | }
|
14268 | function separatorChar(c2) {
|
14269 | console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
|
14270 | }
|
14271 | function formatChar(c2) {
|
14272 | const replacements = {
|
14273 | "'": "\\'",
|
14274 | '"': '\\"',
|
14275 | "\\": "\\\\",
|
14276 | "\b": "\\b",
|
14277 | "\f": "\\f",
|
14278 | "\n": "\\n",
|
14279 | "\r": "\\r",
|
14280 | " ": "\\t",
|
14281 | "\v": "\\v",
|
14282 | "\0": "\\0",
|
14283 | "\u2028": "\\u2028",
|
14284 | "\u2029": "\\u2029"
|
14285 | };
|
14286 | if (replacements[c2]) {
|
14287 | return replacements[c2];
|
14288 | }
|
14289 | if (c2 < " ") {
|
14290 | const hexString = c2.charCodeAt(0).toString(16);
|
14291 | return "\\x" + ("00" + hexString).substring(hexString.length);
|
14292 | }
|
14293 | return c2;
|
14294 | }
|
14295 | function syntaxError(message) {
|
14296 | const err = new SyntaxError(message);
|
14297 | err.lineNumber = line;
|
14298 | err.columnNumber = column;
|
14299 | return err;
|
14300 | }
|
14301 | }
|
14302 | });
|
14303 | var require_stringify2 = __commonJS2({
|
14304 | "node_modules/json5/lib/stringify.js"(exports2, module2) {
|
14305 | var util = require_util2();
|
14306 | module2.exports = function stringify(value, replacer, space) {
|
14307 | const stack = [];
|
14308 | let indent = "";
|
14309 | let propertyList;
|
14310 | let replacerFunc;
|
14311 | let gap = "";
|
14312 | let quote;
|
14313 | if (replacer != null && typeof replacer === "object" && !Array.isArray(replacer)) {
|
14314 | space = replacer.space;
|
14315 | quote = replacer.quote;
|
14316 | replacer = replacer.replacer;
|
14317 | }
|
14318 | if (typeof replacer === "function") {
|
14319 | replacerFunc = replacer;
|
14320 | } else if (Array.isArray(replacer)) {
|
14321 | propertyList = [];
|
14322 | for (const v of replacer) {
|
14323 | let item;
|
14324 | if (typeof v === "string") {
|
14325 | item = v;
|
14326 | } else if (typeof v === "number" || v instanceof String || v instanceof Number) {
|
14327 | item = String(v);
|
14328 | }
|
14329 | if (item !== void 0 && propertyList.indexOf(item) < 0) {
|
14330 | propertyList.push(item);
|
14331 | }
|
14332 | }
|
14333 | }
|
14334 | if (space instanceof Number) {
|
14335 | space = Number(space);
|
14336 | } else if (space instanceof String) {
|
14337 | space = String(space);
|
14338 | }
|
14339 | if (typeof space === "number") {
|
14340 | if (space > 0) {
|
14341 | space = Math.min(10, Math.floor(space));
|
14342 | gap = " ".substr(0, space);
|
14343 | }
|
14344 | } else if (typeof space === "string") {
|
14345 | gap = space.substr(0, 10);
|
14346 | }
|
14347 | return serializeProperty("", {
|
14348 | "": value
|
14349 | });
|
14350 | function serializeProperty(key, holder) {
|
14351 | let value2 = holder[key];
|
14352 | if (value2 != null) {
|
14353 | if (typeof value2.toJSON5 === "function") {
|
14354 | value2 = value2.toJSON5(key);
|
14355 | } else if (typeof value2.toJSON === "function") {
|
14356 | value2 = value2.toJSON(key);
|
14357 | }
|
14358 | }
|
14359 | if (replacerFunc) {
|
14360 | value2 = replacerFunc.call(holder, key, value2);
|
14361 | }
|
14362 | if (value2 instanceof Number) {
|
14363 | value2 = Number(value2);
|
14364 | } else if (value2 instanceof String) {
|
14365 | value2 = String(value2);
|
14366 | } else if (value2 instanceof Boolean) {
|
14367 | value2 = value2.valueOf();
|
14368 | }
|
14369 | switch (value2) {
|
14370 | case null:
|
14371 | return "null";
|
14372 | case true:
|
14373 | return "true";
|
14374 | case false:
|
14375 | return "false";
|
14376 | }
|
14377 | if (typeof value2 === "string") {
|
14378 | return quoteString(value2, false);
|
14379 | }
|
14380 | if (typeof value2 === "number") {
|
14381 | return String(value2);
|
14382 | }
|
14383 | if (typeof value2 === "object") {
|
14384 | return Array.isArray(value2) ? serializeArray(value2) : serializeObject(value2);
|
14385 | }
|
14386 | return void 0;
|
14387 | }
|
14388 | function quoteString(value2) {
|
14389 | const quotes = {
|
14390 | "'": 0.1,
|
14391 | '"': 0.2
|
14392 | };
|
14393 | const replacements = {
|
14394 | "'": "\\'",
|
14395 | '"': '\\"',
|
14396 | "\\": "\\\\",
|
14397 | "\b": "\\b",
|
14398 | "\f": "\\f",
|
14399 | "\n": "\\n",
|
14400 | "\r": "\\r",
|
14401 | " ": "\\t",
|
14402 | "\v": "\\v",
|
14403 | "\0": "\\0",
|
14404 | "\u2028": "\\u2028",
|
14405 | "\u2029": "\\u2029"
|
14406 | };
|
14407 | let product = "";
|
14408 | for (let i = 0; i < value2.length; i++) {
|
14409 | const c = value2[i];
|
14410 | switch (c) {
|
14411 | case "'":
|
14412 | case '"':
|
14413 | quotes[c]++;
|
14414 | product += c;
|
14415 | continue;
|
14416 | case "\0":
|
14417 | if (util.isDigit(value2[i + 1])) {
|
14418 | product += "\\x00";
|
14419 | continue;
|
14420 | }
|
14421 | }
|
14422 | if (replacements[c]) {
|
14423 | product += replacements[c];
|
14424 | continue;
|
14425 | }
|
14426 | if (c < " ") {
|
14427 | let hexString = c.charCodeAt(0).toString(16);
|
14428 | product += "\\x" + ("00" + hexString).substring(hexString.length);
|
14429 | continue;
|
14430 | }
|
14431 | product += c;
|
14432 | }
|
14433 | const quoteChar = quote || Object.keys(quotes).reduce((a, b) => quotes[a] < quotes[b] ? a : b);
|
14434 | product = product.replace(new RegExp(quoteChar, "g"), replacements[quoteChar]);
|
14435 | return quoteChar + product + quoteChar;
|
14436 | }
|
14437 | function serializeObject(value2) {
|
14438 | if (stack.indexOf(value2) >= 0) {
|
14439 | throw TypeError("Converting circular structure to JSON5");
|
14440 | }
|
14441 | stack.push(value2);
|
14442 | let stepback = indent;
|
14443 | indent = indent + gap;
|
14444 | let keys = propertyList || Object.keys(value2);
|
14445 | let partial = [];
|
14446 | for (const key of keys) {
|
14447 | const propertyString = serializeProperty(key, value2);
|
14448 | if (propertyString !== void 0) {
|
14449 | let member = serializeKey(key) + ":";
|
14450 | if (gap !== "") {
|
14451 | member += " ";
|
14452 | }
|
14453 | member += propertyString;
|
14454 | partial.push(member);
|
14455 | }
|
14456 | }
|
14457 | let final;
|
14458 | if (partial.length === 0) {
|
14459 | final = "{}";
|
14460 | } else {
|
14461 | let properties;
|
14462 | if (gap === "") {
|
14463 | properties = partial.join(",");
|
14464 | final = "{" + properties + "}";
|
14465 | } else {
|
14466 | let separator = ",\n" + indent;
|
14467 | properties = partial.join(separator);
|
14468 | final = "{\n" + indent + properties + ",\n" + stepback + "}";
|
14469 | }
|
14470 | }
|
14471 | stack.pop();
|
14472 | indent = stepback;
|
14473 | return final;
|
14474 | }
|
14475 | function serializeKey(key) {
|
14476 | if (key.length === 0) {
|
14477 | return quoteString(key, true);
|
14478 | }
|
14479 | const firstChar = String.fromCodePoint(key.codePointAt(0));
|
14480 | if (!util.isIdStartChar(firstChar)) {
|
14481 | return quoteString(key, true);
|
14482 | }
|
14483 | for (let i = firstChar.length; i < key.length; i++) {
|
14484 | if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
|
14485 | return quoteString(key, true);
|
14486 | }
|
14487 | }
|
14488 | return key;
|
14489 | }
|
14490 | function serializeArray(value2) {
|
14491 | if (stack.indexOf(value2) >= 0) {
|
14492 | throw TypeError("Converting circular structure to JSON5");
|
14493 | }
|
14494 | stack.push(value2);
|
14495 | let stepback = indent;
|
14496 | indent = indent + gap;
|
14497 | let partial = [];
|
14498 | for (let i = 0; i < value2.length; i++) {
|
14499 | const propertyString = serializeProperty(String(i), value2);
|
14500 | partial.push(propertyString !== void 0 ? propertyString : "null");
|
14501 | }
|
14502 | let final;
|
14503 | if (partial.length === 0) {
|
14504 | final = "[]";
|
14505 | } else {
|
14506 | if (gap === "") {
|
14507 | let properties = partial.join(",");
|
14508 | final = "[" + properties + "]";
|
14509 | } else {
|
14510 | let separator = ",\n" + indent;
|
14511 | let properties = partial.join(separator);
|
14512 | final = "[\n" + indent + properties + ",\n" + stepback + "]";
|
14513 | }
|
14514 | }
|
14515 | stack.pop();
|
14516 | indent = stepback;
|
14517 | return final;
|
14518 | }
|
14519 | };
|
14520 | }
|
14521 | });
|
14522 | var require_lib6 = __commonJS2({
|
14523 | "node_modules/json5/lib/index.js"(exports2, module2) {
|
14524 | var parse = require_parse3();
|
14525 | var stringify = require_stringify2();
|
14526 | var JSON5 = {
|
14527 | parse,
|
14528 | stringify
|
14529 | };
|
14530 | module2.exports = JSON5;
|
14531 | }
|
14532 | });
|
14533 | var require_load_json5 = __commonJS2({
|
14534 | "src/utils/load-json5.js"(exports2, module2) {
|
14535 | "use strict";
|
14536 | var {
|
14537 | parse
|
14538 | } = require_lib6();
|
14539 | module2.exports = function(filePath, content) {
|
14540 | try {
|
14541 | return parse(content);
|
14542 | } catch (error) {
|
14543 | error.message = `JSON5 Error in ${filePath}:
|
14544 | ${error.message}`;
|
14545 | throw error;
|
14546 | }
|
14547 | };
|
14548 | }
|
14549 | });
|
14550 | var require_partition = __commonJS2({
|
14551 | "src/utils/partition.js"(exports2, module2) {
|
14552 | "use strict";
|
14553 | function partition(array, predicate) {
|
14554 | const result = [[], []];
|
14555 | for (const value of array) {
|
14556 | result[predicate(value) ? 0 : 1].push(value);
|
14557 | }
|
14558 | return result;
|
14559 | }
|
14560 | module2.exports = partition;
|
14561 | }
|
14562 | });
|
14563 | var require_homedir = __commonJS2({
|
14564 | "node_modules/resolve/lib/homedir.js"(exports2, module2) {
|
14565 | "use strict";
|
14566 | var os = require("os");
|
14567 | module2.exports = os.homedir || function homedir() {
|
14568 | var home = process.env.HOME;
|
14569 | var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
|
14570 | if (process.platform === "win32") {
|
14571 | return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
|
14572 | }
|
14573 | if (process.platform === "darwin") {
|
14574 | return home || (user ? "/Users/" + user : null);
|
14575 | }
|
14576 | if (process.platform === "linux") {
|
14577 | return home || (process.getuid() === 0 ? "/root" : user ? "/home/" + user : null);
|
14578 | }
|
14579 | return home || null;
|
14580 | };
|
14581 | }
|
14582 | });
|
14583 | var require_caller = __commonJS2({
|
14584 | "node_modules/resolve/lib/caller.js"(exports2, module2) {
|
14585 | module2.exports = function() {
|
14586 | var origPrepareStackTrace = Error.prepareStackTrace;
|
14587 | Error.prepareStackTrace = function(_, stack2) {
|
14588 | return stack2;
|
14589 | };
|
14590 | var stack = new Error().stack;
|
14591 | Error.prepareStackTrace = origPrepareStackTrace;
|
14592 | return stack[2].getFileName();
|
14593 | };
|
14594 | }
|
14595 | });
|
14596 | var require_path_parse = __commonJS2({
|
14597 | "node_modules/path-parse/index.js"(exports2, module2) {
|
14598 | "use strict";
|
14599 | var isWindows = process.platform === "win32";
|
14600 | var splitWindowsRe = /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/;
|
14601 | var win32 = {};
|
14602 | function win32SplitPath(filename) {
|
14603 | return splitWindowsRe.exec(filename).slice(1);
|
14604 | }
|
14605 | win32.parse = function(pathString) {
|
14606 | if (typeof pathString !== "string") {
|
14607 | throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
|
14608 | }
|
14609 | var allParts = win32SplitPath(pathString);
|
14610 | if (!allParts || allParts.length !== 5) {
|
14611 | throw new TypeError("Invalid path '" + pathString + "'");
|
14612 | }
|
14613 | return {
|
14614 | root: allParts[1],
|
14615 | dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1),
|
14616 | base: allParts[2],
|
14617 | ext: allParts[4],
|
14618 | name: allParts[3]
|
14619 | };
|
14620 | };
|
14621 | var splitPathRe = /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/;
|
14622 | var posix = {};
|
14623 | function posixSplitPath(filename) {
|
14624 | return splitPathRe.exec(filename).slice(1);
|
14625 | }
|
14626 | posix.parse = function(pathString) {
|
14627 | if (typeof pathString !== "string") {
|
14628 | throw new TypeError("Parameter 'pathString' must be a string, not " + typeof pathString);
|
14629 | }
|
14630 | var allParts = posixSplitPath(pathString);
|
14631 | if (!allParts || allParts.length !== 5) {
|
14632 | throw new TypeError("Invalid path '" + pathString + "'");
|
14633 | }
|
14634 | return {
|
14635 | root: allParts[1],
|
14636 | dir: allParts[0].slice(0, -1),
|
14637 | base: allParts[2],
|
14638 | ext: allParts[4],
|
14639 | name: allParts[3]
|
14640 | };
|
14641 | };
|
14642 | if (isWindows)
|
14643 | module2.exports = win32.parse;
|
14644 | else
|
14645 | module2.exports = posix.parse;
|
14646 | module2.exports.posix = posix.parse;
|
14647 | module2.exports.win32 = win32.parse;
|
14648 | }
|
14649 | });
|
14650 | var require_node_modules_paths = __commonJS2({
|
14651 | "node_modules/resolve/lib/node-modules-paths.js"(exports2, module2) {
|
14652 | var path = require("path");
|
14653 | var parse = path.parse || require_path_parse();
|
14654 | var getNodeModulesDirs = function getNodeModulesDirs2(absoluteStart, modules) {
|
14655 | var prefix = "/";
|
14656 | if (/^([A-Za-z]:)/.test(absoluteStart)) {
|
14657 | prefix = "";
|
14658 | } else if (/^\\\\/.test(absoluteStart)) {
|
14659 | prefix = "\\\\";
|
14660 | }
|
14661 | var paths = [absoluteStart];
|
14662 | var parsed = parse(absoluteStart);
|
14663 | while (parsed.dir !== paths[paths.length - 1]) {
|
14664 | paths.push(parsed.dir);
|
14665 | parsed = parse(parsed.dir);
|
14666 | }
|
14667 | return paths.reduce(function(dirs, aPath) {
|
14668 | return dirs.concat(modules.map(function(moduleDir) {
|
14669 | return path.resolve(prefix, aPath, moduleDir);
|
14670 | }));
|
14671 | }, []);
|
14672 | };
|
14673 | module2.exports = function nodeModulesPaths(start, opts, request) {
|
14674 | var modules = opts && opts.moduleDirectory ? [].concat(opts.moduleDirectory) : ["node_modules"];
|
14675 | if (opts && typeof opts.paths === "function") {
|
14676 | return opts.paths(request, start, function() {
|
14677 | return getNodeModulesDirs(start, modules);
|
14678 | }, opts);
|
14679 | }
|
14680 | var dirs = getNodeModulesDirs(start, modules);
|
14681 | return opts && opts.paths ? dirs.concat(opts.paths) : dirs;
|
14682 | };
|
14683 | }
|
14684 | });
|
14685 | var require_normalize_options = __commonJS2({
|
14686 | "node_modules/resolve/lib/normalize-options.js"(exports2, module2) {
|
14687 | module2.exports = function(x, opts) {
|
14688 | return opts || {};
|
14689 | };
|
14690 | }
|
14691 | });
|
14692 | var require_implementation = __commonJS2({
|
14693 | "node_modules/function-bind/implementation.js"(exports2, module2) {
|
14694 | "use strict";
|
14695 | var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
14696 | var slice = Array.prototype.slice;
|
14697 | var toStr = Object.prototype.toString;
|
14698 | var funcType = "[object Function]";
|
14699 | module2.exports = function bind(that) {
|
14700 | var target = this;
|
14701 | if (typeof target !== "function" || toStr.call(target) !== funcType) {
|
14702 | throw new TypeError(ERROR_MESSAGE + target);
|
14703 | }
|
14704 | var args = slice.call(arguments, 1);
|
14705 | var bound;
|
14706 | var binder = function() {
|
14707 | if (this instanceof bound) {
|
14708 | var result = target.apply(this, args.concat(slice.call(arguments)));
|
14709 | if (Object(result) === result) {
|
14710 | return result;
|
14711 | }
|
14712 | return this;
|
14713 | } else {
|
14714 | return target.apply(that, args.concat(slice.call(arguments)));
|
14715 | }
|
14716 | };
|
14717 | var boundLength = Math.max(0, target.length - args.length);
|
14718 | var boundArgs = [];
|
14719 | for (var i = 0; i < boundLength; i++) {
|
14720 | boundArgs.push("$" + i);
|
14721 | }
|
14722 | bound = Function("binder", "return function (" + boundArgs.join(",") + "){ return binder.apply(this,arguments); }")(binder);
|
14723 | if (target.prototype) {
|
14724 | var Empty = function Empty2() {
|
14725 | };
|
14726 | Empty.prototype = target.prototype;
|
14727 | bound.prototype = new Empty();
|
14728 | Empty.prototype = null;
|
14729 | }
|
14730 | return bound;
|
14731 | };
|
14732 | }
|
14733 | });
|
14734 | var require_function_bind = __commonJS2({
|
14735 | "node_modules/function-bind/index.js"(exports2, module2) {
|
14736 | "use strict";
|
14737 | var implementation = require_implementation();
|
14738 | module2.exports = Function.prototype.bind || implementation;
|
14739 | }
|
14740 | });
|
14741 | var require_src = __commonJS2({
|
14742 | "node_modules/has/src/index.js"(exports2, module2) {
|
14743 | "use strict";
|
14744 | var bind = require_function_bind();
|
14745 | module2.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
14746 | }
|
14747 | });
|
14748 | var require_core2 = __commonJS2({
|
14749 | "node_modules/is-core-module/core.json"(exports2, module2) {
|
14750 | module2.exports = {
|
14751 | assert: true,
|
14752 | "node:assert": [">= 14.18 && < 15", ">= 16"],
|
14753 | "assert/strict": ">= 15",
|
14754 | "node:assert/strict": ">= 16",
|
14755 | async_hooks: ">= 8",
|
14756 | "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
|
14757 | buffer_ieee754: ">= 0.5 && < 0.9.7",
|
14758 | buffer: true,
|
14759 | "node:buffer": [">= 14.18 && < 15", ">= 16"],
|
14760 | child_process: true,
|
14761 | "node:child_process": [">= 14.18 && < 15", ">= 16"],
|
14762 | cluster: ">= 0.5",
|
14763 | "node:cluster": [">= 14.18 && < 15", ">= 16"],
|
14764 | console: true,
|
14765 | "node:console": [">= 14.18 && < 15", ">= 16"],
|
14766 | constants: true,
|
14767 | "node:constants": [">= 14.18 && < 15", ">= 16"],
|
14768 | crypto: true,
|
14769 | "node:crypto": [">= 14.18 && < 15", ">= 16"],
|
14770 | _debug_agent: ">= 1 && < 8",
|
14771 | _debugger: "< 8",
|
14772 | dgram: true,
|
14773 | "node:dgram": [">= 14.18 && < 15", ">= 16"],
|
14774 | diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
|
14775 | "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
|
14776 | dns: true,
|
14777 | "node:dns": [">= 14.18 && < 15", ">= 16"],
|
14778 | "dns/promises": ">= 15",
|
14779 | "node:dns/promises": ">= 16",
|
14780 | domain: ">= 0.7.12",
|
14781 | "node:domain": [">= 14.18 && < 15", ">= 16"],
|
14782 | events: true,
|
14783 | "node:events": [">= 14.18 && < 15", ">= 16"],
|
14784 | freelist: "< 6",
|
14785 | fs: true,
|
14786 | "node:fs": [">= 14.18 && < 15", ">= 16"],
|
14787 | "fs/promises": [">= 10 && < 10.1", ">= 14"],
|
14788 | "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
|
14789 | _http_agent: ">= 0.11.1",
|
14790 | "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
|
14791 | _http_client: ">= 0.11.1",
|
14792 | "node:_http_client": [">= 14.18 && < 15", ">= 16"],
|
14793 | _http_common: ">= 0.11.1",
|
14794 | "node:_http_common": [">= 14.18 && < 15", ">= 16"],
|
14795 | _http_incoming: ">= 0.11.1",
|
14796 | "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
|
14797 | _http_outgoing: ">= 0.11.1",
|
14798 | "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
|
14799 | _http_server: ">= 0.11.1",
|
14800 | "node:_http_server": [">= 14.18 && < 15", ">= 16"],
|
14801 | http: true,
|
14802 | "node:http": [">= 14.18 && < 15", ">= 16"],
|
14803 | http2: ">= 8.8",
|
14804 | "node:http2": [">= 14.18 && < 15", ">= 16"],
|
14805 | https: true,
|
14806 | "node:https": [">= 14.18 && < 15", ">= 16"],
|
14807 | inspector: ">= 8",
|
14808 | "node:inspector": [">= 14.18 && < 15", ">= 16"],
|
14809 | _linklist: "< 8",
|
14810 | module: true,
|
14811 | "node:module": [">= 14.18 && < 15", ">= 16"],
|
14812 | net: true,
|
14813 | "node:net": [">= 14.18 && < 15", ">= 16"],
|
14814 | "node-inspect/lib/_inspect": ">= 7.6 && < 12",
|
14815 | "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
|
14816 | "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
|
14817 | os: true,
|
14818 | "node:os": [">= 14.18 && < 15", ">= 16"],
|
14819 | path: true,
|
14820 | "node:path": [">= 14.18 && < 15", ">= 16"],
|
14821 | "path/posix": ">= 15.3",
|
14822 | "node:path/posix": ">= 16",
|
14823 | "path/win32": ">= 15.3",
|
14824 | "node:path/win32": ">= 16",
|
14825 | perf_hooks: ">= 8.5",
|
14826 | "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
|
14827 | process: ">= 1",
|
14828 | "node:process": [">= 14.18 && < 15", ">= 16"],
|
14829 | punycode: ">= 0.5",
|
14830 | "node:punycode": [">= 14.18 && < 15", ">= 16"],
|
14831 | querystring: true,
|
14832 | "node:querystring": [">= 14.18 && < 15", ">= 16"],
|
14833 | readline: true,
|
14834 | "node:readline": [">= 14.18 && < 15", ">= 16"],
|
14835 | "readline/promises": ">= 17",
|
14836 | "node:readline/promises": ">= 17",
|
14837 | repl: true,
|
14838 | "node:repl": [">= 14.18 && < 15", ">= 16"],
|
14839 | smalloc: ">= 0.11.5 && < 3",
|
14840 | _stream_duplex: ">= 0.9.4",
|
14841 | "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
|
14842 | _stream_transform: ">= 0.9.4",
|
14843 | "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
|
14844 | _stream_wrap: ">= 1.4.1",
|
14845 | "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
|
14846 | _stream_passthrough: ">= 0.9.4",
|
14847 | "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
|
14848 | _stream_readable: ">= 0.9.4",
|
14849 | "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
|
14850 | _stream_writable: ">= 0.9.4",
|
14851 | "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
|
14852 | stream: true,
|
14853 | "node:stream": [">= 14.18 && < 15", ">= 16"],
|
14854 | "stream/consumers": ">= 16.7",
|
14855 | "node:stream/consumers": ">= 16.7",
|
14856 | "stream/promises": ">= 15",
|
14857 | "node:stream/promises": ">= 16",
|
14858 | "stream/web": ">= 16.5",
|
14859 | "node:stream/web": ">= 16.5",
|
14860 | string_decoder: true,
|
14861 | "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
|
14862 | sys: [">= 0.4 && < 0.7", ">= 0.8"],
|
14863 | "node:sys": [">= 14.18 && < 15", ">= 16"],
|
14864 | timers: true,
|
14865 | "node:timers": [">= 14.18 && < 15", ">= 16"],
|
14866 | "timers/promises": ">= 15",
|
14867 | "node:timers/promises": ">= 16",
|
14868 | _tls_common: ">= 0.11.13",
|
14869 | "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
|
14870 | _tls_legacy: ">= 0.11.3 && < 10",
|
14871 | _tls_wrap: ">= 0.11.3",
|
14872 | "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
|
14873 | tls: true,
|
14874 | "node:tls": [">= 14.18 && < 15", ">= 16"],
|
14875 | trace_events: ">= 10",
|
14876 | "node:trace_events": [">= 14.18 && < 15", ">= 16"],
|
14877 | tty: true,
|
14878 | "node:tty": [">= 14.18 && < 15", ">= 16"],
|
14879 | url: true,
|
14880 | "node:url": [">= 14.18 && < 15", ">= 16"],
|
14881 | util: true,
|
14882 | "node:util": [">= 14.18 && < 15", ">= 16"],
|
14883 | "util/types": ">= 15.3",
|
14884 | "node:util/types": ">= 16",
|
14885 | "v8/tools/arguments": ">= 10 && < 12",
|
14886 | "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14887 | "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14888 | "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14889 | "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14890 | "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14891 | "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
14892 | v8: ">= 1",
|
14893 | "node:v8": [">= 14.18 && < 15", ">= 16"],
|
14894 | vm: true,
|
14895 | "node:vm": [">= 14.18 && < 15", ">= 16"],
|
14896 | wasi: ">= 13.4 && < 13.5",
|
14897 | worker_threads: ">= 11.7",
|
14898 | "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
|
14899 | zlib: ">= 0.5",
|
14900 | "node:zlib": [">= 14.18 && < 15", ">= 16"]
|
14901 | };
|
14902 | }
|
14903 | });
|
14904 | var require_is_core_module = __commonJS2({
|
14905 | "node_modules/is-core-module/index.js"(exports2, module2) {
|
14906 | "use strict";
|
14907 | var has = require_src();
|
14908 | function specifierIncluded(current, specifier) {
|
14909 | var nodeParts = current.split(".");
|
14910 | var parts = specifier.split(" ");
|
14911 | var op = parts.length > 1 ? parts[0] : "=";
|
14912 | var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
|
14913 | for (var i = 0; i < 3; ++i) {
|
14914 | var cur = parseInt(nodeParts[i] || 0, 10);
|
14915 | var ver = parseInt(versionParts[i] || 0, 10);
|
14916 | if (cur === ver) {
|
14917 | continue;
|
14918 | }
|
14919 | if (op === "<") {
|
14920 | return cur < ver;
|
14921 | }
|
14922 | if (op === ">=") {
|
14923 | return cur >= ver;
|
14924 | }
|
14925 | return false;
|
14926 | }
|
14927 | return op === ">=";
|
14928 | }
|
14929 | function matchesRange(current, range) {
|
14930 | var specifiers = range.split(/ ?&& ?/);
|
14931 | if (specifiers.length === 0) {
|
14932 | return false;
|
14933 | }
|
14934 | for (var i = 0; i < specifiers.length; ++i) {
|
14935 | if (!specifierIncluded(current, specifiers[i])) {
|
14936 | return false;
|
14937 | }
|
14938 | }
|
14939 | return true;
|
14940 | }
|
14941 | function versionIncluded(nodeVersion, specifierValue) {
|
14942 | if (typeof specifierValue === "boolean") {
|
14943 | return specifierValue;
|
14944 | }
|
14945 | var current = typeof nodeVersion === "undefined" ? process.versions && process.versions.node : nodeVersion;
|
14946 | if (typeof current !== "string") {
|
14947 | throw new TypeError(typeof nodeVersion === "undefined" ? "Unable to determine current node version" : "If provided, a valid node version is required");
|
14948 | }
|
14949 | if (specifierValue && typeof specifierValue === "object") {
|
14950 | for (var i = 0; i < specifierValue.length; ++i) {
|
14951 | if (matchesRange(current, specifierValue[i])) {
|
14952 | return true;
|
14953 | }
|
14954 | }
|
14955 | return false;
|
14956 | }
|
14957 | return matchesRange(current, specifierValue);
|
14958 | }
|
14959 | var data = require_core2();
|
14960 | module2.exports = function isCore(x, nodeVersion) {
|
14961 | return has(data, x) && versionIncluded(nodeVersion, data[x]);
|
14962 | };
|
14963 | }
|
14964 | });
|
14965 | var require_async = __commonJS2({
|
14966 | "node_modules/resolve/lib/async.js"(exports2, module2) {
|
14967 | var fs = require("fs");
|
14968 | var getHomedir = require_homedir();
|
14969 | var path = require("path");
|
14970 | var caller = require_caller();
|
14971 | var nodeModulesPaths = require_node_modules_paths();
|
14972 | var normalizeOptions = require_normalize_options();
|
14973 | var isCore = require_is_core_module();
|
14974 | var realpathFS = fs.realpath && typeof fs.realpath.native === "function" ? fs.realpath.native : fs.realpath;
|
14975 | var homedir = getHomedir();
|
14976 | var defaultPaths = function() {
|
14977 | return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
|
14978 | };
|
14979 | var defaultIsFile = function isFile(file, cb) {
|
14980 | fs.stat(file, function(err, stat) {
|
14981 | if (!err) {
|
14982 | return cb(null, stat.isFile() || stat.isFIFO());
|
14983 | }
|
14984 | if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
14985 | return cb(null, false);
|
14986 | return cb(err);
|
14987 | });
|
14988 | };
|
14989 | var defaultIsDir = function isDirectory(dir, cb) {
|
14990 | fs.stat(dir, function(err, stat) {
|
14991 | if (!err) {
|
14992 | return cb(null, stat.isDirectory());
|
14993 | }
|
14994 | if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
14995 | return cb(null, false);
|
14996 | return cb(err);
|
14997 | });
|
14998 | };
|
14999 | var defaultRealpath = function realpath(x, cb) {
|
15000 | realpathFS(x, function(realpathErr, realPath) {
|
15001 | if (realpathErr && realpathErr.code !== "ENOENT")
|
15002 | cb(realpathErr);
|
15003 | else
|
15004 | cb(null, realpathErr ? x : realPath);
|
15005 | });
|
15006 | };
|
15007 | var maybeRealpath = function maybeRealpath2(realpath, x, opts, cb) {
|
15008 | if (opts && opts.preserveSymlinks === false) {
|
15009 | realpath(x, cb);
|
15010 | } else {
|
15011 | cb(null, x);
|
15012 | }
|
15013 | };
|
15014 | var defaultReadPackage = function defaultReadPackage2(readFile, pkgfile, cb) {
|
15015 | readFile(pkgfile, function(readFileErr, body) {
|
15016 | if (readFileErr)
|
15017 | cb(readFileErr);
|
15018 | else {
|
15019 | try {
|
15020 | var pkg = JSON.parse(body);
|
15021 | cb(null, pkg);
|
15022 | } catch (jsonErr) {
|
15023 | cb(null);
|
15024 | }
|
15025 | }
|
15026 | });
|
15027 | };
|
15028 | var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
|
15029 | var dirs = nodeModulesPaths(start, opts, x);
|
15030 | for (var i = 0; i < dirs.length; i++) {
|
15031 | dirs[i] = path.join(dirs[i], x);
|
15032 | }
|
15033 | return dirs;
|
15034 | };
|
15035 | module2.exports = function resolve(x, options, callback) {
|
15036 | var cb = callback;
|
15037 | var opts = options;
|
15038 | if (typeof options === "function") {
|
15039 | cb = opts;
|
15040 | opts = {};
|
15041 | }
|
15042 | if (typeof x !== "string") {
|
15043 | var err = new TypeError("Path must be a string.");
|
15044 | return process.nextTick(function() {
|
15045 | cb(err);
|
15046 | });
|
15047 | }
|
15048 | opts = normalizeOptions(x, opts);
|
15049 | var isFile = opts.isFile || defaultIsFile;
|
15050 | var isDirectory = opts.isDirectory || defaultIsDir;
|
15051 | var readFile = opts.readFile || fs.readFile;
|
15052 | var realpath = opts.realpath || defaultRealpath;
|
15053 | var readPackage = opts.readPackage || defaultReadPackage;
|
15054 | if (opts.readFile && opts.readPackage) {
|
15055 | var conflictErr = new TypeError("`readFile` and `readPackage` are mutually exclusive.");
|
15056 | return process.nextTick(function() {
|
15057 | cb(conflictErr);
|
15058 | });
|
15059 | }
|
15060 | var packageIterator = opts.packageIterator;
|
15061 | var extensions = opts.extensions || [".js"];
|
15062 | var includeCoreModules = opts.includeCoreModules !== false;
|
15063 | var basedir = opts.basedir || path.dirname(caller());
|
15064 | var parent = opts.filename || basedir;
|
15065 | opts.paths = opts.paths || defaultPaths();
|
15066 | var absoluteStart = path.resolve(basedir);
|
15067 | maybeRealpath(realpath, absoluteStart, opts, function(err2, realStart) {
|
15068 | if (err2)
|
15069 | cb(err2);
|
15070 | else
|
15071 | init(realStart);
|
15072 | });
|
15073 | var res;
|
15074 | function init(basedir2) {
|
15075 | if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
15076 | res = path.resolve(basedir2, x);
|
15077 | if (x === "." || x === ".." || x.slice(-1) === "/")
|
15078 | res += "/";
|
15079 | if (/\/$/.test(x) && res === basedir2) {
|
15080 | loadAsDirectory(res, opts.package, onfile);
|
15081 | } else
|
15082 | loadAsFile(res, opts.package, onfile);
|
15083 | } else if (includeCoreModules && isCore(x)) {
|
15084 | return cb(null, x);
|
15085 | } else
|
15086 | loadNodeModules(x, basedir2, function(err2, n, pkg) {
|
15087 | if (err2)
|
15088 | cb(err2);
|
15089 | else if (n) {
|
15090 | return maybeRealpath(realpath, n, opts, function(err3, realN) {
|
15091 | if (err3) {
|
15092 | cb(err3);
|
15093 | } else {
|
15094 | cb(null, realN, pkg);
|
15095 | }
|
15096 | });
|
15097 | } else {
|
15098 | var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
15099 | moduleError.code = "MODULE_NOT_FOUND";
|
15100 | cb(moduleError);
|
15101 | }
|
15102 | });
|
15103 | }
|
15104 | function onfile(err2, m, pkg) {
|
15105 | if (err2)
|
15106 | cb(err2);
|
15107 | else if (m)
|
15108 | cb(null, m, pkg);
|
15109 | else
|
15110 | loadAsDirectory(res, function(err3, d, pkg2) {
|
15111 | if (err3)
|
15112 | cb(err3);
|
15113 | else if (d) {
|
15114 | maybeRealpath(realpath, d, opts, function(err4, realD) {
|
15115 | if (err4) {
|
15116 | cb(err4);
|
15117 | } else {
|
15118 | cb(null, realD, pkg2);
|
15119 | }
|
15120 | });
|
15121 | } else {
|
15122 | var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
15123 | moduleError.code = "MODULE_NOT_FOUND";
|
15124 | cb(moduleError);
|
15125 | }
|
15126 | });
|
15127 | }
|
15128 | function loadAsFile(x2, thePackage, callback2) {
|
15129 | var loadAsFilePackage = thePackage;
|
15130 | var cb2 = callback2;
|
15131 | if (typeof loadAsFilePackage === "function") {
|
15132 | cb2 = loadAsFilePackage;
|
15133 | loadAsFilePackage = void 0;
|
15134 | }
|
15135 | var exts = [""].concat(extensions);
|
15136 | load(exts, x2, loadAsFilePackage);
|
15137 | function load(exts2, x3, loadPackage) {
|
15138 | if (exts2.length === 0)
|
15139 | return cb2(null, void 0, loadPackage);
|
15140 | var file = x3 + exts2[0];
|
15141 | var pkg = loadPackage;
|
15142 | if (pkg)
|
15143 | onpkg(null, pkg);
|
15144 | else
|
15145 | loadpkg(path.dirname(file), onpkg);
|
15146 | function onpkg(err2, pkg_, dir) {
|
15147 | pkg = pkg_;
|
15148 | if (err2)
|
15149 | return cb2(err2);
|
15150 | if (dir && pkg && opts.pathFilter) {
|
15151 | var rfile = path.relative(dir, file);
|
15152 | var rel = rfile.slice(0, rfile.length - exts2[0].length);
|
15153 | var r = opts.pathFilter(pkg, x3, rel);
|
15154 | if (r)
|
15155 | return load([""].concat(extensions.slice()), path.resolve(dir, r), pkg);
|
15156 | }
|
15157 | isFile(file, onex);
|
15158 | }
|
15159 | function onex(err2, ex) {
|
15160 | if (err2)
|
15161 | return cb2(err2);
|
15162 | if (ex)
|
15163 | return cb2(null, file, pkg);
|
15164 | load(exts2.slice(1), x3, pkg);
|
15165 | }
|
15166 | }
|
15167 | }
|
15168 | function loadpkg(dir, cb2) {
|
15169 | if (dir === "" || dir === "/")
|
15170 | return cb2(null);
|
15171 | if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
|
15172 | return cb2(null);
|
15173 | }
|
15174 | if (/[/\\]node_modules[/\\]*$/.test(dir))
|
15175 | return cb2(null);
|
15176 | maybeRealpath(realpath, dir, opts, function(unwrapErr, pkgdir) {
|
15177 | if (unwrapErr)
|
15178 | return loadpkg(path.dirname(dir), cb2);
|
15179 | var pkgfile = path.join(pkgdir, "package.json");
|
15180 | isFile(pkgfile, function(err2, ex) {
|
15181 | if (!ex)
|
15182 | return loadpkg(path.dirname(dir), cb2);
|
15183 | readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
15184 | if (err3)
|
15185 | cb2(err3);
|
15186 | var pkg = pkgParam;
|
15187 | if (pkg && opts.packageFilter) {
|
15188 | pkg = opts.packageFilter(pkg, pkgfile);
|
15189 | }
|
15190 | cb2(null, pkg, dir);
|
15191 | });
|
15192 | });
|
15193 | });
|
15194 | }
|
15195 | function loadAsDirectory(x2, loadAsDirectoryPackage, callback2) {
|
15196 | var cb2 = callback2;
|
15197 | var fpkg = loadAsDirectoryPackage;
|
15198 | if (typeof fpkg === "function") {
|
15199 | cb2 = fpkg;
|
15200 | fpkg = opts.package;
|
15201 | }
|
15202 | maybeRealpath(realpath, x2, opts, function(unwrapErr, pkgdir) {
|
15203 | if (unwrapErr)
|
15204 | return cb2(unwrapErr);
|
15205 | var pkgfile = path.join(pkgdir, "package.json");
|
15206 | isFile(pkgfile, function(err2, ex) {
|
15207 | if (err2)
|
15208 | return cb2(err2);
|
15209 | if (!ex)
|
15210 | return loadAsFile(path.join(x2, "index"), fpkg, cb2);
|
15211 | readPackage(readFile, pkgfile, function(err3, pkgParam) {
|
15212 | if (err3)
|
15213 | return cb2(err3);
|
15214 | var pkg = pkgParam;
|
15215 | if (pkg && opts.packageFilter) {
|
15216 | pkg = opts.packageFilter(pkg, pkgfile);
|
15217 | }
|
15218 | if (pkg && pkg.main) {
|
15219 | if (typeof pkg.main !== "string") {
|
15220 | var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
|
15221 | mainError.code = "INVALID_PACKAGE_MAIN";
|
15222 | return cb2(mainError);
|
15223 | }
|
15224 | if (pkg.main === "." || pkg.main === "./") {
|
15225 | pkg.main = "index";
|
15226 | }
|
15227 | loadAsFile(path.resolve(x2, pkg.main), pkg, function(err4, m, pkg2) {
|
15228 | if (err4)
|
15229 | return cb2(err4);
|
15230 | if (m)
|
15231 | return cb2(null, m, pkg2);
|
15232 | if (!pkg2)
|
15233 | return loadAsFile(path.join(x2, "index"), pkg2, cb2);
|
15234 | var dir = path.resolve(x2, pkg2.main);
|
15235 | loadAsDirectory(dir, pkg2, function(err5, n, pkg3) {
|
15236 | if (err5)
|
15237 | return cb2(err5);
|
15238 | if (n)
|
15239 | return cb2(null, n, pkg3);
|
15240 | loadAsFile(path.join(x2, "index"), pkg3, cb2);
|
15241 | });
|
15242 | });
|
15243 | return;
|
15244 | }
|
15245 | loadAsFile(path.join(x2, "/index"), pkg, cb2);
|
15246 | });
|
15247 | });
|
15248 | });
|
15249 | }
|
15250 | function processDirs(cb2, dirs) {
|
15251 | if (dirs.length === 0)
|
15252 | return cb2(null, void 0);
|
15253 | var dir = dirs[0];
|
15254 | isDirectory(path.dirname(dir), isdir);
|
15255 | function isdir(err2, isdir2) {
|
15256 | if (err2)
|
15257 | return cb2(err2);
|
15258 | if (!isdir2)
|
15259 | return processDirs(cb2, dirs.slice(1));
|
15260 | loadAsFile(dir, opts.package, onfile2);
|
15261 | }
|
15262 | function onfile2(err2, m, pkg) {
|
15263 | if (err2)
|
15264 | return cb2(err2);
|
15265 | if (m)
|
15266 | return cb2(null, m, pkg);
|
15267 | loadAsDirectory(dir, opts.package, ondir);
|
15268 | }
|
15269 | function ondir(err2, n, pkg) {
|
15270 | if (err2)
|
15271 | return cb2(err2);
|
15272 | if (n)
|
15273 | return cb2(null, n, pkg);
|
15274 | processDirs(cb2, dirs.slice(1));
|
15275 | }
|
15276 | }
|
15277 | function loadNodeModules(x2, start, cb2) {
|
15278 | var thunk = function() {
|
15279 | return getPackageCandidates(x2, start, opts);
|
15280 | };
|
15281 | processDirs(cb2, packageIterator ? packageIterator(x2, start, thunk, opts) : thunk());
|
15282 | }
|
15283 | };
|
15284 | }
|
15285 | });
|
15286 | var require_core3 = __commonJS2({
|
15287 | "node_modules/resolve/lib/core.json"(exports2, module2) {
|
15288 | module2.exports = {
|
15289 | assert: true,
|
15290 | "node:assert": [">= 14.18 && < 15", ">= 16"],
|
15291 | "assert/strict": ">= 15",
|
15292 | "node:assert/strict": ">= 16",
|
15293 | async_hooks: ">= 8",
|
15294 | "node:async_hooks": [">= 14.18 && < 15", ">= 16"],
|
15295 | buffer_ieee754: ">= 0.5 && < 0.9.7",
|
15296 | buffer: true,
|
15297 | "node:buffer": [">= 14.18 && < 15", ">= 16"],
|
15298 | child_process: true,
|
15299 | "node:child_process": [">= 14.18 && < 15", ">= 16"],
|
15300 | cluster: ">= 0.5",
|
15301 | "node:cluster": [">= 14.18 && < 15", ">= 16"],
|
15302 | console: true,
|
15303 | "node:console": [">= 14.18 && < 15", ">= 16"],
|
15304 | constants: true,
|
15305 | "node:constants": [">= 14.18 && < 15", ">= 16"],
|
15306 | crypto: true,
|
15307 | "node:crypto": [">= 14.18 && < 15", ">= 16"],
|
15308 | _debug_agent: ">= 1 && < 8",
|
15309 | _debugger: "< 8",
|
15310 | dgram: true,
|
15311 | "node:dgram": [">= 14.18 && < 15", ">= 16"],
|
15312 | diagnostics_channel: [">= 14.17 && < 15", ">= 15.1"],
|
15313 | "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"],
|
15314 | dns: true,
|
15315 | "node:dns": [">= 14.18 && < 15", ">= 16"],
|
15316 | "dns/promises": ">= 15",
|
15317 | "node:dns/promises": ">= 16",
|
15318 | domain: ">= 0.7.12",
|
15319 | "node:domain": [">= 14.18 && < 15", ">= 16"],
|
15320 | events: true,
|
15321 | "node:events": [">= 14.18 && < 15", ">= 16"],
|
15322 | freelist: "< 6",
|
15323 | fs: true,
|
15324 | "node:fs": [">= 14.18 && < 15", ">= 16"],
|
15325 | "fs/promises": [">= 10 && < 10.1", ">= 14"],
|
15326 | "node:fs/promises": [">= 14.18 && < 15", ">= 16"],
|
15327 | _http_agent: ">= 0.11.1",
|
15328 | "node:_http_agent": [">= 14.18 && < 15", ">= 16"],
|
15329 | _http_client: ">= 0.11.1",
|
15330 | "node:_http_client": [">= 14.18 && < 15", ">= 16"],
|
15331 | _http_common: ">= 0.11.1",
|
15332 | "node:_http_common": [">= 14.18 && < 15", ">= 16"],
|
15333 | _http_incoming: ">= 0.11.1",
|
15334 | "node:_http_incoming": [">= 14.18 && < 15", ">= 16"],
|
15335 | _http_outgoing: ">= 0.11.1",
|
15336 | "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"],
|
15337 | _http_server: ">= 0.11.1",
|
15338 | "node:_http_server": [">= 14.18 && < 15", ">= 16"],
|
15339 | http: true,
|
15340 | "node:http": [">= 14.18 && < 15", ">= 16"],
|
15341 | http2: ">= 8.8",
|
15342 | "node:http2": [">= 14.18 && < 15", ">= 16"],
|
15343 | https: true,
|
15344 | "node:https": [">= 14.18 && < 15", ">= 16"],
|
15345 | inspector: ">= 8",
|
15346 | "node:inspector": [">= 14.18 && < 15", ">= 16"],
|
15347 | _linklist: "< 8",
|
15348 | module: true,
|
15349 | "node:module": [">= 14.18 && < 15", ">= 16"],
|
15350 | net: true,
|
15351 | "node:net": [">= 14.18 && < 15", ">= 16"],
|
15352 | "node-inspect/lib/_inspect": ">= 7.6 && < 12",
|
15353 | "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12",
|
15354 | "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12",
|
15355 | os: true,
|
15356 | "node:os": [">= 14.18 && < 15", ">= 16"],
|
15357 | path: true,
|
15358 | "node:path": [">= 14.18 && < 15", ">= 16"],
|
15359 | "path/posix": ">= 15.3",
|
15360 | "node:path/posix": ">= 16",
|
15361 | "path/win32": ">= 15.3",
|
15362 | "node:path/win32": ">= 16",
|
15363 | perf_hooks: ">= 8.5",
|
15364 | "node:perf_hooks": [">= 14.18 && < 15", ">= 16"],
|
15365 | process: ">= 1",
|
15366 | "node:process": [">= 14.18 && < 15", ">= 16"],
|
15367 | punycode: ">= 0.5",
|
15368 | "node:punycode": [">= 14.18 && < 15", ">= 16"],
|
15369 | querystring: true,
|
15370 | "node:querystring": [">= 14.18 && < 15", ">= 16"],
|
15371 | readline: true,
|
15372 | "node:readline": [">= 14.18 && < 15", ">= 16"],
|
15373 | "readline/promises": ">= 17",
|
15374 | "node:readline/promises": ">= 17",
|
15375 | repl: true,
|
15376 | "node:repl": [">= 14.18 && < 15", ">= 16"],
|
15377 | smalloc: ">= 0.11.5 && < 3",
|
15378 | _stream_duplex: ">= 0.9.4",
|
15379 | "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"],
|
15380 | _stream_transform: ">= 0.9.4",
|
15381 | "node:_stream_transform": [">= 14.18 && < 15", ">= 16"],
|
15382 | _stream_wrap: ">= 1.4.1",
|
15383 | "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"],
|
15384 | _stream_passthrough: ">= 0.9.4",
|
15385 | "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"],
|
15386 | _stream_readable: ">= 0.9.4",
|
15387 | "node:_stream_readable": [">= 14.18 && < 15", ">= 16"],
|
15388 | _stream_writable: ">= 0.9.4",
|
15389 | "node:_stream_writable": [">= 14.18 && < 15", ">= 16"],
|
15390 | stream: true,
|
15391 | "node:stream": [">= 14.18 && < 15", ">= 16"],
|
15392 | "stream/consumers": ">= 16.7",
|
15393 | "node:stream/consumers": ">= 16.7",
|
15394 | "stream/promises": ">= 15",
|
15395 | "node:stream/promises": ">= 16",
|
15396 | "stream/web": ">= 16.5",
|
15397 | "node:stream/web": ">= 16.5",
|
15398 | string_decoder: true,
|
15399 | "node:string_decoder": [">= 14.18 && < 15", ">= 16"],
|
15400 | sys: [">= 0.4 && < 0.7", ">= 0.8"],
|
15401 | "node:sys": [">= 14.18 && < 15", ">= 16"],
|
15402 | timers: true,
|
15403 | "node:timers": [">= 14.18 && < 15", ">= 16"],
|
15404 | "timers/promises": ">= 15",
|
15405 | "node:timers/promises": ">= 16",
|
15406 | _tls_common: ">= 0.11.13",
|
15407 | "node:_tls_common": [">= 14.18 && < 15", ">= 16"],
|
15408 | _tls_legacy: ">= 0.11.3 && < 10",
|
15409 | _tls_wrap: ">= 0.11.3",
|
15410 | "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"],
|
15411 | tls: true,
|
15412 | "node:tls": [">= 14.18 && < 15", ">= 16"],
|
15413 | trace_events: ">= 10",
|
15414 | "node:trace_events": [">= 14.18 && < 15", ">= 16"],
|
15415 | tty: true,
|
15416 | "node:tty": [">= 14.18 && < 15", ">= 16"],
|
15417 | url: true,
|
15418 | "node:url": [">= 14.18 && < 15", ">= 16"],
|
15419 | util: true,
|
15420 | "node:util": [">= 14.18 && < 15", ">= 16"],
|
15421 | "util/types": ">= 15.3",
|
15422 | "node:util/types": ">= 16",
|
15423 | "v8/tools/arguments": ">= 10 && < 12",
|
15424 | "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15425 | "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15426 | "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15427 | "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15428 | "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15429 | "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"],
|
15430 | v8: ">= 1",
|
15431 | "node:v8": [">= 14.18 && < 15", ">= 16"],
|
15432 | vm: true,
|
15433 | "node:vm": [">= 14.18 && < 15", ">= 16"],
|
15434 | wasi: ">= 13.4 && < 13.5",
|
15435 | worker_threads: ">= 11.7",
|
15436 | "node:worker_threads": [">= 14.18 && < 15", ">= 16"],
|
15437 | zlib: ">= 0.5",
|
15438 | "node:zlib": [">= 14.18 && < 15", ">= 16"]
|
15439 | };
|
15440 | }
|
15441 | });
|
15442 | var require_core4 = __commonJS2({
|
15443 | "node_modules/resolve/lib/core.js"(exports2, module2) {
|
15444 | var current = process.versions && process.versions.node && process.versions.node.split(".") || [];
|
15445 | function specifierIncluded(specifier) {
|
15446 | var parts = specifier.split(" ");
|
15447 | var op = parts.length > 1 ? parts[0] : "=";
|
15448 | var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split(".");
|
15449 | for (var i = 0; i < 3; ++i) {
|
15450 | var cur = parseInt(current[i] || 0, 10);
|
15451 | var ver = parseInt(versionParts[i] || 0, 10);
|
15452 | if (cur === ver) {
|
15453 | continue;
|
15454 | }
|
15455 | if (op === "<") {
|
15456 | return cur < ver;
|
15457 | } else if (op === ">=") {
|
15458 | return cur >= ver;
|
15459 | }
|
15460 | return false;
|
15461 | }
|
15462 | return op === ">=";
|
15463 | }
|
15464 | function matchesRange(range) {
|
15465 | var specifiers = range.split(/ ?&& ?/);
|
15466 | if (specifiers.length === 0) {
|
15467 | return false;
|
15468 | }
|
15469 | for (var i = 0; i < specifiers.length; ++i) {
|
15470 | if (!specifierIncluded(specifiers[i])) {
|
15471 | return false;
|
15472 | }
|
15473 | }
|
15474 | return true;
|
15475 | }
|
15476 | function versionIncluded(specifierValue) {
|
15477 | if (typeof specifierValue === "boolean") {
|
15478 | return specifierValue;
|
15479 | }
|
15480 | if (specifierValue && typeof specifierValue === "object") {
|
15481 | for (var i = 0; i < specifierValue.length; ++i) {
|
15482 | if (matchesRange(specifierValue[i])) {
|
15483 | return true;
|
15484 | }
|
15485 | }
|
15486 | return false;
|
15487 | }
|
15488 | return matchesRange(specifierValue);
|
15489 | }
|
15490 | var data = require_core3();
|
15491 | var core2 = {};
|
15492 | for (mod in data) {
|
15493 | if (Object.prototype.hasOwnProperty.call(data, mod)) {
|
15494 | core2[mod] = versionIncluded(data[mod]);
|
15495 | }
|
15496 | }
|
15497 | var mod;
|
15498 | module2.exports = core2;
|
15499 | }
|
15500 | });
|
15501 | var require_is_core = __commonJS2({
|
15502 | "node_modules/resolve/lib/is-core.js"(exports2, module2) {
|
15503 | var isCoreModule = require_is_core_module();
|
15504 | module2.exports = function isCore(x) {
|
15505 | return isCoreModule(x);
|
15506 | };
|
15507 | }
|
15508 | });
|
15509 | var require_sync = __commonJS2({
|
15510 | "node_modules/resolve/lib/sync.js"(exports2, module2) {
|
15511 | var isCore = require_is_core_module();
|
15512 | var fs = require("fs");
|
15513 | var path = require("path");
|
15514 | var getHomedir = require_homedir();
|
15515 | var caller = require_caller();
|
15516 | var nodeModulesPaths = require_node_modules_paths();
|
15517 | var normalizeOptions = require_normalize_options();
|
15518 | var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === "function" ? fs.realpathSync.native : fs.realpathSync;
|
15519 | var homedir = getHomedir();
|
15520 | var defaultPaths = function() {
|
15521 | return [path.join(homedir, ".node_modules"), path.join(homedir, ".node_libraries")];
|
15522 | };
|
15523 | var defaultIsFile = function isFile(file) {
|
15524 | try {
|
15525 | var stat = fs.statSync(file, {
|
15526 | throwIfNoEntry: false
|
15527 | });
|
15528 | } catch (e) {
|
15529 | if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
|
15530 | return false;
|
15531 | throw e;
|
15532 | }
|
15533 | return !!stat && (stat.isFile() || stat.isFIFO());
|
15534 | };
|
15535 | var defaultIsDir = function isDirectory(dir) {
|
15536 | try {
|
15537 | var stat = fs.statSync(dir, {
|
15538 | throwIfNoEntry: false
|
15539 | });
|
15540 | } catch (e) {
|
15541 | if (e && (e.code === "ENOENT" || e.code === "ENOTDIR"))
|
15542 | return false;
|
15543 | throw e;
|
15544 | }
|
15545 | return !!stat && stat.isDirectory();
|
15546 | };
|
15547 | var defaultRealpathSync = function realpathSync(x) {
|
15548 | try {
|
15549 | return realpathFS(x);
|
15550 | } catch (realpathErr) {
|
15551 | if (realpathErr.code !== "ENOENT") {
|
15552 | throw realpathErr;
|
15553 | }
|
15554 | }
|
15555 | return x;
|
15556 | };
|
15557 | var maybeRealpathSync = function maybeRealpathSync2(realpathSync, x, opts) {
|
15558 | if (opts && opts.preserveSymlinks === false) {
|
15559 | return realpathSync(x);
|
15560 | }
|
15561 | return x;
|
15562 | };
|
15563 | var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync, pkgfile) {
|
15564 | var body = readFileSync(pkgfile);
|
15565 | try {
|
15566 | var pkg = JSON.parse(body);
|
15567 | return pkg;
|
15568 | } catch (jsonErr) {
|
15569 | }
|
15570 | };
|
15571 | var getPackageCandidates = function getPackageCandidates2(x, start, opts) {
|
15572 | var dirs = nodeModulesPaths(start, opts, x);
|
15573 | for (var i = 0; i < dirs.length; i++) {
|
15574 | dirs[i] = path.join(dirs[i], x);
|
15575 | }
|
15576 | return dirs;
|
15577 | };
|
15578 | module2.exports = function resolveSync(x, options) {
|
15579 | if (typeof x !== "string") {
|
15580 | throw new TypeError("Path must be a string.");
|
15581 | }
|
15582 | var opts = normalizeOptions(x, options);
|
15583 | var isFile = opts.isFile || defaultIsFile;
|
15584 | var readFileSync = opts.readFileSync || fs.readFileSync;
|
15585 | var isDirectory = opts.isDirectory || defaultIsDir;
|
15586 | var realpathSync = opts.realpathSync || defaultRealpathSync;
|
15587 | var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
15588 | if (opts.readFileSync && opts.readPackageSync) {
|
15589 | throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");
|
15590 | }
|
15591 | var packageIterator = opts.packageIterator;
|
15592 | var extensions = opts.extensions || [".js"];
|
15593 | var includeCoreModules = opts.includeCoreModules !== false;
|
15594 | var basedir = opts.basedir || path.dirname(caller());
|
15595 | var parent = opts.filename || basedir;
|
15596 | opts.paths = opts.paths || defaultPaths();
|
15597 | var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts);
|
15598 | if (/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(x)) {
|
15599 | var res = path.resolve(absoluteStart, x);
|
15600 | if (x === "." || x === ".." || x.slice(-1) === "/")
|
15601 | res += "/";
|
15602 | var m = loadAsFileSync(res) || loadAsDirectorySync(res);
|
15603 | if (m)
|
15604 | return maybeRealpathSync(realpathSync, m, opts);
|
15605 | } else if (includeCoreModules && isCore(x)) {
|
15606 | return x;
|
15607 | } else {
|
15608 | var n = loadNodeModulesSync(x, absoluteStart);
|
15609 | if (n)
|
15610 | return maybeRealpathSync(realpathSync, n, opts);
|
15611 | }
|
15612 | var err = new Error("Cannot find module '" + x + "' from '" + parent + "'");
|
15613 | err.code = "MODULE_NOT_FOUND";
|
15614 | throw err;
|
15615 | function loadAsFileSync(x2) {
|
15616 | var pkg = loadpkg(path.dirname(x2));
|
15617 | if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) {
|
15618 | var rfile = path.relative(pkg.dir, x2);
|
15619 | var r = opts.pathFilter(pkg.pkg, x2, rfile);
|
15620 | if (r) {
|
15621 | x2 = path.resolve(pkg.dir, r);
|
15622 | }
|
15623 | }
|
15624 | if (isFile(x2)) {
|
15625 | return x2;
|
15626 | }
|
15627 | for (var i = 0; i < extensions.length; i++) {
|
15628 | var file = x2 + extensions[i];
|
15629 | if (isFile(file)) {
|
15630 | return file;
|
15631 | }
|
15632 | }
|
15633 | }
|
15634 | function loadpkg(dir) {
|
15635 | if (dir === "" || dir === "/")
|
15636 | return;
|
15637 | if (process.platform === "win32" && /^\w:[/\\]*$/.test(dir)) {
|
15638 | return;
|
15639 | }
|
15640 | if (/[/\\]node_modules[/\\]*$/.test(dir))
|
15641 | return;
|
15642 | var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), "package.json");
|
15643 | if (!isFile(pkgfile)) {
|
15644 | return loadpkg(path.dirname(dir));
|
15645 | }
|
15646 | var pkg = readPackageSync(readFileSync, pkgfile);
|
15647 | if (pkg && opts.packageFilter) {
|
15648 | pkg = opts.packageFilter(pkg, dir);
|
15649 | }
|
15650 | return {
|
15651 | pkg,
|
15652 | dir
|
15653 | };
|
15654 | }
|
15655 | function loadAsDirectorySync(x2) {
|
15656 | var pkgfile = path.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
15657 | if (isFile(pkgfile)) {
|
15658 | try {
|
15659 | var pkg = readPackageSync(readFileSync, pkgfile);
|
15660 | } catch (e) {
|
15661 | }
|
15662 | if (pkg && opts.packageFilter) {
|
15663 | pkg = opts.packageFilter(pkg, x2);
|
15664 | }
|
15665 | if (pkg && pkg.main) {
|
15666 | if (typeof pkg.main !== "string") {
|
15667 | var mainError = new TypeError("package \u201C" + pkg.name + "\u201D `main` must be a string");
|
15668 | mainError.code = "INVALID_PACKAGE_MAIN";
|
15669 | throw mainError;
|
15670 | }
|
15671 | if (pkg.main === "." || pkg.main === "./") {
|
15672 | pkg.main = "index";
|
15673 | }
|
15674 | try {
|
15675 | var m2 = loadAsFileSync(path.resolve(x2, pkg.main));
|
15676 | if (m2)
|
15677 | return m2;
|
15678 | var n2 = loadAsDirectorySync(path.resolve(x2, pkg.main));
|
15679 | if (n2)
|
15680 | return n2;
|
15681 | } catch (e) {
|
15682 | }
|
15683 | }
|
15684 | }
|
15685 | return loadAsFileSync(path.join(x2, "/index"));
|
15686 | }
|
15687 | function loadNodeModulesSync(x2, start) {
|
15688 | var thunk = function() {
|
15689 | return getPackageCandidates(x2, start, opts);
|
15690 | };
|
15691 | var dirs = packageIterator ? packageIterator(x2, start, thunk, opts) : thunk();
|
15692 | for (var i = 0; i < dirs.length; i++) {
|
15693 | var dir = dirs[i];
|
15694 | if (isDirectory(path.dirname(dir))) {
|
15695 | var m2 = loadAsFileSync(dir);
|
15696 | if (m2)
|
15697 | return m2;
|
15698 | var n2 = loadAsDirectorySync(dir);
|
15699 | if (n2)
|
15700 | return n2;
|
15701 | }
|
15702 | }
|
15703 | }
|
15704 | };
|
15705 | }
|
15706 | });
|
15707 | var require_resolve = __commonJS2({
|
15708 | "node_modules/resolve/index.js"(exports2, module2) {
|
15709 | var async = require_async();
|
15710 | async.core = require_core4();
|
15711 | async.isCore = require_is_core();
|
15712 | async.sync = require_sync();
|
15713 | module2.exports = async;
|
15714 | }
|
15715 | });
|
15716 | var require_resolve2 = __commonJS2({
|
15717 | "src/common/resolve.js"(exports2, module2) {
|
15718 | "use strict";
|
15719 | var {
|
15720 | resolve
|
15721 | } = require;
|
15722 | if (resolve.length === 1 || process.env.PRETTIER_FALLBACK_RESOLVE) {
|
15723 | resolve = (id, options) => {
|
15724 | let basedir;
|
15725 | if (options && options.paths && options.paths.length === 1) {
|
15726 | basedir = options.paths[0];
|
15727 | }
|
15728 | return require_resolve().sync(id, {
|
15729 | basedir
|
15730 | });
|
15731 | };
|
15732 | }
|
15733 | module2.exports = resolve;
|
15734 | }
|
15735 | });
|
15736 | function mimicFunction(to, from, {
|
15737 | ignoreNonConfigurable = false
|
15738 | } = {}) {
|
15739 | const {
|
15740 | name
|
15741 | } = to;
|
15742 | for (const property of Reflect.ownKeys(from)) {
|
15743 | copyProperty(to, from, property, ignoreNonConfigurable);
|
15744 | }
|
15745 | changePrototype(to, from);
|
15746 | changeToString(to, from, name);
|
15747 | return to;
|
15748 | }
|
15749 | var copyProperty;
|
15750 | var canCopyProperty;
|
15751 | var changePrototype;
|
15752 | var wrappedToString;
|
15753 | var toStringDescriptor;
|
15754 | var toStringName;
|
15755 | var changeToString;
|
15756 | var init_mimic_fn = __esm({
|
15757 | "node_modules/mimic-fn/index.js"() {
|
15758 | copyProperty = (to, from, property, ignoreNonConfigurable) => {
|
15759 | if (property === "length" || property === "prototype") {
|
15760 | return;
|
15761 | }
|
15762 | if (property === "arguments" || property === "caller") {
|
15763 | return;
|
15764 | }
|
15765 | const toDescriptor = Object.getOwnPropertyDescriptor(to, property);
|
15766 | const fromDescriptor = Object.getOwnPropertyDescriptor(from, property);
|
15767 | if (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {
|
15768 | return;
|
15769 | }
|
15770 | Object.defineProperty(to, property, fromDescriptor);
|
15771 | };
|
15772 | canCopyProperty = function(toDescriptor, fromDescriptor) {
|
15773 | return toDescriptor === void 0 || toDescriptor.configurable || toDescriptor.writable === fromDescriptor.writable && toDescriptor.enumerable === fromDescriptor.enumerable && toDescriptor.configurable === fromDescriptor.configurable && (toDescriptor.writable || toDescriptor.value === fromDescriptor.value);
|
15774 | };
|
15775 | changePrototype = (to, from) => {
|
15776 | const fromPrototype = Object.getPrototypeOf(from);
|
15777 | if (fromPrototype === Object.getPrototypeOf(to)) {
|
15778 | return;
|
15779 | }
|
15780 | Object.setPrototypeOf(to, fromPrototype);
|
15781 | };
|
15782 | wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/
|
15783 | ${fromBody}`;
|
15784 | toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, "toString");
|
15785 | toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, "name");
|
15786 | changeToString = (to, from, name) => {
|
15787 | const withName = name === "" ? "" : `with ${name.trim()}() `;
|
15788 | const newToString = wrappedToString.bind(null, withName, from.toString());
|
15789 | Object.defineProperty(newToString, "name", toStringName);
|
15790 | Object.defineProperty(to, "toString", Object.assign(Object.assign({}, toStringDescriptor), {}, {
|
15791 | value: newToString
|
15792 | }));
|
15793 | };
|
15794 | }
|
15795 | });
|
15796 | var require_p_defer = __commonJS2({
|
15797 | "node_modules/p-defer/index.js"(exports2, module2) {
|
15798 | "use strict";
|
15799 | module2.exports = () => {
|
15800 | const ret = {};
|
15801 | ret.promise = new Promise((resolve, reject) => {
|
15802 | ret.resolve = resolve;
|
15803 | ret.reject = reject;
|
15804 | });
|
15805 | return ret;
|
15806 | };
|
15807 | }
|
15808 | });
|
15809 | var require_dist = __commonJS2({
|
15810 | "node_modules/map-age-cleaner/dist/index.js"(exports2, module2) {
|
15811 | "use strict";
|
15812 | var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
|
15813 | return new (P || (P = Promise))(function(resolve, reject) {
|
15814 | function fulfilled(value) {
|
15815 | try {
|
15816 | step(generator.next(value));
|
15817 | } catch (e) {
|
15818 | reject(e);
|
15819 | }
|
15820 | }
|
15821 | function rejected(value) {
|
15822 | try {
|
15823 | step(generator["throw"](value));
|
15824 | } catch (e) {
|
15825 | reject(e);
|
15826 | }
|
15827 | }
|
15828 | function step(result) {
|
15829 | result.done ? resolve(result.value) : new P(function(resolve2) {
|
15830 | resolve2(result.value);
|
15831 | }).then(fulfilled, rejected);
|
15832 | }
|
15833 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
15834 | });
|
15835 | };
|
15836 | var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
15837 | return mod && mod.__esModule ? mod : {
|
15838 | "default": mod
|
15839 | };
|
15840 | };
|
15841 | Object.defineProperty(exports2, "__esModule", {
|
15842 | value: true
|
15843 | });
|
15844 | var p_defer_1 = __importDefault2(require_p_defer());
|
15845 | function mapAgeCleaner2(map, property = "maxAge") {
|
15846 | let processingKey;
|
15847 | let processingTimer;
|
15848 | let processingDeferred;
|
15849 | const cleanup = () => __awaiter2(this, void 0, void 0, function* () {
|
15850 | if (processingKey !== void 0) {
|
15851 | return;
|
15852 | }
|
15853 | const setupTimer = (item) => __awaiter2(this, void 0, void 0, function* () {
|
15854 | processingDeferred = p_defer_1.default();
|
15855 | const delay = item[1][property] - Date.now();
|
15856 | if (delay <= 0) {
|
15857 | map.delete(item[0]);
|
15858 | processingDeferred.resolve();
|
15859 | return;
|
15860 | }
|
15861 | processingKey = item[0];
|
15862 | processingTimer = setTimeout(() => {
|
15863 | map.delete(item[0]);
|
15864 | if (processingDeferred) {
|
15865 | processingDeferred.resolve();
|
15866 | }
|
15867 | }, delay);
|
15868 | if (typeof processingTimer.unref === "function") {
|
15869 | processingTimer.unref();
|
15870 | }
|
15871 | return processingDeferred.promise;
|
15872 | });
|
15873 | try {
|
15874 | for (const entry of map) {
|
15875 | yield setupTimer(entry);
|
15876 | }
|
15877 | } catch (_a) {
|
15878 | }
|
15879 | processingKey = void 0;
|
15880 | });
|
15881 | const reset = () => {
|
15882 | processingKey = void 0;
|
15883 | if (processingTimer !== void 0) {
|
15884 | clearTimeout(processingTimer);
|
15885 | processingTimer = void 0;
|
15886 | }
|
15887 | if (processingDeferred !== void 0) {
|
15888 | processingDeferred.reject(void 0);
|
15889 | processingDeferred = void 0;
|
15890 | }
|
15891 | };
|
15892 | const originalSet = map.set.bind(map);
|
15893 | map.set = (key, value) => {
|
15894 | if (map.has(key)) {
|
15895 | map.delete(key);
|
15896 | }
|
15897 | const result = originalSet(key, value);
|
15898 | if (processingKey && processingKey === key) {
|
15899 | reset();
|
15900 | }
|
15901 | cleanup();
|
15902 | return result;
|
15903 | };
|
15904 | cleanup();
|
15905 | return map;
|
15906 | }
|
15907 | exports2.default = mapAgeCleaner2;
|
15908 | module2.exports = mapAgeCleaner2;
|
15909 | module2.exports.default = mapAgeCleaner2;
|
15910 | }
|
15911 | });
|
15912 | var dist_exports = {};
|
15913 | __export(dist_exports, {
|
15914 | default: () => mem,
|
15915 | memClear: () => memClear,
|
15916 | memDecorator: () => memDecorator
|
15917 | });
|
15918 | function mem(fn, {
|
15919 | cacheKey,
|
15920 | cache = /* @__PURE__ */ new Map(),
|
15921 | maxAge
|
15922 | } = {}) {
|
15923 | if (typeof maxAge === "number") {
|
15924 | (0, import_map_age_cleaner.default)(cache);
|
15925 | }
|
15926 | const memoized = function(...arguments_) {
|
15927 | const key = cacheKey ? cacheKey(arguments_) : arguments_[0];
|
15928 | const cacheItem = cache.get(key);
|
15929 | if (cacheItem) {
|
15930 | return cacheItem.data;
|
15931 | }
|
15932 | const result = fn.apply(this, arguments_);
|
15933 | cache.set(key, {
|
15934 | data: result,
|
15935 | maxAge: maxAge ? Date.now() + maxAge : Number.POSITIVE_INFINITY
|
15936 | });
|
15937 | return result;
|
15938 | };
|
15939 | mimicFunction(memoized, fn, {
|
15940 | ignoreNonConfigurable: true
|
15941 | });
|
15942 | cacheStore.set(memoized, cache);
|
15943 | return memoized;
|
15944 | }
|
15945 | function memDecorator(options = {}) {
|
15946 | const instanceMap = new WeakMap();
|
15947 | return (target, propertyKey, descriptor) => {
|
15948 | const input = target[propertyKey];
|
15949 | if (typeof input !== "function") {
|
15950 | throw new TypeError("The decorated value must be a function");
|
15951 | }
|
15952 | delete descriptor.value;
|
15953 | delete descriptor.writable;
|
15954 | descriptor.get = function() {
|
15955 | if (!instanceMap.has(this)) {
|
15956 | const value = mem(input, options);
|
15957 | instanceMap.set(this, value);
|
15958 | return value;
|
15959 | }
|
15960 | return instanceMap.get(this);
|
15961 | };
|
15962 | };
|
15963 | }
|
15964 | function memClear(fn) {
|
15965 | const cache = cacheStore.get(fn);
|
15966 | if (!cache) {
|
15967 | throw new TypeError("Can't clear a function that was not memoized!");
|
15968 | }
|
15969 | if (typeof cache.clear !== "function") {
|
15970 | throw new TypeError("The cache Map can't be cleared!");
|
15971 | }
|
15972 | cache.clear();
|
15973 | }
|
15974 | var import_map_age_cleaner;
|
15975 | var cacheStore;
|
15976 | var init_dist = __esm({
|
15977 | "node_modules/mem/dist/index.js"() {
|
15978 | init_mimic_fn();
|
15979 | import_map_age_cleaner = __toESM(require_dist());
|
15980 | cacheStore = new WeakMap();
|
15981 | }
|
15982 | });
|
15983 | var require_pseudomap = __commonJS2({
|
15984 | "node_modules/pseudomap/pseudomap.js"(exports2, module2) {
|
15985 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
15986 | module2.exports = PseudoMap;
|
15987 | function PseudoMap(set2) {
|
15988 | if (!(this instanceof PseudoMap))
|
15989 | throw new TypeError("Constructor PseudoMap requires 'new'");
|
15990 | this.clear();
|
15991 | if (set2) {
|
15992 | if (set2 instanceof PseudoMap || typeof Map === "function" && set2 instanceof Map)
|
15993 | set2.forEach(function(value, key) {
|
15994 | this.set(key, value);
|
15995 | }, this);
|
15996 | else if (Array.isArray(set2))
|
15997 | set2.forEach(function(kv) {
|
15998 | this.set(kv[0], kv[1]);
|
15999 | }, this);
|
16000 | else
|
16001 | throw new TypeError("invalid argument");
|
16002 | }
|
16003 | }
|
16004 | PseudoMap.prototype.forEach = function(fn, thisp) {
|
16005 | thisp = thisp || this;
|
16006 | Object.keys(this._data).forEach(function(k) {
|
16007 | if (k !== "size")
|
16008 | fn.call(thisp, this._data[k].value, this._data[k].key);
|
16009 | }, this);
|
16010 | };
|
16011 | PseudoMap.prototype.has = function(k) {
|
16012 | return !!find(this._data, k);
|
16013 | };
|
16014 | PseudoMap.prototype.get = function(k) {
|
16015 | var res = find(this._data, k);
|
16016 | return res && res.value;
|
16017 | };
|
16018 | PseudoMap.prototype.set = function(k, v) {
|
16019 | set(this._data, k, v);
|
16020 | };
|
16021 | PseudoMap.prototype.delete = function(k) {
|
16022 | var res = find(this._data, k);
|
16023 | if (res) {
|
16024 | delete this._data[res._index];
|
16025 | this._data.size--;
|
16026 | }
|
16027 | };
|
16028 | PseudoMap.prototype.clear = function() {
|
16029 | var data = Object.create(null);
|
16030 | data.size = 0;
|
16031 | Object.defineProperty(this, "_data", {
|
16032 | value: data,
|
16033 | enumerable: false,
|
16034 | configurable: true,
|
16035 | writable: false
|
16036 | });
|
16037 | };
|
16038 | Object.defineProperty(PseudoMap.prototype, "size", {
|
16039 | get: function() {
|
16040 | return this._data.size;
|
16041 | },
|
16042 | set: function(n) {
|
16043 | },
|
16044 | enumerable: true,
|
16045 | configurable: true
|
16046 | });
|
16047 | PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
|
16048 | throw new Error("iterators are not implemented in this version");
|
16049 | };
|
16050 | function same(a, b) {
|
16051 | return a === b || a !== a && b !== b;
|
16052 | }
|
16053 | function Entry(k, v, i) {
|
16054 | this.key = k;
|
16055 | this.value = v;
|
16056 | this._index = i;
|
16057 | }
|
16058 | function find(data, k) {
|
16059 | for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
|
16060 | if (same(data[key].key, k))
|
16061 | return data[key];
|
16062 | }
|
16063 | }
|
16064 | function set(data, k, v) {
|
16065 | for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
|
16066 | if (same(data[key].key, k)) {
|
16067 | data[key].value = v;
|
16068 | return;
|
16069 | }
|
16070 | }
|
16071 | data.size++;
|
16072 | data[key] = new Entry(k, v, key);
|
16073 | }
|
16074 | }
|
16075 | });
|
16076 | var require_map = __commonJS2({
|
16077 | "node_modules/pseudomap/map.js"(exports2, module2) {
|
16078 | if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
|
16079 | process.env.TEST_PSEUDOMAP = "true";
|
16080 | if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
|
16081 | module2.exports = Map;
|
16082 | } else {
|
16083 | module2.exports = require_pseudomap();
|
16084 | }
|
16085 | }
|
16086 | });
|
16087 | var require_yallist = __commonJS2({
|
16088 | "node_modules/editorconfig/node_modules/yallist/yallist.js"(exports2, module2) {
|
16089 | module2.exports = Yallist;
|
16090 | Yallist.Node = Node;
|
16091 | Yallist.create = Yallist;
|
16092 | function Yallist(list) {
|
16093 | var self2 = this;
|
16094 | if (!(self2 instanceof Yallist)) {
|
16095 | self2 = new Yallist();
|
16096 | }
|
16097 | self2.tail = null;
|
16098 | self2.head = null;
|
16099 | self2.length = 0;
|
16100 | if (list && typeof list.forEach === "function") {
|
16101 | list.forEach(function(item) {
|
16102 | self2.push(item);
|
16103 | });
|
16104 | } else if (arguments.length > 0) {
|
16105 | for (var i = 0, l = arguments.length; i < l; i++) {
|
16106 | self2.push(arguments[i]);
|
16107 | }
|
16108 | }
|
16109 | return self2;
|
16110 | }
|
16111 | Yallist.prototype.removeNode = function(node) {
|
16112 | if (node.list !== this) {
|
16113 | throw new Error("removing node which does not belong to this list");
|
16114 | }
|
16115 | var next = node.next;
|
16116 | var prev = node.prev;
|
16117 | if (next) {
|
16118 | next.prev = prev;
|
16119 | }
|
16120 | if (prev) {
|
16121 | prev.next = next;
|
16122 | }
|
16123 | if (node === this.head) {
|
16124 | this.head = next;
|
16125 | }
|
16126 | if (node === this.tail) {
|
16127 | this.tail = prev;
|
16128 | }
|
16129 | node.list.length--;
|
16130 | node.next = null;
|
16131 | node.prev = null;
|
16132 | node.list = null;
|
16133 | };
|
16134 | Yallist.prototype.unshiftNode = function(node) {
|
16135 | if (node === this.head) {
|
16136 | return;
|
16137 | }
|
16138 | if (node.list) {
|
16139 | node.list.removeNode(node);
|
16140 | }
|
16141 | var head = this.head;
|
16142 | node.list = this;
|
16143 | node.next = head;
|
16144 | if (head) {
|
16145 | head.prev = node;
|
16146 | }
|
16147 | this.head = node;
|
16148 | if (!this.tail) {
|
16149 | this.tail = node;
|
16150 | }
|
16151 | this.length++;
|
16152 | };
|
16153 | Yallist.prototype.pushNode = function(node) {
|
16154 | if (node === this.tail) {
|
16155 | return;
|
16156 | }
|
16157 | if (node.list) {
|
16158 | node.list.removeNode(node);
|
16159 | }
|
16160 | var tail = this.tail;
|
16161 | node.list = this;
|
16162 | node.prev = tail;
|
16163 | if (tail) {
|
16164 | tail.next = node;
|
16165 | }
|
16166 | this.tail = node;
|
16167 | if (!this.head) {
|
16168 | this.head = node;
|
16169 | }
|
16170 | this.length++;
|
16171 | };
|
16172 | Yallist.prototype.push = function() {
|
16173 | for (var i = 0, l = arguments.length; i < l; i++) {
|
16174 | push(this, arguments[i]);
|
16175 | }
|
16176 | return this.length;
|
16177 | };
|
16178 | Yallist.prototype.unshift = function() {
|
16179 | for (var i = 0, l = arguments.length; i < l; i++) {
|
16180 | unshift(this, arguments[i]);
|
16181 | }
|
16182 | return this.length;
|
16183 | };
|
16184 | Yallist.prototype.pop = function() {
|
16185 | if (!this.tail) {
|
16186 | return void 0;
|
16187 | }
|
16188 | var res = this.tail.value;
|
16189 | this.tail = this.tail.prev;
|
16190 | if (this.tail) {
|
16191 | this.tail.next = null;
|
16192 | } else {
|
16193 | this.head = null;
|
16194 | }
|
16195 | this.length--;
|
16196 | return res;
|
16197 | };
|
16198 | Yallist.prototype.shift = function() {
|
16199 | if (!this.head) {
|
16200 | return void 0;
|
16201 | }
|
16202 | var res = this.head.value;
|
16203 | this.head = this.head.next;
|
16204 | if (this.head) {
|
16205 | this.head.prev = null;
|
16206 | } else {
|
16207 | this.tail = null;
|
16208 | }
|
16209 | this.length--;
|
16210 | return res;
|
16211 | };
|
16212 | Yallist.prototype.forEach = function(fn, thisp) {
|
16213 | thisp = thisp || this;
|
16214 | for (var walker = this.head, i = 0; walker !== null; i++) {
|
16215 | fn.call(thisp, walker.value, i, this);
|
16216 | walker = walker.next;
|
16217 | }
|
16218 | };
|
16219 | Yallist.prototype.forEachReverse = function(fn, thisp) {
|
16220 | thisp = thisp || this;
|
16221 | for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
16222 | fn.call(thisp, walker.value, i, this);
|
16223 | walker = walker.prev;
|
16224 | }
|
16225 | };
|
16226 | Yallist.prototype.get = function(n) {
|
16227 | for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
16228 | walker = walker.next;
|
16229 | }
|
16230 | if (i === n && walker !== null) {
|
16231 | return walker.value;
|
16232 | }
|
16233 | };
|
16234 | Yallist.prototype.getReverse = function(n) {
|
16235 | for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
16236 | walker = walker.prev;
|
16237 | }
|
16238 | if (i === n && walker !== null) {
|
16239 | return walker.value;
|
16240 | }
|
16241 | };
|
16242 | Yallist.prototype.map = function(fn, thisp) {
|
16243 | thisp = thisp || this;
|
16244 | var res = new Yallist();
|
16245 | for (var walker = this.head; walker !== null; ) {
|
16246 | res.push(fn.call(thisp, walker.value, this));
|
16247 | walker = walker.next;
|
16248 | }
|
16249 | return res;
|
16250 | };
|
16251 | Yallist.prototype.mapReverse = function(fn, thisp) {
|
16252 | thisp = thisp || this;
|
16253 | var res = new Yallist();
|
16254 | for (var walker = this.tail; walker !== null; ) {
|
16255 | res.push(fn.call(thisp, walker.value, this));
|
16256 | walker = walker.prev;
|
16257 | }
|
16258 | return res;
|
16259 | };
|
16260 | Yallist.prototype.reduce = function(fn, initial) {
|
16261 | var acc;
|
16262 | var walker = this.head;
|
16263 | if (arguments.length > 1) {
|
16264 | acc = initial;
|
16265 | } else if (this.head) {
|
16266 | walker = this.head.next;
|
16267 | acc = this.head.value;
|
16268 | } else {
|
16269 | throw new TypeError("Reduce of empty list with no initial value");
|
16270 | }
|
16271 | for (var i = 0; walker !== null; i++) {
|
16272 | acc = fn(acc, walker.value, i);
|
16273 | walker = walker.next;
|
16274 | }
|
16275 | return acc;
|
16276 | };
|
16277 | Yallist.prototype.reduceReverse = function(fn, initial) {
|
16278 | var acc;
|
16279 | var walker = this.tail;
|
16280 | if (arguments.length > 1) {
|
16281 | acc = initial;
|
16282 | } else if (this.tail) {
|
16283 | walker = this.tail.prev;
|
16284 | acc = this.tail.value;
|
16285 | } else {
|
16286 | throw new TypeError("Reduce of empty list with no initial value");
|
16287 | }
|
16288 | for (var i = this.length - 1; walker !== null; i--) {
|
16289 | acc = fn(acc, walker.value, i);
|
16290 | walker = walker.prev;
|
16291 | }
|
16292 | return acc;
|
16293 | };
|
16294 | Yallist.prototype.toArray = function() {
|
16295 | var arr = new Array(this.length);
|
16296 | for (var i = 0, walker = this.head; walker !== null; i++) {
|
16297 | arr[i] = walker.value;
|
16298 | walker = walker.next;
|
16299 | }
|
16300 | return arr;
|
16301 | };
|
16302 | Yallist.prototype.toArrayReverse = function() {
|
16303 | var arr = new Array(this.length);
|
16304 | for (var i = 0, walker = this.tail; walker !== null; i++) {
|
16305 | arr[i] = walker.value;
|
16306 | walker = walker.prev;
|
16307 | }
|
16308 | return arr;
|
16309 | };
|
16310 | Yallist.prototype.slice = function(from, to) {
|
16311 | to = to || this.length;
|
16312 | if (to < 0) {
|
16313 | to += this.length;
|
16314 | }
|
16315 | from = from || 0;
|
16316 | if (from < 0) {
|
16317 | from += this.length;
|
16318 | }
|
16319 | var ret = new Yallist();
|
16320 | if (to < from || to < 0) {
|
16321 | return ret;
|
16322 | }
|
16323 | if (from < 0) {
|
16324 | from = 0;
|
16325 | }
|
16326 | if (to > this.length) {
|
16327 | to = this.length;
|
16328 | }
|
16329 | for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
16330 | walker = walker.next;
|
16331 | }
|
16332 | for (; walker !== null && i < to; i++, walker = walker.next) {
|
16333 | ret.push(walker.value);
|
16334 | }
|
16335 | return ret;
|
16336 | };
|
16337 | Yallist.prototype.sliceReverse = function(from, to) {
|
16338 | to = to || this.length;
|
16339 | if (to < 0) {
|
16340 | to += this.length;
|
16341 | }
|
16342 | from = from || 0;
|
16343 | if (from < 0) {
|
16344 | from += this.length;
|
16345 | }
|
16346 | var ret = new Yallist();
|
16347 | if (to < from || to < 0) {
|
16348 | return ret;
|
16349 | }
|
16350 | if (from < 0) {
|
16351 | from = 0;
|
16352 | }
|
16353 | if (to > this.length) {
|
16354 | to = this.length;
|
16355 | }
|
16356 | for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
16357 | walker = walker.prev;
|
16358 | }
|
16359 | for (; walker !== null && i > from; i--, walker = walker.prev) {
|
16360 | ret.push(walker.value);
|
16361 | }
|
16362 | return ret;
|
16363 | };
|
16364 | Yallist.prototype.reverse = function() {
|
16365 | var head = this.head;
|
16366 | var tail = this.tail;
|
16367 | for (var walker = head; walker !== null; walker = walker.prev) {
|
16368 | var p = walker.prev;
|
16369 | walker.prev = walker.next;
|
16370 | walker.next = p;
|
16371 | }
|
16372 | this.head = tail;
|
16373 | this.tail = head;
|
16374 | return this;
|
16375 | };
|
16376 | function push(self2, item) {
|
16377 | self2.tail = new Node(item, self2.tail, null, self2);
|
16378 | if (!self2.head) {
|
16379 | self2.head = self2.tail;
|
16380 | }
|
16381 | self2.length++;
|
16382 | }
|
16383 | function unshift(self2, item) {
|
16384 | self2.head = new Node(item, null, self2.head, self2);
|
16385 | if (!self2.tail) {
|
16386 | self2.tail = self2.head;
|
16387 | }
|
16388 | self2.length++;
|
16389 | }
|
16390 | function Node(value, prev, next, list) {
|
16391 | if (!(this instanceof Node)) {
|
16392 | return new Node(value, prev, next, list);
|
16393 | }
|
16394 | this.list = list;
|
16395 | this.value = value;
|
16396 | if (prev) {
|
16397 | prev.next = this;
|
16398 | this.prev = prev;
|
16399 | } else {
|
16400 | this.prev = null;
|
16401 | }
|
16402 | if (next) {
|
16403 | next.prev = this;
|
16404 | this.next = next;
|
16405 | } else {
|
16406 | this.next = null;
|
16407 | }
|
16408 | }
|
16409 | }
|
16410 | });
|
16411 | var require_lru_cache = __commonJS2({
|
16412 | "node_modules/editorconfig/node_modules/lru-cache/index.js"(exports2, module2) {
|
16413 | "use strict";
|
16414 | module2.exports = LRUCache;
|
16415 | var Map2 = require_map();
|
16416 | var util = require("util");
|
16417 | var Yallist = require_yallist();
|
16418 | var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
|
16419 | var makeSymbol;
|
16420 | if (hasSymbol) {
|
16421 | makeSymbol = function(key) {
|
16422 | return Symbol(key);
|
16423 | };
|
16424 | } else {
|
16425 | makeSymbol = function(key) {
|
16426 | return "_" + key;
|
16427 | };
|
16428 | }
|
16429 | var MAX = makeSymbol("max");
|
16430 | var LENGTH = makeSymbol("length");
|
16431 | var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
|
16432 | var ALLOW_STALE = makeSymbol("allowStale");
|
16433 | var MAX_AGE = makeSymbol("maxAge");
|
16434 | var DISPOSE = makeSymbol("dispose");
|
16435 | var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
|
16436 | var LRU_LIST = makeSymbol("lruList");
|
16437 | var CACHE = makeSymbol("cache");
|
16438 | function naiveLength() {
|
16439 | return 1;
|
16440 | }
|
16441 | function LRUCache(options) {
|
16442 | if (!(this instanceof LRUCache)) {
|
16443 | return new LRUCache(options);
|
16444 | }
|
16445 | if (typeof options === "number") {
|
16446 | options = {
|
16447 | max: options
|
16448 | };
|
16449 | }
|
16450 | if (!options) {
|
16451 | options = {};
|
16452 | }
|
16453 | var max = this[MAX] = options.max;
|
16454 | if (!max || !(typeof max === "number") || max <= 0) {
|
16455 | this[MAX] = Infinity;
|
16456 | }
|
16457 | var lc = options.length || naiveLength;
|
16458 | if (typeof lc !== "function") {
|
16459 | lc = naiveLength;
|
16460 | }
|
16461 | this[LENGTH_CALCULATOR] = lc;
|
16462 | this[ALLOW_STALE] = options.stale || false;
|
16463 | this[MAX_AGE] = options.maxAge || 0;
|
16464 | this[DISPOSE] = options.dispose;
|
16465 | this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
|
16466 | this.reset();
|
16467 | }
|
16468 | Object.defineProperty(LRUCache.prototype, "max", {
|
16469 | set: function(mL) {
|
16470 | if (!mL || !(typeof mL === "number") || mL <= 0) {
|
16471 | mL = Infinity;
|
16472 | }
|
16473 | this[MAX] = mL;
|
16474 | trim(this);
|
16475 | },
|
16476 | get: function() {
|
16477 | return this[MAX];
|
16478 | },
|
16479 | enumerable: true
|
16480 | });
|
16481 | Object.defineProperty(LRUCache.prototype, "allowStale", {
|
16482 | set: function(allowStale) {
|
16483 | this[ALLOW_STALE] = !!allowStale;
|
16484 | },
|
16485 | get: function() {
|
16486 | return this[ALLOW_STALE];
|
16487 | },
|
16488 | enumerable: true
|
16489 | });
|
16490 | Object.defineProperty(LRUCache.prototype, "maxAge", {
|
16491 | set: function(mA) {
|
16492 | if (!mA || !(typeof mA === "number") || mA < 0) {
|
16493 | mA = 0;
|
16494 | }
|
16495 | this[MAX_AGE] = mA;
|
16496 | trim(this);
|
16497 | },
|
16498 | get: function() {
|
16499 | return this[MAX_AGE];
|
16500 | },
|
16501 | enumerable: true
|
16502 | });
|
16503 | Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
|
16504 | set: function(lC) {
|
16505 | if (typeof lC !== "function") {
|
16506 | lC = naiveLength;
|
16507 | }
|
16508 | if (lC !== this[LENGTH_CALCULATOR]) {
|
16509 | this[LENGTH_CALCULATOR] = lC;
|
16510 | this[LENGTH] = 0;
|
16511 | this[LRU_LIST].forEach(function(hit) {
|
16512 | hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
16513 | this[LENGTH] += hit.length;
|
16514 | }, this);
|
16515 | }
|
16516 | trim(this);
|
16517 | },
|
16518 | get: function() {
|
16519 | return this[LENGTH_CALCULATOR];
|
16520 | },
|
16521 | enumerable: true
|
16522 | });
|
16523 | Object.defineProperty(LRUCache.prototype, "length", {
|
16524 | get: function() {
|
16525 | return this[LENGTH];
|
16526 | },
|
16527 | enumerable: true
|
16528 | });
|
16529 | Object.defineProperty(LRUCache.prototype, "itemCount", {
|
16530 | get: function() {
|
16531 | return this[LRU_LIST].length;
|
16532 | },
|
16533 | enumerable: true
|
16534 | });
|
16535 | LRUCache.prototype.rforEach = function(fn, thisp) {
|
16536 | thisp = thisp || this;
|
16537 | for (var walker = this[LRU_LIST].tail; walker !== null; ) {
|
16538 | var prev = walker.prev;
|
16539 | forEachStep(this, fn, walker, thisp);
|
16540 | walker = prev;
|
16541 | }
|
16542 | };
|
16543 | function forEachStep(self2, fn, node, thisp) {
|
16544 | var hit = node.value;
|
16545 | if (isStale(self2, hit)) {
|
16546 | del(self2, node);
|
16547 | if (!self2[ALLOW_STALE]) {
|
16548 | hit = void 0;
|
16549 | }
|
16550 | }
|
16551 | if (hit) {
|
16552 | fn.call(thisp, hit.value, hit.key, self2);
|
16553 | }
|
16554 | }
|
16555 | LRUCache.prototype.forEach = function(fn, thisp) {
|
16556 | thisp = thisp || this;
|
16557 | for (var walker = this[LRU_LIST].head; walker !== null; ) {
|
16558 | var next = walker.next;
|
16559 | forEachStep(this, fn, walker, thisp);
|
16560 | walker = next;
|
16561 | }
|
16562 | };
|
16563 | LRUCache.prototype.keys = function() {
|
16564 | return this[LRU_LIST].toArray().map(function(k) {
|
16565 | return k.key;
|
16566 | }, this);
|
16567 | };
|
16568 | LRUCache.prototype.values = function() {
|
16569 | return this[LRU_LIST].toArray().map(function(k) {
|
16570 | return k.value;
|
16571 | }, this);
|
16572 | };
|
16573 | LRUCache.prototype.reset = function() {
|
16574 | if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
|
16575 | this[LRU_LIST].forEach(function(hit) {
|
16576 | this[DISPOSE](hit.key, hit.value);
|
16577 | }, this);
|
16578 | }
|
16579 | this[CACHE] = new Map2();
|
16580 | this[LRU_LIST] = new Yallist();
|
16581 | this[LENGTH] = 0;
|
16582 | };
|
16583 | LRUCache.prototype.dump = function() {
|
16584 | return this[LRU_LIST].map(function(hit) {
|
16585 | if (!isStale(this, hit)) {
|
16586 | return {
|
16587 | k: hit.key,
|
16588 | v: hit.value,
|
16589 | e: hit.now + (hit.maxAge || 0)
|
16590 | };
|
16591 | }
|
16592 | }, this).toArray().filter(function(h) {
|
16593 | return h;
|
16594 | });
|
16595 | };
|
16596 | LRUCache.prototype.dumpLru = function() {
|
16597 | return this[LRU_LIST];
|
16598 | };
|
16599 | LRUCache.prototype.inspect = function(n, opts) {
|
16600 | var str = "LRUCache {";
|
16601 | var extras = false;
|
16602 | var as = this[ALLOW_STALE];
|
16603 | if (as) {
|
16604 | str += "\n allowStale: true";
|
16605 | extras = true;
|
16606 | }
|
16607 | var max = this[MAX];
|
16608 | if (max && max !== Infinity) {
|
16609 | if (extras) {
|
16610 | str += ",";
|
16611 | }
|
16612 | str += "\n max: " + util.inspect(max, opts);
|
16613 | extras = true;
|
16614 | }
|
16615 | var maxAge = this[MAX_AGE];
|
16616 | if (maxAge) {
|
16617 | if (extras) {
|
16618 | str += ",";
|
16619 | }
|
16620 | str += "\n maxAge: " + util.inspect(maxAge, opts);
|
16621 | extras = true;
|
16622 | }
|
16623 | var lc = this[LENGTH_CALCULATOR];
|
16624 | if (lc && lc !== naiveLength) {
|
16625 | if (extras) {
|
16626 | str += ",";
|
16627 | }
|
16628 | str += "\n length: " + util.inspect(this[LENGTH], opts);
|
16629 | extras = true;
|
16630 | }
|
16631 | var didFirst = false;
|
16632 | this[LRU_LIST].forEach(function(item) {
|
16633 | if (didFirst) {
|
16634 | str += ",\n ";
|
16635 | } else {
|
16636 | if (extras) {
|
16637 | str += ",\n";
|
16638 | }
|
16639 | didFirst = true;
|
16640 | str += "\n ";
|
16641 | }
|
16642 | var key = util.inspect(item.key).split("\n").join("\n ");
|
16643 | var val = {
|
16644 | value: item.value
|
16645 | };
|
16646 | if (item.maxAge !== maxAge) {
|
16647 | val.maxAge = item.maxAge;
|
16648 | }
|
16649 | if (lc !== naiveLength) {
|
16650 | val.length = item.length;
|
16651 | }
|
16652 | if (isStale(this, item)) {
|
16653 | val.stale = true;
|
16654 | }
|
16655 | val = util.inspect(val, opts).split("\n").join("\n ");
|
16656 | str += key + " => " + val;
|
16657 | });
|
16658 | if (didFirst || extras) {
|
16659 | str += "\n";
|
16660 | }
|
16661 | str += "}";
|
16662 | return str;
|
16663 | };
|
16664 | LRUCache.prototype.set = function(key, value, maxAge) {
|
16665 | maxAge = maxAge || this[MAX_AGE];
|
16666 | var now = maxAge ? Date.now() : 0;
|
16667 | var len = this[LENGTH_CALCULATOR](value, key);
|
16668 | if (this[CACHE].has(key)) {
|
16669 | if (len > this[MAX]) {
|
16670 | del(this, this[CACHE].get(key));
|
16671 | return false;
|
16672 | }
|
16673 | var node = this[CACHE].get(key);
|
16674 | var item = node.value;
|
16675 | if (this[DISPOSE]) {
|
16676 | if (!this[NO_DISPOSE_ON_SET]) {
|
16677 | this[DISPOSE](key, item.value);
|
16678 | }
|
16679 | }
|
16680 | item.now = now;
|
16681 | item.maxAge = maxAge;
|
16682 | item.value = value;
|
16683 | this[LENGTH] += len - item.length;
|
16684 | item.length = len;
|
16685 | this.get(key);
|
16686 | trim(this);
|
16687 | return true;
|
16688 | }
|
16689 | var hit = new Entry(key, value, len, now, maxAge);
|
16690 | if (hit.length > this[MAX]) {
|
16691 | if (this[DISPOSE]) {
|
16692 | this[DISPOSE](key, value);
|
16693 | }
|
16694 | return false;
|
16695 | }
|
16696 | this[LENGTH] += hit.length;
|
16697 | this[LRU_LIST].unshift(hit);
|
16698 | this[CACHE].set(key, this[LRU_LIST].head);
|
16699 | trim(this);
|
16700 | return true;
|
16701 | };
|
16702 | LRUCache.prototype.has = function(key) {
|
16703 | if (!this[CACHE].has(key))
|
16704 | return false;
|
16705 | var hit = this[CACHE].get(key).value;
|
16706 | if (isStale(this, hit)) {
|
16707 | return false;
|
16708 | }
|
16709 | return true;
|
16710 | };
|
16711 | LRUCache.prototype.get = function(key) {
|
16712 | return get(this, key, true);
|
16713 | };
|
16714 | LRUCache.prototype.peek = function(key) {
|
16715 | return get(this, key, false);
|
16716 | };
|
16717 | LRUCache.prototype.pop = function() {
|
16718 | var node = this[LRU_LIST].tail;
|
16719 | if (!node)
|
16720 | return null;
|
16721 | del(this, node);
|
16722 | return node.value;
|
16723 | };
|
16724 | LRUCache.prototype.del = function(key) {
|
16725 | del(this, this[CACHE].get(key));
|
16726 | };
|
16727 | LRUCache.prototype.load = function(arr) {
|
16728 | this.reset();
|
16729 | var now = Date.now();
|
16730 | for (var l = arr.length - 1; l >= 0; l--) {
|
16731 | var hit = arr[l];
|
16732 | var expiresAt = hit.e || 0;
|
16733 | if (expiresAt === 0) {
|
16734 | this.set(hit.k, hit.v);
|
16735 | } else {
|
16736 | var maxAge = expiresAt - now;
|
16737 | if (maxAge > 0) {
|
16738 | this.set(hit.k, hit.v, maxAge);
|
16739 | }
|
16740 | }
|
16741 | }
|
16742 | };
|
16743 | LRUCache.prototype.prune = function() {
|
16744 | var self2 = this;
|
16745 | this[CACHE].forEach(function(value, key) {
|
16746 | get(self2, key, false);
|
16747 | });
|
16748 | };
|
16749 | function get(self2, key, doUse) {
|
16750 | var node = self2[CACHE].get(key);
|
16751 | if (node) {
|
16752 | var hit = node.value;
|
16753 | if (isStale(self2, hit)) {
|
16754 | del(self2, node);
|
16755 | if (!self2[ALLOW_STALE])
|
16756 | hit = void 0;
|
16757 | } else {
|
16758 | if (doUse) {
|
16759 | self2[LRU_LIST].unshiftNode(node);
|
16760 | }
|
16761 | }
|
16762 | if (hit)
|
16763 | hit = hit.value;
|
16764 | }
|
16765 | return hit;
|
16766 | }
|
16767 | function isStale(self2, hit) {
|
16768 | if (!hit || !hit.maxAge && !self2[MAX_AGE]) {
|
16769 | return false;
|
16770 | }
|
16771 | var stale = false;
|
16772 | var diff = Date.now() - hit.now;
|
16773 | if (hit.maxAge) {
|
16774 | stale = diff > hit.maxAge;
|
16775 | } else {
|
16776 | stale = self2[MAX_AGE] && diff > self2[MAX_AGE];
|
16777 | }
|
16778 | return stale;
|
16779 | }
|
16780 | function trim(self2) {
|
16781 | if (self2[LENGTH] > self2[MAX]) {
|
16782 | for (var walker = self2[LRU_LIST].tail; self2[LENGTH] > self2[MAX] && walker !== null; ) {
|
16783 | var prev = walker.prev;
|
16784 | del(self2, walker);
|
16785 | walker = prev;
|
16786 | }
|
16787 | }
|
16788 | }
|
16789 | function del(self2, node) {
|
16790 | if (node) {
|
16791 | var hit = node.value;
|
16792 | if (self2[DISPOSE]) {
|
16793 | self2[DISPOSE](hit.key, hit.value);
|
16794 | }
|
16795 | self2[LENGTH] -= hit.length;
|
16796 | self2[CACHE].delete(hit.key);
|
16797 | self2[LRU_LIST].removeNode(node);
|
16798 | }
|
16799 | }
|
16800 | function Entry(key, value, length, now, maxAge) {
|
16801 | this.key = key;
|
16802 | this.value = value;
|
16803 | this.length = length;
|
16804 | this.now = now;
|
16805 | this.maxAge = maxAge || 0;
|
16806 | }
|
16807 | }
|
16808 | });
|
16809 | var require_sigmund = __commonJS2({
|
16810 | "node_modules/sigmund/sigmund.js"(exports2, module2) {
|
16811 | module2.exports = sigmund;
|
16812 | function sigmund(subject, maxSessions) {
|
16813 | maxSessions = maxSessions || 10;
|
16814 | var notes = [];
|
16815 | var analysis = "";
|
16816 | var RE = RegExp;
|
16817 | function psychoAnalyze(subject2, session) {
|
16818 | if (session > maxSessions)
|
16819 | return;
|
16820 | if (typeof subject2 === "function" || typeof subject2 === "undefined") {
|
16821 | return;
|
16822 | }
|
16823 | if (typeof subject2 !== "object" || !subject2 || subject2 instanceof RE) {
|
16824 | analysis += subject2;
|
16825 | return;
|
16826 | }
|
16827 | if (notes.indexOf(subject2) !== -1 || session === maxSessions)
|
16828 | return;
|
16829 | notes.push(subject2);
|
16830 | analysis += "{";
|
16831 | Object.keys(subject2).forEach(function(issue, _, __) {
|
16832 | if (issue.charAt(0) === "_")
|
16833 | return;
|
16834 | var to = typeof subject2[issue];
|
16835 | if (to === "function" || to === "undefined")
|
16836 | return;
|
16837 | analysis += issue;
|
16838 | psychoAnalyze(subject2[issue], session + 1);
|
16839 | });
|
16840 | }
|
16841 | psychoAnalyze(subject, 0);
|
16842 | return analysis;
|
16843 | }
|
16844 | }
|
16845 | });
|
16846 | var require_fnmatch = __commonJS2({
|
16847 | "node_modules/editorconfig/src/lib/fnmatch.js"(exports2, module2) {
|
16848 | var platform = typeof process === "object" ? process.platform : "win32";
|
16849 | if (module2)
|
16850 | module2.exports = minimatch;
|
16851 | else
|
16852 | exports2.minimatch = minimatch;
|
16853 | minimatch.Minimatch = Minimatch;
|
16854 | var LRU = require_lru_cache();
|
16855 | var cache = minimatch.cache = new LRU({
|
16856 | max: 100
|
16857 | });
|
16858 | var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
16859 | var sigmund = require_sigmund();
|
16860 | var path = require("path");
|
16861 | var qmark = "[^/]";
|
16862 | var star = qmark + "*?";
|
16863 | var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
16864 | var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
16865 | var reSpecials = charSet("().*{}+?[]^$\\!");
|
16866 | function charSet(s) {
|
16867 | return s.split("").reduce(function(set, c) {
|
16868 | set[c] = true;
|
16869 | return set;
|
16870 | }, {});
|
16871 | }
|
16872 | var slashSplit = /\/+/;
|
16873 | minimatch.monkeyPatch = monkeyPatch;
|
16874 | function monkeyPatch() {
|
16875 | var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
|
16876 | var orig = desc.value;
|
16877 | desc.value = function(p) {
|
16878 | if (p instanceof Minimatch)
|
16879 | return p.match(this);
|
16880 | return orig.call(this, p);
|
16881 | };
|
16882 | Object.defineProperty(String.prototype, desc);
|
16883 | }
|
16884 | minimatch.filter = filter;
|
16885 | function filter(pattern, options) {
|
16886 | options = options || {};
|
16887 | return function(p, i, list) {
|
16888 | return minimatch(p, pattern, options);
|
16889 | };
|
16890 | }
|
16891 | function ext(a, b) {
|
16892 | a = a || {};
|
16893 | b = b || {};
|
16894 | var t = {};
|
16895 | Object.keys(b).forEach(function(k) {
|
16896 | t[k] = b[k];
|
16897 | });
|
16898 | Object.keys(a).forEach(function(k) {
|
16899 | t[k] = a[k];
|
16900 | });
|
16901 | return t;
|
16902 | }
|
16903 | minimatch.defaults = function(def) {
|
16904 | if (!def || !Object.keys(def).length)
|
16905 | return minimatch;
|
16906 | var orig = minimatch;
|
16907 | var m = function minimatch2(p, pattern, options) {
|
16908 | return orig.minimatch(p, pattern, ext(def, options));
|
16909 | };
|
16910 | m.Minimatch = function Minimatch2(pattern, options) {
|
16911 | return new orig.Minimatch(pattern, ext(def, options));
|
16912 | };
|
16913 | return m;
|
16914 | };
|
16915 | Minimatch.defaults = function(def) {
|
16916 | if (!def || !Object.keys(def).length)
|
16917 | return Minimatch;
|
16918 | return minimatch.defaults(def).Minimatch;
|
16919 | };
|
16920 | function minimatch(p, pattern, options) {
|
16921 | if (typeof pattern !== "string") {
|
16922 | throw new TypeError("glob pattern string required");
|
16923 | }
|
16924 | if (!options)
|
16925 | options = {};
|
16926 | if (!options.nocomment && pattern.charAt(0) === "#") {
|
16927 | return false;
|
16928 | }
|
16929 | if (pattern.trim() === "")
|
16930 | return p === "";
|
16931 | return new Minimatch(pattern, options).match(p);
|
16932 | }
|
16933 | function Minimatch(pattern, options) {
|
16934 | if (!(this instanceof Minimatch)) {
|
16935 | return new Minimatch(pattern, options, cache);
|
16936 | }
|
16937 | if (typeof pattern !== "string") {
|
16938 | throw new TypeError("glob pattern string required");
|
16939 | }
|
16940 | if (!options)
|
16941 | options = {};
|
16942 | if (platform === "win32") {
|
16943 | pattern = pattern.split("\\").join("/");
|
16944 | }
|
16945 | var cacheKey = pattern + "\n" + sigmund(options);
|
16946 | var cached = minimatch.cache.get(cacheKey);
|
16947 | if (cached)
|
16948 | return cached;
|
16949 | minimatch.cache.set(cacheKey, this);
|
16950 | this.options = options;
|
16951 | this.set = [];
|
16952 | this.pattern = pattern;
|
16953 | this.regexp = null;
|
16954 | this.negate = false;
|
16955 | this.comment = false;
|
16956 | this.empty = false;
|
16957 | this.make();
|
16958 | }
|
16959 | Minimatch.prototype.make = make;
|
16960 | function make() {
|
16961 | if (this._made)
|
16962 | return;
|
16963 | var pattern = this.pattern;
|
16964 | var options = this.options;
|
16965 | if (!options.nocomment && pattern.charAt(0) === "#") {
|
16966 | this.comment = true;
|
16967 | return;
|
16968 | }
|
16969 | if (!pattern) {
|
16970 | this.empty = true;
|
16971 | return;
|
16972 | }
|
16973 | this.parseNegate();
|
16974 | var set = this.globSet = this.braceExpand();
|
16975 | if (options.debug)
|
16976 | console.error(this.pattern, set);
|
16977 | set = this.globParts = set.map(function(s) {
|
16978 | return s.split(slashSplit);
|
16979 | });
|
16980 | if (options.debug)
|
16981 | console.error(this.pattern, set);
|
16982 | set = set.map(function(s, si, set2) {
|
16983 | return s.map(this.parse, this);
|
16984 | }, this);
|
16985 | if (options.debug)
|
16986 | console.error(this.pattern, set);
|
16987 | set = set.filter(function(s) {
|
16988 | return s.indexOf(false) === -1;
|
16989 | });
|
16990 | if (options.debug)
|
16991 | console.error(this.pattern, set);
|
16992 | this.set = set;
|
16993 | }
|
16994 | Minimatch.prototype.parseNegate = parseNegate;
|
16995 | function parseNegate() {
|
16996 | var pattern = this.pattern, negate = false, options = this.options, negateOffset = 0;
|
16997 | if (options.nonegate)
|
16998 | return;
|
16999 | for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
17000 | negate = !negate;
|
17001 | negateOffset++;
|
17002 | }
|
17003 | if (negateOffset)
|
17004 | this.pattern = pattern.substr(negateOffset);
|
17005 | this.negate = negate;
|
17006 | }
|
17007 | minimatch.braceExpand = function(pattern, options) {
|
17008 | return new Minimatch(pattern, options).braceExpand();
|
17009 | };
|
17010 | Minimatch.prototype.braceExpand = braceExpand;
|
17011 | function braceExpand(pattern, options) {
|
17012 | options = options || this.options;
|
17013 | pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
17014 | if (typeof pattern === "undefined") {
|
17015 | throw new Error("undefined pattern");
|
17016 | }
|
17017 | if (options.nobrace || !pattern.match(/\{.*\}/)) {
|
17018 | return [pattern];
|
17019 | }
|
17020 | var escaping = false;
|
17021 | if (pattern.charAt(0) !== "{") {
|
17022 | var prefix = null;
|
17023 | for (var i = 0, l = pattern.length; i < l; i++) {
|
17024 | var c = pattern.charAt(i);
|
17025 | if (c === "\\") {
|
17026 | escaping = !escaping;
|
17027 | } else if (c === "{" && !escaping) {
|
17028 | prefix = pattern.substr(0, i);
|
17029 | break;
|
17030 | }
|
17031 | }
|
17032 | if (prefix === null) {
|
17033 | return [pattern];
|
17034 | }
|
17035 | var tail = braceExpand(pattern.substr(i), options);
|
17036 | return tail.map(function(t) {
|
17037 | return prefix + t;
|
17038 | });
|
17039 | }
|
17040 | var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
|
17041 | if (numset) {
|
17042 | var suf = braceExpand(pattern.substr(numset[0].length), options), start = +numset[1], end = +numset[2], inc = start > end ? -1 : 1, set = [];
|
17043 | for (var i = start; i != end + inc; i += inc) {
|
17044 | for (var ii = 0, ll = suf.length; ii < ll; ii++) {
|
17045 | set.push(i + suf[ii]);
|
17046 | }
|
17047 | }
|
17048 | return set;
|
17049 | }
|
17050 | var i = 1, depth = 1, set = [], member = "", sawEnd = false, escaping = false;
|
17051 | function addMember() {
|
17052 | set.push(member);
|
17053 | member = "";
|
17054 | }
|
17055 | FOR:
|
17056 | for (i = 1, l = pattern.length; i < l; i++) {
|
17057 | var c = pattern.charAt(i);
|
17058 | if (escaping) {
|
17059 | escaping = false;
|
17060 | member += "\\" + c;
|
17061 | } else {
|
17062 | switch (c) {
|
17063 | case "\\":
|
17064 | escaping = true;
|
17065 | continue;
|
17066 | case "{":
|
17067 | depth++;
|
17068 | member += "{";
|
17069 | continue;
|
17070 | case "}":
|
17071 | depth--;
|
17072 | if (depth === 0) {
|
17073 | addMember();
|
17074 | i++;
|
17075 | break FOR;
|
17076 | } else {
|
17077 | member += c;
|
17078 | continue;
|
17079 | }
|
17080 | case ",":
|
17081 | if (depth === 1) {
|
17082 | addMember();
|
17083 | } else {
|
17084 | member += c;
|
17085 | }
|
17086 | continue;
|
17087 | default:
|
17088 | member += c;
|
17089 | continue;
|
17090 | }
|
17091 | }
|
17092 | }
|
17093 | if (depth !== 0) {
|
17094 | return braceExpand("\\" + pattern, options);
|
17095 | }
|
17096 | var suf = braceExpand(pattern.substr(i), options);
|
17097 | var addBraces = set.length === 1;
|
17098 | set = set.map(function(p) {
|
17099 | return braceExpand(p, options);
|
17100 | });
|
17101 | set = set.reduce(function(l2, r) {
|
17102 | return l2.concat(r);
|
17103 | });
|
17104 | if (addBraces) {
|
17105 | set = set.map(function(s) {
|
17106 | return "{" + s + "}";
|
17107 | });
|
17108 | }
|
17109 | var ret = [];
|
17110 | for (var i = 0, l = set.length; i < l; i++) {
|
17111 | for (var ii = 0, ll = suf.length; ii < ll; ii++) {
|
17112 | ret.push(set[i] + suf[ii]);
|
17113 | }
|
17114 | }
|
17115 | return ret;
|
17116 | }
|
17117 | Minimatch.prototype.parse = parse;
|
17118 | var SUBPARSE = {};
|
17119 | function parse(pattern, isSub) {
|
17120 | var options = this.options;
|
17121 | if (!options.noglobstar && pattern === "**")
|
17122 | return GLOBSTAR;
|
17123 | if (pattern === "")
|
17124 | return "";
|
17125 | var re = "", hasMagic = !!options.nocase, escaping = false, patternListStack = [], plType, stateChar, inClass = false, reClassStart = -1, classStart = -1, patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
17126 | function clearStateChar() {
|
17127 | if (stateChar) {
|
17128 | switch (stateChar) {
|
17129 | case "*":
|
17130 | re += star;
|
17131 | hasMagic = true;
|
17132 | break;
|
17133 | case "?":
|
17134 | re += qmark;
|
17135 | hasMagic = true;
|
17136 | break;
|
17137 | default:
|
17138 | re += "\\" + stateChar;
|
17139 | break;
|
17140 | }
|
17141 | stateChar = false;
|
17142 | }
|
17143 | }
|
17144 | for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
|
17145 | if (options.debug) {
|
17146 | console.error("%s %s %s %j", pattern, i, re, c);
|
17147 | }
|
17148 | if (escaping && reSpecials[c]) {
|
17149 | re += "\\" + c;
|
17150 | escaping = false;
|
17151 | continue;
|
17152 | }
|
17153 | SWITCH:
|
17154 | switch (c) {
|
17155 | case "/":
|
17156 | return false;
|
17157 | case "\\":
|
17158 | clearStateChar();
|
17159 | escaping = true;
|
17160 | continue;
|
17161 | case "?":
|
17162 | case "*":
|
17163 | case "+":
|
17164 | case "@":
|
17165 | case "!":
|
17166 | if (options.debug) {
|
17167 | console.error("%s %s %s %j <-- stateChar", pattern, i, re, c);
|
17168 | }
|
17169 | if (inClass) {
|
17170 | if (c === "!" && i === classStart + 1)
|
17171 | c = "^";
|
17172 | re += c;
|
17173 | continue;
|
17174 | }
|
17175 | clearStateChar();
|
17176 | stateChar = c;
|
17177 | if (options.noext)
|
17178 | clearStateChar();
|
17179 | continue;
|
17180 | case "(":
|
17181 | if (inClass) {
|
17182 | re += "(";
|
17183 | continue;
|
17184 | }
|
17185 | if (!stateChar) {
|
17186 | re += "\\(";
|
17187 | continue;
|
17188 | }
|
17189 | plType = stateChar;
|
17190 | patternListStack.push({
|
17191 | type: plType,
|
17192 | start: i - 1,
|
17193 | reStart: re.length
|
17194 | });
|
17195 | re += stateChar === "!" ? "(?:(?!" : "(?:";
|
17196 | stateChar = false;
|
17197 | continue;
|
17198 | case ")":
|
17199 | if (inClass || !patternListStack.length) {
|
17200 | re += "\\)";
|
17201 | continue;
|
17202 | }
|
17203 | hasMagic = true;
|
17204 | re += ")";
|
17205 | plType = patternListStack.pop().type;
|
17206 | switch (plType) {
|
17207 | case "!":
|
17208 | re += "[^/]*?)";
|
17209 | break;
|
17210 | case "?":
|
17211 | case "+":
|
17212 | case "*":
|
17213 | re += plType;
|
17214 | case "@":
|
17215 | break;
|
17216 | }
|
17217 | continue;
|
17218 | case "|":
|
17219 | if (inClass || !patternListStack.length || escaping) {
|
17220 | re += "\\|";
|
17221 | escaping = false;
|
17222 | continue;
|
17223 | }
|
17224 | re += "|";
|
17225 | continue;
|
17226 | case "[":
|
17227 | clearStateChar();
|
17228 | if (inClass) {
|
17229 | re += "\\" + c;
|
17230 | continue;
|
17231 | }
|
17232 | inClass = true;
|
17233 | classStart = i;
|
17234 | reClassStart = re.length;
|
17235 | re += c;
|
17236 | continue;
|
17237 | case "]":
|
17238 | if (i === classStart + 1 || !inClass) {
|
17239 | re += "\\" + c;
|
17240 | escaping = false;
|
17241 | continue;
|
17242 | }
|
17243 | hasMagic = true;
|
17244 | inClass = false;
|
17245 | re += c;
|
17246 | continue;
|
17247 | default:
|
17248 | clearStateChar();
|
17249 | if (escaping) {
|
17250 | escaping = false;
|
17251 | } else if (reSpecials[c] && !(c === "^" && inClass)) {
|
17252 | re += "\\";
|
17253 | }
|
17254 | re += c;
|
17255 | }
|
17256 | }
|
17257 | if (inClass) {
|
17258 | var cs = pattern.substr(classStart + 1), sp = this.parse(cs, SUBPARSE);
|
17259 | re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
17260 | hasMagic = hasMagic || sp[1];
|
17261 | }
|
17262 | var pl;
|
17263 | while (pl = patternListStack.pop()) {
|
17264 | var tail = re.slice(pl.reStart + 3);
|
17265 | tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function(_, $1, $2) {
|
17266 | if (!$2) {
|
17267 | $2 = "\\";
|
17268 | }
|
17269 | return $1 + $1 + $2 + "|";
|
17270 | });
|
17271 | var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
17272 | hasMagic = true;
|
17273 | re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
17274 | }
|
17275 | clearStateChar();
|
17276 | if (escaping) {
|
17277 | re += "\\\\";
|
17278 | }
|
17279 | var addPatternStart = false;
|
17280 | switch (re.charAt(0)) {
|
17281 | case ".":
|
17282 | case "[":
|
17283 | case "(":
|
17284 | addPatternStart = true;
|
17285 | }
|
17286 | if (re !== "" && hasMagic)
|
17287 | re = "(?=.)" + re;
|
17288 | if (addPatternStart)
|
17289 | re = patternStart + re;
|
17290 | if (isSub === SUBPARSE) {
|
17291 | return [re, hasMagic];
|
17292 | }
|
17293 | if (!hasMagic) {
|
17294 | return globUnescape(pattern);
|
17295 | }
|
17296 | var flags = options.nocase ? "i" : "", regExp = new RegExp("^" + re + "$", flags);
|
17297 | regExp._glob = pattern;
|
17298 | regExp._src = re;
|
17299 | return regExp;
|
17300 | }
|
17301 | minimatch.makeRe = function(pattern, options) {
|
17302 | return new Minimatch(pattern, options || {}).makeRe();
|
17303 | };
|
17304 | Minimatch.prototype.makeRe = makeRe;
|
17305 | function makeRe() {
|
17306 | if (this.regexp || this.regexp === false)
|
17307 | return this.regexp;
|
17308 | var set = this.set;
|
17309 | if (!set.length)
|
17310 | return this.regexp = false;
|
17311 | var options = this.options;
|
17312 | var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot, flags = options.nocase ? "i" : "";
|
17313 | var re = set.map(function(pattern) {
|
17314 | return pattern.map(function(p) {
|
17315 | return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
17316 | }).join("\\/");
|
17317 | }).join("|");
|
17318 | re = "^(?:" + re + ")$";
|
17319 | if (this.negate)
|
17320 | re = "^(?!" + re + ").*$";
|
17321 | try {
|
17322 | return this.regexp = new RegExp(re, flags);
|
17323 | } catch (ex) {
|
17324 | return this.regexp = false;
|
17325 | }
|
17326 | }
|
17327 | minimatch.match = function(list, pattern, options) {
|
17328 | var mm = new Minimatch(pattern, options);
|
17329 | list = list.filter(function(f) {
|
17330 | return mm.match(f);
|
17331 | });
|
17332 | if (options.nonull && !list.length) {
|
17333 | list.push(pattern);
|
17334 | }
|
17335 | return list;
|
17336 | };
|
17337 | Minimatch.prototype.match = match;
|
17338 | function match(f, partial) {
|
17339 | if (this.comment)
|
17340 | return false;
|
17341 | if (this.empty)
|
17342 | return f === "";
|
17343 | if (f === "/" && partial)
|
17344 | return true;
|
17345 | var options = this.options;
|
17346 | if (platform === "win32") {
|
17347 | f = f.split("\\").join("/");
|
17348 | }
|
17349 | f = f.split(slashSplit);
|
17350 | if (options.debug) {
|
17351 | console.error(this.pattern, "split", f);
|
17352 | }
|
17353 | var set = this.set;
|
17354 | for (var i = 0, l = set.length; i < l; i++) {
|
17355 | var pattern = set[i];
|
17356 | var hit = this.matchOne(f, pattern, partial);
|
17357 | if (hit) {
|
17358 | if (options.flipNegate)
|
17359 | return true;
|
17360 | return !this.negate;
|
17361 | }
|
17362 | }
|
17363 | if (options.flipNegate)
|
17364 | return false;
|
17365 | return this.negate;
|
17366 | }
|
17367 | Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
17368 | var options = this.options;
|
17369 | if (options.debug) {
|
17370 | console.error("matchOne", {
|
17371 | "this": this,
|
17372 | file,
|
17373 | pattern
|
17374 | });
|
17375 | }
|
17376 | if (options.matchBase && pattern.length === 1) {
|
17377 | file = path.basename(file.join("/")).split("/");
|
17378 | }
|
17379 | if (options.debug) {
|
17380 | console.error("matchOne", file.length, pattern.length);
|
17381 | }
|
17382 | for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
17383 | if (options.debug) {
|
17384 | console.error("matchOne loop");
|
17385 | }
|
17386 | var p = pattern[pi], f = file[fi];
|
17387 | if (options.debug) {
|
17388 | console.error(pattern, p, f);
|
17389 | }
|
17390 | if (p === false)
|
17391 | return false;
|
17392 | if (p === GLOBSTAR) {
|
17393 | if (options.debug)
|
17394 | console.error("GLOBSTAR", [pattern, p, f]);
|
17395 | var fr = fi, pr = pi + 1;
|
17396 | if (pr === pl) {
|
17397 | if (options.debug)
|
17398 | console.error("** at the end");
|
17399 | for (; fi < fl; fi++) {
|
17400 | if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
17401 | return false;
|
17402 | }
|
17403 | return true;
|
17404 | }
|
17405 | WHILE:
|
17406 | while (fr < fl) {
|
17407 | var swallowee = file[fr];
|
17408 | if (options.debug) {
|
17409 | console.error("\nglobstar while", file, fr, pattern, pr, swallowee);
|
17410 | }
|
17411 | if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
17412 | if (options.debug)
|
17413 | console.error("globstar found match!", fr, fl, swallowee);
|
17414 | return true;
|
17415 | } else {
|
17416 | if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
17417 | if (options.debug)
|
17418 | console.error("dot detected!", file, fr, pattern, pr);
|
17419 | break WHILE;
|
17420 | }
|
17421 | if (options.debug)
|
17422 | console.error("globstar swallow a segment, and continue");
|
17423 | fr++;
|
17424 | }
|
17425 | }
|
17426 | if (partial) {
|
17427 | if (fr === fl)
|
17428 | return true;
|
17429 | }
|
17430 | return false;
|
17431 | }
|
17432 | var hit;
|
17433 | if (typeof p === "string") {
|
17434 | if (options.nocase) {
|
17435 | hit = f.toLowerCase() === p.toLowerCase();
|
17436 | } else {
|
17437 | hit = f === p;
|
17438 | }
|
17439 | if (options.debug) {
|
17440 | console.error("string match", p, f, hit);
|
17441 | }
|
17442 | } else {
|
17443 | hit = f.match(p);
|
17444 | if (options.debug) {
|
17445 | console.error("pattern match", p, f, hit);
|
17446 | }
|
17447 | }
|
17448 | if (!hit)
|
17449 | return false;
|
17450 | }
|
17451 | if (fi === fl && pi === pl) {
|
17452 | return true;
|
17453 | } else if (fi === fl) {
|
17454 | return partial;
|
17455 | } else if (pi === pl) {
|
17456 | var emptyFileEnd = fi === fl - 1 && file[fi] === "";
|
17457 | return emptyFileEnd;
|
17458 | }
|
17459 | throw new Error("wtf?");
|
17460 | };
|
17461 | function globUnescape(s) {
|
17462 | return s.replace(/\\(.)/g, "$1");
|
17463 | }
|
17464 | function regExpEscape(s) {
|
17465 | return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
17466 | }
|
17467 | }
|
17468 | });
|
17469 | var require_ini = __commonJS2({
|
17470 | "node_modules/editorconfig/src/lib/ini.js"(exports2) {
|
17471 | "use strict";
|
17472 | var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
|
17473 | return new (P || (P = Promise))(function(resolve, reject) {
|
17474 | function fulfilled(value) {
|
17475 | try {
|
17476 | step(generator.next(value));
|
17477 | } catch (e) {
|
17478 | reject(e);
|
17479 | }
|
17480 | }
|
17481 | function rejected(value) {
|
17482 | try {
|
17483 | step(generator["throw"](value));
|
17484 | } catch (e) {
|
17485 | reject(e);
|
17486 | }
|
17487 | }
|
17488 | function step(result) {
|
17489 | result.done ? resolve(result.value) : new P(function(resolve2) {
|
17490 | resolve2(result.value);
|
17491 | }).then(fulfilled, rejected);
|
17492 | }
|
17493 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
17494 | });
|
17495 | };
|
17496 | var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
|
17497 | var _ = {
|
17498 | label: 0,
|
17499 | sent: function() {
|
17500 | if (t[0] & 1)
|
17501 | throw t[1];
|
17502 | return t[1];
|
17503 | },
|
17504 | trys: [],
|
17505 | ops: []
|
17506 | }, f, y, t, g;
|
17507 | return g = {
|
17508 | next: verb(0),
|
17509 | "throw": verb(1),
|
17510 | "return": verb(2)
|
17511 | }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
17512 | return this;
|
17513 | }), g;
|
17514 | function verb(n) {
|
17515 | return function(v) {
|
17516 | return step([n, v]);
|
17517 | };
|
17518 | }
|
17519 | function step(op) {
|
17520 | if (f)
|
17521 | throw new TypeError("Generator is already executing.");
|
17522 | while (_)
|
17523 | try {
|
17524 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
17525 | return t;
|
17526 | if (y = 0, t)
|
17527 | op = [op[0] & 2, t.value];
|
17528 | switch (op[0]) {
|
17529 | case 0:
|
17530 | case 1:
|
17531 | t = op;
|
17532 | break;
|
17533 | case 4:
|
17534 | _.label++;
|
17535 | return {
|
17536 | value: op[1],
|
17537 | done: false
|
17538 | };
|
17539 | case 5:
|
17540 | _.label++;
|
17541 | y = op[1];
|
17542 | op = [0];
|
17543 | continue;
|
17544 | case 7:
|
17545 | op = _.ops.pop();
|
17546 | _.trys.pop();
|
17547 | continue;
|
17548 | default:
|
17549 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
17550 | _ = 0;
|
17551 | continue;
|
17552 | }
|
17553 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
17554 | _.label = op[1];
|
17555 | break;
|
17556 | }
|
17557 | if (op[0] === 6 && _.label < t[1]) {
|
17558 | _.label = t[1];
|
17559 | t = op;
|
17560 | break;
|
17561 | }
|
17562 | if (t && _.label < t[2]) {
|
17563 | _.label = t[2];
|
17564 | _.ops.push(op);
|
17565 | break;
|
17566 | }
|
17567 | if (t[2])
|
17568 | _.ops.pop();
|
17569 | _.trys.pop();
|
17570 | continue;
|
17571 | }
|
17572 | op = body.call(thisArg, _);
|
17573 | } catch (e) {
|
17574 | op = [6, e];
|
17575 | y = 0;
|
17576 | } finally {
|
17577 | f = t = 0;
|
17578 | }
|
17579 | if (op[0] & 5)
|
17580 | throw op[1];
|
17581 | return {
|
17582 | value: op[0] ? op[1] : void 0,
|
17583 | done: true
|
17584 | };
|
17585 | }
|
17586 | };
|
17587 | var __importStar2 = exports2 && exports2.__importStar || function(mod) {
|
17588 | if (mod && mod.__esModule)
|
17589 | return mod;
|
17590 | var result = {};
|
17591 | if (mod != null) {
|
17592 | for (var k in mod)
|
17593 | if (Object.hasOwnProperty.call(mod, k))
|
17594 | result[k] = mod[k];
|
17595 | }
|
17596 | result["default"] = mod;
|
17597 | return result;
|
17598 | };
|
17599 | Object.defineProperty(exports2, "__esModule", {
|
17600 | value: true
|
17601 | });
|
17602 | var fs = __importStar2(require("fs"));
|
17603 | var regex = {
|
17604 | section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
|
17605 | param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
|
17606 | comment: /^\s*[#;].*$/
|
17607 | };
|
17608 | function parse(file) {
|
17609 | return __awaiter2(this, void 0, void 0, function() {
|
17610 | return __generator2(this, function(_a) {
|
17611 | return [2, new Promise(function(resolve, reject) {
|
17612 | fs.readFile(file, "utf8", function(err, data) {
|
17613 | if (err) {
|
17614 | reject(err);
|
17615 | return;
|
17616 | }
|
17617 | resolve(parseString(data));
|
17618 | });
|
17619 | })];
|
17620 | });
|
17621 | });
|
17622 | }
|
17623 | exports2.parse = parse;
|
17624 | function parseSync(file) {
|
17625 | return parseString(fs.readFileSync(file, "utf8"));
|
17626 | }
|
17627 | exports2.parseSync = parseSync;
|
17628 | function parseString(data) {
|
17629 | var sectionBody = {};
|
17630 | var sectionName = null;
|
17631 | var value = [[sectionName, sectionBody]];
|
17632 | var lines = data.split(/\r\n|\r|\n/);
|
17633 | lines.forEach(function(line) {
|
17634 | var match;
|
17635 | if (regex.comment.test(line)) {
|
17636 | return;
|
17637 | }
|
17638 | if (regex.param.test(line)) {
|
17639 | match = line.match(regex.param);
|
17640 | sectionBody[match[1]] = match[2];
|
17641 | } else if (regex.section.test(line)) {
|
17642 | match = line.match(regex.section);
|
17643 | sectionName = match[1];
|
17644 | sectionBody = {};
|
17645 | value.push([sectionName, sectionBody]);
|
17646 | }
|
17647 | });
|
17648 | return value;
|
17649 | }
|
17650 | exports2.parseString = parseString;
|
17651 | }
|
17652 | });
|
17653 | var require_package = __commonJS2({
|
17654 | "node_modules/editorconfig/package.json"(exports2, module2) {
|
17655 | module2.exports = {
|
17656 | name: "editorconfig",
|
17657 | version: "0.15.3",
|
17658 | description: "EditorConfig File Locator and Interpreter for Node.js",
|
17659 | keywords: ["editorconfig", "core"],
|
17660 | main: "src/index.js",
|
17661 | contributors: ["Hong Xu (topbug.net)", "Jed Mao (https://github.com/jedmao/)", "Trey Hunner (http://treyhunner.com)"],
|
17662 | directories: {
|
17663 | bin: "./bin",
|
17664 | lib: "./lib"
|
17665 | },
|
17666 | scripts: {
|
17667 | clean: "rimraf dist",
|
17668 | prebuild: "npm run clean",
|
17669 | build: "tsc",
|
17670 | pretest: "npm run lint && npm run build && npm run copy && cmake .",
|
17671 | test: "ctest .",
|
17672 | "pretest:ci": "npm run pretest",
|
17673 | "test:ci": "ctest -VV --output-on-failure .",
|
17674 | lint: "npm run eclint && npm run tslint",
|
17675 | eclint: 'eclint check --indent_size ignore "src/**"',
|
17676 | tslint: "tslint --project tsconfig.json --exclude package.json",
|
17677 | copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
|
17678 | prepub: "npm run lint && npm run build && npm run copy",
|
17679 | pub: "npm publish ./dist"
|
17680 | },
|
17681 | repository: {
|
17682 | type: "git",
|
17683 | url: "git://github.com/editorconfig/editorconfig-core-js.git"
|
17684 | },
|
17685 | bugs: "https://github.com/editorconfig/editorconfig-core-js/issues",
|
17686 | author: "EditorConfig Team",
|
17687 | license: "MIT",
|
17688 | dependencies: {
|
17689 | commander: "^2.19.0",
|
17690 | "lru-cache": "^4.1.5",
|
17691 | semver: "^5.6.0",
|
17692 | sigmund: "^1.0.1"
|
17693 | },
|
17694 | devDependencies: {
|
17695 | "@types/mocha": "^5.2.6",
|
17696 | "@types/node": "^10.12.29",
|
17697 | "@types/semver": "^5.5.0",
|
17698 | "cpy-cli": "^2.0.0",
|
17699 | eclint: "^2.8.1",
|
17700 | mocha: "^5.2.0",
|
17701 | rimraf: "^2.6.3",
|
17702 | should: "^13.2.3",
|
17703 | tslint: "^5.13.1",
|
17704 | typescript: "^3.3.3333"
|
17705 | }
|
17706 | };
|
17707 | }
|
17708 | });
|
17709 | var require_src2 = __commonJS2({
|
17710 | "node_modules/editorconfig/src/index.js"(exports2) {
|
17711 | "use strict";
|
17712 | var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
|
17713 | return new (P || (P = Promise))(function(resolve, reject) {
|
17714 | function fulfilled(value) {
|
17715 | try {
|
17716 | step(generator.next(value));
|
17717 | } catch (e) {
|
17718 | reject(e);
|
17719 | }
|
17720 | }
|
17721 | function rejected(value) {
|
17722 | try {
|
17723 | step(generator["throw"](value));
|
17724 | } catch (e) {
|
17725 | reject(e);
|
17726 | }
|
17727 | }
|
17728 | function step(result) {
|
17729 | result.done ? resolve(result.value) : new P(function(resolve2) {
|
17730 | resolve2(result.value);
|
17731 | }).then(fulfilled, rejected);
|
17732 | }
|
17733 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
17734 | });
|
17735 | };
|
17736 | var __generator2 = exports2 && exports2.__generator || function(thisArg, body) {
|
17737 | var _ = {
|
17738 | label: 0,
|
17739 | sent: function() {
|
17740 | if (t[0] & 1)
|
17741 | throw t[1];
|
17742 | return t[1];
|
17743 | },
|
17744 | trys: [],
|
17745 | ops: []
|
17746 | }, f, y, t, g;
|
17747 | return g = {
|
17748 | next: verb(0),
|
17749 | "throw": verb(1),
|
17750 | "return": verb(2)
|
17751 | }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
17752 | return this;
|
17753 | }), g;
|
17754 | function verb(n) {
|
17755 | return function(v) {
|
17756 | return step([n, v]);
|
17757 | };
|
17758 | }
|
17759 | function step(op) {
|
17760 | if (f)
|
17761 | throw new TypeError("Generator is already executing.");
|
17762 | while (_)
|
17763 | try {
|
17764 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
17765 | return t;
|
17766 | if (y = 0, t)
|
17767 | op = [op[0] & 2, t.value];
|
17768 | switch (op[0]) {
|
17769 | case 0:
|
17770 | case 1:
|
17771 | t = op;
|
17772 | break;
|
17773 | case 4:
|
17774 | _.label++;
|
17775 | return {
|
17776 | value: op[1],
|
17777 | done: false
|
17778 | };
|
17779 | case 5:
|
17780 | _.label++;
|
17781 | y = op[1];
|
17782 | op = [0];
|
17783 | continue;
|
17784 | case 7:
|
17785 | op = _.ops.pop();
|
17786 | _.trys.pop();
|
17787 | continue;
|
17788 | default:
|
17789 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
17790 | _ = 0;
|
17791 | continue;
|
17792 | }
|
17793 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
17794 | _.label = op[1];
|
17795 | break;
|
17796 | }
|
17797 | if (op[0] === 6 && _.label < t[1]) {
|
17798 | _.label = t[1];
|
17799 | t = op;
|
17800 | break;
|
17801 | }
|
17802 | if (t && _.label < t[2]) {
|
17803 | _.label = t[2];
|
17804 | _.ops.push(op);
|
17805 | break;
|
17806 | }
|
17807 | if (t[2])
|
17808 | _.ops.pop();
|
17809 | _.trys.pop();
|
17810 | continue;
|
17811 | }
|
17812 | op = body.call(thisArg, _);
|
17813 | } catch (e) {
|
17814 | op = [6, e];
|
17815 | y = 0;
|
17816 | } finally {
|
17817 | f = t = 0;
|
17818 | }
|
17819 | if (op[0] & 5)
|
17820 | throw op[1];
|
17821 | return {
|
17822 | value: op[0] ? op[1] : void 0,
|
17823 | done: true
|
17824 | };
|
17825 | }
|
17826 | };
|
17827 | var __importStar2 = exports2 && exports2.__importStar || function(mod) {
|
17828 | if (mod && mod.__esModule)
|
17829 | return mod;
|
17830 | var result = {};
|
17831 | if (mod != null) {
|
17832 | for (var k in mod)
|
17833 | if (Object.hasOwnProperty.call(mod, k))
|
17834 | result[k] = mod[k];
|
17835 | }
|
17836 | result["default"] = mod;
|
17837 | return result;
|
17838 | };
|
17839 | var __importDefault2 = exports2 && exports2.__importDefault || function(mod) {
|
17840 | return mod && mod.__esModule ? mod : {
|
17841 | "default": mod
|
17842 | };
|
17843 | };
|
17844 | Object.defineProperty(exports2, "__esModule", {
|
17845 | value: true
|
17846 | });
|
17847 | var fs = __importStar2(require("fs"));
|
17848 | var path = __importStar2(require("path"));
|
17849 | var semver = {
|
17850 | gte: require_gte()
|
17851 | };
|
17852 | var fnmatch_1 = __importDefault2(require_fnmatch());
|
17853 | var ini_1 = require_ini();
|
17854 | exports2.parseString = ini_1.parseString;
|
17855 | var package_json_1 = __importDefault2(require_package());
|
17856 | var knownProps = {
|
17857 | end_of_line: true,
|
17858 | indent_style: true,
|
17859 | indent_size: true,
|
17860 | insert_final_newline: true,
|
17861 | trim_trailing_whitespace: true,
|
17862 | charset: true
|
17863 | };
|
17864 | function fnmatch(filepath, glob) {
|
17865 | var matchOptions = {
|
17866 | matchBase: true,
|
17867 | dot: true,
|
17868 | noext: true
|
17869 | };
|
17870 | glob = glob.replace(/\*\*/g, "{*,**/**/**}");
|
17871 | return fnmatch_1.default(filepath, glob, matchOptions);
|
17872 | }
|
17873 | function getConfigFileNames(filepath, options) {
|
17874 | var paths = [];
|
17875 | do {
|
17876 | filepath = path.dirname(filepath);
|
17877 | paths.push(path.join(filepath, options.config));
|
17878 | } while (filepath !== options.root);
|
17879 | return paths;
|
17880 | }
|
17881 | function processMatches(matches, version2) {
|
17882 | if ("indent_style" in matches && matches.indent_style === "tab" && !("indent_size" in matches) && semver.gte(version2, "0.10.0")) {
|
17883 | matches.indent_size = "tab";
|
17884 | }
|
17885 | if ("indent_size" in matches && !("tab_width" in matches) && matches.indent_size !== "tab") {
|
17886 | matches.tab_width = matches.indent_size;
|
17887 | }
|
17888 | if ("indent_size" in matches && "tab_width" in matches && matches.indent_size === "tab") {
|
17889 | matches.indent_size = matches.tab_width;
|
17890 | }
|
17891 | return matches;
|
17892 | }
|
17893 | function processOptions(options, filepath) {
|
17894 | if (options === void 0) {
|
17895 | options = {};
|
17896 | }
|
17897 | return {
|
17898 | config: options.config || ".editorconfig",
|
17899 | version: options.version || package_json_1.default.version,
|
17900 | root: path.resolve(options.root || path.parse(filepath).root)
|
17901 | };
|
17902 | }
|
17903 | function buildFullGlob(pathPrefix, glob) {
|
17904 | switch (glob.indexOf("/")) {
|
17905 | case -1:
|
17906 | glob = "**/" + glob;
|
17907 | break;
|
17908 | case 0:
|
17909 | glob = glob.substring(1);
|
17910 | break;
|
17911 | default:
|
17912 | break;
|
17913 | }
|
17914 | return path.join(pathPrefix, glob);
|
17915 | }
|
17916 | function extendProps(props, options) {
|
17917 | if (props === void 0) {
|
17918 | props = {};
|
17919 | }
|
17920 | if (options === void 0) {
|
17921 | options = {};
|
17922 | }
|
17923 | for (var key in options) {
|
17924 | if (options.hasOwnProperty(key)) {
|
17925 | var value = options[key];
|
17926 | var key2 = key.toLowerCase();
|
17927 | var value2 = value;
|
17928 | if (knownProps[key2]) {
|
17929 | value2 = value.toLowerCase();
|
17930 | }
|
17931 | try {
|
17932 | value2 = JSON.parse(value);
|
17933 | } catch (e) {
|
17934 | }
|
17935 | if (typeof value === "undefined" || value === null) {
|
17936 | value2 = String(value);
|
17937 | }
|
17938 | props[key2] = value2;
|
17939 | }
|
17940 | }
|
17941 | return props;
|
17942 | }
|
17943 | function parseFromConfigs(configs, filepath, options) {
|
17944 | return processMatches(configs.reverse().reduce(function(matches, file) {
|
17945 | var pathPrefix = path.dirname(file.name);
|
17946 | file.contents.forEach(function(section) {
|
17947 | var glob = section[0];
|
17948 | var options2 = section[1];
|
17949 | if (!glob) {
|
17950 | return;
|
17951 | }
|
17952 | var fullGlob = buildFullGlob(pathPrefix, glob);
|
17953 | if (!fnmatch(filepath, fullGlob)) {
|
17954 | return;
|
17955 | }
|
17956 | matches = extendProps(matches, options2);
|
17957 | });
|
17958 | return matches;
|
17959 | }, {}), options.version);
|
17960 | }
|
17961 | function getConfigsForFiles(files) {
|
17962 | var configs = [];
|
17963 | for (var i in files) {
|
17964 | if (files.hasOwnProperty(i)) {
|
17965 | var file = files[i];
|
17966 | var contents = ini_1.parseString(file.contents);
|
17967 | configs.push({
|
17968 | name: file.name,
|
17969 | contents
|
17970 | });
|
17971 | if ((contents[0][1].root || "").toLowerCase() === "true") {
|
17972 | break;
|
17973 | }
|
17974 | }
|
17975 | }
|
17976 | return configs;
|
17977 | }
|
17978 | function readConfigFiles(filepaths) {
|
17979 | return __awaiter2(this, void 0, void 0, function() {
|
17980 | return __generator2(this, function(_a) {
|
17981 | return [2, Promise.all(filepaths.map(function(name) {
|
17982 | return new Promise(function(resolve) {
|
17983 | fs.readFile(name, "utf8", function(err, data) {
|
17984 | resolve({
|
17985 | name,
|
17986 | contents: err ? "" : data
|
17987 | });
|
17988 | });
|
17989 | });
|
17990 | }))];
|
17991 | });
|
17992 | });
|
17993 | }
|
17994 | function readConfigFilesSync(filepaths) {
|
17995 | var files = [];
|
17996 | var file;
|
17997 | filepaths.forEach(function(filepath) {
|
17998 | try {
|
17999 | file = fs.readFileSync(filepath, "utf8");
|
18000 | } catch (e) {
|
18001 | file = "";
|
18002 | }
|
18003 | files.push({
|
18004 | name: filepath,
|
18005 | contents: file
|
18006 | });
|
18007 | });
|
18008 | return files;
|
18009 | }
|
18010 | function opts(filepath, options) {
|
18011 | if (options === void 0) {
|
18012 | options = {};
|
18013 | }
|
18014 | var resolvedFilePath = path.resolve(filepath);
|
18015 | return [resolvedFilePath, processOptions(options, resolvedFilePath)];
|
18016 | }
|
18017 | function parseFromFiles(filepath, files, options) {
|
18018 | if (options === void 0) {
|
18019 | options = {};
|
18020 | }
|
18021 | return __awaiter2(this, void 0, void 0, function() {
|
18022 | var _a, resolvedFilePath, processedOptions;
|
18023 | return __generator2(this, function(_b) {
|
18024 | _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
18025 | return [2, files.then(getConfigsForFiles).then(function(configs) {
|
18026 | return parseFromConfigs(configs, resolvedFilePath, processedOptions);
|
18027 | })];
|
18028 | });
|
18029 | });
|
18030 | }
|
18031 | exports2.parseFromFiles = parseFromFiles;
|
18032 | function parseFromFilesSync(filepath, files, options) {
|
18033 | if (options === void 0) {
|
18034 | options = {};
|
18035 | }
|
18036 | var _a = opts(filepath, options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
18037 | return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
|
18038 | }
|
18039 | exports2.parseFromFilesSync = parseFromFilesSync;
|
18040 | function parse(_filepath, _options) {
|
18041 | if (_options === void 0) {
|
18042 | _options = {};
|
18043 | }
|
18044 | return __awaiter2(this, void 0, void 0, function() {
|
18045 | var _a, resolvedFilePath, processedOptions, filepaths;
|
18046 | return __generator2(this, function(_b) {
|
18047 | _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
18048 | filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
|
18049 | return [2, readConfigFiles(filepaths).then(getConfigsForFiles).then(function(configs) {
|
18050 | return parseFromConfigs(configs, resolvedFilePath, processedOptions);
|
18051 | })];
|
18052 | });
|
18053 | });
|
18054 | }
|
18055 | exports2.parse = parse;
|
18056 | function parseSync(_filepath, _options) {
|
18057 | if (_options === void 0) {
|
18058 | _options = {};
|
18059 | }
|
18060 | var _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
18061 | var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
|
18062 | var files = readConfigFilesSync(filepaths);
|
18063 | return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
|
18064 | }
|
18065 | exports2.parseSync = parseSync;
|
18066 | }
|
18067 | });
|
18068 | var require_editorconfig_to_prettier = __commonJS2({
|
18069 | "node_modules/editorconfig-to-prettier/index.js"(exports2, module2) {
|
18070 | module2.exports = editorConfigToPrettier;
|
18071 | function removeUnset(editorConfig) {
|
18072 | const result = {};
|
18073 | const keys = Object.keys(editorConfig);
|
18074 | for (let i = 0; i < keys.length; i++) {
|
18075 | const key = keys[i];
|
18076 | if (editorConfig[key] === "unset") {
|
18077 | continue;
|
18078 | }
|
18079 | result[key] = editorConfig[key];
|
18080 | }
|
18081 | return result;
|
18082 | }
|
18083 | function editorConfigToPrettier(editorConfig) {
|
18084 | if (!editorConfig) {
|
18085 | return null;
|
18086 | }
|
18087 | editorConfig = removeUnset(editorConfig);
|
18088 | if (Object.keys(editorConfig).length === 0) {
|
18089 | return null;
|
18090 | }
|
18091 | const result = {};
|
18092 | if (editorConfig.indent_style) {
|
18093 | result.useTabs = editorConfig.indent_style === "tab";
|
18094 | }
|
18095 | if (editorConfig.indent_size === "tab") {
|
18096 | result.useTabs = true;
|
18097 | }
|
18098 | if (result.useTabs && editorConfig.tab_width) {
|
18099 | result.tabWidth = editorConfig.tab_width;
|
18100 | } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
|
18101 | result.tabWidth = editorConfig.indent_size;
|
18102 | } else if (editorConfig.tab_width !== void 0) {
|
18103 | result.tabWidth = editorConfig.tab_width;
|
18104 | }
|
18105 | if (editorConfig.max_line_length && editorConfig.max_line_length !== "off") {
|
18106 | result.printWidth = editorConfig.max_line_length;
|
18107 | }
|
18108 | if (editorConfig.quote_type === "single") {
|
18109 | result.singleQuote = true;
|
18110 | } else if (editorConfig.quote_type === "double") {
|
18111 | result.singleQuote = false;
|
18112 | }
|
18113 | if (["cr", "crlf", "lf"].indexOf(editorConfig.end_of_line) !== -1) {
|
18114 | result.endOfLine = editorConfig.end_of_line;
|
18115 | }
|
18116 | if (editorConfig.insert_final_newline === false || editorConfig.insert_final_newline === true) {
|
18117 | result.insertFinalNewline = editorConfig.insert_final_newline;
|
18118 | }
|
18119 | return result;
|
18120 | }
|
18121 | }
|
18122 | });
|
18123 | var require_find_project_root = __commonJS2({
|
18124 | "src/config/find-project-root.js"(exports2, module2) {
|
18125 | "use strict";
|
18126 | var fs = require("fs");
|
18127 | var path = require("path");
|
18128 | var MARKERS = [".git", ".hg"];
|
18129 | var markerExists = (directory) => MARKERS.some((mark) => fs.existsSync(path.join(directory, mark)));
|
18130 | function findProjectRoot(directory) {
|
18131 | while (!markerExists(directory)) {
|
18132 | const parentDirectory = path.resolve(directory, "..");
|
18133 | if (parentDirectory === directory) {
|
18134 | break;
|
18135 | }
|
18136 | directory = parentDirectory;
|
18137 | }
|
18138 | return directory;
|
18139 | }
|
18140 | module2.exports = findProjectRoot;
|
18141 | }
|
18142 | });
|
18143 | var require_resolve_config_editorconfig = __commonJS2({
|
18144 | "src/config/resolve-config-editorconfig.js"(exports2, module2) {
|
18145 | "use strict";
|
18146 | var path = require("path");
|
18147 | var editorconfig = require_src2();
|
18148 | var editorConfigToPrettier = require_editorconfig_to_prettier();
|
18149 | var {
|
18150 | default: mem2,
|
18151 | memClear: memClear2
|
18152 | } = (init_dist(), __toCommonJS(dist_exports));
|
18153 | var findProjectRoot = require_find_project_root();
|
18154 | var jsonStringifyMem = (fn) => mem2(fn, {
|
18155 | cacheKey: JSON.stringify
|
18156 | });
|
18157 | var maybeParse = (filePath, parse) => filePath && parse(filePath, {
|
18158 | root: findProjectRoot(path.dirname(path.resolve(filePath)))
|
18159 | });
|
18160 | var editorconfigAsyncNoCache = async (filePath) => editorConfigToPrettier(await maybeParse(filePath, editorconfig.parse));
|
18161 | var editorconfigAsyncWithCache = jsonStringifyMem(editorconfigAsyncNoCache);
|
18162 | var editorconfigSyncNoCache = (filePath) => editorConfigToPrettier(maybeParse(filePath, editorconfig.parseSync));
|
18163 | var editorconfigSyncWithCache = jsonStringifyMem(editorconfigSyncNoCache);
|
18164 | function getLoadFunction(opts) {
|
18165 | if (!opts.editorconfig) {
|
18166 | return () => null;
|
18167 | }
|
18168 | if (opts.sync) {
|
18169 | return opts.cache ? editorconfigSyncWithCache : editorconfigSyncNoCache;
|
18170 | }
|
18171 | return opts.cache ? editorconfigAsyncWithCache : editorconfigAsyncNoCache;
|
18172 | }
|
18173 | function clearCache() {
|
18174 | memClear2(editorconfigSyncWithCache);
|
18175 | memClear2(editorconfigAsyncWithCache);
|
18176 | }
|
18177 | module2.exports = {
|
18178 | getLoadFunction,
|
18179 | clearCache
|
18180 | };
|
18181 | }
|
18182 | });
|
18183 | var require_resolve_config = __commonJS2({
|
18184 | "src/config/resolve-config.js"(exports2, module2) {
|
18185 | "use strict";
|
18186 | var path = require("path");
|
18187 | var micromatch = require_micromatch();
|
18188 | var thirdParty = require("./third-party.js");
|
18189 | var loadToml = require_load_toml();
|
18190 | var loadJson5 = require_load_json5();
|
18191 | var partition = require_partition();
|
18192 | var resolve = require_resolve2();
|
18193 | var {
|
18194 | default: mem2,
|
18195 | memClear: memClear2
|
18196 | } = (init_dist(), __toCommonJS(dist_exports));
|
18197 | var resolveEditorConfig = require_resolve_config_editorconfig();
|
18198 | var getExplorerMemoized = mem2((opts) => {
|
18199 | const cosmiconfig = thirdParty["cosmiconfig" + (opts.sync ? "Sync" : "")];
|
18200 | const explorer = cosmiconfig("prettier", {
|
18201 | cache: opts.cache,
|
18202 | transform: (result) => {
|
18203 | if (result && result.config) {
|
18204 | if (typeof result.config === "string") {
|
18205 | const dir = path.dirname(result.filepath);
|
18206 | const modulePath = resolve(result.config, {
|
18207 | paths: [dir]
|
18208 | });
|
18209 | result.config = require(modulePath);
|
18210 | }
|
18211 | if (typeof result.config !== "object") {
|
18212 | throw new TypeError(`Config is only allowed to be an object, but received ${typeof result.config} in "${result.filepath}"`);
|
18213 | }
|
18214 | delete result.config.$schema;
|
18215 | }
|
18216 | return result;
|
18217 | },
|
18218 | searchPlaces: ["package.json", ".prettierrc", ".prettierrc.json", ".prettierrc.yaml", ".prettierrc.yml", ".prettierrc.json5", ".prettierrc.js", ".prettierrc.cjs", "prettier.config.js", "prettier.config.cjs", ".prettierrc.toml"],
|
18219 | loaders: {
|
18220 | ".toml": loadToml,
|
18221 | ".json5": loadJson5
|
18222 | }
|
18223 | });
|
18224 | return explorer;
|
18225 | }, {
|
18226 | cacheKey: JSON.stringify
|
18227 | });
|
18228 | function getExplorer(opts) {
|
18229 | opts = Object.assign({
|
18230 | sync: false,
|
18231 | cache: false
|
18232 | }, opts);
|
18233 | return getExplorerMemoized(opts);
|
18234 | }
|
18235 | function _resolveConfig(filePath, opts, sync) {
|
18236 | opts = Object.assign({
|
18237 | useCache: true
|
18238 | }, opts);
|
18239 | const loadOpts = {
|
18240 | cache: Boolean(opts.useCache),
|
18241 | sync: Boolean(sync),
|
18242 | editorconfig: Boolean(opts.editorconfig)
|
18243 | };
|
18244 | const {
|
18245 | load,
|
18246 | search
|
18247 | } = getExplorer(loadOpts);
|
18248 | const loadEditorConfig = resolveEditorConfig.getLoadFunction(loadOpts);
|
18249 | const arr = [opts.config ? load(opts.config) : search(filePath), loadEditorConfig(filePath)];
|
18250 | const unwrapAndMerge = ([result, editorConfigured]) => {
|
18251 | const merged = Object.assign(Object.assign({}, editorConfigured), mergeOverrides(result, filePath));
|
18252 | for (const optionName of ["plugins", "pluginSearchDirs"]) {
|
18253 | if (Array.isArray(merged[optionName])) {
|
18254 | merged[optionName] = merged[optionName].map((value) => typeof value === "string" && value.startsWith(".") ? path.resolve(path.dirname(result.filepath), value) : value);
|
18255 | }
|
18256 | }
|
18257 | if (!result && !editorConfigured) {
|
18258 | return null;
|
18259 | }
|
18260 | delete merged.insertFinalNewline;
|
18261 | return merged;
|
18262 | };
|
18263 | if (loadOpts.sync) {
|
18264 | return unwrapAndMerge(arr);
|
18265 | }
|
18266 | return Promise.all(arr).then(unwrapAndMerge);
|
18267 | }
|
18268 | var resolveConfig = (filePath, opts) => _resolveConfig(filePath, opts, false);
|
18269 | resolveConfig.sync = (filePath, opts) => _resolveConfig(filePath, opts, true);
|
18270 | function clearCache() {
|
18271 | memClear2(getExplorerMemoized);
|
18272 | resolveEditorConfig.clearCache();
|
18273 | }
|
18274 | async function resolveConfigFile(filePath) {
|
18275 | const {
|
18276 | search
|
18277 | } = getExplorer({
|
18278 | sync: false
|
18279 | });
|
18280 | const result = await search(filePath);
|
18281 | return result ? result.filepath : null;
|
18282 | }
|
18283 | resolveConfigFile.sync = (filePath) => {
|
18284 | const {
|
18285 | search
|
18286 | } = getExplorer({
|
18287 | sync: true
|
18288 | });
|
18289 | const result = search(filePath);
|
18290 | return result ? result.filepath : null;
|
18291 | };
|
18292 | function mergeOverrides(configResult, filePath) {
|
18293 | const {
|
18294 | config: config2,
|
18295 | filepath: configPath
|
18296 | } = configResult || {};
|
18297 | const _ref = config2 || {}, {
|
18298 | overrides
|
18299 | } = _ref, options = _objectWithoutProperties(_ref, _excluded3);
|
18300 | if (filePath && overrides) {
|
18301 | const relativeFilePath = path.relative(path.dirname(configPath), filePath);
|
18302 | for (const override of overrides) {
|
18303 | if (pathMatchesGlobs(relativeFilePath, override.files, override.excludeFiles)) {
|
18304 | Object.assign(options, override.options);
|
18305 | }
|
18306 | }
|
18307 | }
|
18308 | return options;
|
18309 | }
|
18310 | function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
|
18311 | const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
18312 | const [withSlashes, withoutSlashes] = partition(patternList, (pattern) => pattern.includes("/"));
|
18313 | return micromatch.isMatch(filePath, withoutSlashes, {
|
18314 | ignore: excludedPatterns,
|
18315 | basename: true,
|
18316 | dot: true
|
18317 | }) || micromatch.isMatch(filePath, withSlashes, {
|
18318 | ignore: excludedPatterns,
|
18319 | basename: false,
|
18320 | dot: true
|
18321 | });
|
18322 | }
|
18323 | module2.exports = {
|
18324 | resolveConfig,
|
18325 | resolveConfigFile,
|
18326 | clearCache
|
18327 | };
|
18328 | }
|
18329 | });
|
18330 | var require_ignore = __commonJS2({
|
18331 | "node_modules/ignore/index.js"(exports2, module2) {
|
18332 | function makeArray(subject) {
|
18333 | return Array.isArray(subject) ? subject : [subject];
|
18334 | }
|
18335 | var EMPTY = "";
|
18336 | var SPACE = " ";
|
18337 | var ESCAPE = "\\";
|
18338 | var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
18339 | var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
18340 | var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
18341 | var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
18342 | var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
18343 | var SLASH = "/";
|
18344 | var KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("node-ignore") : "node-ignore";
|
18345 | var define2 = (object, key, value) => Object.defineProperty(object, key, {
|
18346 | value
|
18347 | });
|
18348 | var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
18349 | var RETURN_FALSE = () => false;
|
18350 | var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
|
18351 | var cleanRangeBackSlash = (slashes) => {
|
18352 | const {
|
18353 | length
|
18354 | } = slashes;
|
18355 | return slashes.slice(0, length - length % 2);
|
18356 | };
|
18357 | var REPLACERS = [[/\\?\s+$/, (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY], [/\\\s/g, () => SPACE], [/[\\$.|*+(){^]/g, (match) => `\\${match}`], [/(?!\\)\?/g, () => "[^/]"], [/^\//, () => "^"], [/\//g, () => "\\/"], [/^\^*\\\*\\\*\\\//, () => "^(?:.*\\/)?"], [/^(?=[^^])/, function startingReplacer() {
|
18358 | return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
18359 | }], [/\\\/\\\*\\\*(?=\\\/|$)/g, (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"], [/(^|[^\\]+)\\\*(?=.+)/g, (_, p1) => `${p1}[^\\/]*`], [/\\\\\\(?=[$.|*+(){^])/g, () => ESCAPE], [/\\\\/g, () => ESCAPE], [/(\\)?\[([^\]/]*?)(\\*)($|\])/g, (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"], [/(?:[^*])$/, (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`], [/(\^|\\\/)?\\\*$/, (_, p1) => {
|
18360 | const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
18361 | return `${prefix}(?=$|\\/$)`;
|
18362 | }]];
|
18363 | var regexCache = Object.create(null);
|
18364 | var makeRegex = (pattern, ignoreCase) => {
|
18365 | let source = regexCache[pattern];
|
18366 | if (!source) {
|
18367 | source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
|
18368 | regexCache[pattern] = source;
|
18369 | }
|
18370 | return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
|
18371 | };
|
18372 | var isString = (subject) => typeof subject === "string";
|
18373 | var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && pattern.indexOf("#") !== 0;
|
18374 | var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
|
18375 | var IgnoreRule = class {
|
18376 | constructor(origin, pattern, negative, regex) {
|
18377 | this.origin = origin;
|
18378 | this.pattern = pattern;
|
18379 | this.negative = negative;
|
18380 | this.regex = regex;
|
18381 | }
|
18382 | };
|
18383 | var createRule = (pattern, ignoreCase) => {
|
18384 | const origin = pattern;
|
18385 | let negative = false;
|
18386 | if (pattern.indexOf("!") === 0) {
|
18387 | negative = true;
|
18388 | pattern = pattern.substr(1);
|
18389 | }
|
18390 | pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
18391 | const regex = makeRegex(pattern, ignoreCase);
|
18392 | return new IgnoreRule(origin, pattern, negative, regex);
|
18393 | };
|
18394 | var throwError = (message, Ctor) => {
|
18395 | throw new Ctor(message);
|
18396 | };
|
18397 | var checkPath = (path, originalPath, doThrow) => {
|
18398 | if (!isString(path)) {
|
18399 | return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
|
18400 | }
|
18401 | if (!path) {
|
18402 | return doThrow(`path must not be empty`, TypeError);
|
18403 | }
|
18404 | if (checkPath.isNotRelative(path)) {
|
18405 | const r = "`path.relative()`d";
|
18406 | return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
|
18407 | }
|
18408 | return true;
|
18409 | };
|
18410 | var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
|
18411 | checkPath.isNotRelative = isNotRelative;
|
18412 | checkPath.convert = (p) => p;
|
18413 | var Ignore = class {
|
18414 | constructor({
|
18415 | ignorecase = true,
|
18416 | ignoreCase = ignorecase,
|
18417 | allowRelativePaths = false
|
18418 | } = {}) {
|
18419 | define2(this, KEY_IGNORE, true);
|
18420 | this._rules = [];
|
18421 | this._ignoreCase = ignoreCase;
|
18422 | this._allowRelativePaths = allowRelativePaths;
|
18423 | this._initCache();
|
18424 | }
|
18425 | _initCache() {
|
18426 | this._ignoreCache = Object.create(null);
|
18427 | this._testCache = Object.create(null);
|
18428 | }
|
18429 | _addPattern(pattern) {
|
18430 | if (pattern && pattern[KEY_IGNORE]) {
|
18431 | this._rules = this._rules.concat(pattern._rules);
|
18432 | this._added = true;
|
18433 | return;
|
18434 | }
|
18435 | if (checkPattern(pattern)) {
|
18436 | const rule = createRule(pattern, this._ignoreCase);
|
18437 | this._added = true;
|
18438 | this._rules.push(rule);
|
18439 | }
|
18440 | }
|
18441 | add(pattern) {
|
18442 | this._added = false;
|
18443 | makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
|
18444 | if (this._added) {
|
18445 | this._initCache();
|
18446 | }
|
18447 | return this;
|
18448 | }
|
18449 | addPattern(pattern) {
|
18450 | return this.add(pattern);
|
18451 | }
|
18452 | _testOne(path, checkUnignored) {
|
18453 | let ignored = false;
|
18454 | let unignored = false;
|
18455 | this._rules.forEach((rule) => {
|
18456 | const {
|
18457 | negative
|
18458 | } = rule;
|
18459 | if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
18460 | return;
|
18461 | }
|
18462 | const matched = rule.regex.test(path);
|
18463 | if (matched) {
|
18464 | ignored = !negative;
|
18465 | unignored = negative;
|
18466 | }
|
18467 | });
|
18468 | return {
|
18469 | ignored,
|
18470 | unignored
|
18471 | };
|
18472 | }
|
18473 | _test(originalPath, cache, checkUnignored, slices) {
|
18474 | const path = originalPath && checkPath.convert(originalPath);
|
18475 | checkPath(path, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
|
18476 | return this._t(path, cache, checkUnignored, slices);
|
18477 | }
|
18478 | _t(path, cache, checkUnignored, slices) {
|
18479 | if (path in cache) {
|
18480 | return cache[path];
|
18481 | }
|
18482 | if (!slices) {
|
18483 | slices = path.split(SLASH);
|
18484 | }
|
18485 | slices.pop();
|
18486 | if (!slices.length) {
|
18487 | return cache[path] = this._testOne(path, checkUnignored);
|
18488 | }
|
18489 | const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
|
18490 | return cache[path] = parent.ignored ? parent : this._testOne(path, checkUnignored);
|
18491 | }
|
18492 | ignores(path) {
|
18493 | return this._test(path, this._ignoreCache, false).ignored;
|
18494 | }
|
18495 | createFilter() {
|
18496 | return (path) => !this.ignores(path);
|
18497 | }
|
18498 | filter(paths) {
|
18499 | return makeArray(paths).filter(this.createFilter());
|
18500 | }
|
18501 | test(path) {
|
18502 | return this._test(path, this._testCache, true);
|
18503 | }
|
18504 | };
|
18505 | var factory = (options) => new Ignore(options);
|
18506 | var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
|
18507 | factory.isPathValid = isPathValid;
|
18508 | factory.default = factory;
|
18509 | module2.exports = factory;
|
18510 | if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
|
18511 | const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
18512 | checkPath.convert = makePosix;
|
18513 | const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
18514 | checkPath.isNotRelative = (path) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
|
18515 | }
|
18516 | }
|
18517 | });
|
18518 | var require_get_file_content_or_null = __commonJS2({
|
18519 | "src/utils/get-file-content-or-null.js"(exports2, module2) {
|
18520 | "use strict";
|
18521 | var fs = require("fs");
|
18522 | var fsAsync = fs.promises;
|
18523 | async function getFileContentOrNull(filename) {
|
18524 | try {
|
18525 | return await fsAsync.readFile(filename, "utf8");
|
18526 | } catch (error) {
|
18527 | return handleError(filename, error);
|
18528 | }
|
18529 | }
|
18530 | getFileContentOrNull.sync = function(filename) {
|
18531 | try {
|
18532 | return fs.readFileSync(filename, "utf8");
|
18533 | } catch (error) {
|
18534 | return handleError(filename, error);
|
18535 | }
|
18536 | };
|
18537 | function handleError(filename, error) {
|
18538 | if (error && error.code === "ENOENT") {
|
18539 | return null;
|
18540 | }
|
18541 | throw new Error(`Unable to read ${filename}: ${error.message}`);
|
18542 | }
|
18543 | module2.exports = getFileContentOrNull;
|
18544 | }
|
18545 | });
|
18546 | var require_create_ignorer = __commonJS2({
|
18547 | "src/common/create-ignorer.js"(exports2, module2) {
|
18548 | "use strict";
|
18549 | var path = require("path");
|
18550 | var ignore = require_ignore().default;
|
18551 | var getFileContentOrNull = require_get_file_content_or_null();
|
18552 | async function createIgnorer(ignorePath, withNodeModules) {
|
18553 | const ignoreContent = ignorePath ? await getFileContentOrNull(path.resolve(ignorePath)) : null;
|
18554 | return _createIgnorer(ignoreContent, withNodeModules);
|
18555 | }
|
18556 | createIgnorer.sync = function(ignorePath, withNodeModules) {
|
18557 | const ignoreContent = !ignorePath ? null : getFileContentOrNull.sync(path.resolve(ignorePath));
|
18558 | return _createIgnorer(ignoreContent, withNodeModules);
|
18559 | };
|
18560 | function _createIgnorer(ignoreContent, withNodeModules) {
|
18561 | const ignorer = ignore({
|
18562 | allowRelativePaths: true
|
18563 | }).add(ignoreContent || "");
|
18564 | if (!withNodeModules) {
|
18565 | ignorer.add("node_modules");
|
18566 | }
|
18567 | return ignorer;
|
18568 | }
|
18569 | module2.exports = createIgnorer;
|
18570 | }
|
18571 | });
|
18572 | var require_get_file_info = __commonJS2({
|
18573 | "src/common/get-file-info.js"(exports2, module2) {
|
18574 | "use strict";
|
18575 | var path = require("path");
|
18576 | var options = require_options();
|
18577 | var config2 = require_resolve_config();
|
18578 | var createIgnorer = require_create_ignorer();
|
18579 | async function getFileInfo2(filePath, opts) {
|
18580 | if (typeof filePath !== "string") {
|
18581 | throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
|
18582 | }
|
18583 | const ignorer = await createIgnorer(opts.ignorePath, opts.withNodeModules);
|
18584 | return _getFileInfo({
|
18585 | ignorer,
|
18586 | filePath,
|
18587 | plugins: opts.plugins,
|
18588 | resolveConfig: opts.resolveConfig,
|
18589 | ignorePath: opts.ignorePath,
|
18590 | sync: false
|
18591 | });
|
18592 | }
|
18593 | getFileInfo2.sync = function(filePath, opts) {
|
18594 | if (typeof filePath !== "string") {
|
18595 | throw new TypeError(`expect \`filePath\` to be a string, got \`${typeof filePath}\``);
|
18596 | }
|
18597 | const ignorer = createIgnorer.sync(opts.ignorePath, opts.withNodeModules);
|
18598 | return _getFileInfo({
|
18599 | ignorer,
|
18600 | filePath,
|
18601 | plugins: opts.plugins,
|
18602 | resolveConfig: opts.resolveConfig,
|
18603 | ignorePath: opts.ignorePath,
|
18604 | sync: true
|
18605 | });
|
18606 | };
|
18607 | function getFileParser(resolvedConfig, filePath, plugins2) {
|
18608 | if (resolvedConfig && resolvedConfig.parser) {
|
18609 | return resolvedConfig.parser;
|
18610 | }
|
18611 | const inferredParser = options.inferParser(filePath, plugins2);
|
18612 | if (inferredParser) {
|
18613 | return inferredParser;
|
18614 | }
|
18615 | return null;
|
18616 | }
|
18617 | function _getFileInfo({
|
18618 | ignorer,
|
18619 | filePath,
|
18620 | plugins: plugins2,
|
18621 | resolveConfig = false,
|
18622 | ignorePath,
|
18623 | sync = false
|
18624 | }) {
|
18625 | const normalizedFilePath = normalizeFilePath(filePath, ignorePath);
|
18626 | const fileInfo = {
|
18627 | ignored: ignorer.ignores(normalizedFilePath),
|
18628 | inferredParser: null
|
18629 | };
|
18630 | if (fileInfo.ignored) {
|
18631 | return fileInfo;
|
18632 | }
|
18633 | let resolvedConfig;
|
18634 | if (resolveConfig) {
|
18635 | if (sync) {
|
18636 | resolvedConfig = config2.resolveConfig.sync(filePath);
|
18637 | } else {
|
18638 | return config2.resolveConfig(filePath).then((resolvedConfig2) => {
|
18639 | fileInfo.inferredParser = getFileParser(resolvedConfig2, filePath, plugins2);
|
18640 | return fileInfo;
|
18641 | });
|
18642 | }
|
18643 | }
|
18644 | fileInfo.inferredParser = getFileParser(resolvedConfig, filePath, plugins2);
|
18645 | return fileInfo;
|
18646 | }
|
18647 | function normalizeFilePath(filePath, ignorePath) {
|
18648 | return ignorePath ? path.relative(path.dirname(ignorePath), filePath) : filePath;
|
18649 | }
|
18650 | module2.exports = getFileInfo2;
|
18651 | }
|
18652 | });
|
18653 | var require_util_shared = __commonJS2({
|
18654 | "src/common/util-shared.js"(exports2, module2) {
|
18655 | "use strict";
|
18656 | var {
|
18657 | getMaxContinuousCount,
|
18658 | getStringWidth,
|
18659 | getAlignmentSize,
|
18660 | getIndentSize,
|
18661 | skip,
|
18662 | skipWhitespace,
|
18663 | skipSpaces,
|
18664 | skipNewline,
|
18665 | skipToLineEnd,
|
18666 | skipEverythingButNewLine,
|
18667 | skipInlineComment,
|
18668 | skipTrailingComment,
|
18669 | hasNewline,
|
18670 | hasNewlineInRange,
|
18671 | hasSpaces,
|
18672 | isNextLineEmpty,
|
18673 | isNextLineEmptyAfterIndex,
|
18674 | isPreviousLineEmpty,
|
18675 | getNextNonSpaceNonCommentCharacterIndex,
|
18676 | makeString,
|
18677 | addLeadingComment,
|
18678 | addDanglingComment,
|
18679 | addTrailingComment
|
18680 | } = require_util();
|
18681 | module2.exports = {
|
18682 | getMaxContinuousCount,
|
18683 | getStringWidth,
|
18684 | getAlignmentSize,
|
18685 | getIndentSize,
|
18686 | skip,
|
18687 | skipWhitespace,
|
18688 | skipSpaces,
|
18689 | skipNewline,
|
18690 | skipToLineEnd,
|
18691 | skipEverythingButNewLine,
|
18692 | skipInlineComment,
|
18693 | skipTrailingComment,
|
18694 | hasNewline,
|
18695 | hasNewlineInRange,
|
18696 | hasSpaces,
|
18697 | isNextLineEmpty,
|
18698 | isNextLineEmptyAfterIndex,
|
18699 | isPreviousLineEmpty,
|
18700 | getNextNonSpaceNonCommentCharacterIndex,
|
18701 | makeString,
|
18702 | addLeadingComment,
|
18703 | addDanglingComment,
|
18704 | addTrailingComment
|
18705 | };
|
18706 | }
|
18707 | });
|
18708 | var require_array3 = __commonJS2({
|
18709 | "node_modules/fast-glob/out/utils/array.js"(exports2) {
|
18710 | "use strict";
|
18711 | Object.defineProperty(exports2, "__esModule", {
|
18712 | value: true
|
18713 | });
|
18714 | exports2.splitWhen = exports2.flatten = void 0;
|
18715 | function flatten(items) {
|
18716 | return items.reduce((collection, item) => [].concat(collection, item), []);
|
18717 | }
|
18718 | exports2.flatten = flatten;
|
18719 | function splitWhen(items, predicate) {
|
18720 | const result = [[]];
|
18721 | let groupIndex = 0;
|
18722 | for (const item of items) {
|
18723 | if (predicate(item)) {
|
18724 | groupIndex++;
|
18725 | result[groupIndex] = [];
|
18726 | } else {
|
18727 | result[groupIndex].push(item);
|
18728 | }
|
18729 | }
|
18730 | return result;
|
18731 | }
|
18732 | exports2.splitWhen = splitWhen;
|
18733 | }
|
18734 | });
|
18735 | var require_errno = __commonJS2({
|
18736 | "node_modules/fast-glob/out/utils/errno.js"(exports2) {
|
18737 | "use strict";
|
18738 | Object.defineProperty(exports2, "__esModule", {
|
18739 | value: true
|
18740 | });
|
18741 | exports2.isEnoentCodeError = void 0;
|
18742 | function isEnoentCodeError(error) {
|
18743 | return error.code === "ENOENT";
|
18744 | }
|
18745 | exports2.isEnoentCodeError = isEnoentCodeError;
|
18746 | }
|
18747 | });
|
18748 | var require_fs = __commonJS2({
|
18749 | "node_modules/fast-glob/out/utils/fs.js"(exports2) {
|
18750 | "use strict";
|
18751 | Object.defineProperty(exports2, "__esModule", {
|
18752 | value: true
|
18753 | });
|
18754 | exports2.createDirentFromStats = void 0;
|
18755 | var DirentFromStats = class {
|
18756 | constructor(name, stats) {
|
18757 | this.name = name;
|
18758 | this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
18759 | this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
18760 | this.isDirectory = stats.isDirectory.bind(stats);
|
18761 | this.isFIFO = stats.isFIFO.bind(stats);
|
18762 | this.isFile = stats.isFile.bind(stats);
|
18763 | this.isSocket = stats.isSocket.bind(stats);
|
18764 | this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
18765 | }
|
18766 | };
|
18767 | function createDirentFromStats(name, stats) {
|
18768 | return new DirentFromStats(name, stats);
|
18769 | }
|
18770 | exports2.createDirentFromStats = createDirentFromStats;
|
18771 | }
|
18772 | });
|
18773 | var require_path = __commonJS2({
|
18774 | "node_modules/fast-glob/out/utils/path.js"(exports2) {
|
18775 | "use strict";
|
18776 | Object.defineProperty(exports2, "__esModule", {
|
18777 | value: true
|
18778 | });
|
18779 | exports2.removeLeadingDotSegment = exports2.escape = exports2.makeAbsolute = exports2.unixify = void 0;
|
18780 | var path = require("path");
|
18781 | var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
18782 | var UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\())/g;
|
18783 | function unixify(filepath) {
|
18784 | return filepath.replace(/\\/g, "/");
|
18785 | }
|
18786 | exports2.unixify = unixify;
|
18787 | function makeAbsolute(cwd, filepath) {
|
18788 | return path.resolve(cwd, filepath);
|
18789 | }
|
18790 | exports2.makeAbsolute = makeAbsolute;
|
18791 | function escape(pattern) {
|
18792 | return pattern.replace(UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
18793 | }
|
18794 | exports2.escape = escape;
|
18795 | function removeLeadingDotSegment(entry) {
|
18796 | if (entry.charAt(0) === ".") {
|
18797 | const secondCharactery = entry.charAt(1);
|
18798 | if (secondCharactery === "/" || secondCharactery === "\\") {
|
18799 | return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
18800 | }
|
18801 | }
|
18802 | return entry;
|
18803 | }
|
18804 | exports2.removeLeadingDotSegment = removeLeadingDotSegment;
|
18805 | }
|
18806 | });
|
18807 | var require_is_extglob = __commonJS2({
|
18808 | "node_modules/is-extglob/index.js"(exports2, module2) {
|
18809 | module2.exports = function isExtglob(str) {
|
18810 | if (typeof str !== "string" || str === "") {
|
18811 | return false;
|
18812 | }
|
18813 | var match;
|
18814 | while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str)) {
|
18815 | if (match[2])
|
18816 | return true;
|
18817 | str = str.slice(match.index + match[0].length);
|
18818 | }
|
18819 | return false;
|
18820 | };
|
18821 | }
|
18822 | });
|
18823 | var require_is_glob = __commonJS2({
|
18824 | "node_modules/is-glob/index.js"(exports2, module2) {
|
18825 | var isExtglob = require_is_extglob();
|
18826 | var chars = {
|
18827 | "{": "}",
|
18828 | "(": ")",
|
18829 | "[": "]"
|
18830 | };
|
18831 | var strictCheck = function(str) {
|
18832 | if (str[0] === "!") {
|
18833 | return true;
|
18834 | }
|
18835 | var index = 0;
|
18836 | var pipeIndex = -2;
|
18837 | var closeSquareIndex = -2;
|
18838 | var closeCurlyIndex = -2;
|
18839 | var closeParenIndex = -2;
|
18840 | var backSlashIndex = -2;
|
18841 | while (index < str.length) {
|
18842 | if (str[index] === "*") {
|
18843 | return true;
|
18844 | }
|
18845 | if (str[index + 1] === "?" && /[\].+)]/.test(str[index])) {
|
18846 | return true;
|
18847 | }
|
18848 | if (closeSquareIndex !== -1 && str[index] === "[" && str[index + 1] !== "]") {
|
18849 | if (closeSquareIndex < index) {
|
18850 | closeSquareIndex = str.indexOf("]", index);
|
18851 | }
|
18852 | if (closeSquareIndex > index) {
|
18853 | if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
18854 | return true;
|
18855 | }
|
18856 | backSlashIndex = str.indexOf("\\", index);
|
18857 | if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
18858 | return true;
|
18859 | }
|
18860 | }
|
18861 | }
|
18862 | if (closeCurlyIndex !== -1 && str[index] === "{" && str[index + 1] !== "}") {
|
18863 | closeCurlyIndex = str.indexOf("}", index);
|
18864 | if (closeCurlyIndex > index) {
|
18865 | backSlashIndex = str.indexOf("\\", index);
|
18866 | if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
|
18867 | return true;
|
18868 | }
|
18869 | }
|
18870 | }
|
18871 | if (closeParenIndex !== -1 && str[index] === "(" && str[index + 1] === "?" && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ")") {
|
18872 | closeParenIndex = str.indexOf(")", index);
|
18873 | if (closeParenIndex > index) {
|
18874 | backSlashIndex = str.indexOf("\\", index);
|
18875 | if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
18876 | return true;
|
18877 | }
|
18878 | }
|
18879 | }
|
18880 | if (pipeIndex !== -1 && str[index] === "(" && str[index + 1] !== "|") {
|
18881 | if (pipeIndex < index) {
|
18882 | pipeIndex = str.indexOf("|", index);
|
18883 | }
|
18884 | if (pipeIndex !== -1 && str[pipeIndex + 1] !== ")") {
|
18885 | closeParenIndex = str.indexOf(")", pipeIndex);
|
18886 | if (closeParenIndex > pipeIndex) {
|
18887 | backSlashIndex = str.indexOf("\\", pipeIndex);
|
18888 | if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
18889 | return true;
|
18890 | }
|
18891 | }
|
18892 | }
|
18893 | }
|
18894 | if (str[index] === "\\") {
|
18895 | var open = str[index + 1];
|
18896 | index += 2;
|
18897 | var close = chars[open];
|
18898 | if (close) {
|
18899 | var n = str.indexOf(close, index);
|
18900 | if (n !== -1) {
|
18901 | index = n + 1;
|
18902 | }
|
18903 | }
|
18904 | if (str[index] === "!") {
|
18905 | return true;
|
18906 | }
|
18907 | } else {
|
18908 | index++;
|
18909 | }
|
18910 | }
|
18911 | return false;
|
18912 | };
|
18913 | var relaxedCheck = function(str) {
|
18914 | if (str[0] === "!") {
|
18915 | return true;
|
18916 | }
|
18917 | var index = 0;
|
18918 | while (index < str.length) {
|
18919 | if (/[*?{}()[\]]/.test(str[index])) {
|
18920 | return true;
|
18921 | }
|
18922 | if (str[index] === "\\") {
|
18923 | var open = str[index + 1];
|
18924 | index += 2;
|
18925 | var close = chars[open];
|
18926 | if (close) {
|
18927 | var n = str.indexOf(close, index);
|
18928 | if (n !== -1) {
|
18929 | index = n + 1;
|
18930 | }
|
18931 | }
|
18932 | if (str[index] === "!") {
|
18933 | return true;
|
18934 | }
|
18935 | } else {
|
18936 | index++;
|
18937 | }
|
18938 | }
|
18939 | return false;
|
18940 | };
|
18941 | module2.exports = function isGlob(str, options) {
|
18942 | if (typeof str !== "string" || str === "") {
|
18943 | return false;
|
18944 | }
|
18945 | if (isExtglob(str)) {
|
18946 | return true;
|
18947 | }
|
18948 | var check = strictCheck;
|
18949 | if (options && options.strict === false) {
|
18950 | check = relaxedCheck;
|
18951 | }
|
18952 | return check(str);
|
18953 | };
|
18954 | }
|
18955 | });
|
18956 | var require_glob_parent = __commonJS2({
|
18957 | "node_modules/glob-parent/index.js"(exports2, module2) {
|
18958 | "use strict";
|
18959 | var isGlob = require_is_glob();
|
18960 | var pathPosixDirname = require("path").posix.dirname;
|
18961 | var isWin32 = require("os").platform() === "win32";
|
18962 | var slash = "/";
|
18963 | var backslash = /\\/g;
|
18964 | var enclosure = /[\{\[].*[\}\]]$/;
|
18965 | var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
18966 | var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
18967 | module2.exports = function globParent(str, opts) {
|
18968 | var options = Object.assign({
|
18969 | flipBackslashes: true
|
18970 | }, opts);
|
18971 | if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) {
|
18972 | str = str.replace(backslash, slash);
|
18973 | }
|
18974 | if (enclosure.test(str)) {
|
18975 | str += slash;
|
18976 | }
|
18977 | str += "a";
|
18978 | do {
|
18979 | str = pathPosixDirname(str);
|
18980 | } while (isGlob(str) || globby.test(str));
|
18981 | return str.replace(escaped, "$1");
|
18982 | };
|
18983 | }
|
18984 | });
|
18985 | var require_pattern = __commonJS2({
|
18986 | "node_modules/fast-glob/out/utils/pattern.js"(exports2) {
|
18987 | "use strict";
|
18988 | Object.defineProperty(exports2, "__esModule", {
|
18989 | value: true
|
18990 | });
|
18991 | exports2.matchAny = exports2.convertPatternsToRe = exports2.makeRe = exports2.getPatternParts = exports2.expandBraceExpansion = exports2.expandPatternsWithBraceExpansion = exports2.isAffectDepthOfReadingPattern = exports2.endsWithSlashGlobStar = exports2.hasGlobStar = exports2.getBaseDirectory = exports2.isPatternRelatedToParentDirectory = exports2.getPatternsOutsideCurrentDirectory = exports2.getPatternsInsideCurrentDirectory = exports2.getPositivePatterns = exports2.getNegativePatterns = exports2.isPositivePattern = exports2.isNegativePattern = exports2.convertToNegativePattern = exports2.convertToPositivePattern = exports2.isDynamicPattern = exports2.isStaticPattern = void 0;
|
18992 | var path = require("path");
|
18993 | var globParent = require_glob_parent();
|
18994 | var micromatch = require_micromatch();
|
18995 | var GLOBSTAR = "**";
|
18996 | var ESCAPE_SYMBOL = "\\";
|
18997 | var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
|
18998 | var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
|
18999 | var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
|
19000 | var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
|
19001 | var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
|
19002 | function isStaticPattern(pattern, options = {}) {
|
19003 | return !isDynamicPattern(pattern, options);
|
19004 | }
|
19005 | exports2.isStaticPattern = isStaticPattern;
|
19006 | function isDynamicPattern(pattern, options = {}) {
|
19007 | if (pattern === "") {
|
19008 | return false;
|
19009 | }
|
19010 | if (options.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
|
19011 | return true;
|
19012 | }
|
19013 | if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
|
19014 | return true;
|
19015 | }
|
19016 | if (options.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
|
19017 | return true;
|
19018 | }
|
19019 | if (options.braceExpansion !== false && hasBraceExpansion(pattern)) {
|
19020 | return true;
|
19021 | }
|
19022 | return false;
|
19023 | }
|
19024 | exports2.isDynamicPattern = isDynamicPattern;
|
19025 | function hasBraceExpansion(pattern) {
|
19026 | const openingBraceIndex = pattern.indexOf("{");
|
19027 | if (openingBraceIndex === -1) {
|
19028 | return false;
|
19029 | }
|
19030 | const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
|
19031 | if (closingBraceIndex === -1) {
|
19032 | return false;
|
19033 | }
|
19034 | const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
|
19035 | return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
|
19036 | }
|
19037 | function convertToPositivePattern(pattern) {
|
19038 | return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
|
19039 | }
|
19040 | exports2.convertToPositivePattern = convertToPositivePattern;
|
19041 | function convertToNegativePattern(pattern) {
|
19042 | return "!" + pattern;
|
19043 | }
|
19044 | exports2.convertToNegativePattern = convertToNegativePattern;
|
19045 | function isNegativePattern(pattern) {
|
19046 | return pattern.startsWith("!") && pattern[1] !== "(";
|
19047 | }
|
19048 | exports2.isNegativePattern = isNegativePattern;
|
19049 | function isPositivePattern(pattern) {
|
19050 | return !isNegativePattern(pattern);
|
19051 | }
|
19052 | exports2.isPositivePattern = isPositivePattern;
|
19053 | function getNegativePatterns(patterns) {
|
19054 | return patterns.filter(isNegativePattern);
|
19055 | }
|
19056 | exports2.getNegativePatterns = getNegativePatterns;
|
19057 | function getPositivePatterns(patterns) {
|
19058 | return patterns.filter(isPositivePattern);
|
19059 | }
|
19060 | exports2.getPositivePatterns = getPositivePatterns;
|
19061 | function getPatternsInsideCurrentDirectory(patterns) {
|
19062 | return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
|
19063 | }
|
19064 | exports2.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
|
19065 | function getPatternsOutsideCurrentDirectory(patterns) {
|
19066 | return patterns.filter(isPatternRelatedToParentDirectory);
|
19067 | }
|
19068 | exports2.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
|
19069 | function isPatternRelatedToParentDirectory(pattern) {
|
19070 | return pattern.startsWith("..") || pattern.startsWith("./..");
|
19071 | }
|
19072 | exports2.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
|
19073 | function getBaseDirectory(pattern) {
|
19074 | return globParent(pattern, {
|
19075 | flipBackslashes: false
|
19076 | });
|
19077 | }
|
19078 | exports2.getBaseDirectory = getBaseDirectory;
|
19079 | function hasGlobStar(pattern) {
|
19080 | return pattern.includes(GLOBSTAR);
|
19081 | }
|
19082 | exports2.hasGlobStar = hasGlobStar;
|
19083 | function endsWithSlashGlobStar(pattern) {
|
19084 | return pattern.endsWith("/" + GLOBSTAR);
|
19085 | }
|
19086 | exports2.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
19087 | function isAffectDepthOfReadingPattern(pattern) {
|
19088 | const basename = path.basename(pattern);
|
19089 | return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
19090 | }
|
19091 | exports2.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
19092 | function expandPatternsWithBraceExpansion(patterns) {
|
19093 | return patterns.reduce((collection, pattern) => {
|
19094 | return collection.concat(expandBraceExpansion(pattern));
|
19095 | }, []);
|
19096 | }
|
19097 | exports2.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
19098 | function expandBraceExpansion(pattern) {
|
19099 | return micromatch.braces(pattern, {
|
19100 | expand: true,
|
19101 | nodupes: true
|
19102 | });
|
19103 | }
|
19104 | exports2.expandBraceExpansion = expandBraceExpansion;
|
19105 | function getPatternParts(pattern, options) {
|
19106 | let {
|
19107 | parts
|
19108 | } = micromatch.scan(pattern, Object.assign(Object.assign({}, options), {
|
19109 | parts: true
|
19110 | }));
|
19111 | if (parts.length === 0) {
|
19112 | parts = [pattern];
|
19113 | }
|
19114 | if (parts[0].startsWith("/")) {
|
19115 | parts[0] = parts[0].slice(1);
|
19116 | parts.unshift("");
|
19117 | }
|
19118 | return parts;
|
19119 | }
|
19120 | exports2.getPatternParts = getPatternParts;
|
19121 | function makeRe(pattern, options) {
|
19122 | return micromatch.makeRe(pattern, options);
|
19123 | }
|
19124 | exports2.makeRe = makeRe;
|
19125 | function convertPatternsToRe(patterns, options) {
|
19126 | return patterns.map((pattern) => makeRe(pattern, options));
|
19127 | }
|
19128 | exports2.convertPatternsToRe = convertPatternsToRe;
|
19129 | function matchAny(entry, patternsRe) {
|
19130 | return patternsRe.some((patternRe) => patternRe.test(entry));
|
19131 | }
|
19132 | exports2.matchAny = matchAny;
|
19133 | }
|
19134 | });
|
19135 | var require_merge2 = __commonJS2({
|
19136 | "node_modules/merge2/index.js"(exports2, module2) {
|
19137 | "use strict";
|
19138 | var Stream = require("stream");
|
19139 | var PassThrough = Stream.PassThrough;
|
19140 | var slice = Array.prototype.slice;
|
19141 | module2.exports = merge2;
|
19142 | function merge2() {
|
19143 | const streamsQueue = [];
|
19144 | const args = slice.call(arguments);
|
19145 | let merging = false;
|
19146 | let options = args[args.length - 1];
|
19147 | if (options && !Array.isArray(options) && options.pipe == null) {
|
19148 | args.pop();
|
19149 | } else {
|
19150 | options = {};
|
19151 | }
|
19152 | const doEnd = options.end !== false;
|
19153 | const doPipeError = options.pipeError === true;
|
19154 | if (options.objectMode == null) {
|
19155 | options.objectMode = true;
|
19156 | }
|
19157 | if (options.highWaterMark == null) {
|
19158 | options.highWaterMark = 64 * 1024;
|
19159 | }
|
19160 | const mergedStream = PassThrough(options);
|
19161 | function addStream() {
|
19162 | for (let i = 0, len = arguments.length; i < len; i++) {
|
19163 | streamsQueue.push(pauseStreams(arguments[i], options));
|
19164 | }
|
19165 | mergeStream();
|
19166 | return this;
|
19167 | }
|
19168 | function mergeStream() {
|
19169 | if (merging) {
|
19170 | return;
|
19171 | }
|
19172 | merging = true;
|
19173 | let streams = streamsQueue.shift();
|
19174 | if (!streams) {
|
19175 | process.nextTick(endStream);
|
19176 | return;
|
19177 | }
|
19178 | if (!Array.isArray(streams)) {
|
19179 | streams = [streams];
|
19180 | }
|
19181 | let pipesCount = streams.length + 1;
|
19182 | function next() {
|
19183 | if (--pipesCount > 0) {
|
19184 | return;
|
19185 | }
|
19186 | merging = false;
|
19187 | mergeStream();
|
19188 | }
|
19189 | function pipe(stream) {
|
19190 | function onend() {
|
19191 | stream.removeListener("merge2UnpipeEnd", onend);
|
19192 | stream.removeListener("end", onend);
|
19193 | if (doPipeError) {
|
19194 | stream.removeListener("error", onerror);
|
19195 | }
|
19196 | next();
|
19197 | }
|
19198 | function onerror(err) {
|
19199 | mergedStream.emit("error", err);
|
19200 | }
|
19201 | if (stream._readableState.endEmitted) {
|
19202 | return next();
|
19203 | }
|
19204 | stream.on("merge2UnpipeEnd", onend);
|
19205 | stream.on("end", onend);
|
19206 | if (doPipeError) {
|
19207 | stream.on("error", onerror);
|
19208 | }
|
19209 | stream.pipe(mergedStream, {
|
19210 | end: false
|
19211 | });
|
19212 | stream.resume();
|
19213 | }
|
19214 | for (let i = 0; i < streams.length; i++) {
|
19215 | pipe(streams[i]);
|
19216 | }
|
19217 | next();
|
19218 | }
|
19219 | function endStream() {
|
19220 | merging = false;
|
19221 | mergedStream.emit("queueDrain");
|
19222 | if (doEnd) {
|
19223 | mergedStream.end();
|
19224 | }
|
19225 | }
|
19226 | mergedStream.setMaxListeners(0);
|
19227 | mergedStream.add = addStream;
|
19228 | mergedStream.on("unpipe", function(stream) {
|
19229 | stream.emit("merge2UnpipeEnd");
|
19230 | });
|
19231 | if (args.length) {
|
19232 | addStream.apply(null, args);
|
19233 | }
|
19234 | return mergedStream;
|
19235 | }
|
19236 | function pauseStreams(streams, options) {
|
19237 | if (!Array.isArray(streams)) {
|
19238 | if (!streams._readableState && streams.pipe) {
|
19239 | streams = streams.pipe(PassThrough(options));
|
19240 | }
|
19241 | if (!streams._readableState || !streams.pause || !streams.pipe) {
|
19242 | throw new Error("Only readable stream can be merged.");
|
19243 | }
|
19244 | streams.pause();
|
19245 | } else {
|
19246 | for (let i = 0, len = streams.length; i < len; i++) {
|
19247 | streams[i] = pauseStreams(streams[i], options);
|
19248 | }
|
19249 | }
|
19250 | return streams;
|
19251 | }
|
19252 | }
|
19253 | });
|
19254 | var require_stream = __commonJS2({
|
19255 | "node_modules/fast-glob/out/utils/stream.js"(exports2) {
|
19256 | "use strict";
|
19257 | Object.defineProperty(exports2, "__esModule", {
|
19258 | value: true
|
19259 | });
|
19260 | exports2.merge = void 0;
|
19261 | var merge2 = require_merge2();
|
19262 | function merge(streams) {
|
19263 | const mergedStream = merge2(streams);
|
19264 | streams.forEach((stream) => {
|
19265 | stream.once("error", (error) => mergedStream.emit("error", error));
|
19266 | });
|
19267 | mergedStream.once("close", () => propagateCloseEventToSources(streams));
|
19268 | mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
19269 | return mergedStream;
|
19270 | }
|
19271 | exports2.merge = merge;
|
19272 | function propagateCloseEventToSources(streams) {
|
19273 | streams.forEach((stream) => stream.emit("close"));
|
19274 | }
|
19275 | }
|
19276 | });
|
19277 | var require_string2 = __commonJS2({
|
19278 | "node_modules/fast-glob/out/utils/string.js"(exports2) {
|
19279 | "use strict";
|
19280 | Object.defineProperty(exports2, "__esModule", {
|
19281 | value: true
|
19282 | });
|
19283 | exports2.isEmpty = exports2.isString = void 0;
|
19284 | function isString(input) {
|
19285 | return typeof input === "string";
|
19286 | }
|
19287 | exports2.isString = isString;
|
19288 | function isEmpty(input) {
|
19289 | return input === "";
|
19290 | }
|
19291 | exports2.isEmpty = isEmpty;
|
19292 | }
|
19293 | });
|
19294 | var require_utils4 = __commonJS2({
|
19295 | "node_modules/fast-glob/out/utils/index.js"(exports2) {
|
19296 | "use strict";
|
19297 | Object.defineProperty(exports2, "__esModule", {
|
19298 | value: true
|
19299 | });
|
19300 | exports2.string = exports2.stream = exports2.pattern = exports2.path = exports2.fs = exports2.errno = exports2.array = void 0;
|
19301 | var array = require_array3();
|
19302 | exports2.array = array;
|
19303 | var errno = require_errno();
|
19304 | exports2.errno = errno;
|
19305 | var fs = require_fs();
|
19306 | exports2.fs = fs;
|
19307 | var path = require_path();
|
19308 | exports2.path = path;
|
19309 | var pattern = require_pattern();
|
19310 | exports2.pattern = pattern;
|
19311 | var stream = require_stream();
|
19312 | exports2.stream = stream;
|
19313 | var string = require_string2();
|
19314 | exports2.string = string;
|
19315 | }
|
19316 | });
|
19317 | var require_tasks = __commonJS2({
|
19318 | "node_modules/fast-glob/out/managers/tasks.js"(exports2) {
|
19319 | "use strict";
|
19320 | Object.defineProperty(exports2, "__esModule", {
|
19321 | value: true
|
19322 | });
|
19323 | exports2.convertPatternGroupToTask = exports2.convertPatternGroupsToTasks = exports2.groupPatternsByBaseDirectory = exports2.getNegativePatternsAsPositive = exports2.getPositivePatterns = exports2.convertPatternsToTasks = exports2.generate = void 0;
|
19324 | var utils = require_utils4();
|
19325 | function generate(patterns, settings) {
|
19326 | const positivePatterns = getPositivePatterns(patterns);
|
19327 | const negativePatterns = getNegativePatternsAsPositive(patterns, settings.ignore);
|
19328 | const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
|
19329 | const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
|
19330 | const staticTasks = convertPatternsToTasks(staticPatterns, negativePatterns, false);
|
19331 | const dynamicTasks = convertPatternsToTasks(dynamicPatterns, negativePatterns, true);
|
19332 | return staticTasks.concat(dynamicTasks);
|
19333 | }
|
19334 | exports2.generate = generate;
|
19335 | function convertPatternsToTasks(positive, negative, dynamic) {
|
19336 | const tasks = [];
|
19337 | const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
|
19338 | const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
|
19339 | const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
19340 | const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
19341 | tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
19342 | if ("." in insideCurrentDirectoryGroup) {
|
19343 | tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
|
19344 | } else {
|
19345 | tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
19346 | }
|
19347 | return tasks;
|
19348 | }
|
19349 | exports2.convertPatternsToTasks = convertPatternsToTasks;
|
19350 | function getPositivePatterns(patterns) {
|
19351 | return utils.pattern.getPositivePatterns(patterns);
|
19352 | }
|
19353 | exports2.getPositivePatterns = getPositivePatterns;
|
19354 | function getNegativePatternsAsPositive(patterns, ignore) {
|
19355 | const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
19356 | const positive = negative.map(utils.pattern.convertToPositivePattern);
|
19357 | return positive;
|
19358 | }
|
19359 | exports2.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
19360 | function groupPatternsByBaseDirectory(patterns) {
|
19361 | const group = {};
|
19362 | return patterns.reduce((collection, pattern) => {
|
19363 | const base = utils.pattern.getBaseDirectory(pattern);
|
19364 | if (base in collection) {
|
19365 | collection[base].push(pattern);
|
19366 | } else {
|
19367 | collection[base] = [pattern];
|
19368 | }
|
19369 | return collection;
|
19370 | }, group);
|
19371 | }
|
19372 | exports2.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
19373 | function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
19374 | return Object.keys(positive).map((base) => {
|
19375 | return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
19376 | });
|
19377 | }
|
19378 | exports2.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
19379 | function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
19380 | return {
|
19381 | dynamic,
|
19382 | positive,
|
19383 | negative,
|
19384 | base,
|
19385 | patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
19386 | };
|
19387 | }
|
19388 | exports2.convertPatternGroupToTask = convertPatternGroupToTask;
|
19389 | }
|
19390 | });
|
19391 | var require_patterns = __commonJS2({
|
19392 | "node_modules/fast-glob/out/managers/patterns.js"(exports2) {
|
19393 | "use strict";
|
19394 | Object.defineProperty(exports2, "__esModule", {
|
19395 | value: true
|
19396 | });
|
19397 | exports2.removeDuplicateSlashes = exports2.transform = void 0;
|
19398 | var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
|
19399 | function transform(patterns) {
|
19400 | return patterns.map((pattern) => removeDuplicateSlashes(pattern));
|
19401 | }
|
19402 | exports2.transform = transform;
|
19403 | function removeDuplicateSlashes(pattern) {
|
19404 | return pattern.replace(DOUBLE_SLASH_RE, "/");
|
19405 | }
|
19406 | exports2.removeDuplicateSlashes = removeDuplicateSlashes;
|
19407 | }
|
19408 | });
|
19409 | var require_async2 = __commonJS2({
|
19410 | "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports2) {
|
19411 | "use strict";
|
19412 | Object.defineProperty(exports2, "__esModule", {
|
19413 | value: true
|
19414 | });
|
19415 | exports2.read = void 0;
|
19416 | function read(path, settings, callback) {
|
19417 | settings.fs.lstat(path, (lstatError, lstat) => {
|
19418 | if (lstatError !== null) {
|
19419 | callFailureCallback(callback, lstatError);
|
19420 | return;
|
19421 | }
|
19422 | if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
19423 | callSuccessCallback(callback, lstat);
|
19424 | return;
|
19425 | }
|
19426 | settings.fs.stat(path, (statError, stat) => {
|
19427 | if (statError !== null) {
|
19428 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
19429 | callFailureCallback(callback, statError);
|
19430 | return;
|
19431 | }
|
19432 | callSuccessCallback(callback, lstat);
|
19433 | return;
|
19434 | }
|
19435 | if (settings.markSymbolicLink) {
|
19436 | stat.isSymbolicLink = () => true;
|
19437 | }
|
19438 | callSuccessCallback(callback, stat);
|
19439 | });
|
19440 | });
|
19441 | }
|
19442 | exports2.read = read;
|
19443 | function callFailureCallback(callback, error) {
|
19444 | callback(error);
|
19445 | }
|
19446 | function callSuccessCallback(callback, result) {
|
19447 | callback(null, result);
|
19448 | }
|
19449 | }
|
19450 | });
|
19451 | var require_sync2 = __commonJS2({
|
19452 | "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports2) {
|
19453 | "use strict";
|
19454 | Object.defineProperty(exports2, "__esModule", {
|
19455 | value: true
|
19456 | });
|
19457 | exports2.read = void 0;
|
19458 | function read(path, settings) {
|
19459 | const lstat = settings.fs.lstatSync(path);
|
19460 | if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
19461 | return lstat;
|
19462 | }
|
19463 | try {
|
19464 | const stat = settings.fs.statSync(path);
|
19465 | if (settings.markSymbolicLink) {
|
19466 | stat.isSymbolicLink = () => true;
|
19467 | }
|
19468 | return stat;
|
19469 | } catch (error) {
|
19470 | if (!settings.throwErrorOnBrokenSymbolicLink) {
|
19471 | return lstat;
|
19472 | }
|
19473 | throw error;
|
19474 | }
|
19475 | }
|
19476 | exports2.read = read;
|
19477 | }
|
19478 | });
|
19479 | var require_fs2 = __commonJS2({
|
19480 | "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports2) {
|
19481 | "use strict";
|
19482 | Object.defineProperty(exports2, "__esModule", {
|
19483 | value: true
|
19484 | });
|
19485 | exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
19486 | var fs = require("fs");
|
19487 | exports2.FILE_SYSTEM_ADAPTER = {
|
19488 | lstat: fs.lstat,
|
19489 | stat: fs.stat,
|
19490 | lstatSync: fs.lstatSync,
|
19491 | statSync: fs.statSync
|
19492 | };
|
19493 | function createFileSystemAdapter(fsMethods) {
|
19494 | if (fsMethods === void 0) {
|
19495 | return exports2.FILE_SYSTEM_ADAPTER;
|
19496 | }
|
19497 | return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
|
19498 | }
|
19499 | exports2.createFileSystemAdapter = createFileSystemAdapter;
|
19500 | }
|
19501 | });
|
19502 | var require_settings = __commonJS2({
|
19503 | "node_modules/@nodelib/fs.stat/out/settings.js"(exports2) {
|
19504 | "use strict";
|
19505 | Object.defineProperty(exports2, "__esModule", {
|
19506 | value: true
|
19507 | });
|
19508 | var fs = require_fs2();
|
19509 | var Settings = class {
|
19510 | constructor(_options = {}) {
|
19511 | this._options = _options;
|
19512 | this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
19513 | this.fs = fs.createFileSystemAdapter(this._options.fs);
|
19514 | this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
19515 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
19516 | }
|
19517 | _getValue(option, value) {
|
19518 | return option !== null && option !== void 0 ? option : value;
|
19519 | }
|
19520 | };
|
19521 | exports2.default = Settings;
|
19522 | }
|
19523 | });
|
19524 | var require_out = __commonJS2({
|
19525 | "node_modules/@nodelib/fs.stat/out/index.js"(exports2) {
|
19526 | "use strict";
|
19527 | Object.defineProperty(exports2, "__esModule", {
|
19528 | value: true
|
19529 | });
|
19530 | exports2.statSync = exports2.stat = exports2.Settings = void 0;
|
19531 | var async = require_async2();
|
19532 | var sync = require_sync2();
|
19533 | var settings_1 = require_settings();
|
19534 | exports2.Settings = settings_1.default;
|
19535 | function stat(path, optionsOrSettingsOrCallback, callback) {
|
19536 | if (typeof optionsOrSettingsOrCallback === "function") {
|
19537 | async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
19538 | return;
|
19539 | }
|
19540 | async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
19541 | }
|
19542 | exports2.stat = stat;
|
19543 | function statSync(path, optionsOrSettings) {
|
19544 | const settings = getSettings(optionsOrSettings);
|
19545 | return sync.read(path, settings);
|
19546 | }
|
19547 | exports2.statSync = statSync;
|
19548 | function getSettings(settingsOrOptions = {}) {
|
19549 | if (settingsOrOptions instanceof settings_1.default) {
|
19550 | return settingsOrOptions;
|
19551 | }
|
19552 | return new settings_1.default(settingsOrOptions);
|
19553 | }
|
19554 | }
|
19555 | });
|
19556 | var require_queue_microtask = __commonJS2({
|
19557 | "node_modules/queue-microtask/index.js"(exports2, module2) {
|
19558 | var promise;
|
19559 | module2.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
|
19560 | throw err;
|
19561 | }, 0));
|
19562 | }
|
19563 | });
|
19564 | var require_run_parallel = __commonJS2({
|
19565 | "node_modules/run-parallel/index.js"(exports2, module2) {
|
19566 | module2.exports = runParallel;
|
19567 | var queueMicrotask2 = require_queue_microtask();
|
19568 | function runParallel(tasks, cb) {
|
19569 | let results, pending, keys;
|
19570 | let isSync = true;
|
19571 | if (Array.isArray(tasks)) {
|
19572 | results = [];
|
19573 | pending = tasks.length;
|
19574 | } else {
|
19575 | keys = Object.keys(tasks);
|
19576 | results = {};
|
19577 | pending = keys.length;
|
19578 | }
|
19579 | function done(err) {
|
19580 | function end() {
|
19581 | if (cb)
|
19582 | cb(err, results);
|
19583 | cb = null;
|
19584 | }
|
19585 | if (isSync)
|
19586 | queueMicrotask2(end);
|
19587 | else
|
19588 | end();
|
19589 | }
|
19590 | function each(i, err, result) {
|
19591 | results[i] = result;
|
19592 | if (--pending === 0 || err) {
|
19593 | done(err);
|
19594 | }
|
19595 | }
|
19596 | if (!pending) {
|
19597 | done(null);
|
19598 | } else if (keys) {
|
19599 | keys.forEach(function(key) {
|
19600 | tasks[key](function(err, result) {
|
19601 | each(key, err, result);
|
19602 | });
|
19603 | });
|
19604 | } else {
|
19605 | tasks.forEach(function(task, i) {
|
19606 | task(function(err, result) {
|
19607 | each(i, err, result);
|
19608 | });
|
19609 | });
|
19610 | }
|
19611 | isSync = false;
|
19612 | }
|
19613 | }
|
19614 | });
|
19615 | var require_constants4 = __commonJS2({
|
19616 | "node_modules/@nodelib/fs.scandir/out/constants.js"(exports2) {
|
19617 | "use strict";
|
19618 | Object.defineProperty(exports2, "__esModule", {
|
19619 | value: true
|
19620 | });
|
19621 | exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
|
19622 | var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
|
19623 | if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
|
19624 | throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
19625 | }
|
19626 | var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
19627 | var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
|
19628 | var SUPPORTED_MAJOR_VERSION = 10;
|
19629 | var SUPPORTED_MINOR_VERSION = 10;
|
19630 | var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
|
19631 | var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
19632 | exports2.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
19633 | }
|
19634 | });
|
19635 | var require_fs3 = __commonJS2({
|
19636 | "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports2) {
|
19637 | "use strict";
|
19638 | Object.defineProperty(exports2, "__esModule", {
|
19639 | value: true
|
19640 | });
|
19641 | exports2.createDirentFromStats = void 0;
|
19642 | var DirentFromStats = class {
|
19643 | constructor(name, stats) {
|
19644 | this.name = name;
|
19645 | this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
19646 | this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
19647 | this.isDirectory = stats.isDirectory.bind(stats);
|
19648 | this.isFIFO = stats.isFIFO.bind(stats);
|
19649 | this.isFile = stats.isFile.bind(stats);
|
19650 | this.isSocket = stats.isSocket.bind(stats);
|
19651 | this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
19652 | }
|
19653 | };
|
19654 | function createDirentFromStats(name, stats) {
|
19655 | return new DirentFromStats(name, stats);
|
19656 | }
|
19657 | exports2.createDirentFromStats = createDirentFromStats;
|
19658 | }
|
19659 | });
|
19660 | var require_utils5 = __commonJS2({
|
19661 | "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports2) {
|
19662 | "use strict";
|
19663 | Object.defineProperty(exports2, "__esModule", {
|
19664 | value: true
|
19665 | });
|
19666 | exports2.fs = void 0;
|
19667 | var fs = require_fs3();
|
19668 | exports2.fs = fs;
|
19669 | }
|
19670 | });
|
19671 | var require_common3 = __commonJS2({
|
19672 | "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports2) {
|
19673 | "use strict";
|
19674 | Object.defineProperty(exports2, "__esModule", {
|
19675 | value: true
|
19676 | });
|
19677 | exports2.joinPathSegments = void 0;
|
19678 | function joinPathSegments(a, b, separator) {
|
19679 | if (a.endsWith(separator)) {
|
19680 | return a + b;
|
19681 | }
|
19682 | return a + separator + b;
|
19683 | }
|
19684 | exports2.joinPathSegments = joinPathSegments;
|
19685 | }
|
19686 | });
|
19687 | var require_async3 = __commonJS2({
|
19688 | "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports2) {
|
19689 | "use strict";
|
19690 | Object.defineProperty(exports2, "__esModule", {
|
19691 | value: true
|
19692 | });
|
19693 | exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
|
19694 | var fsStat = require_out();
|
19695 | var rpl = require_run_parallel();
|
19696 | var constants_1 = require_constants4();
|
19697 | var utils = require_utils5();
|
19698 | var common = require_common3();
|
19699 | function read(directory, settings, callback) {
|
19700 | if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
19701 | readdirWithFileTypes(directory, settings, callback);
|
19702 | return;
|
19703 | }
|
19704 | readdir(directory, settings, callback);
|
19705 | }
|
19706 | exports2.read = read;
|
19707 | function readdirWithFileTypes(directory, settings, callback) {
|
19708 | settings.fs.readdir(directory, {
|
19709 | withFileTypes: true
|
19710 | }, (readdirError, dirents) => {
|
19711 | if (readdirError !== null) {
|
19712 | callFailureCallback(callback, readdirError);
|
19713 | return;
|
19714 | }
|
19715 | const entries = dirents.map((dirent) => ({
|
19716 | dirent,
|
19717 | name: dirent.name,
|
19718 | path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
19719 | }));
|
19720 | if (!settings.followSymbolicLinks) {
|
19721 | callSuccessCallback(callback, entries);
|
19722 | return;
|
19723 | }
|
19724 | const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
19725 | rpl(tasks, (rplError, rplEntries) => {
|
19726 | if (rplError !== null) {
|
19727 | callFailureCallback(callback, rplError);
|
19728 | return;
|
19729 | }
|
19730 | callSuccessCallback(callback, rplEntries);
|
19731 | });
|
19732 | });
|
19733 | }
|
19734 | exports2.readdirWithFileTypes = readdirWithFileTypes;
|
19735 | function makeRplTaskEntry(entry, settings) {
|
19736 | return (done) => {
|
19737 | if (!entry.dirent.isSymbolicLink()) {
|
19738 | done(null, entry);
|
19739 | return;
|
19740 | }
|
19741 | settings.fs.stat(entry.path, (statError, stats) => {
|
19742 | if (statError !== null) {
|
19743 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
19744 | done(statError);
|
19745 | return;
|
19746 | }
|
19747 | done(null, entry);
|
19748 | return;
|
19749 | }
|
19750 | entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
19751 | done(null, entry);
|
19752 | });
|
19753 | };
|
19754 | }
|
19755 | function readdir(directory, settings, callback) {
|
19756 | settings.fs.readdir(directory, (readdirError, names) => {
|
19757 | if (readdirError !== null) {
|
19758 | callFailureCallback(callback, readdirError);
|
19759 | return;
|
19760 | }
|
19761 | const tasks = names.map((name) => {
|
19762 | const path = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
19763 | return (done) => {
|
19764 | fsStat.stat(path, settings.fsStatSettings, (error, stats) => {
|
19765 | if (error !== null) {
|
19766 | done(error);
|
19767 | return;
|
19768 | }
|
19769 | const entry = {
|
19770 | name,
|
19771 | path,
|
19772 | dirent: utils.fs.createDirentFromStats(name, stats)
|
19773 | };
|
19774 | if (settings.stats) {
|
19775 | entry.stats = stats;
|
19776 | }
|
19777 | done(null, entry);
|
19778 | });
|
19779 | };
|
19780 | });
|
19781 | rpl(tasks, (rplError, entries) => {
|
19782 | if (rplError !== null) {
|
19783 | callFailureCallback(callback, rplError);
|
19784 | return;
|
19785 | }
|
19786 | callSuccessCallback(callback, entries);
|
19787 | });
|
19788 | });
|
19789 | }
|
19790 | exports2.readdir = readdir;
|
19791 | function callFailureCallback(callback, error) {
|
19792 | callback(error);
|
19793 | }
|
19794 | function callSuccessCallback(callback, result) {
|
19795 | callback(null, result);
|
19796 | }
|
19797 | }
|
19798 | });
|
19799 | var require_sync3 = __commonJS2({
|
19800 | "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports2) {
|
19801 | "use strict";
|
19802 | Object.defineProperty(exports2, "__esModule", {
|
19803 | value: true
|
19804 | });
|
19805 | exports2.readdir = exports2.readdirWithFileTypes = exports2.read = void 0;
|
19806 | var fsStat = require_out();
|
19807 | var constants_1 = require_constants4();
|
19808 | var utils = require_utils5();
|
19809 | var common = require_common3();
|
19810 | function read(directory, settings) {
|
19811 | if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
19812 | return readdirWithFileTypes(directory, settings);
|
19813 | }
|
19814 | return readdir(directory, settings);
|
19815 | }
|
19816 | exports2.read = read;
|
19817 | function readdirWithFileTypes(directory, settings) {
|
19818 | const dirents = settings.fs.readdirSync(directory, {
|
19819 | withFileTypes: true
|
19820 | });
|
19821 | return dirents.map((dirent) => {
|
19822 | const entry = {
|
19823 | dirent,
|
19824 | name: dirent.name,
|
19825 | path: common.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
19826 | };
|
19827 | if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
19828 | try {
|
19829 | const stats = settings.fs.statSync(entry.path);
|
19830 | entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
19831 | } catch (error) {
|
19832 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
19833 | throw error;
|
19834 | }
|
19835 | }
|
19836 | }
|
19837 | return entry;
|
19838 | });
|
19839 | }
|
19840 | exports2.readdirWithFileTypes = readdirWithFileTypes;
|
19841 | function readdir(directory, settings) {
|
19842 | const names = settings.fs.readdirSync(directory);
|
19843 | return names.map((name) => {
|
19844 | const entryPath = common.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
19845 | const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
19846 | const entry = {
|
19847 | name,
|
19848 | path: entryPath,
|
19849 | dirent: utils.fs.createDirentFromStats(name, stats)
|
19850 | };
|
19851 | if (settings.stats) {
|
19852 | entry.stats = stats;
|
19853 | }
|
19854 | return entry;
|
19855 | });
|
19856 | }
|
19857 | exports2.readdir = readdir;
|
19858 | }
|
19859 | });
|
19860 | var require_fs4 = __commonJS2({
|
19861 | "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports2) {
|
19862 | "use strict";
|
19863 | Object.defineProperty(exports2, "__esModule", {
|
19864 | value: true
|
19865 | });
|
19866 | exports2.createFileSystemAdapter = exports2.FILE_SYSTEM_ADAPTER = void 0;
|
19867 | var fs = require("fs");
|
19868 | exports2.FILE_SYSTEM_ADAPTER = {
|
19869 | lstat: fs.lstat,
|
19870 | stat: fs.stat,
|
19871 | lstatSync: fs.lstatSync,
|
19872 | statSync: fs.statSync,
|
19873 | readdir: fs.readdir,
|
19874 | readdirSync: fs.readdirSync
|
19875 | };
|
19876 | function createFileSystemAdapter(fsMethods) {
|
19877 | if (fsMethods === void 0) {
|
19878 | return exports2.FILE_SYSTEM_ADAPTER;
|
19879 | }
|
19880 | return Object.assign(Object.assign({}, exports2.FILE_SYSTEM_ADAPTER), fsMethods);
|
19881 | }
|
19882 | exports2.createFileSystemAdapter = createFileSystemAdapter;
|
19883 | }
|
19884 | });
|
19885 | var require_settings2 = __commonJS2({
|
19886 | "node_modules/@nodelib/fs.scandir/out/settings.js"(exports2) {
|
19887 | "use strict";
|
19888 | Object.defineProperty(exports2, "__esModule", {
|
19889 | value: true
|
19890 | });
|
19891 | var path = require("path");
|
19892 | var fsStat = require_out();
|
19893 | var fs = require_fs4();
|
19894 | var Settings = class {
|
19895 | constructor(_options = {}) {
|
19896 | this._options = _options;
|
19897 | this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
19898 | this.fs = fs.createFileSystemAdapter(this._options.fs);
|
19899 | this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
19900 | this.stats = this._getValue(this._options.stats, false);
|
19901 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
19902 | this.fsStatSettings = new fsStat.Settings({
|
19903 | followSymbolicLink: this.followSymbolicLinks,
|
19904 | fs: this.fs,
|
19905 | throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
19906 | });
|
19907 | }
|
19908 | _getValue(option, value) {
|
19909 | return option !== null && option !== void 0 ? option : value;
|
19910 | }
|
19911 | };
|
19912 | exports2.default = Settings;
|
19913 | }
|
19914 | });
|
19915 | var require_out2 = __commonJS2({
|
19916 | "node_modules/@nodelib/fs.scandir/out/index.js"(exports2) {
|
19917 | "use strict";
|
19918 | Object.defineProperty(exports2, "__esModule", {
|
19919 | value: true
|
19920 | });
|
19921 | exports2.Settings = exports2.scandirSync = exports2.scandir = void 0;
|
19922 | var async = require_async3();
|
19923 | var sync = require_sync3();
|
19924 | var settings_1 = require_settings2();
|
19925 | exports2.Settings = settings_1.default;
|
19926 | function scandir(path, optionsOrSettingsOrCallback, callback) {
|
19927 | if (typeof optionsOrSettingsOrCallback === "function") {
|
19928 | async.read(path, getSettings(), optionsOrSettingsOrCallback);
|
19929 | return;
|
19930 | }
|
19931 | async.read(path, getSettings(optionsOrSettingsOrCallback), callback);
|
19932 | }
|
19933 | exports2.scandir = scandir;
|
19934 | function scandirSync(path, optionsOrSettings) {
|
19935 | const settings = getSettings(optionsOrSettings);
|
19936 | return sync.read(path, settings);
|
19937 | }
|
19938 | exports2.scandirSync = scandirSync;
|
19939 | function getSettings(settingsOrOptions = {}) {
|
19940 | if (settingsOrOptions instanceof settings_1.default) {
|
19941 | return settingsOrOptions;
|
19942 | }
|
19943 | return new settings_1.default(settingsOrOptions);
|
19944 | }
|
19945 | }
|
19946 | });
|
19947 | var require_reusify = __commonJS2({
|
19948 | "node_modules/reusify/reusify.js"(exports2, module2) {
|
19949 | "use strict";
|
19950 | function reusify(Constructor) {
|
19951 | var head = new Constructor();
|
19952 | var tail = head;
|
19953 | function get() {
|
19954 | var current = head;
|
19955 | if (current.next) {
|
19956 | head = current.next;
|
19957 | } else {
|
19958 | head = new Constructor();
|
19959 | tail = head;
|
19960 | }
|
19961 | current.next = null;
|
19962 | return current;
|
19963 | }
|
19964 | function release(obj) {
|
19965 | tail.next = obj;
|
19966 | tail = obj;
|
19967 | }
|
19968 | return {
|
19969 | get,
|
19970 | release
|
19971 | };
|
19972 | }
|
19973 | module2.exports = reusify;
|
19974 | }
|
19975 | });
|
19976 | var require_queue = __commonJS2({
|
19977 | "node_modules/fastq/queue.js"(exports2, module2) {
|
19978 | "use strict";
|
19979 | var reusify = require_reusify();
|
19980 | function fastqueue(context, worker, concurrency) {
|
19981 | if (typeof context === "function") {
|
19982 | concurrency = worker;
|
19983 | worker = context;
|
19984 | context = null;
|
19985 | }
|
19986 | if (concurrency < 1) {
|
19987 | throw new Error("fastqueue concurrency must be greater than 1");
|
19988 | }
|
19989 | var cache = reusify(Task);
|
19990 | var queueHead = null;
|
19991 | var queueTail = null;
|
19992 | var _running = 0;
|
19993 | var errorHandler = null;
|
19994 | var self2 = {
|
19995 | push,
|
19996 | drain: noop,
|
19997 | saturated: noop,
|
19998 | pause,
|
19999 | paused: false,
|
20000 | concurrency,
|
20001 | running,
|
20002 | resume,
|
20003 | idle,
|
20004 | length,
|
20005 | getQueue,
|
20006 | unshift,
|
20007 | empty: noop,
|
20008 | kill,
|
20009 | killAndDrain,
|
20010 | error
|
20011 | };
|
20012 | return self2;
|
20013 | function running() {
|
20014 | return _running;
|
20015 | }
|
20016 | function pause() {
|
20017 | self2.paused = true;
|
20018 | }
|
20019 | function length() {
|
20020 | var current = queueHead;
|
20021 | var counter = 0;
|
20022 | while (current) {
|
20023 | current = current.next;
|
20024 | counter++;
|
20025 | }
|
20026 | return counter;
|
20027 | }
|
20028 | function getQueue() {
|
20029 | var current = queueHead;
|
20030 | var tasks = [];
|
20031 | while (current) {
|
20032 | tasks.push(current.value);
|
20033 | current = current.next;
|
20034 | }
|
20035 | return tasks;
|
20036 | }
|
20037 | function resume() {
|
20038 | if (!self2.paused)
|
20039 | return;
|
20040 | self2.paused = false;
|
20041 | for (var i = 0; i < self2.concurrency; i++) {
|
20042 | _running++;
|
20043 | release();
|
20044 | }
|
20045 | }
|
20046 | function idle() {
|
20047 | return _running === 0 && self2.length() === 0;
|
20048 | }
|
20049 | function push(value, done) {
|
20050 | var current = cache.get();
|
20051 | current.context = context;
|
20052 | current.release = release;
|
20053 | current.value = value;
|
20054 | current.callback = done || noop;
|
20055 | current.errorHandler = errorHandler;
|
20056 | if (_running === self2.concurrency || self2.paused) {
|
20057 | if (queueTail) {
|
20058 | queueTail.next = current;
|
20059 | queueTail = current;
|
20060 | } else {
|
20061 | queueHead = current;
|
20062 | queueTail = current;
|
20063 | self2.saturated();
|
20064 | }
|
20065 | } else {
|
20066 | _running++;
|
20067 | worker.call(context, current.value, current.worked);
|
20068 | }
|
20069 | }
|
20070 | function unshift(value, done) {
|
20071 | var current = cache.get();
|
20072 | current.context = context;
|
20073 | current.release = release;
|
20074 | current.value = value;
|
20075 | current.callback = done || noop;
|
20076 | if (_running === self2.concurrency || self2.paused) {
|
20077 | if (queueHead) {
|
20078 | current.next = queueHead;
|
20079 | queueHead = current;
|
20080 | } else {
|
20081 | queueHead = current;
|
20082 | queueTail = current;
|
20083 | self2.saturated();
|
20084 | }
|
20085 | } else {
|
20086 | _running++;
|
20087 | worker.call(context, current.value, current.worked);
|
20088 | }
|
20089 | }
|
20090 | function release(holder) {
|
20091 | if (holder) {
|
20092 | cache.release(holder);
|
20093 | }
|
20094 | var next = queueHead;
|
20095 | if (next) {
|
20096 | if (!self2.paused) {
|
20097 | if (queueTail === queueHead) {
|
20098 | queueTail = null;
|
20099 | }
|
20100 | queueHead = next.next;
|
20101 | next.next = null;
|
20102 | worker.call(context, next.value, next.worked);
|
20103 | if (queueTail === null) {
|
20104 | self2.empty();
|
20105 | }
|
20106 | } else {
|
20107 | _running--;
|
20108 | }
|
20109 | } else if (--_running === 0) {
|
20110 | self2.drain();
|
20111 | }
|
20112 | }
|
20113 | function kill() {
|
20114 | queueHead = null;
|
20115 | queueTail = null;
|
20116 | self2.drain = noop;
|
20117 | }
|
20118 | function killAndDrain() {
|
20119 | queueHead = null;
|
20120 | queueTail = null;
|
20121 | self2.drain();
|
20122 | self2.drain = noop;
|
20123 | }
|
20124 | function error(handler) {
|
20125 | errorHandler = handler;
|
20126 | }
|
20127 | }
|
20128 | function noop() {
|
20129 | }
|
20130 | function Task() {
|
20131 | this.value = null;
|
20132 | this.callback = noop;
|
20133 | this.next = null;
|
20134 | this.release = noop;
|
20135 | this.context = null;
|
20136 | this.errorHandler = null;
|
20137 | var self2 = this;
|
20138 | this.worked = function worked(err, result) {
|
20139 | var callback = self2.callback;
|
20140 | var errorHandler = self2.errorHandler;
|
20141 | var val = self2.value;
|
20142 | self2.value = null;
|
20143 | self2.callback = noop;
|
20144 | if (self2.errorHandler) {
|
20145 | errorHandler(err, val);
|
20146 | }
|
20147 | callback.call(self2.context, err, result);
|
20148 | self2.release(self2);
|
20149 | };
|
20150 | }
|
20151 | function queueAsPromised(context, worker, concurrency) {
|
20152 | if (typeof context === "function") {
|
20153 | concurrency = worker;
|
20154 | worker = context;
|
20155 | context = null;
|
20156 | }
|
20157 | function asyncWrapper(arg, cb) {
|
20158 | worker.call(this, arg).then(function(res) {
|
20159 | cb(null, res);
|
20160 | }, cb);
|
20161 | }
|
20162 | var queue = fastqueue(context, asyncWrapper, concurrency);
|
20163 | var pushCb = queue.push;
|
20164 | var unshiftCb = queue.unshift;
|
20165 | queue.push = push;
|
20166 | queue.unshift = unshift;
|
20167 | queue.drained = drained;
|
20168 | return queue;
|
20169 | function push(value) {
|
20170 | var p = new Promise(function(resolve, reject) {
|
20171 | pushCb(value, function(err, result) {
|
20172 | if (err) {
|
20173 | reject(err);
|
20174 | return;
|
20175 | }
|
20176 | resolve(result);
|
20177 | });
|
20178 | });
|
20179 | p.catch(noop);
|
20180 | return p;
|
20181 | }
|
20182 | function unshift(value) {
|
20183 | var p = new Promise(function(resolve, reject) {
|
20184 | unshiftCb(value, function(err, result) {
|
20185 | if (err) {
|
20186 | reject(err);
|
20187 | return;
|
20188 | }
|
20189 | resolve(result);
|
20190 | });
|
20191 | });
|
20192 | p.catch(noop);
|
20193 | return p;
|
20194 | }
|
20195 | function drained() {
|
20196 | var previousDrain = queue.drain;
|
20197 | var p = new Promise(function(resolve) {
|
20198 | queue.drain = function() {
|
20199 | previousDrain();
|
20200 | resolve();
|
20201 | };
|
20202 | });
|
20203 | return p;
|
20204 | }
|
20205 | }
|
20206 | module2.exports = fastqueue;
|
20207 | module2.exports.promise = queueAsPromised;
|
20208 | }
|
20209 | });
|
20210 | var require_common4 = __commonJS2({
|
20211 | "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports2) {
|
20212 | "use strict";
|
20213 | Object.defineProperty(exports2, "__esModule", {
|
20214 | value: true
|
20215 | });
|
20216 | exports2.joinPathSegments = exports2.replacePathSegmentSeparator = exports2.isAppliedFilter = exports2.isFatalError = void 0;
|
20217 | function isFatalError(settings, error) {
|
20218 | if (settings.errorFilter === null) {
|
20219 | return true;
|
20220 | }
|
20221 | return !settings.errorFilter(error);
|
20222 | }
|
20223 | exports2.isFatalError = isFatalError;
|
20224 | function isAppliedFilter(filter, value) {
|
20225 | return filter === null || filter(value);
|
20226 | }
|
20227 | exports2.isAppliedFilter = isAppliedFilter;
|
20228 | function replacePathSegmentSeparator(filepath, separator) {
|
20229 | return filepath.split(/[/\\]/).join(separator);
|
20230 | }
|
20231 | exports2.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
20232 | function joinPathSegments(a, b, separator) {
|
20233 | if (a === "") {
|
20234 | return b;
|
20235 | }
|
20236 | if (a.endsWith(separator)) {
|
20237 | return a + b;
|
20238 | }
|
20239 | return a + separator + b;
|
20240 | }
|
20241 | exports2.joinPathSegments = joinPathSegments;
|
20242 | }
|
20243 | });
|
20244 | var require_reader = __commonJS2({
|
20245 | "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports2) {
|
20246 | "use strict";
|
20247 | Object.defineProperty(exports2, "__esModule", {
|
20248 | value: true
|
20249 | });
|
20250 | var common = require_common4();
|
20251 | var Reader = class {
|
20252 | constructor(_root, _settings) {
|
20253 | this._root = _root;
|
20254 | this._settings = _settings;
|
20255 | this._root = common.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
20256 | }
|
20257 | };
|
20258 | exports2.default = Reader;
|
20259 | }
|
20260 | });
|
20261 | var require_async4 = __commonJS2({
|
20262 | "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports2) {
|
20263 | "use strict";
|
20264 | Object.defineProperty(exports2, "__esModule", {
|
20265 | value: true
|
20266 | });
|
20267 | var events_1 = require("events");
|
20268 | var fsScandir = require_out2();
|
20269 | var fastq = require_queue();
|
20270 | var common = require_common4();
|
20271 | var reader_1 = require_reader();
|
20272 | var AsyncReader = class extends reader_1.default {
|
20273 | constructor(_root, _settings) {
|
20274 | super(_root, _settings);
|
20275 | this._settings = _settings;
|
20276 | this._scandir = fsScandir.scandir;
|
20277 | this._emitter = new events_1.EventEmitter();
|
20278 | this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
20279 | this._isFatalError = false;
|
20280 | this._isDestroyed = false;
|
20281 | this._queue.drain = () => {
|
20282 | if (!this._isFatalError) {
|
20283 | this._emitter.emit("end");
|
20284 | }
|
20285 | };
|
20286 | }
|
20287 | read() {
|
20288 | this._isFatalError = false;
|
20289 | this._isDestroyed = false;
|
20290 | setImmediate(() => {
|
20291 | this._pushToQueue(this._root, this._settings.basePath);
|
20292 | });
|
20293 | return this._emitter;
|
20294 | }
|
20295 | get isDestroyed() {
|
20296 | return this._isDestroyed;
|
20297 | }
|
20298 | destroy() {
|
20299 | if (this._isDestroyed) {
|
20300 | throw new Error("The reader is already destroyed");
|
20301 | }
|
20302 | this._isDestroyed = true;
|
20303 | this._queue.killAndDrain();
|
20304 | }
|
20305 | onEntry(callback) {
|
20306 | this._emitter.on("entry", callback);
|
20307 | }
|
20308 | onError(callback) {
|
20309 | this._emitter.once("error", callback);
|
20310 | }
|
20311 | onEnd(callback) {
|
20312 | this._emitter.once("end", callback);
|
20313 | }
|
20314 | _pushToQueue(directory, base) {
|
20315 | const queueItem = {
|
20316 | directory,
|
20317 | base
|
20318 | };
|
20319 | this._queue.push(queueItem, (error) => {
|
20320 | if (error !== null) {
|
20321 | this._handleError(error);
|
20322 | }
|
20323 | });
|
20324 | }
|
20325 | _worker(item, done) {
|
20326 | this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
20327 | if (error !== null) {
|
20328 | done(error, void 0);
|
20329 | return;
|
20330 | }
|
20331 | for (const entry of entries) {
|
20332 | this._handleEntry(entry, item.base);
|
20333 | }
|
20334 | done(null, void 0);
|
20335 | });
|
20336 | }
|
20337 | _handleError(error) {
|
20338 | if (this._isDestroyed || !common.isFatalError(this._settings, error)) {
|
20339 | return;
|
20340 | }
|
20341 | this._isFatalError = true;
|
20342 | this._isDestroyed = true;
|
20343 | this._emitter.emit("error", error);
|
20344 | }
|
20345 | _handleEntry(entry, base) {
|
20346 | if (this._isDestroyed || this._isFatalError) {
|
20347 | return;
|
20348 | }
|
20349 | const fullpath = entry.path;
|
20350 | if (base !== void 0) {
|
20351 | entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
20352 | }
|
20353 | if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
20354 | this._emitEntry(entry);
|
20355 | }
|
20356 | if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
20357 | this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
20358 | }
|
20359 | }
|
20360 | _emitEntry(entry) {
|
20361 | this._emitter.emit("entry", entry);
|
20362 | }
|
20363 | };
|
20364 | exports2.default = AsyncReader;
|
20365 | }
|
20366 | });
|
20367 | var require_async5 = __commonJS2({
|
20368 | "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports2) {
|
20369 | "use strict";
|
20370 | Object.defineProperty(exports2, "__esModule", {
|
20371 | value: true
|
20372 | });
|
20373 | var async_1 = require_async4();
|
20374 | var AsyncProvider = class {
|
20375 | constructor(_root, _settings) {
|
20376 | this._root = _root;
|
20377 | this._settings = _settings;
|
20378 | this._reader = new async_1.default(this._root, this._settings);
|
20379 | this._storage = [];
|
20380 | }
|
20381 | read(callback) {
|
20382 | this._reader.onError((error) => {
|
20383 | callFailureCallback(callback, error);
|
20384 | });
|
20385 | this._reader.onEntry((entry) => {
|
20386 | this._storage.push(entry);
|
20387 | });
|
20388 | this._reader.onEnd(() => {
|
20389 | callSuccessCallback(callback, this._storage);
|
20390 | });
|
20391 | this._reader.read();
|
20392 | }
|
20393 | };
|
20394 | exports2.default = AsyncProvider;
|
20395 | function callFailureCallback(callback, error) {
|
20396 | callback(error);
|
20397 | }
|
20398 | function callSuccessCallback(callback, entries) {
|
20399 | callback(null, entries);
|
20400 | }
|
20401 | }
|
20402 | });
|
20403 | var require_stream2 = __commonJS2({
|
20404 | "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports2) {
|
20405 | "use strict";
|
20406 | Object.defineProperty(exports2, "__esModule", {
|
20407 | value: true
|
20408 | });
|
20409 | var stream_1 = require("stream");
|
20410 | var async_1 = require_async4();
|
20411 | var StreamProvider = class {
|
20412 | constructor(_root, _settings) {
|
20413 | this._root = _root;
|
20414 | this._settings = _settings;
|
20415 | this._reader = new async_1.default(this._root, this._settings);
|
20416 | this._stream = new stream_1.Readable({
|
20417 | objectMode: true,
|
20418 | read: () => {
|
20419 | },
|
20420 | destroy: () => {
|
20421 | if (!this._reader.isDestroyed) {
|
20422 | this._reader.destroy();
|
20423 | }
|
20424 | }
|
20425 | });
|
20426 | }
|
20427 | read() {
|
20428 | this._reader.onError((error) => {
|
20429 | this._stream.emit("error", error);
|
20430 | });
|
20431 | this._reader.onEntry((entry) => {
|
20432 | this._stream.push(entry);
|
20433 | });
|
20434 | this._reader.onEnd(() => {
|
20435 | this._stream.push(null);
|
20436 | });
|
20437 | this._reader.read();
|
20438 | return this._stream;
|
20439 | }
|
20440 | };
|
20441 | exports2.default = StreamProvider;
|
20442 | }
|
20443 | });
|
20444 | var require_sync4 = __commonJS2({
|
20445 | "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports2) {
|
20446 | "use strict";
|
20447 | Object.defineProperty(exports2, "__esModule", {
|
20448 | value: true
|
20449 | });
|
20450 | var fsScandir = require_out2();
|
20451 | var common = require_common4();
|
20452 | var reader_1 = require_reader();
|
20453 | var SyncReader = class extends reader_1.default {
|
20454 | constructor() {
|
20455 | super(...arguments);
|
20456 | this._scandir = fsScandir.scandirSync;
|
20457 | this._storage = [];
|
20458 | this._queue = new Set();
|
20459 | }
|
20460 | read() {
|
20461 | this._pushToQueue(this._root, this._settings.basePath);
|
20462 | this._handleQueue();
|
20463 | return this._storage;
|
20464 | }
|
20465 | _pushToQueue(directory, base) {
|
20466 | this._queue.add({
|
20467 | directory,
|
20468 | base
|
20469 | });
|
20470 | }
|
20471 | _handleQueue() {
|
20472 | for (const item of this._queue.values()) {
|
20473 | this._handleDirectory(item.directory, item.base);
|
20474 | }
|
20475 | }
|
20476 | _handleDirectory(directory, base) {
|
20477 | try {
|
20478 | const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
20479 | for (const entry of entries) {
|
20480 | this._handleEntry(entry, base);
|
20481 | }
|
20482 | } catch (error) {
|
20483 | this._handleError(error);
|
20484 | }
|
20485 | }
|
20486 | _handleError(error) {
|
20487 | if (!common.isFatalError(this._settings, error)) {
|
20488 | return;
|
20489 | }
|
20490 | throw error;
|
20491 | }
|
20492 | _handleEntry(entry, base) {
|
20493 | const fullpath = entry.path;
|
20494 | if (base !== void 0) {
|
20495 | entry.path = common.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
20496 | }
|
20497 | if (common.isAppliedFilter(this._settings.entryFilter, entry)) {
|
20498 | this._pushToStorage(entry);
|
20499 | }
|
20500 | if (entry.dirent.isDirectory() && common.isAppliedFilter(this._settings.deepFilter, entry)) {
|
20501 | this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
20502 | }
|
20503 | }
|
20504 | _pushToStorage(entry) {
|
20505 | this._storage.push(entry);
|
20506 | }
|
20507 | };
|
20508 | exports2.default = SyncReader;
|
20509 | }
|
20510 | });
|
20511 | var require_sync5 = __commonJS2({
|
20512 | "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports2) {
|
20513 | "use strict";
|
20514 | Object.defineProperty(exports2, "__esModule", {
|
20515 | value: true
|
20516 | });
|
20517 | var sync_1 = require_sync4();
|
20518 | var SyncProvider = class {
|
20519 | constructor(_root, _settings) {
|
20520 | this._root = _root;
|
20521 | this._settings = _settings;
|
20522 | this._reader = new sync_1.default(this._root, this._settings);
|
20523 | }
|
20524 | read() {
|
20525 | return this._reader.read();
|
20526 | }
|
20527 | };
|
20528 | exports2.default = SyncProvider;
|
20529 | }
|
20530 | });
|
20531 | var require_settings3 = __commonJS2({
|
20532 | "node_modules/@nodelib/fs.walk/out/settings.js"(exports2) {
|
20533 | "use strict";
|
20534 | Object.defineProperty(exports2, "__esModule", {
|
20535 | value: true
|
20536 | });
|
20537 | var path = require("path");
|
20538 | var fsScandir = require_out2();
|
20539 | var Settings = class {
|
20540 | constructor(_options = {}) {
|
20541 | this._options = _options;
|
20542 | this.basePath = this._getValue(this._options.basePath, void 0);
|
20543 | this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
20544 | this.deepFilter = this._getValue(this._options.deepFilter, null);
|
20545 | this.entryFilter = this._getValue(this._options.entryFilter, null);
|
20546 | this.errorFilter = this._getValue(this._options.errorFilter, null);
|
20547 | this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path.sep);
|
20548 | this.fsScandirSettings = new fsScandir.Settings({
|
20549 | followSymbolicLinks: this._options.followSymbolicLinks,
|
20550 | fs: this._options.fs,
|
20551 | pathSegmentSeparator: this._options.pathSegmentSeparator,
|
20552 | stats: this._options.stats,
|
20553 | throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
20554 | });
|
20555 | }
|
20556 | _getValue(option, value) {
|
20557 | return option !== null && option !== void 0 ? option : value;
|
20558 | }
|
20559 | };
|
20560 | exports2.default = Settings;
|
20561 | }
|
20562 | });
|
20563 | var require_out3 = __commonJS2({
|
20564 | "node_modules/@nodelib/fs.walk/out/index.js"(exports2) {
|
20565 | "use strict";
|
20566 | Object.defineProperty(exports2, "__esModule", {
|
20567 | value: true
|
20568 | });
|
20569 | exports2.Settings = exports2.walkStream = exports2.walkSync = exports2.walk = void 0;
|
20570 | var async_1 = require_async5();
|
20571 | var stream_1 = require_stream2();
|
20572 | var sync_1 = require_sync5();
|
20573 | var settings_1 = require_settings3();
|
20574 | exports2.Settings = settings_1.default;
|
20575 | function walk(directory, optionsOrSettingsOrCallback, callback) {
|
20576 | if (typeof optionsOrSettingsOrCallback === "function") {
|
20577 | new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
20578 | return;
|
20579 | }
|
20580 | new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
20581 | }
|
20582 | exports2.walk = walk;
|
20583 | function walkSync(directory, optionsOrSettings) {
|
20584 | const settings = getSettings(optionsOrSettings);
|
20585 | const provider = new sync_1.default(directory, settings);
|
20586 | return provider.read();
|
20587 | }
|
20588 | exports2.walkSync = walkSync;
|
20589 | function walkStream(directory, optionsOrSettings) {
|
20590 | const settings = getSettings(optionsOrSettings);
|
20591 | const provider = new stream_1.default(directory, settings);
|
20592 | return provider.read();
|
20593 | }
|
20594 | exports2.walkStream = walkStream;
|
20595 | function getSettings(settingsOrOptions = {}) {
|
20596 | if (settingsOrOptions instanceof settings_1.default) {
|
20597 | return settingsOrOptions;
|
20598 | }
|
20599 | return new settings_1.default(settingsOrOptions);
|
20600 | }
|
20601 | }
|
20602 | });
|
20603 | var require_reader2 = __commonJS2({
|
20604 | "node_modules/fast-glob/out/readers/reader.js"(exports2) {
|
20605 | "use strict";
|
20606 | Object.defineProperty(exports2, "__esModule", {
|
20607 | value: true
|
20608 | });
|
20609 | var path = require("path");
|
20610 | var fsStat = require_out();
|
20611 | var utils = require_utils4();
|
20612 | var Reader = class {
|
20613 | constructor(_settings) {
|
20614 | this._settings = _settings;
|
20615 | this._fsStatSettings = new fsStat.Settings({
|
20616 | followSymbolicLink: this._settings.followSymbolicLinks,
|
20617 | fs: this._settings.fs,
|
20618 | throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
20619 | });
|
20620 | }
|
20621 | _getFullEntryPath(filepath) {
|
20622 | return path.resolve(this._settings.cwd, filepath);
|
20623 | }
|
20624 | _makeEntry(stats, pattern) {
|
20625 | const entry = {
|
20626 | name: pattern,
|
20627 | path: pattern,
|
20628 | dirent: utils.fs.createDirentFromStats(pattern, stats)
|
20629 | };
|
20630 | if (this._settings.stats) {
|
20631 | entry.stats = stats;
|
20632 | }
|
20633 | return entry;
|
20634 | }
|
20635 | _isFatalError(error) {
|
20636 | return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
20637 | }
|
20638 | };
|
20639 | exports2.default = Reader;
|
20640 | }
|
20641 | });
|
20642 | var require_stream3 = __commonJS2({
|
20643 | "node_modules/fast-glob/out/readers/stream.js"(exports2) {
|
20644 | "use strict";
|
20645 | Object.defineProperty(exports2, "__esModule", {
|
20646 | value: true
|
20647 | });
|
20648 | var stream_1 = require("stream");
|
20649 | var fsStat = require_out();
|
20650 | var fsWalk = require_out3();
|
20651 | var reader_1 = require_reader2();
|
20652 | var ReaderStream = class extends reader_1.default {
|
20653 | constructor() {
|
20654 | super(...arguments);
|
20655 | this._walkStream = fsWalk.walkStream;
|
20656 | this._stat = fsStat.stat;
|
20657 | }
|
20658 | dynamic(root, options) {
|
20659 | return this._walkStream(root, options);
|
20660 | }
|
20661 | static(patterns, options) {
|
20662 | const filepaths = patterns.map(this._getFullEntryPath, this);
|
20663 | const stream = new stream_1.PassThrough({
|
20664 | objectMode: true
|
20665 | });
|
20666 | stream._write = (index, _enc, done) => {
|
20667 | return this._getEntry(filepaths[index], patterns[index], options).then((entry) => {
|
20668 | if (entry !== null && options.entryFilter(entry)) {
|
20669 | stream.push(entry);
|
20670 | }
|
20671 | if (index === filepaths.length - 1) {
|
20672 | stream.end();
|
20673 | }
|
20674 | done();
|
20675 | }).catch(done);
|
20676 | };
|
20677 | for (let i = 0; i < filepaths.length; i++) {
|
20678 | stream.write(i);
|
20679 | }
|
20680 | return stream;
|
20681 | }
|
20682 | _getEntry(filepath, pattern, options) {
|
20683 | return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
|
20684 | if (options.errorFilter(error)) {
|
20685 | return null;
|
20686 | }
|
20687 | throw error;
|
20688 | });
|
20689 | }
|
20690 | _getStat(filepath) {
|
20691 | return new Promise((resolve, reject) => {
|
20692 | this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
20693 | return error === null ? resolve(stats) : reject(error);
|
20694 | });
|
20695 | });
|
20696 | }
|
20697 | };
|
20698 | exports2.default = ReaderStream;
|
20699 | }
|
20700 | });
|
20701 | var require_matcher = __commonJS2({
|
20702 | "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports2) {
|
20703 | "use strict";
|
20704 | Object.defineProperty(exports2, "__esModule", {
|
20705 | value: true
|
20706 | });
|
20707 | var utils = require_utils4();
|
20708 | var Matcher = class {
|
20709 | constructor(_patterns, _settings, _micromatchOptions) {
|
20710 | this._patterns = _patterns;
|
20711 | this._settings = _settings;
|
20712 | this._micromatchOptions = _micromatchOptions;
|
20713 | this._storage = [];
|
20714 | this._fillStorage();
|
20715 | }
|
20716 | _fillStorage() {
|
20717 | const patterns = utils.pattern.expandPatternsWithBraceExpansion(this._patterns);
|
20718 | for (const pattern of patterns) {
|
20719 | const segments = this._getPatternSegments(pattern);
|
20720 | const sections = this._splitSegmentsIntoSections(segments);
|
20721 | this._storage.push({
|
20722 | complete: sections.length <= 1,
|
20723 | pattern,
|
20724 | segments,
|
20725 | sections
|
20726 | });
|
20727 | }
|
20728 | }
|
20729 | _getPatternSegments(pattern) {
|
20730 | const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
|
20731 | return parts.map((part) => {
|
20732 | const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
|
20733 | if (!dynamic) {
|
20734 | return {
|
20735 | dynamic: false,
|
20736 | pattern: part
|
20737 | };
|
20738 | }
|
20739 | return {
|
20740 | dynamic: true,
|
20741 | pattern: part,
|
20742 | patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
|
20743 | };
|
20744 | });
|
20745 | }
|
20746 | _splitSegmentsIntoSections(segments) {
|
20747 | return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
|
20748 | }
|
20749 | };
|
20750 | exports2.default = Matcher;
|
20751 | }
|
20752 | });
|
20753 | var require_partial = __commonJS2({
|
20754 | "node_modules/fast-glob/out/providers/matchers/partial.js"(exports2) {
|
20755 | "use strict";
|
20756 | Object.defineProperty(exports2, "__esModule", {
|
20757 | value: true
|
20758 | });
|
20759 | var matcher_1 = require_matcher();
|
20760 | var PartialMatcher = class extends matcher_1.default {
|
20761 | match(filepath) {
|
20762 | const parts = filepath.split("/");
|
20763 | const levels = parts.length;
|
20764 | const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
20765 | for (const pattern of patterns) {
|
20766 | const section = pattern.sections[0];
|
20767 | if (!pattern.complete && levels > section.length) {
|
20768 | return true;
|
20769 | }
|
20770 | const match = parts.every((part, index) => {
|
20771 | const segment = pattern.segments[index];
|
20772 | if (segment.dynamic && segment.patternRe.test(part)) {
|
20773 | return true;
|
20774 | }
|
20775 | if (!segment.dynamic && segment.pattern === part) {
|
20776 | return true;
|
20777 | }
|
20778 | return false;
|
20779 | });
|
20780 | if (match) {
|
20781 | return true;
|
20782 | }
|
20783 | }
|
20784 | return false;
|
20785 | }
|
20786 | };
|
20787 | exports2.default = PartialMatcher;
|
20788 | }
|
20789 | });
|
20790 | var require_deep = __commonJS2({
|
20791 | "node_modules/fast-glob/out/providers/filters/deep.js"(exports2) {
|
20792 | "use strict";
|
20793 | Object.defineProperty(exports2, "__esModule", {
|
20794 | value: true
|
20795 | });
|
20796 | var utils = require_utils4();
|
20797 | var partial_1 = require_partial();
|
20798 | var DeepFilter = class {
|
20799 | constructor(_settings, _micromatchOptions) {
|
20800 | this._settings = _settings;
|
20801 | this._micromatchOptions = _micromatchOptions;
|
20802 | }
|
20803 | getFilter(basePath, positive, negative) {
|
20804 | const matcher = this._getMatcher(positive);
|
20805 | const negativeRe = this._getNegativePatternsRe(negative);
|
20806 | return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
20807 | }
|
20808 | _getMatcher(patterns) {
|
20809 | return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
20810 | }
|
20811 | _getNegativePatternsRe(patterns) {
|
20812 | const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
|
20813 | return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
20814 | }
|
20815 | _filter(basePath, entry, matcher, negativeRe) {
|
20816 | if (this._isSkippedByDeep(basePath, entry.path)) {
|
20817 | return false;
|
20818 | }
|
20819 | if (this._isSkippedSymbolicLink(entry)) {
|
20820 | return false;
|
20821 | }
|
20822 | const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
20823 | if (this._isSkippedByPositivePatterns(filepath, matcher)) {
|
20824 | return false;
|
20825 | }
|
20826 | return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
20827 | }
|
20828 | _isSkippedByDeep(basePath, entryPath) {
|
20829 | if (this._settings.deep === Infinity) {
|
20830 | return false;
|
20831 | }
|
20832 | return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
20833 | }
|
20834 | _getEntryLevel(basePath, entryPath) {
|
20835 | const entryPathDepth = entryPath.split("/").length;
|
20836 | if (basePath === "") {
|
20837 | return entryPathDepth;
|
20838 | }
|
20839 | const basePathDepth = basePath.split("/").length;
|
20840 | return entryPathDepth - basePathDepth;
|
20841 | }
|
20842 | _isSkippedSymbolicLink(entry) {
|
20843 | return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
20844 | }
|
20845 | _isSkippedByPositivePatterns(entryPath, matcher) {
|
20846 | return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
20847 | }
|
20848 | _isSkippedByNegativePatterns(entryPath, patternsRe) {
|
20849 | return !utils.pattern.matchAny(entryPath, patternsRe);
|
20850 | }
|
20851 | };
|
20852 | exports2.default = DeepFilter;
|
20853 | }
|
20854 | });
|
20855 | var require_entry = __commonJS2({
|
20856 | "node_modules/fast-glob/out/providers/filters/entry.js"(exports2) {
|
20857 | "use strict";
|
20858 | Object.defineProperty(exports2, "__esModule", {
|
20859 | value: true
|
20860 | });
|
20861 | var utils = require_utils4();
|
20862 | var EntryFilter = class {
|
20863 | constructor(_settings, _micromatchOptions) {
|
20864 | this._settings = _settings;
|
20865 | this._micromatchOptions = _micromatchOptions;
|
20866 | this.index = new Map();
|
20867 | }
|
20868 | getFilter(positive, negative) {
|
20869 | const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
|
20870 | const negativeRe = utils.pattern.convertPatternsToRe(negative, this._micromatchOptions);
|
20871 | return (entry) => this._filter(entry, positiveRe, negativeRe);
|
20872 | }
|
20873 | _filter(entry, positiveRe, negativeRe) {
|
20874 | if (this._settings.unique && this._isDuplicateEntry(entry)) {
|
20875 | return false;
|
20876 | }
|
20877 | if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
20878 | return false;
|
20879 | }
|
20880 | if (this._isSkippedByAbsoluteNegativePatterns(entry.path, negativeRe)) {
|
20881 | return false;
|
20882 | }
|
20883 | const filepath = this._settings.baseNameMatch ? entry.name : entry.path;
|
20884 | const isMatched = this._isMatchToPatterns(filepath, positiveRe) && !this._isMatchToPatterns(entry.path, negativeRe);
|
20885 | if (this._settings.unique && isMatched) {
|
20886 | this._createIndexRecord(entry);
|
20887 | }
|
20888 | return isMatched;
|
20889 | }
|
20890 | _isDuplicateEntry(entry) {
|
20891 | return this.index.has(entry.path);
|
20892 | }
|
20893 | _createIndexRecord(entry) {
|
20894 | this.index.set(entry.path, void 0);
|
20895 | }
|
20896 | _onlyFileFilter(entry) {
|
20897 | return this._settings.onlyFiles && !entry.dirent.isFile();
|
20898 | }
|
20899 | _onlyDirectoryFilter(entry) {
|
20900 | return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
20901 | }
|
20902 | _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
|
20903 | if (!this._settings.absolute) {
|
20904 | return false;
|
20905 | }
|
20906 | const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
|
20907 | return utils.pattern.matchAny(fullpath, patternsRe);
|
20908 | }
|
20909 | _isMatchToPatterns(entryPath, patternsRe) {
|
20910 | const filepath = utils.path.removeLeadingDotSegment(entryPath);
|
20911 | return utils.pattern.matchAny(filepath, patternsRe) || utils.pattern.matchAny(filepath + "/", patternsRe);
|
20912 | }
|
20913 | };
|
20914 | exports2.default = EntryFilter;
|
20915 | }
|
20916 | });
|
20917 | var require_error = __commonJS2({
|
20918 | "node_modules/fast-glob/out/providers/filters/error.js"(exports2) {
|
20919 | "use strict";
|
20920 | Object.defineProperty(exports2, "__esModule", {
|
20921 | value: true
|
20922 | });
|
20923 | var utils = require_utils4();
|
20924 | var ErrorFilter = class {
|
20925 | constructor(_settings) {
|
20926 | this._settings = _settings;
|
20927 | }
|
20928 | getFilter() {
|
20929 | return (error) => this._isNonFatalError(error);
|
20930 | }
|
20931 | _isNonFatalError(error) {
|
20932 | return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
20933 | }
|
20934 | };
|
20935 | exports2.default = ErrorFilter;
|
20936 | }
|
20937 | });
|
20938 | var require_entry2 = __commonJS2({
|
20939 | "node_modules/fast-glob/out/providers/transformers/entry.js"(exports2) {
|
20940 | "use strict";
|
20941 | Object.defineProperty(exports2, "__esModule", {
|
20942 | value: true
|
20943 | });
|
20944 | var utils = require_utils4();
|
20945 | var EntryTransformer = class {
|
20946 | constructor(_settings) {
|
20947 | this._settings = _settings;
|
20948 | }
|
20949 | getTransformer() {
|
20950 | return (entry) => this._transform(entry);
|
20951 | }
|
20952 | _transform(entry) {
|
20953 | let filepath = entry.path;
|
20954 | if (this._settings.absolute) {
|
20955 | filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
20956 | filepath = utils.path.unixify(filepath);
|
20957 | }
|
20958 | if (this._settings.markDirectories && entry.dirent.isDirectory()) {
|
20959 | filepath += "/";
|
20960 | }
|
20961 | if (!this._settings.objectMode) {
|
20962 | return filepath;
|
20963 | }
|
20964 | return Object.assign(Object.assign({}, entry), {
|
20965 | path: filepath
|
20966 | });
|
20967 | }
|
20968 | };
|
20969 | exports2.default = EntryTransformer;
|
20970 | }
|
20971 | });
|
20972 | var require_provider = __commonJS2({
|
20973 | "node_modules/fast-glob/out/providers/provider.js"(exports2) {
|
20974 | "use strict";
|
20975 | Object.defineProperty(exports2, "__esModule", {
|
20976 | value: true
|
20977 | });
|
20978 | var path = require("path");
|
20979 | var deep_1 = require_deep();
|
20980 | var entry_1 = require_entry();
|
20981 | var error_1 = require_error();
|
20982 | var entry_2 = require_entry2();
|
20983 | var Provider = class {
|
20984 | constructor(_settings) {
|
20985 | this._settings = _settings;
|
20986 | this.errorFilter = new error_1.default(this._settings);
|
20987 | this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
20988 | this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
20989 | this.entryTransformer = new entry_2.default(this._settings);
|
20990 | }
|
20991 | _getRootDirectory(task) {
|
20992 | return path.resolve(this._settings.cwd, task.base);
|
20993 | }
|
20994 | _getReaderOptions(task) {
|
20995 | const basePath = task.base === "." ? "" : task.base;
|
20996 | return {
|
20997 | basePath,
|
20998 | pathSegmentSeparator: "/",
|
20999 | concurrency: this._settings.concurrency,
|
21000 | deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
21001 | entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
21002 | errorFilter: this.errorFilter.getFilter(),
|
21003 | followSymbolicLinks: this._settings.followSymbolicLinks,
|
21004 | fs: this._settings.fs,
|
21005 | stats: this._settings.stats,
|
21006 | throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
21007 | transform: this.entryTransformer.getTransformer()
|
21008 | };
|
21009 | }
|
21010 | _getMicromatchOptions() {
|
21011 | return {
|
21012 | dot: this._settings.dot,
|
21013 | matchBase: this._settings.baseNameMatch,
|
21014 | nobrace: !this._settings.braceExpansion,
|
21015 | nocase: !this._settings.caseSensitiveMatch,
|
21016 | noext: !this._settings.extglob,
|
21017 | noglobstar: !this._settings.globstar,
|
21018 | posix: true,
|
21019 | strictSlashes: false
|
21020 | };
|
21021 | }
|
21022 | };
|
21023 | exports2.default = Provider;
|
21024 | }
|
21025 | });
|
21026 | var require_async6 = __commonJS2({
|
21027 | "node_modules/fast-glob/out/providers/async.js"(exports2) {
|
21028 | "use strict";
|
21029 | Object.defineProperty(exports2, "__esModule", {
|
21030 | value: true
|
21031 | });
|
21032 | var stream_1 = require_stream3();
|
21033 | var provider_1 = require_provider();
|
21034 | var ProviderAsync = class extends provider_1.default {
|
21035 | constructor() {
|
21036 | super(...arguments);
|
21037 | this._reader = new stream_1.default(this._settings);
|
21038 | }
|
21039 | read(task) {
|
21040 | const root = this._getRootDirectory(task);
|
21041 | const options = this._getReaderOptions(task);
|
21042 | const entries = [];
|
21043 | return new Promise((resolve, reject) => {
|
21044 | const stream = this.api(root, task, options);
|
21045 | stream.once("error", reject);
|
21046 | stream.on("data", (entry) => entries.push(options.transform(entry)));
|
21047 | stream.once("end", () => resolve(entries));
|
21048 | });
|
21049 | }
|
21050 | api(root, task, options) {
|
21051 | if (task.dynamic) {
|
21052 | return this._reader.dynamic(root, options);
|
21053 | }
|
21054 | return this._reader.static(task.patterns, options);
|
21055 | }
|
21056 | };
|
21057 | exports2.default = ProviderAsync;
|
21058 | }
|
21059 | });
|
21060 | var require_stream4 = __commonJS2({
|
21061 | "node_modules/fast-glob/out/providers/stream.js"(exports2) {
|
21062 | "use strict";
|
21063 | Object.defineProperty(exports2, "__esModule", {
|
21064 | value: true
|
21065 | });
|
21066 | var stream_1 = require("stream");
|
21067 | var stream_2 = require_stream3();
|
21068 | var provider_1 = require_provider();
|
21069 | var ProviderStream = class extends provider_1.default {
|
21070 | constructor() {
|
21071 | super(...arguments);
|
21072 | this._reader = new stream_2.default(this._settings);
|
21073 | }
|
21074 | read(task) {
|
21075 | const root = this._getRootDirectory(task);
|
21076 | const options = this._getReaderOptions(task);
|
21077 | const source = this.api(root, task, options);
|
21078 | const destination = new stream_1.Readable({
|
21079 | objectMode: true,
|
21080 | read: () => {
|
21081 | }
|
21082 | });
|
21083 | source.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options.transform(entry))).once("end", () => destination.emit("end"));
|
21084 | destination.once("close", () => source.destroy());
|
21085 | return destination;
|
21086 | }
|
21087 | api(root, task, options) {
|
21088 | if (task.dynamic) {
|
21089 | return this._reader.dynamic(root, options);
|
21090 | }
|
21091 | return this._reader.static(task.patterns, options);
|
21092 | }
|
21093 | };
|
21094 | exports2.default = ProviderStream;
|
21095 | }
|
21096 | });
|
21097 | var require_sync6 = __commonJS2({
|
21098 | "node_modules/fast-glob/out/readers/sync.js"(exports2) {
|
21099 | "use strict";
|
21100 | Object.defineProperty(exports2, "__esModule", {
|
21101 | value: true
|
21102 | });
|
21103 | var fsStat = require_out();
|
21104 | var fsWalk = require_out3();
|
21105 | var reader_1 = require_reader2();
|
21106 | var ReaderSync = class extends reader_1.default {
|
21107 | constructor() {
|
21108 | super(...arguments);
|
21109 | this._walkSync = fsWalk.walkSync;
|
21110 | this._statSync = fsStat.statSync;
|
21111 | }
|
21112 | dynamic(root, options) {
|
21113 | return this._walkSync(root, options);
|
21114 | }
|
21115 | static(patterns, options) {
|
21116 | const entries = [];
|
21117 | for (const pattern of patterns) {
|
21118 | const filepath = this._getFullEntryPath(pattern);
|
21119 | const entry = this._getEntry(filepath, pattern, options);
|
21120 | if (entry === null || !options.entryFilter(entry)) {
|
21121 | continue;
|
21122 | }
|
21123 | entries.push(entry);
|
21124 | }
|
21125 | return entries;
|
21126 | }
|
21127 | _getEntry(filepath, pattern, options) {
|
21128 | try {
|
21129 | const stats = this._getStat(filepath);
|
21130 | return this._makeEntry(stats, pattern);
|
21131 | } catch (error) {
|
21132 | if (options.errorFilter(error)) {
|
21133 | return null;
|
21134 | }
|
21135 | throw error;
|
21136 | }
|
21137 | }
|
21138 | _getStat(filepath) {
|
21139 | return this._statSync(filepath, this._fsStatSettings);
|
21140 | }
|
21141 | };
|
21142 | exports2.default = ReaderSync;
|
21143 | }
|
21144 | });
|
21145 | var require_sync7 = __commonJS2({
|
21146 | "node_modules/fast-glob/out/providers/sync.js"(exports2) {
|
21147 | "use strict";
|
21148 | Object.defineProperty(exports2, "__esModule", {
|
21149 | value: true
|
21150 | });
|
21151 | var sync_1 = require_sync6();
|
21152 | var provider_1 = require_provider();
|
21153 | var ProviderSync = class extends provider_1.default {
|
21154 | constructor() {
|
21155 | super(...arguments);
|
21156 | this._reader = new sync_1.default(this._settings);
|
21157 | }
|
21158 | read(task) {
|
21159 | const root = this._getRootDirectory(task);
|
21160 | const options = this._getReaderOptions(task);
|
21161 | const entries = this.api(root, task, options);
|
21162 | return entries.map(options.transform);
|
21163 | }
|
21164 | api(root, task, options) {
|
21165 | if (task.dynamic) {
|
21166 | return this._reader.dynamic(root, options);
|
21167 | }
|
21168 | return this._reader.static(task.patterns, options);
|
21169 | }
|
21170 | };
|
21171 | exports2.default = ProviderSync;
|
21172 | }
|
21173 | });
|
21174 | var require_settings4 = __commonJS2({
|
21175 | "node_modules/fast-glob/out/settings.js"(exports2) {
|
21176 | "use strict";
|
21177 | Object.defineProperty(exports2, "__esModule", {
|
21178 | value: true
|
21179 | });
|
21180 | exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
21181 | var fs = require("fs");
|
21182 | var os = require("os");
|
21183 | var CPU_COUNT = Math.max(os.cpus().length, 1);
|
21184 | exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
21185 | lstat: fs.lstat,
|
21186 | lstatSync: fs.lstatSync,
|
21187 | stat: fs.stat,
|
21188 | statSync: fs.statSync,
|
21189 | readdir: fs.readdir,
|
21190 | readdirSync: fs.readdirSync
|
21191 | };
|
21192 | var Settings = class {
|
21193 | constructor(_options = {}) {
|
21194 | this._options = _options;
|
21195 | this.absolute = this._getValue(this._options.absolute, false);
|
21196 | this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
21197 | this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
21198 | this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
21199 | this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
21200 | this.cwd = this._getValue(this._options.cwd, process.cwd());
|
21201 | this.deep = this._getValue(this._options.deep, Infinity);
|
21202 | this.dot = this._getValue(this._options.dot, false);
|
21203 | this.extglob = this._getValue(this._options.extglob, true);
|
21204 | this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
21205 | this.fs = this._getFileSystemMethods(this._options.fs);
|
21206 | this.globstar = this._getValue(this._options.globstar, true);
|
21207 | this.ignore = this._getValue(this._options.ignore, []);
|
21208 | this.markDirectories = this._getValue(this._options.markDirectories, false);
|
21209 | this.objectMode = this._getValue(this._options.objectMode, false);
|
21210 | this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
21211 | this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
21212 | this.stats = this._getValue(this._options.stats, false);
|
21213 | this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
21214 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
21215 | this.unique = this._getValue(this._options.unique, true);
|
21216 | if (this.onlyDirectories) {
|
21217 | this.onlyFiles = false;
|
21218 | }
|
21219 | if (this.stats) {
|
21220 | this.objectMode = true;
|
21221 | }
|
21222 | }
|
21223 | _getValue(option, value) {
|
21224 | return option === void 0 ? value : option;
|
21225 | }
|
21226 | _getFileSystemMethods(methods = {}) {
|
21227 | return Object.assign(Object.assign({}, exports2.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
21228 | }
|
21229 | };
|
21230 | exports2.default = Settings;
|
21231 | }
|
21232 | });
|
21233 | var require_out4 = __commonJS2({
|
21234 | "node_modules/fast-glob/out/index.js"(exports2, module2) {
|
21235 | "use strict";
|
21236 | var taskManager = require_tasks();
|
21237 | var patternManager = require_patterns();
|
21238 | var async_1 = require_async6();
|
21239 | var stream_1 = require_stream4();
|
21240 | var sync_1 = require_sync7();
|
21241 | var settings_1 = require_settings4();
|
21242 | var utils = require_utils4();
|
21243 | async function FastGlob(source, options) {
|
21244 | assertPatternsInput(source);
|
21245 | const works = getWorks(source, async_1.default, options);
|
21246 | const result = await Promise.all(works);
|
21247 | return utils.array.flatten(result);
|
21248 | }
|
21249 | (function(FastGlob2) {
|
21250 | function sync(source, options) {
|
21251 | assertPatternsInput(source);
|
21252 | const works = getWorks(source, sync_1.default, options);
|
21253 | return utils.array.flatten(works);
|
21254 | }
|
21255 | FastGlob2.sync = sync;
|
21256 | function stream(source, options) {
|
21257 | assertPatternsInput(source);
|
21258 | const works = getWorks(source, stream_1.default, options);
|
21259 | return utils.stream.merge(works);
|
21260 | }
|
21261 | FastGlob2.stream = stream;
|
21262 | function generateTasks(source, options) {
|
21263 | assertPatternsInput(source);
|
21264 | const patterns = patternManager.transform([].concat(source));
|
21265 | const settings = new settings_1.default(options);
|
21266 | return taskManager.generate(patterns, settings);
|
21267 | }
|
21268 | FastGlob2.generateTasks = generateTasks;
|
21269 | function isDynamicPattern(source, options) {
|
21270 | assertPatternsInput(source);
|
21271 | const settings = new settings_1.default(options);
|
21272 | return utils.pattern.isDynamicPattern(source, settings);
|
21273 | }
|
21274 | FastGlob2.isDynamicPattern = isDynamicPattern;
|
21275 | function escapePath(source) {
|
21276 | assertPatternsInput(source);
|
21277 | return utils.path.escape(source);
|
21278 | }
|
21279 | FastGlob2.escapePath = escapePath;
|
21280 | })(FastGlob || (FastGlob = {}));
|
21281 | function getWorks(source, _Provider, options) {
|
21282 | const patterns = patternManager.transform([].concat(source));
|
21283 | const settings = new settings_1.default(options);
|
21284 | const tasks = taskManager.generate(patterns, settings);
|
21285 | const provider = new _Provider(settings);
|
21286 | return tasks.map(provider.read, provider);
|
21287 | }
|
21288 | function assertPatternsInput(input) {
|
21289 | const source = [].concat(input);
|
21290 | const isValidSource = source.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
|
21291 | if (!isValidSource) {
|
21292 | throw new TypeError("Patterns must be a string (non empty) or an array of strings");
|
21293 | }
|
21294 | }
|
21295 | module2.exports = FastGlob;
|
21296 | }
|
21297 | });
|
21298 | var require_uniq_by_key = __commonJS2({
|
21299 | "src/utils/uniq-by-key.js"(exports2, module2) {
|
21300 | "use strict";
|
21301 | function uniqByKey(array, key) {
|
21302 | const result = [];
|
21303 | const seen = new Set();
|
21304 | for (const element of array) {
|
21305 | const value = element[key];
|
21306 | if (!seen.has(value)) {
|
21307 | seen.add(value);
|
21308 | result.push(element);
|
21309 | }
|
21310 | }
|
21311 | return result;
|
21312 | }
|
21313 | module2.exports = uniqByKey;
|
21314 | }
|
21315 | });
|
21316 | var require_create_language = __commonJS2({
|
21317 | "src/utils/create-language.js"(exports2, module2) {
|
21318 | "use strict";
|
21319 | module2.exports = function(linguistData, override) {
|
21320 | const {
|
21321 | languageId
|
21322 | } = linguistData, rest = _objectWithoutProperties(linguistData, _excluded4);
|
21323 | return Object.assign(Object.assign({
|
21324 | linguistLanguageId: languageId
|
21325 | }, rest), override(linguistData));
|
21326 | };
|
21327 | }
|
21328 | });
|
21329 | var require_ast = __commonJS2({
|
21330 | "node_modules/esutils/lib/ast.js"(exports2, module2) {
|
21331 | (function() {
|
21332 | "use strict";
|
21333 | function isExpression(node) {
|
21334 | if (node == null) {
|
21335 | return false;
|
21336 | }
|
21337 | switch (node.type) {
|
21338 | case "ArrayExpression":
|
21339 | case "AssignmentExpression":
|
21340 | case "BinaryExpression":
|
21341 | case "CallExpression":
|
21342 | case "ConditionalExpression":
|
21343 | case "FunctionExpression":
|
21344 | case "Identifier":
|
21345 | case "Literal":
|
21346 | case "LogicalExpression":
|
21347 | case "MemberExpression":
|
21348 | case "NewExpression":
|
21349 | case "ObjectExpression":
|
21350 | case "SequenceExpression":
|
21351 | case "ThisExpression":
|
21352 | case "UnaryExpression":
|
21353 | case "UpdateExpression":
|
21354 | return true;
|
21355 | }
|
21356 | return false;
|
21357 | }
|
21358 | function isIterationStatement(node) {
|
21359 | if (node == null) {
|
21360 | return false;
|
21361 | }
|
21362 | switch (node.type) {
|
21363 | case "DoWhileStatement":
|
21364 | case "ForInStatement":
|
21365 | case "ForStatement":
|
21366 | case "WhileStatement":
|
21367 | return true;
|
21368 | }
|
21369 | return false;
|
21370 | }
|
21371 | function isStatement(node) {
|
21372 | if (node == null) {
|
21373 | return false;
|
21374 | }
|
21375 | switch (node.type) {
|
21376 | case "BlockStatement":
|
21377 | case "BreakStatement":
|
21378 | case "ContinueStatement":
|
21379 | case "DebuggerStatement":
|
21380 | case "DoWhileStatement":
|
21381 | case "EmptyStatement":
|
21382 | case "ExpressionStatement":
|
21383 | case "ForInStatement":
|
21384 | case "ForStatement":
|
21385 | case "IfStatement":
|
21386 | case "LabeledStatement":
|
21387 | case "ReturnStatement":
|
21388 | case "SwitchStatement":
|
21389 | case "ThrowStatement":
|
21390 | case "TryStatement":
|
21391 | case "VariableDeclaration":
|
21392 | case "WhileStatement":
|
21393 | case "WithStatement":
|
21394 | return true;
|
21395 | }
|
21396 | return false;
|
21397 | }
|
21398 | function isSourceElement(node) {
|
21399 | return isStatement(node) || node != null && node.type === "FunctionDeclaration";
|
21400 | }
|
21401 | function trailingStatement(node) {
|
21402 | switch (node.type) {
|
21403 | case "IfStatement":
|
21404 | if (node.alternate != null) {
|
21405 | return node.alternate;
|
21406 | }
|
21407 | return node.consequent;
|
21408 | case "LabeledStatement":
|
21409 | case "ForStatement":
|
21410 | case "ForInStatement":
|
21411 | case "WhileStatement":
|
21412 | case "WithStatement":
|
21413 | return node.body;
|
21414 | }
|
21415 | return null;
|
21416 | }
|
21417 | function isProblematicIfStatement(node) {
|
21418 | var current;
|
21419 | if (node.type !== "IfStatement") {
|
21420 | return false;
|
21421 | }
|
21422 | if (node.alternate == null) {
|
21423 | return false;
|
21424 | }
|
21425 | current = node.consequent;
|
21426 | do {
|
21427 | if (current.type === "IfStatement") {
|
21428 | if (current.alternate == null) {
|
21429 | return true;
|
21430 | }
|
21431 | }
|
21432 | current = trailingStatement(current);
|
21433 | } while (current);
|
21434 | return false;
|
21435 | }
|
21436 | module2.exports = {
|
21437 | isExpression,
|
21438 | isStatement,
|
21439 | isIterationStatement,
|
21440 | isSourceElement,
|
21441 | isProblematicIfStatement,
|
21442 | trailingStatement
|
21443 | };
|
21444 | })();
|
21445 | }
|
21446 | });
|
21447 | var require_code = __commonJS2({
|
21448 | "node_modules/esutils/lib/code.js"(exports2, module2) {
|
21449 | (function() {
|
21450 | "use strict";
|
21451 | var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
|
21452 | ES5Regex = {
|
21453 | NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
21454 | NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
|
21455 | };
|
21456 | ES6Regex = {
|
21457 | NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
|
21458 | NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
|
21459 | };
|
21460 | function isDecimalDigit(ch2) {
|
21461 | return 48 <= ch2 && ch2 <= 57;
|
21462 | }
|
21463 | function isHexDigit(ch2) {
|
21464 | return 48 <= ch2 && ch2 <= 57 || 97 <= ch2 && ch2 <= 102 || 65 <= ch2 && ch2 <= 70;
|
21465 | }
|
21466 | function isOctalDigit(ch2) {
|
21467 | return ch2 >= 48 && ch2 <= 55;
|
21468 | }
|
21469 | NON_ASCII_WHITESPACES = [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279];
|
21470 | function isWhiteSpace(ch2) {
|
21471 | return ch2 === 32 || ch2 === 9 || ch2 === 11 || ch2 === 12 || ch2 === 160 || ch2 >= 5760 && NON_ASCII_WHITESPACES.indexOf(ch2) >= 0;
|
21472 | }
|
21473 | function isLineTerminator(ch2) {
|
21474 | return ch2 === 10 || ch2 === 13 || ch2 === 8232 || ch2 === 8233;
|
21475 | }
|
21476 | function fromCodePoint(cp) {
|
21477 | if (cp <= 65535) {
|
21478 | return String.fromCharCode(cp);
|
21479 | }
|
21480 | var cu1 = String.fromCharCode(Math.floor((cp - 65536) / 1024) + 55296);
|
21481 | var cu2 = String.fromCharCode((cp - 65536) % 1024 + 56320);
|
21482 | return cu1 + cu2;
|
21483 | }
|
21484 | IDENTIFIER_START = new Array(128);
|
21485 | for (ch = 0; ch < 128; ++ch) {
|
21486 | IDENTIFIER_START[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch === 36 || ch === 95;
|
21487 | }
|
21488 | IDENTIFIER_PART = new Array(128);
|
21489 | for (ch = 0; ch < 128; ++ch) {
|
21490 | IDENTIFIER_PART[ch] = ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57 || ch === 36 || ch === 95;
|
21491 | }
|
21492 | function isIdentifierStartES5(ch2) {
|
21493 | return ch2 < 128 ? IDENTIFIER_START[ch2] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
|
21494 | }
|
21495 | function isIdentifierPartES5(ch2) {
|
21496 | return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
|
21497 | }
|
21498 | function isIdentifierStartES6(ch2) {
|
21499 | return ch2 < 128 ? IDENTIFIER_START[ch2] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch2));
|
21500 | }
|
21501 | function isIdentifierPartES6(ch2) {
|
21502 | return ch2 < 128 ? IDENTIFIER_PART[ch2] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch2));
|
21503 | }
|
21504 | module2.exports = {
|
21505 | isDecimalDigit,
|
21506 | isHexDigit,
|
21507 | isOctalDigit,
|
21508 | isWhiteSpace,
|
21509 | isLineTerminator,
|
21510 | isIdentifierStartES5,
|
21511 | isIdentifierPartES5,
|
21512 | isIdentifierStartES6,
|
21513 | isIdentifierPartES6
|
21514 | };
|
21515 | })();
|
21516 | }
|
21517 | });
|
21518 | var require_keyword2 = __commonJS2({
|
21519 | "node_modules/esutils/lib/keyword.js"(exports2, module2) {
|
21520 | (function() {
|
21521 | "use strict";
|
21522 | var code = require_code();
|
21523 | function isStrictModeReservedWordES6(id) {
|
21524 | switch (id) {
|
21525 | case "implements":
|
21526 | case "interface":
|
21527 | case "package":
|
21528 | case "private":
|
21529 | case "protected":
|
21530 | case "public":
|
21531 | case "static":
|
21532 | case "let":
|
21533 | return true;
|
21534 | default:
|
21535 | return false;
|
21536 | }
|
21537 | }
|
21538 | function isKeywordES5(id, strict) {
|
21539 | if (!strict && id === "yield") {
|
21540 | return false;
|
21541 | }
|
21542 | return isKeywordES6(id, strict);
|
21543 | }
|
21544 | function isKeywordES6(id, strict) {
|
21545 | if (strict && isStrictModeReservedWordES6(id)) {
|
21546 | return true;
|
21547 | }
|
21548 | switch (id.length) {
|
21549 | case 2:
|
21550 | return id === "if" || id === "in" || id === "do";
|
21551 | case 3:
|
21552 | return id === "var" || id === "for" || id === "new" || id === "try";
|
21553 | case 4:
|
21554 | return id === "this" || id === "else" || id === "case" || id === "void" || id === "with" || id === "enum";
|
21555 | case 5:
|
21556 | return id === "while" || id === "break" || id === "catch" || id === "throw" || id === "const" || id === "yield" || id === "class" || id === "super";
|
21557 | case 6:
|
21558 | return id === "return" || id === "typeof" || id === "delete" || id === "switch" || id === "export" || id === "import";
|
21559 | case 7:
|
21560 | return id === "default" || id === "finally" || id === "extends";
|
21561 | case 8:
|
21562 | return id === "function" || id === "continue" || id === "debugger";
|
21563 | case 10:
|
21564 | return id === "instanceof";
|
21565 | default:
|
21566 | return false;
|
21567 | }
|
21568 | }
|
21569 | function isReservedWordES5(id, strict) {
|
21570 | return id === "null" || id === "true" || id === "false" || isKeywordES5(id, strict);
|
21571 | }
|
21572 | function isReservedWordES6(id, strict) {
|
21573 | return id === "null" || id === "true" || id === "false" || isKeywordES6(id, strict);
|
21574 | }
|
21575 | function isRestrictedWord(id) {
|
21576 | return id === "eval" || id === "arguments";
|
21577 | }
|
21578 | function isIdentifierNameES5(id) {
|
21579 | var i, iz, ch;
|
21580 | if (id.length === 0) {
|
21581 | return false;
|
21582 | }
|
21583 | ch = id.charCodeAt(0);
|
21584 | if (!code.isIdentifierStartES5(ch)) {
|
21585 | return false;
|
21586 | }
|
21587 | for (i = 1, iz = id.length; i < iz; ++i) {
|
21588 | ch = id.charCodeAt(i);
|
21589 | if (!code.isIdentifierPartES5(ch)) {
|
21590 | return false;
|
21591 | }
|
21592 | }
|
21593 | return true;
|
21594 | }
|
21595 | function decodeUtf16(lead, trail) {
|
21596 | return (lead - 55296) * 1024 + (trail - 56320) + 65536;
|
21597 | }
|
21598 | function isIdentifierNameES6(id) {
|
21599 | var i, iz, ch, lowCh, check;
|
21600 | if (id.length === 0) {
|
21601 | return false;
|
21602 | }
|
21603 | check = code.isIdentifierStartES6;
|
21604 | for (i = 0, iz = id.length; i < iz; ++i) {
|
21605 | ch = id.charCodeAt(i);
|
21606 | if (55296 <= ch && ch <= 56319) {
|
21607 | ++i;
|
21608 | if (i >= iz) {
|
21609 | return false;
|
21610 | }
|
21611 | lowCh = id.charCodeAt(i);
|
21612 | if (!(56320 <= lowCh && lowCh <= 57343)) {
|
21613 | return false;
|
21614 | }
|
21615 | ch = decodeUtf16(ch, lowCh);
|
21616 | }
|
21617 | if (!check(ch)) {
|
21618 | return false;
|
21619 | }
|
21620 | check = code.isIdentifierPartES6;
|
21621 | }
|
21622 | return true;
|
21623 | }
|
21624 | function isIdentifierES5(id, strict) {
|
21625 | return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
|
21626 | }
|
21627 | function isIdentifierES6(id, strict) {
|
21628 | return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
|
21629 | }
|
21630 | module2.exports = {
|
21631 | isKeywordES5,
|
21632 | isKeywordES6,
|
21633 | isReservedWordES5,
|
21634 | isReservedWordES6,
|
21635 | isRestrictedWord,
|
21636 | isIdentifierNameES5,
|
21637 | isIdentifierNameES6,
|
21638 | isIdentifierES5,
|
21639 | isIdentifierES6
|
21640 | };
|
21641 | })();
|
21642 | }
|
21643 | });
|
21644 | var require_utils6 = __commonJS2({
|
21645 | "node_modules/esutils/lib/utils.js"(exports2) {
|
21646 | (function() {
|
21647 | "use strict";
|
21648 | exports2.ast = require_ast();
|
21649 | exports2.code = require_code();
|
21650 | exports2.keyword = require_keyword2();
|
21651 | })();
|
21652 | }
|
21653 | });
|
21654 | var require_is_block_comment = __commonJS2({
|
21655 | "src/language-js/utils/is-block-comment.js"(exports2, module2) {
|
21656 | "use strict";
|
21657 | var BLOCK_COMMENT_TYPES = new Set(["Block", "CommentBlock", "MultiLine"]);
|
21658 | var isBlockComment = (comment) => BLOCK_COMMENT_TYPES.has(comment === null || comment === void 0 ? void 0 : comment.type);
|
21659 | module2.exports = isBlockComment;
|
21660 | }
|
21661 | });
|
21662 | var require_is_node_matches = __commonJS2({
|
21663 | "src/language-js/utils/is-node-matches.js"(exports2, module2) {
|
21664 | "use strict";
|
21665 | function isNodeMatchesNameOrPath(node, nameOrPath) {
|
21666 | const names = nameOrPath.split(".");
|
21667 | for (let index = names.length - 1; index >= 0; index--) {
|
21668 | const name = names[index];
|
21669 | if (index === 0) {
|
21670 | return node.type === "Identifier" && node.name === name;
|
21671 | }
|
21672 | if (node.type !== "MemberExpression" || node.optional || node.computed || node.property.type !== "Identifier" || node.property.name !== name) {
|
21673 | return false;
|
21674 | }
|
21675 | node = node.object;
|
21676 | }
|
21677 | }
|
21678 | function isNodeMatches(node, nameOrPaths) {
|
21679 | return nameOrPaths.some((nameOrPath) => isNodeMatchesNameOrPath(node, nameOrPath));
|
21680 | }
|
21681 | module2.exports = isNodeMatches;
|
21682 | }
|
21683 | });
|
21684 | var require_utils7 = __commonJS2({
|
21685 | "src/language-js/utils/index.js"(exports2, module2) {
|
21686 | "use strict";
|
21687 | var isIdentifierName = require_utils6().keyword.isIdentifierNameES5;
|
21688 | var {
|
21689 | getLast,
|
21690 | hasNewline,
|
21691 | skipWhitespace,
|
21692 | isNonEmptyArray,
|
21693 | isNextLineEmptyAfterIndex,
|
21694 | getStringWidth
|
21695 | } = require_util();
|
21696 | var {
|
21697 | locStart,
|
21698 | locEnd,
|
21699 | hasSameLocStart
|
21700 | } = require_loc();
|
21701 | var isBlockComment = require_is_block_comment();
|
21702 | var isNodeMatches = require_is_node_matches();
|
21703 | var NON_LINE_TERMINATING_WHITE_SPACE = "(?:(?=.)\\s)";
|
21704 | var FLOW_SHORTHAND_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*:`);
|
21705 | var FLOW_ANNOTATION = new RegExp(`^${NON_LINE_TERMINATING_WHITE_SPACE}*::`);
|
21706 | function hasFlowShorthandAnnotationComment(node) {
|
21707 | var _node$extra, _node$trailingComment;
|
21708 | return ((_node$extra = node.extra) === null || _node$extra === void 0 ? void 0 : _node$extra.parenthesized) && isBlockComment((_node$trailingComment = node.trailingComments) === null || _node$trailingComment === void 0 ? void 0 : _node$trailingComment[0]) && FLOW_SHORTHAND_ANNOTATION.test(node.trailingComments[0].value);
|
21709 | }
|
21710 | function hasFlowAnnotationComment(comments) {
|
21711 | const firstComment = comments === null || comments === void 0 ? void 0 : comments[0];
|
21712 | return isBlockComment(firstComment) && FLOW_ANNOTATION.test(firstComment.value);
|
21713 | }
|
21714 | function hasNode(node, fn) {
|
21715 | if (!node || typeof node !== "object") {
|
21716 | return false;
|
21717 | }
|
21718 | if (Array.isArray(node)) {
|
21719 | return node.some((value) => hasNode(value, fn));
|
21720 | }
|
21721 | const result = fn(node);
|
21722 | return typeof result === "boolean" ? result : Object.values(node).some((value) => hasNode(value, fn));
|
21723 | }
|
21724 | function hasNakedLeftSide(node) {
|
21725 | return node.type === "AssignmentExpression" || node.type === "BinaryExpression" || node.type === "LogicalExpression" || node.type === "NGPipeExpression" || node.type === "ConditionalExpression" || isCallExpression(node) || isMemberExpression(node) || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "BindExpression" || node.type === "UpdateExpression" && !node.prefix || isTSTypeExpression(node) || node.type === "TSNonNullExpression";
|
21726 | }
|
21727 | function getLeftSide(node) {
|
21728 | var _ref2, _ref3, _ref4, _ref5, _ref6, _node$left;
|
21729 | if (node.expressions) {
|
21730 | return node.expressions[0];
|
21731 | }
|
21732 | return (_ref2 = (_ref3 = (_ref4 = (_ref5 = (_ref6 = (_node$left = node.left) !== null && _node$left !== void 0 ? _node$left : node.test) !== null && _ref6 !== void 0 ? _ref6 : node.callee) !== null && _ref5 !== void 0 ? _ref5 : node.object) !== null && _ref4 !== void 0 ? _ref4 : node.tag) !== null && _ref3 !== void 0 ? _ref3 : node.argument) !== null && _ref2 !== void 0 ? _ref2 : node.expression;
|
21733 | }
|
21734 | function getLeftSidePathName(path, node) {
|
21735 | if (node.expressions) {
|
21736 | return ["expressions", 0];
|
21737 | }
|
21738 | if (node.left) {
|
21739 | return ["left"];
|
21740 | }
|
21741 | if (node.test) {
|
21742 | return ["test"];
|
21743 | }
|
21744 | if (node.object) {
|
21745 | return ["object"];
|
21746 | }
|
21747 | if (node.callee) {
|
21748 | return ["callee"];
|
21749 | }
|
21750 | if (node.tag) {
|
21751 | return ["tag"];
|
21752 | }
|
21753 | if (node.argument) {
|
21754 | return ["argument"];
|
21755 | }
|
21756 | if (node.expression) {
|
21757 | return ["expression"];
|
21758 | }
|
21759 | throw new Error("Unexpected node has no left side.");
|
21760 | }
|
21761 | function createTypeCheckFunction(types) {
|
21762 | types = new Set(types);
|
21763 | return (node) => types.has(node === null || node === void 0 ? void 0 : node.type);
|
21764 | }
|
21765 | var isLineComment = createTypeCheckFunction(["Line", "CommentLine", "SingleLine", "HashbangComment", "HTMLOpen", "HTMLClose"]);
|
21766 | var isExportDeclaration = createTypeCheckFunction(["ExportDefaultDeclaration", "ExportDefaultSpecifier", "DeclareExportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
|
21767 | function getParentExportDeclaration(path) {
|
21768 | const parentNode = path.getParentNode();
|
21769 | if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
|
21770 | return parentNode;
|
21771 | }
|
21772 | return null;
|
21773 | }
|
21774 | var isLiteral = createTypeCheckFunction(["BooleanLiteral", "DirectiveLiteral", "Literal", "NullLiteral", "NumericLiteral", "BigIntLiteral", "DecimalLiteral", "RegExpLiteral", "StringLiteral", "TemplateLiteral", "TSTypeLiteral", "JSXText"]);
|
21775 | function isNumericLiteral(node) {
|
21776 | return node.type === "NumericLiteral" || node.type === "Literal" && typeof node.value === "number";
|
21777 | }
|
21778 | function isSignedNumericLiteral(node) {
|
21779 | return node.type === "UnaryExpression" && (node.operator === "+" || node.operator === "-") && isNumericLiteral(node.argument);
|
21780 | }
|
21781 | function isStringLiteral(node) {
|
21782 | return node.type === "StringLiteral" || node.type === "Literal" && typeof node.value === "string";
|
21783 | }
|
21784 | var isObjectType = createTypeCheckFunction(["ObjectTypeAnnotation", "TSTypeLiteral", "TSMappedType"]);
|
21785 | var isFunctionOrArrowExpression = createTypeCheckFunction(["FunctionExpression", "ArrowFunctionExpression"]);
|
21786 | function isFunctionOrArrowExpressionWithBody(node) {
|
21787 | return node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement";
|
21788 | }
|
21789 | function isAngularTestWrapper(node) {
|
21790 | return isCallExpression(node) && node.callee.type === "Identifier" && ["async", "inject", "fakeAsync", "waitForAsync"].includes(node.callee.name);
|
21791 | }
|
21792 | var isJsxNode = createTypeCheckFunction(["JSXElement", "JSXFragment"]);
|
21793 | function isTheOnlyJsxElementInMarkdown(options, path) {
|
21794 | if (options.parentParser !== "markdown" && options.parentParser !== "mdx") {
|
21795 | return false;
|
21796 | }
|
21797 | const node = path.getNode();
|
21798 | if (!node.expression || !isJsxNode(node.expression)) {
|
21799 | return false;
|
21800 | }
|
21801 | const parent = path.getParentNode();
|
21802 | return parent.type === "Program" && parent.body.length === 1;
|
21803 | }
|
21804 | function isGetterOrSetter(node) {
|
21805 | return node.kind === "get" || node.kind === "set";
|
21806 | }
|
21807 | function isFunctionNotation(node) {
|
21808 | return isGetterOrSetter(node) || hasSameLocStart(node, node.value);
|
21809 | }
|
21810 | function isObjectTypePropertyAFunction(node) {
|
21811 | return (node.type === "ObjectTypeProperty" || node.type === "ObjectTypeInternalSlot") && node.value.type === "FunctionTypeAnnotation" && !node.static && !isFunctionNotation(node);
|
21812 | }
|
21813 | function isTypeAnnotationAFunction(node) {
|
21814 | return (node.type === "TypeAnnotation" || node.type === "TSTypeAnnotation") && node.typeAnnotation.type === "FunctionTypeAnnotation" && !node.static && !hasSameLocStart(node, node.typeAnnotation);
|
21815 | }
|
21816 | var isBinaryish = createTypeCheckFunction(["BinaryExpression", "LogicalExpression", "NGPipeExpression"]);
|
21817 | function isMemberish(node) {
|
21818 | return isMemberExpression(node) || node.type === "BindExpression" && Boolean(node.object);
|
21819 | }
|
21820 | var simpleTypeAnnotations = new Set(["AnyTypeAnnotation", "TSAnyKeyword", "NullLiteralTypeAnnotation", "TSNullKeyword", "ThisTypeAnnotation", "TSThisType", "NumberTypeAnnotation", "TSNumberKeyword", "VoidTypeAnnotation", "TSVoidKeyword", "BooleanTypeAnnotation", "TSBooleanKeyword", "BigIntTypeAnnotation", "TSBigIntKeyword", "SymbolTypeAnnotation", "TSSymbolKeyword", "StringTypeAnnotation", "TSStringKeyword", "BooleanLiteralTypeAnnotation", "StringLiteralTypeAnnotation", "BigIntLiteralTypeAnnotation", "NumberLiteralTypeAnnotation", "TSLiteralType", "TSTemplateLiteralType", "EmptyTypeAnnotation", "MixedTypeAnnotation", "TSNeverKeyword", "TSObjectKeyword", "TSUndefinedKeyword", "TSUnknownKeyword"]);
|
21821 | function isSimpleType(node) {
|
21822 | if (!node) {
|
21823 | return false;
|
21824 | }
|
21825 | if ((node.type === "GenericTypeAnnotation" || node.type === "TSTypeReference") && !node.typeParameters) {
|
21826 | return true;
|
21827 | }
|
21828 | if (simpleTypeAnnotations.has(node.type)) {
|
21829 | return true;
|
21830 | }
|
21831 | return false;
|
21832 | }
|
21833 | function isUnitTestSetUp(node) {
|
21834 | const unitTestSetUpRe = /^(?:before|after)(?:Each|All)$/;
|
21835 | return node.callee.type === "Identifier" && unitTestSetUpRe.test(node.callee.name) && node.arguments.length === 1;
|
21836 | }
|
21837 | var testCallCalleePatterns = ["it", "it.only", "it.skip", "describe", "describe.only", "describe.skip", "test", "test.only", "test.skip", "test.step", "test.describe", "test.describe.only", "test.describe.parallel", "test.describe.parallel.only", "test.describe.serial", "test.describe.serial.only", "skip", "xit", "xdescribe", "xtest", "fit", "fdescribe", "ftest"];
|
21838 | function isTestCallCallee(node) {
|
21839 | return isNodeMatches(node, testCallCalleePatterns);
|
21840 | }
|
21841 | function isTestCall(node, parent) {
|
21842 | if (node.type !== "CallExpression") {
|
21843 | return false;
|
21844 | }
|
21845 | if (node.arguments.length === 1) {
|
21846 | if (isAngularTestWrapper(node) && parent && isTestCall(parent)) {
|
21847 | return isFunctionOrArrowExpression(node.arguments[0]);
|
21848 | }
|
21849 | if (isUnitTestSetUp(node)) {
|
21850 | return isAngularTestWrapper(node.arguments[0]);
|
21851 | }
|
21852 | } else if (node.arguments.length === 2 || node.arguments.length === 3) {
|
21853 | if ((node.arguments[0].type === "TemplateLiteral" || isStringLiteral(node.arguments[0])) && isTestCallCallee(node.callee)) {
|
21854 | if (node.arguments[2] && !isNumericLiteral(node.arguments[2])) {
|
21855 | return false;
|
21856 | }
|
21857 | return (node.arguments.length === 2 ? isFunctionOrArrowExpression(node.arguments[1]) : isFunctionOrArrowExpressionWithBody(node.arguments[1]) && getFunctionParameters(node.arguments[1]).length <= 1) || isAngularTestWrapper(node.arguments[1]);
|
21858 | }
|
21859 | }
|
21860 | return false;
|
21861 | }
|
21862 | var isCallExpression = createTypeCheckFunction(["CallExpression", "OptionalCallExpression"]);
|
21863 | var isMemberExpression = createTypeCheckFunction(["MemberExpression", "OptionalMemberExpression"]);
|
21864 | function isSimpleTemplateLiteral(node) {
|
21865 | let expressionsKey = "expressions";
|
21866 | if (node.type === "TSTemplateLiteralType") {
|
21867 | expressionsKey = "types";
|
21868 | }
|
21869 | const expressions = node[expressionsKey];
|
21870 | if (expressions.length === 0) {
|
21871 | return false;
|
21872 | }
|
21873 | return expressions.every((expr) => {
|
21874 | if (hasComment(expr)) {
|
21875 | return false;
|
21876 | }
|
21877 | if (expr.type === "Identifier" || expr.type === "ThisExpression") {
|
21878 | return true;
|
21879 | }
|
21880 | if (isMemberExpression(expr)) {
|
21881 | let head = expr;
|
21882 | while (isMemberExpression(head)) {
|
21883 | if (head.property.type !== "Identifier" && head.property.type !== "Literal" && head.property.type !== "StringLiteral" && head.property.type !== "NumericLiteral") {
|
21884 | return false;
|
21885 | }
|
21886 | head = head.object;
|
21887 | if (hasComment(head)) {
|
21888 | return false;
|
21889 | }
|
21890 | }
|
21891 | if (head.type === "Identifier" || head.type === "ThisExpression") {
|
21892 | return true;
|
21893 | }
|
21894 | return false;
|
21895 | }
|
21896 | return false;
|
21897 | });
|
21898 | }
|
21899 | function getTypeScriptMappedTypeModifier(tokenNode, keyword) {
|
21900 | if (tokenNode === "+" || tokenNode === "-") {
|
21901 | return tokenNode + keyword;
|
21902 | }
|
21903 | return keyword;
|
21904 | }
|
21905 | function isFlowAnnotationComment(text, typeAnnotation) {
|
21906 | const start = locStart(typeAnnotation);
|
21907 | const end = skipWhitespace(text, locEnd(typeAnnotation));
|
21908 | return end !== false && text.slice(start, start + 2) === "/*" && text.slice(end, end + 2) === "*/";
|
21909 | }
|
21910 | function hasLeadingOwnLineComment(text, node) {
|
21911 | if (isJsxNode(node)) {
|
21912 | return hasNodeIgnoreComment(node);
|
21913 | }
|
21914 | return hasComment(node, CommentCheckFlags.Leading, (comment) => hasNewline(text, locEnd(comment)));
|
21915 | }
|
21916 | function isStringPropSafeToUnquote(node, options) {
|
21917 | return options.parser !== "json" && isStringLiteral(node.key) && rawText(node.key).slice(1, -1) === node.key.value && (isIdentifierName(node.key.value) && !(options.parser === "babel-ts" && node.type === "ClassProperty" || options.parser === "typescript" && node.type === "PropertyDefinition") || isSimpleNumber(node.key.value) && String(Number(node.key.value)) === node.key.value && (options.parser === "babel" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree"));
|
21918 | }
|
21919 | function isSimpleNumber(numberString) {
|
21920 | return /^(?:\d+|\d+\.\d+)$/.test(numberString);
|
21921 | }
|
21922 | function isJestEachTemplateLiteral(node, parentNode) {
|
21923 | const jestEachTriggerRegex = /^[fx]?(?:describe|it|test)$/;
|
21924 | return parentNode.type === "TaggedTemplateExpression" && parentNode.quasi === node && parentNode.tag.type === "MemberExpression" && parentNode.tag.property.type === "Identifier" && parentNode.tag.property.name === "each" && (parentNode.tag.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.name) || parentNode.tag.object.type === "MemberExpression" && parentNode.tag.object.property.type === "Identifier" && (parentNode.tag.object.property.name === "only" || parentNode.tag.object.property.name === "skip") && parentNode.tag.object.object.type === "Identifier" && jestEachTriggerRegex.test(parentNode.tag.object.object.name));
|
21925 | }
|
21926 | function templateLiteralHasNewLines(template) {
|
21927 | return template.quasis.some((quasi) => quasi.value.raw.includes("\n"));
|
21928 | }
|
21929 | function isTemplateOnItsOwnLine(node, text) {
|
21930 | return (node.type === "TemplateLiteral" && templateLiteralHasNewLines(node) || node.type === "TaggedTemplateExpression" && templateLiteralHasNewLines(node.quasi)) && !hasNewline(text, locStart(node), {
|
21931 | backwards: true
|
21932 | });
|
21933 | }
|
21934 | function needsHardlineAfterDanglingComment(node) {
|
21935 | if (!hasComment(node)) {
|
21936 | return false;
|
21937 | }
|
21938 | const lastDanglingComment = getLast(getComments(node, CommentCheckFlags.Dangling));
|
21939 | return lastDanglingComment && !isBlockComment(lastDanglingComment);
|
21940 | }
|
21941 | function isFunctionCompositionArgs(args) {
|
21942 | if (args.length <= 1) {
|
21943 | return false;
|
21944 | }
|
21945 | let count = 0;
|
21946 | for (const arg of args) {
|
21947 | if (isFunctionOrArrowExpression(arg)) {
|
21948 | count += 1;
|
21949 | if (count > 1) {
|
21950 | return true;
|
21951 | }
|
21952 | } else if (isCallExpression(arg)) {
|
21953 | for (const childArg of arg.arguments) {
|
21954 | if (isFunctionOrArrowExpression(childArg)) {
|
21955 | return true;
|
21956 | }
|
21957 | }
|
21958 | }
|
21959 | }
|
21960 | return false;
|
21961 | }
|
21962 | function isLongCurriedCallExpression(path) {
|
21963 | const node = path.getValue();
|
21964 | const parent = path.getParentNode();
|
21965 | return isCallExpression(node) && isCallExpression(parent) && parent.callee === node && node.arguments.length > parent.arguments.length && parent.arguments.length > 0;
|
21966 | }
|
21967 | function isSimpleCallArgument(node, depth) {
|
21968 | if (depth >= 2) {
|
21969 | return false;
|
21970 | }
|
21971 | const isChildSimple = (child) => isSimpleCallArgument(child, depth + 1);
|
21972 | const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
|
21973 | if (regexpPattern && getStringWidth(regexpPattern) > 5) {
|
21974 | return false;
|
21975 | }
|
21976 | if (node.type === "Literal" || node.type === "BigIntLiteral" || node.type === "DecimalLiteral" || node.type === "BooleanLiteral" || node.type === "NullLiteral" || node.type === "NumericLiteral" || node.type === "RegExpLiteral" || node.type === "StringLiteral" || node.type === "Identifier" || node.type === "ThisExpression" || node.type === "Super" || node.type === "PrivateName" || node.type === "PrivateIdentifier" || node.type === "ArgumentPlaceholder" || node.type === "Import") {
|
21977 | return true;
|
21978 | }
|
21979 | if (node.type === "TemplateLiteral") {
|
21980 | return node.quasis.every((element) => !element.value.raw.includes("\n")) && node.expressions.every(isChildSimple);
|
21981 | }
|
21982 | if (node.type === "ObjectExpression") {
|
21983 | return node.properties.every((p) => !p.computed && (p.shorthand || p.value && isChildSimple(p.value)));
|
21984 | }
|
21985 | if (node.type === "ArrayExpression") {
|
21986 | return node.elements.every((x) => x === null || isChildSimple(x));
|
21987 | }
|
21988 | if (isCallLikeExpression(node)) {
|
21989 | return (node.type === "ImportExpression" || isSimpleCallArgument(node.callee, depth)) && getCallArguments(node).every(isChildSimple);
|
21990 | }
|
21991 | if (isMemberExpression(node)) {
|
21992 | return isSimpleCallArgument(node.object, depth) && isSimpleCallArgument(node.property, depth);
|
21993 | }
|
21994 | const targetUnaryExpressionOperators = {
|
21995 | "!": true,
|
21996 | "-": true,
|
21997 | "+": true,
|
21998 | "~": true
|
21999 | };
|
22000 | if (node.type === "UnaryExpression" && targetUnaryExpressionOperators[node.operator]) {
|
22001 | return isSimpleCallArgument(node.argument, depth);
|
22002 | }
|
22003 | const targetUpdateExpressionOperators = {
|
22004 | "++": true,
|
22005 | "--": true
|
22006 | };
|
22007 | if (node.type === "UpdateExpression" && targetUpdateExpressionOperators[node.operator]) {
|
22008 | return isSimpleCallArgument(node.argument, depth);
|
22009 | }
|
22010 | if (node.type === "TSNonNullExpression") {
|
22011 | return isSimpleCallArgument(node.expression, depth);
|
22012 | }
|
22013 | return false;
|
22014 | }
|
22015 | function rawText(node) {
|
22016 | var _node$extra$raw, _node$extra2;
|
22017 | return (_node$extra$raw = (_node$extra2 = node.extra) === null || _node$extra2 === void 0 ? void 0 : _node$extra2.raw) !== null && _node$extra$raw !== void 0 ? _node$extra$raw : node.raw;
|
22018 | }
|
22019 | function identity(x) {
|
22020 | return x;
|
22021 | }
|
22022 | function isTSXFile(options) {
|
22023 | return options.filepath && /\.tsx$/i.test(options.filepath);
|
22024 | }
|
22025 | function shouldPrintComma(options, level = "es5") {
|
22026 | return options.trailingComma === "es5" && level === "es5" || options.trailingComma === "all" && (level === "all" || level === "es5");
|
22027 | }
|
22028 | function startsWithNoLookaheadToken(node, forbidFunctionClassAndDoExpr) {
|
22029 | node = getLeftMost(node);
|
22030 | switch (node.type) {
|
22031 | case "FunctionExpression":
|
22032 | case "ClassExpression":
|
22033 | case "DoExpression":
|
22034 | return forbidFunctionClassAndDoExpr;
|
22035 | case "ObjectExpression":
|
22036 | return true;
|
22037 | case "MemberExpression":
|
22038 | case "OptionalMemberExpression":
|
22039 | return startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
|
22040 | case "TaggedTemplateExpression":
|
22041 | if (node.tag.type === "FunctionExpression") {
|
22042 | return false;
|
22043 | }
|
22044 | return startsWithNoLookaheadToken(node.tag, forbidFunctionClassAndDoExpr);
|
22045 | case "CallExpression":
|
22046 | case "OptionalCallExpression":
|
22047 | if (node.callee.type === "FunctionExpression") {
|
22048 | return false;
|
22049 | }
|
22050 | return startsWithNoLookaheadToken(node.callee, forbidFunctionClassAndDoExpr);
|
22051 | case "ConditionalExpression":
|
22052 | return startsWithNoLookaheadToken(node.test, forbidFunctionClassAndDoExpr);
|
22053 | case "UpdateExpression":
|
22054 | return !node.prefix && startsWithNoLookaheadToken(node.argument, forbidFunctionClassAndDoExpr);
|
22055 | case "BindExpression":
|
22056 | return node.object && startsWithNoLookaheadToken(node.object, forbidFunctionClassAndDoExpr);
|
22057 | case "SequenceExpression":
|
22058 | return startsWithNoLookaheadToken(node.expressions[0], forbidFunctionClassAndDoExpr);
|
22059 | case "TSSatisfiesExpression":
|
22060 | case "TSAsExpression":
|
22061 | case "TSNonNullExpression":
|
22062 | return startsWithNoLookaheadToken(node.expression, forbidFunctionClassAndDoExpr);
|
22063 | default:
|
22064 | return false;
|
22065 | }
|
22066 | }
|
22067 | var equalityOperators = {
|
22068 | "==": true,
|
22069 | "!=": true,
|
22070 | "===": true,
|
22071 | "!==": true
|
22072 | };
|
22073 | var multiplicativeOperators = {
|
22074 | "*": true,
|
22075 | "/": true,
|
22076 | "%": true
|
22077 | };
|
22078 | var bitshiftOperators = {
|
22079 | ">>": true,
|
22080 | ">>>": true,
|
22081 | "<<": true
|
22082 | };
|
22083 | function shouldFlatten(parentOp, nodeOp) {
|
22084 | if (getPrecedence(nodeOp) !== getPrecedence(parentOp)) {
|
22085 | return false;
|
22086 | }
|
22087 | if (parentOp === "**") {
|
22088 | return false;
|
22089 | }
|
22090 | if (equalityOperators[parentOp] && equalityOperators[nodeOp]) {
|
22091 | return false;
|
22092 | }
|
22093 | if (nodeOp === "%" && multiplicativeOperators[parentOp] || parentOp === "%" && multiplicativeOperators[nodeOp]) {
|
22094 | return false;
|
22095 | }
|
22096 | if (nodeOp !== parentOp && multiplicativeOperators[nodeOp] && multiplicativeOperators[parentOp]) {
|
22097 | return false;
|
22098 | }
|
22099 | if (bitshiftOperators[parentOp] && bitshiftOperators[nodeOp]) {
|
22100 | return false;
|
22101 | }
|
22102 | return true;
|
22103 | }
|
22104 | var PRECEDENCE = new Map([["|>"], ["??"], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "===", "!=", "!=="], ["<", ">", "<=", ">=", "in", "instanceof"], [">>", "<<", ">>>"], ["+", "-"], ["*", "/", "%"], ["**"]].flatMap((operators, index) => operators.map((operator) => [operator, index])));
|
22105 | function getPrecedence(operator) {
|
22106 | return PRECEDENCE.get(operator);
|
22107 | }
|
22108 | function getLeftMost(node) {
|
22109 | while (node.left) {
|
22110 | node = node.left;
|
22111 | }
|
22112 | return node;
|
22113 | }
|
22114 | function isBitwiseOperator(operator) {
|
22115 | return Boolean(bitshiftOperators[operator]) || operator === "|" || operator === "^" || operator === "&";
|
22116 | }
|
22117 | function hasRestParameter(node) {
|
22118 | var _getLast;
|
22119 | if (node.rest) {
|
22120 | return true;
|
22121 | }
|
22122 | const parameters = getFunctionParameters(node);
|
22123 | return ((_getLast = getLast(parameters)) === null || _getLast === void 0 ? void 0 : _getLast.type) === "RestElement";
|
22124 | }
|
22125 | var functionParametersCache = new WeakMap();
|
22126 | function getFunctionParameters(node) {
|
22127 | if (functionParametersCache.has(node)) {
|
22128 | return functionParametersCache.get(node);
|
22129 | }
|
22130 | const parameters = [];
|
22131 | if (node.this) {
|
22132 | parameters.push(node.this);
|
22133 | }
|
22134 | if (Array.isArray(node.parameters)) {
|
22135 | parameters.push(...node.parameters);
|
22136 | } else if (Array.isArray(node.params)) {
|
22137 | parameters.push(...node.params);
|
22138 | }
|
22139 | if (node.rest) {
|
22140 | parameters.push(node.rest);
|
22141 | }
|
22142 | functionParametersCache.set(node, parameters);
|
22143 | return parameters;
|
22144 | }
|
22145 | function iterateFunctionParametersPath(path, iteratee) {
|
22146 | const node = path.getValue();
|
22147 | let index = 0;
|
22148 | const callback = (childPath) => iteratee(childPath, index++);
|
22149 | if (node.this) {
|
22150 | path.call(callback, "this");
|
22151 | }
|
22152 | if (Array.isArray(node.parameters)) {
|
22153 | path.each(callback, "parameters");
|
22154 | } else if (Array.isArray(node.params)) {
|
22155 | path.each(callback, "params");
|
22156 | }
|
22157 | if (node.rest) {
|
22158 | path.call(callback, "rest");
|
22159 | }
|
22160 | }
|
22161 | var callArgumentsCache = new WeakMap();
|
22162 | function getCallArguments(node) {
|
22163 | if (callArgumentsCache.has(node)) {
|
22164 | return callArgumentsCache.get(node);
|
22165 | }
|
22166 | let args = node.arguments;
|
22167 | if (node.type === "ImportExpression") {
|
22168 | args = [node.source];
|
22169 | if (node.attributes) {
|
22170 | args.push(node.attributes);
|
22171 | }
|
22172 | }
|
22173 | callArgumentsCache.set(node, args);
|
22174 | return args;
|
22175 | }
|
22176 | function iterateCallArgumentsPath(path, iteratee) {
|
22177 | const node = path.getValue();
|
22178 | if (node.type === "ImportExpression") {
|
22179 | path.call((sourcePath) => iteratee(sourcePath, 0), "source");
|
22180 | if (node.attributes) {
|
22181 | path.call((sourcePath) => iteratee(sourcePath, 1), "attributes");
|
22182 | }
|
22183 | } else {
|
22184 | path.each(iteratee, "arguments");
|
22185 | }
|
22186 | }
|
22187 | function isPrettierIgnoreComment(comment) {
|
22188 | return comment.value.trim() === "prettier-ignore" && !comment.unignore;
|
22189 | }
|
22190 | function hasNodeIgnoreComment(node) {
|
22191 | return node && (node.prettierIgnore || hasComment(node, CommentCheckFlags.PrettierIgnore));
|
22192 | }
|
22193 | function hasIgnoreComment(path) {
|
22194 | const node = path.getValue();
|
22195 | return hasNodeIgnoreComment(node);
|
22196 | }
|
22197 | var CommentCheckFlags = {
|
22198 | Leading: 1 << 1,
|
22199 | Trailing: 1 << 2,
|
22200 | Dangling: 1 << 3,
|
22201 | Block: 1 << 4,
|
22202 | Line: 1 << 5,
|
22203 | PrettierIgnore: 1 << 6,
|
22204 | First: 1 << 7,
|
22205 | Last: 1 << 8
|
22206 | };
|
22207 | var getCommentTestFunction = (flags, fn) => {
|
22208 | if (typeof flags === "function") {
|
22209 | fn = flags;
|
22210 | flags = 0;
|
22211 | }
|
22212 | if (flags || fn) {
|
22213 | return (comment, index, comments) => !(flags & CommentCheckFlags.Leading && !comment.leading || flags & CommentCheckFlags.Trailing && !comment.trailing || flags & CommentCheckFlags.Dangling && (comment.leading || comment.trailing) || flags & CommentCheckFlags.Block && !isBlockComment(comment) || flags & CommentCheckFlags.Line && !isLineComment(comment) || flags & CommentCheckFlags.First && index !== 0 || flags & CommentCheckFlags.Last && index !== comments.length - 1 || flags & CommentCheckFlags.PrettierIgnore && !isPrettierIgnoreComment(comment) || fn && !fn(comment));
|
22214 | }
|
22215 | };
|
22216 | function hasComment(node, flags, fn) {
|
22217 | if (!isNonEmptyArray(node === null || node === void 0 ? void 0 : node.comments)) {
|
22218 | return false;
|
22219 | }
|
22220 | const test = getCommentTestFunction(flags, fn);
|
22221 | return test ? node.comments.some(test) : true;
|
22222 | }
|
22223 | function getComments(node, flags, fn) {
|
22224 | if (!Array.isArray(node === null || node === void 0 ? void 0 : node.comments)) {
|
22225 | return [];
|
22226 | }
|
22227 | const test = getCommentTestFunction(flags, fn);
|
22228 | return test ? node.comments.filter(test) : node.comments;
|
22229 | }
|
22230 | var isNextLineEmpty = (node, {
|
22231 | originalText
|
22232 | }) => isNextLineEmptyAfterIndex(originalText, locEnd(node));
|
22233 | function isCallLikeExpression(node) {
|
22234 | return isCallExpression(node) || node.type === "NewExpression" || node.type === "ImportExpression";
|
22235 | }
|
22236 | function isObjectProperty(node) {
|
22237 | return node && (node.type === "ObjectProperty" || node.type === "Property" && !node.method && node.kind === "init");
|
22238 | }
|
22239 | function isEnabledHackPipeline(options) {
|
22240 | return Boolean(options.__isUsingHackPipeline);
|
22241 | }
|
22242 | var markerForIfWithoutBlockAndSameLineComment = Symbol("ifWithoutBlockAndSameLineComment");
|
22243 | function isTSTypeExpression(node) {
|
22244 | return node.type === "TSAsExpression" || node.type === "TSSatisfiesExpression";
|
22245 | }
|
22246 | module2.exports = {
|
22247 | getFunctionParameters,
|
22248 | iterateFunctionParametersPath,
|
22249 | getCallArguments,
|
22250 | iterateCallArgumentsPath,
|
22251 | hasRestParameter,
|
22252 | getLeftSide,
|
22253 | getLeftSidePathName,
|
22254 | getParentExportDeclaration,
|
22255 | getTypeScriptMappedTypeModifier,
|
22256 | hasFlowAnnotationComment,
|
22257 | hasFlowShorthandAnnotationComment,
|
22258 | hasLeadingOwnLineComment,
|
22259 | hasNakedLeftSide,
|
22260 | hasNode,
|
22261 | hasIgnoreComment,
|
22262 | hasNodeIgnoreComment,
|
22263 | identity,
|
22264 | isBinaryish,
|
22265 | isCallLikeExpression,
|
22266 | isEnabledHackPipeline,
|
22267 | isLineComment,
|
22268 | isPrettierIgnoreComment,
|
22269 | isCallExpression,
|
22270 | isMemberExpression,
|
22271 | isExportDeclaration,
|
22272 | isFlowAnnotationComment,
|
22273 | isFunctionCompositionArgs,
|
22274 | isFunctionNotation,
|
22275 | isFunctionOrArrowExpression,
|
22276 | isGetterOrSetter,
|
22277 | isJestEachTemplateLiteral,
|
22278 | isJsxNode,
|
22279 | isLiteral,
|
22280 | isLongCurriedCallExpression,
|
22281 | isSimpleCallArgument,
|
22282 | isMemberish,
|
22283 | isNumericLiteral,
|
22284 | isSignedNumericLiteral,
|
22285 | isObjectProperty,
|
22286 | isObjectType,
|
22287 | isObjectTypePropertyAFunction,
|
22288 | isSimpleType,
|
22289 | isSimpleNumber,
|
22290 | isSimpleTemplateLiteral,
|
22291 | isStringLiteral,
|
22292 | isStringPropSafeToUnquote,
|
22293 | isTemplateOnItsOwnLine,
|
22294 | isTestCall,
|
22295 | isTheOnlyJsxElementInMarkdown,
|
22296 | isTSXFile,
|
22297 | isTypeAnnotationAFunction,
|
22298 | isNextLineEmpty,
|
22299 | needsHardlineAfterDanglingComment,
|
22300 | rawText,
|
22301 | shouldPrintComma,
|
22302 | isBitwiseOperator,
|
22303 | shouldFlatten,
|
22304 | startsWithNoLookaheadToken,
|
22305 | getPrecedence,
|
22306 | hasComment,
|
22307 | getComments,
|
22308 | CommentCheckFlags,
|
22309 | markerForIfWithoutBlockAndSameLineComment,
|
22310 | isTSTypeExpression
|
22311 | };
|
22312 | }
|
22313 | });
|
22314 | var require_template_literal = __commonJS2({
|
22315 | "src/language-js/print/template-literal.js"(exports2, module2) {
|
22316 | "use strict";
|
22317 | var getLast = require_get_last();
|
22318 | var {
|
22319 | getStringWidth,
|
22320 | getIndentSize
|
22321 | } = require_util();
|
22322 | var {
|
22323 | builders: {
|
22324 | join,
|
22325 | hardline,
|
22326 | softline,
|
22327 | group,
|
22328 | indent,
|
22329 | align,
|
22330 | lineSuffixBoundary,
|
22331 | addAlignmentToDoc
|
22332 | },
|
22333 | printer: {
|
22334 | printDocToString
|
22335 | },
|
22336 | utils: {
|
22337 | mapDoc
|
22338 | }
|
22339 | } = require("./doc.js");
|
22340 | var {
|
22341 | isBinaryish,
|
22342 | isJestEachTemplateLiteral,
|
22343 | isSimpleTemplateLiteral,
|
22344 | hasComment,
|
22345 | isMemberExpression,
|
22346 | isTSTypeExpression
|
22347 | } = require_utils7();
|
22348 | function printTemplateLiteral(path, print, options) {
|
22349 | const node = path.getValue();
|
22350 | const isTemplateLiteral = node.type === "TemplateLiteral";
|
22351 | if (isTemplateLiteral && isJestEachTemplateLiteral(node, path.getParentNode())) {
|
22352 | const printed = printJestEachTemplateLiteral(path, options, print);
|
22353 | if (printed) {
|
22354 | return printed;
|
22355 | }
|
22356 | }
|
22357 | let expressionsKey = "expressions";
|
22358 | if (node.type === "TSTemplateLiteralType") {
|
22359 | expressionsKey = "types";
|
22360 | }
|
22361 | const parts = [];
|
22362 | let expressions = path.map(print, expressionsKey);
|
22363 | const isSimple = isSimpleTemplateLiteral(node);
|
22364 | if (isSimple) {
|
22365 | expressions = expressions.map((doc2) => printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
|
22366 | printWidth: Number.POSITIVE_INFINITY
|
22367 | })).formatted);
|
22368 | }
|
22369 | parts.push(lineSuffixBoundary, "`");
|
22370 | path.each((childPath) => {
|
22371 | const i = childPath.getName();
|
22372 | parts.push(print());
|
22373 | if (i < expressions.length) {
|
22374 | const {
|
22375 | tabWidth
|
22376 | } = options;
|
22377 | const quasi = childPath.getValue();
|
22378 | const indentSize = getIndentSize(quasi.value.raw, tabWidth);
|
22379 | let printed = expressions[i];
|
22380 | if (!isSimple) {
|
22381 | const expression = node[expressionsKey][i];
|
22382 | if (hasComment(expression) || isMemberExpression(expression) || expression.type === "ConditionalExpression" || expression.type === "SequenceExpression" || isTSTypeExpression(expression) || isBinaryish(expression)) {
|
22383 | printed = [indent([softline, printed]), softline];
|
22384 | }
|
22385 | }
|
22386 | const aligned = indentSize === 0 && quasi.value.raw.endsWith("\n") ? align(Number.NEGATIVE_INFINITY, printed) : addAlignmentToDoc(printed, indentSize, tabWidth);
|
22387 | parts.push(group(["${", aligned, lineSuffixBoundary, "}"]));
|
22388 | }
|
22389 | }, "quasis");
|
22390 | parts.push("`");
|
22391 | return parts;
|
22392 | }
|
22393 | function printJestEachTemplateLiteral(path, options, print) {
|
22394 | const node = path.getNode();
|
22395 | const headerNames = node.quasis[0].value.raw.trim().split(/\s*\|\s*/);
|
22396 | if (headerNames.length > 1 || headerNames.some((headerName) => headerName.length > 0)) {
|
22397 | options.__inJestEach = true;
|
22398 | const expressions = path.map(print, "expressions");
|
22399 | options.__inJestEach = false;
|
22400 | const parts = [];
|
22401 | const stringifiedExpressions = expressions.map((doc2) => "${" + printDocToString(doc2, Object.assign(Object.assign({}, options), {}, {
|
22402 | printWidth: Number.POSITIVE_INFINITY,
|
22403 | endOfLine: "lf"
|
22404 | })).formatted + "}");
|
22405 | const tableBody = [{
|
22406 | hasLineBreak: false,
|
22407 | cells: []
|
22408 | }];
|
22409 | for (let i = 1; i < node.quasis.length; i++) {
|
22410 | const row = getLast(tableBody);
|
22411 | const correspondingExpression = stringifiedExpressions[i - 1];
|
22412 | row.cells.push(correspondingExpression);
|
22413 | if (correspondingExpression.includes("\n")) {
|
22414 | row.hasLineBreak = true;
|
22415 | }
|
22416 | if (node.quasis[i].value.raw.includes("\n")) {
|
22417 | tableBody.push({
|
22418 | hasLineBreak: false,
|
22419 | cells: []
|
22420 | });
|
22421 | }
|
22422 | }
|
22423 | const maxColumnCount = Math.max(headerNames.length, ...tableBody.map((row) => row.cells.length));
|
22424 | const maxColumnWidths = Array.from({
|
22425 | length: maxColumnCount
|
22426 | }).fill(0);
|
22427 | const table = [{
|
22428 | cells: headerNames
|
22429 | }, ...tableBody.filter((row) => row.cells.length > 0)];
|
22430 | for (const {
|
22431 | cells
|
22432 | } of table.filter((row) => !row.hasLineBreak)) {
|
22433 | for (const [index, cell] of cells.entries()) {
|
22434 | maxColumnWidths[index] = Math.max(maxColumnWidths[index], getStringWidth(cell));
|
22435 | }
|
22436 | }
|
22437 | parts.push(lineSuffixBoundary, "`", indent([hardline, join(hardline, table.map((row) => join(" | ", row.cells.map((cell, index) => row.hasLineBreak ? cell : cell + " ".repeat(maxColumnWidths[index] - getStringWidth(cell))))))]), hardline, "`");
|
22438 | return parts;
|
22439 | }
|
22440 | }
|
22441 | function printTemplateExpression(path, print) {
|
22442 | const node = path.getValue();
|
22443 | let printed = print();
|
22444 | if (hasComment(node)) {
|
22445 | printed = group([indent([softline, printed]), softline]);
|
22446 | }
|
22447 | return ["${", printed, lineSuffixBoundary, "}"];
|
22448 | }
|
22449 | function printTemplateExpressions(path, print) {
|
22450 | return path.map((path2) => printTemplateExpression(path2, print), "expressions");
|
22451 | }
|
22452 | function escapeTemplateCharacters(doc2, raw) {
|
22453 | return mapDoc(doc2, (currentDoc) => {
|
22454 | if (typeof currentDoc === "string") {
|
22455 | return raw ? currentDoc.replace(/(\\*)`/g, "$1$1\\`") : uncookTemplateElementValue(currentDoc);
|
22456 | }
|
22457 | return currentDoc;
|
22458 | });
|
22459 | }
|
22460 | function uncookTemplateElementValue(cookedValue) {
|
22461 | return cookedValue.replace(/([\\`]|\${)/g, "\\$1");
|
22462 | }
|
22463 | module2.exports = {
|
22464 | printTemplateLiteral,
|
22465 | printTemplateExpressions,
|
22466 | escapeTemplateCharacters,
|
22467 | uncookTemplateElementValue
|
22468 | };
|
22469 | }
|
22470 | });
|
22471 | var require_markdown = __commonJS2({
|
22472 | "src/language-js/embed/markdown.js"(exports2, module2) {
|
22473 | "use strict";
|
22474 | var {
|
22475 | builders: {
|
22476 | indent,
|
22477 | softline,
|
22478 | literalline,
|
22479 | dedentToRoot
|
22480 | }
|
22481 | } = require("./doc.js");
|
22482 | var {
|
22483 | escapeTemplateCharacters
|
22484 | } = require_template_literal();
|
22485 | function format(path, print, textToDoc) {
|
22486 | const node = path.getValue();
|
22487 | let text = node.quasis[0].value.raw.replace(/((?:\\\\)*)\\`/g, (_, backslashes) => "\\".repeat(backslashes.length / 2) + "`");
|
22488 | const indentation = getIndentation(text);
|
22489 | const hasIndent = indentation !== "";
|
22490 | if (hasIndent) {
|
22491 | text = text.replace(new RegExp(`^${indentation}`, "gm"), "");
|
22492 | }
|
22493 | const doc2 = escapeTemplateCharacters(textToDoc(text, {
|
22494 | parser: "markdown",
|
22495 | __inJsTemplate: true
|
22496 | }, {
|
22497 | stripTrailingHardline: true
|
22498 | }), true);
|
22499 | return ["`", hasIndent ? indent([softline, doc2]) : [literalline, dedentToRoot(doc2)], softline, "`"];
|
22500 | }
|
22501 | function getIndentation(str) {
|
22502 | const firstMatchedIndent = str.match(/^([^\S\n]*)\S/m);
|
22503 | return firstMatchedIndent === null ? "" : firstMatchedIndent[1];
|
22504 | }
|
22505 | module2.exports = format;
|
22506 | }
|
22507 | });
|
22508 | var require_css = __commonJS2({
|
22509 | "src/language-js/embed/css.js"(exports2, module2) {
|
22510 | "use strict";
|
22511 | var {
|
22512 | isNonEmptyArray
|
22513 | } = require_util();
|
22514 | var {
|
22515 | builders: {
|
22516 | indent,
|
22517 | hardline,
|
22518 | softline
|
22519 | },
|
22520 | utils: {
|
22521 | mapDoc,
|
22522 | replaceEndOfLine,
|
22523 | cleanDoc
|
22524 | }
|
22525 | } = require("./doc.js");
|
22526 | var {
|
22527 | printTemplateExpressions
|
22528 | } = require_template_literal();
|
22529 | function format(path, print, textToDoc) {
|
22530 | const node = path.getValue();
|
22531 | const rawQuasis = node.quasis.map((q) => q.value.raw);
|
22532 | let placeholderID = 0;
|
22533 | const text = rawQuasis.reduce((prevVal, currVal, idx) => idx === 0 ? currVal : prevVal + "@prettier-placeholder-" + placeholderID++ + "-id" + currVal, "");
|
22534 | const doc2 = textToDoc(text, {
|
22535 | parser: "scss"
|
22536 | }, {
|
22537 | stripTrailingHardline: true
|
22538 | });
|
22539 | const expressionDocs = printTemplateExpressions(path, print);
|
22540 | return transformCssDoc(doc2, node, expressionDocs);
|
22541 | }
|
22542 | function transformCssDoc(quasisDoc, parentNode, expressionDocs) {
|
22543 | const isEmpty = parentNode.quasis.length === 1 && !parentNode.quasis[0].value.raw.trim();
|
22544 | if (isEmpty) {
|
22545 | return "``";
|
22546 | }
|
22547 | const newDoc = replacePlaceholders(quasisDoc, expressionDocs);
|
22548 | if (!newDoc) {
|
22549 | throw new Error("Couldn't insert all the expressions");
|
22550 | }
|
22551 | return ["`", indent([hardline, newDoc]), softline, "`"];
|
22552 | }
|
22553 | function replacePlaceholders(quasisDoc, expressionDocs) {
|
22554 | if (!isNonEmptyArray(expressionDocs)) {
|
22555 | return quasisDoc;
|
22556 | }
|
22557 | let replaceCounter = 0;
|
22558 | const newDoc = mapDoc(cleanDoc(quasisDoc), (doc2) => {
|
22559 | if (typeof doc2 !== "string" || !doc2.includes("@prettier-placeholder")) {
|
22560 | return doc2;
|
22561 | }
|
22562 | return doc2.split(/@prettier-placeholder-(\d+)-id/).map((component, idx) => {
|
22563 | if (idx % 2 === 0) {
|
22564 | return replaceEndOfLine(component);
|
22565 | }
|
22566 | replaceCounter++;
|
22567 | return expressionDocs[component];
|
22568 | });
|
22569 | });
|
22570 | return expressionDocs.length === replaceCounter ? newDoc : null;
|
22571 | }
|
22572 | module2.exports = format;
|
22573 | }
|
22574 | });
|
22575 | var require_graphql = __commonJS2({
|
22576 | "src/language-js/embed/graphql.js"(exports2, module2) {
|
22577 | "use strict";
|
22578 | var {
|
22579 | builders: {
|
22580 | indent,
|
22581 | join,
|
22582 | hardline
|
22583 | }
|
22584 | } = require("./doc.js");
|
22585 | var {
|
22586 | escapeTemplateCharacters,
|
22587 | printTemplateExpressions
|
22588 | } = require_template_literal();
|
22589 | function format(path, print, textToDoc) {
|
22590 | const node = path.getValue();
|
22591 | const numQuasis = node.quasis.length;
|
22592 | if (numQuasis === 1 && node.quasis[0].value.raw.trim() === "") {
|
22593 | return "``";
|
22594 | }
|
22595 | const expressionDocs = printTemplateExpressions(path, print);
|
22596 | const parts = [];
|
22597 | for (let i = 0; i < numQuasis; i++) {
|
22598 | const templateElement = node.quasis[i];
|
22599 | const isFirst = i === 0;
|
22600 | const isLast = i === numQuasis - 1;
|
22601 | const text = templateElement.value.cooked;
|
22602 | const lines = text.split("\n");
|
22603 | const numLines = lines.length;
|
22604 | const expressionDoc = expressionDocs[i];
|
22605 | const startsWithBlankLine = numLines > 2 && lines[0].trim() === "" && lines[1].trim() === "";
|
22606 | const endsWithBlankLine = numLines > 2 && lines[numLines - 1].trim() === "" && lines[numLines - 2].trim() === "";
|
22607 | const commentsAndWhitespaceOnly = lines.every((line) => /^\s*(?:#[^\n\r]*)?$/.test(line));
|
22608 | if (!isLast && /#[^\n\r]*$/.test(lines[numLines - 1])) {
|
22609 | return null;
|
22610 | }
|
22611 | let doc2 = null;
|
22612 | if (commentsAndWhitespaceOnly) {
|
22613 | doc2 = printGraphqlComments(lines);
|
22614 | } else {
|
22615 | doc2 = textToDoc(text, {
|
22616 | parser: "graphql"
|
22617 | }, {
|
22618 | stripTrailingHardline: true
|
22619 | });
|
22620 | }
|
22621 | if (doc2) {
|
22622 | doc2 = escapeTemplateCharacters(doc2, false);
|
22623 | if (!isFirst && startsWithBlankLine) {
|
22624 | parts.push("");
|
22625 | }
|
22626 | parts.push(doc2);
|
22627 | if (!isLast && endsWithBlankLine) {
|
22628 | parts.push("");
|
22629 | }
|
22630 | } else if (!isFirst && !isLast && startsWithBlankLine) {
|
22631 | parts.push("");
|
22632 | }
|
22633 | if (expressionDoc) {
|
22634 | parts.push(expressionDoc);
|
22635 | }
|
22636 | }
|
22637 | return ["`", indent([hardline, join(hardline, parts)]), hardline, "`"];
|
22638 | }
|
22639 | function printGraphqlComments(lines) {
|
22640 | const parts = [];
|
22641 | let seenComment = false;
|
22642 | const array = lines.map((textLine) => textLine.trim());
|
22643 | for (const [i, textLine] of array.entries()) {
|
22644 | if (textLine === "") {
|
22645 | continue;
|
22646 | }
|
22647 | if (array[i - 1] === "" && seenComment) {
|
22648 | parts.push([hardline, textLine]);
|
22649 | } else {
|
22650 | parts.push(textLine);
|
22651 | }
|
22652 | seenComment = true;
|
22653 | }
|
22654 | return parts.length === 0 ? null : join(hardline, parts);
|
22655 | }
|
22656 | module2.exports = format;
|
22657 | }
|
22658 | });
|
22659 | var require_html = __commonJS2({
|
22660 | "src/language-js/embed/html.js"(exports2, module2) {
|
22661 | "use strict";
|
22662 | var {
|
22663 | builders: {
|
22664 | indent,
|
22665 | line,
|
22666 | hardline,
|
22667 | group
|
22668 | },
|
22669 | utils: {
|
22670 | mapDoc
|
22671 | }
|
22672 | } = require("./doc.js");
|
22673 | var {
|
22674 | printTemplateExpressions,
|
22675 | uncookTemplateElementValue
|
22676 | } = require_template_literal();
|
22677 | var htmlTemplateLiteralCounter = 0;
|
22678 | function format(path, print, textToDoc, options, {
|
22679 | parser
|
22680 | }) {
|
22681 | const node = path.getValue();
|
22682 | const counter = htmlTemplateLiteralCounter;
|
22683 | htmlTemplateLiteralCounter = htmlTemplateLiteralCounter + 1 >>> 0;
|
22684 | const composePlaceholder = (index) => `PRETTIER_HTML_PLACEHOLDER_${index}_${counter}_IN_JS`;
|
22685 | const text = node.quasis.map((quasi, index, quasis) => index === quasis.length - 1 ? quasi.value.cooked : quasi.value.cooked + composePlaceholder(index)).join("");
|
22686 | const expressionDocs = printTemplateExpressions(path, print);
|
22687 | if (expressionDocs.length === 0 && text.trim().length === 0) {
|
22688 | return "``";
|
22689 | }
|
22690 | const placeholderRegex = new RegExp(composePlaceholder("(\\d+)"), "g");
|
22691 | let topLevelCount = 0;
|
22692 | const doc2 = textToDoc(text, {
|
22693 | parser,
|
22694 | __onHtmlRoot(root) {
|
22695 | topLevelCount = root.children.length;
|
22696 | }
|
22697 | }, {
|
22698 | stripTrailingHardline: true
|
22699 | });
|
22700 | const contentDoc = mapDoc(doc2, (doc3) => {
|
22701 | if (typeof doc3 !== "string") {
|
22702 | return doc3;
|
22703 | }
|
22704 | const parts = [];
|
22705 | const components = doc3.split(placeholderRegex);
|
22706 | for (let i = 0; i < components.length; i++) {
|
22707 | let component = components[i];
|
22708 | if (i % 2 === 0) {
|
22709 | if (component) {
|
22710 | component = uncookTemplateElementValue(component);
|
22711 | if (options.__embeddedInHtml) {
|
22712 | component = component.replace(/<\/(script)\b/gi, "<\\/$1");
|
22713 | }
|
22714 | parts.push(component);
|
22715 | }
|
22716 | continue;
|
22717 | }
|
22718 | const placeholderIndex = Number(component);
|
22719 | parts.push(expressionDocs[placeholderIndex]);
|
22720 | }
|
22721 | return parts;
|
22722 | });
|
22723 | const leadingWhitespace = /^\s/.test(text) ? " " : "";
|
22724 | const trailingWhitespace = /\s$/.test(text) ? " " : "";
|
22725 | const linebreak = options.htmlWhitespaceSensitivity === "ignore" ? hardline : leadingWhitespace && trailingWhitespace ? line : null;
|
22726 | if (linebreak) {
|
22727 | return group(["`", indent([linebreak, group(contentDoc)]), linebreak, "`"]);
|
22728 | }
|
22729 | return group(["`", leadingWhitespace, topLevelCount > 1 ? indent(group(contentDoc)) : group(contentDoc), trailingWhitespace, "`"]);
|
22730 | }
|
22731 | module2.exports = format;
|
22732 | }
|
22733 | });
|
22734 | var require_embed = __commonJS2({
|
22735 | "src/language-js/embed.js"(exports2, module2) {
|
22736 | "use strict";
|
22737 | var {
|
22738 | hasComment,
|
22739 | CommentCheckFlags,
|
22740 | isObjectProperty
|
22741 | } = require_utils7();
|
22742 | var formatMarkdown = require_markdown();
|
22743 | var formatCss = require_css();
|
22744 | var formatGraphql = require_graphql();
|
22745 | var formatHtml = require_html();
|
22746 | function getLanguage(path) {
|
22747 | if (isStyledJsx(path) || isStyledComponents(path) || isCssProp(path) || isAngularComponentStyles(path)) {
|
22748 | return "css";
|
22749 | }
|
22750 | if (isGraphQL(path)) {
|
22751 | return "graphql";
|
22752 | }
|
22753 | if (isHtml(path)) {
|
22754 | return "html";
|
22755 | }
|
22756 | if (isAngularComponentTemplate(path)) {
|
22757 | return "angular";
|
22758 | }
|
22759 | if (isMarkdown(path)) {
|
22760 | return "markdown";
|
22761 | }
|
22762 | }
|
22763 | function embed(path, print, textToDoc, options) {
|
22764 | const node = path.getValue();
|
22765 | if (node.type !== "TemplateLiteral" || hasInvalidCookedValue(node)) {
|
22766 | return;
|
22767 | }
|
22768 | const language = getLanguage(path);
|
22769 | if (!language) {
|
22770 | return;
|
22771 | }
|
22772 | if (language === "markdown") {
|
22773 | return formatMarkdown(path, print, textToDoc);
|
22774 | }
|
22775 | if (language === "css") {
|
22776 | return formatCss(path, print, textToDoc);
|
22777 | }
|
22778 | if (language === "graphql") {
|
22779 | return formatGraphql(path, print, textToDoc);
|
22780 | }
|
22781 | if (language === "html" || language === "angular") {
|
22782 | return formatHtml(path, print, textToDoc, options, {
|
22783 | parser: language
|
22784 | });
|
22785 | }
|
22786 | }
|
22787 | function isMarkdown(path) {
|
22788 | const node = path.getValue();
|
22789 | const parent = path.getParentNode();
|
22790 | return parent && parent.type === "TaggedTemplateExpression" && node.quasis.length === 1 && parent.tag.type === "Identifier" && (parent.tag.name === "md" || parent.tag.name === "markdown");
|
22791 | }
|
22792 | function isStyledJsx(path) {
|
22793 | const node = path.getValue();
|
22794 | const parent = path.getParentNode();
|
22795 | const parentParent = path.getParentNode(1);
|
22796 | return parentParent && node.quasis && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXElement" && parentParent.openingElement.name.name === "style" && parentParent.openingElement.attributes.some((attribute) => attribute.name.name === "jsx") || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "Identifier" && parent.tag.name === "css" || parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && parent.tag.object.name === "css" && (parent.tag.property.name === "global" || parent.tag.property.name === "resolve");
|
22797 | }
|
22798 | function isAngularComponentStyles(path) {
|
22799 | return path.match((node) => node.type === "TemplateLiteral", (node, name) => node.type === "ArrayExpression" && name === "elements", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "styles" && name === "value", ...angularComponentObjectExpressionPredicates);
|
22800 | }
|
22801 | function isAngularComponentTemplate(path) {
|
22802 | return path.match((node) => node.type === "TemplateLiteral", (node, name) => isObjectProperty(node) && node.key.type === "Identifier" && node.key.name === "template" && name === "value", ...angularComponentObjectExpressionPredicates);
|
22803 | }
|
22804 | var angularComponentObjectExpressionPredicates = [(node, name) => node.type === "ObjectExpression" && name === "properties", (node, name) => node.type === "CallExpression" && node.callee.type === "Identifier" && node.callee.name === "Component" && name === "arguments", (node, name) => node.type === "Decorator" && name === "expression"];
|
22805 | function isStyledComponents(path) {
|
22806 | const parent = path.getParentNode();
|
22807 | if (!parent || parent.type !== "TaggedTemplateExpression") {
|
22808 | return false;
|
22809 | }
|
22810 | const tag = parent.tag.type === "ParenthesizedExpression" ? parent.tag.expression : parent.tag;
|
22811 | switch (tag.type) {
|
22812 | case "MemberExpression":
|
22813 | return isStyledIdentifier(tag.object) || isStyledExtend(tag);
|
22814 | case "CallExpression":
|
22815 | return isStyledIdentifier(tag.callee) || tag.callee.type === "MemberExpression" && (tag.callee.object.type === "MemberExpression" && (isStyledIdentifier(tag.callee.object.object) || isStyledExtend(tag.callee.object)) || tag.callee.object.type === "CallExpression" && isStyledIdentifier(tag.callee.object.callee));
|
22816 | case "Identifier":
|
22817 | return tag.name === "css";
|
22818 | default:
|
22819 | return false;
|
22820 | }
|
22821 | }
|
22822 | function isCssProp(path) {
|
22823 | const parent = path.getParentNode();
|
22824 | const parentParent = path.getParentNode(1);
|
22825 | return parentParent && parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" && parentParent.name.type === "JSXIdentifier" && parentParent.name.name === "css";
|
22826 | }
|
22827 | function isStyledIdentifier(node) {
|
22828 | return node.type === "Identifier" && node.name === "styled";
|
22829 | }
|
22830 | function isStyledExtend(node) {
|
22831 | return /^[A-Z]/.test(node.object.name) && node.property.name === "extend";
|
22832 | }
|
22833 | function isGraphQL(path) {
|
22834 | const node = path.getValue();
|
22835 | const parent = path.getParentNode();
|
22836 | return hasLanguageComment(node, "GraphQL") || parent && (parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && parent.tag.object.name === "graphql" && parent.tag.property.name === "experimental" || parent.tag.type === "Identifier" && (parent.tag.name === "gql" || parent.tag.name === "graphql")) || parent.type === "CallExpression" && parent.callee.type === "Identifier" && parent.callee.name === "graphql");
|
22837 | }
|
22838 | function hasLanguageComment(node, languageName) {
|
22839 | return hasComment(node, CommentCheckFlags.Block | CommentCheckFlags.Leading, ({
|
22840 | value
|
22841 | }) => value === ` ${languageName} `);
|
22842 | }
|
22843 | function isHtml(path) {
|
22844 | return hasLanguageComment(path.getValue(), "HTML") || path.match((node) => node.type === "TemplateLiteral", (node, name) => node.type === "TaggedTemplateExpression" && node.tag.type === "Identifier" && node.tag.name === "html" && name === "quasi");
|
22845 | }
|
22846 | function hasInvalidCookedValue({
|
22847 | quasis
|
22848 | }) {
|
22849 | return quasis.some(({
|
22850 | value: {
|
22851 | cooked
|
22852 | }
|
22853 | }) => cooked === null);
|
22854 | }
|
22855 | module2.exports = embed;
|
22856 | }
|
22857 | });
|
22858 | var require_clean = __commonJS2({
|
22859 | "src/language-js/clean.js"(exports2, module2) {
|
22860 | "use strict";
|
22861 | var isBlockComment = require_is_block_comment();
|
22862 | var ignoredProperties = new Set(["range", "raw", "comments", "leadingComments", "trailingComments", "innerComments", "extra", "start", "end", "loc", "flags", "errors", "tokens"]);
|
22863 | var removeTemplateElementsValue = (node) => {
|
22864 | for (const templateElement of node.quasis) {
|
22865 | delete templateElement.value;
|
22866 | }
|
22867 | };
|
22868 | function clean(ast, newObj, parent) {
|
22869 | if (ast.type === "Program") {
|
22870 | delete newObj.sourceType;
|
22871 | }
|
22872 | if (ast.type === "BigIntLiteral" || ast.type === "BigIntLiteralTypeAnnotation") {
|
22873 | if (newObj.value) {
|
22874 | newObj.value = newObj.value.toLowerCase();
|
22875 | }
|
22876 | }
|
22877 | if (ast.type === "BigIntLiteral" || ast.type === "Literal") {
|
22878 | if (newObj.bigint) {
|
22879 | newObj.bigint = newObj.bigint.toLowerCase();
|
22880 | }
|
22881 | }
|
22882 | if (ast.type === "DecimalLiteral") {
|
22883 | newObj.value = Number(newObj.value);
|
22884 | }
|
22885 | if (ast.type === "Literal" && newObj.decimal) {
|
22886 | newObj.decimal = Number(newObj.decimal);
|
22887 | }
|
22888 | if (ast.type === "EmptyStatement") {
|
22889 | return null;
|
22890 | }
|
22891 | if (ast.type === "JSXText") {
|
22892 | return null;
|
22893 | }
|
22894 | if (ast.type === "JSXExpressionContainer" && (ast.expression.type === "Literal" || ast.expression.type === "StringLiteral") && ast.expression.value === " ") {
|
22895 | return null;
|
22896 | }
|
22897 | if ((ast.type === "Property" || ast.type === "ObjectProperty" || ast.type === "MethodDefinition" || ast.type === "ClassProperty" || ast.type === "ClassMethod" || ast.type === "PropertyDefinition" || ast.type === "TSDeclareMethod" || ast.type === "TSPropertySignature" || ast.type === "ObjectTypeProperty") && typeof ast.key === "object" && ast.key && (ast.key.type === "Literal" || ast.key.type === "NumericLiteral" || ast.key.type === "StringLiteral" || ast.key.type === "Identifier")) {
|
22898 | delete newObj.key;
|
22899 | }
|
22900 | if (ast.type === "JSXElement" && ast.openingElement.name.name === "style" && ast.openingElement.attributes.some((attr) => attr.name.name === "jsx")) {
|
22901 | for (const {
|
22902 | type,
|
22903 | expression: expression2
|
22904 | } of newObj.children) {
|
22905 | if (type === "JSXExpressionContainer" && expression2.type === "TemplateLiteral") {
|
22906 | removeTemplateElementsValue(expression2);
|
22907 | }
|
22908 | }
|
22909 | }
|
22910 | if (ast.type === "JSXAttribute" && ast.name.name === "css" && ast.value.type === "JSXExpressionContainer" && ast.value.expression.type === "TemplateLiteral") {
|
22911 | removeTemplateElementsValue(newObj.value.expression);
|
22912 | }
|
22913 | if (ast.type === "JSXAttribute" && ast.value && ast.value.type === "Literal" && /["']|"|'/.test(ast.value.value)) {
|
22914 | newObj.value.value = newObj.value.value.replace(/["']|"|'/g, '"');
|
22915 | }
|
22916 | const expression = ast.expression || ast.callee;
|
22917 | if (ast.type === "Decorator" && expression.type === "CallExpression" && expression.callee.name === "Component" && expression.arguments.length === 1) {
|
22918 | const astProps = ast.expression.arguments[0].properties;
|
22919 | for (const [index, prop] of newObj.expression.arguments[0].properties.entries()) {
|
22920 | switch (astProps[index].key.name) {
|
22921 | case "styles":
|
22922 | if (prop.value.type === "ArrayExpression") {
|
22923 | removeTemplateElementsValue(prop.value.elements[0]);
|
22924 | }
|
22925 | break;
|
22926 | case "template":
|
22927 | if (prop.value.type === "TemplateLiteral") {
|
22928 | removeTemplateElementsValue(prop.value);
|
22929 | }
|
22930 | break;
|
22931 | }
|
22932 | }
|
22933 | }
|
22934 | if (ast.type === "TaggedTemplateExpression" && (ast.tag.type === "MemberExpression" || ast.tag.type === "Identifier" && (ast.tag.name === "gql" || ast.tag.name === "graphql" || ast.tag.name === "css" || ast.tag.name === "md" || ast.tag.name === "markdown" || ast.tag.name === "html") || ast.tag.type === "CallExpression")) {
|
22935 | removeTemplateElementsValue(newObj.quasi);
|
22936 | }
|
22937 | if (ast.type === "TemplateLiteral") {
|
22938 | var _ast$leadingComments;
|
22939 | const hasLanguageComment = (_ast$leadingComments = ast.leadingComments) === null || _ast$leadingComments === void 0 ? void 0 : _ast$leadingComments.some((comment) => isBlockComment(comment) && ["GraphQL", "HTML"].some((languageName) => comment.value === ` ${languageName} `));
|
22940 | if (hasLanguageComment || parent.type === "CallExpression" && parent.callee.name === "graphql" || !ast.leadingComments) {
|
22941 | removeTemplateElementsValue(newObj);
|
22942 | }
|
22943 | }
|
22944 | if (ast.type === "InterpreterDirective") {
|
22945 | newObj.value = newObj.value.trimEnd();
|
22946 | }
|
22947 | if ((ast.type === "TSIntersectionType" || ast.type === "TSUnionType") && ast.types.length === 1) {
|
22948 | return newObj.types[0];
|
22949 | }
|
22950 | }
|
22951 | clean.ignoredProperties = ignoredProperties;
|
22952 | module2.exports = clean;
|
22953 | }
|
22954 | });
|
22955 | var require_detect_newline = __commonJS2({
|
22956 | "node_modules/detect-newline/index.js"(exports2, module2) {
|
22957 | "use strict";
|
22958 | var detectNewline = (string) => {
|
22959 | if (typeof string !== "string") {
|
22960 | throw new TypeError("Expected a string");
|
22961 | }
|
22962 | const newlines = string.match(/(?:\r?\n)/g) || [];
|
22963 | if (newlines.length === 0) {
|
22964 | return;
|
22965 | }
|
22966 | const crlf = newlines.filter((newline) => newline === "\r\n").length;
|
22967 | const lf = newlines.length - crlf;
|
22968 | return crlf > lf ? "\r\n" : "\n";
|
22969 | };
|
22970 | module2.exports = detectNewline;
|
22971 | module2.exports.graceful = (string) => typeof string === "string" && detectNewline(string) || "\n";
|
22972 | }
|
22973 | });
|
22974 | var require_build = __commonJS2({
|
22975 | "node_modules/jest-docblock/build/index.js"(exports2) {
|
22976 | "use strict";
|
22977 | Object.defineProperty(exports2, "__esModule", {
|
22978 | value: true
|
22979 | });
|
22980 | exports2.extract = extract;
|
22981 | exports2.parse = parse;
|
22982 | exports2.parseWithComments = parseWithComments;
|
22983 | exports2.print = print;
|
22984 | exports2.strip = strip;
|
22985 | function _os() {
|
22986 | const data = require("os");
|
22987 | _os = function() {
|
22988 | return data;
|
22989 | };
|
22990 | return data;
|
22991 | }
|
22992 | function _detectNewline() {
|
22993 | const data = _interopRequireDefault(require_detect_newline());
|
22994 | _detectNewline = function() {
|
22995 | return data;
|
22996 | };
|
22997 | return data;
|
22998 | }
|
22999 | function _interopRequireDefault(obj) {
|
23000 | return obj && obj.__esModule ? obj : {
|
23001 | default: obj
|
23002 | };
|
23003 | }
|
23004 | var commentEndRe = /\*\/$/;
|
23005 | var commentStartRe = /^\/\*\*?/;
|
23006 | var docblockRe = /^\s*(\/\*\*?(.|\r?\n)*?\*\/)/;
|
23007 | var lineCommentRe = /(^|\s+)\/\/([^\r\n]*)/g;
|
23008 | var ltrimNewlineRe = /^(\r?\n)+/;
|
23009 | var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *(?![^@\r\n]*\/\/[^]*)([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
|
23010 | var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
|
23011 | var stringStartRe = /(\r?\n|^) *\* ?/g;
|
23012 | var STRING_ARRAY = [];
|
23013 | function extract(contents) {
|
23014 | const match = contents.match(docblockRe);
|
23015 | return match ? match[0].trimLeft() : "";
|
23016 | }
|
23017 | function strip(contents) {
|
23018 | const match = contents.match(docblockRe);
|
23019 | return match && match[0] ? contents.substring(match[0].length) : contents;
|
23020 | }
|
23021 | function parse(docblock) {
|
23022 | return parseWithComments(docblock).pragmas;
|
23023 | }
|
23024 | function parseWithComments(docblock) {
|
23025 | const line = (0, _detectNewline().default)(docblock) || _os().EOL;
|
23026 | docblock = docblock.replace(commentStartRe, "").replace(commentEndRe, "").replace(stringStartRe, "$1");
|
23027 | let prev = "";
|
23028 | while (prev !== docblock) {
|
23029 | prev = docblock;
|
23030 | docblock = docblock.replace(multilineRe, `${line}$1 $2${line}`);
|
23031 | }
|
23032 | docblock = docblock.replace(ltrimNewlineRe, "").trimRight();
|
23033 | const result = Object.create(null);
|
23034 | const comments = docblock.replace(propertyRe, "").replace(ltrimNewlineRe, "").trimRight();
|
23035 | let match;
|
23036 | while (match = propertyRe.exec(docblock)) {
|
23037 | const nextPragma = match[2].replace(lineCommentRe, "");
|
23038 | if (typeof result[match[1]] === "string" || Array.isArray(result[match[1]])) {
|
23039 | result[match[1]] = STRING_ARRAY.concat(result[match[1]], nextPragma);
|
23040 | } else {
|
23041 | result[match[1]] = nextPragma;
|
23042 | }
|
23043 | }
|
23044 | return {
|
23045 | comments,
|
23046 | pragmas: result
|
23047 | };
|
23048 | }
|
23049 | function print({
|
23050 | comments = "",
|
23051 | pragmas = {}
|
23052 | }) {
|
23053 | const line = (0, _detectNewline().default)(comments) || _os().EOL;
|
23054 | const head = "/**";
|
23055 | const start = " *";
|
23056 | const tail = " */";
|
23057 | const keys = Object.keys(pragmas);
|
23058 | const printedObject = keys.map((key) => printKeyValues(key, pragmas[key])).reduce((arr, next) => arr.concat(next), []).map((keyValue) => `${start} ${keyValue}${line}`).join("");
|
23059 | if (!comments) {
|
23060 | if (keys.length === 0) {
|
23061 | return "";
|
23062 | }
|
23063 | if (keys.length === 1 && !Array.isArray(pragmas[keys[0]])) {
|
23064 | const value = pragmas[keys[0]];
|
23065 | return `${head} ${printKeyValues(keys[0], value)[0]}${tail}`;
|
23066 | }
|
23067 | }
|
23068 | const printedComments = comments.split(line).map((textLine) => `${start} ${textLine}`).join(line) + line;
|
23069 | return head + line + (comments ? printedComments : "") + (comments && keys.length ? start + line : "") + printedObject + tail;
|
23070 | }
|
23071 | function printKeyValues(key, valueOrArray) {
|
23072 | return STRING_ARRAY.concat(valueOrArray).map((value) => `@${key} ${value}`.trim());
|
23073 | }
|
23074 | }
|
23075 | });
|
23076 | var require_get_shebang = __commonJS2({
|
23077 | "src/language-js/utils/get-shebang.js"(exports2, module2) {
|
23078 | "use strict";
|
23079 | function getShebang(text) {
|
23080 | if (!text.startsWith("#!")) {
|
23081 | return "";
|
23082 | }
|
23083 | const index = text.indexOf("\n");
|
23084 | if (index === -1) {
|
23085 | return text;
|
23086 | }
|
23087 | return text.slice(0, index);
|
23088 | }
|
23089 | module2.exports = getShebang;
|
23090 | }
|
23091 | });
|
23092 | var require_pragma = __commonJS2({
|
23093 | "src/language-js/pragma.js"(exports2, module2) {
|
23094 | "use strict";
|
23095 | var {
|
23096 | parseWithComments,
|
23097 | strip,
|
23098 | extract,
|
23099 | print
|
23100 | } = require_build();
|
23101 | var {
|
23102 | normalizeEndOfLine
|
23103 | } = require_end_of_line();
|
23104 | var getShebang = require_get_shebang();
|
23105 | function parseDocBlock(text) {
|
23106 | const shebang = getShebang(text);
|
23107 | if (shebang) {
|
23108 | text = text.slice(shebang.length + 1);
|
23109 | }
|
23110 | const docBlock = extract(text);
|
23111 | const {
|
23112 | pragmas,
|
23113 | comments
|
23114 | } = parseWithComments(docBlock);
|
23115 | return {
|
23116 | shebang,
|
23117 | text,
|
23118 | pragmas,
|
23119 | comments
|
23120 | };
|
23121 | }
|
23122 | function hasPragma(text) {
|
23123 | const pragmas = Object.keys(parseDocBlock(text).pragmas);
|
23124 | return pragmas.includes("prettier") || pragmas.includes("format");
|
23125 | }
|
23126 | function insertPragma(originalText) {
|
23127 | const {
|
23128 | shebang,
|
23129 | text,
|
23130 | pragmas,
|
23131 | comments
|
23132 | } = parseDocBlock(originalText);
|
23133 | const strippedText = strip(text);
|
23134 | const docBlock = print({
|
23135 | pragmas: Object.assign({
|
23136 | format: ""
|
23137 | }, pragmas),
|
23138 | comments: comments.trimStart()
|
23139 | });
|
23140 | return (shebang ? `${shebang}
|
23141 | ` : "") + normalizeEndOfLine(docBlock) + (strippedText.startsWith("\n") ? "\n" : "\n\n") + strippedText;
|
23142 | }
|
23143 | module2.exports = {
|
23144 | hasPragma,
|
23145 | insertPragma
|
23146 | };
|
23147 | }
|
23148 | });
|
23149 | var require_comments2 = __commonJS2({
|
23150 | "src/language-js/comments.js"(exports2, module2) {
|
23151 | "use strict";
|
23152 | var {
|
23153 | getLast,
|
23154 | hasNewline,
|
23155 | getNextNonSpaceNonCommentCharacterIndexWithStartIndex,
|
23156 | getNextNonSpaceNonCommentCharacter,
|
23157 | hasNewlineInRange,
|
23158 | addLeadingComment,
|
23159 | addTrailingComment,
|
23160 | addDanglingComment,
|
23161 | getNextNonSpaceNonCommentCharacterIndex,
|
23162 | isNonEmptyArray
|
23163 | } = require_util();
|
23164 | var {
|
23165 | getFunctionParameters,
|
23166 | isPrettierIgnoreComment,
|
23167 | isJsxNode,
|
23168 | hasFlowShorthandAnnotationComment,
|
23169 | hasFlowAnnotationComment,
|
23170 | hasIgnoreComment,
|
23171 | isCallLikeExpression,
|
23172 | getCallArguments,
|
23173 | isCallExpression,
|
23174 | isMemberExpression,
|
23175 | isObjectProperty,
|
23176 | isLineComment,
|
23177 | getComments,
|
23178 | CommentCheckFlags,
|
23179 | markerForIfWithoutBlockAndSameLineComment
|
23180 | } = require_utils7();
|
23181 | var {
|
23182 | locStart,
|
23183 | locEnd
|
23184 | } = require_loc();
|
23185 | var isBlockComment = require_is_block_comment();
|
23186 | function handleOwnLineComment(context) {
|
23187 | return [handleIgnoreComments, handleLastFunctionArgComments, handleMemberExpressionComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleForComments, handleUnionTypeComments, handleOnlyComments, handleModuleSpecifiersComments, handleAssignmentPatternComments, handleMethodNameComments, handleLabeledStatementComments, handleBreakAndContinueStatementComments].some((fn) => fn(context));
|
23188 | }
|
23189 | function handleEndOfLineComment(context) {
|
23190 | return [handleClosureTypeCastComments, handleLastFunctionArgComments, handleConditionalExpressionComments, handleModuleSpecifiersComments, handleIfStatementComments, handleWhileComments, handleTryStatementComments, handleClassComments, handleLabeledStatementComments, handleCallExpressionComments, handlePropertyComments, handleOnlyComments, handleVariableDeclaratorComments, handleBreakAndContinueStatementComments, handleSwitchDefaultCaseComments].some((fn) => fn(context));
|
23191 | }
|
23192 | function handleRemainingComment(context) {
|
23193 | return [handleIgnoreComments, handleIfStatementComments, handleWhileComments, handleObjectPropertyAssignment, handleCommentInEmptyParens, handleMethodNameComments, handleOnlyComments, handleCommentAfterArrowParams, handleFunctionNameComments, handleTSMappedTypeComments, handleBreakAndContinueStatementComments, handleTSFunctionTrailingComments].some((fn) => fn(context));
|
23194 | }
|
23195 | function addBlockStatementFirstComment(node, comment) {
|
23196 | const firstNonEmptyNode = (node.body || node.properties).find(({
|
23197 | type
|
23198 | }) => type !== "EmptyStatement");
|
23199 | if (firstNonEmptyNode) {
|
23200 | addLeadingComment(firstNonEmptyNode, comment);
|
23201 | } else {
|
23202 | addDanglingComment(node, comment);
|
23203 | }
|
23204 | }
|
23205 | function addBlockOrNotComment(node, comment) {
|
23206 | if (node.type === "BlockStatement") {
|
23207 | addBlockStatementFirstComment(node, comment);
|
23208 | } else {
|
23209 | addLeadingComment(node, comment);
|
23210 | }
|
23211 | }
|
23212 | function handleClosureTypeCastComments({
|
23213 | comment,
|
23214 | followingNode
|
23215 | }) {
|
23216 | if (followingNode && isTypeCastComment(comment)) {
|
23217 | addLeadingComment(followingNode, comment);
|
23218 | return true;
|
23219 | }
|
23220 | return false;
|
23221 | }
|
23222 | function handleIfStatementComments({
|
23223 | comment,
|
23224 | precedingNode,
|
23225 | enclosingNode,
|
23226 | followingNode,
|
23227 | text
|
23228 | }) {
|
23229 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "IfStatement" || !followingNode) {
|
23230 | return false;
|
23231 | }
|
23232 | const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
|
23233 | if (nextCharacter === ")") {
|
23234 | addTrailingComment(precedingNode, comment);
|
23235 | return true;
|
23236 | }
|
23237 | if (precedingNode === enclosingNode.consequent && followingNode === enclosingNode.alternate) {
|
23238 | if (precedingNode.type === "BlockStatement") {
|
23239 | addTrailingComment(precedingNode, comment);
|
23240 | } else {
|
23241 | const isSingleLineComment = comment.type === "SingleLine" || comment.loc.start.line === comment.loc.end.line;
|
23242 | const isSameLineComment = comment.loc.start.line === precedingNode.loc.start.line;
|
23243 | if (isSingleLineComment && isSameLineComment) {
|
23244 | addDanglingComment(precedingNode, comment, markerForIfWithoutBlockAndSameLineComment);
|
23245 | } else {
|
23246 | addDanglingComment(enclosingNode, comment);
|
23247 | }
|
23248 | }
|
23249 | return true;
|
23250 | }
|
23251 | if (followingNode.type === "BlockStatement") {
|
23252 | addBlockStatementFirstComment(followingNode, comment);
|
23253 | return true;
|
23254 | }
|
23255 | if (followingNode.type === "IfStatement") {
|
23256 | addBlockOrNotComment(followingNode.consequent, comment);
|
23257 | return true;
|
23258 | }
|
23259 | if (enclosingNode.consequent === followingNode) {
|
23260 | addLeadingComment(followingNode, comment);
|
23261 | return true;
|
23262 | }
|
23263 | return false;
|
23264 | }
|
23265 | function handleWhileComments({
|
23266 | comment,
|
23267 | precedingNode,
|
23268 | enclosingNode,
|
23269 | followingNode,
|
23270 | text
|
23271 | }) {
|
23272 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "WhileStatement" || !followingNode) {
|
23273 | return false;
|
23274 | }
|
23275 | const nextCharacter = getNextNonSpaceNonCommentCharacter(text, comment, locEnd);
|
23276 | if (nextCharacter === ")") {
|
23277 | addTrailingComment(precedingNode, comment);
|
23278 | return true;
|
23279 | }
|
23280 | if (followingNode.type === "BlockStatement") {
|
23281 | addBlockStatementFirstComment(followingNode, comment);
|
23282 | return true;
|
23283 | }
|
23284 | if (enclosingNode.body === followingNode) {
|
23285 | addLeadingComment(followingNode, comment);
|
23286 | return true;
|
23287 | }
|
23288 | return false;
|
23289 | }
|
23290 | function handleTryStatementComments({
|
23291 | comment,
|
23292 | precedingNode,
|
23293 | enclosingNode,
|
23294 | followingNode
|
23295 | }) {
|
23296 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TryStatement" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "CatchClause" || !followingNode) {
|
23297 | return false;
|
23298 | }
|
23299 | if (enclosingNode.type === "CatchClause" && precedingNode) {
|
23300 | addTrailingComment(precedingNode, comment);
|
23301 | return true;
|
23302 | }
|
23303 | if (followingNode.type === "BlockStatement") {
|
23304 | addBlockStatementFirstComment(followingNode, comment);
|
23305 | return true;
|
23306 | }
|
23307 | if (followingNode.type === "TryStatement") {
|
23308 | addBlockOrNotComment(followingNode.finalizer, comment);
|
23309 | return true;
|
23310 | }
|
23311 | if (followingNode.type === "CatchClause") {
|
23312 | addBlockOrNotComment(followingNode.body, comment);
|
23313 | return true;
|
23314 | }
|
23315 | return false;
|
23316 | }
|
23317 | function handleMemberExpressionComments({
|
23318 | comment,
|
23319 | enclosingNode,
|
23320 | followingNode
|
23321 | }) {
|
23322 | if (isMemberExpression(enclosingNode) && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Identifier") {
|
23323 | addLeadingComment(enclosingNode, comment);
|
23324 | return true;
|
23325 | }
|
23326 | return false;
|
23327 | }
|
23328 | function handleConditionalExpressionComments({
|
23329 | comment,
|
23330 | precedingNode,
|
23331 | enclosingNode,
|
23332 | followingNode,
|
23333 | text
|
23334 | }) {
|
23335 | const isSameLineAsPrecedingNode = precedingNode && !hasNewlineInRange(text, locEnd(precedingNode), locStart(comment));
|
23336 | if ((!precedingNode || !isSameLineAsPrecedingNode) && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ConditionalExpression" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSConditionalType") && followingNode) {
|
23337 | addLeadingComment(followingNode, comment);
|
23338 | return true;
|
23339 | }
|
23340 | return false;
|
23341 | }
|
23342 | function handleObjectPropertyAssignment({
|
23343 | comment,
|
23344 | precedingNode,
|
23345 | enclosingNode
|
23346 | }) {
|
23347 | if (isObjectProperty(enclosingNode) && enclosingNode.shorthand && enclosingNode.key === precedingNode && enclosingNode.value.type === "AssignmentPattern") {
|
23348 | addTrailingComment(enclosingNode.value.left, comment);
|
23349 | return true;
|
23350 | }
|
23351 | return false;
|
23352 | }
|
23353 | var classLikeNodeTypes = new Set(["ClassDeclaration", "ClassExpression", "DeclareClass", "DeclareInterface", "InterfaceDeclaration", "TSInterfaceDeclaration"]);
|
23354 | function handleClassComments({
|
23355 | comment,
|
23356 | precedingNode,
|
23357 | enclosingNode,
|
23358 | followingNode
|
23359 | }) {
|
23360 | if (classLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
|
23361 | if (isNonEmptyArray(enclosingNode.decorators) && !(followingNode && followingNode.type === "Decorator")) {
|
23362 | addTrailingComment(getLast(enclosingNode.decorators), comment);
|
23363 | return true;
|
23364 | }
|
23365 | if (enclosingNode.body && followingNode === enclosingNode.body) {
|
23366 | addBlockStatementFirstComment(enclosingNode.body, comment);
|
23367 | return true;
|
23368 | }
|
23369 | if (followingNode) {
|
23370 | if (enclosingNode.superClass && followingNode === enclosingNode.superClass && precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters)) {
|
23371 | addTrailingComment(precedingNode, comment);
|
23372 | return true;
|
23373 | }
|
23374 | for (const prop of ["implements", "extends", "mixins"]) {
|
23375 | if (enclosingNode[prop] && followingNode === enclosingNode[prop][0]) {
|
23376 | if (precedingNode && (precedingNode === enclosingNode.id || precedingNode === enclosingNode.typeParameters || precedingNode === enclosingNode.superClass)) {
|
23377 | addTrailingComment(precedingNode, comment);
|
23378 | } else {
|
23379 | addDanglingComment(enclosingNode, comment, prop);
|
23380 | }
|
23381 | return true;
|
23382 | }
|
23383 | }
|
23384 | }
|
23385 | }
|
23386 | return false;
|
23387 | }
|
23388 | var propertyLikeNodeTypes = new Set(["ClassMethod", "ClassProperty", "PropertyDefinition", "TSAbstractPropertyDefinition", "TSAbstractMethodDefinition", "TSDeclareMethod", "MethodDefinition"]);
|
23389 | function handleMethodNameComments({
|
23390 | comment,
|
23391 | precedingNode,
|
23392 | enclosingNode,
|
23393 | text
|
23394 | }) {
|
23395 | if (enclosingNode && precedingNode && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === "(" && (enclosingNode.type === "Property" || enclosingNode.type === "TSDeclareMethod" || enclosingNode.type === "TSAbstractMethodDefinition") && precedingNode.type === "Identifier" && enclosingNode.key === precedingNode && getNextNonSpaceNonCommentCharacter(text, precedingNode, locEnd) !== ":") {
|
23396 | addTrailingComment(precedingNode, comment);
|
23397 | return true;
|
23398 | }
|
23399 | if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Decorator" && propertyLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
|
23400 | addTrailingComment(precedingNode, comment);
|
23401 | return true;
|
23402 | }
|
23403 | return false;
|
23404 | }
|
23405 | var functionLikeNodeTypes = new Set(["FunctionDeclaration", "FunctionExpression", "ClassMethod", "MethodDefinition", "ObjectMethod"]);
|
23406 | function handleFunctionNameComments({
|
23407 | comment,
|
23408 | precedingNode,
|
23409 | enclosingNode,
|
23410 | text
|
23411 | }) {
|
23412 | if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== "(") {
|
23413 | return false;
|
23414 | }
|
23415 | if (precedingNode && functionLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type)) {
|
23416 | addTrailingComment(precedingNode, comment);
|
23417 | return true;
|
23418 | }
|
23419 | return false;
|
23420 | }
|
23421 | function handleCommentAfterArrowParams({
|
23422 | comment,
|
23423 | enclosingNode,
|
23424 | text
|
23425 | }) {
|
23426 | if (!((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ArrowFunctionExpression")) {
|
23427 | return false;
|
23428 | }
|
23429 | const index = getNextNonSpaceNonCommentCharacterIndex(text, comment, locEnd);
|
23430 | if (index !== false && text.slice(index, index + 2) === "=>") {
|
23431 | addDanglingComment(enclosingNode, comment);
|
23432 | return true;
|
23433 | }
|
23434 | return false;
|
23435 | }
|
23436 | function handleCommentInEmptyParens({
|
23437 | comment,
|
23438 | enclosingNode,
|
23439 | text
|
23440 | }) {
|
23441 | if (getNextNonSpaceNonCommentCharacter(text, comment, locEnd) !== ")") {
|
23442 | return false;
|
23443 | }
|
23444 | if (enclosingNode && (isRealFunctionLikeNode(enclosingNode) && getFunctionParameters(enclosingNode).length === 0 || isCallLikeExpression(enclosingNode) && getCallArguments(enclosingNode).length === 0)) {
|
23445 | addDanglingComment(enclosingNode, comment);
|
23446 | return true;
|
23447 | }
|
23448 | if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "MethodDefinition" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getFunctionParameters(enclosingNode.value).length === 0) {
|
23449 | addDanglingComment(enclosingNode.value, comment);
|
23450 | return true;
|
23451 | }
|
23452 | return false;
|
23453 | }
|
23454 | function handleLastFunctionArgComments({
|
23455 | comment,
|
23456 | precedingNode,
|
23457 | enclosingNode,
|
23458 | followingNode,
|
23459 | text
|
23460 | }) {
|
23461 | if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "FunctionTypeParam" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionTypeAnnotation" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) !== "FunctionTypeParam") {
|
23462 | addTrailingComment(precedingNode, comment);
|
23463 | return true;
|
23464 | }
|
23465 | if (((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "Identifier" || (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "AssignmentPattern") && enclosingNode && isRealFunctionLikeNode(enclosingNode) && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ")") {
|
23466 | addTrailingComment(precedingNode, comment);
|
23467 | return true;
|
23468 | }
|
23469 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "FunctionDeclaration" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "BlockStatement") {
|
23470 | const functionParamRightParenIndex = (() => {
|
23471 | const parameters = getFunctionParameters(enclosingNode);
|
23472 | if (parameters.length > 0) {
|
23473 | return getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(getLast(parameters)));
|
23474 | }
|
23475 | const functionParamLeftParenIndex = getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, locEnd(enclosingNode.id));
|
23476 | return functionParamLeftParenIndex !== false && getNextNonSpaceNonCommentCharacterIndexWithStartIndex(text, functionParamLeftParenIndex + 1);
|
23477 | })();
|
23478 | if (locStart(comment) > functionParamRightParenIndex) {
|
23479 | addBlockStatementFirstComment(followingNode, comment);
|
23480 | return true;
|
23481 | }
|
23482 | }
|
23483 | return false;
|
23484 | }
|
23485 | function handleLabeledStatementComments({
|
23486 | comment,
|
23487 | enclosingNode
|
23488 | }) {
|
23489 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "LabeledStatement") {
|
23490 | addLeadingComment(enclosingNode, comment);
|
23491 | return true;
|
23492 | }
|
23493 | return false;
|
23494 | }
|
23495 | function handleBreakAndContinueStatementComments({
|
23496 | comment,
|
23497 | enclosingNode
|
23498 | }) {
|
23499 | if (((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ContinueStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "BreakStatement") && !enclosingNode.label) {
|
23500 | addTrailingComment(enclosingNode, comment);
|
23501 | return true;
|
23502 | }
|
23503 | return false;
|
23504 | }
|
23505 | function handleCallExpressionComments({
|
23506 | comment,
|
23507 | precedingNode,
|
23508 | enclosingNode
|
23509 | }) {
|
23510 | if (isCallExpression(enclosingNode) && precedingNode && enclosingNode.callee === precedingNode && enclosingNode.arguments.length > 0) {
|
23511 | addLeadingComment(enclosingNode.arguments[0], comment);
|
23512 | return true;
|
23513 | }
|
23514 | return false;
|
23515 | }
|
23516 | function handleUnionTypeComments({
|
23517 | comment,
|
23518 | precedingNode,
|
23519 | enclosingNode,
|
23520 | followingNode
|
23521 | }) {
|
23522 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "UnionTypeAnnotation" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSUnionType") {
|
23523 | if (isPrettierIgnoreComment(comment)) {
|
23524 | followingNode.prettierIgnore = true;
|
23525 | comment.unignore = true;
|
23526 | }
|
23527 | if (precedingNode) {
|
23528 | addTrailingComment(precedingNode, comment);
|
23529 | return true;
|
23530 | }
|
23531 | return false;
|
23532 | }
|
23533 | if (((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "UnionTypeAnnotation" || (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSUnionType") && isPrettierIgnoreComment(comment)) {
|
23534 | followingNode.types[0].prettierIgnore = true;
|
23535 | comment.unignore = true;
|
23536 | }
|
23537 | return false;
|
23538 | }
|
23539 | function handlePropertyComments({
|
23540 | comment,
|
23541 | enclosingNode
|
23542 | }) {
|
23543 | if (isObjectProperty(enclosingNode)) {
|
23544 | addLeadingComment(enclosingNode, comment);
|
23545 | return true;
|
23546 | }
|
23547 | return false;
|
23548 | }
|
23549 | function handleOnlyComments({
|
23550 | comment,
|
23551 | enclosingNode,
|
23552 | followingNode,
|
23553 | ast,
|
23554 | isLastComment
|
23555 | }) {
|
23556 | if (ast && ast.body && ast.body.length === 0) {
|
23557 | if (isLastComment) {
|
23558 | addDanglingComment(ast, comment);
|
23559 | } else {
|
23560 | addLeadingComment(ast, comment);
|
23561 | }
|
23562 | return true;
|
23563 | }
|
23564 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "Program" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.body.length) === 0 && !isNonEmptyArray(enclosingNode.directives)) {
|
23565 | if (isLastComment) {
|
23566 | addDanglingComment(enclosingNode, comment);
|
23567 | } else {
|
23568 | addLeadingComment(enclosingNode, comment);
|
23569 | }
|
23570 | return true;
|
23571 | }
|
23572 | if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "Program" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.body.length) === 0 && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ModuleExpression") {
|
23573 | addDanglingComment(followingNode, comment);
|
23574 | return true;
|
23575 | }
|
23576 | return false;
|
23577 | }
|
23578 | function handleForComments({
|
23579 | comment,
|
23580 | enclosingNode
|
23581 | }) {
|
23582 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForInStatement" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ForOfStatement") {
|
23583 | addLeadingComment(enclosingNode, comment);
|
23584 | return true;
|
23585 | }
|
23586 | return false;
|
23587 | }
|
23588 | function handleModuleSpecifiersComments({
|
23589 | comment,
|
23590 | precedingNode,
|
23591 | enclosingNode,
|
23592 | text
|
23593 | }) {
|
23594 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportSpecifier" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportSpecifier") {
|
23595 | addLeadingComment(enclosingNode, comment);
|
23596 | return true;
|
23597 | }
|
23598 | const isImportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ImportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ImportDeclaration";
|
23599 | const isExportDeclaration = (precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "ExportSpecifier" && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "ExportNamedDeclaration";
|
23600 | if ((isImportDeclaration || isExportDeclaration) && hasNewline(text, locEnd(comment))) {
|
23601 | addTrailingComment(precedingNode, comment);
|
23602 | return true;
|
23603 | }
|
23604 | return false;
|
23605 | }
|
23606 | function handleAssignmentPatternComments({
|
23607 | comment,
|
23608 | enclosingNode
|
23609 | }) {
|
23610 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "AssignmentPattern") {
|
23611 | addLeadingComment(enclosingNode, comment);
|
23612 | return true;
|
23613 | }
|
23614 | return false;
|
23615 | }
|
23616 | var assignmentLikeNodeTypes = new Set(["VariableDeclarator", "AssignmentExpression", "TypeAlias", "TSTypeAliasDeclaration"]);
|
23617 | var complexExprNodeTypes = new Set(["ObjectExpression", "ArrayExpression", "TemplateLiteral", "TaggedTemplateExpression", "ObjectTypeAnnotation", "TSTypeLiteral"]);
|
23618 | function handleVariableDeclaratorComments({
|
23619 | comment,
|
23620 | enclosingNode,
|
23621 | followingNode
|
23622 | }) {
|
23623 | if (assignmentLikeNodeTypes.has(enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) && followingNode && (complexExprNodeTypes.has(followingNode.type) || isBlockComment(comment))) {
|
23624 | addLeadingComment(followingNode, comment);
|
23625 | return true;
|
23626 | }
|
23627 | return false;
|
23628 | }
|
23629 | function handleTSFunctionTrailingComments({
|
23630 | comment,
|
23631 | enclosingNode,
|
23632 | followingNode,
|
23633 | text
|
23634 | }) {
|
23635 | if (!followingNode && ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMethodSignature" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSDeclareFunction" || (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSAbstractMethodDefinition") && getNextNonSpaceNonCommentCharacter(text, comment, locEnd) === ";") {
|
23636 | addTrailingComment(enclosingNode, comment);
|
23637 | return true;
|
23638 | }
|
23639 | return false;
|
23640 | }
|
23641 | function handleIgnoreComments({
|
23642 | comment,
|
23643 | enclosingNode,
|
23644 | followingNode
|
23645 | }) {
|
23646 | if (isPrettierIgnoreComment(comment) && (enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "TSMappedType" && (followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.constraint) {
|
23647 | enclosingNode.prettierIgnore = true;
|
23648 | comment.unignore = true;
|
23649 | return true;
|
23650 | }
|
23651 | }
|
23652 | function handleTSMappedTypeComments({
|
23653 | comment,
|
23654 | precedingNode,
|
23655 | enclosingNode,
|
23656 | followingNode
|
23657 | }) {
|
23658 | if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) !== "TSMappedType") {
|
23659 | return false;
|
23660 | }
|
23661 | if ((followingNode === null || followingNode === void 0 ? void 0 : followingNode.type) === "TSTypeParameter" && followingNode.name) {
|
23662 | addLeadingComment(followingNode.name, comment);
|
23663 | return true;
|
23664 | }
|
23665 | if ((precedingNode === null || precedingNode === void 0 ? void 0 : precedingNode.type) === "TSTypeParameter" && precedingNode.constraint) {
|
23666 | addTrailingComment(precedingNode.constraint, comment);
|
23667 | return true;
|
23668 | }
|
23669 | return false;
|
23670 | }
|
23671 | function handleSwitchDefaultCaseComments({
|
23672 | comment,
|
23673 | enclosingNode,
|
23674 | followingNode
|
23675 | }) {
|
23676 | if (!enclosingNode || enclosingNode.type !== "SwitchCase" || enclosingNode.test) {
|
23677 | return false;
|
23678 | }
|
23679 | if (followingNode.type === "BlockStatement" && isLineComment(comment)) {
|
23680 | addBlockStatementFirstComment(followingNode, comment);
|
23681 | } else {
|
23682 | addDanglingComment(enclosingNode, comment);
|
23683 | }
|
23684 | return true;
|
23685 | }
|
23686 | function isRealFunctionLikeNode(node) {
|
23687 | return node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration" || node.type === "ObjectMethod" || node.type === "ClassMethod" || node.type === "TSDeclareFunction" || node.type === "TSCallSignatureDeclaration" || node.type === "TSConstructSignatureDeclaration" || node.type === "TSMethodSignature" || node.type === "TSConstructorType" || node.type === "TSFunctionType" || node.type === "TSDeclareMethod";
|
23688 | }
|
23689 | function getCommentChildNodes(node, options) {
|
23690 | if ((options.parser === "typescript" || options.parser === "flow" || options.parser === "acorn" || options.parser === "espree" || options.parser === "meriyah" || options.parser === "__babel_estree") && node.type === "MethodDefinition" && node.value && node.value.type === "FunctionExpression" && getFunctionParameters(node.value).length === 0 && !node.value.returnType && !isNonEmptyArray(node.value.typeParameters) && node.value.body) {
|
23691 | return [...node.decorators || [], node.key, node.value.body];
|
23692 | }
|
23693 | }
|
23694 | function isTypeCastComment(comment) {
|
23695 | return isBlockComment(comment) && comment.value[0] === "*" && /@type\b/.test(comment.value);
|
23696 | }
|
23697 | function willPrintOwnComments(path) {
|
23698 | const node = path.getValue();
|
23699 | const parent = path.getParentNode();
|
23700 | const hasFlowAnnotations = (node2) => hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Leading)) || hasFlowAnnotationComment(getComments(node2, CommentCheckFlags.Trailing));
|
23701 | return (node && (isJsxNode(node) || hasFlowShorthandAnnotationComment(node) || isCallExpression(parent) && hasFlowAnnotations(node)) || parent && (parent.type === "JSXSpreadAttribute" || parent.type === "JSXSpreadChild" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || (parent.type === "ClassDeclaration" || parent.type === "ClassExpression") && parent.superClass === node)) && (!hasIgnoreComment(path) || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType");
|
23702 | }
|
23703 | module2.exports = {
|
23704 | handleOwnLineComment,
|
23705 | handleEndOfLineComment,
|
23706 | handleRemainingComment,
|
23707 | isTypeCastComment,
|
23708 | getCommentChildNodes,
|
23709 | willPrintOwnComments
|
23710 | };
|
23711 | }
|
23712 | });
|
23713 | var require_needs_parens = __commonJS2({
|
23714 | "src/language-js/needs-parens.js"(exports2, module2) {
|
23715 | "use strict";
|
23716 | var getLast = require_get_last();
|
23717 | var isNonEmptyArray = require_is_non_empty_array();
|
23718 | var {
|
23719 | getFunctionParameters,
|
23720 | getLeftSidePathName,
|
23721 | hasFlowShorthandAnnotationComment,
|
23722 | hasNakedLeftSide,
|
23723 | hasNode,
|
23724 | isBitwiseOperator,
|
23725 | startsWithNoLookaheadToken,
|
23726 | shouldFlatten,
|
23727 | getPrecedence,
|
23728 | isCallExpression,
|
23729 | isMemberExpression,
|
23730 | isObjectProperty,
|
23731 | isTSTypeExpression
|
23732 | } = require_utils7();
|
23733 | function needsParens(path, options) {
|
23734 | const parent = path.getParentNode();
|
23735 | if (!parent) {
|
23736 | return false;
|
23737 | }
|
23738 | const name = path.getName();
|
23739 | const node = path.getNode();
|
23740 | if (options.__isInHtmlInterpolation && !options.bracketSpacing && endsWithRightBracket(node) && isFollowedByRightBracket(path)) {
|
23741 | return true;
|
23742 | }
|
23743 | if (isStatement(node)) {
|
23744 | return false;
|
23745 | }
|
23746 | if (options.parser !== "flow" && hasFlowShorthandAnnotationComment(path.getValue())) {
|
23747 | return true;
|
23748 | }
|
23749 | if (node.type === "Identifier") {
|
23750 | if (node.extra && node.extra.parenthesized && /^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(node.name)) {
|
23751 | return true;
|
23752 | }
|
23753 | if (name === "left" && node.name === "async" && parent.type === "ForOfStatement" && !parent.await) {
|
23754 | return true;
|
23755 | }
|
23756 | return false;
|
23757 | }
|
23758 | switch (parent.type) {
|
23759 | case "ParenthesizedExpression":
|
23760 | return false;
|
23761 | case "ClassDeclaration":
|
23762 | case "ClassExpression": {
|
23763 | if (name === "superClass" && (node.type === "ArrowFunctionExpression" || node.type === "AssignmentExpression" || node.type === "AwaitExpression" || node.type === "BinaryExpression" || node.type === "ConditionalExpression" || node.type === "LogicalExpression" || node.type === "NewExpression" || node.type === "ObjectExpression" || node.type === "SequenceExpression" || node.type === "TaggedTemplateExpression" || node.type === "UnaryExpression" || node.type === "UpdateExpression" || node.type === "YieldExpression" || node.type === "TSNonNullExpression")) {
|
23764 | return true;
|
23765 | }
|
23766 | break;
|
23767 | }
|
23768 | case "ExportDefaultDeclaration": {
|
23769 | return shouldWrapFunctionForExportDefault(path, options) || node.type === "SequenceExpression";
|
23770 | }
|
23771 | case "Decorator": {
|
23772 | if (name === "expression") {
|
23773 | let hasCallExpression = false;
|
23774 | let hasMemberExpression = false;
|
23775 | let current = node;
|
23776 | while (current) {
|
23777 | switch (current.type) {
|
23778 | case "MemberExpression":
|
23779 | hasMemberExpression = true;
|
23780 | current = current.object;
|
23781 | break;
|
23782 | case "CallExpression":
|
23783 | if (hasMemberExpression || hasCallExpression) {
|
23784 | return options.parser !== "typescript";
|
23785 | }
|
23786 | hasCallExpression = true;
|
23787 | current = current.callee;
|
23788 | break;
|
23789 | case "Identifier":
|
23790 | return false;
|
23791 | case "TaggedTemplateExpression":
|
23792 | return options.parser !== "typescript";
|
23793 | default:
|
23794 | return true;
|
23795 | }
|
23796 | }
|
23797 | return true;
|
23798 | }
|
23799 | break;
|
23800 | }
|
23801 | case "ExpressionStatement": {
|
23802 | if (startsWithNoLookaheadToken(node, true)) {
|
23803 | return true;
|
23804 | }
|
23805 | break;
|
23806 | }
|
23807 | case "ArrowFunctionExpression": {
|
23808 | if (name === "body" && node.type !== "SequenceExpression" && startsWithNoLookaheadToken(node, false)) {
|
23809 | return true;
|
23810 | }
|
23811 | break;
|
23812 | }
|
23813 | }
|
23814 | switch (node.type) {
|
23815 | case "UpdateExpression":
|
23816 | if (parent.type === "UnaryExpression") {
|
23817 | return node.prefix && (node.operator === "++" && parent.operator === "+" || node.operator === "--" && parent.operator === "-");
|
23818 | }
|
23819 | case "UnaryExpression":
|
23820 | switch (parent.type) {
|
23821 | case "UnaryExpression":
|
23822 | return node.operator === parent.operator && (node.operator === "+" || node.operator === "-");
|
23823 | case "BindExpression":
|
23824 | return true;
|
23825 | case "MemberExpression":
|
23826 | case "OptionalMemberExpression":
|
23827 | return name === "object";
|
23828 | case "TaggedTemplateExpression":
|
23829 | return true;
|
23830 | case "NewExpression":
|
23831 | case "CallExpression":
|
23832 | case "OptionalCallExpression":
|
23833 | return name === "callee";
|
23834 | case "BinaryExpression":
|
23835 | return name === "left" && parent.operator === "**";
|
23836 | case "TSNonNullExpression":
|
23837 | return true;
|
23838 | default:
|
23839 | return false;
|
23840 | }
|
23841 | case "BinaryExpression": {
|
23842 | if (parent.type === "UpdateExpression") {
|
23843 | return true;
|
23844 | }
|
23845 | if (node.operator === "in" && isPathInForStatementInitializer(path)) {
|
23846 | return true;
|
23847 | }
|
23848 | if (node.operator === "|>" && node.extra && node.extra.parenthesized) {
|
23849 | const grandParent = path.getParentNode(1);
|
23850 | if (grandParent.type === "BinaryExpression" && grandParent.operator === "|>") {
|
23851 | return true;
|
23852 | }
|
23853 | }
|
23854 | }
|
23855 | case "TSTypeAssertion":
|
23856 | case "TSAsExpression":
|
23857 | case "TSSatisfiesExpression":
|
23858 | case "LogicalExpression":
|
23859 | switch (parent.type) {
|
23860 | case "TSSatisfiesExpression":
|
23861 | case "TSAsExpression":
|
23862 | return !isTSTypeExpression(node);
|
23863 | case "ConditionalExpression":
|
23864 | return isTSTypeExpression(node);
|
23865 | case "CallExpression":
|
23866 | case "NewExpression":
|
23867 | case "OptionalCallExpression":
|
23868 | return name === "callee";
|
23869 | case "ClassExpression":
|
23870 | case "ClassDeclaration":
|
23871 | return name === "superClass";
|
23872 | case "TSTypeAssertion":
|
23873 | case "TaggedTemplateExpression":
|
23874 | case "UnaryExpression":
|
23875 | case "JSXSpreadAttribute":
|
23876 | case "SpreadElement":
|
23877 | case "SpreadProperty":
|
23878 | case "BindExpression":
|
23879 | case "AwaitExpression":
|
23880 | case "TSNonNullExpression":
|
23881 | case "UpdateExpression":
|
23882 | return true;
|
23883 | case "MemberExpression":
|
23884 | case "OptionalMemberExpression":
|
23885 | return name === "object";
|
23886 | case "AssignmentExpression":
|
23887 | case "AssignmentPattern":
|
23888 | return name === "left" && (node.type === "TSTypeAssertion" || isTSTypeExpression(node));
|
23889 | case "LogicalExpression":
|
23890 | if (node.type === "LogicalExpression") {
|
23891 | return parent.operator !== node.operator;
|
23892 | }
|
23893 | case "BinaryExpression": {
|
23894 | const {
|
23895 | operator,
|
23896 | type
|
23897 | } = node;
|
23898 | if (!operator && type !== "TSTypeAssertion") {
|
23899 | return true;
|
23900 | }
|
23901 | const precedence = getPrecedence(operator);
|
23902 | const parentOperator = parent.operator;
|
23903 | const parentPrecedence = getPrecedence(parentOperator);
|
23904 | if (parentPrecedence > precedence) {
|
23905 | return true;
|
23906 | }
|
23907 | if (name === "right" && parentPrecedence === precedence) {
|
23908 | return true;
|
23909 | }
|
23910 | if (parentPrecedence === precedence && !shouldFlatten(parentOperator, operator)) {
|
23911 | return true;
|
23912 | }
|
23913 | if (parentPrecedence < precedence && operator === "%") {
|
23914 | return parentOperator === "+" || parentOperator === "-";
|
23915 | }
|
23916 | if (isBitwiseOperator(parentOperator)) {
|
23917 | return true;
|
23918 | }
|
23919 | return false;
|
23920 | }
|
23921 | default:
|
23922 | return false;
|
23923 | }
|
23924 | case "SequenceExpression":
|
23925 | switch (parent.type) {
|
23926 | case "ReturnStatement":
|
23927 | return false;
|
23928 | case "ForStatement":
|
23929 | return false;
|
23930 | case "ExpressionStatement":
|
23931 | return name !== "expression";
|
23932 | case "ArrowFunctionExpression":
|
23933 | return name !== "body";
|
23934 | default:
|
23935 | return true;
|
23936 | }
|
23937 | case "YieldExpression":
|
23938 | if (parent.type === "UnaryExpression" || parent.type === "AwaitExpression" || isTSTypeExpression(parent) || parent.type === "TSNonNullExpression") {
|
23939 | return true;
|
23940 | }
|
23941 | case "AwaitExpression":
|
23942 | switch (parent.type) {
|
23943 | case "TaggedTemplateExpression":
|
23944 | case "UnaryExpression":
|
23945 | case "LogicalExpression":
|
23946 | case "SpreadElement":
|
23947 | case "SpreadProperty":
|
23948 | case "TSAsExpression":
|
23949 | case "TSSatisfiesExpression":
|
23950 | case "TSNonNullExpression":
|
23951 | case "BindExpression":
|
23952 | return true;
|
23953 | case "MemberExpression":
|
23954 | case "OptionalMemberExpression":
|
23955 | return name === "object";
|
23956 | case "NewExpression":
|
23957 | case "CallExpression":
|
23958 | case "OptionalCallExpression":
|
23959 | return name === "callee";
|
23960 | case "ConditionalExpression":
|
23961 | return name === "test";
|
23962 | case "BinaryExpression": {
|
23963 | if (!node.argument && parent.operator === "|>") {
|
23964 | return false;
|
23965 | }
|
23966 | return true;
|
23967 | }
|
23968 | default:
|
23969 | return false;
|
23970 | }
|
23971 | case "TSConditionalType":
|
23972 | if (name === "extendsType" && parent.type === "TSConditionalType") {
|
23973 | return true;
|
23974 | }
|
23975 | case "TSFunctionType":
|
23976 | case "TSConstructorType":
|
23977 | if (name === "extendsType" && parent.type === "TSConditionalType") {
|
23978 | const returnTypeAnnotation = (node.returnType || node.typeAnnotation).typeAnnotation;
|
23979 | if (returnTypeAnnotation.type === "TSInferType" && returnTypeAnnotation.typeParameter.constraint) {
|
23980 | return true;
|
23981 | }
|
23982 | }
|
23983 | if (name === "checkType" && parent.type === "TSConditionalType") {
|
23984 | return true;
|
23985 | }
|
23986 | case "TSUnionType":
|
23987 | case "TSIntersectionType":
|
23988 | if ((parent.type === "TSUnionType" || parent.type === "TSIntersectionType") && parent.types.length > 1 && (!node.types || node.types.length > 1)) {
|
23989 | return true;
|
23990 | }
|
23991 | case "TSInferType":
|
23992 | if (node.type === "TSInferType" && parent.type === "TSRestType") {
|
23993 | return false;
|
23994 | }
|
23995 | case "TSTypeOperator":
|
23996 | return parent.type === "TSArrayType" || parent.type === "TSOptionalType" || parent.type === "TSRestType" || name === "objectType" && parent.type === "TSIndexedAccessType" || parent.type === "TSTypeOperator" || parent.type === "TSTypeAnnotation" && path.getParentNode(1).type.startsWith("TSJSDoc");
|
23997 | case "ArrayTypeAnnotation":
|
23998 | return parent.type === "NullableTypeAnnotation";
|
23999 | case "IntersectionTypeAnnotation":
|
24000 | case "UnionTypeAnnotation":
|
24001 | return parent.type === "ArrayTypeAnnotation" || parent.type === "NullableTypeAnnotation" || parent.type === "IntersectionTypeAnnotation" || parent.type === "UnionTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
|
24002 | case "NullableTypeAnnotation":
|
24003 | return parent.type === "ArrayTypeAnnotation" || name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
|
24004 | case "FunctionTypeAnnotation": {
|
24005 | const ancestor = parent.type === "NullableTypeAnnotation" ? path.getParentNode(1) : parent;
|
24006 | return ancestor.type === "UnionTypeAnnotation" || ancestor.type === "IntersectionTypeAnnotation" || ancestor.type === "ArrayTypeAnnotation" || name === "objectType" && (ancestor.type === "IndexedAccessType" || ancestor.type === "OptionalIndexedAccessType") || ancestor.type === "NullableTypeAnnotation" || parent.type === "FunctionTypeParam" && parent.name === null && getFunctionParameters(node).some((param) => param.typeAnnotation && param.typeAnnotation.type === "NullableTypeAnnotation");
|
24007 | }
|
24008 | case "OptionalIndexedAccessType":
|
24009 | return name === "objectType" && parent.type === "IndexedAccessType";
|
24010 | case "TypeofTypeAnnotation":
|
24011 | return name === "objectType" && (parent.type === "IndexedAccessType" || parent.type === "OptionalIndexedAccessType");
|
24012 | case "StringLiteral":
|
24013 | case "NumericLiteral":
|
24014 | case "Literal":
|
24015 | if (typeof node.value === "string" && parent.type === "ExpressionStatement" && !parent.directive) {
|
24016 | const grandParent = path.getParentNode(1);
|
24017 | return grandParent.type === "Program" || grandParent.type === "BlockStatement";
|
24018 | }
|
24019 | return name === "object" && parent.type === "MemberExpression" && typeof node.value === "number";
|
24020 | case "AssignmentExpression": {
|
24021 | const grandParent = path.getParentNode(1);
|
24022 | if (name === "body" && parent.type === "ArrowFunctionExpression") {
|
24023 | return true;
|
24024 | }
|
24025 | if (name === "key" && (parent.type === "ClassProperty" || parent.type === "PropertyDefinition") && parent.computed) {
|
24026 | return false;
|
24027 | }
|
24028 | if ((name === "init" || name === "update") && parent.type === "ForStatement") {
|
24029 | return false;
|
24030 | }
|
24031 | if (parent.type === "ExpressionStatement") {
|
24032 | return node.left.type === "ObjectPattern";
|
24033 | }
|
24034 | if (name === "key" && parent.type === "TSPropertySignature") {
|
24035 | return false;
|
24036 | }
|
24037 | if (parent.type === "AssignmentExpression") {
|
24038 | return false;
|
24039 | }
|
24040 | if (parent.type === "SequenceExpression" && grandParent && grandParent.type === "ForStatement" && (grandParent.init === parent || grandParent.update === parent)) {
|
24041 | return false;
|
24042 | }
|
24043 | if (name === "value" && parent.type === "Property" && grandParent && grandParent.type === "ObjectPattern" && grandParent.properties.includes(parent)) {
|
24044 | return false;
|
24045 | }
|
24046 | if (parent.type === "NGChainedExpression") {
|
24047 | return false;
|
24048 | }
|
24049 | return true;
|
24050 | }
|
24051 | case "ConditionalExpression":
|
24052 | switch (parent.type) {
|
24053 | case "TaggedTemplateExpression":
|
24054 | case "UnaryExpression":
|
24055 | case "SpreadElement":
|
24056 | case "SpreadProperty":
|
24057 | case "BinaryExpression":
|
24058 | case "LogicalExpression":
|
24059 | case "NGPipeExpression":
|
24060 | case "ExportDefaultDeclaration":
|
24061 | case "AwaitExpression":
|
24062 | case "JSXSpreadAttribute":
|
24063 | case "TSTypeAssertion":
|
24064 | case "TypeCastExpression":
|
24065 | case "TSAsExpression":
|
24066 | case "TSSatisfiesExpression":
|
24067 | case "TSNonNullExpression":
|
24068 | return true;
|
24069 | case "NewExpression":
|
24070 | case "CallExpression":
|
24071 | case "OptionalCallExpression":
|
24072 | return name === "callee";
|
24073 | case "ConditionalExpression":
|
24074 | return name === "test";
|
24075 | case "MemberExpression":
|
24076 | case "OptionalMemberExpression":
|
24077 | return name === "object";
|
24078 | default:
|
24079 | return false;
|
24080 | }
|
24081 | case "FunctionExpression":
|
24082 | switch (parent.type) {
|
24083 | case "NewExpression":
|
24084 | case "CallExpression":
|
24085 | case "OptionalCallExpression":
|
24086 | return name === "callee";
|
24087 | case "TaggedTemplateExpression":
|
24088 | return true;
|
24089 | default:
|
24090 | return false;
|
24091 | }
|
24092 | case "ArrowFunctionExpression":
|
24093 | switch (parent.type) {
|
24094 | case "BinaryExpression":
|
24095 | return parent.operator !== "|>" || node.extra && node.extra.parenthesized;
|
24096 | case "NewExpression":
|
24097 | case "CallExpression":
|
24098 | case "OptionalCallExpression":
|
24099 | return name === "callee";
|
24100 | case "MemberExpression":
|
24101 | case "OptionalMemberExpression":
|
24102 | return name === "object";
|
24103 | case "TSAsExpression":
|
24104 | case "TSSatisfiesExpression":
|
24105 | case "TSNonNullExpression":
|
24106 | case "BindExpression":
|
24107 | case "TaggedTemplateExpression":
|
24108 | case "UnaryExpression":
|
24109 | case "LogicalExpression":
|
24110 | case "AwaitExpression":
|
24111 | case "TSTypeAssertion":
|
24112 | return true;
|
24113 | case "ConditionalExpression":
|
24114 | return name === "test";
|
24115 | default:
|
24116 | return false;
|
24117 | }
|
24118 | case "ClassExpression":
|
24119 | if (isNonEmptyArray(node.decorators)) {
|
24120 | return true;
|
24121 | }
|
24122 | switch (parent.type) {
|
24123 | case "NewExpression":
|
24124 | return name === "callee";
|
24125 | default:
|
24126 | return false;
|
24127 | }
|
24128 | case "OptionalMemberExpression":
|
24129 | case "OptionalCallExpression": {
|
24130 | const parentParent = path.getParentNode(1);
|
24131 | if (name === "object" && parent.type === "MemberExpression" || name === "callee" && (parent.type === "CallExpression" || parent.type === "NewExpression") || parent.type === "TSNonNullExpression" && parentParent.type === "MemberExpression" && parentParent.object === parent) {
|
24132 | return true;
|
24133 | }
|
24134 | }
|
24135 | case "CallExpression":
|
24136 | case "MemberExpression":
|
24137 | case "TaggedTemplateExpression":
|
24138 | case "TSNonNullExpression":
|
24139 | if (name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression")) {
|
24140 | let object = node;
|
24141 | while (object) {
|
24142 | switch (object.type) {
|
24143 | case "CallExpression":
|
24144 | case "OptionalCallExpression":
|
24145 | return true;
|
24146 | case "MemberExpression":
|
24147 | case "OptionalMemberExpression":
|
24148 | case "BindExpression":
|
24149 | object = object.object;
|
24150 | break;
|
24151 | case "TaggedTemplateExpression":
|
24152 | object = object.tag;
|
24153 | break;
|
24154 | case "TSNonNullExpression":
|
24155 | object = object.expression;
|
24156 | break;
|
24157 | default:
|
24158 | return false;
|
24159 | }
|
24160 | }
|
24161 | }
|
24162 | return false;
|
24163 | case "BindExpression":
|
24164 | return name === "callee" && (parent.type === "BindExpression" || parent.type === "NewExpression") || name === "object" && isMemberExpression(parent);
|
24165 | case "NGPipeExpression":
|
24166 | if (parent.type === "NGRoot" || parent.type === "NGMicrosyntaxExpression" || parent.type === "ObjectProperty" && !(node.extra && node.extra.parenthesized) || parent.type === "ArrayExpression" || isCallExpression(parent) && parent.arguments[name] === node || name === "right" && parent.type === "NGPipeExpression" || name === "property" && parent.type === "MemberExpression" || parent.type === "AssignmentExpression") {
|
24167 | return false;
|
24168 | }
|
24169 | return true;
|
24170 | case "JSXFragment":
|
24171 | case "JSXElement":
|
24172 | return name === "callee" || name === "left" && parent.type === "BinaryExpression" && parent.operator === "<" || parent.type !== "ArrayExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "AssignmentExpression" && parent.type !== "AssignmentPattern" && parent.type !== "BinaryExpression" && parent.type !== "NewExpression" && parent.type !== "ConditionalExpression" && parent.type !== "ExpressionStatement" && parent.type !== "JsExpressionRoot" && parent.type !== "JSXAttribute" && parent.type !== "JSXElement" && parent.type !== "JSXExpressionContainer" && parent.type !== "JSXFragment" && parent.type !== "LogicalExpression" && !isCallExpression(parent) && !isObjectProperty(parent) && parent.type !== "ReturnStatement" && parent.type !== "ThrowStatement" && parent.type !== "TypeCastExpression" && parent.type !== "VariableDeclarator" && parent.type !== "YieldExpression";
|
24173 | case "TypeAnnotation":
|
24174 | return name === "returnType" && parent.type === "ArrowFunctionExpression" && includesFunctionTypeInObjectType(node);
|
24175 | }
|
24176 | return false;
|
24177 | }
|
24178 | function isStatement(node) {
|
24179 | return node.type === "BlockStatement" || node.type === "BreakStatement" || node.type === "ClassBody" || node.type === "ClassDeclaration" || node.type === "ClassMethod" || node.type === "ClassProperty" || node.type === "PropertyDefinition" || node.type === "ClassPrivateProperty" || node.type === "ContinueStatement" || node.type === "DebuggerStatement" || node.type === "DeclareClass" || node.type === "DeclareExportAllDeclaration" || node.type === "DeclareExportDeclaration" || node.type === "DeclareFunction" || node.type === "DeclareInterface" || node.type === "DeclareModule" || node.type === "DeclareModuleExports" || node.type === "DeclareVariable" || node.type === "DoWhileStatement" || node.type === "EnumDeclaration" || node.type === "ExportAllDeclaration" || node.type === "ExportDefaultDeclaration" || node.type === "ExportNamedDeclaration" || node.type === "ExpressionStatement" || node.type === "ForInStatement" || node.type === "ForOfStatement" || node.type === "ForStatement" || node.type === "FunctionDeclaration" || node.type === "IfStatement" || node.type === "ImportDeclaration" || node.type === "InterfaceDeclaration" || node.type === "LabeledStatement" || node.type === "MethodDefinition" || node.type === "ReturnStatement" || node.type === "SwitchStatement" || node.type === "ThrowStatement" || node.type === "TryStatement" || node.type === "TSDeclareFunction" || node.type === "TSEnumDeclaration" || node.type === "TSImportEqualsDeclaration" || node.type === "TSInterfaceDeclaration" || node.type === "TSModuleDeclaration" || node.type === "TSNamespaceExportDeclaration" || node.type === "TypeAlias" || node.type === "VariableDeclaration" || node.type === "WhileStatement" || node.type === "WithStatement";
|
24180 | }
|
24181 | function isPathInForStatementInitializer(path) {
|
24182 | let i = 0;
|
24183 | let node = path.getValue();
|
24184 | while (node) {
|
24185 | const parent = path.getParentNode(i++);
|
24186 | if (parent && parent.type === "ForStatement" && parent.init === node) {
|
24187 | return true;
|
24188 | }
|
24189 | node = parent;
|
24190 | }
|
24191 | return false;
|
24192 | }
|
24193 | function includesFunctionTypeInObjectType(node) {
|
24194 | return hasNode(node, (n1) => n1.type === "ObjectTypeAnnotation" && hasNode(n1, (n2) => n2.type === "FunctionTypeAnnotation" || void 0) || void 0);
|
24195 | }
|
24196 | function endsWithRightBracket(node) {
|
24197 | switch (node.type) {
|
24198 | case "ObjectExpression":
|
24199 | return true;
|
24200 | default:
|
24201 | return false;
|
24202 | }
|
24203 | }
|
24204 | function isFollowedByRightBracket(path) {
|
24205 | const node = path.getValue();
|
24206 | const parent = path.getParentNode();
|
24207 | const name = path.getName();
|
24208 | switch (parent.type) {
|
24209 | case "NGPipeExpression":
|
24210 | if (typeof name === "number" && parent.arguments[name] === node && parent.arguments.length - 1 === name) {
|
24211 | return path.callParent(isFollowedByRightBracket);
|
24212 | }
|
24213 | break;
|
24214 | case "ObjectProperty":
|
24215 | if (name === "value") {
|
24216 | const parentParent = path.getParentNode(1);
|
24217 | return getLast(parentParent.properties) === parent;
|
24218 | }
|
24219 | break;
|
24220 | case "BinaryExpression":
|
24221 | case "LogicalExpression":
|
24222 | if (name === "right") {
|
24223 | return path.callParent(isFollowedByRightBracket);
|
24224 | }
|
24225 | break;
|
24226 | case "ConditionalExpression":
|
24227 | if (name === "alternate") {
|
24228 | return path.callParent(isFollowedByRightBracket);
|
24229 | }
|
24230 | break;
|
24231 | case "UnaryExpression":
|
24232 | if (parent.prefix) {
|
24233 | return path.callParent(isFollowedByRightBracket);
|
24234 | }
|
24235 | break;
|
24236 | }
|
24237 | return false;
|
24238 | }
|
24239 | function shouldWrapFunctionForExportDefault(path, options) {
|
24240 | const node = path.getValue();
|
24241 | const parent = path.getParentNode();
|
24242 | if (node.type === "FunctionExpression" || node.type === "ClassExpression") {
|
24243 | return parent.type === "ExportDefaultDeclaration" || !needsParens(path, options);
|
24244 | }
|
24245 | if (!hasNakedLeftSide(node) || parent.type !== "ExportDefaultDeclaration" && needsParens(path, options)) {
|
24246 | return false;
|
24247 | }
|
24248 | return path.call((childPath) => shouldWrapFunctionForExportDefault(childPath, options), ...getLeftSidePathName(path, node));
|
24249 | }
|
24250 | module2.exports = needsParens;
|
24251 | }
|
24252 | });
|
24253 | var require_print_preprocess = __commonJS2({
|
24254 | "src/language-js/print-preprocess.js"(exports2, module2) {
|
24255 | "use strict";
|
24256 | function preprocess(ast, options) {
|
24257 | switch (options.parser) {
|
24258 | case "json":
|
24259 | case "json5":
|
24260 | case "json-stringify":
|
24261 | case "__js_expression":
|
24262 | case "__vue_expression":
|
24263 | case "__vue_ts_expression":
|
24264 | return Object.assign(Object.assign({}, ast), {}, {
|
24265 | type: options.parser.startsWith("__") ? "JsExpressionRoot" : "JsonRoot",
|
24266 | node: ast,
|
24267 | comments: [],
|
24268 | rootMarker: options.rootMarker
|
24269 | });
|
24270 | default:
|
24271 | return ast;
|
24272 | }
|
24273 | }
|
24274 | module2.exports = preprocess;
|
24275 | }
|
24276 | });
|
24277 | var require_html_binding = __commonJS2({
|
24278 | "src/language-js/print/html-binding.js"(exports2, module2) {
|
24279 | "use strict";
|
24280 | var {
|
24281 | builders: {
|
24282 | join,
|
24283 | line,
|
24284 | group,
|
24285 | softline,
|
24286 | indent
|
24287 | }
|
24288 | } = require("./doc.js");
|
24289 | function printHtmlBinding(path, options, print) {
|
24290 | const node = path.getValue();
|
24291 | if (options.__onHtmlBindingRoot && path.getName() === null) {
|
24292 | options.__onHtmlBindingRoot(node, options);
|
24293 | }
|
24294 | if (node.type !== "File") {
|
24295 | return;
|
24296 | }
|
24297 | if (options.__isVueForBindingLeft) {
|
24298 | return path.call((functionDeclarationPath) => {
|
24299 | const printed = join([",", line], functionDeclarationPath.map(print, "params"));
|
24300 | const {
|
24301 | params
|
24302 | } = functionDeclarationPath.getValue();
|
24303 | if (params.length === 1) {
|
24304 | return printed;
|
24305 | }
|
24306 | return ["(", indent([softline, group(printed)]), softline, ")"];
|
24307 | }, "program", "body", 0);
|
24308 | }
|
24309 | if (options.__isVueBindings) {
|
24310 | return path.call((functionDeclarationPath) => join([",", line], functionDeclarationPath.map(print, "params")), "program", "body", 0);
|
24311 | }
|
24312 | }
|
24313 | function isVueEventBindingExpression(node) {
|
24314 | switch (node.type) {
|
24315 | case "MemberExpression":
|
24316 | switch (node.property.type) {
|
24317 | case "Identifier":
|
24318 | case "NumericLiteral":
|
24319 | case "StringLiteral":
|
24320 | return isVueEventBindingExpression(node.object);
|
24321 | }
|
24322 | return false;
|
24323 | case "Identifier":
|
24324 | return true;
|
24325 | default:
|
24326 | return false;
|
24327 | }
|
24328 | }
|
24329 | module2.exports = {
|
24330 | isVueEventBindingExpression,
|
24331 | printHtmlBinding
|
24332 | };
|
24333 | }
|
24334 | });
|
24335 | var require_binaryish = __commonJS2({
|
24336 | "src/language-js/print/binaryish.js"(exports2, module2) {
|
24337 | "use strict";
|
24338 | var {
|
24339 | printComments
|
24340 | } = require_comments();
|
24341 | var {
|
24342 | getLast
|
24343 | } = require_util();
|
24344 | var {
|
24345 | builders: {
|
24346 | join,
|
24347 | line,
|
24348 | softline,
|
24349 | group,
|
24350 | indent,
|
24351 | align,
|
24352 | indentIfBreak
|
24353 | },
|
24354 | utils: {
|
24355 | cleanDoc,
|
24356 | getDocParts,
|
24357 | isConcat
|
24358 | }
|
24359 | } = require("./doc.js");
|
24360 | var {
|
24361 | hasLeadingOwnLineComment,
|
24362 | isBinaryish,
|
24363 | isJsxNode,
|
24364 | shouldFlatten,
|
24365 | hasComment,
|
24366 | CommentCheckFlags,
|
24367 | isCallExpression,
|
24368 | isMemberExpression,
|
24369 | isObjectProperty,
|
24370 | isEnabledHackPipeline
|
24371 | } = require_utils7();
|
24372 | var uid = 0;
|
24373 | function printBinaryishExpression(path, options, print) {
|
24374 | const node = path.getValue();
|
24375 | const parent = path.getParentNode();
|
24376 | const parentParent = path.getParentNode(1);
|
24377 | const isInsideParenthesis = node !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "SwitchStatement" || parent.type === "DoWhileStatement");
|
24378 | const isHackPipeline = isEnabledHackPipeline(options) && node.operator === "|>";
|
24379 | const parts = printBinaryishExpressions(path, print, options, false, isInsideParenthesis);
|
24380 | if (isInsideParenthesis) {
|
24381 | return parts;
|
24382 | }
|
24383 | if (isHackPipeline) {
|
24384 | return group(parts);
|
24385 | }
|
24386 | if (isCallExpression(parent) && parent.callee === node || parent.type === "UnaryExpression" || isMemberExpression(parent) && !parent.computed) {
|
24387 | return group([indent([softline, ...parts]), softline]);
|
24388 | }
|
24389 | const shouldNotIndent = parent.type === "ReturnStatement" || parent.type === "ThrowStatement" || parent.type === "JSXExpressionContainer" && parentParent.type === "JSXAttribute" || node.operator !== "|" && parent.type === "JsExpressionRoot" || node.type !== "NGPipeExpression" && (parent.type === "NGRoot" && options.parser === "__ng_binding" || parent.type === "NGMicrosyntaxExpression" && parentParent.type === "NGMicrosyntax" && parentParent.body.length === 1) || node === parent.body && parent.type === "ArrowFunctionExpression" || node !== parent.body && parent.type === "ForStatement" || parent.type === "ConditionalExpression" && parentParent.type !== "ReturnStatement" && parentParent.type !== "ThrowStatement" && !isCallExpression(parentParent) || parent.type === "TemplateLiteral";
|
24390 | const shouldIndentIfInlining = parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator" || parent.type === "ClassProperty" || parent.type === "PropertyDefinition" || parent.type === "TSAbstractPropertyDefinition" || parent.type === "ClassPrivateProperty" || isObjectProperty(parent);
|
24391 | const samePrecedenceSubExpression = isBinaryish(node.left) && shouldFlatten(node.operator, node.left.operator);
|
24392 | if (shouldNotIndent || shouldInlineLogicalExpression(node) && !samePrecedenceSubExpression || !shouldInlineLogicalExpression(node) && shouldIndentIfInlining) {
|
24393 | return group(parts);
|
24394 | }
|
24395 | if (parts.length === 0) {
|
24396 | return "";
|
24397 | }
|
24398 | const hasJsx = isJsxNode(node.right);
|
24399 | const firstGroupIndex = parts.findIndex((part) => typeof part !== "string" && !Array.isArray(part) && part.type === "group");
|
24400 | const headParts = parts.slice(0, firstGroupIndex === -1 ? 1 : firstGroupIndex + 1);
|
24401 | const rest = parts.slice(headParts.length, hasJsx ? -1 : void 0);
|
24402 | const groupId = Symbol("logicalChain-" + ++uid);
|
24403 | const chain = group([...headParts, indent(rest)], {
|
24404 | id: groupId
|
24405 | });
|
24406 | if (!hasJsx) {
|
24407 | return chain;
|
24408 | }
|
24409 | const jsxPart = getLast(parts);
|
24410 | return group([chain, indentIfBreak(jsxPart, {
|
24411 | groupId
|
24412 | })]);
|
24413 | }
|
24414 | function printBinaryishExpressions(path, print, options, isNested, isInsideParenthesis) {
|
24415 | const node = path.getValue();
|
24416 | if (!isBinaryish(node)) {
|
24417 | return [group(print())];
|
24418 | }
|
24419 | let parts = [];
|
24420 | if (shouldFlatten(node.operator, node.left.operator)) {
|
24421 | parts = path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "left");
|
24422 | } else {
|
24423 | parts.push(group(print("left")));
|
24424 | }
|
24425 | const shouldInline = shouldInlineLogicalExpression(node);
|
24426 | const lineBeforeOperator = (node.operator === "|>" || node.type === "NGPipeExpression" || node.operator === "|" && options.parser === "__vue_expression") && !hasLeadingOwnLineComment(options.originalText, node.right);
|
24427 | const operator = node.type === "NGPipeExpression" ? "|" : node.operator;
|
24428 | const rightSuffix = node.type === "NGPipeExpression" && node.arguments.length > 0 ? group(indent([line, ": ", join([line, ": "], path.map(print, "arguments").map((arg) => align(2, group(arg))))])) : "";
|
24429 | let right;
|
24430 | if (shouldInline) {
|
24431 | right = [operator, " ", print("right"), rightSuffix];
|
24432 | } else {
|
24433 | const isHackPipeline = isEnabledHackPipeline(options) && operator === "|>";
|
24434 | const rightContent = isHackPipeline ? path.call((left) => printBinaryishExpressions(left, print, options, true, isInsideParenthesis), "right") : print("right");
|
24435 | right = [lineBeforeOperator ? line : "", operator, lineBeforeOperator ? " " : line, rightContent, rightSuffix];
|
24436 | }
|
24437 | const parent = path.getParentNode();
|
24438 | const shouldBreak = hasComment(node.left, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
|
24439 | const shouldGroup = shouldBreak || !(isInsideParenthesis && node.type === "LogicalExpression") && parent.type !== node.type && node.left.type !== node.type && node.right.type !== node.type;
|
24440 | parts.push(lineBeforeOperator ? "" : " ", shouldGroup ? group(right, {
|
24441 | shouldBreak
|
24442 | }) : right);
|
24443 | if (isNested && hasComment(node)) {
|
24444 | const printed = cleanDoc(printComments(path, parts, options));
|
24445 | if (isConcat(printed) || printed.type === "fill") {
|
24446 | return getDocParts(printed);
|
24447 | }
|
24448 | return [printed];
|
24449 | }
|
24450 | return parts;
|
24451 | }
|
24452 | function shouldInlineLogicalExpression(node) {
|
24453 | if (node.type !== "LogicalExpression") {
|
24454 | return false;
|
24455 | }
|
24456 | if (node.right.type === "ObjectExpression" && node.right.properties.length > 0) {
|
24457 | return true;
|
24458 | }
|
24459 | if (node.right.type === "ArrayExpression" && node.right.elements.length > 0) {
|
24460 | return true;
|
24461 | }
|
24462 | if (isJsxNode(node.right)) {
|
24463 | return true;
|
24464 | }
|
24465 | return false;
|
24466 | }
|
24467 | module2.exports = {
|
24468 | printBinaryishExpression,
|
24469 | shouldInlineLogicalExpression
|
24470 | };
|
24471 | }
|
24472 | });
|
24473 | var require_angular = __commonJS2({
|
24474 | "src/language-js/print/angular.js"(exports2, module2) {
|
24475 | "use strict";
|
24476 | var {
|
24477 | builders: {
|
24478 | join,
|
24479 | line,
|
24480 | group
|
24481 | }
|
24482 | } = require("./doc.js");
|
24483 | var {
|
24484 | hasNode,
|
24485 | hasComment,
|
24486 | getComments
|
24487 | } = require_utils7();
|
24488 | var {
|
24489 | printBinaryishExpression
|
24490 | } = require_binaryish();
|
24491 | function printAngular(path, options, print) {
|
24492 | const node = path.getValue();
|
24493 | if (!node.type.startsWith("NG")) {
|
24494 | return;
|
24495 | }
|
24496 | switch (node.type) {
|
24497 | case "NGRoot":
|
24498 | return [print("node"), !hasComment(node.node) ? "" : " //" + getComments(node.node)[0].value.trimEnd()];
|
24499 | case "NGPipeExpression":
|
24500 | return printBinaryishExpression(path, options, print);
|
24501 | case "NGChainedExpression":
|
24502 | return group(join([";", line], path.map((childPath) => hasNgSideEffect(childPath) ? print() : ["(", print(), ")"], "expressions")));
|
24503 | case "NGEmptyExpression":
|
24504 | return "";
|
24505 | case "NGQuotedExpression":
|
24506 | return [node.prefix, ": ", node.value.trim()];
|
24507 | case "NGMicrosyntax":
|
24508 | return path.map((childPath, index) => [index === 0 ? "" : isNgForOf(childPath.getValue(), index, node) ? " " : [";", line], print()], "body");
|
24509 | case "NGMicrosyntaxKey":
|
24510 | return /^[$_a-z][\w$]*(?:-[$_a-z][\w$])*$/i.test(node.name) ? node.name : JSON.stringify(node.name);
|
24511 | case "NGMicrosyntaxExpression":
|
24512 | return [print("expression"), node.alias === null ? "" : [" as ", print("alias")]];
|
24513 | case "NGMicrosyntaxKeyedExpression": {
|
24514 | const index = path.getName();
|
24515 | const parentNode = path.getParentNode();
|
24516 | const shouldNotPrintColon = isNgForOf(node, index, parentNode) || (index === 1 && (node.key.name === "then" || node.key.name === "else") || index === 2 && node.key.name === "else" && parentNode.body[index - 1].type === "NGMicrosyntaxKeyedExpression" && parentNode.body[index - 1].key.name === "then") && parentNode.body[0].type === "NGMicrosyntaxExpression";
|
24517 | return [print("key"), shouldNotPrintColon ? " " : ": ", print("expression")];
|
24518 | }
|
24519 | case "NGMicrosyntaxLet":
|
24520 | return ["let ", print("key"), node.value === null ? "" : [" = ", print("value")]];
|
24521 | case "NGMicrosyntaxAs":
|
24522 | return [print("key"), " as ", print("alias")];
|
24523 | default:
|
24524 | throw new Error(`Unknown Angular node type: ${JSON.stringify(node.type)}.`);
|
24525 | }
|
24526 | }
|
24527 | function isNgForOf(node, index, parentNode) {
|
24528 | return node.type === "NGMicrosyntaxKeyedExpression" && node.key.name === "of" && index === 1 && parentNode.body[0].type === "NGMicrosyntaxLet" && parentNode.body[0].value === null;
|
24529 | }
|
24530 | function hasNgSideEffect(path) {
|
24531 | return hasNode(path.getValue(), (node) => {
|
24532 | switch (node.type) {
|
24533 | case void 0:
|
24534 | return false;
|
24535 | case "CallExpression":
|
24536 | case "OptionalCallExpression":
|
24537 | case "AssignmentExpression":
|
24538 | return true;
|
24539 | }
|
24540 | });
|
24541 | }
|
24542 | module2.exports = {
|
24543 | printAngular
|
24544 | };
|
24545 | }
|
24546 | });
|
24547 | var require_jsx = __commonJS2({
|
24548 | "src/language-js/print/jsx.js"(exports2, module2) {
|
24549 | "use strict";
|
24550 | var {
|
24551 | printComments,
|
24552 | printDanglingComments
|
24553 | } = require_comments();
|
24554 | var {
|
24555 | builders: {
|
24556 | line,
|
24557 | hardline,
|
24558 | softline,
|
24559 | group,
|
24560 | indent,
|
24561 | conditionalGroup,
|
24562 | fill,
|
24563 | ifBreak,
|
24564 | lineSuffixBoundary,
|
24565 | join
|
24566 | },
|
24567 | utils: {
|
24568 | willBreak
|
24569 | }
|
24570 | } = require("./doc.js");
|
24571 | var {
|
24572 | getLast,
|
24573 | getPreferredQuote
|
24574 | } = require_util();
|
24575 | var {
|
24576 | isJsxNode,
|
24577 | rawText,
|
24578 | isLiteral,
|
24579 | isCallExpression,
|
24580 | isStringLiteral,
|
24581 | isBinaryish,
|
24582 | hasComment,
|
24583 | CommentCheckFlags,
|
24584 | hasNodeIgnoreComment
|
24585 | } = require_utils7();
|
24586 | var pathNeedsParens = require_needs_parens();
|
24587 | var {
|
24588 | willPrintOwnComments
|
24589 | } = require_comments2();
|
24590 | var isEmptyStringOrAnyLine = (doc2) => doc2 === "" || doc2 === line || doc2 === hardline || doc2 === softline;
|
24591 | function printJsxElementInternal(path, options, print) {
|
24592 | const node = path.getValue();
|
24593 | if (node.type === "JSXElement" && isEmptyJsxElement(node)) {
|
24594 | return [print("openingElement"), print("closingElement")];
|
24595 | }
|
24596 | const openingLines = node.type === "JSXElement" ? print("openingElement") : print("openingFragment");
|
24597 | const closingLines = node.type === "JSXElement" ? print("closingElement") : print("closingFragment");
|
24598 | if (node.children.length === 1 && node.children[0].type === "JSXExpressionContainer" && (node.children[0].expression.type === "TemplateLiteral" || node.children[0].expression.type === "TaggedTemplateExpression")) {
|
24599 | return [openingLines, ...path.map(print, "children"), closingLines];
|
24600 | }
|
24601 | node.children = node.children.map((child) => {
|
24602 | if (isJsxWhitespaceExpression(child)) {
|
24603 | return {
|
24604 | type: "JSXText",
|
24605 | value: " ",
|
24606 | raw: " "
|
24607 | };
|
24608 | }
|
24609 | return child;
|
24610 | });
|
24611 | const containsTag = node.children.some(isJsxNode);
|
24612 | const containsMultipleExpressions = node.children.filter((child) => child.type === "JSXExpressionContainer").length > 1;
|
24613 | const containsMultipleAttributes = node.type === "JSXElement" && node.openingElement.attributes.length > 1;
|
24614 | let forcedBreak = willBreak(openingLines) || containsTag || containsMultipleAttributes || containsMultipleExpressions;
|
24615 | const isMdxBlock = path.getParentNode().rootMarker === "mdx";
|
24616 | const rawJsxWhitespace = options.singleQuote ? "{' '}" : '{" "}';
|
24617 | const jsxWhitespace = isMdxBlock ? " " : ifBreak([rawJsxWhitespace, softline], " ");
|
24618 | const isFacebookTranslationTag = node.openingElement && node.openingElement.name && node.openingElement.name.name === "fbt";
|
24619 | const children = printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag);
|
24620 | const containsText = node.children.some((child) => isMeaningfulJsxText(child));
|
24621 | for (let i = children.length - 2; i >= 0; i--) {
|
24622 | const isPairOfEmptyStrings = children[i] === "" && children[i + 1] === "";
|
24623 | const isPairOfHardlines = children[i] === hardline && children[i + 1] === "" && children[i + 2] === hardline;
|
24624 | const isLineFollowedByJsxWhitespace = (children[i] === softline || children[i] === hardline) && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
|
24625 | const isJsxWhitespaceFollowedByLine = children[i] === jsxWhitespace && children[i + 1] === "" && (children[i + 2] === softline || children[i + 2] === hardline);
|
24626 | const isDoubleJsxWhitespace = children[i] === jsxWhitespace && children[i + 1] === "" && children[i + 2] === jsxWhitespace;
|
24627 | const isPairOfHardOrSoftLines = children[i] === softline && children[i + 1] === "" && children[i + 2] === hardline || children[i] === hardline && children[i + 1] === "" && children[i + 2] === softline;
|
24628 | if (isPairOfHardlines && containsText || isPairOfEmptyStrings || isLineFollowedByJsxWhitespace || isDoubleJsxWhitespace || isPairOfHardOrSoftLines) {
|
24629 | children.splice(i, 2);
|
24630 | } else if (isJsxWhitespaceFollowedByLine) {
|
24631 | children.splice(i + 1, 2);
|
24632 | }
|
24633 | }
|
24634 | while (children.length > 0 && isEmptyStringOrAnyLine(getLast(children))) {
|
24635 | children.pop();
|
24636 | }
|
24637 | while (children.length > 1 && isEmptyStringOrAnyLine(children[0]) && isEmptyStringOrAnyLine(children[1])) {
|
24638 | children.shift();
|
24639 | children.shift();
|
24640 | }
|
24641 | const multilineChildren = [];
|
24642 | for (const [i, child] of children.entries()) {
|
24643 | if (child === jsxWhitespace) {
|
24644 | if (i === 1 && children[i - 1] === "") {
|
24645 | if (children.length === 2) {
|
24646 | multilineChildren.push(rawJsxWhitespace);
|
24647 | continue;
|
24648 | }
|
24649 | multilineChildren.push([rawJsxWhitespace, hardline]);
|
24650 | continue;
|
24651 | } else if (i === children.length - 1) {
|
24652 | multilineChildren.push(rawJsxWhitespace);
|
24653 | continue;
|
24654 | } else if (children[i - 1] === "" && children[i - 2] === hardline) {
|
24655 | multilineChildren.push(rawJsxWhitespace);
|
24656 | continue;
|
24657 | }
|
24658 | }
|
24659 | multilineChildren.push(child);
|
24660 | if (willBreak(child)) {
|
24661 | forcedBreak = true;
|
24662 | }
|
24663 | }
|
24664 | const content = containsText ? fill(multilineChildren) : group(multilineChildren, {
|
24665 | shouldBreak: true
|
24666 | });
|
24667 | if (isMdxBlock) {
|
24668 | return content;
|
24669 | }
|
24670 | const multiLineElem = group([openingLines, indent([hardline, content]), hardline, closingLines]);
|
24671 | if (forcedBreak) {
|
24672 | return multiLineElem;
|
24673 | }
|
24674 | return conditionalGroup([group([openingLines, ...children, closingLines]), multiLineElem]);
|
24675 | }
|
24676 | function printJsxChildren(path, options, print, jsxWhitespace, isFacebookTranslationTag) {
|
24677 | const parts = [];
|
24678 | path.each((childPath, i, children) => {
|
24679 | const child = childPath.getValue();
|
24680 | if (isLiteral(child)) {
|
24681 | const text = rawText(child);
|
24682 | if (isMeaningfulJsxText(child)) {
|
24683 | const words = text.split(matchJsxWhitespaceRegex);
|
24684 | if (words[0] === "") {
|
24685 | parts.push("");
|
24686 | words.shift();
|
24687 | if (/\n/.test(words[0])) {
|
24688 | const next = children[i + 1];
|
24689 | parts.push(separatorWithWhitespace(isFacebookTranslationTag, words[1], child, next));
|
24690 | } else {
|
24691 | parts.push(jsxWhitespace);
|
24692 | }
|
24693 | words.shift();
|
24694 | }
|
24695 | let endWhitespace;
|
24696 | if (getLast(words) === "") {
|
24697 | words.pop();
|
24698 | endWhitespace = words.pop();
|
24699 | }
|
24700 | if (words.length === 0) {
|
24701 | return;
|
24702 | }
|
24703 | for (const [i2, word] of words.entries()) {
|
24704 | if (i2 % 2 === 1) {
|
24705 | parts.push(line);
|
24706 | } else {
|
24707 | parts.push(word);
|
24708 | }
|
24709 | }
|
24710 | if (endWhitespace !== void 0) {
|
24711 | if (/\n/.test(endWhitespace)) {
|
24712 | const next = children[i + 1];
|
24713 | parts.push(separatorWithWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
|
24714 | } else {
|
24715 | parts.push(jsxWhitespace);
|
24716 | }
|
24717 | } else {
|
24718 | const next = children[i + 1];
|
24719 | parts.push(separatorNoWhitespace(isFacebookTranslationTag, getLast(parts), child, next));
|
24720 | }
|
24721 | } else if (/\n/.test(text)) {
|
24722 | if (text.match(/\n/g).length > 1) {
|
24723 | parts.push("", hardline);
|
24724 | }
|
24725 | } else {
|
24726 | parts.push("", jsxWhitespace);
|
24727 | }
|
24728 | } else {
|
24729 | const printedChild = print();
|
24730 | parts.push(printedChild);
|
24731 | const next = children[i + 1];
|
24732 | const directlyFollowedByMeaningfulText = next && isMeaningfulJsxText(next);
|
24733 | if (directlyFollowedByMeaningfulText) {
|
24734 | const firstWord = trimJsxWhitespace(rawText(next)).split(matchJsxWhitespaceRegex)[0];
|
24735 | parts.push(separatorNoWhitespace(isFacebookTranslationTag, firstWord, child, next));
|
24736 | } else {
|
24737 | parts.push(hardline);
|
24738 | }
|
24739 | }
|
24740 | }, "children");
|
24741 | return parts;
|
24742 | }
|
24743 | function separatorNoWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
|
24744 | if (isFacebookTranslationTag) {
|
24745 | return "";
|
24746 | }
|
24747 | if (childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement) {
|
24748 | return child.length === 1 ? softline : hardline;
|
24749 | }
|
24750 | return softline;
|
24751 | }
|
24752 | function separatorWithWhitespace(isFacebookTranslationTag, child, childNode, nextNode) {
|
24753 | if (isFacebookTranslationTag) {
|
24754 | return hardline;
|
24755 | }
|
24756 | if (child.length === 1) {
|
24757 | return childNode.type === "JSXElement" && !childNode.closingElement || nextNode && nextNode.type === "JSXElement" && !nextNode.closingElement ? hardline : softline;
|
24758 | }
|
24759 | return hardline;
|
24760 | }
|
24761 | function maybeWrapJsxElementInParens(path, elem, options) {
|
24762 | const parent = path.getParentNode();
|
24763 | if (!parent) {
|
24764 | return elem;
|
24765 | }
|
24766 | const NO_WRAP_PARENTS = {
|
24767 | ArrayExpression: true,
|
24768 | JSXAttribute: true,
|
24769 | JSXElement: true,
|
24770 | JSXExpressionContainer: true,
|
24771 | JSXFragment: true,
|
24772 | ExpressionStatement: true,
|
24773 | CallExpression: true,
|
24774 | OptionalCallExpression: true,
|
24775 | ConditionalExpression: true,
|
24776 | JsExpressionRoot: true
|
24777 | };
|
24778 | if (NO_WRAP_PARENTS[parent.type]) {
|
24779 | return elem;
|
24780 | }
|
24781 | const shouldBreak = path.match(void 0, (node) => node.type === "ArrowFunctionExpression", isCallExpression, (node) => node.type === "JSXExpressionContainer");
|
24782 | const needsParens = pathNeedsParens(path, options);
|
24783 | return group([needsParens ? "" : ifBreak("("), indent([softline, elem]), softline, needsParens ? "" : ifBreak(")")], {
|
24784 | shouldBreak
|
24785 | });
|
24786 | }
|
24787 | function printJsxAttribute(path, options, print) {
|
24788 | const node = path.getValue();
|
24789 | const parts = [];
|
24790 | parts.push(print("name"));
|
24791 | if (node.value) {
|
24792 | let res;
|
24793 | if (isStringLiteral(node.value)) {
|
24794 | const raw = rawText(node.value);
|
24795 | let final = raw.slice(1, -1).replace(/'/g, "'").replace(/"/g, '"');
|
24796 | const {
|
24797 | escaped,
|
24798 | quote,
|
24799 | regex
|
24800 | } = getPreferredQuote(final, options.jsxSingleQuote ? "'" : '"');
|
24801 | final = final.replace(regex, escaped);
|
24802 | res = [quote, final, quote];
|
24803 | } else {
|
24804 | res = print("value");
|
24805 | }
|
24806 | parts.push("=", res);
|
24807 | }
|
24808 | return parts;
|
24809 | }
|
24810 | function printJsxExpressionContainer(path, options, print) {
|
24811 | const node = path.getValue();
|
24812 | const shouldInline = (node2, parent) => node2.type === "JSXEmptyExpression" || !hasComment(node2) && (node2.type === "ArrayExpression" || node2.type === "ObjectExpression" || node2.type === "ArrowFunctionExpression" || node2.type === "AwaitExpression" && (shouldInline(node2.argument, node2) || node2.argument.type === "JSXElement") || isCallExpression(node2) || node2.type === "FunctionExpression" || node2.type === "TemplateLiteral" || node2.type === "TaggedTemplateExpression" || node2.type === "DoExpression" || isJsxNode(parent) && (node2.type === "ConditionalExpression" || isBinaryish(node2)));
|
24813 | if (shouldInline(node.expression, path.getParentNode(0))) {
|
24814 | return group(["{", print("expression"), lineSuffixBoundary, "}"]);
|
24815 | }
|
24816 | return group(["{", indent([softline, print("expression")]), softline, lineSuffixBoundary, "}"]);
|
24817 | }
|
24818 | function printJsxOpeningElement(path, options, print) {
|
24819 | const node = path.getValue();
|
24820 | const nameHasComments = node.name && hasComment(node.name) || node.typeParameters && hasComment(node.typeParameters);
|
24821 | if (node.selfClosing && node.attributes.length === 0 && !nameHasComments) {
|
24822 | return ["<", print("name"), print("typeParameters"), " />"];
|
24823 | }
|
24824 | if (node.attributes && node.attributes.length === 1 && node.attributes[0].value && isStringLiteral(node.attributes[0].value) && !node.attributes[0].value.value.includes("\n") && !nameHasComments && !hasComment(node.attributes[0])) {
|
24825 | return group(["<", print("name"), print("typeParameters"), " ", ...path.map(print, "attributes"), node.selfClosing ? " />" : ">"]);
|
24826 | }
|
24827 | const shouldBreak = node.attributes && node.attributes.some((attr) => attr.value && isStringLiteral(attr.value) && attr.value.value.includes("\n"));
|
24828 | const attributeLine = options.singleAttributePerLine && node.attributes.length > 1 ? hardline : line;
|
24829 | return group(["<", print("name"), print("typeParameters"), indent(path.map(() => [attributeLine, print()], "attributes")), ...printEndOfOpeningTag(node, options, nameHasComments)], {
|
24830 | shouldBreak
|
24831 | });
|
24832 | }
|
24833 | function printEndOfOpeningTag(node, options, nameHasComments) {
|
24834 | if (node.selfClosing) {
|
24835 | return [line, "/>"];
|
24836 | }
|
24837 | const bracketSameLine = shouldPrintBracketSameLine(node, options, nameHasComments);
|
24838 | if (bracketSameLine) {
|
24839 | return [">"];
|
24840 | }
|
24841 | return [softline, ">"];
|
24842 | }
|
24843 | function shouldPrintBracketSameLine(node, options, nameHasComments) {
|
24844 | const lastAttrHasTrailingComments = node.attributes.length > 0 && hasComment(getLast(node.attributes), CommentCheckFlags.Trailing);
|
24845 | return node.attributes.length === 0 && !nameHasComments || (options.bracketSameLine || options.jsxBracketSameLine) && (!nameHasComments || node.attributes.length > 0) && !lastAttrHasTrailingComments;
|
24846 | }
|
24847 | function printJsxClosingElement(path, options, print) {
|
24848 | const node = path.getValue();
|
24849 | const parts = [];
|
24850 | parts.push("</");
|
24851 | const printed = print("name");
|
24852 | if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Line)) {
|
24853 | parts.push(indent([hardline, printed]), hardline);
|
24854 | } else if (hasComment(node.name, CommentCheckFlags.Leading | CommentCheckFlags.Block)) {
|
24855 | parts.push(" ", printed);
|
24856 | } else {
|
24857 | parts.push(printed);
|
24858 | }
|
24859 | parts.push(">");
|
24860 | return parts;
|
24861 | }
|
24862 | function printJsxOpeningClosingFragment(path, options) {
|
24863 | const node = path.getValue();
|
24864 | const nodeHasComment = hasComment(node);
|
24865 | const hasOwnLineComment = hasComment(node, CommentCheckFlags.Line);
|
24866 | const isOpeningFragment = node.type === "JSXOpeningFragment";
|
24867 | return [isOpeningFragment ? "<" : "</", indent([hasOwnLineComment ? hardline : nodeHasComment && !isOpeningFragment ? " " : "", printDanglingComments(path, options, true)]), hasOwnLineComment ? hardline : "", ">"];
|
24868 | }
|
24869 | function printJsxElement(path, options, print) {
|
24870 | const elem = printComments(path, printJsxElementInternal(path, options, print), options);
|
24871 | return maybeWrapJsxElementInParens(path, elem, options);
|
24872 | }
|
24873 | function printJsxEmptyExpression(path, options) {
|
24874 | const node = path.getValue();
|
24875 | const requiresHardline = hasComment(node, CommentCheckFlags.Line);
|
24876 | return [printDanglingComments(path, options, !requiresHardline), requiresHardline ? hardline : ""];
|
24877 | }
|
24878 | function printJsxSpreadAttribute(path, options, print) {
|
24879 | const node = path.getValue();
|
24880 | return ["{", path.call((p) => {
|
24881 | const printed = ["...", print()];
|
24882 | const node2 = p.getValue();
|
24883 | if (!hasComment(node2) || !willPrintOwnComments(p)) {
|
24884 | return printed;
|
24885 | }
|
24886 | return [indent([softline, printComments(p, printed, options)]), softline];
|
24887 | }, node.type === "JSXSpreadAttribute" ? "argument" : "expression"), "}"];
|
24888 | }
|
24889 | function printJsx(path, options, print) {
|
24890 | const node = path.getValue();
|
24891 | if (!node.type.startsWith("JSX")) {
|
24892 | return;
|
24893 | }
|
24894 | switch (node.type) {
|
24895 | case "JSXAttribute":
|
24896 | return printJsxAttribute(path, options, print);
|
24897 | case "JSXIdentifier":
|
24898 | return String(node.name);
|
24899 | case "JSXNamespacedName":
|
24900 | return join(":", [print("namespace"), print("name")]);
|
24901 | case "JSXMemberExpression":
|
24902 | return join(".", [print("object"), print("property")]);
|
24903 | case "JSXSpreadAttribute":
|
24904 | return printJsxSpreadAttribute(path, options, print);
|
24905 | case "JSXSpreadChild": {
|
24906 | const printJsxSpreadChild = printJsxSpreadAttribute;
|
24907 | return printJsxSpreadChild(path, options, print);
|
24908 | }
|
24909 | case "JSXExpressionContainer":
|
24910 | return printJsxExpressionContainer(path, options, print);
|
24911 | case "JSXFragment":
|
24912 | case "JSXElement":
|
24913 | return printJsxElement(path, options, print);
|
24914 | case "JSXOpeningElement":
|
24915 | return printJsxOpeningElement(path, options, print);
|
24916 | case "JSXClosingElement":
|
24917 | return printJsxClosingElement(path, options, print);
|
24918 | case "JSXOpeningFragment":
|
24919 | case "JSXClosingFragment":
|
24920 | return printJsxOpeningClosingFragment(path, options);
|
24921 | case "JSXEmptyExpression":
|
24922 | return printJsxEmptyExpression(path, options);
|
24923 | case "JSXText":
|
24924 | throw new Error("JSXTest should be handled by JSXElement");
|
24925 | default:
|
24926 | throw new Error(`Unknown JSX node type: ${JSON.stringify(node.type)}.`);
|
24927 | }
|
24928 | }
|
24929 | var jsxWhitespaceChars = " \n\r ";
|
24930 | var matchJsxWhitespaceRegex = new RegExp("([" + jsxWhitespaceChars + "]+)");
|
24931 | var containsNonJsxWhitespaceRegex = new RegExp("[^" + jsxWhitespaceChars + "]");
|
24932 | var trimJsxWhitespace = (text) => text.replace(new RegExp("(?:^" + matchJsxWhitespaceRegex.source + "|" + matchJsxWhitespaceRegex.source + "$)"), "");
|
24933 | function isEmptyJsxElement(node) {
|
24934 | if (node.children.length === 0) {
|
24935 | return true;
|
24936 | }
|
24937 | if (node.children.length > 1) {
|
24938 | return false;
|
24939 | }
|
24940 | const child = node.children[0];
|
24941 | return isLiteral(child) && !isMeaningfulJsxText(child);
|
24942 | }
|
24943 | function isMeaningfulJsxText(node) {
|
24944 | return isLiteral(node) && (containsNonJsxWhitespaceRegex.test(rawText(node)) || !/\n/.test(rawText(node)));
|
24945 | }
|
24946 | function isJsxWhitespaceExpression(node) {
|
24947 | return node.type === "JSXExpressionContainer" && isLiteral(node.expression) && node.expression.value === " " && !hasComment(node.expression);
|
24948 | }
|
24949 | function hasJsxIgnoreComment(path) {
|
24950 | const node = path.getValue();
|
24951 | const parent = path.getParentNode();
|
24952 | if (!parent || !node || !isJsxNode(node) || !isJsxNode(parent)) {
|
24953 | return false;
|
24954 | }
|
24955 | const index = parent.children.indexOf(node);
|
24956 | let prevSibling = null;
|
24957 | for (let i = index; i > 0; i--) {
|
24958 | const candidate = parent.children[i - 1];
|
24959 | if (candidate.type === "JSXText" && !isMeaningfulJsxText(candidate)) {
|
24960 | continue;
|
24961 | }
|
24962 | prevSibling = candidate;
|
24963 | break;
|
24964 | }
|
24965 | return prevSibling && prevSibling.type === "JSXExpressionContainer" && prevSibling.expression.type === "JSXEmptyExpression" && hasNodeIgnoreComment(prevSibling.expression);
|
24966 | }
|
24967 | module2.exports = {
|
24968 | hasJsxIgnoreComment,
|
24969 | printJsx
|
24970 | };
|
24971 | }
|
24972 | });
|
24973 | var require_doc_builders = __commonJS2({
|
24974 | "src/document/doc-builders.js"(exports2, module2) {
|
24975 | "use strict";
|
24976 | function concat(parts) {
|
24977 | if (false) {
|
24978 | for (const part of parts) {
|
24979 | assertDoc(part);
|
24980 | }
|
24981 | }
|
24982 | return {
|
24983 | type: "concat",
|
24984 | parts
|
24985 | };
|
24986 | }
|
24987 | function indent(contents) {
|
24988 | if (false) {
|
24989 | assertDoc(contents);
|
24990 | }
|
24991 | return {
|
24992 | type: "indent",
|
24993 | contents
|
24994 | };
|
24995 | }
|
24996 | function align(widthOrString, contents) {
|
24997 | if (false) {
|
24998 | assertDoc(contents);
|
24999 | }
|
25000 | return {
|
25001 | type: "align",
|
25002 | contents,
|
25003 | n: widthOrString
|
25004 | };
|
25005 | }
|
25006 | function group(contents, opts = {}) {
|
25007 | if (false) {
|
25008 | assertDoc(contents);
|
25009 | }
|
25010 | return {
|
25011 | type: "group",
|
25012 | id: opts.id,
|
25013 | contents,
|
25014 | break: Boolean(opts.shouldBreak),
|
25015 | expandedStates: opts.expandedStates
|
25016 | };
|
25017 | }
|
25018 | function dedentToRoot(contents) {
|
25019 | return align(Number.NEGATIVE_INFINITY, contents);
|
25020 | }
|
25021 | function markAsRoot(contents) {
|
25022 | return align({
|
25023 | type: "root"
|
25024 | }, contents);
|
25025 | }
|
25026 | function dedent(contents) {
|
25027 | return align(-1, contents);
|
25028 | }
|
25029 | function conditionalGroup(states, opts) {
|
25030 | return group(states[0], Object.assign(Object.assign({}, opts), {}, {
|
25031 | expandedStates: states
|
25032 | }));
|
25033 | }
|
25034 | function fill(parts) {
|
25035 | if (false) {
|
25036 | for (const part of parts) {
|
25037 | assertDoc(part);
|
25038 | }
|
25039 | }
|
25040 | return {
|
25041 | type: "fill",
|
25042 | parts
|
25043 | };
|
25044 | }
|
25045 | function ifBreak(breakContents, flatContents, opts = {}) {
|
25046 | if (false) {
|
25047 | if (breakContents) {
|
25048 | assertDoc(breakContents);
|
25049 | }
|
25050 | if (flatContents) {
|
25051 | assertDoc(flatContents);
|
25052 | }
|
25053 | }
|
25054 | return {
|
25055 | type: "if-break",
|
25056 | breakContents,
|
25057 | flatContents,
|
25058 | groupId: opts.groupId
|
25059 | };
|
25060 | }
|
25061 | function indentIfBreak(contents, opts) {
|
25062 | return {
|
25063 | type: "indent-if-break",
|
25064 | contents,
|
25065 | groupId: opts.groupId,
|
25066 | negate: opts.negate
|
25067 | };
|
25068 | }
|
25069 | function lineSuffix(contents) {
|
25070 | if (false) {
|
25071 | assertDoc(contents);
|
25072 | }
|
25073 | return {
|
25074 | type: "line-suffix",
|
25075 | contents
|
25076 | };
|
25077 | }
|
25078 | var lineSuffixBoundary = {
|
25079 | type: "line-suffix-boundary"
|
25080 | };
|
25081 | var breakParent = {
|
25082 | type: "break-parent"
|
25083 | };
|
25084 | var trim = {
|
25085 | type: "trim"
|
25086 | };
|
25087 | var hardlineWithoutBreakParent = {
|
25088 | type: "line",
|
25089 | hard: true
|
25090 | };
|
25091 | var literallineWithoutBreakParent = {
|
25092 | type: "line",
|
25093 | hard: true,
|
25094 | literal: true
|
25095 | };
|
25096 | var line = {
|
25097 | type: "line"
|
25098 | };
|
25099 | var softline = {
|
25100 | type: "line",
|
25101 | soft: true
|
25102 | };
|
25103 | var hardline = concat([hardlineWithoutBreakParent, breakParent]);
|
25104 | var literalline = concat([literallineWithoutBreakParent, breakParent]);
|
25105 | var cursor = {
|
25106 | type: "cursor",
|
25107 | placeholder: Symbol("cursor")
|
25108 | };
|
25109 | function join(sep, arr) {
|
25110 | const res = [];
|
25111 | for (let i = 0; i < arr.length; i++) {
|
25112 | if (i !== 0) {
|
25113 | res.push(sep);
|
25114 | }
|
25115 | res.push(arr[i]);
|
25116 | }
|
25117 | return concat(res);
|
25118 | }
|
25119 | function addAlignmentToDoc(doc2, size, tabWidth) {
|
25120 | let aligned = doc2;
|
25121 | if (size > 0) {
|
25122 | for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
|
25123 | aligned = indent(aligned);
|
25124 | }
|
25125 | aligned = align(size % tabWidth, aligned);
|
25126 | aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
25127 | }
|
25128 | return aligned;
|
25129 | }
|
25130 | function label(label2, contents) {
|
25131 | return {
|
25132 | type: "label",
|
25133 | label: label2,
|
25134 | contents
|
25135 | };
|
25136 | }
|
25137 | module2.exports = {
|
25138 | concat,
|
25139 | join,
|
25140 | line,
|
25141 | softline,
|
25142 | hardline,
|
25143 | literalline,
|
25144 | group,
|
25145 | conditionalGroup,
|
25146 | fill,
|
25147 | lineSuffix,
|
25148 | lineSuffixBoundary,
|
25149 | cursor,
|
25150 | breakParent,
|
25151 | ifBreak,
|
25152 | trim,
|
25153 | indent,
|
25154 | indentIfBreak,
|
25155 | align,
|
25156 | addAlignmentToDoc,
|
25157 | markAsRoot,
|
25158 | dedentToRoot,
|
25159 | dedent,
|
25160 | hardlineWithoutBreakParent,
|
25161 | literallineWithoutBreakParent,
|
25162 | label
|
25163 | };
|
25164 | }
|
25165 | });
|
25166 | var require_doc_utils = __commonJS2({
|
25167 | "src/document/doc-utils.js"(exports2, module2) {
|
25168 | "use strict";
|
25169 | var getLast = require_get_last();
|
25170 | var {
|
25171 | literalline,
|
25172 | join
|
25173 | } = require_doc_builders();
|
25174 | var isConcat = (doc2) => Array.isArray(doc2) || doc2 && doc2.type === "concat";
|
25175 | var getDocParts = (doc2) => {
|
25176 | if (Array.isArray(doc2)) {
|
25177 | return doc2;
|
25178 | }
|
25179 | if (doc2.type !== "concat" && doc2.type !== "fill") {
|
25180 | throw new Error("Expect doc type to be `concat` or `fill`.");
|
25181 | }
|
25182 | return doc2.parts;
|
25183 | };
|
25184 | var traverseDocOnExitStackMarker = {};
|
25185 | function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) {
|
25186 | const docsStack = [doc2];
|
25187 | while (docsStack.length > 0) {
|
25188 | const doc3 = docsStack.pop();
|
25189 | if (doc3 === traverseDocOnExitStackMarker) {
|
25190 | onExit(docsStack.pop());
|
25191 | continue;
|
25192 | }
|
25193 | if (onExit) {
|
25194 | docsStack.push(doc3, traverseDocOnExitStackMarker);
|
25195 | }
|
25196 | if (!onEnter || onEnter(doc3) !== false) {
|
25197 | if (isConcat(doc3) || doc3.type === "fill") {
|
25198 | const parts = getDocParts(doc3);
|
25199 | for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
|
25200 | docsStack.push(parts[i]);
|
25201 | }
|
25202 | } else if (doc3.type === "if-break") {
|
25203 | if (doc3.flatContents) {
|
25204 | docsStack.push(doc3.flatContents);
|
25205 | }
|
25206 | if (doc3.breakContents) {
|
25207 | docsStack.push(doc3.breakContents);
|
25208 | }
|
25209 | } else if (doc3.type === "group" && doc3.expandedStates) {
|
25210 | if (shouldTraverseConditionalGroups) {
|
25211 | for (let ic = doc3.expandedStates.length, i = ic - 1; i >= 0; --i) {
|
25212 | docsStack.push(doc3.expandedStates[i]);
|
25213 | }
|
25214 | } else {
|
25215 | docsStack.push(doc3.contents);
|
25216 | }
|
25217 | } else if (doc3.contents) {
|
25218 | docsStack.push(doc3.contents);
|
25219 | }
|
25220 | }
|
25221 | }
|
25222 | }
|
25223 | function mapDoc(doc2, cb) {
|
25224 | const mapped = new Map();
|
25225 | return rec(doc2);
|
25226 | function rec(doc3) {
|
25227 | if (mapped.has(doc3)) {
|
25228 | return mapped.get(doc3);
|
25229 | }
|
25230 | const result = process2(doc3);
|
25231 | mapped.set(doc3, result);
|
25232 | return result;
|
25233 | }
|
25234 | function process2(doc3) {
|
25235 | if (Array.isArray(doc3)) {
|
25236 | return cb(doc3.map(rec));
|
25237 | }
|
25238 | if (doc3.type === "concat" || doc3.type === "fill") {
|
25239 | const parts = doc3.parts.map(rec);
|
25240 | return cb(Object.assign(Object.assign({}, doc3), {}, {
|
25241 | parts
|
25242 | }));
|
25243 | }
|
25244 | if (doc3.type === "if-break") {
|
25245 | const breakContents = doc3.breakContents && rec(doc3.breakContents);
|
25246 | const flatContents = doc3.flatContents && rec(doc3.flatContents);
|
25247 | return cb(Object.assign(Object.assign({}, doc3), {}, {
|
25248 | breakContents,
|
25249 | flatContents
|
25250 | }));
|
25251 | }
|
25252 | if (doc3.type === "group" && doc3.expandedStates) {
|
25253 | const expandedStates = doc3.expandedStates.map(rec);
|
25254 | const contents = expandedStates[0];
|
25255 | return cb(Object.assign(Object.assign({}, doc3), {}, {
|
25256 | contents,
|
25257 | expandedStates
|
25258 | }));
|
25259 | }
|
25260 | if (doc3.contents) {
|
25261 | const contents = rec(doc3.contents);
|
25262 | return cb(Object.assign(Object.assign({}, doc3), {}, {
|
25263 | contents
|
25264 | }));
|
25265 | }
|
25266 | return cb(doc3);
|
25267 | }
|
25268 | }
|
25269 | function findInDoc(doc2, fn, defaultValue) {
|
25270 | let result = defaultValue;
|
25271 | let hasStopped = false;
|
25272 | function findInDocOnEnterFn(doc3) {
|
25273 | const maybeResult = fn(doc3);
|
25274 | if (maybeResult !== void 0) {
|
25275 | hasStopped = true;
|
25276 | result = maybeResult;
|
25277 | }
|
25278 | if (hasStopped) {
|
25279 | return false;
|
25280 | }
|
25281 | }
|
25282 | traverseDoc(doc2, findInDocOnEnterFn);
|
25283 | return result;
|
25284 | }
|
25285 | function willBreakFn(doc2) {
|
25286 | if (doc2.type === "group" && doc2.break) {
|
25287 | return true;
|
25288 | }
|
25289 | if (doc2.type === "line" && doc2.hard) {
|
25290 | return true;
|
25291 | }
|
25292 | if (doc2.type === "break-parent") {
|
25293 | return true;
|
25294 | }
|
25295 | }
|
25296 | function willBreak(doc2) {
|
25297 | return findInDoc(doc2, willBreakFn, false);
|
25298 | }
|
25299 | function breakParentGroup(groupStack) {
|
25300 | if (groupStack.length > 0) {
|
25301 | const parentGroup = getLast(groupStack);
|
25302 | if (!parentGroup.expandedStates && !parentGroup.break) {
|
25303 | parentGroup.break = "propagated";
|
25304 | }
|
25305 | }
|
25306 | return null;
|
25307 | }
|
25308 | function propagateBreaks(doc2) {
|
25309 | const alreadyVisitedSet = new Set();
|
25310 | const groupStack = [];
|
25311 | function propagateBreaksOnEnterFn(doc3) {
|
25312 | if (doc3.type === "break-parent") {
|
25313 | breakParentGroup(groupStack);
|
25314 | }
|
25315 | if (doc3.type === "group") {
|
25316 | groupStack.push(doc3);
|
25317 | if (alreadyVisitedSet.has(doc3)) {
|
25318 | return false;
|
25319 | }
|
25320 | alreadyVisitedSet.add(doc3);
|
25321 | }
|
25322 | }
|
25323 | function propagateBreaksOnExitFn(doc3) {
|
25324 | if (doc3.type === "group") {
|
25325 | const group = groupStack.pop();
|
25326 | if (group.break) {
|
25327 | breakParentGroup(groupStack);
|
25328 | }
|
25329 | }
|
25330 | }
|
25331 | traverseDoc(doc2, propagateBreaksOnEnterFn, propagateBreaksOnExitFn, true);
|
25332 | }
|
25333 | function removeLinesFn(doc2) {
|
25334 | if (doc2.type === "line" && !doc2.hard) {
|
25335 | return doc2.soft ? "" : " ";
|
25336 | }
|
25337 | if (doc2.type === "if-break") {
|
25338 | return doc2.flatContents || "";
|
25339 | }
|
25340 | return doc2;
|
25341 | }
|
25342 | function removeLines(doc2) {
|
25343 | return mapDoc(doc2, removeLinesFn);
|
25344 | }
|
25345 | var isHardline = (doc2, nextDoc) => doc2 && doc2.type === "line" && doc2.hard && nextDoc && nextDoc.type === "break-parent";
|
25346 | function stripDocTrailingHardlineFromDoc(doc2) {
|
25347 | if (!doc2) {
|
25348 | return doc2;
|
25349 | }
|
25350 | if (isConcat(doc2) || doc2.type === "fill") {
|
25351 | const parts = getDocParts(doc2);
|
25352 | while (parts.length > 1 && isHardline(...parts.slice(-2))) {
|
25353 | parts.length -= 2;
|
25354 | }
|
25355 | if (parts.length > 0) {
|
25356 | const lastPart = stripDocTrailingHardlineFromDoc(getLast(parts));
|
25357 | parts[parts.length - 1] = lastPart;
|
25358 | }
|
25359 | return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
|
25360 | parts
|
25361 | });
|
25362 | }
|
25363 | switch (doc2.type) {
|
25364 | case "align":
|
25365 | case "indent":
|
25366 | case "indent-if-break":
|
25367 | case "group":
|
25368 | case "line-suffix":
|
25369 | case "label": {
|
25370 | const contents = stripDocTrailingHardlineFromDoc(doc2.contents);
|
25371 | return Object.assign(Object.assign({}, doc2), {}, {
|
25372 | contents
|
25373 | });
|
25374 | }
|
25375 | case "if-break": {
|
25376 | const breakContents = stripDocTrailingHardlineFromDoc(doc2.breakContents);
|
25377 | const flatContents = stripDocTrailingHardlineFromDoc(doc2.flatContents);
|
25378 | return Object.assign(Object.assign({}, doc2), {}, {
|
25379 | breakContents,
|
25380 | flatContents
|
25381 | });
|
25382 | }
|
25383 | }
|
25384 | return doc2;
|
25385 | }
|
25386 | function stripTrailingHardline(doc2) {
|
25387 | return stripDocTrailingHardlineFromDoc(cleanDoc(doc2));
|
25388 | }
|
25389 | function cleanDocFn(doc2) {
|
25390 | switch (doc2.type) {
|
25391 | case "fill":
|
25392 | if (doc2.parts.every((part) => part === "")) {
|
25393 | return "";
|
25394 | }
|
25395 | break;
|
25396 | case "group":
|
25397 | if (!doc2.contents && !doc2.id && !doc2.break && !doc2.expandedStates) {
|
25398 | return "";
|
25399 | }
|
25400 | if (doc2.contents.type === "group" && doc2.contents.id === doc2.id && doc2.contents.break === doc2.break && doc2.contents.expandedStates === doc2.expandedStates) {
|
25401 | return doc2.contents;
|
25402 | }
|
25403 | break;
|
25404 | case "align":
|
25405 | case "indent":
|
25406 | case "indent-if-break":
|
25407 | case "line-suffix":
|
25408 | if (!doc2.contents) {
|
25409 | return "";
|
25410 | }
|
25411 | break;
|
25412 | case "if-break":
|
25413 | if (!doc2.flatContents && !doc2.breakContents) {
|
25414 | return "";
|
25415 | }
|
25416 | break;
|
25417 | }
|
25418 | if (!isConcat(doc2)) {
|
25419 | return doc2;
|
25420 | }
|
25421 | const parts = [];
|
25422 | for (const part of getDocParts(doc2)) {
|
25423 | if (!part) {
|
25424 | continue;
|
25425 | }
|
25426 | const [currentPart, ...restParts] = isConcat(part) ? getDocParts(part) : [part];
|
25427 | if (typeof currentPart === "string" && typeof getLast(parts) === "string") {
|
25428 | parts[parts.length - 1] += currentPart;
|
25429 | } else {
|
25430 | parts.push(currentPart);
|
25431 | }
|
25432 | parts.push(...restParts);
|
25433 | }
|
25434 | if (parts.length === 0) {
|
25435 | return "";
|
25436 | }
|
25437 | if (parts.length === 1) {
|
25438 | return parts[0];
|
25439 | }
|
25440 | return Array.isArray(doc2) ? parts : Object.assign(Object.assign({}, doc2), {}, {
|
25441 | parts
|
25442 | });
|
25443 | }
|
25444 | function cleanDoc(doc2) {
|
25445 | return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
25446 | }
|
25447 | function normalizeParts(parts) {
|
25448 | const newParts = [];
|
25449 | const restParts = parts.filter(Boolean);
|
25450 | while (restParts.length > 0) {
|
25451 | const part = restParts.shift();
|
25452 | if (!part) {
|
25453 | continue;
|
25454 | }
|
25455 | if (isConcat(part)) {
|
25456 | restParts.unshift(...getDocParts(part));
|
25457 | continue;
|
25458 | }
|
25459 | if (newParts.length > 0 && typeof getLast(newParts) === "string" && typeof part === "string") {
|
25460 | newParts[newParts.length - 1] += part;
|
25461 | continue;
|
25462 | }
|
25463 | newParts.push(part);
|
25464 | }
|
25465 | return newParts;
|
25466 | }
|
25467 | function normalizeDoc(doc2) {
|
25468 | return mapDoc(doc2, (currentDoc) => {
|
25469 | if (Array.isArray(currentDoc)) {
|
25470 | return normalizeParts(currentDoc);
|
25471 | }
|
25472 | if (!currentDoc.parts) {
|
25473 | return currentDoc;
|
25474 | }
|
25475 | return Object.assign(Object.assign({}, currentDoc), {}, {
|
25476 | parts: normalizeParts(currentDoc.parts)
|
25477 | });
|
25478 | });
|
25479 | }
|
25480 | function replaceEndOfLine(doc2) {
|
25481 | return mapDoc(doc2, (currentDoc) => typeof currentDoc === "string" && currentDoc.includes("\n") ? replaceTextEndOfLine(currentDoc) : currentDoc);
|
25482 | }
|
25483 | function replaceTextEndOfLine(text, replacement = literalline) {
|
25484 | return join(replacement, text.split("\n")).parts;
|
25485 | }
|
25486 | function canBreakFn(doc2) {
|
25487 | if (doc2.type === "line") {
|
25488 | return true;
|
25489 | }
|
25490 | }
|
25491 | function canBreak(doc2) {
|
25492 | return findInDoc(doc2, canBreakFn, false);
|
25493 | }
|
25494 | module2.exports = {
|
25495 | isConcat,
|
25496 | getDocParts,
|
25497 | willBreak,
|
25498 | traverseDoc,
|
25499 | findInDoc,
|
25500 | mapDoc,
|
25501 | propagateBreaks,
|
25502 | removeLines,
|
25503 | stripTrailingHardline,
|
25504 | normalizeParts,
|
25505 | normalizeDoc,
|
25506 | cleanDoc,
|
25507 | replaceTextEndOfLine,
|
25508 | replaceEndOfLine,
|
25509 | canBreak
|
25510 | };
|
25511 | }
|
25512 | });
|
25513 | var require_misc = __commonJS2({
|
25514 | "src/language-js/print/misc.js"(exports2, module2) {
|
25515 | "use strict";
|
25516 | var {
|
25517 | isNonEmptyArray
|
25518 | } = require_util();
|
25519 | var {
|
25520 | builders: {
|
25521 | indent,
|
25522 | join,
|
25523 | line
|
25524 | }
|
25525 | } = require("./doc.js");
|
25526 | var {
|
25527 | isFlowAnnotationComment
|
25528 | } = require_utils7();
|
25529 | function printOptionalToken(path) {
|
25530 | const node = path.getValue();
|
25531 | if (!node.optional || node.type === "Identifier" && node === path.getParentNode().key) {
|
25532 | return "";
|
25533 | }
|
25534 | if (node.type === "OptionalCallExpression" || node.type === "OptionalMemberExpression" && node.computed) {
|
25535 | return "?.";
|
25536 | }
|
25537 | return "?";
|
25538 | }
|
25539 | function printDefiniteToken(path) {
|
25540 | return path.getValue().definite || path.match(void 0, (node, name) => name === "id" && node.type === "VariableDeclarator" && node.definite) ? "!" : "";
|
25541 | }
|
25542 | function printFunctionTypeParameters(path, options, print) {
|
25543 | const fun = path.getValue();
|
25544 | if (fun.typeArguments) {
|
25545 | return print("typeArguments");
|
25546 | }
|
25547 | if (fun.typeParameters) {
|
25548 | return print("typeParameters");
|
25549 | }
|
25550 | return "";
|
25551 | }
|
25552 | function printTypeAnnotation(path, options, print) {
|
25553 | const node = path.getValue();
|
25554 | if (!node.typeAnnotation) {
|
25555 | return "";
|
25556 | }
|
25557 | const parentNode = path.getParentNode();
|
25558 | const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node;
|
25559 | if (isFlowAnnotationComment(options.originalText, node.typeAnnotation)) {
|
25560 | return [" /*: ", print("typeAnnotation"), " */"];
|
25561 | }
|
25562 | return [isFunctionDeclarationIdentifier ? "" : ": ", print("typeAnnotation")];
|
25563 | }
|
25564 | function printBindExpressionCallee(path, options, print) {
|
25565 | return ["::", print("callee")];
|
25566 | }
|
25567 | function printTypeScriptModifiers(path, options, print) {
|
25568 | const node = path.getValue();
|
25569 | if (!isNonEmptyArray(node.modifiers)) {
|
25570 | return "";
|
25571 | }
|
25572 | return [join(" ", path.map(print, "modifiers")), " "];
|
25573 | }
|
25574 | function adjustClause(node, clause, forceSpace) {
|
25575 | if (node.type === "EmptyStatement") {
|
25576 | return ";";
|
25577 | }
|
25578 | if (node.type === "BlockStatement" || forceSpace) {
|
25579 | return [" ", clause];
|
25580 | }
|
25581 | return indent([line, clause]);
|
25582 | }
|
25583 | function printRestSpread(path, options, print) {
|
25584 | return ["...", print("argument"), printTypeAnnotation(path, options, print)];
|
25585 | }
|
25586 | module2.exports = {
|
25587 | printOptionalToken,
|
25588 | printDefiniteToken,
|
25589 | printFunctionTypeParameters,
|
25590 | printBindExpressionCallee,
|
25591 | printTypeScriptModifiers,
|
25592 | printTypeAnnotation,
|
25593 | printRestSpread,
|
25594 | adjustClause
|
25595 | };
|
25596 | }
|
25597 | });
|
25598 | var require_array4 = __commonJS2({
|
25599 | "src/language-js/print/array.js"(exports2, module2) {
|
25600 | "use strict";
|
25601 | var {
|
25602 | printDanglingComments
|
25603 | } = require_comments();
|
25604 | var {
|
25605 | builders: {
|
25606 | line,
|
25607 | softline,
|
25608 | hardline,
|
25609 | group,
|
25610 | indent,
|
25611 | ifBreak,
|
25612 | fill
|
25613 | }
|
25614 | } = require("./doc.js");
|
25615 | var {
|
25616 | getLast,
|
25617 | hasNewline
|
25618 | } = require_util();
|
25619 | var {
|
25620 | shouldPrintComma,
|
25621 | hasComment,
|
25622 | CommentCheckFlags,
|
25623 | isNextLineEmpty,
|
25624 | isNumericLiteral,
|
25625 | isSignedNumericLiteral
|
25626 | } = require_utils7();
|
25627 | var {
|
25628 | locStart
|
25629 | } = require_loc();
|
25630 | var {
|
25631 | printOptionalToken,
|
25632 | printTypeAnnotation
|
25633 | } = require_misc();
|
25634 | function printArray(path, options, print) {
|
25635 | const node = path.getValue();
|
25636 | const parts = [];
|
25637 | const openBracket = node.type === "TupleExpression" ? "#[" : "[";
|
25638 | const closeBracket = "]";
|
25639 | if (node.elements.length === 0) {
|
25640 | if (!hasComment(node, CommentCheckFlags.Dangling)) {
|
25641 | parts.push(openBracket, closeBracket);
|
25642 | } else {
|
25643 | parts.push(group([openBracket, printDanglingComments(path, options), softline, closeBracket]));
|
25644 | }
|
25645 | } else {
|
25646 | const lastElem = getLast(node.elements);
|
25647 | const canHaveTrailingComma = !(lastElem && lastElem.type === "RestElement");
|
25648 | const needsForcedTrailingComma = lastElem === null;
|
25649 | const groupId = Symbol("array");
|
25650 | const shouldBreak = !options.__inJestEach && node.elements.length > 1 && node.elements.every((element, i, elements) => {
|
25651 | const elementType = element && element.type;
|
25652 | if (elementType !== "ArrayExpression" && elementType !== "ObjectExpression") {
|
25653 | return false;
|
25654 | }
|
25655 | const nextElement = elements[i + 1];
|
25656 | if (nextElement && elementType !== nextElement.type) {
|
25657 | return false;
|
25658 | }
|
25659 | const itemsKey = elementType === "ArrayExpression" ? "elements" : "properties";
|
25660 | return element[itemsKey] && element[itemsKey].length > 1;
|
25661 | });
|
25662 | const shouldUseConciseFormatting = isConciselyPrintedArray(node, options);
|
25663 | const trailingComma = !canHaveTrailingComma ? "" : needsForcedTrailingComma ? "," : !shouldPrintComma(options) ? "" : shouldUseConciseFormatting ? ifBreak(",", "", {
|
25664 | groupId
|
25665 | }) : ifBreak(",");
|
25666 | parts.push(group([openBracket, indent([softline, shouldUseConciseFormatting ? printArrayItemsConcisely(path, options, print, trailingComma) : [printArrayItems(path, options, "elements", print), trailingComma], printDanglingComments(path, options, true)]), softline, closeBracket], {
|
25667 | shouldBreak,
|
25668 | id: groupId
|
25669 | }));
|
25670 | }
|
25671 | parts.push(printOptionalToken(path), printTypeAnnotation(path, options, print));
|
25672 | return parts;
|
25673 | }
|
25674 | function isConciselyPrintedArray(node, options) {
|
25675 | return node.elements.length > 1 && node.elements.every((element) => element && (isNumericLiteral(element) || isSignedNumericLiteral(element) && !hasComment(element.argument)) && !hasComment(element, CommentCheckFlags.Trailing | CommentCheckFlags.Line, (comment) => !hasNewline(options.originalText, locStart(comment), {
|
25676 | backwards: true
|
25677 | })));
|
25678 | }
|
25679 | function printArrayItems(path, options, printPath, print) {
|
25680 | const printedElements = [];
|
25681 | let separatorParts = [];
|
25682 | path.each((childPath) => {
|
25683 | printedElements.push(separatorParts, group(print()));
|
25684 | separatorParts = [",", line];
|
25685 | if (childPath.getValue() && isNextLineEmpty(childPath.getValue(), options)) {
|
25686 | separatorParts.push(softline);
|
25687 | }
|
25688 | }, printPath);
|
25689 | return printedElements;
|
25690 | }
|
25691 | function printArrayItemsConcisely(path, options, print, trailingComma) {
|
25692 | const parts = [];
|
25693 | path.each((childPath, i, elements) => {
|
25694 | const isLast = i === elements.length - 1;
|
25695 | parts.push([print(), isLast ? trailingComma : ","]);
|
25696 | if (!isLast) {
|
25697 | parts.push(isNextLineEmpty(childPath.getValue(), options) ? [hardline, hardline] : hasComment(elements[i + 1], CommentCheckFlags.Leading | CommentCheckFlags.Line) ? hardline : line);
|
25698 | }
|
25699 | }, "elements");
|
25700 | return fill(parts);
|
25701 | }
|
25702 | module2.exports = {
|
25703 | printArray,
|
25704 | printArrayItems,
|
25705 | isConciselyPrintedArray
|
25706 | };
|
25707 | }
|
25708 | });
|
25709 | var require_call_arguments = __commonJS2({
|
25710 | "src/language-js/print/call-arguments.js"(exports2, module2) {
|
25711 | "use strict";
|
25712 | var {
|
25713 | printDanglingComments
|
25714 | } = require_comments();
|
25715 | var {
|
25716 | getLast,
|
25717 | getPenultimate
|
25718 | } = require_util();
|
25719 | var {
|
25720 | getFunctionParameters,
|
25721 | hasComment,
|
25722 | CommentCheckFlags,
|
25723 | isFunctionCompositionArgs,
|
25724 | isJsxNode,
|
25725 | isLongCurriedCallExpression,
|
25726 | shouldPrintComma,
|
25727 | getCallArguments,
|
25728 | iterateCallArgumentsPath,
|
25729 | isNextLineEmpty,
|
25730 | isCallExpression,
|
25731 | isStringLiteral,
|
25732 | isObjectProperty,
|
25733 | isTSTypeExpression
|
25734 | } = require_utils7();
|
25735 | var {
|
25736 | builders: {
|
25737 | line,
|
25738 | hardline,
|
25739 | softline,
|
25740 | group,
|
25741 | indent,
|
25742 | conditionalGroup,
|
25743 | ifBreak,
|
25744 | breakParent
|
25745 | },
|
25746 | utils: {
|
25747 | willBreak
|
25748 | }
|
25749 | } = require("./doc.js");
|
25750 | var {
|
25751 | ArgExpansionBailout
|
25752 | } = require_errors();
|
25753 | var {
|
25754 | isConciselyPrintedArray
|
25755 | } = require_array4();
|
25756 | function printCallArguments(path, options, print) {
|
25757 | const node = path.getValue();
|
25758 | const isDynamicImport = node.type === "ImportExpression";
|
25759 | const args = getCallArguments(node);
|
25760 | if (args.length === 0) {
|
25761 | return ["(", printDanglingComments(path, options, true), ")"];
|
25762 | }
|
25763 | if (isReactHookCallWithDepsArray(args)) {
|
25764 | return ["(", print(["arguments", 0]), ", ", print(["arguments", 1]), ")"];
|
25765 | }
|
25766 | let anyArgEmptyLine = false;
|
25767 | let hasEmptyLineFollowingFirstArg = false;
|
25768 | const lastArgIndex = args.length - 1;
|
25769 | const printedArguments = [];
|
25770 | iterateCallArgumentsPath(path, (argPath, index) => {
|
25771 | const arg = argPath.getNode();
|
25772 | const parts = [print()];
|
25773 | if (index === lastArgIndex) {
|
25774 | } else if (isNextLineEmpty(arg, options)) {
|
25775 | if (index === 0) {
|
25776 | hasEmptyLineFollowingFirstArg = true;
|
25777 | }
|
25778 | anyArgEmptyLine = true;
|
25779 | parts.push(",", hardline, hardline);
|
25780 | } else {
|
25781 | parts.push(",", line);
|
25782 | }
|
25783 | printedArguments.push(parts);
|
25784 | });
|
25785 | const maybeTrailingComma = !(isDynamicImport || node.callee && node.callee.type === "Import") && shouldPrintComma(options, "all") ? "," : "";
|
25786 | function allArgsBrokenOut() {
|
25787 | return group(["(", indent([line, ...printedArguments]), maybeTrailingComma, line, ")"], {
|
25788 | shouldBreak: true
|
25789 | });
|
25790 | }
|
25791 | if (anyArgEmptyLine || path.getParentNode().type !== "Decorator" && isFunctionCompositionArgs(args)) {
|
25792 | return allArgsBrokenOut();
|
25793 | }
|
25794 | const shouldGroupFirst = shouldGroupFirstArg(args);
|
25795 | const shouldGroupLast = shouldGroupLastArg(args, options);
|
25796 | if (shouldGroupFirst || shouldGroupLast) {
|
25797 | if (shouldGroupFirst ? printedArguments.slice(1).some(willBreak) : printedArguments.slice(0, -1).some(willBreak)) {
|
25798 | return allArgsBrokenOut();
|
25799 | }
|
25800 | let printedExpanded = [];
|
25801 | try {
|
25802 | path.try(() => {
|
25803 | iterateCallArgumentsPath(path, (argPath, i) => {
|
25804 | if (shouldGroupFirst && i === 0) {
|
25805 | printedExpanded = [[print([], {
|
25806 | expandFirstArg: true
|
25807 | }), printedArguments.length > 1 ? "," : "", hasEmptyLineFollowingFirstArg ? hardline : line, hasEmptyLineFollowingFirstArg ? hardline : ""], ...printedArguments.slice(1)];
|
25808 | }
|
25809 | if (shouldGroupLast && i === lastArgIndex) {
|
25810 | printedExpanded = [...printedArguments.slice(0, -1), print([], {
|
25811 | expandLastArg: true
|
25812 | })];
|
25813 | }
|
25814 | });
|
25815 | });
|
25816 | } catch (caught) {
|
25817 | if (caught instanceof ArgExpansionBailout) {
|
25818 | return allArgsBrokenOut();
|
25819 | }
|
25820 | throw caught;
|
25821 | }
|
25822 | return [printedArguments.some(willBreak) ? breakParent : "", conditionalGroup([["(", ...printedExpanded, ")"], shouldGroupFirst ? ["(", group(printedExpanded[0], {
|
25823 | shouldBreak: true
|
25824 | }), ...printedExpanded.slice(1), ")"] : ["(", ...printedArguments.slice(0, -1), group(getLast(printedExpanded), {
|
25825 | shouldBreak: true
|
25826 | }), ")"], allArgsBrokenOut()])];
|
25827 | }
|
25828 | const contents = ["(", indent([softline, ...printedArguments]), ifBreak(maybeTrailingComma), softline, ")"];
|
25829 | if (isLongCurriedCallExpression(path)) {
|
25830 | return contents;
|
25831 | }
|
25832 | return group(contents, {
|
25833 | shouldBreak: printedArguments.some(willBreak) || anyArgEmptyLine
|
25834 | });
|
25835 | }
|
25836 | function couldGroupArg(arg, arrowChainRecursion = false) {
|
25837 | return arg.type === "ObjectExpression" && (arg.properties.length > 0 || hasComment(arg)) || arg.type === "ArrayExpression" && (arg.elements.length > 0 || hasComment(arg)) || arg.type === "TSTypeAssertion" && couldGroupArg(arg.expression) || isTSTypeExpression(arg) && couldGroupArg(arg.expression) || arg.type === "FunctionExpression" || arg.type === "ArrowFunctionExpression" && (!arg.returnType || !arg.returnType.typeAnnotation || arg.returnType.typeAnnotation.type !== "TSTypeReference" || isNonEmptyBlockStatement(arg.body)) && (arg.body.type === "BlockStatement" || arg.body.type === "ArrowFunctionExpression" && couldGroupArg(arg.body, true) || arg.body.type === "ObjectExpression" || arg.body.type === "ArrayExpression" || !arrowChainRecursion && (isCallExpression(arg.body) || arg.body.type === "ConditionalExpression") || isJsxNode(arg.body)) || arg.type === "DoExpression" || arg.type === "ModuleExpression";
|
25838 | }
|
25839 | function shouldGroupLastArg(args, options) {
|
25840 | const lastArg = getLast(args);
|
25841 | const penultimateArg = getPenultimate(args);
|
25842 | return !hasComment(lastArg, CommentCheckFlags.Leading) && !hasComment(lastArg, CommentCheckFlags.Trailing) && couldGroupArg(lastArg) && (!penultimateArg || penultimateArg.type !== lastArg.type) && (args.length !== 2 || penultimateArg.type !== "ArrowFunctionExpression" || lastArg.type !== "ArrayExpression") && !(args.length > 1 && lastArg.type === "ArrayExpression" && isConciselyPrintedArray(lastArg, options));
|
25843 | }
|
25844 | function shouldGroupFirstArg(args) {
|
25845 | if (args.length !== 2) {
|
25846 | return false;
|
25847 | }
|
25848 | const [firstArg, secondArg] = args;
|
25849 | if (firstArg.type === "ModuleExpression" && isTypeModuleObjectExpression(secondArg)) {
|
25850 | return true;
|
25851 | }
|
25852 | return !hasComment(firstArg) && (firstArg.type === "FunctionExpression" || firstArg.type === "ArrowFunctionExpression" && firstArg.body.type === "BlockStatement") && secondArg.type !== "FunctionExpression" && secondArg.type !== "ArrowFunctionExpression" && secondArg.type !== "ConditionalExpression" && !couldGroupArg(secondArg);
|
25853 | }
|
25854 | function isReactHookCallWithDepsArray(args) {
|
25855 | return args.length === 2 && args[0].type === "ArrowFunctionExpression" && getFunctionParameters(args[0]).length === 0 && args[0].body.type === "BlockStatement" && args[1].type === "ArrayExpression" && !args.some((arg) => hasComment(arg));
|
25856 | }
|
25857 | function isNonEmptyBlockStatement(node) {
|
25858 | return node.type === "BlockStatement" && (node.body.some((node2) => node2.type !== "EmptyStatement") || hasComment(node, CommentCheckFlags.Dangling));
|
25859 | }
|
25860 | function isTypeModuleObjectExpression(node) {
|
25861 | return node.type === "ObjectExpression" && node.properties.length === 1 && isObjectProperty(node.properties[0]) && node.properties[0].key.type === "Identifier" && node.properties[0].key.name === "type" && isStringLiteral(node.properties[0].value) && node.properties[0].value.value === "module";
|
25862 | }
|
25863 | module2.exports = printCallArguments;
|
25864 | }
|
25865 | });
|
25866 | var require_member = __commonJS2({
|
25867 | "src/language-js/print/member.js"(exports2, module2) {
|
25868 | "use strict";
|
25869 | var {
|
25870 | builders: {
|
25871 | softline,
|
25872 | group,
|
25873 | indent,
|
25874 | label
|
25875 | }
|
25876 | } = require("./doc.js");
|
25877 | var {
|
25878 | isNumericLiteral,
|
25879 | isMemberExpression,
|
25880 | isCallExpression
|
25881 | } = require_utils7();
|
25882 | var {
|
25883 | printOptionalToken
|
25884 | } = require_misc();
|
25885 | function printMemberExpression(path, options, print) {
|
25886 | const node = path.getValue();
|
25887 | const parent = path.getParentNode();
|
25888 | let firstNonMemberParent;
|
25889 | let i = 0;
|
25890 | do {
|
25891 | firstNonMemberParent = path.getParentNode(i);
|
25892 | i++;
|
25893 | } while (firstNonMemberParent && (isMemberExpression(firstNonMemberParent) || firstNonMemberParent.type === "TSNonNullExpression"));
|
25894 | const objectDoc = print("object");
|
25895 | const lookupDoc = printMemberLookup(path, options, print);
|
25896 | const shouldInline = firstNonMemberParent && (firstNonMemberParent.type === "NewExpression" || firstNonMemberParent.type === "BindExpression" || firstNonMemberParent.type === "AssignmentExpression" && firstNonMemberParent.left.type !== "Identifier") || node.computed || node.object.type === "Identifier" && node.property.type === "Identifier" && !isMemberExpression(parent) || (parent.type === "AssignmentExpression" || parent.type === "VariableDeclarator") && (isCallExpression(node.object) && node.object.arguments.length > 0 || node.object.type === "TSNonNullExpression" && isCallExpression(node.object.expression) && node.object.expression.arguments.length > 0 || objectDoc.label === "member-chain");
|
25897 | return label(objectDoc.label === "member-chain" ? "member-chain" : "member", [objectDoc, shouldInline ? lookupDoc : group(indent([softline, lookupDoc]))]);
|
25898 | }
|
25899 | function printMemberLookup(path, options, print) {
|
25900 | const property = print("property");
|
25901 | const node = path.getValue();
|
25902 | const optional = printOptionalToken(path);
|
25903 | if (!node.computed) {
|
25904 | return [optional, ".", property];
|
25905 | }
|
25906 | if (!node.property || isNumericLiteral(node.property)) {
|
25907 | return [optional, "[", property, "]"];
|
25908 | }
|
25909 | return group([optional, "[", indent([softline, property]), softline, "]"]);
|
25910 | }
|
25911 | module2.exports = {
|
25912 | printMemberExpression,
|
25913 | printMemberLookup
|
25914 | };
|
25915 | }
|
25916 | });
|
25917 | var require_member_chain = __commonJS2({
|
25918 | "src/language-js/print/member-chain.js"(exports2, module2) {
|
25919 | "use strict";
|
25920 | var {
|
25921 | printComments
|
25922 | } = require_comments();
|
25923 | var {
|
25924 | getLast,
|
25925 | isNextLineEmptyAfterIndex,
|
25926 | getNextNonSpaceNonCommentCharacterIndex
|
25927 | } = require_util();
|
25928 | var pathNeedsParens = require_needs_parens();
|
25929 | var {
|
25930 | isCallExpression,
|
25931 | isMemberExpression,
|
25932 | isFunctionOrArrowExpression,
|
25933 | isLongCurriedCallExpression,
|
25934 | isMemberish,
|
25935 | isNumericLiteral,
|
25936 | isSimpleCallArgument,
|
25937 | hasComment,
|
25938 | CommentCheckFlags,
|
25939 | isNextLineEmpty
|
25940 | } = require_utils7();
|
25941 | var {
|
25942 | locEnd
|
25943 | } = require_loc();
|
25944 | var {
|
25945 | builders: {
|
25946 | join,
|
25947 | hardline,
|
25948 | group,
|
25949 | indent,
|
25950 | conditionalGroup,
|
25951 | breakParent,
|
25952 | label
|
25953 | },
|
25954 | utils: {
|
25955 | willBreak
|
25956 | }
|
25957 | } = require("./doc.js");
|
25958 | var printCallArguments = require_call_arguments();
|
25959 | var {
|
25960 | printMemberLookup
|
25961 | } = require_member();
|
25962 | var {
|
25963 | printOptionalToken,
|
25964 | printFunctionTypeParameters,
|
25965 | printBindExpressionCallee
|
25966 | } = require_misc();
|
25967 | function printMemberChain(path, options, print) {
|
25968 | const parent = path.getParentNode();
|
25969 | const isExpressionStatement = !parent || parent.type === "ExpressionStatement";
|
25970 | const printedNodes = [];
|
25971 | function shouldInsertEmptyLineAfter(node2) {
|
25972 | const {
|
25973 | originalText
|
25974 | } = options;
|
25975 | const nextCharIndex = getNextNonSpaceNonCommentCharacterIndex(originalText, node2, locEnd);
|
25976 | const nextChar = originalText.charAt(nextCharIndex);
|
25977 | if (nextChar === ")") {
|
25978 | return nextCharIndex !== false && isNextLineEmptyAfterIndex(originalText, nextCharIndex + 1);
|
25979 | }
|
25980 | return isNextLineEmpty(node2, options);
|
25981 | }
|
25982 | function rec(path2) {
|
25983 | const node2 = path2.getValue();
|
25984 | if (isCallExpression(node2) && (isMemberish(node2.callee) || isCallExpression(node2.callee))) {
|
25985 | printedNodes.unshift({
|
25986 | node: node2,
|
25987 | printed: [printComments(path2, [printOptionalToken(path2), printFunctionTypeParameters(path2, options, print), printCallArguments(path2, options, print)], options), shouldInsertEmptyLineAfter(node2) ? hardline : ""]
|
25988 | });
|
25989 | path2.call((callee) => rec(callee), "callee");
|
25990 | } else if (isMemberish(node2)) {
|
25991 | printedNodes.unshift({
|
25992 | node: node2,
|
25993 | needsParens: pathNeedsParens(path2, options),
|
25994 | printed: printComments(path2, isMemberExpression(node2) ? printMemberLookup(path2, options, print) : printBindExpressionCallee(path2, options, print), options)
|
25995 | });
|
25996 | path2.call((object) => rec(object), "object");
|
25997 | } else if (node2.type === "TSNonNullExpression") {
|
25998 | printedNodes.unshift({
|
25999 | node: node2,
|
26000 | printed: printComments(path2, "!", options)
|
26001 | });
|
26002 | path2.call((expression) => rec(expression), "expression");
|
26003 | } else {
|
26004 | printedNodes.unshift({
|
26005 | node: node2,
|
26006 | printed: print()
|
26007 | });
|
26008 | }
|
26009 | }
|
26010 | const node = path.getValue();
|
26011 | printedNodes.unshift({
|
26012 | node,
|
26013 | printed: [printOptionalToken(path), printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)]
|
26014 | });
|
26015 | if (node.callee) {
|
26016 | path.call((callee) => rec(callee), "callee");
|
26017 | }
|
26018 | const groups = [];
|
26019 | let currentGroup = [printedNodes[0]];
|
26020 | let i = 1;
|
26021 | for (; i < printedNodes.length; ++i) {
|
26022 | if (printedNodes[i].node.type === "TSNonNullExpression" || isCallExpression(printedNodes[i].node) || isMemberExpression(printedNodes[i].node) && printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
|
26023 | currentGroup.push(printedNodes[i]);
|
26024 | } else {
|
26025 | break;
|
26026 | }
|
26027 | }
|
26028 | if (!isCallExpression(printedNodes[0].node)) {
|
26029 | for (; i + 1 < printedNodes.length; ++i) {
|
26030 | if (isMemberish(printedNodes[i].node) && isMemberish(printedNodes[i + 1].node)) {
|
26031 | currentGroup.push(printedNodes[i]);
|
26032 | } else {
|
26033 | break;
|
26034 | }
|
26035 | }
|
26036 | }
|
26037 | groups.push(currentGroup);
|
26038 | currentGroup = [];
|
26039 | let hasSeenCallExpression = false;
|
26040 | for (; i < printedNodes.length; ++i) {
|
26041 | if (hasSeenCallExpression && isMemberish(printedNodes[i].node)) {
|
26042 | if (printedNodes[i].node.computed && isNumericLiteral(printedNodes[i].node.property)) {
|
26043 | currentGroup.push(printedNodes[i]);
|
26044 | continue;
|
26045 | }
|
26046 | groups.push(currentGroup);
|
26047 | currentGroup = [];
|
26048 | hasSeenCallExpression = false;
|
26049 | }
|
26050 | if (isCallExpression(printedNodes[i].node) || printedNodes[i].node.type === "ImportExpression") {
|
26051 | hasSeenCallExpression = true;
|
26052 | }
|
26053 | currentGroup.push(printedNodes[i]);
|
26054 | if (hasComment(printedNodes[i].node, CommentCheckFlags.Trailing)) {
|
26055 | groups.push(currentGroup);
|
26056 | currentGroup = [];
|
26057 | hasSeenCallExpression = false;
|
26058 | }
|
26059 | }
|
26060 | if (currentGroup.length > 0) {
|
26061 | groups.push(currentGroup);
|
26062 | }
|
26063 | function isFactory(name) {
|
26064 | return /^[A-Z]|^[$_]+$/.test(name);
|
26065 | }
|
26066 | function isShort(name) {
|
26067 | return name.length <= options.tabWidth;
|
26068 | }
|
26069 | function shouldNotWrap(groups2) {
|
26070 | const hasComputed = groups2[1].length > 0 && groups2[1][0].node.computed;
|
26071 | if (groups2[0].length === 1) {
|
26072 | const firstNode = groups2[0][0].node;
|
26073 | return firstNode.type === "ThisExpression" || firstNode.type === "Identifier" && (isFactory(firstNode.name) || isExpressionStatement && isShort(firstNode.name) || hasComputed);
|
26074 | }
|
26075 | const lastNode = getLast(groups2[0]).node;
|
26076 | return isMemberExpression(lastNode) && lastNode.property.type === "Identifier" && (isFactory(lastNode.property.name) || hasComputed);
|
26077 | }
|
26078 | const shouldMerge = groups.length >= 2 && !hasComment(groups[1][0].node) && shouldNotWrap(groups);
|
26079 | function printGroup(printedGroup) {
|
26080 | const printed = printedGroup.map((tuple) => tuple.printed);
|
26081 | if (printedGroup.length > 0 && getLast(printedGroup).needsParens) {
|
26082 | return ["(", ...printed, ")"];
|
26083 | }
|
26084 | return printed;
|
26085 | }
|
26086 | function printIndentedGroup(groups2) {
|
26087 | if (groups2.length === 0) {
|
26088 | return "";
|
26089 | }
|
26090 | return indent(group([hardline, join(hardline, groups2.map(printGroup))]));
|
26091 | }
|
26092 | const printedGroups = groups.map(printGroup);
|
26093 | const oneLine = printedGroups;
|
26094 | const cutoff = shouldMerge ? 3 : 2;
|
26095 | const flatGroups = groups.flat();
|
26096 | const nodeHasComment = flatGroups.slice(1, -1).some((node2) => hasComment(node2.node, CommentCheckFlags.Leading)) || flatGroups.slice(0, -1).some((node2) => hasComment(node2.node, CommentCheckFlags.Trailing)) || groups[cutoff] && hasComment(groups[cutoff][0].node, CommentCheckFlags.Leading);
|
26097 | if (groups.length <= cutoff && !nodeHasComment) {
|
26098 | if (isLongCurriedCallExpression(path)) {
|
26099 | return oneLine;
|
26100 | }
|
26101 | return group(oneLine);
|
26102 | }
|
26103 | const lastNodeBeforeIndent = getLast(groups[shouldMerge ? 1 : 0]).node;
|
26104 | const shouldHaveEmptyLineBeforeIndent = !isCallExpression(lastNodeBeforeIndent) && shouldInsertEmptyLineAfter(lastNodeBeforeIndent);
|
26105 | const expanded = [printGroup(groups[0]), shouldMerge ? groups.slice(1, 2).map(printGroup) : "", shouldHaveEmptyLineBeforeIndent ? hardline : "", printIndentedGroup(groups.slice(shouldMerge ? 2 : 1))];
|
26106 | const callExpressions = printedNodes.map(({
|
26107 | node: node2
|
26108 | }) => node2).filter(isCallExpression);
|
26109 | function lastGroupWillBreakAndOtherCallsHaveFunctionArguments() {
|
26110 | const lastGroupNode = getLast(getLast(groups)).node;
|
26111 | const lastGroupDoc = getLast(printedGroups);
|
26112 | return isCallExpression(lastGroupNode) && willBreak(lastGroupDoc) && callExpressions.slice(0, -1).some((node2) => node2.arguments.some(isFunctionOrArrowExpression));
|
26113 | }
|
26114 | let result;
|
26115 | if (nodeHasComment || callExpressions.length > 2 && callExpressions.some((expr) => !expr.arguments.every((arg) => isSimpleCallArgument(arg, 0))) || printedGroups.slice(0, -1).some(willBreak) || lastGroupWillBreakAndOtherCallsHaveFunctionArguments()) {
|
26116 | result = group(expanded);
|
26117 | } else {
|
26118 | result = [willBreak(oneLine) || shouldHaveEmptyLineBeforeIndent ? breakParent : "", conditionalGroup([oneLine, expanded])];
|
26119 | }
|
26120 | return label("member-chain", result);
|
26121 | }
|
26122 | module2.exports = printMemberChain;
|
26123 | }
|
26124 | });
|
26125 | var require_call_expression = __commonJS2({
|
26126 | "src/language-js/print/call-expression.js"(exports2, module2) {
|
26127 | "use strict";
|
26128 | var {
|
26129 | builders: {
|
26130 | join,
|
26131 | group
|
26132 | }
|
26133 | } = require("./doc.js");
|
26134 | var pathNeedsParens = require_needs_parens();
|
26135 | var {
|
26136 | getCallArguments,
|
26137 | hasFlowAnnotationComment,
|
26138 | isCallExpression,
|
26139 | isMemberish,
|
26140 | isStringLiteral,
|
26141 | isTemplateOnItsOwnLine,
|
26142 | isTestCall,
|
26143 | iterateCallArgumentsPath
|
26144 | } = require_utils7();
|
26145 | var printMemberChain = require_member_chain();
|
26146 | var printCallArguments = require_call_arguments();
|
26147 | var {
|
26148 | printOptionalToken,
|
26149 | printFunctionTypeParameters
|
26150 | } = require_misc();
|
26151 | function printCallExpression(path, options, print) {
|
26152 | const node = path.getValue();
|
26153 | const parentNode = path.getParentNode();
|
26154 | const isNew = node.type === "NewExpression";
|
26155 | const isDynamicImport = node.type === "ImportExpression";
|
26156 | const optional = printOptionalToken(path);
|
26157 | const args = getCallArguments(node);
|
26158 | if (args.length > 0 && (!isDynamicImport && !isNew && isCommonsJsOrAmdCall(node, parentNode) || args.length === 1 && isTemplateOnItsOwnLine(args[0], options.originalText) || !isNew && isTestCall(node, parentNode))) {
|
26159 | const printed = [];
|
26160 | iterateCallArgumentsPath(path, () => {
|
26161 | printed.push(print());
|
26162 | });
|
26163 | return [isNew ? "new " : "", print("callee"), optional, printFunctionTypeParameters(path, options, print), "(", join(", ", printed), ")"];
|
26164 | }
|
26165 | const isIdentifierWithFlowAnnotation = (options.parser === "babel" || options.parser === "babel-flow") && node.callee && node.callee.type === "Identifier" && hasFlowAnnotationComment(node.callee.trailingComments);
|
26166 | if (isIdentifierWithFlowAnnotation) {
|
26167 | node.callee.trailingComments[0].printed = true;
|
26168 | }
|
26169 | if (!isDynamicImport && !isNew && isMemberish(node.callee) && !path.call((path2) => pathNeedsParens(path2, options), "callee")) {
|
26170 | return printMemberChain(path, options, print);
|
26171 | }
|
26172 | const contents = [isNew ? "new " : "", isDynamicImport ? "import" : print("callee"), optional, isIdentifierWithFlowAnnotation ? `/*:: ${node.callee.trailingComments[0].value.slice(2).trim()} */` : "", printFunctionTypeParameters(path, options, print), printCallArguments(path, options, print)];
|
26173 | if (isDynamicImport || isCallExpression(node.callee)) {
|
26174 | return group(contents);
|
26175 | }
|
26176 | return contents;
|
26177 | }
|
26178 | function isCommonsJsOrAmdCall(node, parentNode) {
|
26179 | if (node.callee.type !== "Identifier") {
|
26180 | return false;
|
26181 | }
|
26182 | if (node.callee.name === "require") {
|
26183 | return true;
|
26184 | }
|
26185 | if (node.callee.name === "define") {
|
26186 | const args = getCallArguments(node);
|
26187 | return parentNode.type === "ExpressionStatement" && (args.length === 1 || args.length === 2 && args[0].type === "ArrayExpression" || args.length === 3 && isStringLiteral(args[0]) && args[1].type === "ArrayExpression");
|
26188 | }
|
26189 | return false;
|
26190 | }
|
26191 | module2.exports = {
|
26192 | printCallExpression
|
26193 | };
|
26194 | }
|
26195 | });
|
26196 | var require_assignment = __commonJS2({
|
26197 | "src/language-js/print/assignment.js"(exports2, module2) {
|
26198 | "use strict";
|
26199 | var {
|
26200 | isNonEmptyArray,
|
26201 | getStringWidth
|
26202 | } = require_util();
|
26203 | var {
|
26204 | builders: {
|
26205 | line,
|
26206 | group,
|
26207 | indent,
|
26208 | indentIfBreak,
|
26209 | lineSuffixBoundary
|
26210 | },
|
26211 | utils: {
|
26212 | cleanDoc,
|
26213 | willBreak,
|
26214 | canBreak
|
26215 | }
|
26216 | } = require("./doc.js");
|
26217 | var {
|
26218 | hasLeadingOwnLineComment,
|
26219 | isBinaryish,
|
26220 | isStringLiteral,
|
26221 | isLiteral,
|
26222 | isNumericLiteral,
|
26223 | isCallExpression,
|
26224 | isMemberExpression,
|
26225 | getCallArguments,
|
26226 | rawText,
|
26227 | hasComment,
|
26228 | isSignedNumericLiteral,
|
26229 | isObjectProperty
|
26230 | } = require_utils7();
|
26231 | var {
|
26232 | shouldInlineLogicalExpression
|
26233 | } = require_binaryish();
|
26234 | var {
|
26235 | printCallExpression
|
26236 | } = require_call_expression();
|
26237 | function printAssignment(path, options, print, leftDoc, operator, rightPropertyName) {
|
26238 | const layout = chooseLayout(path, options, print, leftDoc, rightPropertyName);
|
26239 | const rightDoc = print(rightPropertyName, {
|
26240 | assignmentLayout: layout
|
26241 | });
|
26242 | switch (layout) {
|
26243 | case "break-after-operator":
|
26244 | return group([group(leftDoc), operator, group(indent([line, rightDoc]))]);
|
26245 | case "never-break-after-operator":
|
26246 | return group([group(leftDoc), operator, " ", rightDoc]);
|
26247 | case "fluid": {
|
26248 | const groupId = Symbol("assignment");
|
26249 | return group([group(leftDoc), operator, group(indent(line), {
|
26250 | id: groupId
|
26251 | }), lineSuffixBoundary, indentIfBreak(rightDoc, {
|
26252 | groupId
|
26253 | })]);
|
26254 | }
|
26255 | case "break-lhs":
|
26256 | return group([leftDoc, operator, " ", group(rightDoc)]);
|
26257 | case "chain":
|
26258 | return [group(leftDoc), operator, line, rightDoc];
|
26259 | case "chain-tail":
|
26260 | return [group(leftDoc), operator, indent([line, rightDoc])];
|
26261 | case "chain-tail-arrow-chain":
|
26262 | return [group(leftDoc), operator, rightDoc];
|
26263 | case "only-left":
|
26264 | return leftDoc;
|
26265 | }
|
26266 | }
|
26267 | function printAssignmentExpression(path, options, print) {
|
26268 | const node = path.getValue();
|
26269 | return printAssignment(path, options, print, print("left"), [" ", node.operator], "right");
|
26270 | }
|
26271 | function printVariableDeclarator(path, options, print) {
|
26272 | return printAssignment(path, options, print, print("id"), " =", "init");
|
26273 | }
|
26274 | function chooseLayout(path, options, print, leftDoc, rightPropertyName) {
|
26275 | const node = path.getValue();
|
26276 | const rightNode = node[rightPropertyName];
|
26277 | if (!rightNode) {
|
26278 | return "only-left";
|
26279 | }
|
26280 | const isTail = !isAssignment(rightNode);
|
26281 | const shouldUseChainFormatting = path.match(isAssignment, isAssignmentOrVariableDeclarator, (node2) => !isTail || node2.type !== "ExpressionStatement" && node2.type !== "VariableDeclaration");
|
26282 | if (shouldUseChainFormatting) {
|
26283 | return !isTail ? "chain" : rightNode.type === "ArrowFunctionExpression" && rightNode.body.type === "ArrowFunctionExpression" ? "chain-tail-arrow-chain" : "chain-tail";
|
26284 | }
|
26285 | const isHeadOfLongChain = !isTail && isAssignment(rightNode.right);
|
26286 | if (isHeadOfLongChain || hasLeadingOwnLineComment(options.originalText, rightNode)) {
|
26287 | return "break-after-operator";
|
26288 | }
|
26289 | if (rightNode.type === "CallExpression" && rightNode.callee.name === "require" || options.parser === "json5" || options.parser === "json") {
|
26290 | return "never-break-after-operator";
|
26291 | }
|
26292 | if (isComplexDestructuring(node) || isComplexTypeAliasParams(node) || hasComplexTypeAnnotation(node) || isArrowFunctionVariableDeclarator(node) && canBreak(leftDoc)) {
|
26293 | return "break-lhs";
|
26294 | }
|
26295 | const hasShortKey = isObjectPropertyWithShortKey(node, leftDoc, options);
|
26296 | if (path.call(() => shouldBreakAfterOperator(path, options, print, hasShortKey), rightPropertyName)) {
|
26297 | return "break-after-operator";
|
26298 | }
|
26299 | if (hasShortKey || rightNode.type === "TemplateLiteral" || rightNode.type === "TaggedTemplateExpression" || rightNode.type === "BooleanLiteral" || isNumericLiteral(rightNode) || rightNode.type === "ClassExpression") {
|
26300 | return "never-break-after-operator";
|
26301 | }
|
26302 | return "fluid";
|
26303 | }
|
26304 | function shouldBreakAfterOperator(path, options, print, hasShortKey) {
|
26305 | const rightNode = path.getValue();
|
26306 | if (isBinaryish(rightNode) && !shouldInlineLogicalExpression(rightNode)) {
|
26307 | return true;
|
26308 | }
|
26309 | switch (rightNode.type) {
|
26310 | case "StringLiteralTypeAnnotation":
|
26311 | case "SequenceExpression":
|
26312 | return true;
|
26313 | case "ConditionalExpression": {
|
26314 | const {
|
26315 | test
|
26316 | } = rightNode;
|
26317 | return isBinaryish(test) && !shouldInlineLogicalExpression(test);
|
26318 | }
|
26319 | case "ClassExpression":
|
26320 | return isNonEmptyArray(rightNode.decorators);
|
26321 | }
|
26322 | if (hasShortKey) {
|
26323 | return false;
|
26324 | }
|
26325 | let node = rightNode;
|
26326 | const propertiesForPath = [];
|
26327 | for (; ; ) {
|
26328 | if (node.type === "UnaryExpression") {
|
26329 | node = node.argument;
|
26330 | propertiesForPath.push("argument");
|
26331 | } else if (node.type === "TSNonNullExpression") {
|
26332 | node = node.expression;
|
26333 | propertiesForPath.push("expression");
|
26334 | } else {
|
26335 | break;
|
26336 | }
|
26337 | }
|
26338 | if (isStringLiteral(node) || path.call(() => isPoorlyBreakableMemberOrCallChain(path, options, print), ...propertiesForPath)) {
|
26339 | return true;
|
26340 | }
|
26341 | return false;
|
26342 | }
|
26343 | function isComplexDestructuring(node) {
|
26344 | if (isAssignmentOrVariableDeclarator(node)) {
|
26345 | const leftNode = node.left || node.id;
|
26346 | return leftNode.type === "ObjectPattern" && leftNode.properties.length > 2 && leftNode.properties.some((property) => isObjectProperty(property) && (!property.shorthand || property.value && property.value.type === "AssignmentPattern"));
|
26347 | }
|
26348 | return false;
|
26349 | }
|
26350 | function isAssignment(node) {
|
26351 | return node.type === "AssignmentExpression";
|
26352 | }
|
26353 | function isAssignmentOrVariableDeclarator(node) {
|
26354 | return isAssignment(node) || node.type === "VariableDeclarator";
|
26355 | }
|
26356 | function isComplexTypeAliasParams(node) {
|
26357 | const typeParams = getTypeParametersFromTypeAlias(node);
|
26358 | if (isNonEmptyArray(typeParams)) {
|
26359 | const constraintPropertyName = node.type === "TSTypeAliasDeclaration" ? "constraint" : "bound";
|
26360 | if (typeParams.length > 1 && typeParams.some((param) => param[constraintPropertyName] || param.default)) {
|
26361 | return true;
|
26362 | }
|
26363 | }
|
26364 | return false;
|
26365 | }
|
26366 | function getTypeParametersFromTypeAlias(node) {
|
26367 | if (isTypeAlias(node) && node.typeParameters && node.typeParameters.params) {
|
26368 | return node.typeParameters.params;
|
26369 | }
|
26370 | return null;
|
26371 | }
|
26372 | function isTypeAlias(node) {
|
26373 | return node.type === "TSTypeAliasDeclaration" || node.type === "TypeAlias";
|
26374 | }
|
26375 | function hasComplexTypeAnnotation(node) {
|
26376 | if (node.type !== "VariableDeclarator") {
|
26377 | return false;
|
26378 | }
|
26379 | const {
|
26380 | typeAnnotation
|
26381 | } = node.id;
|
26382 | if (!typeAnnotation || !typeAnnotation.typeAnnotation) {
|
26383 | return false;
|
26384 | }
|
26385 | const typeParams = getTypeParametersFromTypeReference(typeAnnotation.typeAnnotation);
|
26386 | return isNonEmptyArray(typeParams) && typeParams.length > 1 && typeParams.some((param) => isNonEmptyArray(getTypeParametersFromTypeReference(param)) || param.type === "TSConditionalType");
|
26387 | }
|
26388 | function isArrowFunctionVariableDeclarator(node) {
|
26389 | return node.type === "VariableDeclarator" && node.init && node.init.type === "ArrowFunctionExpression";
|
26390 | }
|
26391 | function getTypeParametersFromTypeReference(node) {
|
26392 | if (isTypeReference(node) && node.typeParameters && node.typeParameters.params) {
|
26393 | return node.typeParameters.params;
|
26394 | }
|
26395 | return null;
|
26396 | }
|
26397 | function isTypeReference(node) {
|
26398 | return node.type === "TSTypeReference" || node.type === "GenericTypeAnnotation";
|
26399 | }
|
26400 | function isPoorlyBreakableMemberOrCallChain(path, options, print, deep = false) {
|
26401 | const node = path.getValue();
|
26402 | const goDeeper = () => isPoorlyBreakableMemberOrCallChain(path, options, print, true);
|
26403 | if (node.type === "TSNonNullExpression") {
|
26404 | return path.call(goDeeper, "expression");
|
26405 | }
|
26406 | if (isCallExpression(node)) {
|
26407 | const doc2 = printCallExpression(path, options, print);
|
26408 | if (doc2.label === "member-chain") {
|
26409 | return false;
|
26410 | }
|
26411 | const args = getCallArguments(node);
|
26412 | const isPoorlyBreakableCall = args.length === 0 || args.length === 1 && isLoneShortArgument(args[0], options);
|
26413 | if (!isPoorlyBreakableCall) {
|
26414 | return false;
|
26415 | }
|
26416 | if (isCallExpressionWithComplexTypeArguments(node, print)) {
|
26417 | return false;
|
26418 | }
|
26419 | return path.call(goDeeper, "callee");
|
26420 | }
|
26421 | if (isMemberExpression(node)) {
|
26422 | return path.call(goDeeper, "object");
|
26423 | }
|
26424 | return deep && (node.type === "Identifier" || node.type === "ThisExpression");
|
26425 | }
|
26426 | var LONE_SHORT_ARGUMENT_THRESHOLD_RATE = 0.25;
|
26427 | function isLoneShortArgument(node, {
|
26428 | printWidth
|
26429 | }) {
|
26430 | if (hasComment(node)) {
|
26431 | return false;
|
26432 | }
|
26433 | const threshold = printWidth * LONE_SHORT_ARGUMENT_THRESHOLD_RATE;
|
26434 | if (node.type === "ThisExpression" || node.type === "Identifier" && node.name.length <= threshold || isSignedNumericLiteral(node) && !hasComment(node.argument)) {
|
26435 | return true;
|
26436 | }
|
26437 | const regexpPattern = node.type === "Literal" && "regex" in node && node.regex.pattern || node.type === "RegExpLiteral" && node.pattern;
|
26438 | if (regexpPattern) {
|
26439 | return regexpPattern.length <= threshold;
|
26440 | }
|
26441 | if (isStringLiteral(node)) {
|
26442 | return rawText(node).length <= threshold;
|
26443 | }
|
26444 | if (node.type === "TemplateLiteral") {
|
26445 | return node.expressions.length === 0 && node.quasis[0].value.raw.length <= threshold && !node.quasis[0].value.raw.includes("\n");
|
26446 | }
|
26447 | return isLiteral(node);
|
26448 | }
|
26449 | function isObjectPropertyWithShortKey(node, keyDoc, options) {
|
26450 | if (!isObjectProperty(node)) {
|
26451 | return false;
|
26452 | }
|
26453 | keyDoc = cleanDoc(keyDoc);
|
26454 | const MIN_OVERLAP_FOR_BREAK = 3;
|
26455 | return typeof keyDoc === "string" && getStringWidth(keyDoc) < options.tabWidth + MIN_OVERLAP_FOR_BREAK;
|
26456 | }
|
26457 | function isCallExpressionWithComplexTypeArguments(node, print) {
|
26458 | const typeArgs = getTypeArgumentsFromCallExpression(node);
|
26459 | if (isNonEmptyArray(typeArgs)) {
|
26460 | if (typeArgs.length > 1) {
|
26461 | return true;
|
26462 | }
|
26463 | if (typeArgs.length === 1) {
|
26464 | const firstArg = typeArgs[0];
|
26465 | if (firstArg.type === "TSUnionType" || firstArg.type === "UnionTypeAnnotation" || firstArg.type === "TSIntersectionType" || firstArg.type === "IntersectionTypeAnnotation" || firstArg.type === "TSTypeLiteral" || firstArg.type === "ObjectTypeAnnotation") {
|
26466 | return true;
|
26467 | }
|
26468 | }
|
26469 | const typeArgsKeyName = node.typeParameters ? "typeParameters" : "typeArguments";
|
26470 | if (willBreak(print(typeArgsKeyName))) {
|
26471 | return true;
|
26472 | }
|
26473 | }
|
26474 | return false;
|
26475 | }
|
26476 | function getTypeArgumentsFromCallExpression(node) {
|
26477 | return node.typeParameters && node.typeParameters.params || node.typeArguments && node.typeArguments.params;
|
26478 | }
|
26479 | module2.exports = {
|
26480 | printVariableDeclarator,
|
26481 | printAssignmentExpression,
|
26482 | printAssignment,
|
26483 | isArrowFunctionVariableDeclarator
|
26484 | };
|
26485 | }
|
26486 | });
|
26487 | var require_function_parameters = __commonJS2({
|
26488 | "src/language-js/print/function-parameters.js"(exports2, module2) {
|
26489 | "use strict";
|
26490 | var {
|
26491 | getNextNonSpaceNonCommentCharacter
|
26492 | } = require_util();
|
26493 | var {
|
26494 | printDanglingComments
|
26495 | } = require_comments();
|
26496 | var {
|
26497 | builders: {
|
26498 | line,
|
26499 | hardline,
|
26500 | softline,
|
26501 | group,
|
26502 | indent,
|
26503 | ifBreak
|
26504 | },
|
26505 | utils: {
|
26506 | removeLines,
|
26507 | willBreak
|
26508 | }
|
26509 | } = require("./doc.js");
|
26510 | var {
|
26511 | getFunctionParameters,
|
26512 | iterateFunctionParametersPath,
|
26513 | isSimpleType,
|
26514 | isTestCall,
|
26515 | isTypeAnnotationAFunction,
|
26516 | isObjectType,
|
26517 | isObjectTypePropertyAFunction,
|
26518 | hasRestParameter,
|
26519 | shouldPrintComma,
|
26520 | hasComment,
|
26521 | isNextLineEmpty
|
26522 | } = require_utils7();
|
26523 | var {
|
26524 | locEnd
|
26525 | } = require_loc();
|
26526 | var {
|
26527 | ArgExpansionBailout
|
26528 | } = require_errors();
|
26529 | var {
|
26530 | printFunctionTypeParameters
|
26531 | } = require_misc();
|
26532 | function printFunctionParameters(path, print, options, expandArg, printTypeParams) {
|
26533 | const functionNode = path.getValue();
|
26534 | const parameters = getFunctionParameters(functionNode);
|
26535 | const typeParams = printTypeParams ? printFunctionTypeParameters(path, options, print) : "";
|
26536 | if (parameters.length === 0) {
|
26537 | return [typeParams, "(", printDanglingComments(path, options, true, (comment) => getNextNonSpaceNonCommentCharacter(options.originalText, comment, locEnd) === ")"), ")"];
|
26538 | }
|
26539 | const parent = path.getParentNode();
|
26540 | const isParametersInTestCall = isTestCall(parent);
|
26541 | const shouldHugParameters = shouldHugFunctionParameters(functionNode);
|
26542 | const printed = [];
|
26543 | iterateFunctionParametersPath(path, (parameterPath, index) => {
|
26544 | const isLastParameter = index === parameters.length - 1;
|
26545 | if (isLastParameter && functionNode.rest) {
|
26546 | printed.push("...");
|
26547 | }
|
26548 | printed.push(print());
|
26549 | if (isLastParameter) {
|
26550 | return;
|
26551 | }
|
26552 | printed.push(",");
|
26553 | if (isParametersInTestCall || shouldHugParameters) {
|
26554 | printed.push(" ");
|
26555 | } else if (isNextLineEmpty(parameters[index], options)) {
|
26556 | printed.push(hardline, hardline);
|
26557 | } else {
|
26558 | printed.push(line);
|
26559 | }
|
26560 | });
|
26561 | if (expandArg) {
|
26562 | if (willBreak(typeParams) || willBreak(printed)) {
|
26563 | throw new ArgExpansionBailout();
|
26564 | }
|
26565 | return group([removeLines(typeParams), "(", removeLines(printed), ")"]);
|
26566 | }
|
26567 | const hasNotParameterDecorator = parameters.every((node) => !node.decorators);
|
26568 | if (shouldHugParameters && hasNotParameterDecorator) {
|
26569 | return [typeParams, "(", ...printed, ")"];
|
26570 | }
|
26571 | if (isParametersInTestCall) {
|
26572 | return [typeParams, "(", ...printed, ")"];
|
26573 | }
|
26574 | const isFlowShorthandWithOneArg = (isObjectTypePropertyAFunction(parent) || isTypeAnnotationAFunction(parent) || parent.type === "TypeAlias" || parent.type === "UnionTypeAnnotation" || parent.type === "TSUnionType" || parent.type === "IntersectionTypeAnnotation" || parent.type === "FunctionTypeAnnotation" && parent.returnType === functionNode) && parameters.length === 1 && parameters[0].name === null && functionNode.this !== parameters[0] && parameters[0].typeAnnotation && functionNode.typeParameters === null && isSimpleType(parameters[0].typeAnnotation) && !functionNode.rest;
|
26575 | if (isFlowShorthandWithOneArg) {
|
26576 | if (options.arrowParens === "always") {
|
26577 | return ["(", ...printed, ")"];
|
26578 | }
|
26579 | return printed;
|
26580 | }
|
26581 | return [typeParams, "(", indent([softline, ...printed]), ifBreak(!hasRestParameter(functionNode) && shouldPrintComma(options, "all") ? "," : ""), softline, ")"];
|
26582 | }
|
26583 | function shouldHugFunctionParameters(node) {
|
26584 | if (!node) {
|
26585 | return false;
|
26586 | }
|
26587 | const parameters = getFunctionParameters(node);
|
26588 | if (parameters.length !== 1) {
|
26589 | return false;
|
26590 | }
|
26591 | const [parameter] = parameters;
|
26592 | return !hasComment(parameter) && (parameter.type === "ObjectPattern" || parameter.type === "ArrayPattern" || parameter.type === "Identifier" && parameter.typeAnnotation && (parameter.typeAnnotation.type === "TypeAnnotation" || parameter.typeAnnotation.type === "TSTypeAnnotation") && isObjectType(parameter.typeAnnotation.typeAnnotation) || parameter.type === "FunctionTypeParam" && isObjectType(parameter.typeAnnotation) || parameter.type === "AssignmentPattern" && (parameter.left.type === "ObjectPattern" || parameter.left.type === "ArrayPattern") && (parameter.right.type === "Identifier" || parameter.right.type === "ObjectExpression" && parameter.right.properties.length === 0 || parameter.right.type === "ArrayExpression" && parameter.right.elements.length === 0));
|
26593 | }
|
26594 | function getReturnTypeNode(functionNode) {
|
26595 | let returnTypeNode;
|
26596 | if (functionNode.returnType) {
|
26597 | returnTypeNode = functionNode.returnType;
|
26598 | if (returnTypeNode.typeAnnotation) {
|
26599 | returnTypeNode = returnTypeNode.typeAnnotation;
|
26600 | }
|
26601 | } else if (functionNode.typeAnnotation) {
|
26602 | returnTypeNode = functionNode.typeAnnotation;
|
26603 | }
|
26604 | return returnTypeNode;
|
26605 | }
|
26606 | function shouldGroupFunctionParameters(functionNode, returnTypeDoc) {
|
26607 | const returnTypeNode = getReturnTypeNode(functionNode);
|
26608 | if (!returnTypeNode) {
|
26609 | return false;
|
26610 | }
|
26611 | const typeParameters = functionNode.typeParameters && functionNode.typeParameters.params;
|
26612 | if (typeParameters) {
|
26613 | if (typeParameters.length > 1) {
|
26614 | return false;
|
26615 | }
|
26616 | if (typeParameters.length === 1) {
|
26617 | const typeParameter = typeParameters[0];
|
26618 | if (typeParameter.constraint || typeParameter.default) {
|
26619 | return false;
|
26620 | }
|
26621 | }
|
26622 | }
|
26623 | return getFunctionParameters(functionNode).length === 1 && (isObjectType(returnTypeNode) || willBreak(returnTypeDoc));
|
26624 | }
|
26625 | module2.exports = {
|
26626 | printFunctionParameters,
|
26627 | shouldHugFunctionParameters,
|
26628 | shouldGroupFunctionParameters
|
26629 | };
|
26630 | }
|
26631 | });
|
26632 | var require_type_annotation = __commonJS2({
|
26633 | "src/language-js/print/type-annotation.js"(exports2, module2) {
|
26634 | "use strict";
|
26635 | var {
|
26636 | printComments,
|
26637 | printDanglingComments
|
26638 | } = require_comments();
|
26639 | var {
|
26640 | isNonEmptyArray
|
26641 | } = require_util();
|
26642 | var {
|
26643 | builders: {
|
26644 | group,
|
26645 | join,
|
26646 | line,
|
26647 | softline,
|
26648 | indent,
|
26649 | align,
|
26650 | ifBreak
|
26651 | }
|
26652 | } = require("./doc.js");
|
26653 | var pathNeedsParens = require_needs_parens();
|
26654 | var {
|
26655 | locStart
|
26656 | } = require_loc();
|
26657 | var {
|
26658 | isSimpleType,
|
26659 | isObjectType,
|
26660 | hasLeadingOwnLineComment,
|
26661 | isObjectTypePropertyAFunction,
|
26662 | shouldPrintComma
|
26663 | } = require_utils7();
|
26664 | var {
|
26665 | printAssignment
|
26666 | } = require_assignment();
|
26667 | var {
|
26668 | printFunctionParameters,
|
26669 | shouldGroupFunctionParameters
|
26670 | } = require_function_parameters();
|
26671 | var {
|
26672 | printArrayItems
|
26673 | } = require_array4();
|
26674 | function shouldHugType(node) {
|
26675 | if (isSimpleType(node) || isObjectType(node)) {
|
26676 | return true;
|
26677 | }
|
26678 | if (node.type === "UnionTypeAnnotation" || node.type === "TSUnionType") {
|
26679 | const voidCount = node.types.filter((node2) => node2.type === "VoidTypeAnnotation" || node2.type === "TSVoidKeyword" || node2.type === "NullLiteralTypeAnnotation" || node2.type === "TSNullKeyword").length;
|
26680 | const hasObject = node.types.some((node2) => node2.type === "ObjectTypeAnnotation" || node2.type === "TSTypeLiteral" || node2.type === "GenericTypeAnnotation" || node2.type === "TSTypeReference");
|
26681 | if (node.types.length - 1 === voidCount && hasObject) {
|
26682 | return true;
|
26683 | }
|
26684 | }
|
26685 | return false;
|
26686 | }
|
26687 | function printOpaqueType(path, options, print) {
|
26688 | const semi = options.semi ? ";" : "";
|
26689 | const node = path.getValue();
|
26690 | const parts = [];
|
26691 | parts.push("opaque type ", print("id"), print("typeParameters"));
|
26692 | if (node.supertype) {
|
26693 | parts.push(": ", print("supertype"));
|
26694 | }
|
26695 | if (node.impltype) {
|
26696 | parts.push(" = ", print("impltype"));
|
26697 | }
|
26698 | parts.push(semi);
|
26699 | return parts;
|
26700 | }
|
26701 | function printTypeAlias(path, options, print) {
|
26702 | const semi = options.semi ? ";" : "";
|
26703 | const node = path.getValue();
|
26704 | const parts = [];
|
26705 | if (node.declare) {
|
26706 | parts.push("declare ");
|
26707 | }
|
26708 | parts.push("type ", print("id"), print("typeParameters"));
|
26709 | const rightPropertyName = node.type === "TSTypeAliasDeclaration" ? "typeAnnotation" : "right";
|
26710 | return [printAssignment(path, options, print, parts, " =", rightPropertyName), semi];
|
26711 | }
|
26712 | function printIntersectionType(path, options, print) {
|
26713 | const node = path.getValue();
|
26714 | const types = path.map(print, "types");
|
26715 | const result = [];
|
26716 | let wasIndented = false;
|
26717 | for (let i = 0; i < types.length; ++i) {
|
26718 | if (i === 0) {
|
26719 | result.push(types[i]);
|
26720 | } else if (isObjectType(node.types[i - 1]) && isObjectType(node.types[i])) {
|
26721 | result.push([" & ", wasIndented ? indent(types[i]) : types[i]]);
|
26722 | } else if (!isObjectType(node.types[i - 1]) && !isObjectType(node.types[i])) {
|
26723 | result.push(indent([" &", line, types[i]]));
|
26724 | } else {
|
26725 | if (i > 1) {
|
26726 | wasIndented = true;
|
26727 | }
|
26728 | result.push(" & ", i > 1 ? indent(types[i]) : types[i]);
|
26729 | }
|
26730 | }
|
26731 | return group(result);
|
26732 | }
|
26733 | function printUnionType(path, options, print) {
|
26734 | const node = path.getValue();
|
26735 | const parent = path.getParentNode();
|
26736 | const shouldIndent = parent.type !== "TypeParameterInstantiation" && parent.type !== "TSTypeParameterInstantiation" && parent.type !== "GenericTypeAnnotation" && parent.type !== "TSTypeReference" && parent.type !== "TSTypeAssertion" && parent.type !== "TupleTypeAnnotation" && parent.type !== "TSTupleType" && !(parent.type === "FunctionTypeParam" && !parent.name && path.getParentNode(1).this !== parent) && !((parent.type === "TypeAlias" || parent.type === "VariableDeclarator" || parent.type === "TSTypeAliasDeclaration") && hasLeadingOwnLineComment(options.originalText, node));
|
26737 | const shouldHug = shouldHugType(node);
|
26738 | const printed = path.map((typePath) => {
|
26739 | let printedType = print();
|
26740 | if (!shouldHug) {
|
26741 | printedType = align(2, printedType);
|
26742 | }
|
26743 | return printComments(typePath, printedType, options);
|
26744 | }, "types");
|
26745 | if (shouldHug) {
|
26746 | return join(" | ", printed);
|
26747 | }
|
26748 | const shouldAddStartLine = shouldIndent && !hasLeadingOwnLineComment(options.originalText, node);
|
26749 | const code = [ifBreak([shouldAddStartLine ? line : "", "| "]), join([line, "| "], printed)];
|
26750 | if (pathNeedsParens(path, options)) {
|
26751 | return group([indent(code), softline]);
|
26752 | }
|
26753 | if (parent.type === "TupleTypeAnnotation" && parent.types.length > 1 || parent.type === "TSTupleType" && parent.elementTypes.length > 1) {
|
26754 | return group([indent([ifBreak(["(", softline]), code]), softline, ifBreak(")")]);
|
26755 | }
|
26756 | return group(shouldIndent ? indent(code) : code);
|
26757 | }
|
26758 | function printFunctionType(path, options, print) {
|
26759 | const node = path.getValue();
|
26760 | const parts = [];
|
26761 | const parent = path.getParentNode(0);
|
26762 | const parentParent = path.getParentNode(1);
|
26763 | const parentParentParent = path.getParentNode(2);
|
26764 | let isArrowFunctionTypeAnnotation = node.type === "TSFunctionType" || !((parent.type === "ObjectTypeProperty" || parent.type === "ObjectTypeInternalSlot") && !parent.variance && !parent.optional && locStart(parent) === locStart(node) || parent.type === "ObjectTypeCallProperty" || parentParentParent && parentParentParent.type === "DeclareFunction");
|
26765 | let needsColon = isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation");
|
26766 | const needsParens = needsColon && isArrowFunctionTypeAnnotation && (parent.type === "TypeAnnotation" || parent.type === "TSTypeAnnotation") && parentParent.type === "ArrowFunctionExpression";
|
26767 | if (isObjectTypePropertyAFunction(parent)) {
|
26768 | isArrowFunctionTypeAnnotation = true;
|
26769 | needsColon = true;
|
26770 | }
|
26771 | if (needsParens) {
|
26772 | parts.push("(");
|
26773 | }
|
26774 | const parametersDoc = printFunctionParameters(path, print, options, false, true);
|
26775 | const returnTypeDoc = node.returnType || node.predicate || node.typeAnnotation ? [isArrowFunctionTypeAnnotation ? " => " : ": ", print("returnType"), print("predicate"), print("typeAnnotation")] : "";
|
26776 | const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
|
26777 | parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
|
26778 | if (returnTypeDoc) {
|
26779 | parts.push(returnTypeDoc);
|
26780 | }
|
26781 | if (needsParens) {
|
26782 | parts.push(")");
|
26783 | }
|
26784 | return group(parts);
|
26785 | }
|
26786 | function printTupleType(path, options, print) {
|
26787 | const node = path.getValue();
|
26788 | const typesField = node.type === "TSTupleType" ? "elementTypes" : "types";
|
26789 | const types = node[typesField];
|
26790 | const isNonEmptyTuple = isNonEmptyArray(types);
|
26791 | const bracketsDelimiterLine = isNonEmptyTuple ? softline : "";
|
26792 | return group(["[", indent([bracketsDelimiterLine, printArrayItems(path, options, typesField, print)]), ifBreak(isNonEmptyTuple && shouldPrintComma(options, "all") ? "," : ""), printDanglingComments(path, options, true), bracketsDelimiterLine, "]"]);
|
26793 | }
|
26794 | function printIndexedAccessType(path, options, print) {
|
26795 | const node = path.getValue();
|
26796 | const leftDelimiter = node.type === "OptionalIndexedAccessType" && node.optional ? "?.[" : "[";
|
26797 | return [print("objectType"), leftDelimiter, print("indexType"), "]"];
|
26798 | }
|
26799 | function printJSDocType(path, print, token) {
|
26800 | const node = path.getValue();
|
26801 | return [node.postfix ? "" : token, print("typeAnnotation"), node.postfix ? token : ""];
|
26802 | }
|
26803 | module2.exports = {
|
26804 | printOpaqueType,
|
26805 | printTypeAlias,
|
26806 | printIntersectionType,
|
26807 | printUnionType,
|
26808 | printFunctionType,
|
26809 | printTupleType,
|
26810 | printIndexedAccessType,
|
26811 | shouldHugType,
|
26812 | printJSDocType
|
26813 | };
|
26814 | }
|
26815 | });
|
26816 | var require_type_parameters = __commonJS2({
|
26817 | "src/language-js/print/type-parameters.js"(exports2, module2) {
|
26818 | "use strict";
|
26819 | var {
|
26820 | printDanglingComments
|
26821 | } = require_comments();
|
26822 | var {
|
26823 | builders: {
|
26824 | join,
|
26825 | line,
|
26826 | hardline,
|
26827 | softline,
|
26828 | group,
|
26829 | indent,
|
26830 | ifBreak
|
26831 | }
|
26832 | } = require("./doc.js");
|
26833 | var {
|
26834 | isTestCall,
|
26835 | hasComment,
|
26836 | CommentCheckFlags,
|
26837 | isTSXFile,
|
26838 | shouldPrintComma,
|
26839 | getFunctionParameters,
|
26840 | isObjectType
|
26841 | } = require_utils7();
|
26842 | var {
|
26843 | createGroupIdMapper
|
26844 | } = require_util();
|
26845 | var {
|
26846 | shouldHugType
|
26847 | } = require_type_annotation();
|
26848 | var {
|
26849 | isArrowFunctionVariableDeclarator
|
26850 | } = require_assignment();
|
26851 | var getTypeParametersGroupId = createGroupIdMapper("typeParameters");
|
26852 | function printTypeParameters(path, options, print, paramsKey) {
|
26853 | const node = path.getValue();
|
26854 | if (!node[paramsKey]) {
|
26855 | return "";
|
26856 | }
|
26857 | if (!Array.isArray(node[paramsKey])) {
|
26858 | return print(paramsKey);
|
26859 | }
|
26860 | const grandparent = path.getNode(2);
|
26861 | const isParameterInTestCall = grandparent && isTestCall(grandparent);
|
26862 | const isArrowFunctionVariable = path.match((node2) => !(node2[paramsKey].length === 1 && isObjectType(node2[paramsKey][0])), void 0, (node2, name) => name === "typeAnnotation", (node2) => node2.type === "Identifier", isArrowFunctionVariableDeclarator);
|
26863 | const shouldInline = !isArrowFunctionVariable && (isParameterInTestCall || node[paramsKey].length === 0 || node[paramsKey].length === 1 && (node[paramsKey][0].type === "NullableTypeAnnotation" || shouldHugType(node[paramsKey][0])));
|
26864 | if (shouldInline) {
|
26865 | return ["<", join(", ", path.map(print, paramsKey)), printDanglingCommentsForInline(path, options), ">"];
|
26866 | }
|
26867 | const trailingComma = node.type === "TSTypeParameterInstantiation" ? "" : getFunctionParameters(node).length === 1 && isTSXFile(options) && !node[paramsKey][0].constraint && path.getParentNode().type === "ArrowFunctionExpression" ? "," : shouldPrintComma(options, "all") ? ifBreak(",") : "";
|
26868 | return group(["<", indent([softline, join([",", line], path.map(print, paramsKey))]), trailingComma, softline, ">"], {
|
26869 | id: getTypeParametersGroupId(node)
|
26870 | });
|
26871 | }
|
26872 | function printDanglingCommentsForInline(path, options) {
|
26873 | const node = path.getValue();
|
26874 | if (!hasComment(node, CommentCheckFlags.Dangling)) {
|
26875 | return "";
|
26876 | }
|
26877 | const hasOnlyBlockComments = !hasComment(node, CommentCheckFlags.Line);
|
26878 | const printed = printDanglingComments(path, options, hasOnlyBlockComments);
|
26879 | if (hasOnlyBlockComments) {
|
26880 | return printed;
|
26881 | }
|
26882 | return [printed, hardline];
|
26883 | }
|
26884 | function printTypeParameter(path, options, print) {
|
26885 | const node = path.getValue();
|
26886 | const parts = [];
|
26887 | const parent = path.getParentNode();
|
26888 | if (parent.type === "TSMappedType") {
|
26889 | parts.push("[", print("name"));
|
26890 | if (node.constraint) {
|
26891 | parts.push(" in ", print("constraint"));
|
26892 | }
|
26893 | if (parent.nameType) {
|
26894 | parts.push(" as ", path.callParent(() => print("nameType")));
|
26895 | }
|
26896 | parts.push("]");
|
26897 | return parts;
|
26898 | }
|
26899 | if (node.variance) {
|
26900 | parts.push(print("variance"));
|
26901 | }
|
26902 | if (node.in) {
|
26903 | parts.push("in ");
|
26904 | }
|
26905 | if (node.out) {
|
26906 | parts.push("out ");
|
26907 | }
|
26908 | parts.push(print("name"));
|
26909 | if (node.bound) {
|
26910 | parts.push(": ", print("bound"));
|
26911 | }
|
26912 | if (node.constraint) {
|
26913 | parts.push(" extends ", print("constraint"));
|
26914 | }
|
26915 | if (node.default) {
|
26916 | parts.push(" = ", print("default"));
|
26917 | }
|
26918 | return parts;
|
26919 | }
|
26920 | module2.exports = {
|
26921 | printTypeParameter,
|
26922 | printTypeParameters,
|
26923 | getTypeParametersGroupId
|
26924 | };
|
26925 | }
|
26926 | });
|
26927 | var require_property = __commonJS2({
|
26928 | "src/language-js/print/property.js"(exports2, module2) {
|
26929 | "use strict";
|
26930 | var {
|
26931 | printComments
|
26932 | } = require_comments();
|
26933 | var {
|
26934 | printString,
|
26935 | printNumber
|
26936 | } = require_util();
|
26937 | var {
|
26938 | isNumericLiteral,
|
26939 | isSimpleNumber,
|
26940 | isStringLiteral,
|
26941 | isStringPropSafeToUnquote,
|
26942 | rawText
|
26943 | } = require_utils7();
|
26944 | var {
|
26945 | printAssignment
|
26946 | } = require_assignment();
|
26947 | var needsQuoteProps = new WeakMap();
|
26948 | function printPropertyKey(path, options, print) {
|
26949 | const node = path.getNode();
|
26950 | if (node.computed) {
|
26951 | return ["[", print("key"), "]"];
|
26952 | }
|
26953 | const parent = path.getParentNode();
|
26954 | const {
|
26955 | key
|
26956 | } = node;
|
26957 | if (node.type === "ClassPrivateProperty" && key.type === "Identifier") {
|
26958 | return ["#", print("key")];
|
26959 | }
|
26960 | if (options.quoteProps === "consistent" && !needsQuoteProps.has(parent)) {
|
26961 | const objectHasStringProp = (parent.properties || parent.body || parent.members).some((prop) => !prop.computed && prop.key && isStringLiteral(prop.key) && !isStringPropSafeToUnquote(prop, options));
|
26962 | needsQuoteProps.set(parent, objectHasStringProp);
|
26963 | }
|
26964 | if ((key.type === "Identifier" || isNumericLiteral(key) && isSimpleNumber(printNumber(rawText(key))) && String(key.value) === printNumber(rawText(key)) && !(options.parser === "typescript" || options.parser === "babel-ts")) && (options.parser === "json" || options.quoteProps === "consistent" && needsQuoteProps.get(parent))) {
|
26965 | const prop = printString(JSON.stringify(key.type === "Identifier" ? key.name : key.value.toString()), options);
|
26966 | return path.call((keyPath) => printComments(keyPath, prop, options), "key");
|
26967 | }
|
26968 | if (isStringPropSafeToUnquote(node, options) && (options.quoteProps === "as-needed" || options.quoteProps === "consistent" && !needsQuoteProps.get(parent))) {
|
26969 | return path.call((keyPath) => printComments(keyPath, /^\d/.test(key.value) ? printNumber(key.value) : key.value, options), "key");
|
26970 | }
|
26971 | return print("key");
|
26972 | }
|
26973 | function printProperty(path, options, print) {
|
26974 | const node = path.getValue();
|
26975 | if (node.shorthand) {
|
26976 | return print("value");
|
26977 | }
|
26978 | return printAssignment(path, options, print, printPropertyKey(path, options, print), ":", "value");
|
26979 | }
|
26980 | module2.exports = {
|
26981 | printProperty,
|
26982 | printPropertyKey
|
26983 | };
|
26984 | }
|
26985 | });
|
26986 | var require_function = __commonJS2({
|
26987 | "src/language-js/print/function.js"(exports2, module2) {
|
26988 | "use strict";
|
26989 | var assert = require("assert");
|
26990 | var {
|
26991 | printDanglingComments,
|
26992 | printCommentsSeparately
|
26993 | } = require_comments();
|
26994 | var getLast = require_get_last();
|
26995 | var {
|
26996 | getNextNonSpaceNonCommentCharacterIndex
|
26997 | } = require_util();
|
26998 | var {
|
26999 | builders: {
|
27000 | line,
|
27001 | softline,
|
27002 | group,
|
27003 | indent,
|
27004 | ifBreak,
|
27005 | hardline,
|
27006 | join,
|
27007 | indentIfBreak
|
27008 | },
|
27009 | utils: {
|
27010 | removeLines,
|
27011 | willBreak
|
27012 | }
|
27013 | } = require("./doc.js");
|
27014 | var {
|
27015 | ArgExpansionBailout
|
27016 | } = require_errors();
|
27017 | var {
|
27018 | getFunctionParameters,
|
27019 | hasLeadingOwnLineComment,
|
27020 | isFlowAnnotationComment,
|
27021 | isJsxNode,
|
27022 | isTemplateOnItsOwnLine,
|
27023 | shouldPrintComma,
|
27024 | startsWithNoLookaheadToken,
|
27025 | isBinaryish,
|
27026 | isLineComment,
|
27027 | hasComment,
|
27028 | getComments,
|
27029 | CommentCheckFlags,
|
27030 | isCallLikeExpression,
|
27031 | isCallExpression,
|
27032 | getCallArguments,
|
27033 | hasNakedLeftSide,
|
27034 | getLeftSide
|
27035 | } = require_utils7();
|
27036 | var {
|
27037 | locEnd
|
27038 | } = require_loc();
|
27039 | var {
|
27040 | printFunctionParameters,
|
27041 | shouldGroupFunctionParameters
|
27042 | } = require_function_parameters();
|
27043 | var {
|
27044 | printPropertyKey
|
27045 | } = require_property();
|
27046 | var {
|
27047 | printFunctionTypeParameters
|
27048 | } = require_misc();
|
27049 | function printFunction(path, print, options, args) {
|
27050 | const node = path.getValue();
|
27051 | let expandArg = false;
|
27052 | if ((node.type === "FunctionDeclaration" || node.type === "FunctionExpression") && args && args.expandLastArg) {
|
27053 | const parent = path.getParentNode();
|
27054 | if (isCallExpression(parent) && getCallArguments(parent).length > 1) {
|
27055 | expandArg = true;
|
27056 | }
|
27057 | }
|
27058 | const parts = [];
|
27059 | if (node.type === "TSDeclareFunction" && node.declare) {
|
27060 | parts.push("declare ");
|
27061 | }
|
27062 | if (node.async) {
|
27063 | parts.push("async ");
|
27064 | }
|
27065 | if (node.generator) {
|
27066 | parts.push("function* ");
|
27067 | } else {
|
27068 | parts.push("function ");
|
27069 | }
|
27070 | if (node.id) {
|
27071 | parts.push(print("id"));
|
27072 | }
|
27073 | const parametersDoc = printFunctionParameters(path, print, options, expandArg);
|
27074 | const returnTypeDoc = printReturnType(path, print, options);
|
27075 | const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
|
27076 | parts.push(printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc]), node.body ? " " : "", print("body"));
|
27077 | if (options.semi && (node.declare || !node.body)) {
|
27078 | parts.push(";");
|
27079 | }
|
27080 | return parts;
|
27081 | }
|
27082 | function printMethod(path, options, print) {
|
27083 | const node = path.getNode();
|
27084 | const {
|
27085 | kind
|
27086 | } = node;
|
27087 | const value = node.value || node;
|
27088 | const parts = [];
|
27089 | if (!kind || kind === "init" || kind === "method" || kind === "constructor") {
|
27090 | if (value.async) {
|
27091 | parts.push("async ");
|
27092 | }
|
27093 | } else {
|
27094 | assert.ok(kind === "get" || kind === "set");
|
27095 | parts.push(kind, " ");
|
27096 | }
|
27097 | if (value.generator) {
|
27098 | parts.push("*");
|
27099 | }
|
27100 | parts.push(printPropertyKey(path, options, print), node.optional || node.key.optional ? "?" : "");
|
27101 | if (node === value) {
|
27102 | parts.push(printMethodInternal(path, options, print));
|
27103 | } else if (value.type === "FunctionExpression") {
|
27104 | parts.push(path.call((path2) => printMethodInternal(path2, options, print), "value"));
|
27105 | } else {
|
27106 | parts.push(print("value"));
|
27107 | }
|
27108 | return parts;
|
27109 | }
|
27110 | function printMethodInternal(path, options, print) {
|
27111 | const node = path.getNode();
|
27112 | const parametersDoc = printFunctionParameters(path, print, options);
|
27113 | const returnTypeDoc = printReturnType(path, print, options);
|
27114 | const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
|
27115 | const parts = [printFunctionTypeParameters(path, options, print), group([shouldGroupParameters ? group(parametersDoc) : parametersDoc, returnTypeDoc])];
|
27116 | if (node.body) {
|
27117 | parts.push(" ", print("body"));
|
27118 | } else {
|
27119 | parts.push(options.semi ? ";" : "");
|
27120 | }
|
27121 | return parts;
|
27122 | }
|
27123 | function printArrowFunctionSignature(path, options, print, args) {
|
27124 | const node = path.getValue();
|
27125 | const parts = [];
|
27126 | if (node.async) {
|
27127 | parts.push("async ");
|
27128 | }
|
27129 | if (shouldPrintParamsWithoutParens(path, options)) {
|
27130 | parts.push(print(["params", 0]));
|
27131 | } else {
|
27132 | const expandArg = args && (args.expandLastArg || args.expandFirstArg);
|
27133 | let returnTypeDoc = printReturnType(path, print, options);
|
27134 | if (expandArg) {
|
27135 | if (willBreak(returnTypeDoc)) {
|
27136 | throw new ArgExpansionBailout();
|
27137 | }
|
27138 | returnTypeDoc = group(removeLines(returnTypeDoc));
|
27139 | }
|
27140 | parts.push(group([printFunctionParameters(path, print, options, expandArg, true), returnTypeDoc]));
|
27141 | }
|
27142 | const dangling = printDanglingComments(path, options, true, (comment) => {
|
27143 | const nextCharacter = getNextNonSpaceNonCommentCharacterIndex(options.originalText, comment, locEnd);
|
27144 | return nextCharacter !== false && options.originalText.slice(nextCharacter, nextCharacter + 2) === "=>";
|
27145 | });
|
27146 | if (dangling) {
|
27147 | parts.push(" ", dangling);
|
27148 | }
|
27149 | return parts;
|
27150 | }
|
27151 | function printArrowChain(path, args, signatures, shouldBreak, bodyDoc, tailNode) {
|
27152 | const name = path.getName();
|
27153 | const parent = path.getParentNode();
|
27154 | const isCallee = isCallLikeExpression(parent) && name === "callee";
|
27155 | const isAssignmentRhs = Boolean(args && args.assignmentLayout);
|
27156 | const shouldPutBodyOnSeparateLine = tailNode.body.type !== "BlockStatement" && tailNode.body.type !== "ObjectExpression" && tailNode.body.type !== "SequenceExpression";
|
27157 | const shouldBreakBeforeChain = isCallee && shouldPutBodyOnSeparateLine || args && args.assignmentLayout === "chain-tail-arrow-chain";
|
27158 | const groupId = Symbol("arrow-chain");
|
27159 | if (tailNode.body.type === "SequenceExpression") {
|
27160 | bodyDoc = group(["(", indent([softline, bodyDoc]), softline, ")"]);
|
27161 | }
|
27162 | return group([group(indent([isCallee || isAssignmentRhs ? softline : "", group(join([" =>", line], signatures), {
|
27163 | shouldBreak
|
27164 | })]), {
|
27165 | id: groupId,
|
27166 | shouldBreak: shouldBreakBeforeChain
|
27167 | }), " =>", indentIfBreak(shouldPutBodyOnSeparateLine ? indent([line, bodyDoc]) : [" ", bodyDoc], {
|
27168 | groupId
|
27169 | }), isCallee ? ifBreak(softline, "", {
|
27170 | groupId
|
27171 | }) : ""]);
|
27172 | }
|
27173 | function printArrowFunction(path, options, print, args) {
|
27174 | let node = path.getValue();
|
27175 | const signatures = [];
|
27176 | const body = [];
|
27177 | let chainShouldBreak = false;
|
27178 | (function rec() {
|
27179 | const doc2 = printArrowFunctionSignature(path, options, print, args);
|
27180 | if (signatures.length === 0) {
|
27181 | signatures.push(doc2);
|
27182 | } else {
|
27183 | const {
|
27184 | leading,
|
27185 | trailing
|
27186 | } = printCommentsSeparately(path, options);
|
27187 | signatures.push([leading, doc2]);
|
27188 | body.unshift(trailing);
|
27189 | }
|
27190 | chainShouldBreak = chainShouldBreak || node.returnType && getFunctionParameters(node).length > 0 || node.typeParameters || getFunctionParameters(node).some((param) => param.type !== "Identifier");
|
27191 | if (node.body.type !== "ArrowFunctionExpression" || args && args.expandLastArg) {
|
27192 | body.unshift(print("body", args));
|
27193 | } else {
|
27194 | node = node.body;
|
27195 | path.call(rec, "body");
|
27196 | }
|
27197 | })();
|
27198 | if (signatures.length > 1) {
|
27199 | return printArrowChain(path, args, signatures, chainShouldBreak, body, node);
|
27200 | }
|
27201 | const parts = signatures;
|
27202 | parts.push(" =>");
|
27203 | if (!hasLeadingOwnLineComment(options.originalText, node.body) && (node.body.type === "ArrayExpression" || node.body.type === "ObjectExpression" || node.body.type === "BlockStatement" || isJsxNode(node.body) || isTemplateOnItsOwnLine(node.body, options.originalText) || node.body.type === "ArrowFunctionExpression" || node.body.type === "DoExpression")) {
|
27204 | return group([...parts, " ", body]);
|
27205 | }
|
27206 | if (node.body.type === "SequenceExpression") {
|
27207 | return group([...parts, group([" (", indent([softline, body]), softline, ")"])]);
|
27208 | }
|
27209 | const shouldAddSoftLine = (args && args.expandLastArg || path.getParentNode().type === "JSXExpressionContainer") && !hasComment(node);
|
27210 | const printTrailingComma = args && args.expandLastArg && shouldPrintComma(options, "all");
|
27211 | const shouldAddParens = node.body.type === "ConditionalExpression" && !startsWithNoLookaheadToken(node.body, false);
|
27212 | return group([...parts, group([indent([line, shouldAddParens ? ifBreak("", "(") : "", body, shouldAddParens ? ifBreak("", ")") : ""]), shouldAddSoftLine ? [ifBreak(printTrailingComma ? "," : ""), softline] : ""])]);
|
27213 | }
|
27214 | function canPrintParamsWithoutParens(node) {
|
27215 | const parameters = getFunctionParameters(node);
|
27216 | return parameters.length === 1 && !node.typeParameters && !hasComment(node, CommentCheckFlags.Dangling) && parameters[0].type === "Identifier" && !parameters[0].typeAnnotation && !hasComment(parameters[0]) && !parameters[0].optional && !node.predicate && !node.returnType;
|
27217 | }
|
27218 | function shouldPrintParamsWithoutParens(path, options) {
|
27219 | if (options.arrowParens === "always") {
|
27220 | return false;
|
27221 | }
|
27222 | if (options.arrowParens === "avoid") {
|
27223 | const node = path.getValue();
|
27224 | return canPrintParamsWithoutParens(node);
|
27225 | }
|
27226 | return false;
|
27227 | }
|
27228 | function printReturnType(path, print, options) {
|
27229 | const node = path.getValue();
|
27230 | const returnType = print("returnType");
|
27231 | if (node.returnType && isFlowAnnotationComment(options.originalText, node.returnType)) {
|
27232 | return [" /*: ", returnType, " */"];
|
27233 | }
|
27234 | const parts = [returnType];
|
27235 | if (node.returnType && node.returnType.typeAnnotation) {
|
27236 | parts.unshift(": ");
|
27237 | }
|
27238 | if (node.predicate) {
|
27239 | parts.push(node.returnType ? " " : ": ", print("predicate"));
|
27240 | }
|
27241 | return parts;
|
27242 | }
|
27243 | function printReturnOrThrowArgument(path, options, print) {
|
27244 | const node = path.getValue();
|
27245 | const semi = options.semi ? ";" : "";
|
27246 | const parts = [];
|
27247 | if (node.argument) {
|
27248 | if (returnArgumentHasLeadingComment(options, node.argument)) {
|
27249 | parts.push([" (", indent([hardline, print("argument")]), hardline, ")"]);
|
27250 | } else if (isBinaryish(node.argument) || node.argument.type === "SequenceExpression") {
|
27251 | parts.push(group([ifBreak(" (", " "), indent([softline, print("argument")]), softline, ifBreak(")")]));
|
27252 | } else {
|
27253 | parts.push(" ", print("argument"));
|
27254 | }
|
27255 | }
|
27256 | const comments = getComments(node);
|
27257 | const lastComment = getLast(comments);
|
27258 | const isLastCommentLine = lastComment && isLineComment(lastComment);
|
27259 | if (isLastCommentLine) {
|
27260 | parts.push(semi);
|
27261 | }
|
27262 | if (hasComment(node, CommentCheckFlags.Dangling)) {
|
27263 | parts.push(" ", printDanglingComments(path, options, true));
|
27264 | }
|
27265 | if (!isLastCommentLine) {
|
27266 | parts.push(semi);
|
27267 | }
|
27268 | return parts;
|
27269 | }
|
27270 | function printReturnStatement(path, options, print) {
|
27271 | return ["return", printReturnOrThrowArgument(path, options, print)];
|
27272 | }
|
27273 | function printThrowStatement(path, options, print) {
|
27274 | return ["throw", printReturnOrThrowArgument(path, options, print)];
|
27275 | }
|
27276 | function returnArgumentHasLeadingComment(options, argument) {
|
27277 | if (hasLeadingOwnLineComment(options.originalText, argument)) {
|
27278 | return true;
|
27279 | }
|
27280 | if (hasNakedLeftSide(argument)) {
|
27281 | let leftMost = argument;
|
27282 | let newLeftMost;
|
27283 | while (newLeftMost = getLeftSide(leftMost)) {
|
27284 | leftMost = newLeftMost;
|
27285 | if (hasLeadingOwnLineComment(options.originalText, leftMost)) {
|
27286 | return true;
|
27287 | }
|
27288 | }
|
27289 | }
|
27290 | return false;
|
27291 | }
|
27292 | module2.exports = {
|
27293 | printFunction,
|
27294 | printArrowFunction,
|
27295 | printMethod,
|
27296 | printReturnStatement,
|
27297 | printThrowStatement,
|
27298 | printMethodInternal,
|
27299 | shouldPrintParamsWithoutParens
|
27300 | };
|
27301 | }
|
27302 | });
|
27303 | var require_decorators = __commonJS2({
|
27304 | "src/language-js/print/decorators.js"(exports2, module2) {
|
27305 | "use strict";
|
27306 | var {
|
27307 | isNonEmptyArray,
|
27308 | hasNewline
|
27309 | } = require_util();
|
27310 | var {
|
27311 | builders: {
|
27312 | line,
|
27313 | hardline,
|
27314 | join,
|
27315 | breakParent,
|
27316 | group
|
27317 | }
|
27318 | } = require("./doc.js");
|
27319 | var {
|
27320 | locStart,
|
27321 | locEnd
|
27322 | } = require_loc();
|
27323 | var {
|
27324 | getParentExportDeclaration
|
27325 | } = require_utils7();
|
27326 | function printClassMemberDecorators(path, options, print) {
|
27327 | const node = path.getValue();
|
27328 | return group([join(line, path.map(print, "decorators")), hasNewlineBetweenOrAfterDecorators(node, options) ? hardline : line]);
|
27329 | }
|
27330 | function printDecoratorsBeforeExport(path, options, print) {
|
27331 | return [join(hardline, path.map(print, "declaration", "decorators")), hardline];
|
27332 | }
|
27333 | function printDecorators(path, options, print) {
|
27334 | const node = path.getValue();
|
27335 | const {
|
27336 | decorators
|
27337 | } = node;
|
27338 | if (!isNonEmptyArray(decorators) || hasDecoratorsBeforeExport(path.getParentNode())) {
|
27339 | return;
|
27340 | }
|
27341 | const shouldBreak = node.type === "ClassExpression" || node.type === "ClassDeclaration" || hasNewlineBetweenOrAfterDecorators(node, options);
|
27342 | return [getParentExportDeclaration(path) ? hardline : shouldBreak ? breakParent : "", join(line, path.map(print, "decorators")), line];
|
27343 | }
|
27344 | function hasNewlineBetweenOrAfterDecorators(node, options) {
|
27345 | return node.decorators.some((decorator) => hasNewline(options.originalText, locEnd(decorator)));
|
27346 | }
|
27347 | function hasDecoratorsBeforeExport(node) {
|
27348 | if (node.type !== "ExportDefaultDeclaration" && node.type !== "ExportNamedDeclaration" && node.type !== "DeclareExportDeclaration") {
|
27349 | return false;
|
27350 | }
|
27351 | const decorators = node.declaration && node.declaration.decorators;
|
27352 | return isNonEmptyArray(decorators) && locStart(node) === locStart(decorators[0]);
|
27353 | }
|
27354 | module2.exports = {
|
27355 | printDecorators,
|
27356 | printClassMemberDecorators,
|
27357 | printDecoratorsBeforeExport,
|
27358 | hasDecoratorsBeforeExport
|
27359 | };
|
27360 | }
|
27361 | });
|
27362 | var require_class = __commonJS2({
|
27363 | "src/language-js/print/class.js"(exports2, module2) {
|
27364 | "use strict";
|
27365 | var {
|
27366 | isNonEmptyArray,
|
27367 | createGroupIdMapper
|
27368 | } = require_util();
|
27369 | var {
|
27370 | printComments,
|
27371 | printDanglingComments
|
27372 | } = require_comments();
|
27373 | var {
|
27374 | builders: {
|
27375 | join,
|
27376 | line,
|
27377 | hardline,
|
27378 | softline,
|
27379 | group,
|
27380 | indent,
|
27381 | ifBreak
|
27382 | }
|
27383 | } = require("./doc.js");
|
27384 | var {
|
27385 | hasComment,
|
27386 | CommentCheckFlags
|
27387 | } = require_utils7();
|
27388 | var {
|
27389 | getTypeParametersGroupId
|
27390 | } = require_type_parameters();
|
27391 | var {
|
27392 | printMethod
|
27393 | } = require_function();
|
27394 | var {
|
27395 | printOptionalToken,
|
27396 | printTypeAnnotation,
|
27397 | printDefiniteToken
|
27398 | } = require_misc();
|
27399 | var {
|
27400 | printPropertyKey
|
27401 | } = require_property();
|
27402 | var {
|
27403 | printAssignment
|
27404 | } = require_assignment();
|
27405 | var {
|
27406 | printClassMemberDecorators
|
27407 | } = require_decorators();
|
27408 | function printClass(path, options, print) {
|
27409 | const node = path.getValue();
|
27410 | const parts = [];
|
27411 | if (node.declare) {
|
27412 | parts.push("declare ");
|
27413 | }
|
27414 | if (node.abstract) {
|
27415 | parts.push("abstract ");
|
27416 | }
|
27417 | parts.push("class");
|
27418 | const groupMode = node.id && hasComment(node.id, CommentCheckFlags.Trailing) || node.typeParameters && hasComment(node.typeParameters, CommentCheckFlags.Trailing) || node.superClass && hasComment(node.superClass) || isNonEmptyArray(node.extends) || isNonEmptyArray(node.mixins) || isNonEmptyArray(node.implements);
|
27419 | const partsGroup = [];
|
27420 | const extendsParts = [];
|
27421 | if (node.id) {
|
27422 | partsGroup.push(" ", print("id"));
|
27423 | }
|
27424 | partsGroup.push(print("typeParameters"));
|
27425 | if (node.superClass) {
|
27426 | const printed = [printSuperClass(path, options, print), print("superTypeParameters")];
|
27427 | const printedWithComments = path.call((superClass) => ["extends ", printComments(superClass, printed, options)], "superClass");
|
27428 | if (groupMode) {
|
27429 | extendsParts.push(line, group(printedWithComments));
|
27430 | } else {
|
27431 | extendsParts.push(" ", printedWithComments);
|
27432 | }
|
27433 | } else {
|
27434 | extendsParts.push(printList(path, options, print, "extends"));
|
27435 | }
|
27436 | extendsParts.push(printList(path, options, print, "mixins"), printList(path, options, print, "implements"));
|
27437 | if (groupMode) {
|
27438 | let printedPartsGroup;
|
27439 | if (shouldIndentOnlyHeritageClauses(node)) {
|
27440 | printedPartsGroup = [...partsGroup, indent(extendsParts)];
|
27441 | } else {
|
27442 | printedPartsGroup = indent([...partsGroup, extendsParts]);
|
27443 | }
|
27444 | parts.push(group(printedPartsGroup, {
|
27445 | id: getHeritageGroupId(node)
|
27446 | }));
|
27447 | } else {
|
27448 | parts.push(...partsGroup, ...extendsParts);
|
27449 | }
|
27450 | parts.push(" ", print("body"));
|
27451 | return parts;
|
27452 | }
|
27453 | var getHeritageGroupId = createGroupIdMapper("heritageGroup");
|
27454 | function printHardlineAfterHeritage(node) {
|
27455 | return ifBreak(hardline, "", {
|
27456 | groupId: getHeritageGroupId(node)
|
27457 | });
|
27458 | }
|
27459 | function hasMultipleHeritage(node) {
|
27460 | return ["superClass", "extends", "mixins", "implements"].filter((key) => Boolean(node[key])).length > 1;
|
27461 | }
|
27462 | function shouldIndentOnlyHeritageClauses(node) {
|
27463 | return node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line) && !hasMultipleHeritage(node);
|
27464 | }
|
27465 | function printList(path, options, print, listName) {
|
27466 | const node = path.getValue();
|
27467 | if (!isNonEmptyArray(node[listName])) {
|
27468 | return "";
|
27469 | }
|
27470 | const printedLeadingComments = printDanglingComments(path, options, true, ({
|
27471 | marker
|
27472 | }) => marker === listName);
|
27473 | return [shouldIndentOnlyHeritageClauses(node) ? ifBreak(" ", line, {
|
27474 | groupId: getTypeParametersGroupId(node.typeParameters)
|
27475 | }) : line, printedLeadingComments, printedLeadingComments && hardline, listName, group(indent([line, join([",", line], path.map(print, listName))]))];
|
27476 | }
|
27477 | function printSuperClass(path, options, print) {
|
27478 | const printed = print("superClass");
|
27479 | const parent = path.getParentNode();
|
27480 | if (parent.type === "AssignmentExpression") {
|
27481 | return group(ifBreak(["(", indent([softline, printed]), softline, ")"], printed));
|
27482 | }
|
27483 | return printed;
|
27484 | }
|
27485 | function printClassMethod(path, options, print) {
|
27486 | const node = path.getValue();
|
27487 | const parts = [];
|
27488 | if (isNonEmptyArray(node.decorators)) {
|
27489 | parts.push(printClassMemberDecorators(path, options, print));
|
27490 | }
|
27491 | if (node.accessibility) {
|
27492 | parts.push(node.accessibility + " ");
|
27493 | }
|
27494 | if (node.readonly) {
|
27495 | parts.push("readonly ");
|
27496 | }
|
27497 | if (node.declare) {
|
27498 | parts.push("declare ");
|
27499 | }
|
27500 | if (node.static) {
|
27501 | parts.push("static ");
|
27502 | }
|
27503 | if (node.type === "TSAbstractMethodDefinition" || node.abstract) {
|
27504 | parts.push("abstract ");
|
27505 | }
|
27506 | if (node.override) {
|
27507 | parts.push("override ");
|
27508 | }
|
27509 | parts.push(printMethod(path, options, print));
|
27510 | return parts;
|
27511 | }
|
27512 | function printClassProperty(path, options, print) {
|
27513 | const node = path.getValue();
|
27514 | const parts = [];
|
27515 | const semi = options.semi ? ";" : "";
|
27516 | if (isNonEmptyArray(node.decorators)) {
|
27517 | parts.push(printClassMemberDecorators(path, options, print));
|
27518 | }
|
27519 | if (node.accessibility) {
|
27520 | parts.push(node.accessibility + " ");
|
27521 | }
|
27522 | if (node.declare) {
|
27523 | parts.push("declare ");
|
27524 | }
|
27525 | if (node.static) {
|
27526 | parts.push("static ");
|
27527 | }
|
27528 | if (node.type === "TSAbstractPropertyDefinition" || node.type === "TSAbstractAccessorProperty" || node.abstract) {
|
27529 | parts.push("abstract ");
|
27530 | }
|
27531 | if (node.override) {
|
27532 | parts.push("override ");
|
27533 | }
|
27534 | if (node.readonly) {
|
27535 | parts.push("readonly ");
|
27536 | }
|
27537 | if (node.variance) {
|
27538 | parts.push(print("variance"));
|
27539 | }
|
27540 | if (node.type === "ClassAccessorProperty" || node.type === "AccessorProperty" || node.type === "TSAbstractAccessorProperty") {
|
27541 | parts.push("accessor ");
|
27542 | }
|
27543 | parts.push(printPropertyKey(path, options, print), printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print));
|
27544 | return [printAssignment(path, options, print, parts, " =", "value"), semi];
|
27545 | }
|
27546 | module2.exports = {
|
27547 | printClass,
|
27548 | printClassMethod,
|
27549 | printClassProperty,
|
27550 | printHardlineAfterHeritage
|
27551 | };
|
27552 | }
|
27553 | });
|
27554 | var require_interface = __commonJS2({
|
27555 | "src/language-js/print/interface.js"(exports2, module2) {
|
27556 | "use strict";
|
27557 | var {
|
27558 | isNonEmptyArray
|
27559 | } = require_util();
|
27560 | var {
|
27561 | builders: {
|
27562 | join,
|
27563 | line,
|
27564 | group,
|
27565 | indent,
|
27566 | ifBreak
|
27567 | }
|
27568 | } = require("./doc.js");
|
27569 | var {
|
27570 | hasComment,
|
27571 | identity,
|
27572 | CommentCheckFlags
|
27573 | } = require_utils7();
|
27574 | var {
|
27575 | getTypeParametersGroupId
|
27576 | } = require_type_parameters();
|
27577 | var {
|
27578 | printTypeScriptModifiers
|
27579 | } = require_misc();
|
27580 | function printInterface(path, options, print) {
|
27581 | const node = path.getValue();
|
27582 | const parts = [];
|
27583 | if (node.declare) {
|
27584 | parts.push("declare ");
|
27585 | }
|
27586 | if (node.type === "TSInterfaceDeclaration") {
|
27587 | parts.push(node.abstract ? "abstract " : "", printTypeScriptModifiers(path, options, print));
|
27588 | }
|
27589 | parts.push("interface");
|
27590 | const partsGroup = [];
|
27591 | const extendsParts = [];
|
27592 | if (node.type !== "InterfaceTypeAnnotation") {
|
27593 | partsGroup.push(" ", print("id"), print("typeParameters"));
|
27594 | }
|
27595 | const shouldIndentOnlyHeritageClauses = node.typeParameters && !hasComment(node.typeParameters, CommentCheckFlags.Trailing | CommentCheckFlags.Line);
|
27596 | if (isNonEmptyArray(node.extends)) {
|
27597 | extendsParts.push(shouldIndentOnlyHeritageClauses ? ifBreak(" ", line, {
|
27598 | groupId: getTypeParametersGroupId(node.typeParameters)
|
27599 | }) : line, "extends ", (node.extends.length === 1 ? identity : indent)(join([",", line], path.map(print, "extends"))));
|
27600 | }
|
27601 | if (node.id && hasComment(node.id, CommentCheckFlags.Trailing) || isNonEmptyArray(node.extends)) {
|
27602 | if (shouldIndentOnlyHeritageClauses) {
|
27603 | parts.push(group([...partsGroup, indent(extendsParts)]));
|
27604 | } else {
|
27605 | parts.push(group(indent([...partsGroup, ...extendsParts])));
|
27606 | }
|
27607 | } else {
|
27608 | parts.push(...partsGroup, ...extendsParts);
|
27609 | }
|
27610 | parts.push(" ", print("body"));
|
27611 | return group(parts);
|
27612 | }
|
27613 | module2.exports = {
|
27614 | printInterface
|
27615 | };
|
27616 | }
|
27617 | });
|
27618 | var require_module = __commonJS2({
|
27619 | "src/language-js/print/module.js"(exports2, module2) {
|
27620 | "use strict";
|
27621 | var {
|
27622 | isNonEmptyArray
|
27623 | } = require_util();
|
27624 | var {
|
27625 | builders: {
|
27626 | softline,
|
27627 | group,
|
27628 | indent,
|
27629 | join,
|
27630 | line,
|
27631 | ifBreak,
|
27632 | hardline
|
27633 | }
|
27634 | } = require("./doc.js");
|
27635 | var {
|
27636 | printDanglingComments
|
27637 | } = require_comments();
|
27638 | var {
|
27639 | hasComment,
|
27640 | CommentCheckFlags,
|
27641 | shouldPrintComma,
|
27642 | needsHardlineAfterDanglingComment,
|
27643 | isStringLiteral,
|
27644 | rawText
|
27645 | } = require_utils7();
|
27646 | var {
|
27647 | locStart,
|
27648 | hasSameLoc
|
27649 | } = require_loc();
|
27650 | var {
|
27651 | hasDecoratorsBeforeExport,
|
27652 | printDecoratorsBeforeExport
|
27653 | } = require_decorators();
|
27654 | function printImportDeclaration(path, options, print) {
|
27655 | const node = path.getValue();
|
27656 | const semi = options.semi ? ";" : "";
|
27657 | const parts = [];
|
27658 | const {
|
27659 | importKind
|
27660 | } = node;
|
27661 | parts.push("import");
|
27662 | if (importKind && importKind !== "value") {
|
27663 | parts.push(" ", importKind);
|
27664 | }
|
27665 | parts.push(printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
|
27666 | return parts;
|
27667 | }
|
27668 | function printExportDeclaration(path, options, print) {
|
27669 | const node = path.getValue();
|
27670 | const parts = [];
|
27671 | if (hasDecoratorsBeforeExport(node)) {
|
27672 | parts.push(printDecoratorsBeforeExport(path, options, print));
|
27673 | }
|
27674 | const {
|
27675 | type,
|
27676 | exportKind,
|
27677 | declaration
|
27678 | } = node;
|
27679 | parts.push("export");
|
27680 | const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
|
27681 | if (isDefaultExport) {
|
27682 | parts.push(" default");
|
27683 | }
|
27684 | if (hasComment(node, CommentCheckFlags.Dangling)) {
|
27685 | parts.push(" ", printDanglingComments(path, options, true));
|
27686 | if (needsHardlineAfterDanglingComment(node)) {
|
27687 | parts.push(hardline);
|
27688 | }
|
27689 | }
|
27690 | if (declaration) {
|
27691 | parts.push(" ", print("declaration"));
|
27692 | } else {
|
27693 | parts.push(exportKind === "type" ? " type" : "", printModuleSpecifiers(path, options, print), printModuleSource(path, options, print), printImportAssertions(path, options, print));
|
27694 | }
|
27695 | if (shouldExportDeclarationPrintSemi(node, options)) {
|
27696 | parts.push(";");
|
27697 | }
|
27698 | return parts;
|
27699 | }
|
27700 | function printExportAllDeclaration(path, options, print) {
|
27701 | const node = path.getValue();
|
27702 | const semi = options.semi ? ";" : "";
|
27703 | const parts = [];
|
27704 | const {
|
27705 | exportKind,
|
27706 | exported
|
27707 | } = node;
|
27708 | parts.push("export");
|
27709 | if (exportKind === "type") {
|
27710 | parts.push(" type");
|
27711 | }
|
27712 | parts.push(" *");
|
27713 | if (exported) {
|
27714 | parts.push(" as ", print("exported"));
|
27715 | }
|
27716 | parts.push(printModuleSource(path, options, print), printImportAssertions(path, options, print), semi);
|
27717 | return parts;
|
27718 | }
|
27719 | function shouldExportDeclarationPrintSemi(node, options) {
|
27720 | if (!options.semi) {
|
27721 | return false;
|
27722 | }
|
27723 | const {
|
27724 | type,
|
27725 | declaration
|
27726 | } = node;
|
27727 | const isDefaultExport = node.default || type === "ExportDefaultDeclaration";
|
27728 | if (!declaration) {
|
27729 | return true;
|
27730 | }
|
27731 | const {
|
27732 | type: declarationType
|
27733 | } = declaration;
|
27734 | if (isDefaultExport && declarationType !== "ClassDeclaration" && declarationType !== "FunctionDeclaration" && declarationType !== "TSInterfaceDeclaration" && declarationType !== "DeclareClass" && declarationType !== "DeclareFunction" && declarationType !== "TSDeclareFunction" && declarationType !== "EnumDeclaration") {
|
27735 | return true;
|
27736 | }
|
27737 | return false;
|
27738 | }
|
27739 | function printModuleSource(path, options, print) {
|
27740 | const node = path.getValue();
|
27741 | if (!node.source) {
|
27742 | return "";
|
27743 | }
|
27744 | const parts = [];
|
27745 | if (!shouldNotPrintSpecifiers(node, options)) {
|
27746 | parts.push(" from");
|
27747 | }
|
27748 | parts.push(" ", print("source"));
|
27749 | return parts;
|
27750 | }
|
27751 | function printModuleSpecifiers(path, options, print) {
|
27752 | const node = path.getValue();
|
27753 | if (shouldNotPrintSpecifiers(node, options)) {
|
27754 | return "";
|
27755 | }
|
27756 | const parts = [" "];
|
27757 | if (isNonEmptyArray(node.specifiers)) {
|
27758 | const standaloneSpecifiers = [];
|
27759 | const groupedSpecifiers = [];
|
27760 | path.each(() => {
|
27761 | const specifierType = path.getValue().type;
|
27762 | if (specifierType === "ExportNamespaceSpecifier" || specifierType === "ExportDefaultSpecifier" || specifierType === "ImportNamespaceSpecifier" || specifierType === "ImportDefaultSpecifier") {
|
27763 | standaloneSpecifiers.push(print());
|
27764 | } else if (specifierType === "ExportSpecifier" || specifierType === "ImportSpecifier") {
|
27765 | groupedSpecifiers.push(print());
|
27766 | } else {
|
27767 | throw new Error(`Unknown specifier type ${JSON.stringify(specifierType)}`);
|
27768 | }
|
27769 | }, "specifiers");
|
27770 | parts.push(join(", ", standaloneSpecifiers));
|
27771 | if (groupedSpecifiers.length > 0) {
|
27772 | if (standaloneSpecifiers.length > 0) {
|
27773 | parts.push(", ");
|
27774 | }
|
27775 | const canBreak = groupedSpecifiers.length > 1 || standaloneSpecifiers.length > 0 || node.specifiers.some((node2) => hasComment(node2));
|
27776 | if (canBreak) {
|
27777 | parts.push(group(["{", indent([options.bracketSpacing ? line : softline, join([",", line], groupedSpecifiers)]), ifBreak(shouldPrintComma(options) ? "," : ""), options.bracketSpacing ? line : softline, "}"]));
|
27778 | } else {
|
27779 | parts.push(["{", options.bracketSpacing ? " " : "", ...groupedSpecifiers, options.bracketSpacing ? " " : "", "}"]);
|
27780 | }
|
27781 | }
|
27782 | } else {
|
27783 | parts.push("{}");
|
27784 | }
|
27785 | return parts;
|
27786 | }
|
27787 | function shouldNotPrintSpecifiers(node, options) {
|
27788 | const {
|
27789 | type,
|
27790 | importKind,
|
27791 | source,
|
27792 | specifiers
|
27793 | } = node;
|
27794 | if (type !== "ImportDeclaration" || isNonEmptyArray(specifiers) || importKind === "type") {
|
27795 | return false;
|
27796 | }
|
27797 | return !/{\s*}/.test(options.originalText.slice(locStart(node), locStart(source)));
|
27798 | }
|
27799 | function printImportAssertions(path, options, print) {
|
27800 | const node = path.getNode();
|
27801 | if (isNonEmptyArray(node.assertions)) {
|
27802 | return [" assert {", options.bracketSpacing ? " " : "", join(", ", path.map(print, "assertions")), options.bracketSpacing ? " " : "", "}"];
|
27803 | }
|
27804 | return "";
|
27805 | }
|
27806 | function printModuleSpecifier(path, options, print) {
|
27807 | const node = path.getNode();
|
27808 | const {
|
27809 | type
|
27810 | } = node;
|
27811 | const parts = [];
|
27812 | const kind = type === "ImportSpecifier" ? node.importKind : node.exportKind;
|
27813 | if (kind && kind !== "value") {
|
27814 | parts.push(kind, " ");
|
27815 | }
|
27816 | const isImport = type.startsWith("Import");
|
27817 | const leftSideProperty = isImport ? "imported" : "local";
|
27818 | const rightSideProperty = isImport ? "local" : "exported";
|
27819 | const leftSideNode = node[leftSideProperty];
|
27820 | const rightSideNode = node[rightSideProperty];
|
27821 | let left = "";
|
27822 | let right = "";
|
27823 | if (type === "ExportNamespaceSpecifier" || type === "ImportNamespaceSpecifier") {
|
27824 | left = "*";
|
27825 | } else if (leftSideNode) {
|
27826 | left = print(leftSideProperty);
|
27827 | }
|
27828 | if (rightSideNode && !isShorthandSpecifier(node)) {
|
27829 | right = print(rightSideProperty);
|
27830 | }
|
27831 | parts.push(left, left && right ? " as " : "", right);
|
27832 | return parts;
|
27833 | }
|
27834 | function isShorthandSpecifier(specifier) {
|
27835 | if (specifier.type !== "ImportSpecifier" && specifier.type !== "ExportSpecifier") {
|
27836 | return false;
|
27837 | }
|
27838 | const {
|
27839 | local,
|
27840 | [specifier.type === "ImportSpecifier" ? "imported" : "exported"]: importedOrExported
|
27841 | } = specifier;
|
27842 | if (local.type !== importedOrExported.type || !hasSameLoc(local, importedOrExported)) {
|
27843 | return false;
|
27844 | }
|
27845 | if (isStringLiteral(local)) {
|
27846 | return local.value === importedOrExported.value && rawText(local) === rawText(importedOrExported);
|
27847 | }
|
27848 | switch (local.type) {
|
27849 | case "Identifier":
|
27850 | return local.name === importedOrExported.name;
|
27851 | default:
|
27852 | return false;
|
27853 | }
|
27854 | }
|
27855 | module2.exports = {
|
27856 | printImportDeclaration,
|
27857 | printExportDeclaration,
|
27858 | printExportAllDeclaration,
|
27859 | printModuleSpecifier
|
27860 | };
|
27861 | }
|
27862 | });
|
27863 | var require_object = __commonJS2({
|
27864 | "src/language-js/print/object.js"(exports2, module2) {
|
27865 | "use strict";
|
27866 | var {
|
27867 | printDanglingComments
|
27868 | } = require_comments();
|
27869 | var {
|
27870 | builders: {
|
27871 | line,
|
27872 | softline,
|
27873 | group,
|
27874 | indent,
|
27875 | ifBreak,
|
27876 | hardline
|
27877 | }
|
27878 | } = require("./doc.js");
|
27879 | var {
|
27880 | getLast,
|
27881 | hasNewlineInRange,
|
27882 | hasNewline,
|
27883 | isNonEmptyArray
|
27884 | } = require_util();
|
27885 | var {
|
27886 | shouldPrintComma,
|
27887 | hasComment,
|
27888 | getComments,
|
27889 | CommentCheckFlags,
|
27890 | isNextLineEmpty
|
27891 | } = require_utils7();
|
27892 | var {
|
27893 | locStart,
|
27894 | locEnd
|
27895 | } = require_loc();
|
27896 | var {
|
27897 | printOptionalToken,
|
27898 | printTypeAnnotation
|
27899 | } = require_misc();
|
27900 | var {
|
27901 | shouldHugFunctionParameters
|
27902 | } = require_function_parameters();
|
27903 | var {
|
27904 | shouldHugType
|
27905 | } = require_type_annotation();
|
27906 | var {
|
27907 | printHardlineAfterHeritage
|
27908 | } = require_class();
|
27909 | function printObject(path, options, print) {
|
27910 | const semi = options.semi ? ";" : "";
|
27911 | const node = path.getValue();
|
27912 | let propertiesField;
|
27913 | if (node.type === "TSTypeLiteral") {
|
27914 | propertiesField = "members";
|
27915 | } else if (node.type === "TSInterfaceBody") {
|
27916 | propertiesField = "body";
|
27917 | } else {
|
27918 | propertiesField = "properties";
|
27919 | }
|
27920 | const isTypeAnnotation = node.type === "ObjectTypeAnnotation";
|
27921 | const fields = [propertiesField];
|
27922 | if (isTypeAnnotation) {
|
27923 | fields.push("indexers", "callProperties", "internalSlots");
|
27924 | }
|
27925 | const firstProperty = fields.map((field) => node[field][0]).sort((a, b) => locStart(a) - locStart(b))[0];
|
27926 | const parent = path.getParentNode(0);
|
27927 | const isFlowInterfaceLikeBody = isTypeAnnotation && parent && (parent.type === "InterfaceDeclaration" || parent.type === "DeclareInterface" || parent.type === "DeclareClass") && path.getName() === "body";
|
27928 | const shouldBreak = node.type === "TSInterfaceBody" || isFlowInterfaceLikeBody || node.type === "ObjectPattern" && parent.type !== "FunctionDeclaration" && parent.type !== "FunctionExpression" && parent.type !== "ArrowFunctionExpression" && parent.type !== "ObjectMethod" && parent.type !== "ClassMethod" && parent.type !== "ClassPrivateMethod" && parent.type !== "AssignmentPattern" && parent.type !== "CatchClause" && node.properties.some((property) => property.value && (property.value.type === "ObjectPattern" || property.value.type === "ArrayPattern")) || node.type !== "ObjectPattern" && firstProperty && hasNewlineInRange(options.originalText, locStart(node), locStart(firstProperty));
|
27929 | const separator = isFlowInterfaceLikeBody ? ";" : node.type === "TSInterfaceBody" || node.type === "TSTypeLiteral" ? ifBreak(semi, ";") : ",";
|
27930 | const leftBrace = node.type === "RecordExpression" ? "#{" : node.exact ? "{|" : "{";
|
27931 | const rightBrace = node.exact ? "|}" : "}";
|
27932 | const propsAndLoc = [];
|
27933 | for (const field of fields) {
|
27934 | path.each((childPath) => {
|
27935 | const node2 = childPath.getValue();
|
27936 | propsAndLoc.push({
|
27937 | node: node2,
|
27938 | printed: print(),
|
27939 | loc: locStart(node2)
|
27940 | });
|
27941 | }, field);
|
27942 | }
|
27943 | if (fields.length > 1) {
|
27944 | propsAndLoc.sort((a, b) => a.loc - b.loc);
|
27945 | }
|
27946 | let separatorParts = [];
|
27947 | const props = propsAndLoc.map((prop) => {
|
27948 | const result = [...separatorParts, group(prop.printed)];
|
27949 | separatorParts = [separator, line];
|
27950 | if ((prop.node.type === "TSPropertySignature" || prop.node.type === "TSMethodSignature" || prop.node.type === "TSConstructSignatureDeclaration") && hasComment(prop.node, CommentCheckFlags.PrettierIgnore)) {
|
27951 | separatorParts.shift();
|
27952 | }
|
27953 | if (isNextLineEmpty(prop.node, options)) {
|
27954 | separatorParts.push(hardline);
|
27955 | }
|
27956 | return result;
|
27957 | });
|
27958 | if (node.inexact) {
|
27959 | let printed;
|
27960 | if (hasComment(node, CommentCheckFlags.Dangling)) {
|
27961 | const hasLineComments = hasComment(node, CommentCheckFlags.Line);
|
27962 | const printedDanglingComments = printDanglingComments(path, options, true);
|
27963 | printed = [printedDanglingComments, hasLineComments || hasNewline(options.originalText, locEnd(getLast(getComments(node)))) ? hardline : line, "..."];
|
27964 | } else {
|
27965 | printed = ["..."];
|
27966 | }
|
27967 | props.push([...separatorParts, ...printed]);
|
27968 | }
|
27969 | const lastElem = getLast(node[propertiesField]);
|
27970 | const canHaveTrailingSeparator = !(node.inexact || lastElem && lastElem.type === "RestElement" || lastElem && (lastElem.type === "TSPropertySignature" || lastElem.type === "TSCallSignatureDeclaration" || lastElem.type === "TSMethodSignature" || lastElem.type === "TSConstructSignatureDeclaration") && hasComment(lastElem, CommentCheckFlags.PrettierIgnore));
|
27971 | let content;
|
27972 | if (props.length === 0) {
|
27973 | if (!hasComment(node, CommentCheckFlags.Dangling)) {
|
27974 | return [leftBrace, rightBrace, printTypeAnnotation(path, options, print)];
|
27975 | }
|
27976 | content = group([leftBrace, printDanglingComments(path, options), softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)]);
|
27977 | } else {
|
27978 | content = [isFlowInterfaceLikeBody && isNonEmptyArray(node.properties) ? printHardlineAfterHeritage(parent) : "", leftBrace, indent([options.bracketSpacing ? line : softline, ...props]), ifBreak(canHaveTrailingSeparator && (separator !== "," || shouldPrintComma(options)) ? separator : ""), options.bracketSpacing ? line : softline, rightBrace, printOptionalToken(path), printTypeAnnotation(path, options, print)];
|
27979 | }
|
27980 | if (path.match((node2) => node2.type === "ObjectPattern" && !node2.decorators, (node2, name, number) => shouldHugFunctionParameters(node2) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || path.match(shouldHugType, (node2, name) => name === "typeAnnotation", (node2, name) => name === "typeAnnotation", (node2, name, number) => shouldHugFunctionParameters(node2) && (name === "params" || name === "parameters" || name === "this" || name === "rest") && number === 0) || !shouldBreak && path.match((node2) => node2.type === "ObjectPattern", (node2) => node2.type === "AssignmentExpression" || node2.type === "VariableDeclarator")) {
|
27981 | return content;
|
27982 | }
|
27983 | return group(content, {
|
27984 | shouldBreak
|
27985 | });
|
27986 | }
|
27987 | module2.exports = {
|
27988 | printObject
|
27989 | };
|
27990 | }
|
27991 | });
|
27992 | var require_flow = __commonJS2({
|
27993 | "src/language-js/print/flow.js"(exports2, module2) {
|
27994 | "use strict";
|
27995 | var assert = require("assert");
|
27996 | var {
|
27997 | printDanglingComments
|
27998 | } = require_comments();
|
27999 | var {
|
28000 | printString,
|
28001 | printNumber
|
28002 | } = require_util();
|
28003 | var {
|
28004 | builders: {
|
28005 | hardline,
|
28006 | softline,
|
28007 | group,
|
28008 | indent
|
28009 | }
|
28010 | } = require("./doc.js");
|
28011 | var {
|
28012 | getParentExportDeclaration,
|
28013 | isFunctionNotation,
|
28014 | isGetterOrSetter,
|
28015 | rawText,
|
28016 | shouldPrintComma
|
28017 | } = require_utils7();
|
28018 | var {
|
28019 | locStart,
|
28020 | locEnd
|
28021 | } = require_loc();
|
28022 | var {
|
28023 | replaceTextEndOfLine
|
28024 | } = require_doc_utils();
|
28025 | var {
|
28026 | printClass
|
28027 | } = require_class();
|
28028 | var {
|
28029 | printOpaqueType,
|
28030 | printTypeAlias,
|
28031 | printIntersectionType,
|
28032 | printUnionType,
|
28033 | printFunctionType,
|
28034 | printTupleType,
|
28035 | printIndexedAccessType
|
28036 | } = require_type_annotation();
|
28037 | var {
|
28038 | printInterface
|
28039 | } = require_interface();
|
28040 | var {
|
28041 | printTypeParameter,
|
28042 | printTypeParameters
|
28043 | } = require_type_parameters();
|
28044 | var {
|
28045 | printExportDeclaration,
|
28046 | printExportAllDeclaration
|
28047 | } = require_module();
|
28048 | var {
|
28049 | printArrayItems
|
28050 | } = require_array4();
|
28051 | var {
|
28052 | printObject
|
28053 | } = require_object();
|
28054 | var {
|
28055 | printPropertyKey
|
28056 | } = require_property();
|
28057 | var {
|
28058 | printOptionalToken,
|
28059 | printTypeAnnotation,
|
28060 | printRestSpread
|
28061 | } = require_misc();
|
28062 | function printFlow(path, options, print) {
|
28063 | const node = path.getValue();
|
28064 | const semi = options.semi ? ";" : "";
|
28065 | const parts = [];
|
28066 | switch (node.type) {
|
28067 | case "DeclareClass":
|
28068 | return printFlowDeclaration(path, printClass(path, options, print));
|
28069 | case "DeclareFunction":
|
28070 | return printFlowDeclaration(path, ["function ", print("id"), node.predicate ? " " : "", print("predicate"), semi]);
|
28071 | case "DeclareModule":
|
28072 | return printFlowDeclaration(path, ["module ", print("id"), " ", print("body")]);
|
28073 | case "DeclareModuleExports":
|
28074 | return printFlowDeclaration(path, ["module.exports", ": ", print("typeAnnotation"), semi]);
|
28075 | case "DeclareVariable":
|
28076 | return printFlowDeclaration(path, ["var ", print("id"), semi]);
|
28077 | case "DeclareOpaqueType":
|
28078 | return printFlowDeclaration(path, printOpaqueType(path, options, print));
|
28079 | case "DeclareInterface":
|
28080 | return printFlowDeclaration(path, printInterface(path, options, print));
|
28081 | case "DeclareTypeAlias":
|
28082 | return printFlowDeclaration(path, printTypeAlias(path, options, print));
|
28083 | case "DeclareExportDeclaration":
|
28084 | return printFlowDeclaration(path, printExportDeclaration(path, options, print));
|
28085 | case "DeclareExportAllDeclaration":
|
28086 | return printFlowDeclaration(path, printExportAllDeclaration(path, options, print));
|
28087 | case "OpaqueType":
|
28088 | return printOpaqueType(path, options, print);
|
28089 | case "TypeAlias":
|
28090 | return printTypeAlias(path, options, print);
|
28091 | case "IntersectionTypeAnnotation":
|
28092 | return printIntersectionType(path, options, print);
|
28093 | case "UnionTypeAnnotation":
|
28094 | return printUnionType(path, options, print);
|
28095 | case "FunctionTypeAnnotation":
|
28096 | return printFunctionType(path, options, print);
|
28097 | case "TupleTypeAnnotation":
|
28098 | return printTupleType(path, options, print);
|
28099 | case "GenericTypeAnnotation":
|
28100 | return [print("id"), printTypeParameters(path, options, print, "typeParameters")];
|
28101 | case "IndexedAccessType":
|
28102 | case "OptionalIndexedAccessType":
|
28103 | return printIndexedAccessType(path, options, print);
|
28104 | case "TypeAnnotation":
|
28105 | return print("typeAnnotation");
|
28106 | case "TypeParameter":
|
28107 | return printTypeParameter(path, options, print);
|
28108 | case "TypeofTypeAnnotation":
|
28109 | return ["typeof ", print("argument")];
|
28110 | case "ExistsTypeAnnotation":
|
28111 | return "*";
|
28112 | case "EmptyTypeAnnotation":
|
28113 | return "empty";
|
28114 | case "MixedTypeAnnotation":
|
28115 | return "mixed";
|
28116 | case "ArrayTypeAnnotation":
|
28117 | return [print("elementType"), "[]"];
|
28118 | case "BooleanLiteralTypeAnnotation":
|
28119 | return String(node.value);
|
28120 | case "EnumDeclaration":
|
28121 | return ["enum ", print("id"), " ", print("body")];
|
28122 | case "EnumBooleanBody":
|
28123 | case "EnumNumberBody":
|
28124 | case "EnumStringBody":
|
28125 | case "EnumSymbolBody": {
|
28126 | if (node.type === "EnumSymbolBody" || node.explicitType) {
|
28127 | let type = null;
|
28128 | switch (node.type) {
|
28129 | case "EnumBooleanBody":
|
28130 | type = "boolean";
|
28131 | break;
|
28132 | case "EnumNumberBody":
|
28133 | type = "number";
|
28134 | break;
|
28135 | case "EnumStringBody":
|
28136 | type = "string";
|
28137 | break;
|
28138 | case "EnumSymbolBody":
|
28139 | type = "symbol";
|
28140 | break;
|
28141 | }
|
28142 | parts.push("of ", type, " ");
|
28143 | }
|
28144 | if (node.members.length === 0 && !node.hasUnknownMembers) {
|
28145 | parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
|
28146 | } else {
|
28147 | const members = node.members.length > 0 ? [hardline, printArrayItems(path, options, "members", print), node.hasUnknownMembers || shouldPrintComma(options) ? "," : ""] : [];
|
28148 | parts.push(group(["{", indent([...members, ...node.hasUnknownMembers ? [hardline, "..."] : []]), printDanglingComments(path, options, true), hardline, "}"]));
|
28149 | }
|
28150 | return parts;
|
28151 | }
|
28152 | case "EnumBooleanMember":
|
28153 | case "EnumNumberMember":
|
28154 | case "EnumStringMember":
|
28155 | return [print("id"), " = ", typeof node.init === "object" ? print("init") : String(node.init)];
|
28156 | case "EnumDefaultedMember":
|
28157 | return print("id");
|
28158 | case "FunctionTypeParam": {
|
28159 | const name = node.name ? print("name") : path.getParentNode().this === node ? "this" : "";
|
28160 | return [name, printOptionalToken(path), name ? ": " : "", print("typeAnnotation")];
|
28161 | }
|
28162 | case "InterfaceDeclaration":
|
28163 | case "InterfaceTypeAnnotation":
|
28164 | return printInterface(path, options, print);
|
28165 | case "ClassImplements":
|
28166 | case "InterfaceExtends":
|
28167 | return [print("id"), print("typeParameters")];
|
28168 | case "NullableTypeAnnotation":
|
28169 | return ["?", print("typeAnnotation")];
|
28170 | case "Variance": {
|
28171 | const {
|
28172 | kind
|
28173 | } = node;
|
28174 | assert.ok(kind === "plus" || kind === "minus");
|
28175 | return kind === "plus" ? "+" : "-";
|
28176 | }
|
28177 | case "ObjectTypeCallProperty":
|
28178 | if (node.static) {
|
28179 | parts.push("static ");
|
28180 | }
|
28181 | parts.push(print("value"));
|
28182 | return parts;
|
28183 | case "ObjectTypeIndexer": {
|
28184 | return [node.static ? "static " : "", node.variance ? print("variance") : "", "[", print("id"), node.id ? ": " : "", print("key"), "]: ", print("value")];
|
28185 | }
|
28186 | case "ObjectTypeProperty": {
|
28187 | let modifier = "";
|
28188 | if (node.proto) {
|
28189 | modifier = "proto ";
|
28190 | } else if (node.static) {
|
28191 | modifier = "static ";
|
28192 | }
|
28193 | return [modifier, isGetterOrSetter(node) ? node.kind + " " : "", node.variance ? print("variance") : "", printPropertyKey(path, options, print), printOptionalToken(path), isFunctionNotation(node) ? "" : ": ", print("value")];
|
28194 | }
|
28195 | case "ObjectTypeAnnotation":
|
28196 | return printObject(path, options, print);
|
28197 | case "ObjectTypeInternalSlot":
|
28198 | return [node.static ? "static " : "", "[[", print("id"), "]]", printOptionalToken(path), node.method ? "" : ": ", print("value")];
|
28199 | case "ObjectTypeSpreadProperty":
|
28200 | return printRestSpread(path, options, print);
|
28201 | case "QualifiedTypeofIdentifier":
|
28202 | case "QualifiedTypeIdentifier":
|
28203 | return [print("qualification"), ".", print("id")];
|
28204 | case "StringLiteralTypeAnnotation":
|
28205 | return replaceTextEndOfLine(printString(rawText(node), options));
|
28206 | case "NumberLiteralTypeAnnotation":
|
28207 | assert.strictEqual(typeof node.value, "number");
|
28208 | case "BigIntLiteralTypeAnnotation":
|
28209 | if (node.extra) {
|
28210 | return printNumber(node.extra.raw);
|
28211 | }
|
28212 | return printNumber(node.raw);
|
28213 | case "TypeCastExpression": {
|
28214 | return ["(", print("expression"), printTypeAnnotation(path, options, print), ")"];
|
28215 | }
|
28216 | case "TypeParameterDeclaration":
|
28217 | case "TypeParameterInstantiation": {
|
28218 | const printed = printTypeParameters(path, options, print, "params");
|
28219 | if (options.parser === "flow") {
|
28220 | const start = locStart(node);
|
28221 | const end = locEnd(node);
|
28222 | const commentStartIndex = options.originalText.lastIndexOf("/*", start);
|
28223 | const commentEndIndex = options.originalText.indexOf("*/", end);
|
28224 | if (commentStartIndex !== -1 && commentEndIndex !== -1) {
|
28225 | const comment = options.originalText.slice(commentStartIndex + 2, commentEndIndex).trim();
|
28226 | if (comment.startsWith("::") && !comment.includes("/*") && !comment.includes("*/")) {
|
28227 | return ["/*:: ", printed, " */"];
|
28228 | }
|
28229 | }
|
28230 | }
|
28231 | return printed;
|
28232 | }
|
28233 | case "InferredPredicate":
|
28234 | return "%checks";
|
28235 | case "DeclaredPredicate":
|
28236 | return ["%checks(", print("value"), ")"];
|
28237 | case "AnyTypeAnnotation":
|
28238 | return "any";
|
28239 | case "BooleanTypeAnnotation":
|
28240 | return "boolean";
|
28241 | case "BigIntTypeAnnotation":
|
28242 | return "bigint";
|
28243 | case "NullLiteralTypeAnnotation":
|
28244 | return "null";
|
28245 | case "NumberTypeAnnotation":
|
28246 | return "number";
|
28247 | case "SymbolTypeAnnotation":
|
28248 | return "symbol";
|
28249 | case "StringTypeAnnotation":
|
28250 | return "string";
|
28251 | case "VoidTypeAnnotation":
|
28252 | return "void";
|
28253 | case "ThisTypeAnnotation":
|
28254 | return "this";
|
28255 | case "Node":
|
28256 | case "Printable":
|
28257 | case "SourceLocation":
|
28258 | case "Position":
|
28259 | case "Statement":
|
28260 | case "Function":
|
28261 | case "Pattern":
|
28262 | case "Expression":
|
28263 | case "Declaration":
|
28264 | case "Specifier":
|
28265 | case "NamedSpecifier":
|
28266 | case "Comment":
|
28267 | case "MemberTypeAnnotation":
|
28268 | case "Type":
|
28269 | throw new Error("unprintable type: " + JSON.stringify(node.type));
|
28270 | }
|
28271 | }
|
28272 | function printFlowDeclaration(path, printed) {
|
28273 | const parentExportDecl = getParentExportDeclaration(path);
|
28274 | if (parentExportDecl) {
|
28275 | assert.strictEqual(parentExportDecl.type, "DeclareExportDeclaration");
|
28276 | return printed;
|
28277 | }
|
28278 | return ["declare ", printed];
|
28279 | }
|
28280 | module2.exports = {
|
28281 | printFlow
|
28282 | };
|
28283 | }
|
28284 | });
|
28285 | var require_is_ts_keyword_type = __commonJS2({
|
28286 | "src/language-js/utils/is-ts-keyword-type.js"(exports2, module2) {
|
28287 | "use strict";
|
28288 | function isTsKeywordType({
|
28289 | type
|
28290 | }) {
|
28291 | return type.startsWith("TS") && type.endsWith("Keyword");
|
28292 | }
|
28293 | module2.exports = isTsKeywordType;
|
28294 | }
|
28295 | });
|
28296 | var require_ternary = __commonJS2({
|
28297 | "src/language-js/print/ternary.js"(exports2, module2) {
|
28298 | "use strict";
|
28299 | var {
|
28300 | hasNewlineInRange
|
28301 | } = require_util();
|
28302 | var {
|
28303 | isJsxNode,
|
28304 | getComments,
|
28305 | isCallExpression,
|
28306 | isMemberExpression,
|
28307 | isTSTypeExpression
|
28308 | } = require_utils7();
|
28309 | var {
|
28310 | locStart,
|
28311 | locEnd
|
28312 | } = require_loc();
|
28313 | var isBlockComment = require_is_block_comment();
|
28314 | var {
|
28315 | builders: {
|
28316 | line,
|
28317 | softline,
|
28318 | group,
|
28319 | indent,
|
28320 | align,
|
28321 | ifBreak,
|
28322 | dedent,
|
28323 | breakParent
|
28324 | }
|
28325 | } = require("./doc.js");
|
28326 | function conditionalExpressionChainContainsJsx(node) {
|
28327 | const conditionalExpressions = [node];
|
28328 | for (let index = 0; index < conditionalExpressions.length; index++) {
|
28329 | const conditionalExpression = conditionalExpressions[index];
|
28330 | for (const property of ["test", "consequent", "alternate"]) {
|
28331 | const node2 = conditionalExpression[property];
|
28332 | if (isJsxNode(node2)) {
|
28333 | return true;
|
28334 | }
|
28335 | if (node2.type === "ConditionalExpression") {
|
28336 | conditionalExpressions.push(node2);
|
28337 | }
|
28338 | }
|
28339 | }
|
28340 | return false;
|
28341 | }
|
28342 | function printTernaryTest(path, options, print) {
|
28343 | const node = path.getValue();
|
28344 | const isConditionalExpression = node.type === "ConditionalExpression";
|
28345 | const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
|
28346 | const parent = path.getParentNode();
|
28347 | const printed = isConditionalExpression ? print("test") : [print("checkType"), " ", "extends", " ", print("extendsType")];
|
28348 | if (parent.type === node.type && parent[alternateNodePropertyName] === node) {
|
28349 | return align(2, printed);
|
28350 | }
|
28351 | return printed;
|
28352 | }
|
28353 | var ancestorNameMap = new Map([["AssignmentExpression", "right"], ["VariableDeclarator", "init"], ["ReturnStatement", "argument"], ["ThrowStatement", "argument"], ["UnaryExpression", "argument"], ["YieldExpression", "argument"]]);
|
28354 | function shouldExtraIndentForConditionalExpression(path) {
|
28355 | const node = path.getValue();
|
28356 | if (node.type !== "ConditionalExpression") {
|
28357 | return false;
|
28358 | }
|
28359 | let parent;
|
28360 | let child = node;
|
28361 | for (let ancestorCount = 0; !parent; ancestorCount++) {
|
28362 | const node2 = path.getParentNode(ancestorCount);
|
28363 | if (isCallExpression(node2) && node2.callee === child || isMemberExpression(node2) && node2.object === child || node2.type === "TSNonNullExpression" && node2.expression === child) {
|
28364 | child = node2;
|
28365 | continue;
|
28366 | }
|
28367 | if (node2.type === "NewExpression" && node2.callee === child || isTSTypeExpression(node2) && node2.expression === child) {
|
28368 | parent = path.getParentNode(ancestorCount + 1);
|
28369 | child = node2;
|
28370 | } else {
|
28371 | parent = node2;
|
28372 | }
|
28373 | }
|
28374 | if (child === node) {
|
28375 | return false;
|
28376 | }
|
28377 | return parent[ancestorNameMap.get(parent.type)] === child;
|
28378 | }
|
28379 | function printTernary(path, options, print) {
|
28380 | const node = path.getValue();
|
28381 | const isConditionalExpression = node.type === "ConditionalExpression";
|
28382 | const consequentNodePropertyName = isConditionalExpression ? "consequent" : "trueType";
|
28383 | const alternateNodePropertyName = isConditionalExpression ? "alternate" : "falseType";
|
28384 | const testNodePropertyNames = isConditionalExpression ? ["test"] : ["checkType", "extendsType"];
|
28385 | const consequentNode = node[consequentNodePropertyName];
|
28386 | const alternateNode = node[alternateNodePropertyName];
|
28387 | const parts = [];
|
28388 | let jsxMode = false;
|
28389 | const parent = path.getParentNode();
|
28390 | const isParentTest = parent.type === node.type && testNodePropertyNames.some((prop) => parent[prop] === node);
|
28391 | let forceNoIndent = parent.type === node.type && !isParentTest;
|
28392 | let currentParent;
|
28393 | let previousParent;
|
28394 | let i = 0;
|
28395 | do {
|
28396 | previousParent = currentParent || node;
|
28397 | currentParent = path.getParentNode(i);
|
28398 | i++;
|
28399 | } while (currentParent && currentParent.type === node.type && testNodePropertyNames.every((prop) => currentParent[prop] !== previousParent));
|
28400 | const firstNonConditionalParent = currentParent || parent;
|
28401 | const lastConditionalParent = previousParent;
|
28402 | if (isConditionalExpression && (isJsxNode(node[testNodePropertyNames[0]]) || isJsxNode(consequentNode) || isJsxNode(alternateNode) || conditionalExpressionChainContainsJsx(lastConditionalParent))) {
|
28403 | jsxMode = true;
|
28404 | forceNoIndent = true;
|
28405 | const wrap = (doc2) => [ifBreak("("), indent([softline, doc2]), softline, ifBreak(")")];
|
28406 | const isNil = (node2) => node2.type === "NullLiteral" || node2.type === "Literal" && node2.value === null || node2.type === "Identifier" && node2.name === "undefined";
|
28407 | parts.push(" ? ", isNil(consequentNode) ? print(consequentNodePropertyName) : wrap(print(consequentNodePropertyName)), " : ", alternateNode.type === node.type || isNil(alternateNode) ? print(alternateNodePropertyName) : wrap(print(alternateNodePropertyName)));
|
28408 | } else {
|
28409 | const part = [line, "? ", consequentNode.type === node.type ? ifBreak("", "(") : "", align(2, print(consequentNodePropertyName)), consequentNode.type === node.type ? ifBreak("", ")") : "", line, ": ", alternateNode.type === node.type ? print(alternateNodePropertyName) : align(2, print(alternateNodePropertyName))];
|
28410 | parts.push(parent.type !== node.type || parent[alternateNodePropertyName] === node || isParentTest ? part : options.useTabs ? dedent(indent(part)) : align(Math.max(0, options.tabWidth - 2), part));
|
28411 | }
|
28412 | const comments = [...testNodePropertyNames.map((propertyName) => getComments(node[propertyName])), getComments(consequentNode), getComments(alternateNode)].flat();
|
28413 | const shouldBreak = comments.some((comment) => isBlockComment(comment) && hasNewlineInRange(options.originalText, locStart(comment), locEnd(comment)));
|
28414 | const maybeGroup = (doc2) => parent === firstNonConditionalParent ? group(doc2, {
|
28415 | shouldBreak
|
28416 | }) : shouldBreak ? [doc2, breakParent] : doc2;
|
28417 | const breakClosingParen = !jsxMode && (isMemberExpression(parent) || parent.type === "NGPipeExpression" && parent.left === node) && !parent.computed;
|
28418 | const shouldExtraIndent = shouldExtraIndentForConditionalExpression(path);
|
28419 | const result = maybeGroup([printTernaryTest(path, options, print), forceNoIndent ? parts : indent(parts), isConditionalExpression && breakClosingParen && !shouldExtraIndent ? softline : ""]);
|
28420 | return isParentTest || shouldExtraIndent ? group([indent([softline, result]), softline]) : result;
|
28421 | }
|
28422 | module2.exports = {
|
28423 | printTernary
|
28424 | };
|
28425 | }
|
28426 | });
|
28427 | var require_statement = __commonJS2({
|
28428 | "src/language-js/print/statement.js"(exports2, module2) {
|
28429 | "use strict";
|
28430 | var {
|
28431 | builders: {
|
28432 | hardline
|
28433 | }
|
28434 | } = require("./doc.js");
|
28435 | var pathNeedsParens = require_needs_parens();
|
28436 | var {
|
28437 | getLeftSidePathName,
|
28438 | hasNakedLeftSide,
|
28439 | isJsxNode,
|
28440 | isTheOnlyJsxElementInMarkdown,
|
28441 | hasComment,
|
28442 | CommentCheckFlags,
|
28443 | isNextLineEmpty
|
28444 | } = require_utils7();
|
28445 | var {
|
28446 | shouldPrintParamsWithoutParens
|
28447 | } = require_function();
|
28448 | function printStatementSequence(path, options, print, property) {
|
28449 | const node = path.getValue();
|
28450 | const parts = [];
|
28451 | const isClassBody = node.type === "ClassBody";
|
28452 | const lastStatement = getLastStatement(node[property]);
|
28453 | path.each((path2, index, statements) => {
|
28454 | const node2 = path2.getValue();
|
28455 | if (node2.type === "EmptyStatement") {
|
28456 | return;
|
28457 | }
|
28458 | const printed = print();
|
28459 | if (!options.semi && !isClassBody && !isTheOnlyJsxElementInMarkdown(options, path2) && statementNeedsASIProtection(path2, options)) {
|
28460 | if (hasComment(node2, CommentCheckFlags.Leading)) {
|
28461 | parts.push(print([], {
|
28462 | needsSemi: true
|
28463 | }));
|
28464 | } else {
|
28465 | parts.push(";", printed);
|
28466 | }
|
28467 | } else {
|
28468 | parts.push(printed);
|
28469 | }
|
28470 | if (!options.semi && isClassBody && isClassProperty(node2) && shouldPrintSemicolonAfterClassProperty(node2, statements[index + 1])) {
|
28471 | parts.push(";");
|
28472 | }
|
28473 | if (node2 !== lastStatement) {
|
28474 | parts.push(hardline);
|
28475 | if (isNextLineEmpty(node2, options)) {
|
28476 | parts.push(hardline);
|
28477 | }
|
28478 | }
|
28479 | }, property);
|
28480 | return parts;
|
28481 | }
|
28482 | function getLastStatement(statements) {
|
28483 | for (let i = statements.length - 1; i >= 0; i--) {
|
28484 | const statement = statements[i];
|
28485 | if (statement.type !== "EmptyStatement") {
|
28486 | return statement;
|
28487 | }
|
28488 | }
|
28489 | }
|
28490 | function statementNeedsASIProtection(path, options) {
|
28491 | const node = path.getNode();
|
28492 | if (node.type !== "ExpressionStatement") {
|
28493 | return false;
|
28494 | }
|
28495 | return path.call((childPath) => expressionNeedsASIProtection(childPath, options), "expression");
|
28496 | }
|
28497 | function expressionNeedsASIProtection(path, options) {
|
28498 | const node = path.getValue();
|
28499 | switch (node.type) {
|
28500 | case "ParenthesizedExpression":
|
28501 | case "TypeCastExpression":
|
28502 | case "ArrayExpression":
|
28503 | case "ArrayPattern":
|
28504 | case "TemplateLiteral":
|
28505 | case "TemplateElement":
|
28506 | case "RegExpLiteral":
|
28507 | return true;
|
28508 | case "ArrowFunctionExpression": {
|
28509 | if (!shouldPrintParamsWithoutParens(path, options)) {
|
28510 | return true;
|
28511 | }
|
28512 | break;
|
28513 | }
|
28514 | case "UnaryExpression": {
|
28515 | const {
|
28516 | prefix,
|
28517 | operator
|
28518 | } = node;
|
28519 | if (prefix && (operator === "+" || operator === "-")) {
|
28520 | return true;
|
28521 | }
|
28522 | break;
|
28523 | }
|
28524 | case "BindExpression": {
|
28525 | if (!node.object) {
|
28526 | return true;
|
28527 | }
|
28528 | break;
|
28529 | }
|
28530 | case "Literal": {
|
28531 | if (node.regex) {
|
28532 | return true;
|
28533 | }
|
28534 | break;
|
28535 | }
|
28536 | default: {
|
28537 | if (isJsxNode(node)) {
|
28538 | return true;
|
28539 | }
|
28540 | }
|
28541 | }
|
28542 | if (pathNeedsParens(path, options)) {
|
28543 | return true;
|
28544 | }
|
28545 | if (!hasNakedLeftSide(node)) {
|
28546 | return false;
|
28547 | }
|
28548 | return path.call((childPath) => expressionNeedsASIProtection(childPath, options), ...getLeftSidePathName(path, node));
|
28549 | }
|
28550 | function printBody(path, options, print) {
|
28551 | return printStatementSequence(path, options, print, "body");
|
28552 | }
|
28553 | function printSwitchCaseConsequent(path, options, print) {
|
28554 | return printStatementSequence(path, options, print, "consequent");
|
28555 | }
|
28556 | var isClassProperty = ({
|
28557 | type
|
28558 | }) => type === "ClassProperty" || type === "PropertyDefinition" || type === "ClassPrivateProperty" || type === "ClassAccessorProperty" || type === "AccessorProperty" || type === "TSAbstractPropertyDefinition" || type === "TSAbstractAccessorProperty";
|
28559 | function shouldPrintSemicolonAfterClassProperty(node, nextNode) {
|
28560 | const {
|
28561 | name
|
28562 | } = node.key;
|
28563 | if ((name === "static" || name === "get" || name === "set" || name === "accessor") && !node.value && !node.typeAnnotation) {
|
28564 | return true;
|
28565 | }
|
28566 | if (!nextNode) {
|
28567 | return false;
|
28568 | }
|
28569 | if (nextNode.static || nextNode.accessibility) {
|
28570 | return false;
|
28571 | }
|
28572 | if (!nextNode.computed) {
|
28573 | const name2 = nextNode.key && nextNode.key.name;
|
28574 | if (name2 === "in" || name2 === "instanceof") {
|
28575 | return true;
|
28576 | }
|
28577 | }
|
28578 | if (isClassProperty(nextNode) && nextNode.variance && !nextNode.static && !nextNode.declare) {
|
28579 | return true;
|
28580 | }
|
28581 | switch (nextNode.type) {
|
28582 | case "ClassProperty":
|
28583 | case "PropertyDefinition":
|
28584 | case "TSAbstractPropertyDefinition":
|
28585 | return nextNode.computed;
|
28586 | case "MethodDefinition":
|
28587 | case "TSAbstractMethodDefinition":
|
28588 | case "ClassMethod":
|
28589 | case "ClassPrivateMethod": {
|
28590 | const isAsync = nextNode.value ? nextNode.value.async : nextNode.async;
|
28591 | if (isAsync || nextNode.kind === "get" || nextNode.kind === "set") {
|
28592 | return false;
|
28593 | }
|
28594 | const isGenerator = nextNode.value ? nextNode.value.generator : nextNode.generator;
|
28595 | if (nextNode.computed || isGenerator) {
|
28596 | return true;
|
28597 | }
|
28598 | return false;
|
28599 | }
|
28600 | case "TSIndexSignature":
|
28601 | return true;
|
28602 | }
|
28603 | return false;
|
28604 | }
|
28605 | module2.exports = {
|
28606 | printBody,
|
28607 | printSwitchCaseConsequent
|
28608 | };
|
28609 | }
|
28610 | });
|
28611 | var require_block = __commonJS2({
|
28612 | "src/language-js/print/block.js"(exports2, module2) {
|
28613 | "use strict";
|
28614 | var {
|
28615 | printDanglingComments
|
28616 | } = require_comments();
|
28617 | var {
|
28618 | isNonEmptyArray
|
28619 | } = require_util();
|
28620 | var {
|
28621 | builders: {
|
28622 | hardline,
|
28623 | indent
|
28624 | }
|
28625 | } = require("./doc.js");
|
28626 | var {
|
28627 | hasComment,
|
28628 | CommentCheckFlags,
|
28629 | isNextLineEmpty
|
28630 | } = require_utils7();
|
28631 | var {
|
28632 | printHardlineAfterHeritage
|
28633 | } = require_class();
|
28634 | var {
|
28635 | printBody
|
28636 | } = require_statement();
|
28637 | function printBlock(path, options, print) {
|
28638 | const node = path.getValue();
|
28639 | const parts = [];
|
28640 | if (node.type === "StaticBlock") {
|
28641 | parts.push("static ");
|
28642 | }
|
28643 | if (node.type === "ClassBody" && isNonEmptyArray(node.body)) {
|
28644 | const parent = path.getParentNode();
|
28645 | parts.push(printHardlineAfterHeritage(parent));
|
28646 | }
|
28647 | parts.push("{");
|
28648 | const printed = printBlockBody(path, options, print);
|
28649 | if (printed) {
|
28650 | parts.push(indent([hardline, printed]), hardline);
|
28651 | } else {
|
28652 | const parent = path.getParentNode();
|
28653 | const parentParent = path.getParentNode(1);
|
28654 | if (!(parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression" || parent.type === "FunctionDeclaration" || parent.type === "ObjectMethod" || parent.type === "ClassMethod" || parent.type === "ClassPrivateMethod" || parent.type === "ForStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement" || parent.type === "DoExpression" || parent.type === "CatchClause" && !parentParent.finalizer || parent.type === "TSModuleDeclaration" || parent.type === "TSDeclareFunction" || node.type === "StaticBlock" || node.type === "ClassBody")) {
|
28655 | parts.push(hardline);
|
28656 | }
|
28657 | }
|
28658 | parts.push("}");
|
28659 | return parts;
|
28660 | }
|
28661 | function printBlockBody(path, options, print) {
|
28662 | const node = path.getValue();
|
28663 | const nodeHasDirectives = isNonEmptyArray(node.directives);
|
28664 | const nodeHasBody = node.body.some((node2) => node2.type !== "EmptyStatement");
|
28665 | const nodeHasComment = hasComment(node, CommentCheckFlags.Dangling);
|
28666 | if (!nodeHasDirectives && !nodeHasBody && !nodeHasComment) {
|
28667 | return "";
|
28668 | }
|
28669 | const parts = [];
|
28670 | if (nodeHasDirectives) {
|
28671 | path.each((childPath, index, directives) => {
|
28672 | parts.push(print());
|
28673 | if (index < directives.length - 1 || nodeHasBody || nodeHasComment) {
|
28674 | parts.push(hardline);
|
28675 | if (isNextLineEmpty(childPath.getValue(), options)) {
|
28676 | parts.push(hardline);
|
28677 | }
|
28678 | }
|
28679 | }, "directives");
|
28680 | }
|
28681 | if (nodeHasBody) {
|
28682 | parts.push(printBody(path, options, print));
|
28683 | }
|
28684 | if (nodeHasComment) {
|
28685 | parts.push(printDanglingComments(path, options, true));
|
28686 | }
|
28687 | if (node.type === "Program") {
|
28688 | const parent = path.getParentNode();
|
28689 | if (!parent || parent.type !== "ModuleExpression") {
|
28690 | parts.push(hardline);
|
28691 | }
|
28692 | }
|
28693 | return parts;
|
28694 | }
|
28695 | module2.exports = {
|
28696 | printBlock,
|
28697 | printBlockBody
|
28698 | };
|
28699 | }
|
28700 | });
|
28701 | var require_typescript = __commonJS2({
|
28702 | "src/language-js/print/typescript.js"(exports2, module2) {
|
28703 | "use strict";
|
28704 | var {
|
28705 | printDanglingComments
|
28706 | } = require_comments();
|
28707 | var {
|
28708 | hasNewlineInRange
|
28709 | } = require_util();
|
28710 | var {
|
28711 | builders: {
|
28712 | join,
|
28713 | line,
|
28714 | hardline,
|
28715 | softline,
|
28716 | group,
|
28717 | indent,
|
28718 | conditionalGroup,
|
28719 | ifBreak
|
28720 | }
|
28721 | } = require("./doc.js");
|
28722 | var {
|
28723 | isLiteral,
|
28724 | getTypeScriptMappedTypeModifier,
|
28725 | shouldPrintComma,
|
28726 | isCallExpression,
|
28727 | isMemberExpression
|
28728 | } = require_utils7();
|
28729 | var isTsKeywordType = require_is_ts_keyword_type();
|
28730 | var {
|
28731 | locStart,
|
28732 | locEnd
|
28733 | } = require_loc();
|
28734 | var {
|
28735 | printOptionalToken,
|
28736 | printTypeScriptModifiers
|
28737 | } = require_misc();
|
28738 | var {
|
28739 | printTernary
|
28740 | } = require_ternary();
|
28741 | var {
|
28742 | printFunctionParameters,
|
28743 | shouldGroupFunctionParameters
|
28744 | } = require_function_parameters();
|
28745 | var {
|
28746 | printTemplateLiteral
|
28747 | } = require_template_literal();
|
28748 | var {
|
28749 | printArrayItems
|
28750 | } = require_array4();
|
28751 | var {
|
28752 | printObject
|
28753 | } = require_object();
|
28754 | var {
|
28755 | printClassProperty,
|
28756 | printClassMethod
|
28757 | } = require_class();
|
28758 | var {
|
28759 | printTypeParameter,
|
28760 | printTypeParameters
|
28761 | } = require_type_parameters();
|
28762 | var {
|
28763 | printPropertyKey
|
28764 | } = require_property();
|
28765 | var {
|
28766 | printFunction,
|
28767 | printMethodInternal
|
28768 | } = require_function();
|
28769 | var {
|
28770 | printInterface
|
28771 | } = require_interface();
|
28772 | var {
|
28773 | printBlock
|
28774 | } = require_block();
|
28775 | var {
|
28776 | printTypeAlias,
|
28777 | printIntersectionType,
|
28778 | printUnionType,
|
28779 | printFunctionType,
|
28780 | printTupleType,
|
28781 | printIndexedAccessType,
|
28782 | printJSDocType
|
28783 | } = require_type_annotation();
|
28784 | function printTypescript(path, options, print) {
|
28785 | const node = path.getValue();
|
28786 | if (!node.type.startsWith("TS")) {
|
28787 | return;
|
28788 | }
|
28789 | if (isTsKeywordType(node)) {
|
28790 | return node.type.slice(2, -7).toLowerCase();
|
28791 | }
|
28792 | const semi = options.semi ? ";" : "";
|
28793 | const parts = [];
|
28794 | switch (node.type) {
|
28795 | case "TSThisType":
|
28796 | return "this";
|
28797 | case "TSTypeAssertion": {
|
28798 | const shouldBreakAfterCast = !(node.expression.type === "ArrayExpression" || node.expression.type === "ObjectExpression");
|
28799 | const castGroup = group(["<", indent([softline, print("typeAnnotation")]), softline, ">"]);
|
28800 | const exprContents = [ifBreak("("), indent([softline, print("expression")]), softline, ifBreak(")")];
|
28801 | if (shouldBreakAfterCast) {
|
28802 | return conditionalGroup([[castGroup, print("expression")], [castGroup, group(exprContents, {
|
28803 | shouldBreak: true
|
28804 | })], [castGroup, print("expression")]]);
|
28805 | }
|
28806 | return group([castGroup, print("expression")]);
|
28807 | }
|
28808 | case "TSDeclareFunction":
|
28809 | return printFunction(path, print, options);
|
28810 | case "TSExportAssignment":
|
28811 | return ["export = ", print("expression"), semi];
|
28812 | case "TSModuleBlock":
|
28813 | return printBlock(path, options, print);
|
28814 | case "TSInterfaceBody":
|
28815 | case "TSTypeLiteral":
|
28816 | return printObject(path, options, print);
|
28817 | case "TSTypeAliasDeclaration":
|
28818 | return printTypeAlias(path, options, print);
|
28819 | case "TSQualifiedName":
|
28820 | return join(".", [print("left"), print("right")]);
|
28821 | case "TSAbstractMethodDefinition":
|
28822 | case "TSDeclareMethod":
|
28823 | return printClassMethod(path, options, print);
|
28824 | case "TSAbstractAccessorProperty":
|
28825 | case "TSAbstractPropertyDefinition":
|
28826 | return printClassProperty(path, options, print);
|
28827 | case "TSInterfaceHeritage":
|
28828 | case "TSExpressionWithTypeArguments":
|
28829 | parts.push(print("expression"));
|
28830 | if (node.typeParameters) {
|
28831 | parts.push(print("typeParameters"));
|
28832 | }
|
28833 | return parts;
|
28834 | case "TSTemplateLiteralType":
|
28835 | return printTemplateLiteral(path, print, options);
|
28836 | case "TSNamedTupleMember":
|
28837 | return [print("label"), node.optional ? "?" : "", ": ", print("elementType")];
|
28838 | case "TSRestType":
|
28839 | return ["...", print("typeAnnotation")];
|
28840 | case "TSOptionalType":
|
28841 | return [print("typeAnnotation"), "?"];
|
28842 | case "TSInterfaceDeclaration":
|
28843 | return printInterface(path, options, print);
|
28844 | case "TSClassImplements":
|
28845 | return [print("expression"), print("typeParameters")];
|
28846 | case "TSTypeParameterDeclaration":
|
28847 | case "TSTypeParameterInstantiation":
|
28848 | return printTypeParameters(path, options, print, "params");
|
28849 | case "TSTypeParameter":
|
28850 | return printTypeParameter(path, options, print);
|
28851 | case "TSSatisfiesExpression":
|
28852 | case "TSAsExpression": {
|
28853 | const operator = node.type === "TSAsExpression" ? "as" : "satisfies";
|
28854 | parts.push(print("expression"), ` ${operator} `, print("typeAnnotation"));
|
28855 | const parent = path.getParentNode();
|
28856 | if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
|
28857 | return group([indent([softline, ...parts]), softline]);
|
28858 | }
|
28859 | return parts;
|
28860 | }
|
28861 | case "TSArrayType":
|
28862 | return [print("elementType"), "[]"];
|
28863 | case "TSPropertySignature": {
|
28864 | if (node.readonly) {
|
28865 | parts.push("readonly ");
|
28866 | }
|
28867 | parts.push(printPropertyKey(path, options, print), printOptionalToken(path));
|
28868 | if (node.typeAnnotation) {
|
28869 | parts.push(": ", print("typeAnnotation"));
|
28870 | }
|
28871 | if (node.initializer) {
|
28872 | parts.push(" = ", print("initializer"));
|
28873 | }
|
28874 | return parts;
|
28875 | }
|
28876 | case "TSParameterProperty":
|
28877 | if (node.accessibility) {
|
28878 | parts.push(node.accessibility + " ");
|
28879 | }
|
28880 | if (node.export) {
|
28881 | parts.push("export ");
|
28882 | }
|
28883 | if (node.static) {
|
28884 | parts.push("static ");
|
28885 | }
|
28886 | if (node.override) {
|
28887 | parts.push("override ");
|
28888 | }
|
28889 | if (node.readonly) {
|
28890 | parts.push("readonly ");
|
28891 | }
|
28892 | parts.push(print("parameter"));
|
28893 | return parts;
|
28894 | case "TSTypeQuery":
|
28895 | return ["typeof ", print("exprName"), print("typeParameters")];
|
28896 | case "TSIndexSignature": {
|
28897 | const parent = path.getParentNode();
|
28898 | const trailingComma = node.parameters.length > 1 ? ifBreak(shouldPrintComma(options) ? "," : "") : "";
|
28899 | const parametersGroup = group([indent([softline, join([", ", softline], path.map(print, "parameters"))]), trailingComma, softline]);
|
28900 | return [node.export ? "export " : "", node.accessibility ? [node.accessibility, " "] : "", node.static ? "static " : "", node.readonly ? "readonly " : "", node.declare ? "declare " : "", "[", node.parameters ? parametersGroup : "", node.typeAnnotation ? "]: " : "]", node.typeAnnotation ? print("typeAnnotation") : "", parent.type === "ClassBody" ? semi : ""];
|
28901 | }
|
28902 | case "TSTypePredicate":
|
28903 | return [node.asserts ? "asserts " : "", print("parameterName"), node.typeAnnotation ? [" is ", print("typeAnnotation")] : ""];
|
28904 | case "TSNonNullExpression":
|
28905 | return [print("expression"), "!"];
|
28906 | case "TSImportType":
|
28907 | return [!node.isTypeOf ? "" : "typeof ", "import(", print(node.parameter ? "parameter" : "argument"), ")", !node.qualifier ? "" : [".", print("qualifier")], printTypeParameters(path, options, print, "typeParameters")];
|
28908 | case "TSLiteralType":
|
28909 | return print("literal");
|
28910 | case "TSIndexedAccessType":
|
28911 | return printIndexedAccessType(path, options, print);
|
28912 | case "TSConstructSignatureDeclaration":
|
28913 | case "TSCallSignatureDeclaration":
|
28914 | case "TSConstructorType": {
|
28915 | if (node.type === "TSConstructorType" && node.abstract) {
|
28916 | parts.push("abstract ");
|
28917 | }
|
28918 | if (node.type !== "TSCallSignatureDeclaration") {
|
28919 | parts.push("new ");
|
28920 | }
|
28921 | parts.push(group(printFunctionParameters(path, print, options, false, true)));
|
28922 | if (node.returnType || node.typeAnnotation) {
|
28923 | const isType = node.type === "TSConstructorType";
|
28924 | parts.push(isType ? " => " : ": ", print("returnType"), print("typeAnnotation"));
|
28925 | }
|
28926 | return parts;
|
28927 | }
|
28928 | case "TSTypeOperator":
|
28929 | return [node.operator, " ", print("typeAnnotation")];
|
28930 | case "TSMappedType": {
|
28931 | const shouldBreak = hasNewlineInRange(options.originalText, locStart(node), locEnd(node));
|
28932 | return group(["{", indent([options.bracketSpacing ? line : softline, node.readonly ? [getTypeScriptMappedTypeModifier(node.readonly, "readonly"), " "] : "", printTypeScriptModifiers(path, options, print), print("typeParameter"), node.optional ? getTypeScriptMappedTypeModifier(node.optional, "?") : "", node.typeAnnotation ? ": " : "", print("typeAnnotation"), ifBreak(semi)]), printDanglingComments(path, options, true), options.bracketSpacing ? line : softline, "}"], {
|
28933 | shouldBreak
|
28934 | });
|
28935 | }
|
28936 | case "TSMethodSignature": {
|
28937 | const kind = node.kind && node.kind !== "method" ? `${node.kind} ` : "";
|
28938 | parts.push(node.accessibility ? [node.accessibility, " "] : "", kind, node.export ? "export " : "", node.static ? "static " : "", node.readonly ? "readonly " : "", node.abstract ? "abstract " : "", node.declare ? "declare " : "", node.computed ? "[" : "", print("key"), node.computed ? "]" : "", printOptionalToken(path));
|
28939 | const parametersDoc = printFunctionParameters(path, print, options, false, true);
|
28940 | const returnTypePropertyName = node.returnType ? "returnType" : "typeAnnotation";
|
28941 | const returnTypeNode = node[returnTypePropertyName];
|
28942 | const returnTypeDoc = returnTypeNode ? print(returnTypePropertyName) : "";
|
28943 | const shouldGroupParameters = shouldGroupFunctionParameters(node, returnTypeDoc);
|
28944 | parts.push(shouldGroupParameters ? group(parametersDoc) : parametersDoc);
|
28945 | if (returnTypeNode) {
|
28946 | parts.push(": ", group(returnTypeDoc));
|
28947 | }
|
28948 | return group(parts);
|
28949 | }
|
28950 | case "TSNamespaceExportDeclaration":
|
28951 | parts.push("export as namespace ", print("id"));
|
28952 | if (options.semi) {
|
28953 | parts.push(";");
|
28954 | }
|
28955 | return group(parts);
|
28956 | case "TSEnumDeclaration":
|
28957 | if (node.declare) {
|
28958 | parts.push("declare ");
|
28959 | }
|
28960 | if (node.modifiers) {
|
28961 | parts.push(printTypeScriptModifiers(path, options, print));
|
28962 | }
|
28963 | if (node.const) {
|
28964 | parts.push("const ");
|
28965 | }
|
28966 | parts.push("enum ", print("id"), " ");
|
28967 | if (node.members.length === 0) {
|
28968 | parts.push(group(["{", printDanglingComments(path, options), softline, "}"]));
|
28969 | } else {
|
28970 | parts.push(group(["{", indent([hardline, printArrayItems(path, options, "members", print), shouldPrintComma(options, "es5") ? "," : ""]), printDanglingComments(path, options, true), hardline, "}"]));
|
28971 | }
|
28972 | return parts;
|
28973 | case "TSEnumMember":
|
28974 | if (node.computed) {
|
28975 | parts.push("[", print("id"), "]");
|
28976 | } else {
|
28977 | parts.push(print("id"));
|
28978 | }
|
28979 | if (node.initializer) {
|
28980 | parts.push(" = ", print("initializer"));
|
28981 | }
|
28982 | return parts;
|
28983 | case "TSImportEqualsDeclaration":
|
28984 | if (node.isExport) {
|
28985 | parts.push("export ");
|
28986 | }
|
28987 | parts.push("import ");
|
28988 | if (node.importKind && node.importKind !== "value") {
|
28989 | parts.push(node.importKind, " ");
|
28990 | }
|
28991 | parts.push(print("id"), " = ", print("moduleReference"));
|
28992 | if (options.semi) {
|
28993 | parts.push(";");
|
28994 | }
|
28995 | return group(parts);
|
28996 | case "TSExternalModuleReference":
|
28997 | return ["require(", print("expression"), ")"];
|
28998 | case "TSModuleDeclaration": {
|
28999 | const parent = path.getParentNode();
|
29000 | const isExternalModule = isLiteral(node.id);
|
29001 | const parentIsDeclaration = parent.type === "TSModuleDeclaration";
|
29002 | const bodyIsDeclaration = node.body && node.body.type === "TSModuleDeclaration";
|
29003 | if (parentIsDeclaration) {
|
29004 | parts.push(".");
|
29005 | } else {
|
29006 | if (node.declare) {
|
29007 | parts.push("declare ");
|
29008 | }
|
29009 | parts.push(printTypeScriptModifiers(path, options, print));
|
29010 | const textBetweenNodeAndItsId = options.originalText.slice(locStart(node), locStart(node.id));
|
29011 | const isGlobalDeclaration = node.id.type === "Identifier" && node.id.name === "global" && !/namespace|module/.test(textBetweenNodeAndItsId);
|
29012 | if (!isGlobalDeclaration) {
|
29013 | parts.push(isExternalModule || /(?:^|\s)module(?:\s|$)/.test(textBetweenNodeAndItsId) ? "module " : "namespace ");
|
29014 | }
|
29015 | }
|
29016 | parts.push(print("id"));
|
29017 | if (bodyIsDeclaration) {
|
29018 | parts.push(print("body"));
|
29019 | } else if (node.body) {
|
29020 | parts.push(" ", group(print("body")));
|
29021 | } else {
|
29022 | parts.push(semi);
|
29023 | }
|
29024 | return parts;
|
29025 | }
|
29026 | case "TSConditionalType":
|
29027 | return printTernary(path, options, print);
|
29028 | case "TSInferType":
|
29029 | return ["infer", " ", print("typeParameter")];
|
29030 | case "TSIntersectionType":
|
29031 | return printIntersectionType(path, options, print);
|
29032 | case "TSUnionType":
|
29033 | return printUnionType(path, options, print);
|
29034 | case "TSFunctionType":
|
29035 | return printFunctionType(path, options, print);
|
29036 | case "TSTupleType":
|
29037 | return printTupleType(path, options, print);
|
29038 | case "TSTypeReference":
|
29039 | return [print("typeName"), printTypeParameters(path, options, print, "typeParameters")];
|
29040 | case "TSTypeAnnotation":
|
29041 | return print("typeAnnotation");
|
29042 | case "TSEmptyBodyFunctionExpression":
|
29043 | return printMethodInternal(path, options, print);
|
29044 | case "TSJSDocAllType":
|
29045 | return "*";
|
29046 | case "TSJSDocUnknownType":
|
29047 | return "?";
|
29048 | case "TSJSDocNullableType":
|
29049 | return printJSDocType(path, print, "?");
|
29050 | case "TSJSDocNonNullableType":
|
29051 | return printJSDocType(path, print, "!");
|
29052 | case "TSInstantiationExpression":
|
29053 | return [print("expression"), print("typeParameters")];
|
29054 | default:
|
29055 | throw new Error(`Unknown TypeScript node type: ${JSON.stringify(node.type)}.`);
|
29056 | }
|
29057 | }
|
29058 | module2.exports = {
|
29059 | printTypescript
|
29060 | };
|
29061 | }
|
29062 | });
|
29063 | var require_comment = __commonJS2({
|
29064 | "src/language-js/print/comment.js"(exports2, module2) {
|
29065 | "use strict";
|
29066 | var {
|
29067 | hasNewline
|
29068 | } = require_util();
|
29069 | var {
|
29070 | builders: {
|
29071 | join,
|
29072 | hardline
|
29073 | },
|
29074 | utils: {
|
29075 | replaceTextEndOfLine
|
29076 | }
|
29077 | } = require("./doc.js");
|
29078 | var {
|
29079 | isLineComment
|
29080 | } = require_utils7();
|
29081 | var {
|
29082 | locStart,
|
29083 | locEnd
|
29084 | } = require_loc();
|
29085 | var isBlockComment = require_is_block_comment();
|
29086 | function printComment(commentPath, options) {
|
29087 | const comment = commentPath.getValue();
|
29088 | if (isLineComment(comment)) {
|
29089 | return options.originalText.slice(locStart(comment), locEnd(comment)).trimEnd();
|
29090 | }
|
29091 | if (isBlockComment(comment)) {
|
29092 | if (isIndentableBlockComment(comment)) {
|
29093 | const printed = printIndentableBlockComment(comment);
|
29094 | if (comment.trailing && !hasNewline(options.originalText, locStart(comment), {
|
29095 | backwards: true
|
29096 | })) {
|
29097 | return [hardline, printed];
|
29098 | }
|
29099 | return printed;
|
29100 | }
|
29101 | const commentEnd = locEnd(comment);
|
29102 | const isInsideFlowComment = options.originalText.slice(commentEnd - 3, commentEnd) === "*-/";
|
29103 | return ["/*", replaceTextEndOfLine(comment.value), isInsideFlowComment ? "*-/" : "*/"];
|
29104 | }
|
29105 | throw new Error("Not a comment: " + JSON.stringify(comment));
|
29106 | }
|
29107 | function isIndentableBlockComment(comment) {
|
29108 | const lines = `*${comment.value}*`.split("\n");
|
29109 | return lines.length > 1 && lines.every((line) => line.trim()[0] === "*");
|
29110 | }
|
29111 | function printIndentableBlockComment(comment) {
|
29112 | const lines = comment.value.split("\n");
|
29113 | return ["/*", join(hardline, lines.map((line, index) => index === 0 ? line.trimEnd() : " " + (index < lines.length - 1 ? line.trim() : line.trimStart()))), "*/"];
|
29114 | }
|
29115 | module2.exports = {
|
29116 | printComment
|
29117 | };
|
29118 | }
|
29119 | });
|
29120 | var require_literal = __commonJS2({
|
29121 | "src/language-js/print/literal.js"(exports2, module2) {
|
29122 | "use strict";
|
29123 | var {
|
29124 | printString,
|
29125 | printNumber
|
29126 | } = require_util();
|
29127 | var {
|
29128 | replaceTextEndOfLine
|
29129 | } = require_doc_utils();
|
29130 | function printLiteral(path, options) {
|
29131 | const node = path.getNode();
|
29132 | switch (node.type) {
|
29133 | case "RegExpLiteral":
|
29134 | return printRegex(node);
|
29135 | case "BigIntLiteral":
|
29136 | return printBigInt(node.bigint || node.extra.raw);
|
29137 | case "NumericLiteral":
|
29138 | return printNumber(node.extra.raw);
|
29139 | case "StringLiteral":
|
29140 | return replaceTextEndOfLine(printString(node.extra.raw, options));
|
29141 | case "NullLiteral":
|
29142 | return "null";
|
29143 | case "BooleanLiteral":
|
29144 | return String(node.value);
|
29145 | case "DecimalLiteral":
|
29146 | return printNumber(node.value) + "m";
|
29147 | case "Literal": {
|
29148 | if (node.regex) {
|
29149 | return printRegex(node.regex);
|
29150 | }
|
29151 | if (node.bigint) {
|
29152 | return printBigInt(node.raw);
|
29153 | }
|
29154 | if (node.decimal) {
|
29155 | return printNumber(node.decimal) + "m";
|
29156 | }
|
29157 | const {
|
29158 | value
|
29159 | } = node;
|
29160 | if (typeof value === "number") {
|
29161 | return printNumber(node.raw);
|
29162 | }
|
29163 | if (typeof value === "string") {
|
29164 | return replaceTextEndOfLine(printString(node.raw, options));
|
29165 | }
|
29166 | return String(value);
|
29167 | }
|
29168 | }
|
29169 | }
|
29170 | function printBigInt(raw) {
|
29171 | return raw.toLowerCase();
|
29172 | }
|
29173 | function printRegex({
|
29174 | pattern,
|
29175 | flags
|
29176 | }) {
|
29177 | flags = [...flags].sort().join("");
|
29178 | return `/${pattern}/${flags}`;
|
29179 | }
|
29180 | module2.exports = {
|
29181 | printLiteral
|
29182 | };
|
29183 | }
|
29184 | });
|
29185 | var require_printer_estree = __commonJS2({
|
29186 | "src/language-js/printer-estree.js"(exports2, module2) {
|
29187 | "use strict";
|
29188 | var {
|
29189 | printDanglingComments
|
29190 | } = require_comments();
|
29191 | var {
|
29192 | hasNewline
|
29193 | } = require_util();
|
29194 | var {
|
29195 | builders: {
|
29196 | join,
|
29197 | line,
|
29198 | hardline,
|
29199 | softline,
|
29200 | group,
|
29201 | indent
|
29202 | },
|
29203 | utils: {
|
29204 | replaceTextEndOfLine
|
29205 | }
|
29206 | } = require("./doc.js");
|
29207 | var embed = require_embed();
|
29208 | var clean = require_clean();
|
29209 | var {
|
29210 | insertPragma
|
29211 | } = require_pragma();
|
29212 | var handleComments = require_comments2();
|
29213 | var pathNeedsParens = require_needs_parens();
|
29214 | var preprocess = require_print_preprocess();
|
29215 | var {
|
29216 | hasFlowShorthandAnnotationComment,
|
29217 | hasComment,
|
29218 | CommentCheckFlags,
|
29219 | isTheOnlyJsxElementInMarkdown,
|
29220 | isLineComment,
|
29221 | isNextLineEmpty,
|
29222 | needsHardlineAfterDanglingComment,
|
29223 | rawText,
|
29224 | hasIgnoreComment,
|
29225 | isCallExpression,
|
29226 | isMemberExpression,
|
29227 | markerForIfWithoutBlockAndSameLineComment
|
29228 | } = require_utils7();
|
29229 | var {
|
29230 | locStart,
|
29231 | locEnd
|
29232 | } = require_loc();
|
29233 | var isBlockComment = require_is_block_comment();
|
29234 | var {
|
29235 | printHtmlBinding,
|
29236 | isVueEventBindingExpression
|
29237 | } = require_html_binding();
|
29238 | var {
|
29239 | printAngular
|
29240 | } = require_angular();
|
29241 | var {
|
29242 | printJsx,
|
29243 | hasJsxIgnoreComment
|
29244 | } = require_jsx();
|
29245 | var {
|
29246 | printFlow
|
29247 | } = require_flow();
|
29248 | var {
|
29249 | printTypescript
|
29250 | } = require_typescript();
|
29251 | var {
|
29252 | printOptionalToken,
|
29253 | printBindExpressionCallee,
|
29254 | printTypeAnnotation,
|
29255 | adjustClause,
|
29256 | printRestSpread,
|
29257 | printDefiniteToken
|
29258 | } = require_misc();
|
29259 | var {
|
29260 | printImportDeclaration,
|
29261 | printExportDeclaration,
|
29262 | printExportAllDeclaration,
|
29263 | printModuleSpecifier
|
29264 | } = require_module();
|
29265 | var {
|
29266 | printTernary
|
29267 | } = require_ternary();
|
29268 | var {
|
29269 | printTemplateLiteral
|
29270 | } = require_template_literal();
|
29271 | var {
|
29272 | printArray
|
29273 | } = require_array4();
|
29274 | var {
|
29275 | printObject
|
29276 | } = require_object();
|
29277 | var {
|
29278 | printClass,
|
29279 | printClassMethod,
|
29280 | printClassProperty
|
29281 | } = require_class();
|
29282 | var {
|
29283 | printProperty
|
29284 | } = require_property();
|
29285 | var {
|
29286 | printFunction,
|
29287 | printArrowFunction,
|
29288 | printMethod,
|
29289 | printReturnStatement,
|
29290 | printThrowStatement
|
29291 | } = require_function();
|
29292 | var {
|
29293 | printCallExpression
|
29294 | } = require_call_expression();
|
29295 | var {
|
29296 | printVariableDeclarator,
|
29297 | printAssignmentExpression
|
29298 | } = require_assignment();
|
29299 | var {
|
29300 | printBinaryishExpression
|
29301 | } = require_binaryish();
|
29302 | var {
|
29303 | printSwitchCaseConsequent
|
29304 | } = require_statement();
|
29305 | var {
|
29306 | printMemberExpression
|
29307 | } = require_member();
|
29308 | var {
|
29309 | printBlock,
|
29310 | printBlockBody
|
29311 | } = require_block();
|
29312 | var {
|
29313 | printComment
|
29314 | } = require_comment();
|
29315 | var {
|
29316 | printLiteral
|
29317 | } = require_literal();
|
29318 | var {
|
29319 | printDecorators
|
29320 | } = require_decorators();
|
29321 | function genericPrint(path, options, print, args) {
|
29322 | const printed = printPathNoParens(path, options, print, args);
|
29323 | if (!printed) {
|
29324 | return "";
|
29325 | }
|
29326 | const node = path.getValue();
|
29327 | const {
|
29328 | type
|
29329 | } = node;
|
29330 | if (type === "ClassMethod" || type === "ClassPrivateMethod" || type === "ClassProperty" || type === "ClassAccessorProperty" || type === "AccessorProperty" || type === "TSAbstractAccessorProperty" || type === "PropertyDefinition" || type === "TSAbstractPropertyDefinition" || type === "ClassPrivateProperty" || type === "MethodDefinition" || type === "TSAbstractMethodDefinition" || type === "TSDeclareMethod") {
|
29331 | return printed;
|
29332 | }
|
29333 | let parts = [printed];
|
29334 | const printedDecorators = printDecorators(path, options, print);
|
29335 | const isClassExpressionWithDecorators = node.type === "ClassExpression" && printedDecorators;
|
29336 | if (printedDecorators) {
|
29337 | parts = [...printedDecorators, printed];
|
29338 | if (!isClassExpressionWithDecorators) {
|
29339 | return group(parts);
|
29340 | }
|
29341 | }
|
29342 | const needsParens = pathNeedsParens(path, options);
|
29343 | if (!needsParens) {
|
29344 | if (args && args.needsSemi) {
|
29345 | parts.unshift(";");
|
29346 | }
|
29347 | if (parts.length === 1 && parts[0] === printed) {
|
29348 | return printed;
|
29349 | }
|
29350 | return parts;
|
29351 | }
|
29352 | if (isClassExpressionWithDecorators) {
|
29353 | parts = [indent([line, ...parts])];
|
29354 | }
|
29355 | parts.unshift("(");
|
29356 | if (args && args.needsSemi) {
|
29357 | parts.unshift(";");
|
29358 | }
|
29359 | if (hasFlowShorthandAnnotationComment(node)) {
|
29360 | const [comment] = node.trailingComments;
|
29361 | parts.push(" /*", comment.value.trimStart(), "*/");
|
29362 | comment.printed = true;
|
29363 | }
|
29364 | if (isClassExpressionWithDecorators) {
|
29365 | parts.push(line);
|
29366 | }
|
29367 | parts.push(")");
|
29368 | return parts;
|
29369 | }
|
29370 | function printPathNoParens(path, options, print, args) {
|
29371 | const node = path.getValue();
|
29372 | const semi = options.semi ? ";" : "";
|
29373 | if (!node) {
|
29374 | return "";
|
29375 | }
|
29376 | if (typeof node === "string") {
|
29377 | return node;
|
29378 | }
|
29379 | for (const printer of [printLiteral, printHtmlBinding, printAngular, printJsx, printFlow, printTypescript]) {
|
29380 | const printed = printer(path, options, print);
|
29381 | if (typeof printed !== "undefined") {
|
29382 | return printed;
|
29383 | }
|
29384 | }
|
29385 | let parts = [];
|
29386 | switch (node.type) {
|
29387 | case "JsExpressionRoot":
|
29388 | return print("node");
|
29389 | case "JsonRoot":
|
29390 | return [print("node"), hardline];
|
29391 | case "File":
|
29392 | if (node.program && node.program.interpreter) {
|
29393 | parts.push(print(["program", "interpreter"]));
|
29394 | }
|
29395 | parts.push(print("program"));
|
29396 | return parts;
|
29397 | case "Program":
|
29398 | return printBlockBody(path, options, print);
|
29399 | case "EmptyStatement":
|
29400 | return "";
|
29401 | case "ExpressionStatement": {
|
29402 | if (node.directive) {
|
29403 | return [printDirective(node.expression, options), semi];
|
29404 | }
|
29405 | if (options.parser === "__vue_event_binding" || options.parser === "__vue_ts_event_binding") {
|
29406 | const parent = path.getParentNode();
|
29407 | if (parent.type === "Program" && parent.body.length === 1 && parent.body[0] === node) {
|
29408 | return [print("expression"), isVueEventBindingExpression(node.expression) ? ";" : ""];
|
29409 | }
|
29410 | }
|
29411 | const danglingComment = printDanglingComments(path, options, true, ({
|
29412 | marker
|
29413 | }) => marker === markerForIfWithoutBlockAndSameLineComment);
|
29414 | return [print("expression"), isTheOnlyJsxElementInMarkdown(options, path) ? "" : semi, danglingComment ? [" ", danglingComment] : ""];
|
29415 | }
|
29416 | case "ParenthesizedExpression": {
|
29417 | const shouldHug = !hasComment(node.expression) && (node.expression.type === "ObjectExpression" || node.expression.type === "ArrayExpression");
|
29418 | if (shouldHug) {
|
29419 | return ["(", print("expression"), ")"];
|
29420 | }
|
29421 | return group(["(", indent([softline, print("expression")]), softline, ")"]);
|
29422 | }
|
29423 | case "AssignmentExpression":
|
29424 | return printAssignmentExpression(path, options, print);
|
29425 | case "VariableDeclarator":
|
29426 | return printVariableDeclarator(path, options, print);
|
29427 | case "BinaryExpression":
|
29428 | case "LogicalExpression":
|
29429 | return printBinaryishExpression(path, options, print);
|
29430 | case "AssignmentPattern":
|
29431 | return [print("left"), " = ", print("right")];
|
29432 | case "OptionalMemberExpression":
|
29433 | case "MemberExpression": {
|
29434 | return printMemberExpression(path, options, print);
|
29435 | }
|
29436 | case "MetaProperty":
|
29437 | return [print("meta"), ".", print("property")];
|
29438 | case "BindExpression":
|
29439 | if (node.object) {
|
29440 | parts.push(print("object"));
|
29441 | }
|
29442 | parts.push(group(indent([softline, printBindExpressionCallee(path, options, print)])));
|
29443 | return parts;
|
29444 | case "Identifier": {
|
29445 | return [node.name, printOptionalToken(path), printDefiniteToken(path), printTypeAnnotation(path, options, print)];
|
29446 | }
|
29447 | case "V8IntrinsicIdentifier":
|
29448 | return ["%", node.name];
|
29449 | case "SpreadElement":
|
29450 | case "SpreadElementPattern":
|
29451 | case "SpreadProperty":
|
29452 | case "SpreadPropertyPattern":
|
29453 | case "RestElement":
|
29454 | return printRestSpread(path, options, print);
|
29455 | case "FunctionDeclaration":
|
29456 | case "FunctionExpression":
|
29457 | return printFunction(path, print, options, args);
|
29458 | case "ArrowFunctionExpression":
|
29459 | return printArrowFunction(path, options, print, args);
|
29460 | case "YieldExpression":
|
29461 | parts.push("yield");
|
29462 | if (node.delegate) {
|
29463 | parts.push("*");
|
29464 | }
|
29465 | if (node.argument) {
|
29466 | parts.push(" ", print("argument"));
|
29467 | }
|
29468 | return parts;
|
29469 | case "AwaitExpression": {
|
29470 | parts.push("await");
|
29471 | if (node.argument) {
|
29472 | parts.push(" ", print("argument"));
|
29473 | const parent = path.getParentNode();
|
29474 | if (isCallExpression(parent) && parent.callee === node || isMemberExpression(parent) && parent.object === node) {
|
29475 | parts = [indent([softline, ...parts]), softline];
|
29476 | const parentAwaitOrBlock = path.findAncestor((node2) => node2.type === "AwaitExpression" || node2.type === "BlockStatement");
|
29477 | if (!parentAwaitOrBlock || parentAwaitOrBlock.type !== "AwaitExpression") {
|
29478 | return group(parts);
|
29479 | }
|
29480 | }
|
29481 | }
|
29482 | return parts;
|
29483 | }
|
29484 | case "ExportDefaultDeclaration":
|
29485 | case "ExportNamedDeclaration":
|
29486 | return printExportDeclaration(path, options, print);
|
29487 | case "ExportAllDeclaration":
|
29488 | return printExportAllDeclaration(path, options, print);
|
29489 | case "ImportDeclaration":
|
29490 | return printImportDeclaration(path, options, print);
|
29491 | case "ImportSpecifier":
|
29492 | case "ExportSpecifier":
|
29493 | case "ImportNamespaceSpecifier":
|
29494 | case "ExportNamespaceSpecifier":
|
29495 | case "ImportDefaultSpecifier":
|
29496 | case "ExportDefaultSpecifier":
|
29497 | return printModuleSpecifier(path, options, print);
|
29498 | case "ImportAttribute":
|
29499 | return [print("key"), ": ", print("value")];
|
29500 | case "Import":
|
29501 | return "import";
|
29502 | case "BlockStatement":
|
29503 | case "StaticBlock":
|
29504 | case "ClassBody":
|
29505 | return printBlock(path, options, print);
|
29506 | case "ThrowStatement":
|
29507 | return printThrowStatement(path, options, print);
|
29508 | case "ReturnStatement":
|
29509 | return printReturnStatement(path, options, print);
|
29510 | case "NewExpression":
|
29511 | case "ImportExpression":
|
29512 | case "OptionalCallExpression":
|
29513 | case "CallExpression":
|
29514 | return printCallExpression(path, options, print);
|
29515 | case "ObjectExpression":
|
29516 | case "ObjectPattern":
|
29517 | case "RecordExpression":
|
29518 | return printObject(path, options, print);
|
29519 | case "ObjectProperty":
|
29520 | case "Property":
|
29521 | if (node.method || node.kind === "get" || node.kind === "set") {
|
29522 | return printMethod(path, options, print);
|
29523 | }
|
29524 | return printProperty(path, options, print);
|
29525 | case "ObjectMethod":
|
29526 | return printMethod(path, options, print);
|
29527 | case "Decorator":
|
29528 | return ["@", print("expression")];
|
29529 | case "ArrayExpression":
|
29530 | case "ArrayPattern":
|
29531 | case "TupleExpression":
|
29532 | return printArray(path, options, print);
|
29533 | case "SequenceExpression": {
|
29534 | const parent = path.getParentNode(0);
|
29535 | if (parent.type === "ExpressionStatement" || parent.type === "ForStatement") {
|
29536 | const parts2 = [];
|
29537 | path.each((expressionPath, index) => {
|
29538 | if (index === 0) {
|
29539 | parts2.push(print());
|
29540 | } else {
|
29541 | parts2.push(",", indent([line, print()]));
|
29542 | }
|
29543 | }, "expressions");
|
29544 | return group(parts2);
|
29545 | }
|
29546 | return group(join([",", line], path.map(print, "expressions")));
|
29547 | }
|
29548 | case "ThisExpression":
|
29549 | return "this";
|
29550 | case "Super":
|
29551 | return "super";
|
29552 | case "Directive":
|
29553 | return [print("value"), semi];
|
29554 | case "DirectiveLiteral":
|
29555 | return printDirective(node, options);
|
29556 | case "UnaryExpression":
|
29557 | parts.push(node.operator);
|
29558 | if (/[a-z]$/.test(node.operator)) {
|
29559 | parts.push(" ");
|
29560 | }
|
29561 | if (hasComment(node.argument)) {
|
29562 | parts.push(group(["(", indent([softline, print("argument")]), softline, ")"]));
|
29563 | } else {
|
29564 | parts.push(print("argument"));
|
29565 | }
|
29566 | return parts;
|
29567 | case "UpdateExpression":
|
29568 | parts.push(print("argument"), node.operator);
|
29569 | if (node.prefix) {
|
29570 | parts.reverse();
|
29571 | }
|
29572 | return parts;
|
29573 | case "ConditionalExpression":
|
29574 | return printTernary(path, options, print);
|
29575 | case "VariableDeclaration": {
|
29576 | const printed = path.map(print, "declarations");
|
29577 | const parentNode = path.getParentNode();
|
29578 | const isParentForLoop = parentNode.type === "ForStatement" || parentNode.type === "ForInStatement" || parentNode.type === "ForOfStatement";
|
29579 | const hasValue = node.declarations.some((decl) => decl.init);
|
29580 | let firstVariable;
|
29581 | if (printed.length === 1 && !hasComment(node.declarations[0])) {
|
29582 | firstVariable = printed[0];
|
29583 | } else if (printed.length > 0) {
|
29584 | firstVariable = indent(printed[0]);
|
29585 | }
|
29586 | parts = [node.declare ? "declare " : "", node.kind, firstVariable ? [" ", firstVariable] : "", indent(printed.slice(1).map((p) => [",", hasValue && !isParentForLoop ? hardline : line, p]))];
|
29587 | if (!(isParentForLoop && parentNode.body !== node)) {
|
29588 | parts.push(semi);
|
29589 | }
|
29590 | return group(parts);
|
29591 | }
|
29592 | case "WithStatement":
|
29593 | return group(["with (", print("object"), ")", adjustClause(node.body, print("body"))]);
|
29594 | case "IfStatement": {
|
29595 | const con = adjustClause(node.consequent, print("consequent"));
|
29596 | const opening = group(["if (", group([indent([softline, print("test")]), softline]), ")", con]);
|
29597 | parts.push(opening);
|
29598 | if (node.alternate) {
|
29599 | const commentOnOwnLine = hasComment(node.consequent, CommentCheckFlags.Trailing | CommentCheckFlags.Line) || needsHardlineAfterDanglingComment(node);
|
29600 | const elseOnSameLine = node.consequent.type === "BlockStatement" && !commentOnOwnLine;
|
29601 | parts.push(elseOnSameLine ? " " : hardline);
|
29602 | if (hasComment(node, CommentCheckFlags.Dangling)) {
|
29603 | parts.push(printDanglingComments(path, options, true), commentOnOwnLine ? hardline : " ");
|
29604 | }
|
29605 | parts.push("else", group(adjustClause(node.alternate, print("alternate"), node.alternate.type === "IfStatement")));
|
29606 | }
|
29607 | return parts;
|
29608 | }
|
29609 | case "ForStatement": {
|
29610 | const body = adjustClause(node.body, print("body"));
|
29611 | const dangling = printDanglingComments(path, options, true);
|
29612 | const printedComments = dangling ? [dangling, softline] : "";
|
29613 | if (!node.init && !node.test && !node.update) {
|
29614 | return [printedComments, group(["for (;;)", body])];
|
29615 | }
|
29616 | return [printedComments, group(["for (", group([indent([softline, print("init"), ";", line, print("test"), ";", line, print("update")]), softline]), ")", body])];
|
29617 | }
|
29618 | case "WhileStatement":
|
29619 | return group(["while (", group([indent([softline, print("test")]), softline]), ")", adjustClause(node.body, print("body"))]);
|
29620 | case "ForInStatement":
|
29621 | return group(["for (", print("left"), " in ", print("right"), ")", adjustClause(node.body, print("body"))]);
|
29622 | case "ForOfStatement":
|
29623 | return group(["for", node.await ? " await" : "", " (", print("left"), " of ", print("right"), ")", adjustClause(node.body, print("body"))]);
|
29624 | case "DoWhileStatement": {
|
29625 | const clause = adjustClause(node.body, print("body"));
|
29626 | const doBody = group(["do", clause]);
|
29627 | parts = [doBody];
|
29628 | if (node.body.type === "BlockStatement") {
|
29629 | parts.push(" ");
|
29630 | } else {
|
29631 | parts.push(hardline);
|
29632 | }
|
29633 | parts.push("while (", group([indent([softline, print("test")]), softline]), ")", semi);
|
29634 | return parts;
|
29635 | }
|
29636 | case "DoExpression":
|
29637 | return [node.async ? "async " : "", "do ", print("body")];
|
29638 | case "BreakStatement":
|
29639 | parts.push("break");
|
29640 | if (node.label) {
|
29641 | parts.push(" ", print("label"));
|
29642 | }
|
29643 | parts.push(semi);
|
29644 | return parts;
|
29645 | case "ContinueStatement":
|
29646 | parts.push("continue");
|
29647 | if (node.label) {
|
29648 | parts.push(" ", print("label"));
|
29649 | }
|
29650 | parts.push(semi);
|
29651 | return parts;
|
29652 | case "LabeledStatement":
|
29653 | if (node.body.type === "EmptyStatement") {
|
29654 | return [print("label"), ":;"];
|
29655 | }
|
29656 | return [print("label"), ": ", print("body")];
|
29657 | case "TryStatement":
|
29658 | return ["try ", print("block"), node.handler ? [" ", print("handler")] : "", node.finalizer ? [" finally ", print("finalizer")] : ""];
|
29659 | case "CatchClause":
|
29660 | if (node.param) {
|
29661 | const parameterHasComments = hasComment(node.param, (comment) => !isBlockComment(comment) || comment.leading && hasNewline(options.originalText, locEnd(comment)) || comment.trailing && hasNewline(options.originalText, locStart(comment), {
|
29662 | backwards: true
|
29663 | }));
|
29664 | const param = print("param");
|
29665 | return ["catch ", parameterHasComments ? ["(", indent([softline, param]), softline, ") "] : ["(", param, ") "], print("body")];
|
29666 | }
|
29667 | return ["catch ", print("body")];
|
29668 | case "SwitchStatement":
|
29669 | return [group(["switch (", indent([softline, print("discriminant")]), softline, ")"]), " {", node.cases.length > 0 ? indent([hardline, join(hardline, path.map((casePath, index, cases) => {
|
29670 | const caseNode = casePath.getValue();
|
29671 | return [print(), index !== cases.length - 1 && isNextLineEmpty(caseNode, options) ? hardline : ""];
|
29672 | }, "cases"))]) : "", hardline, "}"];
|
29673 | case "SwitchCase": {
|
29674 | if (node.test) {
|
29675 | parts.push("case ", print("test"), ":");
|
29676 | } else {
|
29677 | parts.push("default:");
|
29678 | }
|
29679 | if (hasComment(node, CommentCheckFlags.Dangling)) {
|
29680 | parts.push(" ", printDanglingComments(path, options, true));
|
29681 | }
|
29682 | const consequent = node.consequent.filter((node2) => node2.type !== "EmptyStatement");
|
29683 | if (consequent.length > 0) {
|
29684 | const cons = printSwitchCaseConsequent(path, options, print);
|
29685 | parts.push(consequent.length === 1 && consequent[0].type === "BlockStatement" ? [" ", cons] : indent([hardline, cons]));
|
29686 | }
|
29687 | return parts;
|
29688 | }
|
29689 | case "DebuggerStatement":
|
29690 | return ["debugger", semi];
|
29691 | case "ClassDeclaration":
|
29692 | case "ClassExpression":
|
29693 | return printClass(path, options, print);
|
29694 | case "ClassMethod":
|
29695 | case "ClassPrivateMethod":
|
29696 | case "MethodDefinition":
|
29697 | return printClassMethod(path, options, print);
|
29698 | case "ClassProperty":
|
29699 | case "PropertyDefinition":
|
29700 | case "ClassPrivateProperty":
|
29701 | case "ClassAccessorProperty":
|
29702 | case "AccessorProperty":
|
29703 | return printClassProperty(path, options, print);
|
29704 | case "TemplateElement":
|
29705 | return replaceTextEndOfLine(node.value.raw);
|
29706 | case "TemplateLiteral":
|
29707 | return printTemplateLiteral(path, print, options);
|
29708 | case "TaggedTemplateExpression":
|
29709 | return [print("tag"), print("typeParameters"), print("quasi")];
|
29710 | case "PrivateIdentifier":
|
29711 | return ["#", print("name")];
|
29712 | case "PrivateName":
|
29713 | return ["#", print("id")];
|
29714 | case "InterpreterDirective":
|
29715 | parts.push("#!", node.value, hardline);
|
29716 | if (isNextLineEmpty(node, options)) {
|
29717 | parts.push(hardline);
|
29718 | }
|
29719 | return parts;
|
29720 | case "TopicReference":
|
29721 | return "%";
|
29722 | case "ArgumentPlaceholder":
|
29723 | return "?";
|
29724 | case "ModuleExpression": {
|
29725 | parts.push("module {");
|
29726 | const printed = print("body");
|
29727 | if (printed) {
|
29728 | parts.push(indent([hardline, printed]), hardline);
|
29729 | }
|
29730 | parts.push("}");
|
29731 | return parts;
|
29732 | }
|
29733 | default:
|
29734 | throw new Error("unknown type: " + JSON.stringify(node.type));
|
29735 | }
|
29736 | }
|
29737 | function printDirective(node, options) {
|
29738 | const raw = rawText(node);
|
29739 | const rawContent = raw.slice(1, -1);
|
29740 | if (rawContent.includes('"') || rawContent.includes("'")) {
|
29741 | return raw;
|
29742 | }
|
29743 | const enclosingQuote = options.singleQuote ? "'" : '"';
|
29744 | return enclosingQuote + rawContent + enclosingQuote;
|
29745 | }
|
29746 | function canAttachComment(node) {
|
29747 | return node.type && !isBlockComment(node) && !isLineComment(node) && node.type !== "EmptyStatement" && node.type !== "TemplateElement" && node.type !== "Import" && node.type !== "TSEmptyBodyFunctionExpression";
|
29748 | }
|
29749 | module2.exports = {
|
29750 | preprocess,
|
29751 | print: genericPrint,
|
29752 | embed,
|
29753 | insertPragma,
|
29754 | massageAstNode: clean,
|
29755 | hasPrettierIgnore(path) {
|
29756 | return hasIgnoreComment(path) || hasJsxIgnoreComment(path);
|
29757 | },
|
29758 | willPrintOwnComments: handleComments.willPrintOwnComments,
|
29759 | canAttachComment,
|
29760 | printComment,
|
29761 | isBlockComment,
|
29762 | handleComments: {
|
29763 | avoidAstMutation: true,
|
29764 | ownLine: handleComments.handleOwnLineComment,
|
29765 | endOfLine: handleComments.handleEndOfLineComment,
|
29766 | remaining: handleComments.handleRemainingComment
|
29767 | },
|
29768 | getCommentChildNodes: handleComments.getCommentChildNodes
|
29769 | };
|
29770 | }
|
29771 | });
|
29772 | var require_printer_estree_json = __commonJS2({
|
29773 | "src/language-js/printer-estree-json.js"(exports2, module2) {
|
29774 | "use strict";
|
29775 | var {
|
29776 | builders: {
|
29777 | hardline,
|
29778 | indent,
|
29779 | join
|
29780 | }
|
29781 | } = require("./doc.js");
|
29782 | var preprocess = require_print_preprocess();
|
29783 | function genericPrint(path, options, print) {
|
29784 | const node = path.getValue();
|
29785 | switch (node.type) {
|
29786 | case "JsonRoot":
|
29787 | return [print("node"), hardline];
|
29788 | case "ArrayExpression": {
|
29789 | if (node.elements.length === 0) {
|
29790 | return "[]";
|
29791 | }
|
29792 | const printed = path.map(() => path.getValue() === null ? "null" : print(), "elements");
|
29793 | return ["[", indent([hardline, join([",", hardline], printed)]), hardline, "]"];
|
29794 | }
|
29795 | case "ObjectExpression":
|
29796 | return node.properties.length === 0 ? "{}" : ["{", indent([hardline, join([",", hardline], path.map(print, "properties"))]), hardline, "}"];
|
29797 | case "ObjectProperty":
|
29798 | return [print("key"), ": ", print("value")];
|
29799 | case "UnaryExpression":
|
29800 | return [node.operator === "+" ? "" : node.operator, print("argument")];
|
29801 | case "NullLiteral":
|
29802 | return "null";
|
29803 | case "BooleanLiteral":
|
29804 | return node.value ? "true" : "false";
|
29805 | case "StringLiteral":
|
29806 | case "NumericLiteral":
|
29807 | return JSON.stringify(node.value);
|
29808 | case "Identifier": {
|
29809 | const parent = path.getParentNode();
|
29810 | if (parent && parent.type === "ObjectProperty" && parent.key === node) {
|
29811 | return JSON.stringify(node.name);
|
29812 | }
|
29813 | return node.name;
|
29814 | }
|
29815 | case "TemplateLiteral":
|
29816 | return print(["quasis", 0]);
|
29817 | case "TemplateElement":
|
29818 | return JSON.stringify(node.value.cooked);
|
29819 | default:
|
29820 | throw new Error("unknown type: " + JSON.stringify(node.type));
|
29821 | }
|
29822 | }
|
29823 | var ignoredProperties = new Set(["start", "end", "extra", "loc", "comments", "leadingComments", "trailingComments", "innerComments", "errors", "range", "tokens"]);
|
29824 | function clean(node, newNode) {
|
29825 | const {
|
29826 | type
|
29827 | } = node;
|
29828 | if (type === "ObjectProperty" && node.key.type === "Identifier") {
|
29829 | newNode.key = {
|
29830 | type: "StringLiteral",
|
29831 | value: node.key.name
|
29832 | };
|
29833 | return;
|
29834 | }
|
29835 | if (type === "UnaryExpression" && node.operator === "+") {
|
29836 | return newNode.argument;
|
29837 | }
|
29838 | if (type === "ArrayExpression") {
|
29839 | for (const [index, element] of node.elements.entries()) {
|
29840 | if (element === null) {
|
29841 | newNode.elements.splice(index, 0, {
|
29842 | type: "NullLiteral"
|
29843 | });
|
29844 | }
|
29845 | }
|
29846 | return;
|
29847 | }
|
29848 | if (type === "TemplateLiteral") {
|
29849 | return {
|
29850 | type: "StringLiteral",
|
29851 | value: node.quasis[0].value.cooked
|
29852 | };
|
29853 | }
|
29854 | }
|
29855 | clean.ignoredProperties = ignoredProperties;
|
29856 | module2.exports = {
|
29857 | preprocess,
|
29858 | print: genericPrint,
|
29859 | massageAstNode: clean
|
29860 | };
|
29861 | }
|
29862 | });
|
29863 | var require_common_options = __commonJS2({
|
29864 | "src/common/common-options.js"(exports2, module2) {
|
29865 | "use strict";
|
29866 | var CATEGORY_COMMON = "Common";
|
29867 | module2.exports = {
|
29868 | bracketSpacing: {
|
29869 | since: "0.0.0",
|
29870 | category: CATEGORY_COMMON,
|
29871 | type: "boolean",
|
29872 | default: true,
|
29873 | description: "Print spaces between brackets.",
|
29874 | oppositeDescription: "Do not print spaces between brackets."
|
29875 | },
|
29876 | singleQuote: {
|
29877 | since: "0.0.0",
|
29878 | category: CATEGORY_COMMON,
|
29879 | type: "boolean",
|
29880 | default: false,
|
29881 | description: "Use single quotes instead of double quotes."
|
29882 | },
|
29883 | proseWrap: {
|
29884 | since: "1.8.2",
|
29885 | category: CATEGORY_COMMON,
|
29886 | type: "choice",
|
29887 | default: [{
|
29888 | since: "1.8.2",
|
29889 | value: true
|
29890 | }, {
|
29891 | since: "1.9.0",
|
29892 | value: "preserve"
|
29893 | }],
|
29894 | description: "How to wrap prose.",
|
29895 | choices: [{
|
29896 | since: "1.9.0",
|
29897 | value: "always",
|
29898 | description: "Wrap prose if it exceeds the print width."
|
29899 | }, {
|
29900 | since: "1.9.0",
|
29901 | value: "never",
|
29902 | description: "Do not wrap prose."
|
29903 | }, {
|
29904 | since: "1.9.0",
|
29905 | value: "preserve",
|
29906 | description: "Wrap prose as-is."
|
29907 | }]
|
29908 | },
|
29909 | bracketSameLine: {
|
29910 | since: "2.4.0",
|
29911 | category: CATEGORY_COMMON,
|
29912 | type: "boolean",
|
29913 | default: false,
|
29914 | description: "Put > of opening tags on the last line instead of on a new line."
|
29915 | },
|
29916 | singleAttributePerLine: {
|
29917 | since: "2.6.0",
|
29918 | category: CATEGORY_COMMON,
|
29919 | type: "boolean",
|
29920 | default: false,
|
29921 | description: "Enforce single attribute per line in HTML, Vue and JSX."
|
29922 | }
|
29923 | };
|
29924 | }
|
29925 | });
|
29926 | var require_options2 = __commonJS2({
|
29927 | "src/language-js/options.js"(exports2, module2) {
|
29928 | "use strict";
|
29929 | var commonOptions = require_common_options();
|
29930 | var CATEGORY_JAVASCRIPT = "JavaScript";
|
29931 | module2.exports = {
|
29932 | arrowParens: {
|
29933 | since: "1.9.0",
|
29934 | category: CATEGORY_JAVASCRIPT,
|
29935 | type: "choice",
|
29936 | default: [{
|
29937 | since: "1.9.0",
|
29938 | value: "avoid"
|
29939 | }, {
|
29940 | since: "2.0.0",
|
29941 | value: "always"
|
29942 | }],
|
29943 | description: "Include parentheses around a sole arrow function parameter.",
|
29944 | choices: [{
|
29945 | value: "always",
|
29946 | description: "Always include parens. Example: `(x) => x`"
|
29947 | }, {
|
29948 | value: "avoid",
|
29949 | description: "Omit parens when possible. Example: `x => x`"
|
29950 | }]
|
29951 | },
|
29952 | bracketSameLine: commonOptions.bracketSameLine,
|
29953 | bracketSpacing: commonOptions.bracketSpacing,
|
29954 | jsxBracketSameLine: {
|
29955 | since: "0.17.0",
|
29956 | category: CATEGORY_JAVASCRIPT,
|
29957 | type: "boolean",
|
29958 | description: "Put > on the last line instead of at a new line.",
|
29959 | deprecated: "2.4.0"
|
29960 | },
|
29961 | semi: {
|
29962 | since: "1.0.0",
|
29963 | category: CATEGORY_JAVASCRIPT,
|
29964 | type: "boolean",
|
29965 | default: true,
|
29966 | description: "Print semicolons.",
|
29967 | oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
|
29968 | },
|
29969 | singleQuote: commonOptions.singleQuote,
|
29970 | jsxSingleQuote: {
|
29971 | since: "1.15.0",
|
29972 | category: CATEGORY_JAVASCRIPT,
|
29973 | type: "boolean",
|
29974 | default: false,
|
29975 | description: "Use single quotes in JSX."
|
29976 | },
|
29977 | quoteProps: {
|
29978 | since: "1.17.0",
|
29979 | category: CATEGORY_JAVASCRIPT,
|
29980 | type: "choice",
|
29981 | default: "as-needed",
|
29982 | description: "Change when properties in objects are quoted.",
|
29983 | choices: [{
|
29984 | value: "as-needed",
|
29985 | description: "Only add quotes around object properties where required."
|
29986 | }, {
|
29987 | value: "consistent",
|
29988 | description: "If at least one property in an object requires quotes, quote all properties."
|
29989 | }, {
|
29990 | value: "preserve",
|
29991 | description: "Respect the input use of quotes in object properties."
|
29992 | }]
|
29993 | },
|
29994 | trailingComma: {
|
29995 | since: "0.0.0",
|
29996 | category: CATEGORY_JAVASCRIPT,
|
29997 | type: "choice",
|
29998 | default: [{
|
29999 | since: "0.0.0",
|
30000 | value: false
|
30001 | }, {
|
30002 | since: "0.19.0",
|
30003 | value: "none"
|
30004 | }, {
|
30005 | since: "2.0.0",
|
30006 | value: "es5"
|
30007 | }],
|
30008 | description: "Print trailing commas wherever possible when multi-line.",
|
30009 | choices: [{
|
30010 | value: "es5",
|
30011 | description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
|
30012 | }, {
|
30013 | value: "none",
|
30014 | description: "No trailing commas."
|
30015 | }, {
|
30016 | value: "all",
|
30017 | description: "Trailing commas wherever possible (including function arguments)."
|
30018 | }]
|
30019 | },
|
30020 | singleAttributePerLine: commonOptions.singleAttributePerLine
|
30021 | };
|
30022 | }
|
30023 | });
|
30024 | var require_parsers = __commonJS2({
|
30025 | "src/language-js/parse/parsers.js"(exports2, module2) {
|
30026 | "use strict";
|
30027 | module2.exports = {
|
30028 | get babel() {
|
30029 | return require("./parser-babel.js").parsers.babel;
|
30030 | },
|
30031 | get "babel-flow"() {
|
30032 | return require("./parser-babel.js").parsers["babel-flow"];
|
30033 | },
|
30034 | get "babel-ts"() {
|
30035 | return require("./parser-babel.js").parsers["babel-ts"];
|
30036 | },
|
30037 | get json() {
|
30038 | return require("./parser-babel.js").parsers.json;
|
30039 | },
|
30040 | get json5() {
|
30041 | return require("./parser-babel.js").parsers.json5;
|
30042 | },
|
30043 | get "json-stringify"() {
|
30044 | return require("./parser-babel.js").parsers["json-stringify"];
|
30045 | },
|
30046 | get __js_expression() {
|
30047 | return require("./parser-babel.js").parsers.__js_expression;
|
30048 | },
|
30049 | get __vue_expression() {
|
30050 | return require("./parser-babel.js").parsers.__vue_expression;
|
30051 | },
|
30052 | get __vue_ts_expression() {
|
30053 | return require("./parser-babel.js").parsers.__vue_ts_expression;
|
30054 | },
|
30055 | get __vue_event_binding() {
|
30056 | return require("./parser-babel.js").parsers.__vue_event_binding;
|
30057 | },
|
30058 | get __vue_ts_event_binding() {
|
30059 | return require("./parser-babel.js").parsers.__vue_ts_event_binding;
|
30060 | },
|
30061 | get flow() {
|
30062 | return require("./parser-flow.js").parsers.flow;
|
30063 | },
|
30064 | get typescript() {
|
30065 | return require("./parser-typescript.js").parsers.typescript;
|
30066 | },
|
30067 | get __ng_action() {
|
30068 | return require("./parser-angular.js").parsers.__ng_action;
|
30069 | },
|
30070 | get __ng_binding() {
|
30071 | return require("./parser-angular.js").parsers.__ng_binding;
|
30072 | },
|
30073 | get __ng_interpolation() {
|
30074 | return require("./parser-angular.js").parsers.__ng_interpolation;
|
30075 | },
|
30076 | get __ng_directive() {
|
30077 | return require("./parser-angular.js").parsers.__ng_directive;
|
30078 | },
|
30079 | get acorn() {
|
30080 | return require("./parser-espree.js").parsers.acorn;
|
30081 | },
|
30082 | get espree() {
|
30083 | return require("./parser-espree.js").parsers.espree;
|
30084 | },
|
30085 | get meriyah() {
|
30086 | return require("./parser-meriyah.js").parsers.meriyah;
|
30087 | },
|
30088 | get __babel_estree() {
|
30089 | return require("./parser-babel.js").parsers.__babel_estree;
|
30090 | }
|
30091 | };
|
30092 | }
|
30093 | });
|
30094 | var require_JavaScript = __commonJS2({
|
30095 | "node_modules/linguist-languages/data/JavaScript.json"(exports2, module2) {
|
30096 | module2.exports = {
|
30097 | name: "JavaScript",
|
30098 | type: "programming",
|
30099 | tmScope: "source.js",
|
30100 | aceMode: "javascript",
|
30101 | codemirrorMode: "javascript",
|
30102 | codemirrorMimeType: "text/javascript",
|
30103 | color: "#f1e05a",
|
30104 | aliases: ["js", "node"],
|
30105 | extensions: [".js", "._js", ".bones", ".cjs", ".es", ".es6", ".frag", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".jsx", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"],
|
30106 | filenames: ["Jakefile"],
|
30107 | interpreters: ["chakra", "d8", "gjs", "js", "node", "nodejs", "qjs", "rhino", "v8", "v8-shell"],
|
30108 | languageId: 183
|
30109 | };
|
30110 | }
|
30111 | });
|
30112 | var require_TypeScript = __commonJS2({
|
30113 | "node_modules/linguist-languages/data/TypeScript.json"(exports2, module2) {
|
30114 | module2.exports = {
|
30115 | name: "TypeScript",
|
30116 | type: "programming",
|
30117 | color: "#3178c6",
|
30118 | aliases: ["ts"],
|
30119 | interpreters: ["deno", "ts-node"],
|
30120 | extensions: [".ts", ".cts", ".mts"],
|
30121 | tmScope: "source.ts",
|
30122 | aceMode: "typescript",
|
30123 | codemirrorMode: "javascript",
|
30124 | codemirrorMimeType: "application/typescript",
|
30125 | languageId: 378
|
30126 | };
|
30127 | }
|
30128 | });
|
30129 | var require_TSX = __commonJS2({
|
30130 | "node_modules/linguist-languages/data/TSX.json"(exports2, module2) {
|
30131 | module2.exports = {
|
30132 | name: "TSX",
|
30133 | type: "programming",
|
30134 | color: "#3178c6",
|
30135 | group: "TypeScript",
|
30136 | extensions: [".tsx"],
|
30137 | tmScope: "source.tsx",
|
30138 | aceMode: "javascript",
|
30139 | codemirrorMode: "jsx",
|
30140 | codemirrorMimeType: "text/jsx",
|
30141 | languageId: 94901924
|
30142 | };
|
30143 | }
|
30144 | });
|
30145 | var require_JSON = __commonJS2({
|
30146 | "node_modules/linguist-languages/data/JSON.json"(exports2, module2) {
|
30147 | module2.exports = {
|
30148 | name: "JSON",
|
30149 | type: "data",
|
30150 | color: "#292929",
|
30151 | tmScope: "source.json",
|
30152 | aceMode: "json",
|
30153 | codemirrorMode: "javascript",
|
30154 | codemirrorMimeType: "application/json",
|
30155 | aliases: ["geojson", "jsonl", "topojson"],
|
30156 | extensions: [".json", ".4DForm", ".4DProject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".JSON-tmLanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"],
|
30157 | filenames: [".arcconfig", ".auto-changelog", ".c8rc", ".htmlhintrc", ".imgbotconfig", ".nycrc", ".tern-config", ".tern-project", ".watchmanconfig", "Pipfile.lock", "composer.lock", "mcmod.info"],
|
30158 | languageId: 174
|
30159 | };
|
30160 | }
|
30161 | });
|
30162 | var require_JSON_with_Comments = __commonJS2({
|
30163 | "node_modules/linguist-languages/data/JSON with Comments.json"(exports2, module2) {
|
30164 | module2.exports = {
|
30165 | name: "JSON with Comments",
|
30166 | type: "data",
|
30167 | color: "#292929",
|
30168 | group: "JSON",
|
30169 | tmScope: "source.js",
|
30170 | aceMode: "javascript",
|
30171 | codemirrorMode: "javascript",
|
30172 | codemirrorMimeType: "text/javascript",
|
30173 | aliases: ["jsonc"],
|
30174 | extensions: [".jsonc", ".code-snippets", ".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"],
|
30175 | filenames: [".babelrc", ".devcontainer.json", ".eslintrc.json", ".jscsrc", ".jshintrc", ".jslintrc", "api-extractor.json", "devcontainer.json", "jsconfig.json", "language-configuration.json", "tsconfig.json", "tslint.json"],
|
30176 | languageId: 423
|
30177 | };
|
30178 | }
|
30179 | });
|
30180 | var require_JSON5 = __commonJS2({
|
30181 | "node_modules/linguist-languages/data/JSON5.json"(exports2, module2) {
|
30182 | module2.exports = {
|
30183 | name: "JSON5",
|
30184 | type: "data",
|
30185 | color: "#267CB9",
|
30186 | extensions: [".json5"],
|
30187 | tmScope: "source.js",
|
30188 | aceMode: "javascript",
|
30189 | codemirrorMode: "javascript",
|
30190 | codemirrorMimeType: "application/json",
|
30191 | languageId: 175
|
30192 | };
|
30193 | }
|
30194 | });
|
30195 | var require_language_js = __commonJS2({
|
30196 | "src/language-js/index.js"(exports2, module2) {
|
30197 | "use strict";
|
30198 | var createLanguage = require_create_language();
|
30199 | var estreePrinter = require_printer_estree();
|
30200 | var estreeJsonPrinter = require_printer_estree_json();
|
30201 | var options = require_options2();
|
30202 | var parsers = require_parsers();
|
30203 | var languages = [createLanguage(require_JavaScript(), (data) => ({
|
30204 | since: "0.0.0",
|
30205 | parsers: ["babel", "acorn", "espree", "meriyah", "babel-flow", "babel-ts", "flow", "typescript"],
|
30206 | vscodeLanguageIds: ["javascript", "mongo"],
|
30207 | interpreters: [...data.interpreters, "zx"],
|
30208 | extensions: [...data.extensions.filter((extension) => extension !== ".jsx"), ".wxs"]
|
30209 | })), createLanguage(require_JavaScript(), () => ({
|
30210 | name: "Flow",
|
30211 | since: "0.0.0",
|
30212 | parsers: ["flow", "babel-flow"],
|
30213 | vscodeLanguageIds: ["javascript"],
|
30214 | aliases: [],
|
30215 | filenames: [],
|
30216 | extensions: [".js.flow"]
|
30217 | })), createLanguage(require_JavaScript(), () => ({
|
30218 | name: "JSX",
|
30219 | since: "0.0.0",
|
30220 | parsers: ["babel", "babel-flow", "babel-ts", "flow", "typescript", "espree", "meriyah"],
|
30221 | vscodeLanguageIds: ["javascriptreact"],
|
30222 | aliases: void 0,
|
30223 | filenames: void 0,
|
30224 | extensions: [".jsx"],
|
30225 | group: "JavaScript",
|
30226 | interpreters: void 0,
|
30227 | tmScope: "source.js.jsx",
|
30228 | aceMode: "javascript",
|
30229 | codemirrorMode: "jsx",
|
30230 | codemirrorMimeType: "text/jsx",
|
30231 | color: void 0
|
30232 | })), createLanguage(require_TypeScript(), () => ({
|
30233 | since: "1.4.0",
|
30234 | parsers: ["typescript", "babel-ts"],
|
30235 | vscodeLanguageIds: ["typescript"]
|
30236 | })), createLanguage(require_TSX(), () => ({
|
30237 | since: "1.4.0",
|
30238 | parsers: ["typescript", "babel-ts"],
|
30239 | vscodeLanguageIds: ["typescriptreact"]
|
30240 | })), createLanguage(require_JSON(), () => ({
|
30241 | name: "JSON.stringify",
|
30242 | since: "1.13.0",
|
30243 | parsers: ["json-stringify"],
|
30244 | vscodeLanguageIds: ["json"],
|
30245 | extensions: [".importmap"],
|
30246 | filenames: ["package.json", "package-lock.json", "composer.json"]
|
30247 | })), createLanguage(require_JSON(), (data) => ({
|
30248 | since: "1.5.0",
|
30249 | parsers: ["json"],
|
30250 | vscodeLanguageIds: ["json"],
|
30251 | extensions: data.extensions.filter((extension) => extension !== ".jsonl")
|
30252 | })), createLanguage(require_JSON_with_Comments(), (data) => ({
|
30253 | since: "1.5.0",
|
30254 | parsers: ["json"],
|
30255 | vscodeLanguageIds: ["jsonc"],
|
30256 | filenames: [...data.filenames, ".eslintrc", ".swcrc"]
|
30257 | })), createLanguage(require_JSON5(), () => ({
|
30258 | since: "1.13.0",
|
30259 | parsers: ["json5"],
|
30260 | vscodeLanguageIds: ["json5"]
|
30261 | }))];
|
30262 | var printers = {
|
30263 | estree: estreePrinter,
|
30264 | "estree-json": estreeJsonPrinter
|
30265 | };
|
30266 | module2.exports = {
|
30267 | languages,
|
30268 | options,
|
30269 | printers,
|
30270 | parsers
|
30271 | };
|
30272 | }
|
30273 | });
|
30274 | var require_clean2 = __commonJS2({
|
30275 | "src/language-css/clean.js"(exports2, module2) {
|
30276 | "use strict";
|
30277 | var {
|
30278 | isFrontMatterNode
|
30279 | } = require_util();
|
30280 | var getLast = require_get_last();
|
30281 | var ignoredProperties = new Set(["raw", "raws", "sourceIndex", "source", "before", "after", "trailingComma"]);
|
30282 | function clean(ast, newObj, parent) {
|
30283 | if (isFrontMatterNode(ast) && ast.lang === "yaml") {
|
30284 | delete newObj.value;
|
30285 | }
|
30286 | if (ast.type === "css-comment" && parent.type === "css-root" && parent.nodes.length > 0) {
|
30287 | if (parent.nodes[0] === ast || isFrontMatterNode(parent.nodes[0]) && parent.nodes[1] === ast) {
|
30288 | delete newObj.text;
|
30289 | if (/^\*\s*@(?:format|prettier)\s*$/.test(ast.text)) {
|
30290 | return null;
|
30291 | }
|
30292 | }
|
30293 | if (parent.type === "css-root" && getLast(parent.nodes) === ast) {
|
30294 | return null;
|
30295 | }
|
30296 | }
|
30297 | if (ast.type === "value-root") {
|
30298 | delete newObj.text;
|
30299 | }
|
30300 | if (ast.type === "media-query" || ast.type === "media-query-list" || ast.type === "media-feature-expression") {
|
30301 | delete newObj.value;
|
30302 | }
|
30303 | if (ast.type === "css-rule") {
|
30304 | delete newObj.params;
|
30305 | }
|
30306 | if (ast.type === "selector-combinator") {
|
30307 | newObj.value = newObj.value.replace(/\s+/g, " ");
|
30308 | }
|
30309 | if (ast.type === "media-feature") {
|
30310 | newObj.value = newObj.value.replace(/ /g, "");
|
30311 | }
|
30312 | if (ast.type === "value-word" && (ast.isColor && ast.isHex || ["initial", "inherit", "unset", "revert"].includes(newObj.value.replace().toLowerCase())) || ast.type === "media-feature" || ast.type === "selector-root-invalid" || ast.type === "selector-pseudo") {
|
30313 | newObj.value = newObj.value.toLowerCase();
|
30314 | }
|
30315 | if (ast.type === "css-decl") {
|
30316 | newObj.prop = newObj.prop.toLowerCase();
|
30317 | }
|
30318 | if (ast.type === "css-atrule" || ast.type === "css-import") {
|
30319 | newObj.name = newObj.name.toLowerCase();
|
30320 | }
|
30321 | if (ast.type === "value-number") {
|
30322 | newObj.unit = newObj.unit.toLowerCase();
|
30323 | }
|
30324 | if ((ast.type === "media-feature" || ast.type === "media-keyword" || ast.type === "media-type" || ast.type === "media-unknown" || ast.type === "media-url" || ast.type === "media-value" || ast.type === "selector-attribute" || ast.type === "selector-string" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "value-string") && newObj.value) {
|
30325 | newObj.value = cleanCSSStrings(newObj.value);
|
30326 | }
|
30327 | if (ast.type === "selector-attribute") {
|
30328 | newObj.attribute = newObj.attribute.trim();
|
30329 | if (newObj.namespace) {
|
30330 | if (typeof newObj.namespace === "string") {
|
30331 | newObj.namespace = newObj.namespace.trim();
|
30332 | if (newObj.namespace.length === 0) {
|
30333 | newObj.namespace = true;
|
30334 | }
|
30335 | }
|
30336 | }
|
30337 | if (newObj.value) {
|
30338 | newObj.value = newObj.value.trim().replace(/^["']|["']$/g, "");
|
30339 | delete newObj.quoted;
|
30340 | }
|
30341 | }
|
30342 | if ((ast.type === "media-value" || ast.type === "media-type" || ast.type === "value-number" || ast.type === "selector-root-invalid" || ast.type === "selector-class" || ast.type === "selector-combinator" || ast.type === "selector-tag") && newObj.value) {
|
30343 | newObj.value = newObj.value.replace(/([\d+.Ee-]+)([A-Za-z]*)/g, (match, numStr, unit) => {
|
30344 | const num = Number(numStr);
|
30345 | return Number.isNaN(num) ? match : num + unit.toLowerCase();
|
30346 | });
|
30347 | }
|
30348 | if (ast.type === "selector-tag") {
|
30349 | const lowercasedValue = ast.value.toLowerCase();
|
30350 | if (["from", "to"].includes(lowercasedValue)) {
|
30351 | newObj.value = lowercasedValue;
|
30352 | }
|
30353 | }
|
30354 | if (ast.type === "css-atrule" && ast.name.toLowerCase() === "supports") {
|
30355 | delete newObj.value;
|
30356 | }
|
30357 | if (ast.type === "selector-unknown") {
|
30358 | delete newObj.value;
|
30359 | }
|
30360 | if (ast.type === "value-comma_group") {
|
30361 | const index = ast.groups.findIndex((node) => node.type === "value-number" && node.unit === "...");
|
30362 | if (index !== -1) {
|
30363 | newObj.groups[index].unit = "";
|
30364 | newObj.groups.splice(index + 1, 0, {
|
30365 | type: "value-word",
|
30366 | value: "...",
|
30367 | isColor: false,
|
30368 | isHex: false
|
30369 | });
|
30370 | }
|
30371 | }
|
30372 | }
|
30373 | clean.ignoredProperties = ignoredProperties;
|
30374 | function cleanCSSStrings(value) {
|
30375 | return value.replace(/'/g, '"').replace(/\\([^\dA-Fa-f])/g, "$1");
|
30376 | }
|
30377 | module2.exports = clean;
|
30378 | }
|
30379 | });
|
30380 | var require_print = __commonJS2({
|
30381 | "src/utils/front-matter/print.js"(exports2, module2) {
|
30382 | "use strict";
|
30383 | var {
|
30384 | builders: {
|
30385 | hardline,
|
30386 | markAsRoot
|
30387 | }
|
30388 | } = require("./doc.js");
|
30389 | function print(node, textToDoc) {
|
30390 | if (node.lang === "yaml") {
|
30391 | const value = node.value.trim();
|
30392 | const doc2 = value ? textToDoc(value, {
|
30393 | parser: "yaml"
|
30394 | }, {
|
30395 | stripTrailingHardline: true
|
30396 | }) : "";
|
30397 | return markAsRoot([node.startDelimiter, hardline, doc2, doc2 ? hardline : "", node.endDelimiter]);
|
30398 | }
|
30399 | }
|
30400 | module2.exports = print;
|
30401 | }
|
30402 | });
|
30403 | var require_embed2 = __commonJS2({
|
30404 | "src/language-css/embed.js"(exports2, module2) {
|
30405 | "use strict";
|
30406 | var {
|
30407 | builders: {
|
30408 | hardline
|
30409 | }
|
30410 | } = require("./doc.js");
|
30411 | var printFrontMatter = require_print();
|
30412 | function embed(path, print, textToDoc) {
|
30413 | const node = path.getValue();
|
30414 | if (node.type === "front-matter") {
|
30415 | const doc2 = printFrontMatter(node, textToDoc);
|
30416 | return doc2 ? [doc2, hardline] : "";
|
30417 | }
|
30418 | }
|
30419 | module2.exports = embed;
|
30420 | }
|
30421 | });
|
30422 | var require_parse4 = __commonJS2({
|
30423 | "src/utils/front-matter/parse.js"(exports2, module2) {
|
30424 | "use strict";
|
30425 | var frontMatterRegex = new RegExp("^(?<startDelimiter>-{3}|\\+{3})(?<language>[^\\n]*)\\n(?:|(?<value>.*?)\\n)(?<endDelimiter>\\k<startDelimiter>|\\.{3})[^\\S\\n]*(?:\\n|$)", "s");
|
30426 | function parse(text) {
|
30427 | const match = text.match(frontMatterRegex);
|
30428 | if (!match) {
|
30429 | return {
|
30430 | content: text
|
30431 | };
|
30432 | }
|
30433 | const {
|
30434 | startDelimiter,
|
30435 | language,
|
30436 | value = "",
|
30437 | endDelimiter
|
30438 | } = match.groups;
|
30439 | let lang = language.trim() || "yaml";
|
30440 | if (startDelimiter === "+++") {
|
30441 | lang = "toml";
|
30442 | }
|
30443 | if (lang !== "yaml" && startDelimiter !== endDelimiter) {
|
30444 | return {
|
30445 | content: text
|
30446 | };
|
30447 | }
|
30448 | const [raw] = match;
|
30449 | const frontMatter = {
|
30450 | type: "front-matter",
|
30451 | lang,
|
30452 | value,
|
30453 | startDelimiter,
|
30454 | endDelimiter,
|
30455 | raw: raw.replace(/\n$/, "")
|
30456 | };
|
30457 | return {
|
30458 | frontMatter,
|
30459 | content: raw.replace(/[^\n]/g, " ") + text.slice(raw.length)
|
30460 | };
|
30461 | }
|
30462 | module2.exports = parse;
|
30463 | }
|
30464 | });
|
30465 | var require_pragma2 = __commonJS2({
|
30466 | "src/language-css/pragma.js"(exports2, module2) {
|
30467 | "use strict";
|
30468 | var jsPragma = require_pragma();
|
30469 | var parseFrontMatter = require_parse4();
|
30470 | function hasPragma(text) {
|
30471 | return jsPragma.hasPragma(parseFrontMatter(text).content);
|
30472 | }
|
30473 | function insertPragma(text) {
|
30474 | const {
|
30475 | frontMatter,
|
30476 | content
|
30477 | } = parseFrontMatter(text);
|
30478 | return (frontMatter ? frontMatter.raw + "\n\n" : "") + jsPragma.insertPragma(content);
|
30479 | }
|
30480 | module2.exports = {
|
30481 | hasPragma,
|
30482 | insertPragma
|
30483 | };
|
30484 | }
|
30485 | });
|
30486 | var require_utils8 = __commonJS2({
|
30487 | "src/language-css/utils/index.js"(exports2, module2) {
|
30488 | "use strict";
|
30489 | var colorAdjusterFunctions = new Set(["red", "green", "blue", "alpha", "a", "rgb", "hue", "h", "saturation", "s", "lightness", "l", "whiteness", "w", "blackness", "b", "tint", "shade", "blend", "blenda", "contrast", "hsl", "hsla", "hwb", "hwba"]);
|
30490 | function getAncestorCounter(path, typeOrTypes) {
|
30491 | const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
|
30492 | let counter = -1;
|
30493 | let ancestorNode;
|
30494 | while (ancestorNode = path.getParentNode(++counter)) {
|
30495 | if (types.includes(ancestorNode.type)) {
|
30496 | return counter;
|
30497 | }
|
30498 | }
|
30499 | return -1;
|
30500 | }
|
30501 | function getAncestorNode(path, typeOrTypes) {
|
30502 | const counter = getAncestorCounter(path, typeOrTypes);
|
30503 | return counter === -1 ? null : path.getParentNode(counter);
|
30504 | }
|
30505 | function getPropOfDeclNode(path) {
|
30506 | var _declAncestorNode$pro;
|
30507 | const declAncestorNode = getAncestorNode(path, "css-decl");
|
30508 | return declAncestorNode === null || declAncestorNode === void 0 ? void 0 : (_declAncestorNode$pro = declAncestorNode.prop) === null || _declAncestorNode$pro === void 0 ? void 0 : _declAncestorNode$pro.toLowerCase();
|
30509 | }
|
30510 | var wideKeywords = new Set(["initial", "inherit", "unset", "revert"]);
|
30511 | function isWideKeywords(value) {
|
30512 | return wideKeywords.has(value.toLowerCase());
|
30513 | }
|
30514 | function isKeyframeAtRuleKeywords(path, value) {
|
30515 | const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
|
30516 | return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) && atRuleAncestorNode.name.toLowerCase().endsWith("keyframes") && ["from", "to"].includes(value.toLowerCase());
|
30517 | }
|
30518 | function maybeToLowerCase(value) {
|
30519 | return value.includes("$") || value.includes("@") || value.includes("#") || value.startsWith("%") || value.startsWith("--") || value.startsWith(":--") || value.includes("(") && value.includes(")") ? value : value.toLowerCase();
|
30520 | }
|
30521 | function insideValueFunctionNode(path, functionName) {
|
30522 | var _funcAncestorNode$val;
|
30523 | const funcAncestorNode = getAncestorNode(path, "value-func");
|
30524 | return (funcAncestorNode === null || funcAncestorNode === void 0 ? void 0 : (_funcAncestorNode$val = funcAncestorNode.value) === null || _funcAncestorNode$val === void 0 ? void 0 : _funcAncestorNode$val.toLowerCase()) === functionName;
|
30525 | }
|
30526 | function insideICSSRuleNode(path) {
|
30527 | var _ruleAncestorNode$raw;
|
30528 | const ruleAncestorNode = getAncestorNode(path, "css-rule");
|
30529 | const selector = ruleAncestorNode === null || ruleAncestorNode === void 0 ? void 0 : (_ruleAncestorNode$raw = ruleAncestorNode.raws) === null || _ruleAncestorNode$raw === void 0 ? void 0 : _ruleAncestorNode$raw.selector;
|
30530 | return selector && (selector.startsWith(":import") || selector.startsWith(":export"));
|
30531 | }
|
30532 | function insideAtRuleNode(path, atRuleNameOrAtRuleNames) {
|
30533 | const atRuleNames = Array.isArray(atRuleNameOrAtRuleNames) ? atRuleNameOrAtRuleNames : [atRuleNameOrAtRuleNames];
|
30534 | const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
|
30535 | return atRuleAncestorNode && atRuleNames.includes(atRuleAncestorNode.name.toLowerCase());
|
30536 | }
|
30537 | function insideURLFunctionInImportAtRuleNode(path) {
|
30538 | const node = path.getValue();
|
30539 | const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
|
30540 | return (atRuleAncestorNode === null || atRuleAncestorNode === void 0 ? void 0 : atRuleAncestorNode.name) === "import" && node.groups[0].value === "url" && node.groups.length === 2;
|
30541 | }
|
30542 | function isURLFunctionNode(node) {
|
30543 | return node.type === "value-func" && node.value.toLowerCase() === "url";
|
30544 | }
|
30545 | function isLastNode(path, node) {
|
30546 | var _path$getParentNode;
|
30547 | const nodes = (_path$getParentNode = path.getParentNode()) === null || _path$getParentNode === void 0 ? void 0 : _path$getParentNode.nodes;
|
30548 | return nodes && nodes.indexOf(node) === nodes.length - 1;
|
30549 | }
|
30550 | function isDetachedRulesetDeclarationNode(node) {
|
30551 | const {
|
30552 | selector
|
30553 | } = node;
|
30554 | if (!selector) {
|
30555 | return false;
|
30556 | }
|
30557 | return typeof selector === "string" && /^@.+:.*$/.test(selector) || selector.value && /^@.+:.*$/.test(selector.value);
|
30558 | }
|
30559 | function isForKeywordNode(node) {
|
30560 | return node.type === "value-word" && ["from", "through", "end"].includes(node.value);
|
30561 | }
|
30562 | function isIfElseKeywordNode(node) {
|
30563 | return node.type === "value-word" && ["and", "or", "not"].includes(node.value);
|
30564 | }
|
30565 | function isEachKeywordNode(node) {
|
30566 | return node.type === "value-word" && node.value === "in";
|
30567 | }
|
30568 | function isMultiplicationNode(node) {
|
30569 | return node.type === "value-operator" && node.value === "*";
|
30570 | }
|
30571 | function isDivisionNode(node) {
|
30572 | return node.type === "value-operator" && node.value === "/";
|
30573 | }
|
30574 | function isAdditionNode(node) {
|
30575 | return node.type === "value-operator" && node.value === "+";
|
30576 | }
|
30577 | function isSubtractionNode(node) {
|
30578 | return node.type === "value-operator" && node.value === "-";
|
30579 | }
|
30580 | function isModuloNode(node) {
|
30581 | return node.type === "value-operator" && node.value === "%";
|
30582 | }
|
30583 | function isMathOperatorNode(node) {
|
30584 | return isMultiplicationNode(node) || isDivisionNode(node) || isAdditionNode(node) || isSubtractionNode(node) || isModuloNode(node);
|
30585 | }
|
30586 | function isEqualityOperatorNode(node) {
|
30587 | return node.type === "value-word" && ["==", "!="].includes(node.value);
|
30588 | }
|
30589 | function isRelationalOperatorNode(node) {
|
30590 | return node.type === "value-word" && ["<", ">", "<=", ">="].includes(node.value);
|
30591 | }
|
30592 | function isSCSSControlDirectiveNode(node) {
|
30593 | return node.type === "css-atrule" && ["if", "else", "for", "each", "while"].includes(node.name);
|
30594 | }
|
30595 | function isDetachedRulesetCallNode(node) {
|
30596 | var _node$raws;
|
30597 | return ((_node$raws = node.raws) === null || _node$raws === void 0 ? void 0 : _node$raws.params) && /^\(\s*\)$/.test(node.raws.params);
|
30598 | }
|
30599 | function isTemplatePlaceholderNode(node) {
|
30600 | return node.name.startsWith("prettier-placeholder");
|
30601 | }
|
30602 | function isTemplatePropNode(node) {
|
30603 | return node.prop.startsWith("@prettier-placeholder");
|
30604 | }
|
30605 | function isPostcssSimpleVarNode(currentNode, nextNode) {
|
30606 | return currentNode.value === "$$" && currentNode.type === "value-func" && (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) === "value-word" && !nextNode.raws.before;
|
30607 | }
|
30608 | function hasComposesNode(node) {
|
30609 | var _node$value, _node$value$group;
|
30610 | return ((_node$value = node.value) === null || _node$value === void 0 ? void 0 : _node$value.type) === "value-root" && ((_node$value$group = node.value.group) === null || _node$value$group === void 0 ? void 0 : _node$value$group.type) === "value-value" && node.prop.toLowerCase() === "composes";
|
30611 | }
|
30612 | function hasParensAroundNode(node) {
|
30613 | var _node$value2, _node$value2$group, _node$value2$group$gr;
|
30614 | return ((_node$value2 = node.value) === null || _node$value2 === void 0 ? void 0 : (_node$value2$group = _node$value2.group) === null || _node$value2$group === void 0 ? void 0 : (_node$value2$group$gr = _node$value2$group.group) === null || _node$value2$group$gr === void 0 ? void 0 : _node$value2$group$gr.type) === "value-paren_group" && node.value.group.group.open !== null && node.value.group.group.close !== null;
|
30615 | }
|
30616 | function hasEmptyRawBefore(node) {
|
30617 | var _node$raws2;
|
30618 | return ((_node$raws2 = node.raws) === null || _node$raws2 === void 0 ? void 0 : _node$raws2.before) === "";
|
30619 | }
|
30620 | function isKeyValuePairNode(node) {
|
30621 | var _node$groups, _node$groups$;
|
30622 | return node.type === "value-comma_group" && ((_node$groups = node.groups) === null || _node$groups === void 0 ? void 0 : (_node$groups$ = _node$groups[1]) === null || _node$groups$ === void 0 ? void 0 : _node$groups$.type) === "value-colon";
|
30623 | }
|
30624 | function isKeyValuePairInParenGroupNode(node) {
|
30625 | var _node$groups2;
|
30626 | return node.type === "value-paren_group" && ((_node$groups2 = node.groups) === null || _node$groups2 === void 0 ? void 0 : _node$groups2[0]) && isKeyValuePairNode(node.groups[0]);
|
30627 | }
|
30628 | function isSCSSMapItemNode(path) {
|
30629 | var _declNode$prop;
|
30630 | const node = path.getValue();
|
30631 | if (node.groups.length === 0) {
|
30632 | return false;
|
30633 | }
|
30634 | const parentParentNode = path.getParentNode(1);
|
30635 | if (!isKeyValuePairInParenGroupNode(node) && !(parentParentNode && isKeyValuePairInParenGroupNode(parentParentNode))) {
|
30636 | return false;
|
30637 | }
|
30638 | const declNode = getAncestorNode(path, "css-decl");
|
30639 | if (declNode !== null && declNode !== void 0 && (_declNode$prop = declNode.prop) !== null && _declNode$prop !== void 0 && _declNode$prop.startsWith("$")) {
|
30640 | return true;
|
30641 | }
|
30642 | if (isKeyValuePairInParenGroupNode(parentParentNode)) {
|
30643 | return true;
|
30644 | }
|
30645 | if (parentParentNode.type === "value-func") {
|
30646 | return true;
|
30647 | }
|
30648 | return false;
|
30649 | }
|
30650 | function isInlineValueCommentNode(node) {
|
30651 | return node.type === "value-comment" && node.inline;
|
30652 | }
|
30653 | function isHashNode(node) {
|
30654 | return node.type === "value-word" && node.value === "#";
|
30655 | }
|
30656 | function isLeftCurlyBraceNode(node) {
|
30657 | return node.type === "value-word" && node.value === "{";
|
30658 | }
|
30659 | function isRightCurlyBraceNode(node) {
|
30660 | return node.type === "value-word" && node.value === "}";
|
30661 | }
|
30662 | function isWordNode(node) {
|
30663 | return ["value-word", "value-atword"].includes(node.type);
|
30664 | }
|
30665 | function isColonNode(node) {
|
30666 | return (node === null || node === void 0 ? void 0 : node.type) === "value-colon";
|
30667 | }
|
30668 | function isKeyInValuePairNode(node, parentNode) {
|
30669 | if (!isKeyValuePairNode(parentNode)) {
|
30670 | return false;
|
30671 | }
|
30672 | const {
|
30673 | groups
|
30674 | } = parentNode;
|
30675 | const index = groups.indexOf(node);
|
30676 | if (index === -1) {
|
30677 | return false;
|
30678 | }
|
30679 | return isColonNode(groups[index + 1]);
|
30680 | }
|
30681 | function isMediaAndSupportsKeywords(node) {
|
30682 | return node.value && ["not", "and", "or"].includes(node.value.toLowerCase());
|
30683 | }
|
30684 | function isColorAdjusterFuncNode(node) {
|
30685 | if (node.type !== "value-func") {
|
30686 | return false;
|
30687 | }
|
30688 | return colorAdjusterFunctions.has(node.value.toLowerCase());
|
30689 | }
|
30690 | function lastLineHasInlineComment(text) {
|
30691 | return /\/\//.test(text.split(/[\n\r]/).pop());
|
30692 | }
|
30693 | function isAtWordPlaceholderNode(node) {
|
30694 | return (node === null || node === void 0 ? void 0 : node.type) === "value-atword" && node.value.startsWith("prettier-placeholder-");
|
30695 | }
|
30696 | function isConfigurationNode(node, parentNode) {
|
30697 | var _node$open, _node$close;
|
30698 | if (((_node$open = node.open) === null || _node$open === void 0 ? void 0 : _node$open.value) !== "(" || ((_node$close = node.close) === null || _node$close === void 0 ? void 0 : _node$close.value) !== ")" || node.groups.some((group) => group.type !== "value-comma_group")) {
|
30699 | return false;
|
30700 | }
|
30701 | if (parentNode.type === "value-comma_group") {
|
30702 | const prevIdx = parentNode.groups.indexOf(node) - 1;
|
30703 | const maybeWithNode = parentNode.groups[prevIdx];
|
30704 | if ((maybeWithNode === null || maybeWithNode === void 0 ? void 0 : maybeWithNode.type) === "value-word" && maybeWithNode.value === "with") {
|
30705 | return true;
|
30706 | }
|
30707 | }
|
30708 | return false;
|
30709 | }
|
30710 | function isParenGroupNode(node) {
|
30711 | var _node$open2, _node$close2;
|
30712 | return node.type === "value-paren_group" && ((_node$open2 = node.open) === null || _node$open2 === void 0 ? void 0 : _node$open2.value) === "(" && ((_node$close2 = node.close) === null || _node$close2 === void 0 ? void 0 : _node$close2.value) === ")";
|
30713 | }
|
30714 | module2.exports = {
|
30715 | getAncestorCounter,
|
30716 | getAncestorNode,
|
30717 | getPropOfDeclNode,
|
30718 | maybeToLowerCase,
|
30719 | insideValueFunctionNode,
|
30720 | insideICSSRuleNode,
|
30721 | insideAtRuleNode,
|
30722 | insideURLFunctionInImportAtRuleNode,
|
30723 | isKeyframeAtRuleKeywords,
|
30724 | isWideKeywords,
|
30725 | isLastNode,
|
30726 | isSCSSControlDirectiveNode,
|
30727 | isDetachedRulesetDeclarationNode,
|
30728 | isRelationalOperatorNode,
|
30729 | isEqualityOperatorNode,
|
30730 | isMultiplicationNode,
|
30731 | isDivisionNode,
|
30732 | isAdditionNode,
|
30733 | isSubtractionNode,
|
30734 | isModuloNode,
|
30735 | isMathOperatorNode,
|
30736 | isEachKeywordNode,
|
30737 | isForKeywordNode,
|
30738 | isURLFunctionNode,
|
30739 | isIfElseKeywordNode,
|
30740 | hasComposesNode,
|
30741 | hasParensAroundNode,
|
30742 | hasEmptyRawBefore,
|
30743 | isDetachedRulesetCallNode,
|
30744 | isTemplatePlaceholderNode,
|
30745 | isTemplatePropNode,
|
30746 | isPostcssSimpleVarNode,
|
30747 | isKeyValuePairNode,
|
30748 | isKeyValuePairInParenGroupNode,
|
30749 | isKeyInValuePairNode,
|
30750 | isSCSSMapItemNode,
|
30751 | isInlineValueCommentNode,
|
30752 | isHashNode,
|
30753 | isLeftCurlyBraceNode,
|
30754 | isRightCurlyBraceNode,
|
30755 | isWordNode,
|
30756 | isColonNode,
|
30757 | isMediaAndSupportsKeywords,
|
30758 | isColorAdjusterFuncNode,
|
30759 | lastLineHasInlineComment,
|
30760 | isAtWordPlaceholderNode,
|
30761 | isConfigurationNode,
|
30762 | isParenGroupNode
|
30763 | };
|
30764 | }
|
30765 | });
|
30766 | var require_line_column_to_index = __commonJS2({
|
30767 | "src/utils/line-column-to-index.js"(exports2, module2) {
|
30768 | "use strict";
|
30769 | module2.exports = function(lineColumn, text) {
|
30770 | let index = 0;
|
30771 | for (let i = 0; i < lineColumn.line - 1; ++i) {
|
30772 | index = text.indexOf("\n", index) + 1;
|
30773 | }
|
30774 | return index + lineColumn.column;
|
30775 | };
|
30776 | }
|
30777 | });
|
30778 | var require_loc2 = __commonJS2({
|
30779 | "src/language-css/loc.js"(exports2, module2) {
|
30780 | "use strict";
|
30781 | var {
|
30782 | skipEverythingButNewLine
|
30783 | } = require_skip();
|
30784 | var getLast = require_get_last();
|
30785 | var lineColumnToIndex = require_line_column_to_index();
|
30786 | function calculateLocStart(node, text) {
|
30787 | if (typeof node.sourceIndex === "number") {
|
30788 | return node.sourceIndex;
|
30789 | }
|
30790 | return node.source ? lineColumnToIndex(node.source.start, text) - 1 : null;
|
30791 | }
|
30792 | function calculateLocEnd(node, text) {
|
30793 | if (node.type === "css-comment" && node.inline) {
|
30794 | return skipEverythingButNewLine(text, node.source.startOffset);
|
30795 | }
|
30796 | const endNode = node.nodes && getLast(node.nodes);
|
30797 | if (endNode && node.source && !node.source.end) {
|
30798 | node = endNode;
|
30799 | }
|
30800 | if (node.source && node.source.end) {
|
30801 | return lineColumnToIndex(node.source.end, text);
|
30802 | }
|
30803 | return null;
|
30804 | }
|
30805 | function calculateLoc(node, text) {
|
30806 | if (node.source) {
|
30807 | node.source.startOffset = calculateLocStart(node, text);
|
30808 | node.source.endOffset = calculateLocEnd(node, text);
|
30809 | }
|
30810 | for (const key in node) {
|
30811 | const child = node[key];
|
30812 | if (key === "source" || !child || typeof child !== "object") {
|
30813 | continue;
|
30814 | }
|
30815 | if (child.type === "value-root" || child.type === "value-unknown") {
|
30816 | calculateValueNodeLoc(child, getValueRootOffset(node), child.text || child.value);
|
30817 | } else {
|
30818 | calculateLoc(child, text);
|
30819 | }
|
30820 | }
|
30821 | }
|
30822 | function calculateValueNodeLoc(node, rootOffset, text) {
|
30823 | if (node.source) {
|
30824 | node.source.startOffset = calculateLocStart(node, text) + rootOffset;
|
30825 | node.source.endOffset = calculateLocEnd(node, text) + rootOffset;
|
30826 | }
|
30827 | for (const key in node) {
|
30828 | const child = node[key];
|
30829 | if (key === "source" || !child || typeof child !== "object") {
|
30830 | continue;
|
30831 | }
|
30832 | calculateValueNodeLoc(child, rootOffset, text);
|
30833 | }
|
30834 | }
|
30835 | function getValueRootOffset(node) {
|
30836 | let result = node.source.startOffset;
|
30837 | if (typeof node.prop === "string") {
|
30838 | result += node.prop.length;
|
30839 | }
|
30840 | if (node.type === "css-atrule" && typeof node.name === "string") {
|
30841 | result += 1 + node.name.length + node.raws.afterName.match(/^\s*:?\s*/)[0].length;
|
30842 | }
|
30843 | if (node.type !== "css-atrule" && node.raws && typeof node.raws.between === "string") {
|
30844 | result += node.raws.between.length;
|
30845 | }
|
30846 | return result;
|
30847 | }
|
30848 | function replaceQuotesInInlineComments(text) {
|
30849 | let state = "initial";
|
30850 | let stateToReturnFromQuotes = "initial";
|
30851 | let inlineCommentStartIndex;
|
30852 | let inlineCommentContainsQuotes = false;
|
30853 | const inlineCommentsToReplace = [];
|
30854 | for (let i = 0; i < text.length; i++) {
|
30855 | const c = text[i];
|
30856 | switch (state) {
|
30857 | case "initial":
|
30858 | if (c === "'") {
|
30859 | state = "single-quotes";
|
30860 | continue;
|
30861 | }
|
30862 | if (c === '"') {
|
30863 | state = "double-quotes";
|
30864 | continue;
|
30865 | }
|
30866 | if ((c === "u" || c === "U") && text.slice(i, i + 4).toLowerCase() === "url(") {
|
30867 | state = "url";
|
30868 | i += 3;
|
30869 | continue;
|
30870 | }
|
30871 | if (c === "*" && text[i - 1] === "/") {
|
30872 | state = "comment-block";
|
30873 | continue;
|
30874 | }
|
30875 | if (c === "/" && text[i - 1] === "/") {
|
30876 | state = "comment-inline";
|
30877 | inlineCommentStartIndex = i - 1;
|
30878 | continue;
|
30879 | }
|
30880 | continue;
|
30881 | case "single-quotes":
|
30882 | if (c === "'" && text[i - 1] !== "\\") {
|
30883 | state = stateToReturnFromQuotes;
|
30884 | stateToReturnFromQuotes = "initial";
|
30885 | }
|
30886 | if (c === "\n" || c === "\r") {
|
30887 | return text;
|
30888 | }
|
30889 | continue;
|
30890 | case "double-quotes":
|
30891 | if (c === '"' && text[i - 1] !== "\\") {
|
30892 | state = stateToReturnFromQuotes;
|
30893 | stateToReturnFromQuotes = "initial";
|
30894 | }
|
30895 | if (c === "\n" || c === "\r") {
|
30896 | return text;
|
30897 | }
|
30898 | continue;
|
30899 | case "url":
|
30900 | if (c === ")") {
|
30901 | state = "initial";
|
30902 | }
|
30903 | if (c === "\n" || c === "\r") {
|
30904 | return text;
|
30905 | }
|
30906 | if (c === "'") {
|
30907 | state = "single-quotes";
|
30908 | stateToReturnFromQuotes = "url";
|
30909 | continue;
|
30910 | }
|
30911 | if (c === '"') {
|
30912 | state = "double-quotes";
|
30913 | stateToReturnFromQuotes = "url";
|
30914 | continue;
|
30915 | }
|
30916 | continue;
|
30917 | case "comment-block":
|
30918 | if (c === "/" && text[i - 1] === "*") {
|
30919 | state = "initial";
|
30920 | }
|
30921 | continue;
|
30922 | case "comment-inline":
|
30923 | if (c === '"' || c === "'" || c === "*") {
|
30924 | inlineCommentContainsQuotes = true;
|
30925 | }
|
30926 | if (c === "\n" || c === "\r") {
|
30927 | if (inlineCommentContainsQuotes) {
|
30928 | inlineCommentsToReplace.push([inlineCommentStartIndex, i]);
|
30929 | }
|
30930 | state = "initial";
|
30931 | inlineCommentContainsQuotes = false;
|
30932 | }
|
30933 | continue;
|
30934 | }
|
30935 | }
|
30936 | for (const [start, end] of inlineCommentsToReplace) {
|
30937 | text = text.slice(0, start) + text.slice(start, end).replace(/["'*]/g, " ") + text.slice(end);
|
30938 | }
|
30939 | return text;
|
30940 | }
|
30941 | function locStart(node) {
|
30942 | return node.source.startOffset;
|
30943 | }
|
30944 | function locEnd(node) {
|
30945 | return node.source.endOffset;
|
30946 | }
|
30947 | module2.exports = {
|
30948 | locStart,
|
30949 | locEnd,
|
30950 | calculateLoc,
|
30951 | replaceQuotesInInlineComments
|
30952 | };
|
30953 | }
|
30954 | });
|
30955 | var require_is_less_parser = __commonJS2({
|
30956 | "src/language-css/utils/is-less-parser.js"(exports2, module2) {
|
30957 | "use strict";
|
30958 | function isLessParser(options) {
|
30959 | return options.parser === "css" || options.parser === "less";
|
30960 | }
|
30961 | module2.exports = isLessParser;
|
30962 | }
|
30963 | });
|
30964 | var require_is_scss = __commonJS2({
|
30965 | "src/language-css/utils/is-scss.js"(exports2, module2) {
|
30966 | "use strict";
|
30967 | function isSCSS(parser, text) {
|
30968 | const hasExplicitParserChoice = parser === "less" || parser === "scss";
|
30969 | const IS_POSSIBLY_SCSS = /(?:\w\s*:\s*[^:}]+|#){|@import[^\n]+(?:url|,)/;
|
30970 | return hasExplicitParserChoice ? parser === "scss" : IS_POSSIBLY_SCSS.test(text);
|
30971 | }
|
30972 | module2.exports = isSCSS;
|
30973 | }
|
30974 | });
|
30975 | var require_css_units_evaluate = __commonJS2({
|
30976 | "src/language-css/utils/css-units.evaluate.js"(exports2, module2) {
|
30977 | module2.exports = {
|
30978 | em: "em",
|
30979 | rem: "rem",
|
30980 | ex: "ex",
|
30981 | rex: "rex",
|
30982 | cap: "cap",
|
30983 | rcap: "rcap",
|
30984 | ch: "ch",
|
30985 | rch: "rch",
|
30986 | ic: "ic",
|
30987 | ric: "ric",
|
30988 | lh: "lh",
|
30989 | rlh: "rlh",
|
30990 | vw: "vw",
|
30991 | svw: "svw",
|
30992 | lvw: "lvw",
|
30993 | dvw: "dvw",
|
30994 | vh: "vh",
|
30995 | svh: "svh",
|
30996 | lvh: "lvh",
|
30997 | dvh: "dvh",
|
30998 | vi: "vi",
|
30999 | svi: "svi",
|
31000 | lvi: "lvi",
|
31001 | dvi: "dvi",
|
31002 | vb: "vb",
|
31003 | svb: "svb",
|
31004 | lvb: "lvb",
|
31005 | dvb: "dvb",
|
31006 | vmin: "vmin",
|
31007 | svmin: "svmin",
|
31008 | lvmin: "lvmin",
|
31009 | dvmin: "dvmin",
|
31010 | vmax: "vmax",
|
31011 | svmax: "svmax",
|
31012 | lvmax: "lvmax",
|
31013 | dvmax: "dvmax",
|
31014 | cm: "cm",
|
31015 | mm: "mm",
|
31016 | q: "Q",
|
31017 | in: "in",
|
31018 | pt: "pt",
|
31019 | pc: "pc",
|
31020 | px: "px",
|
31021 | deg: "deg",
|
31022 | grad: "grad",
|
31023 | rad: "rad",
|
31024 | turn: "turn",
|
31025 | s: "s",
|
31026 | ms: "ms",
|
31027 | hz: "Hz",
|
31028 | khz: "kHz",
|
31029 | dpi: "dpi",
|
31030 | dpcm: "dpcm",
|
31031 | dppx: "dppx",
|
31032 | x: "x"
|
31033 | };
|
31034 | }
|
31035 | });
|
31036 | var require_print_unit = __commonJS2({
|
31037 | "src/language-css/utils/print-unit.js"(exports2, module2) {
|
31038 | "use strict";
|
31039 | var CSS_UNITS = require_css_units_evaluate();
|
31040 | function printUnit(unit) {
|
31041 | const lowercased = unit.toLowerCase();
|
31042 | return Object.prototype.hasOwnProperty.call(CSS_UNITS, lowercased) ? CSS_UNITS[lowercased] : unit;
|
31043 | }
|
31044 | module2.exports = printUnit;
|
31045 | }
|
31046 | });
|
31047 | var require_printer_postcss = __commonJS2({
|
31048 | "src/language-css/printer-postcss.js"(exports2, module2) {
|
31049 | "use strict";
|
31050 | var getLast = require_get_last();
|
31051 | var {
|
31052 | printNumber,
|
31053 | printString,
|
31054 | hasNewline,
|
31055 | isFrontMatterNode,
|
31056 | isNextLineEmpty,
|
31057 | isNonEmptyArray
|
31058 | } = require_util();
|
31059 | var {
|
31060 | builders: {
|
31061 | join,
|
31062 | line,
|
31063 | hardline,
|
31064 | softline,
|
31065 | group,
|
31066 | fill,
|
31067 | indent,
|
31068 | dedent,
|
31069 | ifBreak,
|
31070 | breakParent
|
31071 | },
|
31072 | utils: {
|
31073 | removeLines,
|
31074 | getDocParts
|
31075 | }
|
31076 | } = require("./doc.js");
|
31077 | var clean = require_clean2();
|
31078 | var embed = require_embed2();
|
31079 | var {
|
31080 | insertPragma
|
31081 | } = require_pragma2();
|
31082 | var {
|
31083 | getAncestorNode,
|
31084 | getPropOfDeclNode,
|
31085 | maybeToLowerCase,
|
31086 | insideValueFunctionNode,
|
31087 | insideICSSRuleNode,
|
31088 | insideAtRuleNode,
|
31089 | insideURLFunctionInImportAtRuleNode,
|
31090 | isKeyframeAtRuleKeywords,
|
31091 | isWideKeywords,
|
31092 | isLastNode,
|
31093 | isSCSSControlDirectiveNode,
|
31094 | isDetachedRulesetDeclarationNode,
|
31095 | isRelationalOperatorNode,
|
31096 | isEqualityOperatorNode,
|
31097 | isMultiplicationNode,
|
31098 | isDivisionNode,
|
31099 | isAdditionNode,
|
31100 | isSubtractionNode,
|
31101 | isMathOperatorNode,
|
31102 | isEachKeywordNode,
|
31103 | isForKeywordNode,
|
31104 | isURLFunctionNode,
|
31105 | isIfElseKeywordNode,
|
31106 | hasComposesNode,
|
31107 | hasParensAroundNode,
|
31108 | hasEmptyRawBefore,
|
31109 | isKeyValuePairNode,
|
31110 | isKeyInValuePairNode,
|
31111 | isDetachedRulesetCallNode,
|
31112 | isTemplatePlaceholderNode,
|
31113 | isTemplatePropNode,
|
31114 | isPostcssSimpleVarNode,
|
31115 | isSCSSMapItemNode,
|
31116 | isInlineValueCommentNode,
|
31117 | isHashNode,
|
31118 | isLeftCurlyBraceNode,
|
31119 | isRightCurlyBraceNode,
|
31120 | isWordNode,
|
31121 | isColonNode,
|
31122 | isMediaAndSupportsKeywords,
|
31123 | isColorAdjusterFuncNode,
|
31124 | lastLineHasInlineComment,
|
31125 | isAtWordPlaceholderNode,
|
31126 | isConfigurationNode,
|
31127 | isParenGroupNode
|
31128 | } = require_utils8();
|
31129 | var {
|
31130 | locStart,
|
31131 | locEnd
|
31132 | } = require_loc2();
|
31133 | var isLessParser = require_is_less_parser();
|
31134 | var isSCSS = require_is_scss();
|
31135 | var printUnit = require_print_unit();
|
31136 | function shouldPrintComma(options) {
|
31137 | return options.trailingComma === "es5" || options.trailingComma === "all";
|
31138 | }
|
31139 | function genericPrint(path, options, print) {
|
31140 | const node = path.getValue();
|
31141 | if (!node) {
|
31142 | return "";
|
31143 | }
|
31144 | if (typeof node === "string") {
|
31145 | return node;
|
31146 | }
|
31147 | switch (node.type) {
|
31148 | case "front-matter":
|
31149 | return [node.raw, hardline];
|
31150 | case "css-root": {
|
31151 | const nodes = printNodeSequence(path, options, print);
|
31152 | const after = node.raws.after.trim();
|
31153 | return [nodes, after ? ` ${after}` : "", getDocParts(nodes).length > 0 ? hardline : ""];
|
31154 | }
|
31155 | case "css-comment": {
|
31156 | const isInlineComment = node.inline || node.raws.inline;
|
31157 | const text = options.originalText.slice(locStart(node), locEnd(node));
|
31158 | return isInlineComment ? text.trimEnd() : text;
|
31159 | }
|
31160 | case "css-rule": {
|
31161 | return [print("selector"), node.important ? " !important" : "", node.nodes ? [node.selector && node.selector.type === "selector-unknown" && lastLineHasInlineComment(node.selector.value) ? line : " ", "{", node.nodes.length > 0 ? indent([hardline, printNodeSequence(path, options, print)]) : "", hardline, "}", isDetachedRulesetDeclarationNode(node) ? ";" : ""] : ";"];
|
31162 | }
|
31163 | case "css-decl": {
|
31164 | const parentNode = path.getParentNode();
|
31165 | const {
|
31166 | between: rawBetween
|
31167 | } = node.raws;
|
31168 | const trimmedBetween = rawBetween.trim();
|
31169 | const isColon = trimmedBetween === ":";
|
31170 | let value = hasComposesNode(node) ? removeLines(print("value")) : print("value");
|
31171 | if (!isColon && lastLineHasInlineComment(trimmedBetween)) {
|
31172 | value = indent([hardline, dedent(value)]);
|
31173 | }
|
31174 | return [node.raws.before.replace(/[\s;]/g, ""), insideICSSRuleNode(path) ? node.prop : maybeToLowerCase(node.prop), trimmedBetween.startsWith("//") ? " " : "", trimmedBetween, node.extend ? "" : " ", isLessParser(options) && node.extend && node.selector ? ["extend(", print("selector"), ")"] : "", value, node.raws.important ? node.raws.important.replace(/\s*!\s*important/i, " !important") : node.important ? " !important" : "", node.raws.scssDefault ? node.raws.scssDefault.replace(/\s*!default/i, " !default") : node.scssDefault ? " !default" : "", node.raws.scssGlobal ? node.raws.scssGlobal.replace(/\s*!global/i, " !global") : node.scssGlobal ? " !global" : "", node.nodes ? [" {", indent([softline, printNodeSequence(path, options, print)]), softline, "}"] : isTemplatePropNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";" ? "" : options.__isHTMLStyleAttribute && isLastNode(path, node) ? ifBreak(";") : ";"];
|
31175 | }
|
31176 | case "css-atrule": {
|
31177 | const parentNode = path.getParentNode();
|
31178 | const isTemplatePlaceholderNodeWithoutSemiColon = isTemplatePlaceholderNode(node) && !parentNode.raws.semicolon && options.originalText[locEnd(node) - 1] !== ";";
|
31179 | if (isLessParser(options)) {
|
31180 | if (node.mixin) {
|
31181 | return [print("selector"), node.important ? " !important" : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
|
31182 | }
|
31183 | if (node.function) {
|
31184 | return [node.name, print("params"), isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
|
31185 | }
|
31186 | if (node.variable) {
|
31187 | return ["@", node.name, ": ", node.value ? print("value") : "", node.raws.between.trim() ? node.raws.between.trim() + " " : "", node.nodes ? ["{", indent([node.nodes.length > 0 ? softline : "", printNodeSequence(path, options, print)]), softline, "}"] : "", isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
|
31188 | }
|
31189 | }
|
31190 | return ["@", isDetachedRulesetCallNode(node) || node.name.endsWith(":") ? node.name : maybeToLowerCase(node.name), node.params ? [isDetachedRulesetCallNode(node) ? "" : isTemplatePlaceholderNode(node) ? node.raws.afterName === "" ? "" : node.name.endsWith(":") ? " " : /^\s*\n\s*\n/.test(node.raws.afterName) ? [hardline, hardline] : /^\s*\n/.test(node.raws.afterName) ? hardline : " " : " ", print("params")] : "", node.selector ? indent([" ", print("selector")]) : "", node.value ? group([" ", print("value"), isSCSSControlDirectiveNode(node) ? hasParensAroundNode(node) ? " " : line : ""]) : node.name === "else" ? " " : "", node.nodes ? [isSCSSControlDirectiveNode(node) ? "" : node.selector && !node.selector.nodes && typeof node.selector.value === "string" && lastLineHasInlineComment(node.selector.value) || !node.selector && typeof node.params === "string" && lastLineHasInlineComment(node.params) ? line : " ", "{", indent([node.nodes.length > 0 ? softline : "", printNodeSequence(path, options, print)]), softline, "}"] : isTemplatePlaceholderNodeWithoutSemiColon ? "" : ";"];
|
31191 | }
|
31192 | case "media-query-list": {
|
31193 | const parts = [];
|
31194 | path.each((childPath) => {
|
31195 | const node2 = childPath.getValue();
|
31196 | if (node2.type === "media-query" && node2.value === "") {
|
31197 | return;
|
31198 | }
|
31199 | parts.push(print());
|
31200 | }, "nodes");
|
31201 | return group(indent(join(line, parts)));
|
31202 | }
|
31203 | case "media-query": {
|
31204 | return [join(" ", path.map(print, "nodes")), isLastNode(path, node) ? "" : ","];
|
31205 | }
|
31206 | case "media-type": {
|
31207 | return adjustNumbers(adjustStrings(node.value, options));
|
31208 | }
|
31209 | case "media-feature-expression": {
|
31210 | if (!node.nodes) {
|
31211 | return node.value;
|
31212 | }
|
31213 | return ["(", ...path.map(print, "nodes"), ")"];
|
31214 | }
|
31215 | case "media-feature": {
|
31216 | return maybeToLowerCase(adjustStrings(node.value.replace(/ +/g, " "), options));
|
31217 | }
|
31218 | case "media-colon": {
|
31219 | return [node.value, " "];
|
31220 | }
|
31221 | case "media-value": {
|
31222 | return adjustNumbers(adjustStrings(node.value, options));
|
31223 | }
|
31224 | case "media-keyword": {
|
31225 | return adjustStrings(node.value, options);
|
31226 | }
|
31227 | case "media-url": {
|
31228 | return adjustStrings(node.value.replace(/^url\(\s+/gi, "url(").replace(/\s+\)$/g, ")"), options);
|
31229 | }
|
31230 | case "media-unknown": {
|
31231 | return node.value;
|
31232 | }
|
31233 | case "selector-root": {
|
31234 | return group([insideAtRuleNode(path, "custom-selector") ? [getAncestorNode(path, "css-atrule").customSelector, line] : "", join([",", insideAtRuleNode(path, ["extend", "custom-selector", "nest"]) ? line : hardline], path.map(print, "nodes"))]);
|
31235 | }
|
31236 | case "selector-selector": {
|
31237 | return group(indent(path.map(print, "nodes")));
|
31238 | }
|
31239 | case "selector-comment": {
|
31240 | return node.value;
|
31241 | }
|
31242 | case "selector-string": {
|
31243 | return adjustStrings(node.value, options);
|
31244 | }
|
31245 | case "selector-tag": {
|
31246 | const parentNode = path.getParentNode();
|
31247 | const index = parentNode && parentNode.nodes.indexOf(node);
|
31248 | const prevNode = index && parentNode.nodes[index - 1];
|
31249 | return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", prevNode.type === "selector-nesting" ? node.value : adjustNumbers(isKeyframeAtRuleKeywords(path, node.value) ? node.value.toLowerCase() : node.value)];
|
31250 | }
|
31251 | case "selector-id": {
|
31252 | return ["#", node.value];
|
31253 | }
|
31254 | case "selector-class": {
|
31255 | return [".", adjustNumbers(adjustStrings(node.value, options))];
|
31256 | }
|
31257 | case "selector-attribute": {
|
31258 | var _node$operator;
|
31259 | return ["[", node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.attribute.trim(), (_node$operator = node.operator) !== null && _node$operator !== void 0 ? _node$operator : "", node.value ? quoteAttributeValue(adjustStrings(node.value.trim(), options), options) : "", node.insensitive ? " i" : "", "]"];
|
31260 | }
|
31261 | case "selector-combinator": {
|
31262 | if (node.value === "+" || node.value === ">" || node.value === "~" || node.value === ">>>") {
|
31263 | const parentNode = path.getParentNode();
|
31264 | const leading2 = parentNode.type === "selector-selector" && parentNode.nodes[0] === node ? "" : line;
|
31265 | return [leading2, node.value, isLastNode(path, node) ? "" : " "];
|
31266 | }
|
31267 | const leading = node.value.trim().startsWith("(") ? line : "";
|
31268 | const value = adjustNumbers(adjustStrings(node.value.trim(), options)) || line;
|
31269 | return [leading, value];
|
31270 | }
|
31271 | case "selector-universal": {
|
31272 | return [node.namespace ? [node.namespace === true ? "" : node.namespace.trim(), "|"] : "", node.value];
|
31273 | }
|
31274 | case "selector-pseudo": {
|
31275 | return [maybeToLowerCase(node.value), isNonEmptyArray(node.nodes) ? group(["(", indent([softline, join([",", line], path.map(print, "nodes"))]), softline, ")"]) : ""];
|
31276 | }
|
31277 | case "selector-nesting": {
|
31278 | return node.value;
|
31279 | }
|
31280 | case "selector-unknown": {
|
31281 | const ruleAncestorNode = getAncestorNode(path, "css-rule");
|
31282 | if (ruleAncestorNode && ruleAncestorNode.isSCSSNesterProperty) {
|
31283 | return adjustNumbers(adjustStrings(maybeToLowerCase(node.value), options));
|
31284 | }
|
31285 | const parentNode = path.getParentNode();
|
31286 | if (parentNode.raws && parentNode.raws.selector) {
|
31287 | const start = locStart(parentNode);
|
31288 | const end = start + parentNode.raws.selector.length;
|
31289 | return options.originalText.slice(start, end).trim();
|
31290 | }
|
31291 | const grandParent = path.getParentNode(1);
|
31292 | if (parentNode.type === "value-paren_group" && grandParent && grandParent.type === "value-func" && grandParent.value === "selector") {
|
31293 | const start = locEnd(parentNode.open) + 1;
|
31294 | const end = locStart(parentNode.close);
|
31295 | const selector = options.originalText.slice(start, end).trim();
|
31296 | return lastLineHasInlineComment(selector) ? [breakParent, selector] : selector;
|
31297 | }
|
31298 | return node.value;
|
31299 | }
|
31300 | case "value-value":
|
31301 | case "value-root": {
|
31302 | return print("group");
|
31303 | }
|
31304 | case "value-comment": {
|
31305 | return options.originalText.slice(locStart(node), locEnd(node));
|
31306 | }
|
31307 | case "value-comma_group": {
|
31308 | const parentNode = path.getParentNode();
|
31309 | const parentParentNode = path.getParentNode(1);
|
31310 | const declAncestorProp = getPropOfDeclNode(path);
|
31311 | const isGridValue = declAncestorProp && parentNode.type === "value-value" && (declAncestorProp === "grid" || declAncestorProp.startsWith("grid-template"));
|
31312 | const atRuleAncestorNode = getAncestorNode(path, "css-atrule");
|
31313 | const isControlDirective = atRuleAncestorNode && isSCSSControlDirectiveNode(atRuleAncestorNode);
|
31314 | const hasInlineComment = node.groups.some((node2) => isInlineValueCommentNode(node2));
|
31315 | const printed = path.map(print, "groups");
|
31316 | const parts = [];
|
31317 | const insideURLFunction = insideValueFunctionNode(path, "url");
|
31318 | let insideSCSSInterpolationInString = false;
|
31319 | let didBreak = false;
|
31320 | for (let i = 0; i < node.groups.length; ++i) {
|
31321 | var _iNode$value;
|
31322 | parts.push(printed[i]);
|
31323 | const iPrevNode = node.groups[i - 1];
|
31324 | const iNode = node.groups[i];
|
31325 | const iNextNode = node.groups[i + 1];
|
31326 | const iNextNextNode = node.groups[i + 2];
|
31327 | if (insideURLFunction) {
|
31328 | if (iNextNode && isAdditionNode(iNextNode) || isAdditionNode(iNode)) {
|
31329 | parts.push(" ");
|
31330 | }
|
31331 | continue;
|
31332 | }
|
31333 | if (insideAtRuleNode(path, "forward") && iNode.type === "value-word" && iNode.value && iPrevNode !== void 0 && iPrevNode.type === "value-word" && iPrevNode.value === "as" && iNextNode.type === "value-operator" && iNextNode.value === "*") {
|
31334 | continue;
|
31335 | }
|
31336 | if (!iNextNode) {
|
31337 | continue;
|
31338 | }
|
31339 | if (iNode.type === "value-word" && iNode.value.endsWith("-") && isAtWordPlaceholderNode(iNextNode)) {
|
31340 | continue;
|
31341 | }
|
31342 | const isStartSCSSInterpolationInString = iNode.type === "value-string" && iNode.value.startsWith("#{");
|
31343 | const isEndingSCSSInterpolationInString = insideSCSSInterpolationInString && iNextNode.type === "value-string" && iNextNode.value.endsWith("}");
|
31344 | if (isStartSCSSInterpolationInString || isEndingSCSSInterpolationInString) {
|
31345 | insideSCSSInterpolationInString = !insideSCSSInterpolationInString;
|
31346 | continue;
|
31347 | }
|
31348 | if (insideSCSSInterpolationInString) {
|
31349 | continue;
|
31350 | }
|
31351 | if (isColonNode(iNode) || isColonNode(iNextNode)) {
|
31352 | continue;
|
31353 | }
|
31354 | if (iNode.type === "value-atword" && iNode.value === "") {
|
31355 | continue;
|
31356 | }
|
31357 | if (iNode.value === "~") {
|
31358 | continue;
|
31359 | }
|
31360 | if (iNode.value && iNode.value.includes("\\") && iNextNode && iNextNode.type !== "value-comment") {
|
31361 | continue;
|
31362 | }
|
31363 | if (iPrevNode && iPrevNode.value && iPrevNode.value.indexOf("\\") === iPrevNode.value.length - 1 && iNode.type === "value-operator" && iNode.value === "/") {
|
31364 | continue;
|
31365 | }
|
31366 | if (iNode.value === "\\") {
|
31367 | continue;
|
31368 | }
|
31369 | if (isPostcssSimpleVarNode(iNode, iNextNode)) {
|
31370 | continue;
|
31371 | }
|
31372 | if (isHashNode(iNode) || isLeftCurlyBraceNode(iNode) || isRightCurlyBraceNode(iNextNode) || isLeftCurlyBraceNode(iNextNode) && hasEmptyRawBefore(iNextNode) || isRightCurlyBraceNode(iNode) && hasEmptyRawBefore(iNextNode)) {
|
31373 | continue;
|
31374 | }
|
31375 | if (iNode.value === "--" && isHashNode(iNextNode)) {
|
31376 | continue;
|
31377 | }
|
31378 | const isMathOperator = isMathOperatorNode(iNode);
|
31379 | const isNextMathOperator = isMathOperatorNode(iNextNode);
|
31380 | if ((isMathOperator && isHashNode(iNextNode) || isNextMathOperator && isRightCurlyBraceNode(iNode)) && hasEmptyRawBefore(iNextNode)) {
|
31381 | continue;
|
31382 | }
|
31383 | if (!iPrevNode && isDivisionNode(iNode)) {
|
31384 | continue;
|
31385 | }
|
31386 | if (insideValueFunctionNode(path, "calc") && (isAdditionNode(iNode) || isAdditionNode(iNextNode) || isSubtractionNode(iNode) || isSubtractionNode(iNextNode)) && hasEmptyRawBefore(iNextNode)) {
|
31387 | continue;
|
31388 | }
|
31389 | const isColorAdjusterNode = (isAdditionNode(iNode) || isSubtractionNode(iNode)) && i === 0 && (iNextNode.type === "value-number" || iNextNode.isHex) && parentParentNode && isColorAdjusterFuncNode(parentParentNode) && !hasEmptyRawBefore(iNextNode);
|
31390 | const requireSpaceBeforeOperator = iNextNextNode && iNextNextNode.type === "value-func" || iNextNextNode && isWordNode(iNextNextNode) || iNode.type === "value-func" || isWordNode(iNode);
|
31391 | const requireSpaceAfterOperator = iNextNode.type === "value-func" || isWordNode(iNextNode) || iPrevNode && iPrevNode.type === "value-func" || iPrevNode && isWordNode(iPrevNode);
|
31392 | if (!(isMultiplicationNode(iNextNode) || isMultiplicationNode(iNode)) && !insideValueFunctionNode(path, "calc") && !isColorAdjusterNode && (isDivisionNode(iNextNode) && !requireSpaceBeforeOperator || isDivisionNode(iNode) && !requireSpaceAfterOperator || isAdditionNode(iNextNode) && !requireSpaceBeforeOperator || isAdditionNode(iNode) && !requireSpaceAfterOperator || isSubtractionNode(iNextNode) || isSubtractionNode(iNode)) && (hasEmptyRawBefore(iNextNode) || isMathOperator && (!iPrevNode || iPrevNode && isMathOperatorNode(iPrevNode)))) {
|
31393 | continue;
|
31394 | }
|
31395 | if (isInlineValueCommentNode(iNode)) {
|
31396 | if (parentNode.type === "value-paren_group") {
|
31397 | parts.push(dedent(hardline));
|
31398 | continue;
|
31399 | }
|
31400 | parts.push(hardline);
|
31401 | continue;
|
31402 | }
|
31403 | if (isControlDirective && (isEqualityOperatorNode(iNextNode) || isRelationalOperatorNode(iNextNode) || isIfElseKeywordNode(iNextNode) || isEachKeywordNode(iNode) || isForKeywordNode(iNode))) {
|
31404 | parts.push(" ");
|
31405 | continue;
|
31406 | }
|
31407 | if (atRuleAncestorNode && atRuleAncestorNode.name.toLowerCase() === "namespace") {
|
31408 | parts.push(" ");
|
31409 | continue;
|
31410 | }
|
31411 | if (isGridValue) {
|
31412 | if (iNode.source && iNextNode.source && iNode.source.start.line !== iNextNode.source.start.line) {
|
31413 | parts.push(hardline);
|
31414 | didBreak = true;
|
31415 | } else {
|
31416 | parts.push(" ");
|
31417 | }
|
31418 | continue;
|
31419 | }
|
31420 | if (isNextMathOperator) {
|
31421 | parts.push(" ");
|
31422 | continue;
|
31423 | }
|
31424 | if (iNextNode && iNextNode.value === "...") {
|
31425 | continue;
|
31426 | }
|
31427 | if (isAtWordPlaceholderNode(iNode) && isAtWordPlaceholderNode(iNextNode) && locEnd(iNode) === locStart(iNextNode)) {
|
31428 | continue;
|
31429 | }
|
31430 | if (isAtWordPlaceholderNode(iNode) && isParenGroupNode(iNextNode) && locEnd(iNode) === locStart(iNextNode.open)) {
|
31431 | parts.push(softline);
|
31432 | continue;
|
31433 | }
|
31434 | if (iNode.value === "with" && isParenGroupNode(iNextNode)) {
|
31435 | parts.push(" ");
|
31436 | continue;
|
31437 | }
|
31438 | if ((_iNode$value = iNode.value) !== null && _iNode$value !== void 0 && _iNode$value.endsWith("#") && iNextNode.value === "{" && isParenGroupNode(iNextNode.group)) {
|
31439 | continue;
|
31440 | }
|
31441 | parts.push(line);
|
31442 | }
|
31443 | if (hasInlineComment) {
|
31444 | parts.push(breakParent);
|
31445 | }
|
31446 | if (didBreak) {
|
31447 | parts.unshift(hardline);
|
31448 | }
|
31449 | if (isControlDirective) {
|
31450 | return group(indent(parts));
|
31451 | }
|
31452 | if (insideURLFunctionInImportAtRuleNode(path)) {
|
31453 | return group(fill(parts));
|
31454 | }
|
31455 | return group(indent(fill(parts)));
|
31456 | }
|
31457 | case "value-paren_group": {
|
31458 | const parentNode = path.getParentNode();
|
31459 | if (parentNode && isURLFunctionNode(parentNode) && (node.groups.length === 1 || node.groups.length > 0 && node.groups[0].type === "value-comma_group" && node.groups[0].groups.length > 0 && node.groups[0].groups[0].type === "value-word" && node.groups[0].groups[0].value.startsWith("data:"))) {
|
31460 | return [node.open ? print("open") : "", join(",", path.map(print, "groups")), node.close ? print("close") : ""];
|
31461 | }
|
31462 | if (!node.open) {
|
31463 | const printed2 = path.map(print, "groups");
|
31464 | const res = [];
|
31465 | for (let i = 0; i < printed2.length; i++) {
|
31466 | if (i !== 0) {
|
31467 | res.push([",", line]);
|
31468 | }
|
31469 | res.push(printed2[i]);
|
31470 | }
|
31471 | return group(indent(fill(res)));
|
31472 | }
|
31473 | const isSCSSMapItem = isSCSSMapItemNode(path);
|
31474 | const lastItem = getLast(node.groups);
|
31475 | const isLastItemComment = lastItem && lastItem.type === "value-comment";
|
31476 | const isKey = isKeyInValuePairNode(node, parentNode);
|
31477 | const isConfiguration = isConfigurationNode(node, parentNode);
|
31478 | const shouldBreak = isConfiguration || isSCSSMapItem && !isKey;
|
31479 | const shouldDedent = isConfiguration || isKey;
|
31480 | const printed = group([node.open ? print("open") : "", indent([softline, join([line], path.map((childPath, index) => {
|
31481 | const child = childPath.getValue();
|
31482 | const isLast = index === node.groups.length - 1;
|
31483 | const printed2 = [print(), isLast ? "" : ","];
|
31484 | if (isKeyValuePairNode(child) && child.type === "value-comma_group" && child.groups && child.groups[0].type !== "value-paren_group" && child.groups[2] && child.groups[2].type === "value-paren_group") {
|
31485 | const parts = getDocParts(printed2[0].contents.contents);
|
31486 | parts[1] = group(parts[1]);
|
31487 | return group(dedent(printed2));
|
31488 | }
|
31489 | if (!isLast && child.type === "value-comma_group" && isNonEmptyArray(child.groups)) {
|
31490 | const last = getLast(child.groups);
|
31491 | if (last.source && isNextLineEmpty(options.originalText, last, locEnd)) {
|
31492 | printed2.push(hardline);
|
31493 | }
|
31494 | }
|
31495 | return printed2;
|
31496 | }, "groups"))]), ifBreak(!isLastItemComment && isSCSS(options.parser, options.originalText) && isSCSSMapItem && shouldPrintComma(options) ? "," : ""), softline, node.close ? print("close") : ""], {
|
31497 | shouldBreak
|
31498 | });
|
31499 | return shouldDedent ? dedent(printed) : printed;
|
31500 | }
|
31501 | case "value-func": {
|
31502 | return [node.value, insideAtRuleNode(path, "supports") && isMediaAndSupportsKeywords(node) ? " " : "", print("group")];
|
31503 | }
|
31504 | case "value-paren": {
|
31505 | return node.value;
|
31506 | }
|
31507 | case "value-number": {
|
31508 | return [printCssNumber(node.value), printUnit(node.unit)];
|
31509 | }
|
31510 | case "value-operator": {
|
31511 | return node.value;
|
31512 | }
|
31513 | case "value-word": {
|
31514 | if (node.isColor && node.isHex || isWideKeywords(node.value)) {
|
31515 | return node.value.toLowerCase();
|
31516 | }
|
31517 | return node.value;
|
31518 | }
|
31519 | case "value-colon": {
|
31520 | const parentNode = path.getParentNode();
|
31521 | const index = parentNode && parentNode.groups.indexOf(node);
|
31522 | const prevNode = index && parentNode.groups[index - 1];
|
31523 | return [node.value, prevNode && typeof prevNode.value === "string" && getLast(prevNode.value) === "\\" || insideValueFunctionNode(path, "url") ? "" : line];
|
31524 | }
|
31525 | case "value-comma": {
|
31526 | return [node.value, " "];
|
31527 | }
|
31528 | case "value-string": {
|
31529 | return printString(node.raws.quote + node.value + node.raws.quote, options);
|
31530 | }
|
31531 | case "value-atword": {
|
31532 | return ["@", node.value];
|
31533 | }
|
31534 | case "value-unicode-range": {
|
31535 | return node.value;
|
31536 | }
|
31537 | case "value-unknown": {
|
31538 | return node.value;
|
31539 | }
|
31540 | default:
|
31541 | throw new Error(`Unknown postcss type ${JSON.stringify(node.type)}`);
|
31542 | }
|
31543 | }
|
31544 | function printNodeSequence(path, options, print) {
|
31545 | const parts = [];
|
31546 | path.each((pathChild, i, nodes) => {
|
31547 | const prevNode = nodes[i - 1];
|
31548 | if (prevNode && prevNode.type === "css-comment" && prevNode.text.trim() === "prettier-ignore") {
|
31549 | const childNode = pathChild.getValue();
|
31550 | parts.push(options.originalText.slice(locStart(childNode), locEnd(childNode)));
|
31551 | } else {
|
31552 | parts.push(print());
|
31553 | }
|
31554 | if (i !== nodes.length - 1) {
|
31555 | if (nodes[i + 1].type === "css-comment" && !hasNewline(options.originalText, locStart(nodes[i + 1]), {
|
31556 | backwards: true
|
31557 | }) && !isFrontMatterNode(nodes[i]) || nodes[i + 1].type === "css-atrule" && nodes[i + 1].name === "else" && nodes[i].type !== "css-comment") {
|
31558 | parts.push(" ");
|
31559 | } else {
|
31560 | parts.push(options.__isHTMLStyleAttribute ? line : hardline);
|
31561 | if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd) && !isFrontMatterNode(nodes[i])) {
|
31562 | parts.push(hardline);
|
31563 | }
|
31564 | }
|
31565 | }
|
31566 | }, "nodes");
|
31567 | return parts;
|
31568 | }
|
31569 | var STRING_REGEX = /(["'])(?:(?!\1)[^\\]|\\.)*\1/gs;
|
31570 | var NUMBER_REGEX = /(?:\d*\.\d+|\d+\.?)(?:[Ee][+-]?\d+)?/g;
|
31571 | var STANDARD_UNIT_REGEX = /[A-Za-z]+/g;
|
31572 | var WORD_PART_REGEX = /[$@]?[A-Z_a-z\u0080-\uFFFF][\w\u0080-\uFFFF-]*/g;
|
31573 | var ADJUST_NUMBERS_REGEX = new RegExp(STRING_REGEX.source + `|(${WORD_PART_REGEX.source})?(${NUMBER_REGEX.source})(${STANDARD_UNIT_REGEX.source})?`, "g");
|
31574 | function adjustStrings(value, options) {
|
31575 | return value.replace(STRING_REGEX, (match) => printString(match, options));
|
31576 | }
|
31577 | function quoteAttributeValue(value, options) {
|
31578 | const quote = options.singleQuote ? "'" : '"';
|
31579 | return value.includes('"') || value.includes("'") ? value : quote + value + quote;
|
31580 | }
|
31581 | function adjustNumbers(value) {
|
31582 | return value.replace(ADJUST_NUMBERS_REGEX, (match, quote, wordPart, number, unit) => !wordPart && number ? printCssNumber(number) + maybeToLowerCase(unit || "") : match);
|
31583 | }
|
31584 | function printCssNumber(rawNumber) {
|
31585 | return printNumber(rawNumber).replace(/\.0(?=$|e)/, "");
|
31586 | }
|
31587 | module2.exports = {
|
31588 | print: genericPrint,
|
31589 | embed,
|
31590 | insertPragma,
|
31591 | massageAstNode: clean
|
31592 | };
|
31593 | }
|
31594 | });
|
31595 | var require_options3 = __commonJS2({
|
31596 | "src/language-css/options.js"(exports2, module2) {
|
31597 | "use strict";
|
31598 | var commonOptions = require_common_options();
|
31599 | module2.exports = {
|
31600 | singleQuote: commonOptions.singleQuote
|
31601 | };
|
31602 | }
|
31603 | });
|
31604 | var require_parsers2 = __commonJS2({
|
31605 | "src/language-css/parsers.js"(exports2, module2) {
|
31606 | "use strict";
|
31607 | module2.exports = {
|
31608 | get css() {
|
31609 | return require("./parser-postcss.js").parsers.css;
|
31610 | },
|
31611 | get less() {
|
31612 | return require("./parser-postcss.js").parsers.less;
|
31613 | },
|
31614 | get scss() {
|
31615 | return require("./parser-postcss.js").parsers.scss;
|
31616 | }
|
31617 | };
|
31618 | }
|
31619 | });
|
31620 | var require_CSS = __commonJS2({
|
31621 | "node_modules/linguist-languages/data/CSS.json"(exports2, module2) {
|
31622 | module2.exports = {
|
31623 | name: "CSS",
|
31624 | type: "markup",
|
31625 | tmScope: "source.css",
|
31626 | aceMode: "css",
|
31627 | codemirrorMode: "css",
|
31628 | codemirrorMimeType: "text/css",
|
31629 | color: "#563d7c",
|
31630 | extensions: [".css"],
|
31631 | languageId: 50
|
31632 | };
|
31633 | }
|
31634 | });
|
31635 | var require_PostCSS = __commonJS2({
|
31636 | "node_modules/linguist-languages/data/PostCSS.json"(exports2, module2) {
|
31637 | module2.exports = {
|
31638 | name: "PostCSS",
|
31639 | type: "markup",
|
31640 | color: "#dc3a0c",
|
31641 | tmScope: "source.postcss",
|
31642 | group: "CSS",
|
31643 | extensions: [".pcss", ".postcss"],
|
31644 | aceMode: "text",
|
31645 | languageId: 262764437
|
31646 | };
|
31647 | }
|
31648 | });
|
31649 | var require_Less = __commonJS2({
|
31650 | "node_modules/linguist-languages/data/Less.json"(exports2, module2) {
|
31651 | module2.exports = {
|
31652 | name: "Less",
|
31653 | type: "markup",
|
31654 | color: "#1d365d",
|
31655 | aliases: ["less-css"],
|
31656 | extensions: [".less"],
|
31657 | tmScope: "source.css.less",
|
31658 | aceMode: "less",
|
31659 | codemirrorMode: "css",
|
31660 | codemirrorMimeType: "text/css",
|
31661 | languageId: 198
|
31662 | };
|
31663 | }
|
31664 | });
|
31665 | var require_SCSS = __commonJS2({
|
31666 | "node_modules/linguist-languages/data/SCSS.json"(exports2, module2) {
|
31667 | module2.exports = {
|
31668 | name: "SCSS",
|
31669 | type: "markup",
|
31670 | color: "#c6538c",
|
31671 | tmScope: "source.css.scss",
|
31672 | aceMode: "scss",
|
31673 | codemirrorMode: "css",
|
31674 | codemirrorMimeType: "text/x-scss",
|
31675 | extensions: [".scss"],
|
31676 | languageId: 329
|
31677 | };
|
31678 | }
|
31679 | });
|
31680 | var require_language_css = __commonJS2({
|
31681 | "src/language-css/index.js"(exports2, module2) {
|
31682 | "use strict";
|
31683 | var createLanguage = require_create_language();
|
31684 | var printer = require_printer_postcss();
|
31685 | var options = require_options3();
|
31686 | var parsers = require_parsers2();
|
31687 | var languages = [createLanguage(require_CSS(), (data) => ({
|
31688 | since: "1.4.0",
|
31689 | parsers: ["css"],
|
31690 | vscodeLanguageIds: ["css"],
|
31691 | extensions: [...data.extensions, ".wxss"]
|
31692 | })), createLanguage(require_PostCSS(), () => ({
|
31693 | since: "1.4.0",
|
31694 | parsers: ["css"],
|
31695 | vscodeLanguageIds: ["postcss"]
|
31696 | })), createLanguage(require_Less(), () => ({
|
31697 | since: "1.4.0",
|
31698 | parsers: ["less"],
|
31699 | vscodeLanguageIds: ["less"]
|
31700 | })), createLanguage(require_SCSS(), () => ({
|
31701 | since: "1.4.0",
|
31702 | parsers: ["scss"],
|
31703 | vscodeLanguageIds: ["scss"]
|
31704 | }))];
|
31705 | var printers = {
|
31706 | postcss: printer
|
31707 | };
|
31708 | module2.exports = {
|
31709 | languages,
|
31710 | options,
|
31711 | printers,
|
31712 | parsers
|
31713 | };
|
31714 | }
|
31715 | });
|
31716 | var require_loc3 = __commonJS2({
|
31717 | "src/language-handlebars/loc.js"(exports2, module2) {
|
31718 | "use strict";
|
31719 | function locStart(node) {
|
31720 | return node.loc.start.offset;
|
31721 | }
|
31722 | function locEnd(node) {
|
31723 | return node.loc.end.offset;
|
31724 | }
|
31725 | module2.exports = {
|
31726 | locStart,
|
31727 | locEnd
|
31728 | };
|
31729 | }
|
31730 | });
|
31731 | var require_clean3 = __commonJS2({
|
31732 | "src/language-handlebars/clean.js"(exports2, module2) {
|
31733 | "use strict";
|
31734 | function clean(ast, newNode) {
|
31735 | if (ast.type === "TextNode") {
|
31736 | const trimmed = ast.chars.trim();
|
31737 | if (!trimmed) {
|
31738 | return null;
|
31739 | }
|
31740 | newNode.chars = trimmed.replace(/[\t\n\f\r ]+/g, " ");
|
31741 | }
|
31742 | if (ast.type === "AttrNode" && ast.name.toLowerCase() === "class") {
|
31743 | delete newNode.value;
|
31744 | }
|
31745 | }
|
31746 | clean.ignoredProperties = new Set(["loc", "selfClosing"]);
|
31747 | module2.exports = clean;
|
31748 | }
|
31749 | });
|
31750 | var require_html_void_elements = __commonJS2({
|
31751 | "vendors/html-void-elements.json"(exports2, module2) {
|
31752 | module2.exports = {
|
31753 | htmlVoidElements: ["area", "base", "basefont", "bgsound", "br", "col", "command", "embed", "frame", "hr", "image", "img", "input", "isindex", "keygen", "link", "menuitem", "meta", "nextid", "param", "source", "track", "wbr"]
|
31754 | };
|
31755 | }
|
31756 | });
|
31757 | var require_utils9 = __commonJS2({
|
31758 | "src/language-handlebars/utils.js"(exports2, module2) {
|
31759 | "use strict";
|
31760 | var {
|
31761 | htmlVoidElements
|
31762 | } = require_html_void_elements();
|
31763 | var getLast = require_get_last();
|
31764 | function isLastNodeOfSiblings(path) {
|
31765 | const node = path.getValue();
|
31766 | const parentNode = path.getParentNode(0);
|
31767 | if (isParentOfSomeType(path, ["ElementNode"]) && getLast(parentNode.children) === node) {
|
31768 | return true;
|
31769 | }
|
31770 | if (isParentOfSomeType(path, ["Block"]) && getLast(parentNode.body) === node) {
|
31771 | return true;
|
31772 | }
|
31773 | return false;
|
31774 | }
|
31775 | function isUppercase(string) {
|
31776 | return string.toUpperCase() === string;
|
31777 | }
|
31778 | function isGlimmerComponent(node) {
|
31779 | return isNodeOfSomeType(node, ["ElementNode"]) && typeof node.tag === "string" && !node.tag.startsWith(":") && (isUppercase(node.tag[0]) || node.tag.includes("."));
|
31780 | }
|
31781 | var voidTags = new Set(htmlVoidElements);
|
31782 | function isVoid(node) {
|
31783 | return voidTags.has(node.tag) || isGlimmerComponent(node) && node.children.every((node2) => isWhitespaceNode(node2));
|
31784 | }
|
31785 | function isWhitespaceNode(node) {
|
31786 | return isNodeOfSomeType(node, ["TextNode"]) && !/\S/.test(node.chars);
|
31787 | }
|
31788 | function isNodeOfSomeType(node, types) {
|
31789 | return node && types.includes(node.type);
|
31790 | }
|
31791 | function isParentOfSomeType(path, types) {
|
31792 | const parentNode = path.getParentNode(0);
|
31793 | return isNodeOfSomeType(parentNode, types);
|
31794 | }
|
31795 | function isPreviousNodeOfSomeType(path, types) {
|
31796 | const previousNode = getPreviousNode(path);
|
31797 | return isNodeOfSomeType(previousNode, types);
|
31798 | }
|
31799 | function isNextNodeOfSomeType(path, types) {
|
31800 | const nextNode = getNextNode(path);
|
31801 | return isNodeOfSomeType(nextNode, types);
|
31802 | }
|
31803 | function getSiblingNode(path, offset) {
|
31804 | var _path$getParentNode2, _ref7, _ref8, _parentNode$children;
|
31805 | const node = path.getValue();
|
31806 | const parentNode = (_path$getParentNode2 = path.getParentNode(0)) !== null && _path$getParentNode2 !== void 0 ? _path$getParentNode2 : {};
|
31807 | const children = (_ref7 = (_ref8 = (_parentNode$children = parentNode.children) !== null && _parentNode$children !== void 0 ? _parentNode$children : parentNode.body) !== null && _ref8 !== void 0 ? _ref8 : parentNode.parts) !== null && _ref7 !== void 0 ? _ref7 : [];
|
31808 | const index = children.indexOf(node);
|
31809 | return index !== -1 && children[index + offset];
|
31810 | }
|
31811 | function getPreviousNode(path, lookBack = 1) {
|
31812 | return getSiblingNode(path, -lookBack);
|
31813 | }
|
31814 | function getNextNode(path) {
|
31815 | return getSiblingNode(path, 1);
|
31816 | }
|
31817 | function isPrettierIgnoreNode(node) {
|
31818 | return isNodeOfSomeType(node, ["MustacheCommentStatement"]) && typeof node.value === "string" && node.value.trim() === "prettier-ignore";
|
31819 | }
|
31820 | function hasPrettierIgnore(path) {
|
31821 | const node = path.getValue();
|
31822 | const previousPreviousNode = getPreviousNode(path, 2);
|
31823 | return isPrettierIgnoreNode(node) || isPrettierIgnoreNode(previousPreviousNode);
|
31824 | }
|
31825 | module2.exports = {
|
31826 | getNextNode,
|
31827 | getPreviousNode,
|
31828 | hasPrettierIgnore,
|
31829 | isLastNodeOfSiblings,
|
31830 | isNextNodeOfSomeType,
|
31831 | isNodeOfSomeType,
|
31832 | isParentOfSomeType,
|
31833 | isPreviousNodeOfSomeType,
|
31834 | isVoid,
|
31835 | isWhitespaceNode
|
31836 | };
|
31837 | }
|
31838 | });
|
31839 | var require_printer_glimmer = __commonJS2({
|
31840 | "src/language-handlebars/printer-glimmer.js"(exports2, module2) {
|
31841 | "use strict";
|
31842 | var {
|
31843 | builders: {
|
31844 | dedent,
|
31845 | fill,
|
31846 | group,
|
31847 | hardline,
|
31848 | ifBreak,
|
31849 | indent,
|
31850 | join,
|
31851 | line,
|
31852 | softline
|
31853 | },
|
31854 | utils: {
|
31855 | getDocParts,
|
31856 | replaceTextEndOfLine
|
31857 | }
|
31858 | } = require("./doc.js");
|
31859 | var {
|
31860 | getPreferredQuote,
|
31861 | isNonEmptyArray
|
31862 | } = require_util();
|
31863 | var {
|
31864 | locStart,
|
31865 | locEnd
|
31866 | } = require_loc3();
|
31867 | var clean = require_clean3();
|
31868 | var {
|
31869 | getNextNode,
|
31870 | getPreviousNode,
|
31871 | hasPrettierIgnore,
|
31872 | isLastNodeOfSiblings,
|
31873 | isNextNodeOfSomeType,
|
31874 | isNodeOfSomeType,
|
31875 | isParentOfSomeType,
|
31876 | isPreviousNodeOfSomeType,
|
31877 | isVoid,
|
31878 | isWhitespaceNode
|
31879 | } = require_utils9();
|
31880 | var NEWLINES_TO_PRESERVE_MAX = 2;
|
31881 | function print(path, options, print2) {
|
31882 | const node = path.getValue();
|
31883 | if (!node) {
|
31884 | return "";
|
31885 | }
|
31886 | if (hasPrettierIgnore(path)) {
|
31887 | return options.originalText.slice(locStart(node), locEnd(node));
|
31888 | }
|
31889 | const favoriteQuote = options.singleQuote ? "'" : '"';
|
31890 | switch (node.type) {
|
31891 | case "Block":
|
31892 | case "Program":
|
31893 | case "Template": {
|
31894 | return group(path.map(print2, "body"));
|
31895 | }
|
31896 | case "ElementNode": {
|
31897 | const startingTag = group(printStartingTag(path, print2));
|
31898 | const escapeNextElementNode = options.htmlWhitespaceSensitivity === "ignore" && isNextNodeOfSomeType(path, ["ElementNode"]) ? softline : "";
|
31899 | if (isVoid(node)) {
|
31900 | return [startingTag, escapeNextElementNode];
|
31901 | }
|
31902 | const endingTag = ["</", node.tag, ">"];
|
31903 | if (node.children.length === 0) {
|
31904 | return [startingTag, indent(endingTag), escapeNextElementNode];
|
31905 | }
|
31906 | if (options.htmlWhitespaceSensitivity === "ignore") {
|
31907 | return [startingTag, indent(printChildren(path, options, print2)), hardline, indent(endingTag), escapeNextElementNode];
|
31908 | }
|
31909 | return [startingTag, indent(group(printChildren(path, options, print2))), indent(endingTag), escapeNextElementNode];
|
31910 | }
|
31911 | case "BlockStatement": {
|
31912 | const pp = path.getParentNode(1);
|
31913 | const isElseIfLike = pp && pp.inverse && pp.inverse.body.length === 1 && pp.inverse.body[0] === node && pp.inverse.body[0].path.parts[0] === pp.path.parts[0];
|
31914 | if (isElseIfLike) {
|
31915 | return [printElseIfLikeBlock(path, print2, pp.inverse.body[0].path.parts[0]), printProgram(path, print2, options), printInverse(path, print2, options)];
|
31916 | }
|
31917 | return [printOpenBlock(path, print2), group([printProgram(path, print2, options), printInverse(path, print2, options), printCloseBlock(path, print2, options)])];
|
31918 | }
|
31919 | case "ElementModifierStatement": {
|
31920 | return group(["{{", printPathAndParams(path, print2), "}}"]);
|
31921 | }
|
31922 | case "MustacheStatement": {
|
31923 | return group([printOpeningMustache(node), printPathAndParams(path, print2), printClosingMustache(node)]);
|
31924 | }
|
31925 | case "SubExpression": {
|
31926 | return group(["(", printSubExpressionPathAndParams(path, print2), softline, ")"]);
|
31927 | }
|
31928 | case "AttrNode": {
|
31929 | const isText = node.value.type === "TextNode";
|
31930 | const isEmptyText = isText && node.value.chars === "";
|
31931 | if (isEmptyText && locStart(node.value) === locEnd(node.value)) {
|
31932 | return node.name;
|
31933 | }
|
31934 | const quote = isText ? getPreferredQuote(node.value.chars, favoriteQuote).quote : node.value.type === "ConcatStatement" ? getPreferredQuote(node.value.parts.filter((part) => part.type === "TextNode").map((part) => part.chars).join(""), favoriteQuote).quote : "";
|
31935 | const valueDoc = print2("value");
|
31936 | return [node.name, "=", quote, node.name === "class" && quote ? group(indent(valueDoc)) : valueDoc, quote];
|
31937 | }
|
31938 | case "ConcatStatement": {
|
31939 | return path.map(print2, "parts");
|
31940 | }
|
31941 | case "Hash": {
|
31942 | return join(line, path.map(print2, "pairs"));
|
31943 | }
|
31944 | case "HashPair": {
|
31945 | return [node.key, "=", print2("value")];
|
31946 | }
|
31947 | case "TextNode": {
|
31948 | let text = node.chars.replace(/{{/g, "\\{{");
|
31949 | const attrName = getCurrentAttributeName(path);
|
31950 | if (attrName) {
|
31951 | if (attrName === "class") {
|
31952 | const formattedClasses = text.trim().split(/\s+/).join(" ");
|
31953 | let leadingSpace2 = false;
|
31954 | let trailingSpace2 = false;
|
31955 | if (isParentOfSomeType(path, ["ConcatStatement"])) {
|
31956 | if (isPreviousNodeOfSomeType(path, ["MustacheStatement"]) && /^\s/.test(text)) {
|
31957 | leadingSpace2 = true;
|
31958 | }
|
31959 | if (isNextNodeOfSomeType(path, ["MustacheStatement"]) && /\s$/.test(text) && formattedClasses !== "") {
|
31960 | trailingSpace2 = true;
|
31961 | }
|
31962 | }
|
31963 | return [leadingSpace2 ? line : "", formattedClasses, trailingSpace2 ? line : ""];
|
31964 | }
|
31965 | return replaceTextEndOfLine(text);
|
31966 | }
|
31967 | const whitespacesOnlyRE = /^[\t\n\f\r ]*$/;
|
31968 | const isWhitespaceOnly = whitespacesOnlyRE.test(text);
|
31969 | const isFirstElement = !getPreviousNode(path);
|
31970 | const isLastElement = !getNextNode(path);
|
31971 | if (options.htmlWhitespaceSensitivity !== "ignore") {
|
31972 | const leadingWhitespacesRE = /^[\t\n\f\r ]*/;
|
31973 | const trailingWhitespacesRE = /[\t\n\f\r ]*$/;
|
31974 | const shouldTrimTrailingNewlines = isLastElement && isParentOfSomeType(path, ["Template"]);
|
31975 | const shouldTrimLeadingNewlines = isFirstElement && isParentOfSomeType(path, ["Template"]);
|
31976 | if (isWhitespaceOnly) {
|
31977 | if (shouldTrimLeadingNewlines || shouldTrimTrailingNewlines) {
|
31978 | return "";
|
31979 | }
|
31980 | let breaks = [line];
|
31981 | const newlines = countNewLines(text);
|
31982 | if (newlines) {
|
31983 | breaks = generateHardlines(newlines);
|
31984 | }
|
31985 | if (isLastNodeOfSiblings(path)) {
|
31986 | breaks = breaks.map((newline) => dedent(newline));
|
31987 | }
|
31988 | return breaks;
|
31989 | }
|
31990 | const [lead] = text.match(leadingWhitespacesRE);
|
31991 | const [tail] = text.match(trailingWhitespacesRE);
|
31992 | let leadBreaks = [];
|
31993 | if (lead) {
|
31994 | leadBreaks = [line];
|
31995 | const leadingNewlines = countNewLines(lead);
|
31996 | if (leadingNewlines) {
|
31997 | leadBreaks = generateHardlines(leadingNewlines);
|
31998 | }
|
31999 | text = text.replace(leadingWhitespacesRE, "");
|
32000 | }
|
32001 | let trailBreaks = [];
|
32002 | if (tail) {
|
32003 | if (!shouldTrimTrailingNewlines) {
|
32004 | trailBreaks = [line];
|
32005 | const trailingNewlines = countNewLines(tail);
|
32006 | if (trailingNewlines) {
|
32007 | trailBreaks = generateHardlines(trailingNewlines);
|
32008 | }
|
32009 | if (isLastNodeOfSiblings(path)) {
|
32010 | trailBreaks = trailBreaks.map((hardline2) => dedent(hardline2));
|
32011 | }
|
32012 | }
|
32013 | text = text.replace(trailingWhitespacesRE, "");
|
32014 | }
|
32015 | return [...leadBreaks, fill(getTextValueParts(text)), ...trailBreaks];
|
32016 | }
|
32017 | const lineBreaksCount = countNewLines(text);
|
32018 | let leadingLineBreaksCount = countLeadingNewLines(text);
|
32019 | let trailingLineBreaksCount = countTrailingNewLines(text);
|
32020 | if ((isFirstElement || isLastElement) && isWhitespaceOnly && isParentOfSomeType(path, ["Block", "ElementNode", "Template"])) {
|
32021 | return "";
|
32022 | }
|
32023 | if (isWhitespaceOnly && lineBreaksCount) {
|
32024 | leadingLineBreaksCount = Math.min(lineBreaksCount, NEWLINES_TO_PRESERVE_MAX);
|
32025 | trailingLineBreaksCount = 0;
|
32026 | } else {
|
32027 | if (isNextNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
|
32028 | trailingLineBreaksCount = Math.max(trailingLineBreaksCount, 1);
|
32029 | }
|
32030 | if (isPreviousNodeOfSomeType(path, ["BlockStatement", "ElementNode"])) {
|
32031 | leadingLineBreaksCount = Math.max(leadingLineBreaksCount, 1);
|
32032 | }
|
32033 | }
|
32034 | let leadingSpace = "";
|
32035 | let trailingSpace = "";
|
32036 | if (trailingLineBreaksCount === 0 && isNextNodeOfSomeType(path, ["MustacheStatement"])) {
|
32037 | trailingSpace = " ";
|
32038 | }
|
32039 | if (leadingLineBreaksCount === 0 && isPreviousNodeOfSomeType(path, ["MustacheStatement"])) {
|
32040 | leadingSpace = " ";
|
32041 | }
|
32042 | if (isFirstElement) {
|
32043 | leadingLineBreaksCount = 0;
|
32044 | leadingSpace = "";
|
32045 | }
|
32046 | if (isLastElement) {
|
32047 | trailingLineBreaksCount = 0;
|
32048 | trailingSpace = "";
|
32049 | }
|
32050 | text = text.replace(/^[\t\n\f\r ]+/g, leadingSpace).replace(/[\t\n\f\r ]+$/, trailingSpace);
|
32051 | return [...generateHardlines(leadingLineBreaksCount), fill(getTextValueParts(text)), ...generateHardlines(trailingLineBreaksCount)];
|
32052 | }
|
32053 | case "MustacheCommentStatement": {
|
32054 | const start = locStart(node);
|
32055 | const end = locEnd(node);
|
32056 | const isLeftWhiteSpaceSensitive = options.originalText.charAt(start + 2) === "~";
|
32057 | const isRightWhitespaceSensitive = options.originalText.charAt(end - 3) === "~";
|
32058 | const dashes = node.value.includes("}}") ? "--" : "";
|
32059 | return ["{{", isLeftWhiteSpaceSensitive ? "~" : "", "!", dashes, node.value, dashes, isRightWhitespaceSensitive ? "~" : "", "}}"];
|
32060 | }
|
32061 | case "PathExpression": {
|
32062 | return node.original;
|
32063 | }
|
32064 | case "BooleanLiteral": {
|
32065 | return String(node.value);
|
32066 | }
|
32067 | case "CommentStatement": {
|
32068 | return ["<!--", node.value, "-->"];
|
32069 | }
|
32070 | case "StringLiteral": {
|
32071 | if (needsOppositeQuote(path)) {
|
32072 | const printFavoriteQuote = !options.singleQuote ? "'" : '"';
|
32073 | return printStringLiteral(node.value, printFavoriteQuote);
|
32074 | }
|
32075 | return printStringLiteral(node.value, favoriteQuote);
|
32076 | }
|
32077 | case "NumberLiteral": {
|
32078 | return String(node.value);
|
32079 | }
|
32080 | case "UndefinedLiteral": {
|
32081 | return "undefined";
|
32082 | }
|
32083 | case "NullLiteral": {
|
32084 | return "null";
|
32085 | }
|
32086 | default:
|
32087 | throw new Error("unknown glimmer type: " + JSON.stringify(node.type));
|
32088 | }
|
32089 | }
|
32090 | function sortByLoc(a, b) {
|
32091 | return locStart(a) - locStart(b);
|
32092 | }
|
32093 | function printStartingTag(path, print2) {
|
32094 | const node = path.getValue();
|
32095 | const types = ["attributes", "modifiers", "comments"].filter((property) => isNonEmptyArray(node[property]));
|
32096 | const attributes = types.flatMap((type) => node[type]).sort(sortByLoc);
|
32097 | for (const attributeType of types) {
|
32098 | path.each((attributePath) => {
|
32099 | const index = attributes.indexOf(attributePath.getValue());
|
32100 | attributes.splice(index, 1, [line, print2()]);
|
32101 | }, attributeType);
|
32102 | }
|
32103 | if (isNonEmptyArray(node.blockParams)) {
|
32104 | attributes.push(line, printBlockParams(node));
|
32105 | }
|
32106 | return ["<", node.tag, indent(attributes), printStartingTagEndMarker(node)];
|
32107 | }
|
32108 | function printChildren(path, options, print2) {
|
32109 | const node = path.getValue();
|
32110 | const isEmpty = node.children.every((node2) => isWhitespaceNode(node2));
|
32111 | if (options.htmlWhitespaceSensitivity === "ignore" && isEmpty) {
|
32112 | return "";
|
32113 | }
|
32114 | return path.map((childPath, childIndex) => {
|
32115 | const printedChild = print2();
|
32116 | if (childIndex === 0 && options.htmlWhitespaceSensitivity === "ignore") {
|
32117 | return [softline, printedChild];
|
32118 | }
|
32119 | return printedChild;
|
32120 | }, "children");
|
32121 | }
|
32122 | function printStartingTagEndMarker(node) {
|
32123 | if (isVoid(node)) {
|
32124 | return ifBreak([softline, "/>"], [" />", softline]);
|
32125 | }
|
32126 | return ifBreak([softline, ">"], ">");
|
32127 | }
|
32128 | function printOpeningMustache(node) {
|
32129 | const mustache = node.escaped === false ? "{{{" : "{{";
|
32130 | const strip = node.strip && node.strip.open ? "~" : "";
|
32131 | return [mustache, strip];
|
32132 | }
|
32133 | function printClosingMustache(node) {
|
32134 | const mustache = node.escaped === false ? "}}}" : "}}";
|
32135 | const strip = node.strip && node.strip.close ? "~" : "";
|
32136 | return [strip, mustache];
|
32137 | }
|
32138 | function printOpeningBlockOpeningMustache(node) {
|
32139 | const opening = printOpeningMustache(node);
|
32140 | const strip = node.openStrip.open ? "~" : "";
|
32141 | return [opening, strip, "#"];
|
32142 | }
|
32143 | function printOpeningBlockClosingMustache(node) {
|
32144 | const closing = printClosingMustache(node);
|
32145 | const strip = node.openStrip.close ? "~" : "";
|
32146 | return [strip, closing];
|
32147 | }
|
32148 | function printClosingBlockOpeningMustache(node) {
|
32149 | const opening = printOpeningMustache(node);
|
32150 | const strip = node.closeStrip.open ? "~" : "";
|
32151 | return [opening, strip, "/"];
|
32152 | }
|
32153 | function printClosingBlockClosingMustache(node) {
|
32154 | const closing = printClosingMustache(node);
|
32155 | const strip = node.closeStrip.close ? "~" : "";
|
32156 | return [strip, closing];
|
32157 | }
|
32158 | function printInverseBlockOpeningMustache(node) {
|
32159 | const opening = printOpeningMustache(node);
|
32160 | const strip = node.inverseStrip.open ? "~" : "";
|
32161 | return [opening, strip];
|
32162 | }
|
32163 | function printInverseBlockClosingMustache(node) {
|
32164 | const closing = printClosingMustache(node);
|
32165 | const strip = node.inverseStrip.close ? "~" : "";
|
32166 | return [strip, closing];
|
32167 | }
|
32168 | function printOpenBlock(path, print2) {
|
32169 | const node = path.getValue();
|
32170 | const openingMustache = printOpeningBlockOpeningMustache(node);
|
32171 | const closingMustache = printOpeningBlockClosingMustache(node);
|
32172 | const attributes = [printPath(path, print2)];
|
32173 | const params = printParams(path, print2);
|
32174 | if (params) {
|
32175 | attributes.push(line, params);
|
32176 | }
|
32177 | if (isNonEmptyArray(node.program.blockParams)) {
|
32178 | const block = printBlockParams(node.program);
|
32179 | attributes.push(line, block);
|
32180 | }
|
32181 | return group([openingMustache, indent(attributes), softline, closingMustache]);
|
32182 | }
|
32183 | function printElseBlock(node, options) {
|
32184 | return [options.htmlWhitespaceSensitivity === "ignore" ? hardline : "", printInverseBlockOpeningMustache(node), "else", printInverseBlockClosingMustache(node)];
|
32185 | }
|
32186 | function printElseIfLikeBlock(path, print2, ifLikeKeyword) {
|
32187 | const parentNode = path.getParentNode(1);
|
32188 | return [printInverseBlockOpeningMustache(parentNode), "else ", ifLikeKeyword, " ", printParams(path, print2), printInverseBlockClosingMustache(parentNode)];
|
32189 | }
|
32190 | function printCloseBlock(path, print2, options) {
|
32191 | const node = path.getValue();
|
32192 | if (options.htmlWhitespaceSensitivity === "ignore") {
|
32193 | const escape = blockStatementHasOnlyWhitespaceInProgram(node) ? softline : hardline;
|
32194 | return [escape, printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
|
32195 | }
|
32196 | return [printClosingBlockOpeningMustache(node), print2("path"), printClosingBlockClosingMustache(node)];
|
32197 | }
|
32198 | function blockStatementHasOnlyWhitespaceInProgram(node) {
|
32199 | return isNodeOfSomeType(node, ["BlockStatement"]) && node.program.body.every((node2) => isWhitespaceNode(node2));
|
32200 | }
|
32201 | function blockStatementHasElseIfLike(node) {
|
32202 | return blockStatementHasElse(node) && node.inverse.body.length === 1 && isNodeOfSomeType(node.inverse.body[0], ["BlockStatement"]) && node.inverse.body[0].path.parts[0] === node.path.parts[0];
|
32203 | }
|
32204 | function blockStatementHasElse(node) {
|
32205 | return isNodeOfSomeType(node, ["BlockStatement"]) && node.inverse;
|
32206 | }
|
32207 | function printProgram(path, print2, options) {
|
32208 | const node = path.getValue();
|
32209 | if (blockStatementHasOnlyWhitespaceInProgram(node)) {
|
32210 | return "";
|
32211 | }
|
32212 | const program = print2("program");
|
32213 | if (options.htmlWhitespaceSensitivity === "ignore") {
|
32214 | return indent([hardline, program]);
|
32215 | }
|
32216 | return indent(program);
|
32217 | }
|
32218 | function printInverse(path, print2, options) {
|
32219 | const node = path.getValue();
|
32220 | const inverse = print2("inverse");
|
32221 | const printed = options.htmlWhitespaceSensitivity === "ignore" ? [hardline, inverse] : inverse;
|
32222 | if (blockStatementHasElseIfLike(node)) {
|
32223 | return printed;
|
32224 | }
|
32225 | if (blockStatementHasElse(node)) {
|
32226 | return [printElseBlock(node, options), indent(printed)];
|
32227 | }
|
32228 | return "";
|
32229 | }
|
32230 | function getTextValueParts(value) {
|
32231 | return getDocParts(join(line, splitByHtmlWhitespace(value)));
|
32232 | }
|
32233 | function splitByHtmlWhitespace(string) {
|
32234 | return string.split(/[\t\n\f\r ]+/);
|
32235 | }
|
32236 | function getCurrentAttributeName(path) {
|
32237 | for (let depth = 0; depth < 2; depth++) {
|
32238 | const parentNode = path.getParentNode(depth);
|
32239 | if (parentNode && parentNode.type === "AttrNode") {
|
32240 | return parentNode.name.toLowerCase();
|
32241 | }
|
32242 | }
|
32243 | }
|
32244 | function countNewLines(string) {
|
32245 | string = typeof string === "string" ? string : "";
|
32246 | return string.split("\n").length - 1;
|
32247 | }
|
32248 | function countLeadingNewLines(string) {
|
32249 | string = typeof string === "string" ? string : "";
|
32250 | const newLines = (string.match(/^([^\S\n\r]*[\n\r])+/g) || [])[0] || "";
|
32251 | return countNewLines(newLines);
|
32252 | }
|
32253 | function countTrailingNewLines(string) {
|
32254 | string = typeof string === "string" ? string : "";
|
32255 | const newLines = (string.match(/([\n\r][^\S\n\r]*)+$/g) || [])[0] || "";
|
32256 | return countNewLines(newLines);
|
32257 | }
|
32258 | function generateHardlines(number = 0) {
|
32259 | return Array.from({
|
32260 | length: Math.min(number, NEWLINES_TO_PRESERVE_MAX)
|
32261 | }).fill(hardline);
|
32262 | }
|
32263 | function printStringLiteral(stringLiteral, favoriteQuote) {
|
32264 | const {
|
32265 | quote,
|
32266 | regex
|
32267 | } = getPreferredQuote(stringLiteral, favoriteQuote);
|
32268 | return [quote, stringLiteral.replace(regex, `\\${quote}`), quote];
|
32269 | }
|
32270 | function needsOppositeQuote(path) {
|
32271 | let index = 0;
|
32272 | let parentNode = path.getParentNode(index);
|
32273 | while (parentNode && isNodeOfSomeType(parentNode, ["SubExpression"])) {
|
32274 | index++;
|
32275 | parentNode = path.getParentNode(index);
|
32276 | }
|
32277 | if (parentNode && isNodeOfSomeType(path.getParentNode(index + 1), ["ConcatStatement"]) && isNodeOfSomeType(path.getParentNode(index + 2), ["AttrNode"])) {
|
32278 | return true;
|
32279 | }
|
32280 | return false;
|
32281 | }
|
32282 | function printSubExpressionPathAndParams(path, print2) {
|
32283 | const printed = printPath(path, print2);
|
32284 | const params = printParams(path, print2);
|
32285 | if (!params) {
|
32286 | return printed;
|
32287 | }
|
32288 | return indent([printed, line, group(params)]);
|
32289 | }
|
32290 | function printPathAndParams(path, print2) {
|
32291 | const p = printPath(path, print2);
|
32292 | const params = printParams(path, print2);
|
32293 | if (!params) {
|
32294 | return p;
|
32295 | }
|
32296 | return [indent([p, line, params]), softline];
|
32297 | }
|
32298 | function printPath(path, print2) {
|
32299 | return print2("path");
|
32300 | }
|
32301 | function printParams(path, print2) {
|
32302 | const node = path.getValue();
|
32303 | const parts = [];
|
32304 | if (node.params.length > 0) {
|
32305 | const params = path.map(print2, "params");
|
32306 | parts.push(...params);
|
32307 | }
|
32308 | if (node.hash && node.hash.pairs.length > 0) {
|
32309 | const hash = print2("hash");
|
32310 | parts.push(hash);
|
32311 | }
|
32312 | if (parts.length === 0) {
|
32313 | return "";
|
32314 | }
|
32315 | return join(line, parts);
|
32316 | }
|
32317 | function printBlockParams(node) {
|
32318 | return ["as |", node.blockParams.join(" "), "|"];
|
32319 | }
|
32320 | module2.exports = {
|
32321 | print,
|
32322 | massageAstNode: clean
|
32323 | };
|
32324 | }
|
32325 | });
|
32326 | var require_parsers3 = __commonJS2({
|
32327 | "src/language-handlebars/parsers.js"(exports2, module2) {
|
32328 | "use strict";
|
32329 | module2.exports = {
|
32330 | get glimmer() {
|
32331 | return require("./parser-glimmer.js").parsers.glimmer;
|
32332 | }
|
32333 | };
|
32334 | }
|
32335 | });
|
32336 | var require_Handlebars = __commonJS2({
|
32337 | "node_modules/linguist-languages/data/Handlebars.json"(exports2, module2) {
|
32338 | module2.exports = {
|
32339 | name: "Handlebars",
|
32340 | type: "markup",
|
32341 | color: "#f7931e",
|
32342 | aliases: ["hbs", "htmlbars"],
|
32343 | extensions: [".handlebars", ".hbs"],
|
32344 | tmScope: "text.html.handlebars",
|
32345 | aceMode: "handlebars",
|
32346 | languageId: 155
|
32347 | };
|
32348 | }
|
32349 | });
|
32350 | var require_language_handlebars = __commonJS2({
|
32351 | "src/language-handlebars/index.js"(exports2, module2) {
|
32352 | "use strict";
|
32353 | var createLanguage = require_create_language();
|
32354 | var printer = require_printer_glimmer();
|
32355 | var parsers = require_parsers3();
|
32356 | var languages = [createLanguage(require_Handlebars(), () => ({
|
32357 | since: "2.3.0",
|
32358 | parsers: ["glimmer"],
|
32359 | vscodeLanguageIds: ["handlebars"]
|
32360 | }))];
|
32361 | var printers = {
|
32362 | glimmer: printer
|
32363 | };
|
32364 | module2.exports = {
|
32365 | languages,
|
32366 | printers,
|
32367 | parsers
|
32368 | };
|
32369 | }
|
32370 | });
|
32371 | var require_pragma3 = __commonJS2({
|
32372 | "src/language-graphql/pragma.js"(exports2, module2) {
|
32373 | "use strict";
|
32374 | function hasPragma(text) {
|
32375 | return /^\s*#[^\S\n]*@(?:format|prettier)\s*(?:\n|$)/.test(text);
|
32376 | }
|
32377 | function insertPragma(text) {
|
32378 | return "# @format\n\n" + text;
|
32379 | }
|
32380 | module2.exports = {
|
32381 | hasPragma,
|
32382 | insertPragma
|
32383 | };
|
32384 | }
|
32385 | });
|
32386 | var require_loc4 = __commonJS2({
|
32387 | "src/language-graphql/loc.js"(exports2, module2) {
|
32388 | "use strict";
|
32389 | function locStart(node) {
|
32390 | if (typeof node.start === "number") {
|
32391 | return node.start;
|
32392 | }
|
32393 | return node.loc && node.loc.start;
|
32394 | }
|
32395 | function locEnd(node) {
|
32396 | if (typeof node.end === "number") {
|
32397 | return node.end;
|
32398 | }
|
32399 | return node.loc && node.loc.end;
|
32400 | }
|
32401 | module2.exports = {
|
32402 | locStart,
|
32403 | locEnd
|
32404 | };
|
32405 | }
|
32406 | });
|
32407 | var require_printer_graphql = __commonJS2({
|
32408 | "src/language-graphql/printer-graphql.js"(exports2, module2) {
|
32409 | "use strict";
|
32410 | var {
|
32411 | builders: {
|
32412 | join,
|
32413 | hardline,
|
32414 | line,
|
32415 | softline,
|
32416 | group,
|
32417 | indent,
|
32418 | ifBreak
|
32419 | }
|
32420 | } = require("./doc.js");
|
32421 | var {
|
32422 | isNextLineEmpty,
|
32423 | isNonEmptyArray
|
32424 | } = require_util();
|
32425 | var {
|
32426 | insertPragma
|
32427 | } = require_pragma3();
|
32428 | var {
|
32429 | locStart,
|
32430 | locEnd
|
32431 | } = require_loc4();
|
32432 | function genericPrint(path, options, print) {
|
32433 | const node = path.getValue();
|
32434 | if (!node) {
|
32435 | return "";
|
32436 | }
|
32437 | if (typeof node === "string") {
|
32438 | return node;
|
32439 | }
|
32440 | switch (node.kind) {
|
32441 | case "Document": {
|
32442 | const parts = [];
|
32443 | path.each((pathChild, index, definitions) => {
|
32444 | parts.push(print());
|
32445 | if (index !== definitions.length - 1) {
|
32446 | parts.push(hardline);
|
32447 | if (isNextLineEmpty(options.originalText, pathChild.getValue(), locEnd)) {
|
32448 | parts.push(hardline);
|
32449 | }
|
32450 | }
|
32451 | }, "definitions");
|
32452 | return [...parts, hardline];
|
32453 | }
|
32454 | case "OperationDefinition": {
|
32455 | const hasOperation = options.originalText[locStart(node)] !== "{";
|
32456 | const hasName = Boolean(node.name);
|
32457 | return [hasOperation ? node.operation : "", hasOperation && hasName ? [" ", print("name")] : "", hasOperation && !hasName && isNonEmptyArray(node.variableDefinitions) ? " " : "", isNonEmptyArray(node.variableDefinitions) ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "variableDefinitions"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? !hasOperation && !hasName ? "" : " " : "", print("selectionSet")];
|
32458 | }
|
32459 | case "FragmentDefinition": {
|
32460 | return ["fragment ", print("name"), isNonEmptyArray(node.variableDefinitions) ? group(["(", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "variableDefinitions"))]), softline, ")"]) : "", " on ", print("typeCondition"), printDirectives(path, print, node), " ", print("selectionSet")];
|
32461 | }
|
32462 | case "SelectionSet": {
|
32463 | return ["{", indent([hardline, join(hardline, printSequence(path, options, print, "selections"))]), hardline, "}"];
|
32464 | }
|
32465 | case "Field": {
|
32466 | return group([node.alias ? [print("alias"), ": "] : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", printDirectives(path, print, node), node.selectionSet ? " " : "", print("selectionSet")]);
|
32467 | }
|
32468 | case "Name": {
|
32469 | return node.value;
|
32470 | }
|
32471 | case "StringValue": {
|
32472 | if (node.block) {
|
32473 | const lines = node.value.replace(/"""/g, "\\$&").split("\n");
|
32474 | if (lines.length === 1) {
|
32475 | lines[0] = lines[0].trim();
|
32476 | }
|
32477 | if (lines.every((line2) => line2 === "")) {
|
32478 | lines.length = 0;
|
32479 | }
|
32480 | return join(hardline, ['"""', ...lines, '"""']);
|
32481 | }
|
32482 | return ['"', node.value.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\n"), '"'];
|
32483 | }
|
32484 | case "IntValue":
|
32485 | case "FloatValue":
|
32486 | case "EnumValue": {
|
32487 | return node.value;
|
32488 | }
|
32489 | case "BooleanValue": {
|
32490 | return node.value ? "true" : "false";
|
32491 | }
|
32492 | case "NullValue": {
|
32493 | return "null";
|
32494 | }
|
32495 | case "Variable": {
|
32496 | return ["$", print("name")];
|
32497 | }
|
32498 | case "ListValue": {
|
32499 | return group(["[", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "values"))]), softline, "]"]);
|
32500 | }
|
32501 | case "ObjectValue": {
|
32502 | return group(["{", options.bracketSpacing && node.fields.length > 0 ? " " : "", indent([softline, join([ifBreak("", ", "), softline], path.map(print, "fields"))]), softline, ifBreak("", options.bracketSpacing && node.fields.length > 0 ? " " : ""), "}"]);
|
32503 | }
|
32504 | case "ObjectField":
|
32505 | case "Argument": {
|
32506 | return [print("name"), ": ", print("value")];
|
32507 | }
|
32508 | case "Directive": {
|
32509 | return ["@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : ""];
|
32510 | }
|
32511 | case "NamedType": {
|
32512 | return print("name");
|
32513 | }
|
32514 | case "VariableDefinition": {
|
32515 | return [print("variable"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
|
32516 | }
|
32517 | case "ObjectTypeExtension":
|
32518 | case "ObjectTypeDefinition": {
|
32519 | return [print("description"), node.description ? hardline : "", node.kind === "ObjectTypeExtension" ? "extend " : "", "type ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
|
32520 | }
|
32521 | case "FieldDefinition": {
|
32522 | return [print("description"), node.description ? hardline : "", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", ": ", print("type"), printDirectives(path, print, node)];
|
32523 | }
|
32524 | case "DirectiveDefinition": {
|
32525 | return [print("description"), node.description ? hardline : "", "directive ", "@", print("name"), node.arguments.length > 0 ? group(["(", indent([softline, join([ifBreak("", ", "), softline], printSequence(path, options, print, "arguments"))]), softline, ")"]) : "", node.repeatable ? " repeatable" : "", " on ", join(" | ", path.map(print, "locations"))];
|
32526 | }
|
32527 | case "EnumTypeExtension":
|
32528 | case "EnumTypeDefinition": {
|
32529 | return [print("description"), node.description ? hardline : "", node.kind === "EnumTypeExtension" ? "extend " : "", "enum ", print("name"), printDirectives(path, print, node), node.values.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "values"))]), hardline, "}"] : ""];
|
32530 | }
|
32531 | case "EnumValueDefinition": {
|
32532 | return [print("description"), node.description ? hardline : "", print("name"), printDirectives(path, print, node)];
|
32533 | }
|
32534 | case "InputValueDefinition": {
|
32535 | return [print("description"), node.description ? node.description.block ? hardline : line : "", print("name"), ": ", print("type"), node.defaultValue ? [" = ", print("defaultValue")] : "", printDirectives(path, print, node)];
|
32536 | }
|
32537 | case "InputObjectTypeExtension":
|
32538 | case "InputObjectTypeDefinition": {
|
32539 | return [print("description"), node.description ? hardline : "", node.kind === "InputObjectTypeExtension" ? "extend " : "", "input ", print("name"), printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
|
32540 | }
|
32541 | case "SchemaExtension": {
|
32542 | return ["extend schema", printDirectives(path, print, node), ...node.operationTypes.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]), hardline, "}"] : []];
|
32543 | }
|
32544 | case "SchemaDefinition": {
|
32545 | return [print("description"), node.description ? hardline : "", "schema", printDirectives(path, print, node), " {", node.operationTypes.length > 0 ? indent([hardline, join(hardline, printSequence(path, options, print, "operationTypes"))]) : "", hardline, "}"];
|
32546 | }
|
32547 | case "OperationTypeDefinition": {
|
32548 | return [print("operation"), ": ", print("type")];
|
32549 | }
|
32550 | case "InterfaceTypeExtension":
|
32551 | case "InterfaceTypeDefinition": {
|
32552 | return [print("description"), node.description ? hardline : "", node.kind === "InterfaceTypeExtension" ? "extend " : "", "interface ", print("name"), node.interfaces.length > 0 ? [" implements ", ...printInterfaces(path, options, print)] : "", printDirectives(path, print, node), node.fields.length > 0 ? [" {", indent([hardline, join(hardline, printSequence(path, options, print, "fields"))]), hardline, "}"] : ""];
|
32553 | }
|
32554 | case "FragmentSpread": {
|
32555 | return ["...", print("name"), printDirectives(path, print, node)];
|
32556 | }
|
32557 | case "InlineFragment": {
|
32558 | return ["...", node.typeCondition ? [" on ", print("typeCondition")] : "", printDirectives(path, print, node), " ", print("selectionSet")];
|
32559 | }
|
32560 | case "UnionTypeExtension":
|
32561 | case "UnionTypeDefinition": {
|
32562 | return group([print("description"), node.description ? hardline : "", group([node.kind === "UnionTypeExtension" ? "extend " : "", "union ", print("name"), printDirectives(path, print, node), node.types.length > 0 ? [" =", ifBreak("", " "), indent([ifBreak([line, " "]), join([line, "| "], path.map(print, "types"))])] : ""])]);
|
32563 | }
|
32564 | case "ScalarTypeExtension":
|
32565 | case "ScalarTypeDefinition": {
|
32566 | return [print("description"), node.description ? hardline : "", node.kind === "ScalarTypeExtension" ? "extend " : "", "scalar ", print("name"), printDirectives(path, print, node)];
|
32567 | }
|
32568 | case "NonNullType": {
|
32569 | return [print("type"), "!"];
|
32570 | }
|
32571 | case "ListType": {
|
32572 | return ["[", print("type"), "]"];
|
32573 | }
|
32574 | default:
|
32575 | throw new Error("unknown graphql type: " + JSON.stringify(node.kind));
|
32576 | }
|
32577 | }
|
32578 | function printDirectives(path, print, node) {
|
32579 | if (node.directives.length === 0) {
|
32580 | return "";
|
32581 | }
|
32582 | const printed = join(line, path.map(print, "directives"));
|
32583 | if (node.kind === "FragmentDefinition" || node.kind === "OperationDefinition") {
|
32584 | return group([line, printed]);
|
32585 | }
|
32586 | return [" ", group(indent([softline, printed]))];
|
32587 | }
|
32588 | function printSequence(path, options, print, property) {
|
32589 | return path.map((path2, index, sequence) => {
|
32590 | const printed = print();
|
32591 | if (index < sequence.length - 1 && isNextLineEmpty(options.originalText, path2.getValue(), locEnd)) {
|
32592 | return [printed, hardline];
|
32593 | }
|
32594 | return printed;
|
32595 | }, property);
|
32596 | }
|
32597 | function canAttachComment(node) {
|
32598 | return node.kind && node.kind !== "Comment";
|
32599 | }
|
32600 | function printComment(commentPath) {
|
32601 | const comment = commentPath.getValue();
|
32602 | if (comment.kind === "Comment") {
|
32603 | return "#" + comment.value.trimEnd();
|
32604 | }
|
32605 | throw new Error("Not a comment: " + JSON.stringify(comment));
|
32606 | }
|
32607 | function printInterfaces(path, options, print) {
|
32608 | const node = path.getNode();
|
32609 | const parts = [];
|
32610 | const {
|
32611 | interfaces
|
32612 | } = node;
|
32613 | const printed = path.map((node2) => print(node2), "interfaces");
|
32614 | for (let index = 0; index < interfaces.length; index++) {
|
32615 | const interfaceNode = interfaces[index];
|
32616 | parts.push(printed[index]);
|
32617 | const nextInterfaceNode = interfaces[index + 1];
|
32618 | if (nextInterfaceNode) {
|
32619 | const textBetween = options.originalText.slice(interfaceNode.loc.end, nextInterfaceNode.loc.start);
|
32620 | const hasComment = textBetween.includes("#");
|
32621 | const separator = textBetween.replace(/#.*/g, "").trim();
|
32622 | parts.push(separator === "," ? "," : " &", hasComment ? line : " ");
|
32623 | }
|
32624 | }
|
32625 | return parts;
|
32626 | }
|
32627 | function clean(node, newNode) {
|
32628 | if (node.kind === "StringValue" && node.block && !node.value.includes("\n")) {
|
32629 | newNode.value = newNode.value.trim();
|
32630 | }
|
32631 | }
|
32632 | clean.ignoredProperties = new Set(["loc", "comments"]);
|
32633 | function hasPrettierIgnore(path) {
|
32634 | var _node$comments;
|
32635 | const node = path.getValue();
|
32636 | return node === null || node === void 0 ? void 0 : (_node$comments = node.comments) === null || _node$comments === void 0 ? void 0 : _node$comments.some((comment) => comment.value.trim() === "prettier-ignore");
|
32637 | }
|
32638 | module2.exports = {
|
32639 | print: genericPrint,
|
32640 | massageAstNode: clean,
|
32641 | hasPrettierIgnore,
|
32642 | insertPragma,
|
32643 | printComment,
|
32644 | canAttachComment
|
32645 | };
|
32646 | }
|
32647 | });
|
32648 | var require_options4 = __commonJS2({
|
32649 | "src/language-graphql/options.js"(exports2, module2) {
|
32650 | "use strict";
|
32651 | var commonOptions = require_common_options();
|
32652 | module2.exports = {
|
32653 | bracketSpacing: commonOptions.bracketSpacing
|
32654 | };
|
32655 | }
|
32656 | });
|
32657 | var require_parsers4 = __commonJS2({
|
32658 | "src/language-graphql/parsers.js"(exports2, module2) {
|
32659 | "use strict";
|
32660 | module2.exports = {
|
32661 | get graphql() {
|
32662 | return require("./parser-graphql.js").parsers.graphql;
|
32663 | }
|
32664 | };
|
32665 | }
|
32666 | });
|
32667 | var require_GraphQL = __commonJS2({
|
32668 | "node_modules/linguist-languages/data/GraphQL.json"(exports2, module2) {
|
32669 | module2.exports = {
|
32670 | name: "GraphQL",
|
32671 | type: "data",
|
32672 | color: "#e10098",
|
32673 | extensions: [".graphql", ".gql", ".graphqls"],
|
32674 | tmScope: "source.graphql",
|
32675 | aceMode: "text",
|
32676 | languageId: 139
|
32677 | };
|
32678 | }
|
32679 | });
|
32680 | var require_language_graphql = __commonJS2({
|
32681 | "src/language-graphql/index.js"(exports2, module2) {
|
32682 | "use strict";
|
32683 | var createLanguage = require_create_language();
|
32684 | var printer = require_printer_graphql();
|
32685 | var options = require_options4();
|
32686 | var parsers = require_parsers4();
|
32687 | var languages = [createLanguage(require_GraphQL(), () => ({
|
32688 | since: "1.5.0",
|
32689 | parsers: ["graphql"],
|
32690 | vscodeLanguageIds: ["graphql"]
|
32691 | }))];
|
32692 | var printers = {
|
32693 | graphql: printer
|
32694 | };
|
32695 | module2.exports = {
|
32696 | languages,
|
32697 | options,
|
32698 | printers,
|
32699 | parsers
|
32700 | };
|
32701 | }
|
32702 | });
|
32703 | var require_loc5 = __commonJS2({
|
32704 | "src/language-markdown/loc.js"(exports2, module2) {
|
32705 | "use strict";
|
32706 | function locStart(node) {
|
32707 | return node.position.start.offset;
|
32708 | }
|
32709 | function locEnd(node) {
|
32710 | return node.position.end.offset;
|
32711 | }
|
32712 | module2.exports = {
|
32713 | locStart,
|
32714 | locEnd
|
32715 | };
|
32716 | }
|
32717 | });
|
32718 | var require_constants_evaluate = __commonJS2({
|
32719 | "src/language-markdown/constants.evaluate.js"(exports2, module2) {
|
32720 | module2.exports = {
|
32721 | cjkPattern: "(?:[\\u02ea-\\u02eb\\u1100-\\u11ff\\u2e80-\\u2e99\\u2e9b-\\u2ef3\\u2f00-\\u2fd5\\u2ff0-\\u303f\\u3041-\\u3096\\u3099-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312f\\u3131-\\u318e\\u3190-\\u3191\\u3196-\\u31ba\\u31c0-\\u31e3\\u31f0-\\u321e\\u322a-\\u3247\\u3260-\\u327e\\u328a-\\u32b0\\u32c0-\\u32cb\\u32d0-\\u3370\\u337b-\\u337f\\u33e0-\\u33fe\\u3400-\\u4db5\\u4e00-\\u9fef\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufe10-\\ufe1f\\ufe30-\\ufe6f\\uff00-\\uffef]|[\\ud840-\\ud868\\ud86a-\\ud86c\\ud86f-\\ud872\\ud874-\\ud879][\\udc00-\\udfff]|\\ud82c[\\udc00-\\udd1e\\udd50-\\udd52\\udd64-\\udd67]|\\ud83c[\\ude00\\ude50-\\ude51]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d\\udc20-\\udfff]|\\ud873[\\udc00-\\udea1\\udeb0-\\udfff]|\\ud87a[\\udc00-\\udfe0]|\\ud87e[\\udc00-\\ude1d])(?:[\\ufe00-\\ufe0f]|\\udb40[\\udd00-\\uddef])?",
|
32722 | kPattern: "[\\u1100-\\u11ff\\u3001-\\u3003\\u3008-\\u3011\\u3013-\\u301f\\u302e-\\u3030\\u3037\\u30fb\\u3131-\\u318e\\u3200-\\u321e\\u3260-\\u327e\\ua960-\\ua97c\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\ufe45-\\ufe46\\uff61-\\uff65\\uffa0-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc]",
|
32723 | punctuationPattern: "[\\u0021-\\u002f\\u003a-\\u0040\\u005b-\\u0060\\u007b-\\u007e\\u00a1\\u00a7\\u00ab\\u00b6-\\u00b7\\u00bb\\u00bf\\u037e\\u0387\\u055a-\\u055f\\u0589-\\u058a\\u05be\\u05c0\\u05c3\\u05c6\\u05f3-\\u05f4\\u0609-\\u060a\\u060c-\\u060d\\u061b\\u061e-\\u061f\\u066a-\\u066d\\u06d4\\u0700-\\u070d\\u07f7-\\u07f9\\u0830-\\u083e\\u085e\\u0964-\\u0965\\u0970\\u09fd\\u0a76\\u0af0\\u0c77\\u0c84\\u0df4\\u0e4f\\u0e5a-\\u0e5b\\u0f04-\\u0f12\\u0f14\\u0f3a-\\u0f3d\\u0f85\\u0fd0-\\u0fd4\\u0fd9-\\u0fda\\u104a-\\u104f\\u10fb\\u1360-\\u1368\\u1400\\u166e\\u169b-\\u169c\\u16eb-\\u16ed\\u1735-\\u1736\\u17d4-\\u17d6\\u17d8-\\u17da\\u1800-\\u180a\\u1944-\\u1945\\u1a1e-\\u1a1f\\u1aa0-\\u1aa6\\u1aa8-\\u1aad\\u1b5a-\\u1b60\\u1bfc-\\u1bff\\u1c3b-\\u1c3f\\u1c7e-\\u1c7f\\u1cc0-\\u1cc7\\u1cd3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205e\\u207d-\\u207e\\u208d-\\u208e\\u2308-\\u230b\\u2329-\\u232a\\u2768-\\u2775\\u27c5-\\u27c6\\u27e6-\\u27ef\\u2983-\\u2998\\u29d8-\\u29db\\u29fc-\\u29fd\\u2cf9-\\u2cfc\\u2cfe-\\u2cff\\u2d70\\u2e00-\\u2e2e\\u2e30-\\u2e4f\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301f\\u3030\\u303d\\u30a0\\u30fb\\ua4fe-\\ua4ff\\ua60d-\\ua60f\\ua673\\ua67e\\ua6f2-\\ua6f7\\ua874-\\ua877\\ua8ce-\\ua8cf\\ua8f8-\\ua8fa\\ua8fc\\ua92e-\\ua92f\\ua95f\\ua9c1-\\ua9cd\\ua9de-\\ua9df\\uaa5c-\\uaa5f\\uaade-\\uaadf\\uaaf0-\\uaaf1\\uabeb\\ufd3e-\\ufd3f\\ufe10-\\ufe19\\ufe30-\\ufe52\\ufe54-\\ufe61\\ufe63\\ufe68\\ufe6a-\\ufe6b\\uff01-\\uff03\\uff05-\\uff0a\\uff0c-\\uff0f\\uff1a-\\uff1b\\uff1f-\\uff20\\uff3b-\\uff3d\\uff3f\\uff5b\\uff5d\\uff5f-\\uff65]|\\ud800[\\udd00-\\udd02\\udf9f\\udfd0]|\\ud801[\\udd6f]|\\ud802[\\udc57\\udd1f\\udd3f\\ude50-\\ude58\\ude7f\\udef0-\\udef6\\udf39-\\udf3f\\udf99-\\udf9c]|\\ud803[\\udf55-\\udf59]|\\ud804[\\udc47-\\udc4d\\udcbb-\\udcbc\\udcbe-\\udcc1\\udd40-\\udd43\\udd74-\\udd75\\uddc5-\\uddc8\\uddcd\\udddb\\udddd-\\udddf\\ude38-\\ude3d\\udea9]|\\ud805[\\udc4b-\\udc4f\\udc5b\\udc5d\\udcc6\\uddc1-\\uddd7\\ude41-\\ude43\\ude60-\\ude6c\\udf3c-\\udf3e]|\\ud806[\\udc3b\\udde2\\ude3f-\\ude46\\ude9a-\\ude9c\\ude9e-\\udea2]|\\ud807[\\udc41-\\udc45\\udc70-\\udc71\\udef7-\\udef8\\udfff]|\\ud809[\\udc70-\\udc74]|\\ud81a[\\ude6e-\\ude6f\\udef5\\udf37-\\udf3b\\udf44]|\\ud81b[\\ude97-\\ude9a\\udfe2]|\\ud82f[\\udc9f]|\\ud836[\\ude87-\\ude8b]|\\ud83a[\\udd5e-\\udd5f]"
|
32724 | };
|
32725 | }
|
32726 | });
|
32727 | var require_utils10 = __commonJS2({
|
32728 | "src/language-markdown/utils.js"(exports2, module2) {
|
32729 | "use strict";
|
32730 | var {
|
32731 | getLast
|
32732 | } = require_util();
|
32733 | var {
|
32734 | locStart,
|
32735 | locEnd
|
32736 | } = require_loc5();
|
32737 | var {
|
32738 | cjkPattern,
|
32739 | kPattern,
|
32740 | punctuationPattern
|
32741 | } = require_constants_evaluate();
|
32742 | var INLINE_NODE_TYPES = ["liquidNode", "inlineCode", "emphasis", "esComment", "strong", "delete", "wikiLink", "link", "linkReference", "image", "imageReference", "footnote", "footnoteReference", "sentence", "whitespace", "word", "break", "inlineMath"];
|
32743 | var INLINE_NODE_WRAPPER_TYPES = [...INLINE_NODE_TYPES, "tableCell", "paragraph", "heading"];
|
32744 | var kRegex = new RegExp(kPattern);
|
32745 | var punctuationRegex = new RegExp(punctuationPattern);
|
32746 | function splitText(text, options) {
|
32747 | const KIND_NON_CJK = "non-cjk";
|
32748 | const KIND_CJ_LETTER = "cj-letter";
|
32749 | const KIND_K_LETTER = "k-letter";
|
32750 | const KIND_CJK_PUNCTUATION = "cjk-punctuation";
|
32751 | const nodes = [];
|
32752 | const tokens = (options.proseWrap === "preserve" ? text : text.replace(new RegExp(`(${cjkPattern})
|
32753 | (${cjkPattern})`, "g"), "$1$2")).split(/([\t\n ]+)/);
|
32754 | for (const [index, token] of tokens.entries()) {
|
32755 | if (index % 2 === 1) {
|
32756 | nodes.push({
|
32757 | type: "whitespace",
|
32758 | value: /\n/.test(token) ? "\n" : " "
|
32759 | });
|
32760 | continue;
|
32761 | }
|
32762 | if ((index === 0 || index === tokens.length - 1) && token === "") {
|
32763 | continue;
|
32764 | }
|
32765 | const innerTokens = token.split(new RegExp(`(${cjkPattern})`));
|
32766 | for (const [innerIndex, innerToken] of innerTokens.entries()) {
|
32767 | if ((innerIndex === 0 || innerIndex === innerTokens.length - 1) && innerToken === "") {
|
32768 | continue;
|
32769 | }
|
32770 | if (innerIndex % 2 === 0) {
|
32771 | if (innerToken !== "") {
|
32772 | appendNode({
|
32773 | type: "word",
|
32774 | value: innerToken,
|
32775 | kind: KIND_NON_CJK,
|
32776 | hasLeadingPunctuation: punctuationRegex.test(innerToken[0]),
|
32777 | hasTrailingPunctuation: punctuationRegex.test(getLast(innerToken))
|
32778 | });
|
32779 | }
|
32780 | continue;
|
32781 | }
|
32782 | appendNode(punctuationRegex.test(innerToken) ? {
|
32783 | type: "word",
|
32784 | value: innerToken,
|
32785 | kind: KIND_CJK_PUNCTUATION,
|
32786 | hasLeadingPunctuation: true,
|
32787 | hasTrailingPunctuation: true
|
32788 | } : {
|
32789 | type: "word",
|
32790 | value: innerToken,
|
32791 | kind: kRegex.test(innerToken) ? KIND_K_LETTER : KIND_CJ_LETTER,
|
32792 | hasLeadingPunctuation: false,
|
32793 | hasTrailingPunctuation: false
|
32794 | });
|
32795 | }
|
32796 | }
|
32797 | return nodes;
|
32798 | function appendNode(node) {
|
32799 | const lastNode = getLast(nodes);
|
32800 | if (lastNode && lastNode.type === "word") {
|
32801 | if (lastNode.kind === KIND_NON_CJK && node.kind === KIND_CJ_LETTER && !lastNode.hasTrailingPunctuation || lastNode.kind === KIND_CJ_LETTER && node.kind === KIND_NON_CJK && !node.hasLeadingPunctuation) {
|
32802 | nodes.push({
|
32803 | type: "whitespace",
|
32804 | value: " "
|
32805 | });
|
32806 | } else if (!isBetween(KIND_NON_CJK, KIND_CJK_PUNCTUATION) && ![lastNode.value, node.value].some((value) => /\u3000/.test(value))) {
|
32807 | nodes.push({
|
32808 | type: "whitespace",
|
32809 | value: ""
|
32810 | });
|
32811 | }
|
32812 | }
|
32813 | nodes.push(node);
|
32814 | function isBetween(kind1, kind2) {
|
32815 | return lastNode.kind === kind1 && node.kind === kind2 || lastNode.kind === kind2 && node.kind === kind1;
|
32816 | }
|
32817 | }
|
32818 | }
|
32819 | function getOrderedListItemInfo(orderListItem, originalText) {
|
32820 | const [, numberText, marker, leadingSpaces] = originalText.slice(orderListItem.position.start.offset, orderListItem.position.end.offset).match(/^\s*(\d+)(\.|\))(\s*)/);
|
32821 | return {
|
32822 | numberText,
|
32823 | marker,
|
32824 | leadingSpaces
|
32825 | };
|
32826 | }
|
32827 | function hasGitDiffFriendlyOrderedList(node, options) {
|
32828 | if (!node.ordered) {
|
32829 | return false;
|
32830 | }
|
32831 | if (node.children.length < 2) {
|
32832 | return false;
|
32833 | }
|
32834 | const firstNumber = Number(getOrderedListItemInfo(node.children[0], options.originalText).numberText);
|
32835 | const secondNumber = Number(getOrderedListItemInfo(node.children[1], options.originalText).numberText);
|
32836 | if (firstNumber === 0 && node.children.length > 2) {
|
32837 | const thirdNumber = Number(getOrderedListItemInfo(node.children[2], options.originalText).numberText);
|
32838 | return secondNumber === 1 && thirdNumber === 1;
|
32839 | }
|
32840 | return secondNumber === 1;
|
32841 | }
|
32842 | function getFencedCodeBlockValue(node, originalText) {
|
32843 | const {
|
32844 | value
|
32845 | } = node;
|
32846 | if (node.position.end.offset === originalText.length && value.endsWith("\n") && originalText.endsWith("\n")) {
|
32847 | return value.slice(0, -1);
|
32848 | }
|
32849 | return value;
|
32850 | }
|
32851 | function mapAst(ast, handler) {
|
32852 | return function preorder(node, index, parentStack) {
|
32853 | const newNode = Object.assign({}, handler(node, index, parentStack));
|
32854 | if (newNode.children) {
|
32855 | newNode.children = newNode.children.map((child, index2) => preorder(child, index2, [newNode, ...parentStack]));
|
32856 | }
|
32857 | return newNode;
|
32858 | }(ast, null, []);
|
32859 | }
|
32860 | function isAutolink(node) {
|
32861 | if ((node === null || node === void 0 ? void 0 : node.type) !== "link" || node.children.length !== 1) {
|
32862 | return false;
|
32863 | }
|
32864 | const [child] = node.children;
|
32865 | return locStart(node) === locStart(child) && locEnd(node) === locEnd(child);
|
32866 | }
|
32867 | module2.exports = {
|
32868 | mapAst,
|
32869 | splitText,
|
32870 | punctuationPattern,
|
32871 | getFencedCodeBlockValue,
|
32872 | getOrderedListItemInfo,
|
32873 | hasGitDiffFriendlyOrderedList,
|
32874 | INLINE_NODE_TYPES,
|
32875 | INLINE_NODE_WRAPPER_TYPES,
|
32876 | isAutolink
|
32877 | };
|
32878 | }
|
32879 | });
|
32880 | var require_embed3 = __commonJS2({
|
32881 | "src/language-markdown/embed.js"(exports2, module2) {
|
32882 | "use strict";
|
32883 | var {
|
32884 | inferParserByLanguage,
|
32885 | getMaxContinuousCount
|
32886 | } = require_util();
|
32887 | var {
|
32888 | builders: {
|
32889 | hardline,
|
32890 | markAsRoot
|
32891 | },
|
32892 | utils: {
|
32893 | replaceEndOfLine
|
32894 | }
|
32895 | } = require("./doc.js");
|
32896 | var printFrontMatter = require_print();
|
32897 | var {
|
32898 | getFencedCodeBlockValue
|
32899 | } = require_utils10();
|
32900 | function embed(path, print, textToDoc, options) {
|
32901 | const node = path.getValue();
|
32902 | if (node.type === "code" && node.lang !== null) {
|
32903 | const parser = inferParserByLanguage(node.lang, options);
|
32904 | if (parser) {
|
32905 | const styleUnit = options.__inJsTemplate ? "~" : "`";
|
32906 | const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
|
32907 | const newOptions = {
|
32908 | parser
|
32909 | };
|
32910 | if (node.lang === "tsx") {
|
32911 | newOptions.filepath = "dummy.tsx";
|
32912 | }
|
32913 | const doc2 = textToDoc(getFencedCodeBlockValue(node, options.originalText), newOptions, {
|
32914 | stripTrailingHardline: true
|
32915 | });
|
32916 | return markAsRoot([style, node.lang, node.meta ? " " + node.meta : "", hardline, replaceEndOfLine(doc2), hardline, style]);
|
32917 | }
|
32918 | }
|
32919 | switch (node.type) {
|
32920 | case "front-matter":
|
32921 | return printFrontMatter(node, textToDoc);
|
32922 | case "importExport":
|
32923 | return [textToDoc(node.value, {
|
32924 | parser: "babel"
|
32925 | }, {
|
32926 | stripTrailingHardline: true
|
32927 | }), hardline];
|
32928 | case "jsx":
|
32929 | return textToDoc(`<$>${node.value}</$>`, {
|
32930 | parser: "__js_expression",
|
32931 | rootMarker: "mdx"
|
32932 | }, {
|
32933 | stripTrailingHardline: true
|
32934 | });
|
32935 | }
|
32936 | return null;
|
32937 | }
|
32938 | module2.exports = embed;
|
32939 | }
|
32940 | });
|
32941 | var require_pragma4 = __commonJS2({
|
32942 | "src/language-markdown/pragma.js"(exports2, module2) {
|
32943 | "use strict";
|
32944 | var parseFrontMatter = require_parse4();
|
32945 | var pragmas = ["format", "prettier"];
|
32946 | function startWithPragma(text) {
|
32947 | const pragma = `@(${pragmas.join("|")})`;
|
32948 | const regex = new RegExp([`<!--\\s*${pragma}\\s*-->`, `{\\s*\\/\\*\\s*${pragma}\\s*\\*\\/\\s*}`, `<!--.*\r?
|
32949 | [\\s\\S]*(^|
|
32950 | )[^\\S
|
32951 | ]*${pragma}[^\\S
|
32952 | ]*($|
|
32953 | )[\\s\\S]*
|
32954 | .*-->`].join("|"), "m");
|
32955 | const matched = text.match(regex);
|
32956 | return (matched === null || matched === void 0 ? void 0 : matched.index) === 0;
|
32957 | }
|
32958 | module2.exports = {
|
32959 | startWithPragma,
|
32960 | hasPragma: (text) => startWithPragma(parseFrontMatter(text).content.trimStart()),
|
32961 | insertPragma: (text) => {
|
32962 | const extracted = parseFrontMatter(text);
|
32963 | const pragma = `<!-- @${pragmas[0]} -->`;
|
32964 | return extracted.frontMatter ? `${extracted.frontMatter.raw}
|
32965 |
|
32966 | ${pragma}
|
32967 |
|
32968 | ${extracted.content}` : `${pragma}
|
32969 |
|
32970 | ${extracted.content}`;
|
32971 | }
|
32972 | };
|
32973 | }
|
32974 | });
|
32975 | var require_print_preprocess2 = __commonJS2({
|
32976 | "src/language-markdown/print-preprocess.js"(exports2, module2) {
|
32977 | "use strict";
|
32978 | var getLast = require_get_last();
|
32979 | var {
|
32980 | getOrderedListItemInfo,
|
32981 | mapAst,
|
32982 | splitText
|
32983 | } = require_utils10();
|
32984 | var isSingleCharRegex = /^.$/su;
|
32985 | function preprocess(ast, options) {
|
32986 | ast = restoreUnescapedCharacter(ast, options);
|
32987 | ast = mergeContinuousTexts(ast);
|
32988 | ast = transformInlineCode(ast, options);
|
32989 | ast = transformIndentedCodeblockAndMarkItsParentList(ast, options);
|
32990 | ast = markAlignedList(ast, options);
|
32991 | ast = splitTextIntoSentences(ast, options);
|
32992 | ast = transformImportExport(ast);
|
32993 | ast = mergeContinuousImportExport(ast);
|
32994 | return ast;
|
32995 | }
|
32996 | function transformImportExport(ast) {
|
32997 | return mapAst(ast, (node) => {
|
32998 | if (node.type !== "import" && node.type !== "export") {
|
32999 | return node;
|
33000 | }
|
33001 | return Object.assign(Object.assign({}, node), {}, {
|
33002 | type: "importExport"
|
33003 | });
|
33004 | });
|
33005 | }
|
33006 | function transformInlineCode(ast, options) {
|
33007 | return mapAst(ast, (node) => {
|
33008 | if (node.type !== "inlineCode" || options.proseWrap === "preserve") {
|
33009 | return node;
|
33010 | }
|
33011 | return Object.assign(Object.assign({}, node), {}, {
|
33012 | value: node.value.replace(/\s+/g, " ")
|
33013 | });
|
33014 | });
|
33015 | }
|
33016 | function restoreUnescapedCharacter(ast, options) {
|
33017 | return mapAst(ast, (node) => node.type !== "text" || node.value === "*" || node.value === "_" || !isSingleCharRegex.test(node.value) || node.position.end.offset - node.position.start.offset === node.value.length ? node : Object.assign(Object.assign({}, node), {}, {
|
33018 | value: options.originalText.slice(node.position.start.offset, node.position.end.offset)
|
33019 | }));
|
33020 | }
|
33021 | function mergeContinuousImportExport(ast) {
|
33022 | return mergeChildren(ast, (prevNode, node) => prevNode.type === "importExport" && node.type === "importExport", (prevNode, node) => ({
|
33023 | type: "importExport",
|
33024 | value: prevNode.value + "\n\n" + node.value,
|
33025 | position: {
|
33026 | start: prevNode.position.start,
|
33027 | end: node.position.end
|
33028 | }
|
33029 | }));
|
33030 | }
|
33031 | function mergeChildren(ast, shouldMerge, mergeNode) {
|
33032 | return mapAst(ast, (node) => {
|
33033 | if (!node.children) {
|
33034 | return node;
|
33035 | }
|
33036 | const children = node.children.reduce((current, child) => {
|
33037 | const lastChild = getLast(current);
|
33038 | if (lastChild && shouldMerge(lastChild, child)) {
|
33039 | current.splice(-1, 1, mergeNode(lastChild, child));
|
33040 | } else {
|
33041 | current.push(child);
|
33042 | }
|
33043 | return current;
|
33044 | }, []);
|
33045 | return Object.assign(Object.assign({}, node), {}, {
|
33046 | children
|
33047 | });
|
33048 | });
|
33049 | }
|
33050 | function mergeContinuousTexts(ast) {
|
33051 | return mergeChildren(ast, (prevNode, node) => prevNode.type === "text" && node.type === "text", (prevNode, node) => ({
|
33052 | type: "text",
|
33053 | value: prevNode.value + node.value,
|
33054 | position: {
|
33055 | start: prevNode.position.start,
|
33056 | end: node.position.end
|
33057 | }
|
33058 | }));
|
33059 | }
|
33060 | function splitTextIntoSentences(ast, options) {
|
33061 | return mapAst(ast, (node, index, [parentNode]) => {
|
33062 | if (node.type !== "text") {
|
33063 | return node;
|
33064 | }
|
33065 | let {
|
33066 | value
|
33067 | } = node;
|
33068 | if (parentNode.type === "paragraph") {
|
33069 | if (index === 0) {
|
33070 | value = value.trimStart();
|
33071 | }
|
33072 | if (index === parentNode.children.length - 1) {
|
33073 | value = value.trimEnd();
|
33074 | }
|
33075 | }
|
33076 | return {
|
33077 | type: "sentence",
|
33078 | position: node.position,
|
33079 | children: splitText(value, options)
|
33080 | };
|
33081 | });
|
33082 | }
|
33083 | function transformIndentedCodeblockAndMarkItsParentList(ast, options) {
|
33084 | return mapAst(ast, (node, index, parentStack) => {
|
33085 | if (node.type === "code") {
|
33086 | const isIndented = /^\n?(?: {4,}|\t)/.test(options.originalText.slice(node.position.start.offset, node.position.end.offset));
|
33087 | node.isIndented = isIndented;
|
33088 | if (isIndented) {
|
33089 | for (let i = 0; i < parentStack.length; i++) {
|
33090 | const parent = parentStack[i];
|
33091 | if (parent.hasIndentedCodeblock) {
|
33092 | break;
|
33093 | }
|
33094 | if (parent.type === "list") {
|
33095 | parent.hasIndentedCodeblock = true;
|
33096 | }
|
33097 | }
|
33098 | }
|
33099 | }
|
33100 | return node;
|
33101 | });
|
33102 | }
|
33103 | function markAlignedList(ast, options) {
|
33104 | return mapAst(ast, (node, index, parentStack) => {
|
33105 | if (node.type === "list" && node.children.length > 0) {
|
33106 | for (let i = 0; i < parentStack.length; i++) {
|
33107 | const parent = parentStack[i];
|
33108 | if (parent.type === "list" && !parent.isAligned) {
|
33109 | node.isAligned = false;
|
33110 | return node;
|
33111 | }
|
33112 | }
|
33113 | node.isAligned = isAligned(node);
|
33114 | }
|
33115 | return node;
|
33116 | });
|
33117 | function getListItemStart(listItem) {
|
33118 | return listItem.children.length === 0 ? -1 : listItem.children[0].position.start.column - 1;
|
33119 | }
|
33120 | function isAligned(list) {
|
33121 | if (!list.ordered) {
|
33122 | return true;
|
33123 | }
|
33124 | const [firstItem, secondItem] = list.children;
|
33125 | const firstInfo = getOrderedListItemInfo(firstItem, options.originalText);
|
33126 | if (firstInfo.leadingSpaces.length > 1) {
|
33127 | return true;
|
33128 | }
|
33129 | const firstStart = getListItemStart(firstItem);
|
33130 | if (firstStart === -1) {
|
33131 | return false;
|
33132 | }
|
33133 | if (list.children.length === 1) {
|
33134 | return firstStart % options.tabWidth === 0;
|
33135 | }
|
33136 | const secondStart = getListItemStart(secondItem);
|
33137 | if (firstStart !== secondStart) {
|
33138 | return false;
|
33139 | }
|
33140 | if (firstStart % options.tabWidth === 0) {
|
33141 | return true;
|
33142 | }
|
33143 | const secondInfo = getOrderedListItemInfo(secondItem, options.originalText);
|
33144 | return secondInfo.leadingSpaces.length > 1;
|
33145 | }
|
33146 | }
|
33147 | module2.exports = preprocess;
|
33148 | }
|
33149 | });
|
33150 | var require_clean4 = __commonJS2({
|
33151 | "src/language-markdown/clean.js"(exports2, module2) {
|
33152 | "use strict";
|
33153 | var {
|
33154 | isFrontMatterNode
|
33155 | } = require_util();
|
33156 | var {
|
33157 | startWithPragma
|
33158 | } = require_pragma4();
|
33159 | var ignoredProperties = new Set(["position", "raw"]);
|
33160 | function clean(ast, newObj, parent) {
|
33161 | if (ast.type === "front-matter" || ast.type === "code" || ast.type === "yaml" || ast.type === "import" || ast.type === "export" || ast.type === "jsx") {
|
33162 | delete newObj.value;
|
33163 | }
|
33164 | if (ast.type === "list") {
|
33165 | delete newObj.isAligned;
|
33166 | }
|
33167 | if (ast.type === "list" || ast.type === "listItem") {
|
33168 | delete newObj.spread;
|
33169 | delete newObj.loose;
|
33170 | }
|
33171 | if (ast.type === "text") {
|
33172 | return null;
|
33173 | }
|
33174 | if (ast.type === "inlineCode") {
|
33175 | newObj.value = ast.value.replace(/[\t\n ]+/g, " ");
|
33176 | }
|
33177 | if (ast.type === "wikiLink") {
|
33178 | newObj.value = ast.value.trim().replace(/[\t\n]+/g, " ");
|
33179 | }
|
33180 | if (ast.type === "definition" || ast.type === "linkReference") {
|
33181 | newObj.label = ast.label.trim().replace(/[\t\n ]+/g, " ").toLowerCase();
|
33182 | }
|
33183 | if ((ast.type === "definition" || ast.type === "link" || ast.type === "image") && ast.title) {
|
33184 | newObj.title = ast.title.replace(/\\(["')])/g, "$1");
|
33185 | }
|
33186 | if (parent && parent.type === "root" && parent.children.length > 0 && (parent.children[0] === ast || isFrontMatterNode(parent.children[0]) && parent.children[1] === ast) && ast.type === "html" && startWithPragma(ast.value)) {
|
33187 | return null;
|
33188 | }
|
33189 | }
|
33190 | clean.ignoredProperties = ignoredProperties;
|
33191 | module2.exports = clean;
|
33192 | }
|
33193 | });
|
33194 | var require_printer_markdown = __commonJS2({
|
33195 | "src/language-markdown/printer-markdown.js"(exports2, module2) {
|
33196 | "use strict";
|
33197 | var {
|
33198 | getLast,
|
33199 | getMinNotPresentContinuousCount,
|
33200 | getMaxContinuousCount,
|
33201 | getStringWidth,
|
33202 | isNonEmptyArray
|
33203 | } = require_util();
|
33204 | var {
|
33205 | builders: {
|
33206 | breakParent,
|
33207 | join,
|
33208 | line,
|
33209 | literalline,
|
33210 | markAsRoot,
|
33211 | hardline,
|
33212 | softline,
|
33213 | ifBreak,
|
33214 | fill,
|
33215 | align,
|
33216 | indent,
|
33217 | group,
|
33218 | hardlineWithoutBreakParent
|
33219 | },
|
33220 | utils: {
|
33221 | normalizeDoc,
|
33222 | replaceTextEndOfLine
|
33223 | },
|
33224 | printer: {
|
33225 | printDocToString
|
33226 | }
|
33227 | } = require("./doc.js");
|
33228 | var embed = require_embed3();
|
33229 | var {
|
33230 | insertPragma
|
33231 | } = require_pragma4();
|
33232 | var {
|
33233 | locStart,
|
33234 | locEnd
|
33235 | } = require_loc5();
|
33236 | var preprocess = require_print_preprocess2();
|
33237 | var clean = require_clean4();
|
33238 | var {
|
33239 | getFencedCodeBlockValue,
|
33240 | hasGitDiffFriendlyOrderedList,
|
33241 | splitText,
|
33242 | punctuationPattern,
|
33243 | INLINE_NODE_TYPES,
|
33244 | INLINE_NODE_WRAPPER_TYPES,
|
33245 | isAutolink
|
33246 | } = require_utils10();
|
33247 | var TRAILING_HARDLINE_NODES = new Set(["importExport"]);
|
33248 | var SINGLE_LINE_NODE_TYPES = ["heading", "tableCell", "link", "wikiLink"];
|
33249 | var SIBLING_NODE_TYPES = new Set(["listItem", "definition", "footnoteDefinition"]);
|
33250 | function genericPrint(path, options, print) {
|
33251 | const node = path.getValue();
|
33252 | if (shouldRemainTheSameContent(path)) {
|
33253 | return splitText(options.originalText.slice(node.position.start.offset, node.position.end.offset), options).map((node2) => node2.type === "word" ? node2.value : node2.value === "" ? "" : printLine(path, node2.value, options));
|
33254 | }
|
33255 | switch (node.type) {
|
33256 | case "front-matter":
|
33257 | return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
33258 | case "root":
|
33259 | if (node.children.length === 0) {
|
33260 | return "";
|
33261 | }
|
33262 | return [normalizeDoc(printRoot(path, options, print)), !TRAILING_HARDLINE_NODES.has(getLastDescendantNode(node).type) ? hardline : ""];
|
33263 | case "paragraph":
|
33264 | return printChildren(path, options, print, {
|
33265 | postprocessor: fill
|
33266 | });
|
33267 | case "sentence":
|
33268 | return printChildren(path, options, print);
|
33269 | case "word": {
|
33270 | let escapedValue = node.value.replace(/\*/g, "\\$&").replace(new RegExp([`(^|${punctuationPattern})(_+)`, `(_+)(${punctuationPattern}|$)`].join("|"), "g"), (_, text1, underscore1, underscore2, text2) => (underscore1 ? `${text1}${underscore1}` : `${underscore2}${text2}`).replace(/_/g, "\\_"));
|
33271 | const isFirstSentence = (node2, name, index) => node2.type === "sentence" && index === 0;
|
33272 | const isLastChildAutolink = (node2, name, index) => isAutolink(node2.children[index - 1]);
|
33273 | if (escapedValue !== node.value && (path.match(void 0, isFirstSentence, isLastChildAutolink) || path.match(void 0, isFirstSentence, (node2, name, index) => node2.type === "emphasis" && index === 0, isLastChildAutolink))) {
|
33274 | escapedValue = escapedValue.replace(/^(\\?[*_])+/, (prefix) => prefix.replace(/\\/g, ""));
|
33275 | }
|
33276 | return escapedValue;
|
33277 | }
|
33278 | case "whitespace": {
|
33279 | const parentNode = path.getParentNode();
|
33280 | const index = parentNode.children.indexOf(node);
|
33281 | const nextNode = parentNode.children[index + 1];
|
33282 | const proseWrap = nextNode && /^>|^(?:[*+-]|#{1,6}|\d+[).])$/.test(nextNode.value) ? "never" : options.proseWrap;
|
33283 | return printLine(path, node.value, {
|
33284 | proseWrap
|
33285 | });
|
33286 | }
|
33287 | case "emphasis": {
|
33288 | let style;
|
33289 | if (isAutolink(node.children[0])) {
|
33290 | style = options.originalText[node.position.start.offset];
|
33291 | } else {
|
33292 | const parentNode = path.getParentNode();
|
33293 | const index = parentNode.children.indexOf(node);
|
33294 | const prevNode = parentNode.children[index - 1];
|
33295 | const nextNode = parentNode.children[index + 1];
|
33296 | const hasPrevOrNextWord = prevNode && prevNode.type === "sentence" && prevNode.children.length > 0 && getLast(prevNode.children).type === "word" && !getLast(prevNode.children).hasTrailingPunctuation || nextNode && nextNode.type === "sentence" && nextNode.children.length > 0 && nextNode.children[0].type === "word" && !nextNode.children[0].hasLeadingPunctuation;
|
33297 | style = hasPrevOrNextWord || getAncestorNode(path, "emphasis") ? "*" : "_";
|
33298 | }
|
33299 | return [style, printChildren(path, options, print), style];
|
33300 | }
|
33301 | case "strong":
|
33302 | return ["**", printChildren(path, options, print), "**"];
|
33303 | case "delete":
|
33304 | return ["~~", printChildren(path, options, print), "~~"];
|
33305 | case "inlineCode": {
|
33306 | const backtickCount = getMinNotPresentContinuousCount(node.value, "`");
|
33307 | const style = "`".repeat(backtickCount || 1);
|
33308 | const gap = backtickCount && !/^\s/.test(node.value) ? " " : "";
|
33309 | return [style, gap, node.value, gap, style];
|
33310 | }
|
33311 | case "wikiLink": {
|
33312 | let contents = "";
|
33313 | if (options.proseWrap === "preserve") {
|
33314 | contents = node.value;
|
33315 | } else {
|
33316 | contents = node.value.replace(/[\t\n]+/g, " ");
|
33317 | }
|
33318 | return ["[[", contents, "]]"];
|
33319 | }
|
33320 | case "link":
|
33321 | switch (options.originalText[node.position.start.offset]) {
|
33322 | case "<": {
|
33323 | const mailto = "mailto:";
|
33324 | const url = node.url.startsWith(mailto) && options.originalText.slice(node.position.start.offset + 1, node.position.start.offset + 1 + mailto.length) !== mailto ? node.url.slice(mailto.length) : node.url;
|
33325 | return ["<", url, ">"];
|
33326 | }
|
33327 | case "[":
|
33328 | return ["[", printChildren(path, options, print), "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
|
33329 | default:
|
33330 | return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
33331 | }
|
33332 | case "image":
|
33333 | return ["![", node.alt || "", "](", printUrl(node.url, ")"), printTitle(node.title, options), ")"];
|
33334 | case "blockquote":
|
33335 | return ["> ", align("> ", printChildren(path, options, print))];
|
33336 | case "heading":
|
33337 | return ["#".repeat(node.depth) + " ", printChildren(path, options, print)];
|
33338 | case "code": {
|
33339 | if (node.isIndented) {
|
33340 | const alignment = " ".repeat(4);
|
33341 | return align(alignment, [alignment, ...replaceTextEndOfLine(node.value, hardline)]);
|
33342 | }
|
33343 | const styleUnit = options.__inJsTemplate ? "~" : "`";
|
33344 | const style = styleUnit.repeat(Math.max(3, getMaxContinuousCount(node.value, styleUnit) + 1));
|
33345 | return [style, node.lang || "", node.meta ? " " + node.meta : "", hardline, ...replaceTextEndOfLine(getFencedCodeBlockValue(node, options.originalText), hardline), hardline, style];
|
33346 | }
|
33347 | case "html": {
|
33348 | const parentNode = path.getParentNode();
|
33349 | const value = parentNode.type === "root" && getLast(parentNode.children) === node ? node.value.trimEnd() : node.value;
|
33350 | const isHtmlComment = /^<!--.*-->$/s.test(value);
|
33351 | return replaceTextEndOfLine(value, isHtmlComment ? hardline : markAsRoot(literalline));
|
33352 | }
|
33353 | case "list": {
|
33354 | const nthSiblingIndex = getNthListSiblingIndex(node, path.getParentNode());
|
33355 | const isGitDiffFriendlyOrderedList = hasGitDiffFriendlyOrderedList(node, options);
|
33356 | return printChildren(path, options, print, {
|
33357 | processor: (childPath, index) => {
|
33358 | const prefix = getPrefix();
|
33359 | const childNode = childPath.getValue();
|
33360 | if (childNode.children.length === 2 && childNode.children[1].type === "html" && childNode.children[0].position.start.column !== childNode.children[1].position.start.column) {
|
33361 | return [prefix, printListItem(childPath, options, print, prefix)];
|
33362 | }
|
33363 | return [prefix, align(" ".repeat(prefix.length), printListItem(childPath, options, print, prefix))];
|
33364 | function getPrefix() {
|
33365 | const rawPrefix = node.ordered ? (index === 0 ? node.start : isGitDiffFriendlyOrderedList ? 1 : node.start + index) + (nthSiblingIndex % 2 === 0 ? ". " : ") ") : nthSiblingIndex % 2 === 0 ? "- " : "* ";
|
33366 | return node.isAligned || node.hasIndentedCodeblock ? alignListPrefix(rawPrefix, options) : rawPrefix;
|
33367 | }
|
33368 | }
|
33369 | });
|
33370 | }
|
33371 | case "thematicBreak": {
|
33372 | const counter = getAncestorCounter(path, "list");
|
33373 | if (counter === -1) {
|
33374 | return "---";
|
33375 | }
|
33376 | const nthSiblingIndex = getNthListSiblingIndex(path.getParentNode(counter), path.getParentNode(counter + 1));
|
33377 | return nthSiblingIndex % 2 === 0 ? "***" : "---";
|
33378 | }
|
33379 | case "linkReference":
|
33380 | return ["[", printChildren(path, options, print), "]", node.referenceType === "full" ? ["[", node.identifier, "]"] : node.referenceType === "collapsed" ? "[]" : ""];
|
33381 | case "imageReference":
|
33382 | switch (node.referenceType) {
|
33383 | case "full":
|
33384 | return ["![", node.alt || "", "][", node.identifier, "]"];
|
33385 | default:
|
33386 | return ["![", node.alt, "]", node.referenceType === "collapsed" ? "[]" : ""];
|
33387 | }
|
33388 | case "definition": {
|
33389 | const lineOrSpace = options.proseWrap === "always" ? line : " ";
|
33390 | return group(["[", node.identifier, "]:", indent([lineOrSpace, printUrl(node.url), node.title === null ? "" : [lineOrSpace, printTitle(node.title, options, false)]])]);
|
33391 | }
|
33392 | case "footnote":
|
33393 | return ["[^", printChildren(path, options, print), "]"];
|
33394 | case "footnoteReference":
|
33395 | return ["[^", node.identifier, "]"];
|
33396 | case "footnoteDefinition": {
|
33397 | const nextNode = path.getParentNode().children[path.getName() + 1];
|
33398 | const shouldInlineFootnote = node.children.length === 1 && node.children[0].type === "paragraph" && (options.proseWrap === "never" || options.proseWrap === "preserve" && node.children[0].position.start.line === node.children[0].position.end.line);
|
33399 | return ["[^", node.identifier, "]: ", shouldInlineFootnote ? printChildren(path, options, print) : group([align(" ".repeat(4), printChildren(path, options, print, {
|
33400 | processor: (childPath, index) => index === 0 ? group([softline, print()]) : print()
|
33401 | })), nextNode && nextNode.type === "footnoteDefinition" ? softline : ""])];
|
33402 | }
|
33403 | case "table":
|
33404 | return printTable(path, options, print);
|
33405 | case "tableCell":
|
33406 | return printChildren(path, options, print);
|
33407 | case "break":
|
33408 | return /\s/.test(options.originalText[node.position.start.offset]) ? [" ", markAsRoot(literalline)] : ["\\", hardline];
|
33409 | case "liquidNode":
|
33410 | return replaceTextEndOfLine(node.value, hardline);
|
33411 | case "importExport":
|
33412 | return [node.value, hardline];
|
33413 | case "esComment":
|
33414 | return ["{/* ", node.value, " */}"];
|
33415 | case "jsx":
|
33416 | return node.value;
|
33417 | case "math":
|
33418 | return ["$$", hardline, node.value ? [...replaceTextEndOfLine(node.value, hardline), hardline] : "", "$$"];
|
33419 | case "inlineMath": {
|
33420 | return options.originalText.slice(locStart(node), locEnd(node));
|
33421 | }
|
33422 | case "tableRow":
|
33423 | case "listItem":
|
33424 | default:
|
33425 | throw new Error(`Unknown markdown type ${JSON.stringify(node.type)}`);
|
33426 | }
|
33427 | }
|
33428 | function printListItem(path, options, print, listPrefix) {
|
33429 | const node = path.getValue();
|
33430 | const prefix = node.checked === null ? "" : node.checked ? "[x] " : "[ ] ";
|
33431 | return [prefix, printChildren(path, options, print, {
|
33432 | processor: (childPath, index) => {
|
33433 | if (index === 0 && childPath.getValue().type !== "list") {
|
33434 | return align(" ".repeat(prefix.length), print());
|
33435 | }
|
33436 | const alignment = " ".repeat(clamp(options.tabWidth - listPrefix.length, 0, 3));
|
33437 | return [alignment, align(alignment, print())];
|
33438 | }
|
33439 | })];
|
33440 | }
|
33441 | function alignListPrefix(prefix, options) {
|
33442 | const additionalSpaces = getAdditionalSpaces();
|
33443 | return prefix + " ".repeat(additionalSpaces >= 4 ? 0 : additionalSpaces);
|
33444 | function getAdditionalSpaces() {
|
33445 | const restSpaces = prefix.length % options.tabWidth;
|
33446 | return restSpaces === 0 ? 0 : options.tabWidth - restSpaces;
|
33447 | }
|
33448 | }
|
33449 | function getNthListSiblingIndex(node, parentNode) {
|
33450 | return getNthSiblingIndex(node, parentNode, (siblingNode) => siblingNode.ordered === node.ordered);
|
33451 | }
|
33452 | function getNthSiblingIndex(node, parentNode, condition) {
|
33453 | let index = -1;
|
33454 | for (const childNode of parentNode.children) {
|
33455 | if (childNode.type === node.type && condition(childNode)) {
|
33456 | index++;
|
33457 | } else {
|
33458 | index = -1;
|
33459 | }
|
33460 | if (childNode === node) {
|
33461 | return index;
|
33462 | }
|
33463 | }
|
33464 | }
|
33465 | function getAncestorCounter(path, typeOrTypes) {
|
33466 | const types = Array.isArray(typeOrTypes) ? typeOrTypes : [typeOrTypes];
|
33467 | let counter = -1;
|
33468 | let ancestorNode;
|
33469 | while (ancestorNode = path.getParentNode(++counter)) {
|
33470 | if (types.includes(ancestorNode.type)) {
|
33471 | return counter;
|
33472 | }
|
33473 | }
|
33474 | return -1;
|
33475 | }
|
33476 | function getAncestorNode(path, typeOrTypes) {
|
33477 | const counter = getAncestorCounter(path, typeOrTypes);
|
33478 | return counter === -1 ? null : path.getParentNode(counter);
|
33479 | }
|
33480 | function printLine(path, value, options) {
|
33481 | if (options.proseWrap === "preserve" && value === "\n") {
|
33482 | return hardline;
|
33483 | }
|
33484 | const isBreakable = options.proseWrap === "always" && !getAncestorNode(path, SINGLE_LINE_NODE_TYPES);
|
33485 | return value !== "" ? isBreakable ? line : " " : isBreakable ? softline : "";
|
33486 | }
|
33487 | function printTable(path, options, print) {
|
33488 | const node = path.getValue();
|
33489 | const columnMaxWidths = [];
|
33490 | const contents = path.map((rowPath) => rowPath.map((cellPath, columnIndex) => {
|
33491 | const text = printDocToString(print(), options).formatted;
|
33492 | const width = getStringWidth(text);
|
33493 | columnMaxWidths[columnIndex] = Math.max(columnMaxWidths[columnIndex] || 3, width);
|
33494 | return {
|
33495 | text,
|
33496 | width
|
33497 | };
|
33498 | }, "children"), "children");
|
33499 | const alignedTable = printTableContents(false);
|
33500 | if (options.proseWrap !== "never") {
|
33501 | return [breakParent, alignedTable];
|
33502 | }
|
33503 | const compactTable = printTableContents(true);
|
33504 | return [breakParent, group(ifBreak(compactTable, alignedTable))];
|
33505 | function printTableContents(isCompact) {
|
33506 | const parts = [printRow(contents[0], isCompact), printAlign(isCompact)];
|
33507 | if (contents.length > 1) {
|
33508 | parts.push(join(hardlineWithoutBreakParent, contents.slice(1).map((rowContents) => printRow(rowContents, isCompact))));
|
33509 | }
|
33510 | return join(hardlineWithoutBreakParent, parts);
|
33511 | }
|
33512 | function printAlign(isCompact) {
|
33513 | const align2 = columnMaxWidths.map((width, index) => {
|
33514 | const align3 = node.align[index];
|
33515 | const first = align3 === "center" || align3 === "left" ? ":" : "-";
|
33516 | const last = align3 === "center" || align3 === "right" ? ":" : "-";
|
33517 | const middle = isCompact ? "-" : "-".repeat(width - 2);
|
33518 | return `${first}${middle}${last}`;
|
33519 | });
|
33520 | return `| ${align2.join(" | ")} |`;
|
33521 | }
|
33522 | function printRow(rowContents, isCompact) {
|
33523 | const columns = rowContents.map(({
|
33524 | text,
|
33525 | width
|
33526 | }, columnIndex) => {
|
33527 | if (isCompact) {
|
33528 | return text;
|
33529 | }
|
33530 | const spaces = columnMaxWidths[columnIndex] - width;
|
33531 | const align2 = node.align[columnIndex];
|
33532 | let before = 0;
|
33533 | if (align2 === "right") {
|
33534 | before = spaces;
|
33535 | } else if (align2 === "center") {
|
33536 | before = Math.floor(spaces / 2);
|
33537 | }
|
33538 | const after = spaces - before;
|
33539 | return `${" ".repeat(before)}${text}${" ".repeat(after)}`;
|
33540 | });
|
33541 | return `| ${columns.join(" | ")} |`;
|
33542 | }
|
33543 | }
|
33544 | function printRoot(path, options, print) {
|
33545 | const ignoreRanges = [];
|
33546 | let ignoreStart = null;
|
33547 | const {
|
33548 | children
|
33549 | } = path.getValue();
|
33550 | for (const [index, childNode] of children.entries()) {
|
33551 | switch (isPrettierIgnore(childNode)) {
|
33552 | case "start":
|
33553 | if (ignoreStart === null) {
|
33554 | ignoreStart = {
|
33555 | index,
|
33556 | offset: childNode.position.end.offset
|
33557 | };
|
33558 | }
|
33559 | break;
|
33560 | case "end":
|
33561 | if (ignoreStart !== null) {
|
33562 | ignoreRanges.push({
|
33563 | start: ignoreStart,
|
33564 | end: {
|
33565 | index,
|
33566 | offset: childNode.position.start.offset
|
33567 | }
|
33568 | });
|
33569 | ignoreStart = null;
|
33570 | }
|
33571 | break;
|
33572 | default:
|
33573 | break;
|
33574 | }
|
33575 | }
|
33576 | return printChildren(path, options, print, {
|
33577 | processor: (childPath, index) => {
|
33578 | if (ignoreRanges.length > 0) {
|
33579 | const ignoreRange = ignoreRanges[0];
|
33580 | if (index === ignoreRange.start.index) {
|
33581 | return [printIgnoreComment(children[ignoreRange.start.index]), options.originalText.slice(ignoreRange.start.offset, ignoreRange.end.offset), printIgnoreComment(children[ignoreRange.end.index])];
|
33582 | }
|
33583 | if (ignoreRange.start.index < index && index < ignoreRange.end.index) {
|
33584 | return false;
|
33585 | }
|
33586 | if (index === ignoreRange.end.index) {
|
33587 | ignoreRanges.shift();
|
33588 | return false;
|
33589 | }
|
33590 | }
|
33591 | return print();
|
33592 | }
|
33593 | });
|
33594 | }
|
33595 | function printChildren(path, options, print, events = {}) {
|
33596 | const {
|
33597 | postprocessor
|
33598 | } = events;
|
33599 | const processor = events.processor || (() => print());
|
33600 | const node = path.getValue();
|
33601 | const parts = [];
|
33602 | let lastChildNode;
|
33603 | path.each((childPath, index) => {
|
33604 | const childNode = childPath.getValue();
|
33605 | const result = processor(childPath, index);
|
33606 | if (result !== false) {
|
33607 | const data = {
|
33608 | parts,
|
33609 | prevNode: lastChildNode,
|
33610 | parentNode: node,
|
33611 | options
|
33612 | };
|
33613 | if (shouldPrePrintHardline(childNode, data)) {
|
33614 | parts.push(hardline);
|
33615 | if (lastChildNode && TRAILING_HARDLINE_NODES.has(lastChildNode.type)) {
|
33616 | if (shouldPrePrintTripleHardline(childNode, data)) {
|
33617 | parts.push(hardline);
|
33618 | }
|
33619 | } else {
|
33620 | if (shouldPrePrintDoubleHardline(childNode, data) || shouldPrePrintTripleHardline(childNode, data)) {
|
33621 | parts.push(hardline);
|
33622 | }
|
33623 | if (shouldPrePrintTripleHardline(childNode, data)) {
|
33624 | parts.push(hardline);
|
33625 | }
|
33626 | }
|
33627 | }
|
33628 | parts.push(result);
|
33629 | lastChildNode = childNode;
|
33630 | }
|
33631 | }, "children");
|
33632 | return postprocessor ? postprocessor(parts) : parts;
|
33633 | }
|
33634 | function printIgnoreComment(node) {
|
33635 | if (node.type === "html") {
|
33636 | return node.value;
|
33637 | }
|
33638 | if (node.type === "paragraph" && Array.isArray(node.children) && node.children.length === 1 && node.children[0].type === "esComment") {
|
33639 | return ["{/* ", node.children[0].value, " */}"];
|
33640 | }
|
33641 | }
|
33642 | function getLastDescendantNode(node) {
|
33643 | let current = node;
|
33644 | while (isNonEmptyArray(current.children)) {
|
33645 | current = getLast(current.children);
|
33646 | }
|
33647 | return current;
|
33648 | }
|
33649 | function isPrettierIgnore(node) {
|
33650 | let match;
|
33651 | if (node.type === "html") {
|
33652 | match = node.value.match(/^<!--\s*prettier-ignore(?:-(start|end))?\s*-->$/);
|
33653 | } else {
|
33654 | let comment;
|
33655 | if (node.type === "esComment") {
|
33656 | comment = node;
|
33657 | } else if (node.type === "paragraph" && node.children.length === 1 && node.children[0].type === "esComment") {
|
33658 | comment = node.children[0];
|
33659 | }
|
33660 | if (comment) {
|
33661 | match = comment.value.match(/^prettier-ignore(?:-(start|end))?$/);
|
33662 | }
|
33663 | }
|
33664 | return match ? match[1] || "next" : false;
|
33665 | }
|
33666 | function shouldPrePrintHardline(node, data) {
|
33667 | const isFirstNode = data.parts.length === 0;
|
33668 | const isInlineNode = INLINE_NODE_TYPES.includes(node.type);
|
33669 | const isInlineHTML = node.type === "html" && INLINE_NODE_WRAPPER_TYPES.includes(data.parentNode.type);
|
33670 | return !isFirstNode && !isInlineNode && !isInlineHTML;
|
33671 | }
|
33672 | function shouldPrePrintDoubleHardline(node, data) {
|
33673 | var _data$prevNode, _data$prevNode2, _data$prevNode3;
|
33674 | const isSequence = (data.prevNode && data.prevNode.type) === node.type;
|
33675 | const isSiblingNode = isSequence && SIBLING_NODE_TYPES.has(node.type);
|
33676 | const isInTightListItem = data.parentNode.type === "listItem" && !data.parentNode.loose;
|
33677 | const isPrevNodeLooseListItem = ((_data$prevNode = data.prevNode) === null || _data$prevNode === void 0 ? void 0 : _data$prevNode.type) === "listItem" && data.prevNode.loose;
|
33678 | const isPrevNodePrettierIgnore = isPrettierIgnore(data.prevNode) === "next";
|
33679 | const isBlockHtmlWithoutBlankLineBetweenPrevHtml = node.type === "html" && ((_data$prevNode2 = data.prevNode) === null || _data$prevNode2 === void 0 ? void 0 : _data$prevNode2.type) === "html" && data.prevNode.position.end.line + 1 === node.position.start.line;
|
33680 | const isHtmlDirectAfterListItem = node.type === "html" && data.parentNode.type === "listItem" && ((_data$prevNode3 = data.prevNode) === null || _data$prevNode3 === void 0 ? void 0 : _data$prevNode3.type) === "paragraph" && data.prevNode.position.end.line + 1 === node.position.start.line;
|
33681 | return isPrevNodeLooseListItem || !(isSiblingNode || isInTightListItem || isPrevNodePrettierIgnore || isBlockHtmlWithoutBlankLineBetweenPrevHtml || isHtmlDirectAfterListItem);
|
33682 | }
|
33683 | function shouldPrePrintTripleHardline(node, data) {
|
33684 | const isPrevNodeList = data.prevNode && data.prevNode.type === "list";
|
33685 | const isIndentedCode = node.type === "code" && node.isIndented;
|
33686 | return isPrevNodeList && isIndentedCode;
|
33687 | }
|
33688 | function shouldRemainTheSameContent(path) {
|
33689 | const ancestorNode = getAncestorNode(path, ["linkReference", "imageReference"]);
|
33690 | return ancestorNode && (ancestorNode.type !== "linkReference" || ancestorNode.referenceType !== "full");
|
33691 | }
|
33692 | function printUrl(url, dangerousCharOrChars = []) {
|
33693 | const dangerousChars = [" ", ...Array.isArray(dangerousCharOrChars) ? dangerousCharOrChars : [dangerousCharOrChars]];
|
33694 | return new RegExp(dangerousChars.map((x) => `\\${x}`).join("|")).test(url) ? `<${url}>` : url;
|
33695 | }
|
33696 | function printTitle(title, options, printSpace = true) {
|
33697 | if (!title) {
|
33698 | return "";
|
33699 | }
|
33700 | if (printSpace) {
|
33701 | return " " + printTitle(title, options, false);
|
33702 | }
|
33703 | title = title.replace(/\\(["')])/g, "$1");
|
33704 | if (title.includes('"') && title.includes("'") && !title.includes(")")) {
|
33705 | return `(${title})`;
|
33706 | }
|
33707 | const singleCount = title.split("'").length - 1;
|
33708 | const doubleCount = title.split('"').length - 1;
|
33709 | const quote = singleCount > doubleCount ? '"' : doubleCount > singleCount ? "'" : options.singleQuote ? "'" : '"';
|
33710 | title = title.replace(/\\/, "\\\\");
|
33711 | title = title.replace(new RegExp(`(${quote})`, "g"), "\\$1");
|
33712 | return `${quote}${title}${quote}`;
|
33713 | }
|
33714 | function clamp(value, min, max) {
|
33715 | return value < min ? min : value > max ? max : value;
|
33716 | }
|
33717 | function hasPrettierIgnore(path) {
|
33718 | const index = Number(path.getName());
|
33719 | if (index === 0) {
|
33720 | return false;
|
33721 | }
|
33722 | const prevNode = path.getParentNode().children[index - 1];
|
33723 | return isPrettierIgnore(prevNode) === "next";
|
33724 | }
|
33725 | module2.exports = {
|
33726 | preprocess,
|
33727 | print: genericPrint,
|
33728 | embed,
|
33729 | massageAstNode: clean,
|
33730 | hasPrettierIgnore,
|
33731 | insertPragma
|
33732 | };
|
33733 | }
|
33734 | });
|
33735 | var require_options5 = __commonJS2({
|
33736 | "src/language-markdown/options.js"(exports2, module2) {
|
33737 | "use strict";
|
33738 | var commonOptions = require_common_options();
|
33739 | module2.exports = {
|
33740 | proseWrap: commonOptions.proseWrap,
|
33741 | singleQuote: commonOptions.singleQuote
|
33742 | };
|
33743 | }
|
33744 | });
|
33745 | var require_parsers5 = __commonJS2({
|
33746 | "src/language-markdown/parsers.js"(exports2, module2) {
|
33747 | "use strict";
|
33748 | module2.exports = {
|
33749 | get remark() {
|
33750 | return require("./parser-markdown.js").parsers.remark;
|
33751 | },
|
33752 | get markdown() {
|
33753 | return require("./parser-markdown.js").parsers.remark;
|
33754 | },
|
33755 | get mdx() {
|
33756 | return require("./parser-markdown.js").parsers.mdx;
|
33757 | }
|
33758 | };
|
33759 | }
|
33760 | });
|
33761 | var require_Markdown = __commonJS2({
|
33762 | "node_modules/linguist-languages/data/Markdown.json"(exports2, module2) {
|
33763 | module2.exports = {
|
33764 | name: "Markdown",
|
33765 | type: "prose",
|
33766 | color: "#083fa1",
|
33767 | aliases: ["pandoc"],
|
33768 | aceMode: "markdown",
|
33769 | codemirrorMode: "gfm",
|
33770 | codemirrorMimeType: "text/x-gfm",
|
33771 | wrap: true,
|
33772 | extensions: [".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"],
|
33773 | filenames: ["contents.lr"],
|
33774 | tmScope: "source.gfm",
|
33775 | languageId: 222
|
33776 | };
|
33777 | }
|
33778 | });
|
33779 | var require_language_markdown = __commonJS2({
|
33780 | "src/language-markdown/index.js"(exports2, module2) {
|
33781 | "use strict";
|
33782 | var createLanguage = require_create_language();
|
33783 | var printer = require_printer_markdown();
|
33784 | var options = require_options5();
|
33785 | var parsers = require_parsers5();
|
33786 | var languages = [createLanguage(require_Markdown(), (data) => ({
|
33787 | since: "1.8.0",
|
33788 | parsers: ["markdown"],
|
33789 | vscodeLanguageIds: ["markdown"],
|
33790 | filenames: [...data.filenames, "README"],
|
33791 | extensions: data.extensions.filter((extension) => extension !== ".mdx")
|
33792 | })), createLanguage(require_Markdown(), () => ({
|
33793 | name: "MDX",
|
33794 | since: "1.15.0",
|
33795 | parsers: ["mdx"],
|
33796 | vscodeLanguageIds: ["mdx"],
|
33797 | filenames: [],
|
33798 | extensions: [".mdx"]
|
33799 | }))];
|
33800 | var printers = {
|
33801 | mdast: printer
|
33802 | };
|
33803 | module2.exports = {
|
33804 | languages,
|
33805 | options,
|
33806 | printers,
|
33807 | parsers
|
33808 | };
|
33809 | }
|
33810 | });
|
33811 | var require_clean5 = __commonJS2({
|
33812 | "src/language-html/clean.js"(exports2, module2) {
|
33813 | "use strict";
|
33814 | var {
|
33815 | isFrontMatterNode
|
33816 | } = require_util();
|
33817 | var ignoredProperties = new Set(["sourceSpan", "startSourceSpan", "endSourceSpan", "nameSpan", "valueSpan"]);
|
33818 | function clean(ast, newNode) {
|
33819 | if (ast.type === "text" || ast.type === "comment") {
|
33820 | return null;
|
33821 | }
|
33822 | if (isFrontMatterNode(ast) || ast.type === "yaml" || ast.type === "toml") {
|
33823 | return null;
|
33824 | }
|
33825 | if (ast.type === "attribute") {
|
33826 | delete newNode.value;
|
33827 | }
|
33828 | if (ast.type === "docType") {
|
33829 | delete newNode.value;
|
33830 | }
|
33831 | }
|
33832 | clean.ignoredProperties = ignoredProperties;
|
33833 | module2.exports = clean;
|
33834 | }
|
33835 | });
|
33836 | var require_constants_evaluate2 = __commonJS2({
|
33837 | "src/language-html/constants.evaluate.js"(exports2, module2) {
|
33838 | module2.exports = {
|
33839 | CSS_DISPLAY_TAGS: {
|
33840 | area: "none",
|
33841 | base: "none",
|
33842 | basefont: "none",
|
33843 | datalist: "none",
|
33844 | head: "none",
|
33845 | link: "none",
|
33846 | meta: "none",
|
33847 | noembed: "none",
|
33848 | noframes: "none",
|
33849 | param: "block",
|
33850 | rp: "none",
|
33851 | script: "block",
|
33852 | source: "block",
|
33853 | style: "none",
|
33854 | template: "inline",
|
33855 | track: "block",
|
33856 | title: "none",
|
33857 | html: "block",
|
33858 | body: "block",
|
33859 | address: "block",
|
33860 | blockquote: "block",
|
33861 | center: "block",
|
33862 | div: "block",
|
33863 | figure: "block",
|
33864 | figcaption: "block",
|
33865 | footer: "block",
|
33866 | form: "block",
|
33867 | header: "block",
|
33868 | hr: "block",
|
33869 | legend: "block",
|
33870 | listing: "block",
|
33871 | main: "block",
|
33872 | p: "block",
|
33873 | plaintext: "block",
|
33874 | pre: "block",
|
33875 | xmp: "block",
|
33876 | slot: "contents",
|
33877 | ruby: "ruby",
|
33878 | rt: "ruby-text",
|
33879 | article: "block",
|
33880 | aside: "block",
|
33881 | h1: "block",
|
33882 | h2: "block",
|
33883 | h3: "block",
|
33884 | h4: "block",
|
33885 | h5: "block",
|
33886 | h6: "block",
|
33887 | hgroup: "block",
|
33888 | nav: "block",
|
33889 | section: "block",
|
33890 | dir: "block",
|
33891 | dd: "block",
|
33892 | dl: "block",
|
33893 | dt: "block",
|
33894 | ol: "block",
|
33895 | ul: "block",
|
33896 | li: "list-item",
|
33897 | table: "table",
|
33898 | caption: "table-caption",
|
33899 | colgroup: "table-column-group",
|
33900 | col: "table-column",
|
33901 | thead: "table-header-group",
|
33902 | tbody: "table-row-group",
|
33903 | tfoot: "table-footer-group",
|
33904 | tr: "table-row",
|
33905 | td: "table-cell",
|
33906 | th: "table-cell",
|
33907 | fieldset: "block",
|
33908 | button: "inline-block",
|
33909 | details: "block",
|
33910 | summary: "block",
|
33911 | dialog: "block",
|
33912 | meter: "inline-block",
|
33913 | progress: "inline-block",
|
33914 | object: "inline-block",
|
33915 | video: "inline-block",
|
33916 | audio: "inline-block",
|
33917 | select: "inline-block",
|
33918 | option: "block",
|
33919 | optgroup: "block"
|
33920 | },
|
33921 | CSS_DISPLAY_DEFAULT: "inline",
|
33922 | CSS_WHITE_SPACE_TAGS: {
|
33923 | listing: "pre",
|
33924 | plaintext: "pre",
|
33925 | pre: "pre",
|
33926 | xmp: "pre",
|
33927 | nobr: "nowrap",
|
33928 | table: "initial",
|
33929 | textarea: "pre-wrap"
|
33930 | },
|
33931 | CSS_WHITE_SPACE_DEFAULT: "normal"
|
33932 | };
|
33933 | }
|
33934 | });
|
33935 | var require_is_unknown_namespace = __commonJS2({
|
33936 | "src/language-html/utils/is-unknown-namespace.js"(exports2, module2) {
|
33937 | "use strict";
|
33938 | function isUnknownNamespace(node) {
|
33939 | return node.type === "element" && !node.hasExplicitNamespace && !["html", "svg"].includes(node.namespace);
|
33940 | }
|
33941 | module2.exports = isUnknownNamespace;
|
33942 | }
|
33943 | });
|
33944 | var require_utils11 = __commonJS2({
|
33945 | "src/language-html/utils/index.js"(exports2, module2) {
|
33946 | "use strict";
|
33947 | var {
|
33948 | inferParserByLanguage,
|
33949 | isFrontMatterNode
|
33950 | } = require_util();
|
33951 | var {
|
33952 | builders: {
|
33953 | line,
|
33954 | hardline,
|
33955 | join
|
33956 | },
|
33957 | utils: {
|
33958 | getDocParts,
|
33959 | replaceTextEndOfLine
|
33960 | }
|
33961 | } = require("./doc.js");
|
33962 | var {
|
33963 | CSS_DISPLAY_TAGS,
|
33964 | CSS_DISPLAY_DEFAULT,
|
33965 | CSS_WHITE_SPACE_TAGS,
|
33966 | CSS_WHITE_SPACE_DEFAULT
|
33967 | } = require_constants_evaluate2();
|
33968 | var isUnknownNamespace = require_is_unknown_namespace();
|
33969 | var HTML_WHITESPACE = new Set([" ", "\n", "\f", "\r", " "]);
|
33970 | var htmlTrimStart = (string) => string.replace(/^[\t\n\f\r ]+/, "");
|
33971 | var htmlTrimEnd = (string) => string.replace(/[\t\n\f\r ]+$/, "");
|
33972 | var htmlTrim = (string) => htmlTrimStart(htmlTrimEnd(string));
|
33973 | var htmlTrimLeadingBlankLines = (string) => string.replace(/^[\t\f\r ]*\n/g, "");
|
33974 | var htmlTrimPreserveIndentation = (string) => htmlTrimLeadingBlankLines(htmlTrimEnd(string));
|
33975 | var splitByHtmlWhitespace = (string) => string.split(/[\t\n\f\r ]+/);
|
33976 | var getLeadingHtmlWhitespace = (string) => string.match(/^[\t\n\f\r ]*/)[0];
|
33977 | var getLeadingAndTrailingHtmlWhitespace = (string) => {
|
33978 | const [, leadingWhitespace, text, trailingWhitespace] = string.match(/^([\t\n\f\r ]*)(.*?)([\t\n\f\r ]*)$/s);
|
33979 | return {
|
33980 | leadingWhitespace,
|
33981 | trailingWhitespace,
|
33982 | text
|
33983 | };
|
33984 | };
|
33985 | var hasHtmlWhitespace = (string) => /[\t\n\f\r ]/.test(string);
|
33986 | function shouldPreserveContent(node, options) {
|
33987 | if (node.type === "ieConditionalComment" && node.lastChild && !node.lastChild.isSelfClosing && !node.lastChild.endSourceSpan) {
|
33988 | return true;
|
33989 | }
|
33990 | if (node.type === "ieConditionalComment" && !node.complete) {
|
33991 | return true;
|
33992 | }
|
33993 | if (isPreLikeNode(node) && node.children.some((child) => child.type !== "text" && child.type !== "interpolation")) {
|
33994 | return true;
|
33995 | }
|
33996 | if (isVueNonHtmlBlock(node, options) && !isScriptLikeTag(node) && node.type !== "interpolation") {
|
33997 | return true;
|
33998 | }
|
33999 | return false;
|
34000 | }
|
34001 | function hasPrettierIgnore(node) {
|
34002 | if (node.type === "attribute") {
|
34003 | return false;
|
34004 | }
|
34005 | if (!node.parent) {
|
34006 | return false;
|
34007 | }
|
34008 | if (!node.prev) {
|
34009 | return false;
|
34010 | }
|
34011 | return isPrettierIgnore(node.prev);
|
34012 | }
|
34013 | function isPrettierIgnore(node) {
|
34014 | return node.type === "comment" && node.value.trim() === "prettier-ignore";
|
34015 | }
|
34016 | function isTextLikeNode(node) {
|
34017 | return node.type === "text" || node.type === "comment";
|
34018 | }
|
34019 | function isScriptLikeTag(node) {
|
34020 | return node.type === "element" && (node.fullName === "script" || node.fullName === "style" || node.fullName === "svg:style" || isUnknownNamespace(node) && (node.name === "script" || node.name === "style"));
|
34021 | }
|
34022 | function canHaveInterpolation(node) {
|
34023 | return node.children && !isScriptLikeTag(node);
|
34024 | }
|
34025 | function isWhitespaceSensitiveNode(node) {
|
34026 | return isScriptLikeTag(node) || node.type === "interpolation" || isIndentationSensitiveNode(node);
|
34027 | }
|
34028 | function isIndentationSensitiveNode(node) {
|
34029 | return getNodeCssStyleWhiteSpace(node).startsWith("pre");
|
34030 | }
|
34031 | function isLeadingSpaceSensitiveNode(node, options) {
|
34032 | const isLeadingSpaceSensitive = _isLeadingSpaceSensitiveNode();
|
34033 | if (isLeadingSpaceSensitive && !node.prev && node.parent && node.parent.tagDefinition && node.parent.tagDefinition.ignoreFirstLf) {
|
34034 | return node.type === "interpolation";
|
34035 | }
|
34036 | return isLeadingSpaceSensitive;
|
34037 | function _isLeadingSpaceSensitiveNode() {
|
34038 | if (isFrontMatterNode(node)) {
|
34039 | return false;
|
34040 | }
|
34041 | if ((node.type === "text" || node.type === "interpolation") && node.prev && (node.prev.type === "text" || node.prev.type === "interpolation")) {
|
34042 | return true;
|
34043 | }
|
34044 | if (!node.parent || node.parent.cssDisplay === "none") {
|
34045 | return false;
|
34046 | }
|
34047 | if (isPreLikeNode(node.parent)) {
|
34048 | return true;
|
34049 | }
|
34050 | if (!node.prev && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isFirstChildLeadingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
|
34051 | return false;
|
34052 | }
|
34053 | if (node.prev && !isNextLeadingSpaceSensitiveCssDisplay(node.prev.cssDisplay)) {
|
34054 | return false;
|
34055 | }
|
34056 | return true;
|
34057 | }
|
34058 | }
|
34059 | function isTrailingSpaceSensitiveNode(node, options) {
|
34060 | if (isFrontMatterNode(node)) {
|
34061 | return false;
|
34062 | }
|
34063 | if ((node.type === "text" || node.type === "interpolation") && node.next && (node.next.type === "text" || node.next.type === "interpolation")) {
|
34064 | return true;
|
34065 | }
|
34066 | if (!node.parent || node.parent.cssDisplay === "none") {
|
34067 | return false;
|
34068 | }
|
34069 | if (isPreLikeNode(node.parent)) {
|
34070 | return true;
|
34071 | }
|
34072 | if (!node.next && (node.parent.type === "root" || isPreLikeNode(node) && node.parent || isScriptLikeTag(node.parent) || isVueCustomBlock(node.parent, options) || !isLastChildTrailingSpaceSensitiveCssDisplay(node.parent.cssDisplay))) {
|
34073 | return false;
|
34074 | }
|
34075 | if (node.next && !isPrevTrailingSpaceSensitiveCssDisplay(node.next.cssDisplay)) {
|
34076 | return false;
|
34077 | }
|
34078 | return true;
|
34079 | }
|
34080 | function isDanglingSpaceSensitiveNode(node) {
|
34081 | return isDanglingSpaceSensitiveCssDisplay(node.cssDisplay) && !isScriptLikeTag(node);
|
34082 | }
|
34083 | function forceNextEmptyLine(node) {
|
34084 | return isFrontMatterNode(node) || node.next && node.sourceSpan.end && node.sourceSpan.end.line + 1 < node.next.sourceSpan.start.line;
|
34085 | }
|
34086 | function forceBreakContent(node) {
|
34087 | return forceBreakChildren(node) || node.type === "element" && node.children.length > 0 && (["body", "script", "style"].includes(node.name) || node.children.some((child) => hasNonTextChild(child))) || node.firstChild && node.firstChild === node.lastChild && node.firstChild.type !== "text" && hasLeadingLineBreak(node.firstChild) && (!node.lastChild.isTrailingSpaceSensitive || hasTrailingLineBreak(node.lastChild));
|
34088 | }
|
34089 | function forceBreakChildren(node) {
|
34090 | return node.type === "element" && node.children.length > 0 && (["html", "head", "ul", "ol", "select"].includes(node.name) || node.cssDisplay.startsWith("table") && node.cssDisplay !== "table-cell");
|
34091 | }
|
34092 | function preferHardlineAsLeadingSpaces(node) {
|
34093 | return preferHardlineAsSurroundingSpaces(node) || node.prev && preferHardlineAsTrailingSpaces(node.prev) || hasSurroundingLineBreak(node);
|
34094 | }
|
34095 | function preferHardlineAsTrailingSpaces(node) {
|
34096 | return preferHardlineAsSurroundingSpaces(node) || node.type === "element" && node.fullName === "br" || hasSurroundingLineBreak(node);
|
34097 | }
|
34098 | function hasSurroundingLineBreak(node) {
|
34099 | return hasLeadingLineBreak(node) && hasTrailingLineBreak(node);
|
34100 | }
|
34101 | function hasLeadingLineBreak(node) {
|
34102 | return node.hasLeadingSpaces && (node.prev ? node.prev.sourceSpan.end.line < node.sourceSpan.start.line : node.parent.type === "root" || node.parent.startSourceSpan.end.line < node.sourceSpan.start.line);
|
34103 | }
|
34104 | function hasTrailingLineBreak(node) {
|
34105 | return node.hasTrailingSpaces && (node.next ? node.next.sourceSpan.start.line > node.sourceSpan.end.line : node.parent.type === "root" || node.parent.endSourceSpan && node.parent.endSourceSpan.start.line > node.sourceSpan.end.line);
|
34106 | }
|
34107 | function preferHardlineAsSurroundingSpaces(node) {
|
34108 | switch (node.type) {
|
34109 | case "ieConditionalComment":
|
34110 | case "comment":
|
34111 | case "directive":
|
34112 | return true;
|
34113 | case "element":
|
34114 | return ["script", "select"].includes(node.name);
|
34115 | }
|
34116 | return false;
|
34117 | }
|
34118 | function getLastDescendant(node) {
|
34119 | return node.lastChild ? getLastDescendant(node.lastChild) : node;
|
34120 | }
|
34121 | function hasNonTextChild(node) {
|
34122 | return node.children && node.children.some((child) => child.type !== "text");
|
34123 | }
|
34124 | function _inferScriptParser(node) {
|
34125 | const {
|
34126 | type,
|
34127 | lang
|
34128 | } = node.attrMap;
|
34129 | if (type === "module" || type === "text/javascript" || type === "text/babel" || type === "application/javascript" || lang === "jsx") {
|
34130 | return "babel";
|
34131 | }
|
34132 | if (type === "application/x-typescript" || lang === "ts" || lang === "tsx") {
|
34133 | return "typescript";
|
34134 | }
|
34135 | if (type === "text/markdown") {
|
34136 | return "markdown";
|
34137 | }
|
34138 | if (type === "text/html") {
|
34139 | return "html";
|
34140 | }
|
34141 | if (type && (type.endsWith("json") || type.endsWith("importmap")) || type === "speculationrules") {
|
34142 | return "json";
|
34143 | }
|
34144 | if (type === "text/x-handlebars-template") {
|
34145 | return "glimmer";
|
34146 | }
|
34147 | }
|
34148 | function inferStyleParser(node, options) {
|
34149 | const {
|
34150 | lang
|
34151 | } = node.attrMap;
|
34152 | if (!lang || lang === "postcss" || lang === "css") {
|
34153 | return "css";
|
34154 | }
|
34155 | if (lang === "scss") {
|
34156 | return "scss";
|
34157 | }
|
34158 | if (lang === "less") {
|
34159 | return "less";
|
34160 | }
|
34161 | if (lang === "stylus") {
|
34162 | return inferParserByLanguage("stylus", options);
|
34163 | }
|
34164 | }
|
34165 | function inferScriptParser(node, options) {
|
34166 | if (node.name === "script" && !node.attrMap.src) {
|
34167 | if (!node.attrMap.lang && !node.attrMap.type) {
|
34168 | return "babel";
|
34169 | }
|
34170 | return _inferScriptParser(node);
|
34171 | }
|
34172 | if (node.name === "style") {
|
34173 | return inferStyleParser(node, options);
|
34174 | }
|
34175 | if (options && isVueNonHtmlBlock(node, options)) {
|
34176 | return _inferScriptParser(node) || !("src" in node.attrMap) && inferParserByLanguage(node.attrMap.lang, options);
|
34177 | }
|
34178 | }
|
34179 | function isBlockLikeCssDisplay(cssDisplay) {
|
34180 | return cssDisplay === "block" || cssDisplay === "list-item" || cssDisplay.startsWith("table");
|
34181 | }
|
34182 | function isFirstChildLeadingSpaceSensitiveCssDisplay(cssDisplay) {
|
34183 | return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
|
34184 | }
|
34185 | function isLastChildTrailingSpaceSensitiveCssDisplay(cssDisplay) {
|
34186 | return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
|
34187 | }
|
34188 | function isPrevTrailingSpaceSensitiveCssDisplay(cssDisplay) {
|
34189 | return !isBlockLikeCssDisplay(cssDisplay);
|
34190 | }
|
34191 | function isNextLeadingSpaceSensitiveCssDisplay(cssDisplay) {
|
34192 | return !isBlockLikeCssDisplay(cssDisplay);
|
34193 | }
|
34194 | function isDanglingSpaceSensitiveCssDisplay(cssDisplay) {
|
34195 | return !isBlockLikeCssDisplay(cssDisplay) && cssDisplay !== "inline-block";
|
34196 | }
|
34197 | function isPreLikeNode(node) {
|
34198 | return getNodeCssStyleWhiteSpace(node).startsWith("pre");
|
34199 | }
|
34200 | function countParents(path, predicate) {
|
34201 | let counter = 0;
|
34202 | for (let i = path.stack.length - 1; i >= 0; i--) {
|
34203 | const value = path.stack[i];
|
34204 | if (value && typeof value === "object" && !Array.isArray(value) && predicate(value)) {
|
34205 | counter++;
|
34206 | }
|
34207 | }
|
34208 | return counter;
|
34209 | }
|
34210 | function hasParent(node, fn) {
|
34211 | let current = node;
|
34212 | while (current) {
|
34213 | if (fn(current)) {
|
34214 | return true;
|
34215 | }
|
34216 | current = current.parent;
|
34217 | }
|
34218 | return false;
|
34219 | }
|
34220 | function getNodeCssStyleDisplay(node, options) {
|
34221 | if (node.prev && node.prev.type === "comment") {
|
34222 | const match = node.prev.value.match(/^\s*display:\s*([a-z]+)\s*$/);
|
34223 | if (match) {
|
34224 | return match[1];
|
34225 | }
|
34226 | }
|
34227 | let isInSvgForeignObject = false;
|
34228 | if (node.type === "element" && node.namespace === "svg") {
|
34229 | if (hasParent(node, (parent) => parent.fullName === "svg:foreignObject")) {
|
34230 | isInSvgForeignObject = true;
|
34231 | } else {
|
34232 | return node.name === "svg" ? "inline-block" : "block";
|
34233 | }
|
34234 | }
|
34235 | switch (options.htmlWhitespaceSensitivity) {
|
34236 | case "strict":
|
34237 | return "inline";
|
34238 | case "ignore":
|
34239 | return "block";
|
34240 | default: {
|
34241 | if (options.parser === "vue" && node.parent && node.parent.type === "root") {
|
34242 | return "block";
|
34243 | }
|
34244 | return node.type === "element" && (!node.namespace || isInSvgForeignObject || isUnknownNamespace(node)) && CSS_DISPLAY_TAGS[node.name] || CSS_DISPLAY_DEFAULT;
|
34245 | }
|
34246 | }
|
34247 | }
|
34248 | function getNodeCssStyleWhiteSpace(node) {
|
34249 | return node.type === "element" && (!node.namespace || isUnknownNamespace(node)) && CSS_WHITE_SPACE_TAGS[node.name] || CSS_WHITE_SPACE_DEFAULT;
|
34250 | }
|
34251 | function getMinIndentation(text) {
|
34252 | let minIndentation = Number.POSITIVE_INFINITY;
|
34253 | for (const lineText of text.split("\n")) {
|
34254 | if (lineText.length === 0) {
|
34255 | continue;
|
34256 | }
|
34257 | if (!HTML_WHITESPACE.has(lineText[0])) {
|
34258 | return 0;
|
34259 | }
|
34260 | const indentation = getLeadingHtmlWhitespace(lineText).length;
|
34261 | if (lineText.length === indentation) {
|
34262 | continue;
|
34263 | }
|
34264 | if (indentation < minIndentation) {
|
34265 | minIndentation = indentation;
|
34266 | }
|
34267 | }
|
34268 | return minIndentation === Number.POSITIVE_INFINITY ? 0 : minIndentation;
|
34269 | }
|
34270 | function dedentString(text, minIndent = getMinIndentation(text)) {
|
34271 | return minIndent === 0 ? text : text.split("\n").map((lineText) => lineText.slice(minIndent)).join("\n");
|
34272 | }
|
34273 | function countChars(text, char) {
|
34274 | let counter = 0;
|
34275 | for (let i = 0; i < text.length; i++) {
|
34276 | if (text[i] === char) {
|
34277 | counter++;
|
34278 | }
|
34279 | }
|
34280 | return counter;
|
34281 | }
|
34282 | function unescapeQuoteEntities(text) {
|
34283 | return text.replace(/'/g, "'").replace(/"/g, '"');
|
34284 | }
|
34285 | var vueRootElementsSet = new Set(["template", "style", "script"]);
|
34286 | function isVueCustomBlock(node, options) {
|
34287 | return isVueSfcBlock(node, options) && !vueRootElementsSet.has(node.fullName);
|
34288 | }
|
34289 | function isVueSfcBlock(node, options) {
|
34290 | return options.parser === "vue" && node.type === "element" && node.parent.type === "root" && node.fullName.toLowerCase() !== "html";
|
34291 | }
|
34292 | function isVueNonHtmlBlock(node, options) {
|
34293 | return isVueSfcBlock(node, options) && (isVueCustomBlock(node, options) || node.attrMap.lang && node.attrMap.lang !== "html");
|
34294 | }
|
34295 | function isVueSlotAttribute(attribute) {
|
34296 | const attributeName = attribute.fullName;
|
34297 | return attributeName.charAt(0) === "#" || attributeName === "slot-scope" || attributeName === "v-slot" || attributeName.startsWith("v-slot:");
|
34298 | }
|
34299 | function isVueSfcBindingsAttribute(attribute, options) {
|
34300 | const element = attribute.parent;
|
34301 | if (!isVueSfcBlock(element, options)) {
|
34302 | return false;
|
34303 | }
|
34304 | const tagName = element.fullName;
|
34305 | const attributeName = attribute.fullName;
|
34306 | return tagName === "script" && attributeName === "setup" || tagName === "style" && attributeName === "vars";
|
34307 | }
|
34308 | function getTextValueParts(node, value = node.value) {
|
34309 | return node.parent.isWhitespaceSensitive ? node.parent.isIndentationSensitive ? replaceTextEndOfLine(value) : replaceTextEndOfLine(dedentString(htmlTrimPreserveIndentation(value)), hardline) : getDocParts(join(line, splitByHtmlWhitespace(value)));
|
34310 | }
|
34311 | function isVueScriptTag(node, options) {
|
34312 | return isVueSfcBlock(node, options) && node.name === "script";
|
34313 | }
|
34314 | module2.exports = {
|
34315 | htmlTrim,
|
34316 | htmlTrimPreserveIndentation,
|
34317 | hasHtmlWhitespace,
|
34318 | getLeadingAndTrailingHtmlWhitespace,
|
34319 | canHaveInterpolation,
|
34320 | countChars,
|
34321 | countParents,
|
34322 | dedentString,
|
34323 | forceBreakChildren,
|
34324 | forceBreakContent,
|
34325 | forceNextEmptyLine,
|
34326 | getLastDescendant,
|
34327 | getNodeCssStyleDisplay,
|
34328 | getNodeCssStyleWhiteSpace,
|
34329 | hasPrettierIgnore,
|
34330 | inferScriptParser,
|
34331 | isVueCustomBlock,
|
34332 | isVueNonHtmlBlock,
|
34333 | isVueScriptTag,
|
34334 | isVueSlotAttribute,
|
34335 | isVueSfcBindingsAttribute,
|
34336 | isVueSfcBlock,
|
34337 | isDanglingSpaceSensitiveNode,
|
34338 | isIndentationSensitiveNode,
|
34339 | isLeadingSpaceSensitiveNode,
|
34340 | isPreLikeNode,
|
34341 | isScriptLikeTag,
|
34342 | isTextLikeNode,
|
34343 | isTrailingSpaceSensitiveNode,
|
34344 | isWhitespaceSensitiveNode,
|
34345 | isUnknownNamespace,
|
34346 | preferHardlineAsLeadingSpaces,
|
34347 | preferHardlineAsTrailingSpaces,
|
34348 | shouldPreserveContent,
|
34349 | unescapeQuoteEntities,
|
34350 | getTextValueParts
|
34351 | };
|
34352 | }
|
34353 | });
|
34354 | var require_chars = __commonJS2({
|
34355 | "node_modules/angular-html-parser/lib/compiler/src/chars.js"(exports2) {
|
34356 | "use strict";
|
34357 | Object.defineProperty(exports2, "__esModule", {
|
34358 | value: true
|
34359 | });
|
34360 | exports2.$EOF = 0;
|
34361 | exports2.$BSPACE = 8;
|
34362 | exports2.$TAB = 9;
|
34363 | exports2.$LF = 10;
|
34364 | exports2.$VTAB = 11;
|
34365 | exports2.$FF = 12;
|
34366 | exports2.$CR = 13;
|
34367 | exports2.$SPACE = 32;
|
34368 | exports2.$BANG = 33;
|
34369 | exports2.$DQ = 34;
|
34370 | exports2.$HASH = 35;
|
34371 | exports2.$$ = 36;
|
34372 | exports2.$PERCENT = 37;
|
34373 | exports2.$AMPERSAND = 38;
|
34374 | exports2.$SQ = 39;
|
34375 | exports2.$LPAREN = 40;
|
34376 | exports2.$RPAREN = 41;
|
34377 | exports2.$STAR = 42;
|
34378 | exports2.$PLUS = 43;
|
34379 | exports2.$COMMA = 44;
|
34380 | exports2.$MINUS = 45;
|
34381 | exports2.$PERIOD = 46;
|
34382 | exports2.$SLASH = 47;
|
34383 | exports2.$COLON = 58;
|
34384 | exports2.$SEMICOLON = 59;
|
34385 | exports2.$LT = 60;
|
34386 | exports2.$EQ = 61;
|
34387 | exports2.$GT = 62;
|
34388 | exports2.$QUESTION = 63;
|
34389 | exports2.$0 = 48;
|
34390 | exports2.$7 = 55;
|
34391 | exports2.$9 = 57;
|
34392 | exports2.$A = 65;
|
34393 | exports2.$E = 69;
|
34394 | exports2.$F = 70;
|
34395 | exports2.$X = 88;
|
34396 | exports2.$Z = 90;
|
34397 | exports2.$LBRACKET = 91;
|
34398 | exports2.$BACKSLASH = 92;
|
34399 | exports2.$RBRACKET = 93;
|
34400 | exports2.$CARET = 94;
|
34401 | exports2.$_ = 95;
|
34402 | exports2.$a = 97;
|
34403 | exports2.$b = 98;
|
34404 | exports2.$e = 101;
|
34405 | exports2.$f = 102;
|
34406 | exports2.$n = 110;
|
34407 | exports2.$r = 114;
|
34408 | exports2.$t = 116;
|
34409 | exports2.$u = 117;
|
34410 | exports2.$v = 118;
|
34411 | exports2.$x = 120;
|
34412 | exports2.$z = 122;
|
34413 | exports2.$LBRACE = 123;
|
34414 | exports2.$BAR = 124;
|
34415 | exports2.$RBRACE = 125;
|
34416 | exports2.$NBSP = 160;
|
34417 | exports2.$PIPE = 124;
|
34418 | exports2.$TILDA = 126;
|
34419 | exports2.$AT = 64;
|
34420 | exports2.$BT = 96;
|
34421 | function isWhitespace(code) {
|
34422 | return code >= exports2.$TAB && code <= exports2.$SPACE || code == exports2.$NBSP;
|
34423 | }
|
34424 | exports2.isWhitespace = isWhitespace;
|
34425 | function isDigit(code) {
|
34426 | return exports2.$0 <= code && code <= exports2.$9;
|
34427 | }
|
34428 | exports2.isDigit = isDigit;
|
34429 | function isAsciiLetter(code) {
|
34430 | return code >= exports2.$a && code <= exports2.$z || code >= exports2.$A && code <= exports2.$Z;
|
34431 | }
|
34432 | exports2.isAsciiLetter = isAsciiLetter;
|
34433 | function isAsciiHexDigit(code) {
|
34434 | return code >= exports2.$a && code <= exports2.$f || code >= exports2.$A && code <= exports2.$F || isDigit(code);
|
34435 | }
|
34436 | exports2.isAsciiHexDigit = isAsciiHexDigit;
|
34437 | function isNewLine(code) {
|
34438 | return code === exports2.$LF || code === exports2.$CR;
|
34439 | }
|
34440 | exports2.isNewLine = isNewLine;
|
34441 | function isOctalDigit(code) {
|
34442 | return exports2.$0 <= code && code <= exports2.$7;
|
34443 | }
|
34444 | exports2.isOctalDigit = isOctalDigit;
|
34445 | }
|
34446 | });
|
34447 | var require_static_symbol = __commonJS2({
|
34448 | "node_modules/angular-html-parser/lib/compiler/src/aot/static_symbol.js"(exports2) {
|
34449 | "use strict";
|
34450 | Object.defineProperty(exports2, "__esModule", {
|
34451 | value: true
|
34452 | });
|
34453 | var StaticSymbol = class {
|
34454 | constructor(filePath, name, members) {
|
34455 | this.filePath = filePath;
|
34456 | this.name = name;
|
34457 | this.members = members;
|
34458 | }
|
34459 | assertNoMembers() {
|
34460 | if (this.members.length) {
|
34461 | throw new Error(`Illegal state: symbol without members expected, but got ${JSON.stringify(this)}.`);
|
34462 | }
|
34463 | }
|
34464 | };
|
34465 | exports2.StaticSymbol = StaticSymbol;
|
34466 | var StaticSymbolCache = class {
|
34467 | constructor() {
|
34468 | this.cache = new Map();
|
34469 | }
|
34470 | get(declarationFile, name, members) {
|
34471 | members = members || [];
|
34472 | const memberSuffix = members.length ? `.${members.join(".")}` : "";
|
34473 | const key = `"${declarationFile}".${name}${memberSuffix}`;
|
34474 | let result = this.cache.get(key);
|
34475 | if (!result) {
|
34476 | result = new StaticSymbol(declarationFile, name, members);
|
34477 | this.cache.set(key, result);
|
34478 | }
|
34479 | return result;
|
34480 | }
|
34481 | };
|
34482 | exports2.StaticSymbolCache = StaticSymbolCache;
|
34483 | }
|
34484 | });
|
34485 | var require_util3 = __commonJS2({
|
34486 | "node_modules/angular-html-parser/lib/compiler/src/util.js"(exports2) {
|
34487 | "use strict";
|
34488 | Object.defineProperty(exports2, "__esModule", {
|
34489 | value: true
|
34490 | });
|
34491 | var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
34492 | function dashCaseToCamelCase(input) {
|
34493 | return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
34494 | }
|
34495 | exports2.dashCaseToCamelCase = dashCaseToCamelCase;
|
34496 | function splitAtColon(input, defaultValues) {
|
34497 | return _splitAt(input, ":", defaultValues);
|
34498 | }
|
34499 | exports2.splitAtColon = splitAtColon;
|
34500 | function splitAtPeriod(input, defaultValues) {
|
34501 | return _splitAt(input, ".", defaultValues);
|
34502 | }
|
34503 | exports2.splitAtPeriod = splitAtPeriod;
|
34504 | function _splitAt(input, character, defaultValues) {
|
34505 | const characterIndex = input.indexOf(character);
|
34506 | if (characterIndex == -1)
|
34507 | return defaultValues;
|
34508 | return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
|
34509 | }
|
34510 | function visitValue(value, visitor, context) {
|
34511 | if (Array.isArray(value)) {
|
34512 | return visitor.visitArray(value, context);
|
34513 | }
|
34514 | if (isStrictStringMap(value)) {
|
34515 | return visitor.visitStringMap(value, context);
|
34516 | }
|
34517 | if (value == null || typeof value == "string" || typeof value == "number" || typeof value == "boolean") {
|
34518 | return visitor.visitPrimitive(value, context);
|
34519 | }
|
34520 | return visitor.visitOther(value, context);
|
34521 | }
|
34522 | exports2.visitValue = visitValue;
|
34523 | function isDefined(val) {
|
34524 | return val !== null && val !== void 0;
|
34525 | }
|
34526 | exports2.isDefined = isDefined;
|
34527 | function noUndefined(val) {
|
34528 | return val === void 0 ? null : val;
|
34529 | }
|
34530 | exports2.noUndefined = noUndefined;
|
34531 | var ValueTransformer = class {
|
34532 | visitArray(arr, context) {
|
34533 | return arr.map((value) => visitValue(value, this, context));
|
34534 | }
|
34535 | visitStringMap(map, context) {
|
34536 | const result = {};
|
34537 | Object.keys(map).forEach((key) => {
|
34538 | result[key] = visitValue(map[key], this, context);
|
34539 | });
|
34540 | return result;
|
34541 | }
|
34542 | visitPrimitive(value, context) {
|
34543 | return value;
|
34544 | }
|
34545 | visitOther(value, context) {
|
34546 | return value;
|
34547 | }
|
34548 | };
|
34549 | exports2.ValueTransformer = ValueTransformer;
|
34550 | exports2.SyncAsync = {
|
34551 | assertSync: (value) => {
|
34552 | if (isPromise(value)) {
|
34553 | throw new Error(`Illegal state: value cannot be a promise`);
|
34554 | }
|
34555 | return value;
|
34556 | },
|
34557 | then: (value, cb) => {
|
34558 | return isPromise(value) ? value.then(cb) : cb(value);
|
34559 | },
|
34560 | all: (syncAsyncValues) => {
|
34561 | return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
|
34562 | }
|
34563 | };
|
34564 | function error(msg) {
|
34565 | throw new Error(`Internal Error: ${msg}`);
|
34566 | }
|
34567 | exports2.error = error;
|
34568 | function syntaxError(msg, parseErrors) {
|
34569 | const error2 = Error(msg);
|
34570 | error2[ERROR_SYNTAX_ERROR] = true;
|
34571 | if (parseErrors)
|
34572 | error2[ERROR_PARSE_ERRORS] = parseErrors;
|
34573 | return error2;
|
34574 | }
|
34575 | exports2.syntaxError = syntaxError;
|
34576 | var ERROR_SYNTAX_ERROR = "ngSyntaxError";
|
34577 | var ERROR_PARSE_ERRORS = "ngParseErrors";
|
34578 | function isSyntaxError(error2) {
|
34579 | return error2[ERROR_SYNTAX_ERROR];
|
34580 | }
|
34581 | exports2.isSyntaxError = isSyntaxError;
|
34582 | function getParseErrors(error2) {
|
34583 | return error2[ERROR_PARSE_ERRORS] || [];
|
34584 | }
|
34585 | exports2.getParseErrors = getParseErrors;
|
34586 | function escapeRegExp(s) {
|
34587 | return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
|
34588 | }
|
34589 | exports2.escapeRegExp = escapeRegExp;
|
34590 | var STRING_MAP_PROTO = Object.getPrototypeOf({});
|
34591 | function isStrictStringMap(obj) {
|
34592 | return typeof obj === "object" && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
|
34593 | }
|
34594 | function utf8Encode(str) {
|
34595 | let encoded = "";
|
34596 | for (let index = 0; index < str.length; index++) {
|
34597 | let codePoint = str.charCodeAt(index);
|
34598 | if (codePoint >= 55296 && codePoint <= 56319 && str.length > index + 1) {
|
34599 | const low = str.charCodeAt(index + 1);
|
34600 | if (low >= 56320 && low <= 57343) {
|
34601 | index++;
|
34602 | codePoint = (codePoint - 55296 << 10) + low - 56320 + 65536;
|
34603 | }
|
34604 | }
|
34605 | if (codePoint <= 127) {
|
34606 | encoded += String.fromCharCode(codePoint);
|
34607 | } else if (codePoint <= 2047) {
|
34608 | encoded += String.fromCharCode(codePoint >> 6 & 31 | 192, codePoint & 63 | 128);
|
34609 | } else if (codePoint <= 65535) {
|
34610 | encoded += String.fromCharCode(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
34611 | } else if (codePoint <= 2097151) {
|
34612 | encoded += String.fromCharCode(codePoint >> 18 & 7 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, codePoint & 63 | 128);
|
34613 | }
|
34614 | }
|
34615 | return encoded;
|
34616 | }
|
34617 | exports2.utf8Encode = utf8Encode;
|
34618 | function stringify(token) {
|
34619 | if (typeof token === "string") {
|
34620 | return token;
|
34621 | }
|
34622 | if (token instanceof Array) {
|
34623 | return "[" + token.map(stringify).join(", ") + "]";
|
34624 | }
|
34625 | if (token == null) {
|
34626 | return "" + token;
|
34627 | }
|
34628 | if (token.overriddenName) {
|
34629 | return `${token.overriddenName}`;
|
34630 | }
|
34631 | if (token.name) {
|
34632 | return `${token.name}`;
|
34633 | }
|
34634 | if (!token.toString) {
|
34635 | return "object";
|
34636 | }
|
34637 | const res = token.toString();
|
34638 | if (res == null) {
|
34639 | return "" + res;
|
34640 | }
|
34641 | const newLineIndex = res.indexOf("\n");
|
34642 | return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
34643 | }
|
34644 | exports2.stringify = stringify;
|
34645 | function resolveForwardRef(type) {
|
34646 | if (typeof type === "function" && type.hasOwnProperty("__forward_ref__")) {
|
34647 | return type();
|
34648 | } else {
|
34649 | return type;
|
34650 | }
|
34651 | }
|
34652 | exports2.resolveForwardRef = resolveForwardRef;
|
34653 | function isPromise(obj) {
|
34654 | return !!obj && typeof obj.then === "function";
|
34655 | }
|
34656 | exports2.isPromise = isPromise;
|
34657 | var Version = class {
|
34658 | constructor(full) {
|
34659 | this.full = full;
|
34660 | const splits = full.split(".");
|
34661 | this.major = splits[0];
|
34662 | this.minor = splits[1];
|
34663 | this.patch = splits.slice(2).join(".");
|
34664 | }
|
34665 | };
|
34666 | exports2.Version = Version;
|
34667 | var __window = typeof window !== "undefined" && window;
|
34668 | var __self = typeof self !== "undefined" && typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && self;
|
34669 | var __global = typeof global !== "undefined" && global;
|
34670 | var _global = __global || __window || __self;
|
34671 | exports2.global = _global;
|
34672 | }
|
34673 | });
|
34674 | var require_compile_metadata = __commonJS2({
|
34675 | "node_modules/angular-html-parser/lib/compiler/src/compile_metadata.js"(exports2) {
|
34676 | "use strict";
|
34677 | Object.defineProperty(exports2, "__esModule", {
|
34678 | value: true
|
34679 | });
|
34680 | var static_symbol_1 = require_static_symbol();
|
34681 | var util_1 = require_util3();
|
34682 | var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
|
34683 | function sanitizeIdentifier(name) {
|
34684 | return name.replace(/\W/g, "_");
|
34685 | }
|
34686 | exports2.sanitizeIdentifier = sanitizeIdentifier;
|
34687 | var _anonymousTypeIndex = 0;
|
34688 | function identifierName(compileIdentifier) {
|
34689 | if (!compileIdentifier || !compileIdentifier.reference) {
|
34690 | return null;
|
34691 | }
|
34692 | const ref = compileIdentifier.reference;
|
34693 | if (ref instanceof static_symbol_1.StaticSymbol) {
|
34694 | return ref.name;
|
34695 | }
|
34696 | if (ref["__anonymousType"]) {
|
34697 | return ref["__anonymousType"];
|
34698 | }
|
34699 | let identifier = util_1.stringify(ref);
|
34700 | if (identifier.indexOf("(") >= 0) {
|
34701 | identifier = `anonymous_${_anonymousTypeIndex++}`;
|
34702 | ref["__anonymousType"] = identifier;
|
34703 | } else {
|
34704 | identifier = sanitizeIdentifier(identifier);
|
34705 | }
|
34706 | return identifier;
|
34707 | }
|
34708 | exports2.identifierName = identifierName;
|
34709 | function identifierModuleUrl(compileIdentifier) {
|
34710 | const ref = compileIdentifier.reference;
|
34711 | if (ref instanceof static_symbol_1.StaticSymbol) {
|
34712 | return ref.filePath;
|
34713 | }
|
34714 | return `./${util_1.stringify(ref)}`;
|
34715 | }
|
34716 | exports2.identifierModuleUrl = identifierModuleUrl;
|
34717 | function viewClassName(compType, embeddedTemplateIndex) {
|
34718 | return `View_${identifierName({
|
34719 | reference: compType
|
34720 | })}_${embeddedTemplateIndex}`;
|
34721 | }
|
34722 | exports2.viewClassName = viewClassName;
|
34723 | function rendererTypeName(compType) {
|
34724 | return `RenderType_${identifierName({
|
34725 | reference: compType
|
34726 | })}`;
|
34727 | }
|
34728 | exports2.rendererTypeName = rendererTypeName;
|
34729 | function hostViewClassName(compType) {
|
34730 | return `HostView_${identifierName({
|
34731 | reference: compType
|
34732 | })}`;
|
34733 | }
|
34734 | exports2.hostViewClassName = hostViewClassName;
|
34735 | function componentFactoryName(compType) {
|
34736 | return `${identifierName({
|
34737 | reference: compType
|
34738 | })}NgFactory`;
|
34739 | }
|
34740 | exports2.componentFactoryName = componentFactoryName;
|
34741 | var CompileSummaryKind;
|
34742 | (function(CompileSummaryKind2) {
|
34743 | CompileSummaryKind2[CompileSummaryKind2["Pipe"] = 0] = "Pipe";
|
34744 | CompileSummaryKind2[CompileSummaryKind2["Directive"] = 1] = "Directive";
|
34745 | CompileSummaryKind2[CompileSummaryKind2["NgModule"] = 2] = "NgModule";
|
34746 | CompileSummaryKind2[CompileSummaryKind2["Injectable"] = 3] = "Injectable";
|
34747 | })(CompileSummaryKind = exports2.CompileSummaryKind || (exports2.CompileSummaryKind = {}));
|
34748 | function tokenName(token) {
|
34749 | return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
|
34750 | }
|
34751 | exports2.tokenName = tokenName;
|
34752 | function tokenReference(token) {
|
34753 | if (token.identifier != null) {
|
34754 | return token.identifier.reference;
|
34755 | } else {
|
34756 | return token.value;
|
34757 | }
|
34758 | }
|
34759 | exports2.tokenReference = tokenReference;
|
34760 | var CompileStylesheetMetadata = class {
|
34761 | constructor({
|
34762 | moduleUrl,
|
34763 | styles,
|
34764 | styleUrls
|
34765 | } = {}) {
|
34766 | this.moduleUrl = moduleUrl || null;
|
34767 | this.styles = _normalizeArray(styles);
|
34768 | this.styleUrls = _normalizeArray(styleUrls);
|
34769 | }
|
34770 | };
|
34771 | exports2.CompileStylesheetMetadata = CompileStylesheetMetadata;
|
34772 | var CompileTemplateMetadata = class {
|
34773 | constructor({
|
34774 | encapsulation,
|
34775 | template,
|
34776 | templateUrl,
|
34777 | htmlAst,
|
34778 | styles,
|
34779 | styleUrls,
|
34780 | externalStylesheets,
|
34781 | animations,
|
34782 | ngContentSelectors,
|
34783 | interpolation,
|
34784 | isInline,
|
34785 | preserveWhitespaces
|
34786 | }) {
|
34787 | this.encapsulation = encapsulation;
|
34788 | this.template = template;
|
34789 | this.templateUrl = templateUrl;
|
34790 | this.htmlAst = htmlAst;
|
34791 | this.styles = _normalizeArray(styles);
|
34792 | this.styleUrls = _normalizeArray(styleUrls);
|
34793 | this.externalStylesheets = _normalizeArray(externalStylesheets);
|
34794 | this.animations = animations ? flatten(animations) : [];
|
34795 | this.ngContentSelectors = ngContentSelectors || [];
|
34796 | if (interpolation && interpolation.length != 2) {
|
34797 | throw new Error(`'interpolation' should have a start and an end symbol.`);
|
34798 | }
|
34799 | this.interpolation = interpolation;
|
34800 | this.isInline = isInline;
|
34801 | this.preserveWhitespaces = preserveWhitespaces;
|
34802 | }
|
34803 | toSummary() {
|
34804 | return {
|
34805 | ngContentSelectors: this.ngContentSelectors,
|
34806 | encapsulation: this.encapsulation,
|
34807 | styles: this.styles,
|
34808 | animations: this.animations
|
34809 | };
|
34810 | }
|
34811 | };
|
34812 | exports2.CompileTemplateMetadata = CompileTemplateMetadata;
|
34813 | var CompileDirectiveMetadata = class {
|
34814 | static create({
|
34815 | isHost,
|
34816 | type,
|
34817 | isComponent,
|
34818 | selector,
|
34819 | exportAs,
|
34820 | changeDetection,
|
34821 | inputs,
|
34822 | outputs,
|
34823 | host,
|
34824 | providers,
|
34825 | viewProviders,
|
34826 | queries,
|
34827 | guards,
|
34828 | viewQueries,
|
34829 | entryComponents,
|
34830 | template,
|
34831 | componentViewType,
|
34832 | rendererType,
|
34833 | componentFactory
|
34834 | }) {
|
34835 | const hostListeners = {};
|
34836 | const hostProperties = {};
|
34837 | const hostAttributes = {};
|
34838 | if (host != null) {
|
34839 | Object.keys(host).forEach((key) => {
|
34840 | const value = host[key];
|
34841 | const matches = key.match(HOST_REG_EXP);
|
34842 | if (matches === null) {
|
34843 | hostAttributes[key] = value;
|
34844 | } else if (matches[1] != null) {
|
34845 | hostProperties[matches[1]] = value;
|
34846 | } else if (matches[2] != null) {
|
34847 | hostListeners[matches[2]] = value;
|
34848 | }
|
34849 | });
|
34850 | }
|
34851 | const inputsMap = {};
|
34852 | if (inputs != null) {
|
34853 | inputs.forEach((bindConfig) => {
|
34854 | const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
34855 | inputsMap[parts[0]] = parts[1];
|
34856 | });
|
34857 | }
|
34858 | const outputsMap = {};
|
34859 | if (outputs != null) {
|
34860 | outputs.forEach((bindConfig) => {
|
34861 | const parts = util_1.splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
34862 | outputsMap[parts[0]] = parts[1];
|
34863 | });
|
34864 | }
|
34865 | return new CompileDirectiveMetadata({
|
34866 | isHost,
|
34867 | type,
|
34868 | isComponent: !!isComponent,
|
34869 | selector,
|
34870 | exportAs,
|
34871 | changeDetection,
|
34872 | inputs: inputsMap,
|
34873 | outputs: outputsMap,
|
34874 | hostListeners,
|
34875 | hostProperties,
|
34876 | hostAttributes,
|
34877 | providers,
|
34878 | viewProviders,
|
34879 | queries,
|
34880 | guards,
|
34881 | viewQueries,
|
34882 | entryComponents,
|
34883 | template,
|
34884 | componentViewType,
|
34885 | rendererType,
|
34886 | componentFactory
|
34887 | });
|
34888 | }
|
34889 | constructor({
|
34890 | isHost,
|
34891 | type,
|
34892 | isComponent,
|
34893 | selector,
|
34894 | exportAs,
|
34895 | changeDetection,
|
34896 | inputs,
|
34897 | outputs,
|
34898 | hostListeners,
|
34899 | hostProperties,
|
34900 | hostAttributes,
|
34901 | providers,
|
34902 | viewProviders,
|
34903 | queries,
|
34904 | guards,
|
34905 | viewQueries,
|
34906 | entryComponents,
|
34907 | template,
|
34908 | componentViewType,
|
34909 | rendererType,
|
34910 | componentFactory
|
34911 | }) {
|
34912 | this.isHost = !!isHost;
|
34913 | this.type = type;
|
34914 | this.isComponent = isComponent;
|
34915 | this.selector = selector;
|
34916 | this.exportAs = exportAs;
|
34917 | this.changeDetection = changeDetection;
|
34918 | this.inputs = inputs;
|
34919 | this.outputs = outputs;
|
34920 | this.hostListeners = hostListeners;
|
34921 | this.hostProperties = hostProperties;
|
34922 | this.hostAttributes = hostAttributes;
|
34923 | this.providers = _normalizeArray(providers);
|
34924 | this.viewProviders = _normalizeArray(viewProviders);
|
34925 | this.queries = _normalizeArray(queries);
|
34926 | this.guards = guards;
|
34927 | this.viewQueries = _normalizeArray(viewQueries);
|
34928 | this.entryComponents = _normalizeArray(entryComponents);
|
34929 | this.template = template;
|
34930 | this.componentViewType = componentViewType;
|
34931 | this.rendererType = rendererType;
|
34932 | this.componentFactory = componentFactory;
|
34933 | }
|
34934 | toSummary() {
|
34935 | return {
|
34936 | summaryKind: CompileSummaryKind.Directive,
|
34937 | type: this.type,
|
34938 | isComponent: this.isComponent,
|
34939 | selector: this.selector,
|
34940 | exportAs: this.exportAs,
|
34941 | inputs: this.inputs,
|
34942 | outputs: this.outputs,
|
34943 | hostListeners: this.hostListeners,
|
34944 | hostProperties: this.hostProperties,
|
34945 | hostAttributes: this.hostAttributes,
|
34946 | providers: this.providers,
|
34947 | viewProviders: this.viewProviders,
|
34948 | queries: this.queries,
|
34949 | guards: this.guards,
|
34950 | viewQueries: this.viewQueries,
|
34951 | entryComponents: this.entryComponents,
|
34952 | changeDetection: this.changeDetection,
|
34953 | template: this.template && this.template.toSummary(),
|
34954 | componentViewType: this.componentViewType,
|
34955 | rendererType: this.rendererType,
|
34956 | componentFactory: this.componentFactory
|
34957 | };
|
34958 | }
|
34959 | };
|
34960 | exports2.CompileDirectiveMetadata = CompileDirectiveMetadata;
|
34961 | var CompilePipeMetadata = class {
|
34962 | constructor({
|
34963 | type,
|
34964 | name,
|
34965 | pure
|
34966 | }) {
|
34967 | this.type = type;
|
34968 | this.name = name;
|
34969 | this.pure = !!pure;
|
34970 | }
|
34971 | toSummary() {
|
34972 | return {
|
34973 | summaryKind: CompileSummaryKind.Pipe,
|
34974 | type: this.type,
|
34975 | name: this.name,
|
34976 | pure: this.pure
|
34977 | };
|
34978 | }
|
34979 | };
|
34980 | exports2.CompilePipeMetadata = CompilePipeMetadata;
|
34981 | var CompileShallowModuleMetadata = class {
|
34982 | };
|
34983 | exports2.CompileShallowModuleMetadata = CompileShallowModuleMetadata;
|
34984 | var CompileNgModuleMetadata = class {
|
34985 | constructor({
|
34986 | type,
|
34987 | providers,
|
34988 | declaredDirectives,
|
34989 | exportedDirectives,
|
34990 | declaredPipes,
|
34991 | exportedPipes,
|
34992 | entryComponents,
|
34993 | bootstrapComponents,
|
34994 | importedModules,
|
34995 | exportedModules,
|
34996 | schemas,
|
34997 | transitiveModule,
|
34998 | id
|
34999 | }) {
|
35000 | this.type = type || null;
|
35001 | this.declaredDirectives = _normalizeArray(declaredDirectives);
|
35002 | this.exportedDirectives = _normalizeArray(exportedDirectives);
|
35003 | this.declaredPipes = _normalizeArray(declaredPipes);
|
35004 | this.exportedPipes = _normalizeArray(exportedPipes);
|
35005 | this.providers = _normalizeArray(providers);
|
35006 | this.entryComponents = _normalizeArray(entryComponents);
|
35007 | this.bootstrapComponents = _normalizeArray(bootstrapComponents);
|
35008 | this.importedModules = _normalizeArray(importedModules);
|
35009 | this.exportedModules = _normalizeArray(exportedModules);
|
35010 | this.schemas = _normalizeArray(schemas);
|
35011 | this.id = id || null;
|
35012 | this.transitiveModule = transitiveModule || null;
|
35013 | }
|
35014 | toSummary() {
|
35015 | const module3 = this.transitiveModule;
|
35016 | return {
|
35017 | summaryKind: CompileSummaryKind.NgModule,
|
35018 | type: this.type,
|
35019 | entryComponents: module3.entryComponents,
|
35020 | providers: module3.providers,
|
35021 | modules: module3.modules,
|
35022 | exportedDirectives: module3.exportedDirectives,
|
35023 | exportedPipes: module3.exportedPipes
|
35024 | };
|
35025 | }
|
35026 | };
|
35027 | exports2.CompileNgModuleMetadata = CompileNgModuleMetadata;
|
35028 | var TransitiveCompileNgModuleMetadata = class {
|
35029 | constructor() {
|
35030 | this.directivesSet = new Set();
|
35031 | this.directives = [];
|
35032 | this.exportedDirectivesSet = new Set();
|
35033 | this.exportedDirectives = [];
|
35034 | this.pipesSet = new Set();
|
35035 | this.pipes = [];
|
35036 | this.exportedPipesSet = new Set();
|
35037 | this.exportedPipes = [];
|
35038 | this.modulesSet = new Set();
|
35039 | this.modules = [];
|
35040 | this.entryComponentsSet = new Set();
|
35041 | this.entryComponents = [];
|
35042 | this.providers = [];
|
35043 | }
|
35044 | addProvider(provider, module3) {
|
35045 | this.providers.push({
|
35046 | provider,
|
35047 | module: module3
|
35048 | });
|
35049 | }
|
35050 | addDirective(id) {
|
35051 | if (!this.directivesSet.has(id.reference)) {
|
35052 | this.directivesSet.add(id.reference);
|
35053 | this.directives.push(id);
|
35054 | }
|
35055 | }
|
35056 | addExportedDirective(id) {
|
35057 | if (!this.exportedDirectivesSet.has(id.reference)) {
|
35058 | this.exportedDirectivesSet.add(id.reference);
|
35059 | this.exportedDirectives.push(id);
|
35060 | }
|
35061 | }
|
35062 | addPipe(id) {
|
35063 | if (!this.pipesSet.has(id.reference)) {
|
35064 | this.pipesSet.add(id.reference);
|
35065 | this.pipes.push(id);
|
35066 | }
|
35067 | }
|
35068 | addExportedPipe(id) {
|
35069 | if (!this.exportedPipesSet.has(id.reference)) {
|
35070 | this.exportedPipesSet.add(id.reference);
|
35071 | this.exportedPipes.push(id);
|
35072 | }
|
35073 | }
|
35074 | addModule(id) {
|
35075 | if (!this.modulesSet.has(id.reference)) {
|
35076 | this.modulesSet.add(id.reference);
|
35077 | this.modules.push(id);
|
35078 | }
|
35079 | }
|
35080 | addEntryComponent(ec) {
|
35081 | if (!this.entryComponentsSet.has(ec.componentType)) {
|
35082 | this.entryComponentsSet.add(ec.componentType);
|
35083 | this.entryComponents.push(ec);
|
35084 | }
|
35085 | }
|
35086 | };
|
35087 | exports2.TransitiveCompileNgModuleMetadata = TransitiveCompileNgModuleMetadata;
|
35088 | function _normalizeArray(obj) {
|
35089 | return obj || [];
|
35090 | }
|
35091 | var ProviderMeta = class {
|
35092 | constructor(token, {
|
35093 | useClass,
|
35094 | useValue,
|
35095 | useExisting,
|
35096 | useFactory,
|
35097 | deps,
|
35098 | multi
|
35099 | }) {
|
35100 | this.token = token;
|
35101 | this.useClass = useClass || null;
|
35102 | this.useValue = useValue;
|
35103 | this.useExisting = useExisting;
|
35104 | this.useFactory = useFactory || null;
|
35105 | this.dependencies = deps || null;
|
35106 | this.multi = !!multi;
|
35107 | }
|
35108 | };
|
35109 | exports2.ProviderMeta = ProviderMeta;
|
35110 | function flatten(list) {
|
35111 | return list.reduce((flat, item) => {
|
35112 | const flatItem = Array.isArray(item) ? flatten(item) : item;
|
35113 | return flat.concat(flatItem);
|
35114 | }, []);
|
35115 | }
|
35116 | exports2.flatten = flatten;
|
35117 | function jitSourceUrl(url) {
|
35118 | return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, "ng:///");
|
35119 | }
|
35120 | function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
|
35121 | let url;
|
35122 | if (templateMeta.isInline) {
|
35123 | if (compMeta.type.reference instanceof static_symbol_1.StaticSymbol) {
|
35124 | url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
|
35125 | } else {
|
35126 | url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
|
35127 | }
|
35128 | } else {
|
35129 | url = templateMeta.templateUrl;
|
35130 | }
|
35131 | return compMeta.type.reference instanceof static_symbol_1.StaticSymbol ? url : jitSourceUrl(url);
|
35132 | }
|
35133 | exports2.templateSourceUrl = templateSourceUrl;
|
35134 | function sharedStylesheetJitUrl(meta, id) {
|
35135 | const pathParts = meta.moduleUrl.split(/\/\\/g);
|
35136 | const baseName = pathParts[pathParts.length - 1];
|
35137 | return jitSourceUrl(`css/${id}${baseName}.ngstyle.js`);
|
35138 | }
|
35139 | exports2.sharedStylesheetJitUrl = sharedStylesheetJitUrl;
|
35140 | function ngModuleJitUrl(moduleMeta) {
|
35141 | return jitSourceUrl(`${identifierName(moduleMeta.type)}/module.ngfactory.js`);
|
35142 | }
|
35143 | exports2.ngModuleJitUrl = ngModuleJitUrl;
|
35144 | function templateJitUrl(ngModuleType, compMeta) {
|
35145 | return jitSourceUrl(`${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.ngfactory.js`);
|
35146 | }
|
35147 | exports2.templateJitUrl = templateJitUrl;
|
35148 | }
|
35149 | });
|
35150 | var require_parse_util = __commonJS2({
|
35151 | "node_modules/angular-html-parser/lib/compiler/src/parse_util.js"(exports2) {
|
35152 | "use strict";
|
35153 | Object.defineProperty(exports2, "__esModule", {
|
35154 | value: true
|
35155 | });
|
35156 | var chars = require_chars();
|
35157 | var compile_metadata_1 = require_compile_metadata();
|
35158 | var ParseLocation = class {
|
35159 | constructor(file, offset, line, col) {
|
35160 | this.file = file;
|
35161 | this.offset = offset;
|
35162 | this.line = line;
|
35163 | this.col = col;
|
35164 | }
|
35165 | toString() {
|
35166 | return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
|
35167 | }
|
35168 | moveBy(delta) {
|
35169 | const source = this.file.content;
|
35170 | const len = source.length;
|
35171 | let offset = this.offset;
|
35172 | let line = this.line;
|
35173 | let col = this.col;
|
35174 | while (offset > 0 && delta < 0) {
|
35175 | offset--;
|
35176 | delta++;
|
35177 | const ch = source.charCodeAt(offset);
|
35178 | if (ch == chars.$LF) {
|
35179 | line--;
|
35180 | const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode(chars.$LF));
|
35181 | col = priorLine > 0 ? offset - priorLine : offset;
|
35182 | } else {
|
35183 | col--;
|
35184 | }
|
35185 | }
|
35186 | while (offset < len && delta > 0) {
|
35187 | const ch = source.charCodeAt(offset);
|
35188 | offset++;
|
35189 | delta--;
|
35190 | if (ch == chars.$LF) {
|
35191 | line++;
|
35192 | col = 0;
|
35193 | } else {
|
35194 | col++;
|
35195 | }
|
35196 | }
|
35197 | return new ParseLocation(this.file, offset, line, col);
|
35198 | }
|
35199 | getContext(maxChars, maxLines) {
|
35200 | const content = this.file.content;
|
35201 | let startOffset = this.offset;
|
35202 | if (startOffset != null) {
|
35203 | if (startOffset > content.length - 1) {
|
35204 | startOffset = content.length - 1;
|
35205 | }
|
35206 | let endOffset = startOffset;
|
35207 | let ctxChars = 0;
|
35208 | let ctxLines = 0;
|
35209 | while (ctxChars < maxChars && startOffset > 0) {
|
35210 | startOffset--;
|
35211 | ctxChars++;
|
35212 | if (content[startOffset] == "\n") {
|
35213 | if (++ctxLines == maxLines) {
|
35214 | break;
|
35215 | }
|
35216 | }
|
35217 | }
|
35218 | ctxChars = 0;
|
35219 | ctxLines = 0;
|
35220 | while (ctxChars < maxChars && endOffset < content.length - 1) {
|
35221 | endOffset++;
|
35222 | ctxChars++;
|
35223 | if (content[endOffset] == "\n") {
|
35224 | if (++ctxLines == maxLines) {
|
35225 | break;
|
35226 | }
|
35227 | }
|
35228 | }
|
35229 | return {
|
35230 | before: content.substring(startOffset, this.offset),
|
35231 | after: content.substring(this.offset, endOffset + 1)
|
35232 | };
|
35233 | }
|
35234 | return null;
|
35235 | }
|
35236 | };
|
35237 | exports2.ParseLocation = ParseLocation;
|
35238 | var ParseSourceFile = class {
|
35239 | constructor(content, url) {
|
35240 | this.content = content;
|
35241 | this.url = url;
|
35242 | }
|
35243 | };
|
35244 | exports2.ParseSourceFile = ParseSourceFile;
|
35245 | var ParseSourceSpan = class {
|
35246 | constructor(start, end, details = null) {
|
35247 | this.start = start;
|
35248 | this.end = end;
|
35249 | this.details = details;
|
35250 | }
|
35251 | toString() {
|
35252 | return this.start.file.content.substring(this.start.offset, this.end.offset);
|
35253 | }
|
35254 | };
|
35255 | exports2.ParseSourceSpan = ParseSourceSpan;
|
35256 | exports2.EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile("", ""), 0, 0, 0);
|
35257 | exports2.EMPTY_SOURCE_SPAN = new ParseSourceSpan(exports2.EMPTY_PARSE_LOCATION, exports2.EMPTY_PARSE_LOCATION);
|
35258 | var ParseErrorLevel;
|
35259 | (function(ParseErrorLevel2) {
|
35260 | ParseErrorLevel2[ParseErrorLevel2["WARNING"] = 0] = "WARNING";
|
35261 | ParseErrorLevel2[ParseErrorLevel2["ERROR"] = 1] = "ERROR";
|
35262 | })(ParseErrorLevel = exports2.ParseErrorLevel || (exports2.ParseErrorLevel = {}));
|
35263 | var ParseError = class {
|
35264 | constructor(span, msg, level = ParseErrorLevel.ERROR) {
|
35265 | this.span = span;
|
35266 | this.msg = msg;
|
35267 | this.level = level;
|
35268 | }
|
35269 | contextualMessage() {
|
35270 | const ctx = this.span.start.getContext(100, 3);
|
35271 | return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` : this.msg;
|
35272 | }
|
35273 | toString() {
|
35274 | const details = this.span.details ? `, ${this.span.details}` : "";
|
35275 | return `${this.contextualMessage()}: ${this.span.start}${details}`;
|
35276 | }
|
35277 | };
|
35278 | exports2.ParseError = ParseError;
|
35279 | function typeSourceSpan(kind, type) {
|
35280 | const moduleUrl = compile_metadata_1.identifierModuleUrl(type);
|
35281 | const sourceFileName = moduleUrl != null ? `in ${kind} ${compile_metadata_1.identifierName(type)} in ${moduleUrl}` : `in ${kind} ${compile_metadata_1.identifierName(type)}`;
|
35282 | const sourceFile = new ParseSourceFile("", sourceFileName);
|
35283 | return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
|
35284 | }
|
35285 | exports2.typeSourceSpan = typeSourceSpan;
|
35286 | function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
|
35287 | const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
|
35288 | const sourceFile = new ParseSourceFile("", sourceFileName);
|
35289 | return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
|
35290 | }
|
35291 | exports2.r3JitTypeSourceSpan = r3JitTypeSourceSpan;
|
35292 | }
|
35293 | });
|
35294 | var require_print_preprocess3 = __commonJS2({
|
35295 | "src/language-html/print-preprocess.js"(exports2, module2) {
|
35296 | "use strict";
|
35297 | var {
|
35298 | ParseSourceSpan
|
35299 | } = require_parse_util();
|
35300 | var {
|
35301 | htmlTrim,
|
35302 | getLeadingAndTrailingHtmlWhitespace,
|
35303 | hasHtmlWhitespace,
|
35304 | canHaveInterpolation,
|
35305 | getNodeCssStyleDisplay,
|
35306 | isDanglingSpaceSensitiveNode,
|
35307 | isIndentationSensitiveNode,
|
35308 | isLeadingSpaceSensitiveNode,
|
35309 | isTrailingSpaceSensitiveNode,
|
35310 | isWhitespaceSensitiveNode,
|
35311 | isVueScriptTag
|
35312 | } = require_utils11();
|
35313 | var PREPROCESS_PIPELINE = [removeIgnorableFirstLf, mergeIfConditionalStartEndCommentIntoElementOpeningTag, mergeCdataIntoText, extractInterpolation, extractWhitespaces, addCssDisplay, addIsSelfClosing, addHasHtmComponentClosingTag, addIsSpaceSensitive, mergeSimpleElementIntoText, markTsScript];
|
35314 | function preprocess(ast, options) {
|
35315 | for (const fn of PREPROCESS_PIPELINE) {
|
35316 | fn(ast, options);
|
35317 | }
|
35318 | return ast;
|
35319 | }
|
35320 | function removeIgnorableFirstLf(ast) {
|
35321 | ast.walk((node) => {
|
35322 | if (node.type === "element" && node.tagDefinition.ignoreFirstLf && node.children.length > 0 && node.children[0].type === "text" && node.children[0].value[0] === "\n") {
|
35323 | const text = node.children[0];
|
35324 | if (text.value.length === 1) {
|
35325 | node.removeChild(text);
|
35326 | } else {
|
35327 | text.value = text.value.slice(1);
|
35328 | }
|
35329 | }
|
35330 | });
|
35331 | }
|
35332 | function mergeIfConditionalStartEndCommentIntoElementOpeningTag(ast) {
|
35333 | const isTarget = (node) => node.type === "element" && node.prev && node.prev.type === "ieConditionalStartComment" && node.prev.sourceSpan.end.offset === node.startSourceSpan.start.offset && node.firstChild && node.firstChild.type === "ieConditionalEndComment" && node.firstChild.sourceSpan.start.offset === node.startSourceSpan.end.offset;
|
35334 | ast.walk((node) => {
|
35335 | if (node.children) {
|
35336 | for (let i = 0; i < node.children.length; i++) {
|
35337 | const child = node.children[i];
|
35338 | if (!isTarget(child)) {
|
35339 | continue;
|
35340 | }
|
35341 | const ieConditionalStartComment = child.prev;
|
35342 | const ieConditionalEndComment = child.firstChild;
|
35343 | node.removeChild(ieConditionalStartComment);
|
35344 | i--;
|
35345 | const startSourceSpan = new ParseSourceSpan(ieConditionalStartComment.sourceSpan.start, ieConditionalEndComment.sourceSpan.end);
|
35346 | const sourceSpan = new ParseSourceSpan(startSourceSpan.start, child.sourceSpan.end);
|
35347 | child.condition = ieConditionalStartComment.condition;
|
35348 | child.sourceSpan = sourceSpan;
|
35349 | child.startSourceSpan = startSourceSpan;
|
35350 | child.removeChild(ieConditionalEndComment);
|
35351 | }
|
35352 | }
|
35353 | });
|
35354 | }
|
35355 | function mergeNodeIntoText(ast, shouldMerge, getValue) {
|
35356 | ast.walk((node) => {
|
35357 | if (node.children) {
|
35358 | for (let i = 0; i < node.children.length; i++) {
|
35359 | const child = node.children[i];
|
35360 | if (child.type !== "text" && !shouldMerge(child)) {
|
35361 | continue;
|
35362 | }
|
35363 | if (child.type !== "text") {
|
35364 | child.type = "text";
|
35365 | child.value = getValue(child);
|
35366 | }
|
35367 | const prevChild = child.prev;
|
35368 | if (!prevChild || prevChild.type !== "text") {
|
35369 | continue;
|
35370 | }
|
35371 | prevChild.value += child.value;
|
35372 | prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, child.sourceSpan.end);
|
35373 | node.removeChild(child);
|
35374 | i--;
|
35375 | }
|
35376 | }
|
35377 | });
|
35378 | }
|
35379 | function mergeCdataIntoText(ast) {
|
35380 | return mergeNodeIntoText(ast, (node) => node.type === "cdata", (node) => `<![CDATA[${node.value}]]>`);
|
35381 | }
|
35382 | function mergeSimpleElementIntoText(ast) {
|
35383 | const isSimpleElement = (node) => node.type === "element" && node.attrs.length === 0 && node.children.length === 1 && node.firstChild.type === "text" && !hasHtmlWhitespace(node.children[0].value) && !node.firstChild.hasLeadingSpaces && !node.firstChild.hasTrailingSpaces && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces && node.prev && node.prev.type === "text" && node.next && node.next.type === "text";
|
35384 | ast.walk((node) => {
|
35385 | if (node.children) {
|
35386 | for (let i = 0; i < node.children.length; i++) {
|
35387 | const child = node.children[i];
|
35388 | if (!isSimpleElement(child)) {
|
35389 | continue;
|
35390 | }
|
35391 | const prevChild = child.prev;
|
35392 | const nextChild = child.next;
|
35393 | prevChild.value += `<${child.rawName}>` + child.firstChild.value + `</${child.rawName}>` + nextChild.value;
|
35394 | prevChild.sourceSpan = new ParseSourceSpan(prevChild.sourceSpan.start, nextChild.sourceSpan.end);
|
35395 | prevChild.isTrailingSpaceSensitive = nextChild.isTrailingSpaceSensitive;
|
35396 | prevChild.hasTrailingSpaces = nextChild.hasTrailingSpaces;
|
35397 | node.removeChild(child);
|
35398 | i--;
|
35399 | node.removeChild(nextChild);
|
35400 | }
|
35401 | }
|
35402 | });
|
35403 | }
|
35404 | function extractInterpolation(ast, options) {
|
35405 | if (options.parser === "html") {
|
35406 | return;
|
35407 | }
|
35408 | const interpolationRegex = /{{(.+?)}}/s;
|
35409 | ast.walk((node) => {
|
35410 | if (!canHaveInterpolation(node)) {
|
35411 | return;
|
35412 | }
|
35413 | for (const child of node.children) {
|
35414 | if (child.type !== "text") {
|
35415 | continue;
|
35416 | }
|
35417 | let startSourceSpan = child.sourceSpan.start;
|
35418 | let endSourceSpan = null;
|
35419 | const components = child.value.split(interpolationRegex);
|
35420 | for (let i = 0; i < components.length; i++, startSourceSpan = endSourceSpan) {
|
35421 | const value = components[i];
|
35422 | if (i % 2 === 0) {
|
35423 | endSourceSpan = startSourceSpan.moveBy(value.length);
|
35424 | if (value.length > 0) {
|
35425 | node.insertChildBefore(child, {
|
35426 | type: "text",
|
35427 | value,
|
35428 | sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan)
|
35429 | });
|
35430 | }
|
35431 | continue;
|
35432 | }
|
35433 | endSourceSpan = startSourceSpan.moveBy(value.length + 4);
|
35434 | node.insertChildBefore(child, {
|
35435 | type: "interpolation",
|
35436 | sourceSpan: new ParseSourceSpan(startSourceSpan, endSourceSpan),
|
35437 | children: value.length === 0 ? [] : [{
|
35438 | type: "text",
|
35439 | value,
|
35440 | sourceSpan: new ParseSourceSpan(startSourceSpan.moveBy(2), endSourceSpan.moveBy(-2))
|
35441 | }]
|
35442 | });
|
35443 | }
|
35444 | node.removeChild(child);
|
35445 | }
|
35446 | });
|
35447 | }
|
35448 | function extractWhitespaces(ast) {
|
35449 | ast.walk((node) => {
|
35450 | if (!node.children) {
|
35451 | return;
|
35452 | }
|
35453 | if (node.children.length === 0 || node.children.length === 1 && node.children[0].type === "text" && htmlTrim(node.children[0].value).length === 0) {
|
35454 | node.hasDanglingSpaces = node.children.length > 0;
|
35455 | node.children = [];
|
35456 | return;
|
35457 | }
|
35458 | const isWhitespaceSensitive = isWhitespaceSensitiveNode(node);
|
35459 | const isIndentationSensitive = isIndentationSensitiveNode(node);
|
35460 | if (!isWhitespaceSensitive) {
|
35461 | for (let i = 0; i < node.children.length; i++) {
|
35462 | const child = node.children[i];
|
35463 | if (child.type !== "text") {
|
35464 | continue;
|
35465 | }
|
35466 | const {
|
35467 | leadingWhitespace,
|
35468 | text,
|
35469 | trailingWhitespace
|
35470 | } = getLeadingAndTrailingHtmlWhitespace(child.value);
|
35471 | const prevChild = child.prev;
|
35472 | const nextChild = child.next;
|
35473 | if (!text) {
|
35474 | node.removeChild(child);
|
35475 | i--;
|
35476 | if (leadingWhitespace || trailingWhitespace) {
|
35477 | if (prevChild) {
|
35478 | prevChild.hasTrailingSpaces = true;
|
35479 | }
|
35480 | if (nextChild) {
|
35481 | nextChild.hasLeadingSpaces = true;
|
35482 | }
|
35483 | }
|
35484 | } else {
|
35485 | child.value = text;
|
35486 | child.sourceSpan = new ParseSourceSpan(child.sourceSpan.start.moveBy(leadingWhitespace.length), child.sourceSpan.end.moveBy(-trailingWhitespace.length));
|
35487 | if (leadingWhitespace) {
|
35488 | if (prevChild) {
|
35489 | prevChild.hasTrailingSpaces = true;
|
35490 | }
|
35491 | child.hasLeadingSpaces = true;
|
35492 | }
|
35493 | if (trailingWhitespace) {
|
35494 | child.hasTrailingSpaces = true;
|
35495 | if (nextChild) {
|
35496 | nextChild.hasLeadingSpaces = true;
|
35497 | }
|
35498 | }
|
35499 | }
|
35500 | }
|
35501 | }
|
35502 | node.isWhitespaceSensitive = isWhitespaceSensitive;
|
35503 | node.isIndentationSensitive = isIndentationSensitive;
|
35504 | });
|
35505 | }
|
35506 | function addIsSelfClosing(ast) {
|
35507 | ast.walk((node) => {
|
35508 | node.isSelfClosing = !node.children || node.type === "element" && (node.tagDefinition.isVoid || node.startSourceSpan === node.endSourceSpan);
|
35509 | });
|
35510 | }
|
35511 | function addHasHtmComponentClosingTag(ast, options) {
|
35512 | ast.walk((node) => {
|
35513 | if (node.type !== "element") {
|
35514 | return;
|
35515 | }
|
35516 | node.hasHtmComponentClosingTag = node.endSourceSpan && /^<\s*\/\s*\/\s*>$/.test(options.originalText.slice(node.endSourceSpan.start.offset, node.endSourceSpan.end.offset));
|
35517 | });
|
35518 | }
|
35519 | function addCssDisplay(ast, options) {
|
35520 | ast.walk((node) => {
|
35521 | node.cssDisplay = getNodeCssStyleDisplay(node, options);
|
35522 | });
|
35523 | }
|
35524 | function addIsSpaceSensitive(ast, options) {
|
35525 | ast.walk((node) => {
|
35526 | const {
|
35527 | children
|
35528 | } = node;
|
35529 | if (!children) {
|
35530 | return;
|
35531 | }
|
35532 | if (children.length === 0) {
|
35533 | node.isDanglingSpaceSensitive = isDanglingSpaceSensitiveNode(node);
|
35534 | return;
|
35535 | }
|
35536 | for (const child of children) {
|
35537 | child.isLeadingSpaceSensitive = isLeadingSpaceSensitiveNode(child, options);
|
35538 | child.isTrailingSpaceSensitive = isTrailingSpaceSensitiveNode(child, options);
|
35539 | }
|
35540 | for (let index = 0; index < children.length; index++) {
|
35541 | const child = children[index];
|
35542 | child.isLeadingSpaceSensitive = index === 0 ? child.isLeadingSpaceSensitive : child.prev.isTrailingSpaceSensitive && child.isLeadingSpaceSensitive;
|
35543 | child.isTrailingSpaceSensitive = index === children.length - 1 ? child.isTrailingSpaceSensitive : child.next.isLeadingSpaceSensitive && child.isTrailingSpaceSensitive;
|
35544 | }
|
35545 | });
|
35546 | }
|
35547 | function markTsScript(ast, options) {
|
35548 | if (options.parser === "vue") {
|
35549 | const vueScriptTag = ast.children.find((child) => isVueScriptTag(child, options));
|
35550 | if (!vueScriptTag) {
|
35551 | return;
|
35552 | }
|
35553 | const {
|
35554 | lang
|
35555 | } = vueScriptTag.attrMap;
|
35556 | if (lang === "ts" || lang === "typescript") {
|
35557 | options.__should_parse_vue_template_with_ts = true;
|
35558 | }
|
35559 | }
|
35560 | }
|
35561 | module2.exports = preprocess;
|
35562 | }
|
35563 | });
|
35564 | var require_pragma5 = __commonJS2({
|
35565 | "src/language-html/pragma.js"(exports2, module2) {
|
35566 | "use strict";
|
35567 | function hasPragma(text) {
|
35568 | return /^\s*<!--\s*@(?:format|prettier)\s*-->/.test(text);
|
35569 | }
|
35570 | function insertPragma(text) {
|
35571 | return "<!-- @format -->\n\n" + text.replace(/^\s*\n/, "");
|
35572 | }
|
35573 | module2.exports = {
|
35574 | hasPragma,
|
35575 | insertPragma
|
35576 | };
|
35577 | }
|
35578 | });
|
35579 | var require_loc6 = __commonJS2({
|
35580 | "src/language-html/loc.js"(exports2, module2) {
|
35581 | "use strict";
|
35582 | function locStart(node) {
|
35583 | return node.sourceSpan.start.offset;
|
35584 | }
|
35585 | function locEnd(node) {
|
35586 | return node.sourceSpan.end.offset;
|
35587 | }
|
35588 | module2.exports = {
|
35589 | locStart,
|
35590 | locEnd
|
35591 | };
|
35592 | }
|
35593 | });
|
35594 | var require_tag = __commonJS2({
|
35595 | "src/language-html/print/tag.js"(exports2, module2) {
|
35596 | "use strict";
|
35597 | var assert = require("assert");
|
35598 | var {
|
35599 | isNonEmptyArray
|
35600 | } = require_util();
|
35601 | var {
|
35602 | builders: {
|
35603 | indent,
|
35604 | join,
|
35605 | line,
|
35606 | softline,
|
35607 | hardline
|
35608 | },
|
35609 | utils: {
|
35610 | replaceTextEndOfLine
|
35611 | }
|
35612 | } = require("./doc.js");
|
35613 | var {
|
35614 | locStart,
|
35615 | locEnd
|
35616 | } = require_loc6();
|
35617 | var {
|
35618 | isTextLikeNode,
|
35619 | getLastDescendant,
|
35620 | isPreLikeNode,
|
35621 | hasPrettierIgnore,
|
35622 | shouldPreserveContent,
|
35623 | isVueSfcBlock
|
35624 | } = require_utils11();
|
35625 | function printClosingTag(node, options) {
|
35626 | return [node.isSelfClosing ? "" : printClosingTagStart(node, options), printClosingTagEnd(node, options)];
|
35627 | }
|
35628 | function printClosingTagStart(node, options) {
|
35629 | return node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild) ? "" : [printClosingTagPrefix(node, options), printClosingTagStartMarker(node, options)];
|
35630 | }
|
35631 | function printClosingTagEnd(node, options) {
|
35632 | return (node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent)) ? "" : [printClosingTagEndMarker(node, options), printClosingTagSuffix(node, options)];
|
35633 | }
|
35634 | function printClosingTagPrefix(node, options) {
|
35635 | return needsToBorrowLastChildClosingTagEndMarker(node) ? printClosingTagEndMarker(node.lastChild, options) : "";
|
35636 | }
|
35637 | function printClosingTagSuffix(node, options) {
|
35638 | return needsToBorrowParentClosingTagStartMarker(node) ? printClosingTagStartMarker(node.parent, options) : needsToBorrowNextOpeningTagStartMarker(node) ? printOpeningTagStartMarker(node.next) : "";
|
35639 | }
|
35640 | function printClosingTagStartMarker(node, options) {
|
35641 | assert(!node.isSelfClosing);
|
35642 | if (shouldNotPrintClosingTag(node, options)) {
|
35643 | return "";
|
35644 | }
|
35645 | switch (node.type) {
|
35646 | case "ieConditionalComment":
|
35647 | return "<!";
|
35648 | case "element":
|
35649 | if (node.hasHtmComponentClosingTag) {
|
35650 | return "<//";
|
35651 | }
|
35652 | default:
|
35653 | return `</${node.rawName}`;
|
35654 | }
|
35655 | }
|
35656 | function printClosingTagEndMarker(node, options) {
|
35657 | if (shouldNotPrintClosingTag(node, options)) {
|
35658 | return "";
|
35659 | }
|
35660 | switch (node.type) {
|
35661 | case "ieConditionalComment":
|
35662 | case "ieConditionalEndComment":
|
35663 | return "[endif]-->";
|
35664 | case "ieConditionalStartComment":
|
35665 | return "]><!-->";
|
35666 | case "interpolation":
|
35667 | return "}}";
|
35668 | case "element":
|
35669 | if (node.isSelfClosing) {
|
35670 | return "/>";
|
35671 | }
|
35672 | default:
|
35673 | return ">";
|
35674 | }
|
35675 | }
|
35676 | function shouldNotPrintClosingTag(node, options) {
|
35677 | return !node.isSelfClosing && !node.endSourceSpan && (hasPrettierIgnore(node) || shouldPreserveContent(node.parent, options));
|
35678 | }
|
35679 | function needsToBorrowPrevClosingTagEndMarker(node) {
|
35680 | return node.prev && node.prev.type !== "docType" && !isTextLikeNode(node.prev) && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
|
35681 | }
|
35682 | function needsToBorrowLastChildClosingTagEndMarker(node) {
|
35683 | return node.lastChild && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces && !isTextLikeNode(getLastDescendant(node.lastChild)) && !isPreLikeNode(node);
|
35684 | }
|
35685 | function needsToBorrowParentClosingTagStartMarker(node) {
|
35686 | return !node.next && !node.hasTrailingSpaces && node.isTrailingSpaceSensitive && isTextLikeNode(getLastDescendant(node));
|
35687 | }
|
35688 | function needsToBorrowNextOpeningTagStartMarker(node) {
|
35689 | return node.next && !isTextLikeNode(node.next) && isTextLikeNode(node) && node.isTrailingSpaceSensitive && !node.hasTrailingSpaces;
|
35690 | }
|
35691 | function getPrettierIgnoreAttributeCommentData(value) {
|
35692 | const match = value.trim().match(/^prettier-ignore-attribute(?:\s+(.+))?$/s);
|
35693 | if (!match) {
|
35694 | return false;
|
35695 | }
|
35696 | if (!match[1]) {
|
35697 | return true;
|
35698 | }
|
35699 | return match[1].split(/\s+/);
|
35700 | }
|
35701 | function needsToBorrowParentOpeningTagEndMarker(node) {
|
35702 | return !node.prev && node.isLeadingSpaceSensitive && !node.hasLeadingSpaces;
|
35703 | }
|
35704 | function printAttributes(path, options, print) {
|
35705 | const node = path.getValue();
|
35706 | if (!isNonEmptyArray(node.attrs)) {
|
35707 | return node.isSelfClosing ? " " : "";
|
35708 | }
|
35709 | const ignoreAttributeData = node.prev && node.prev.type === "comment" && getPrettierIgnoreAttributeCommentData(node.prev.value);
|
35710 | const hasPrettierIgnoreAttribute = typeof ignoreAttributeData === "boolean" ? () => ignoreAttributeData : Array.isArray(ignoreAttributeData) ? (attribute) => ignoreAttributeData.includes(attribute.rawName) : () => false;
|
35711 | const printedAttributes = path.map((attributePath) => {
|
35712 | const attribute = attributePath.getValue();
|
35713 | return hasPrettierIgnoreAttribute(attribute) ? replaceTextEndOfLine(options.originalText.slice(locStart(attribute), locEnd(attribute))) : print();
|
35714 | }, "attrs");
|
35715 | const forceNotToBreakAttrContent = node.type === "element" && node.fullName === "script" && node.attrs.length === 1 && node.attrs[0].fullName === "src" && node.children.length === 0;
|
35716 | const shouldPrintAttributePerLine = options.singleAttributePerLine && node.attrs.length > 1 && !isVueSfcBlock(node, options);
|
35717 | const attributeLine = shouldPrintAttributePerLine ? hardline : line;
|
35718 | const parts = [indent([forceNotToBreakAttrContent ? " " : line, join(attributeLine, printedAttributes)])];
|
35719 | if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) || node.isSelfClosing && needsToBorrowLastChildClosingTagEndMarker(node.parent) || forceNotToBreakAttrContent) {
|
35720 | parts.push(node.isSelfClosing ? " " : "");
|
35721 | } else {
|
35722 | parts.push(options.bracketSameLine ? node.isSelfClosing ? " " : "" : node.isSelfClosing ? line : softline);
|
35723 | }
|
35724 | return parts;
|
35725 | }
|
35726 | function printOpeningTagEnd(node) {
|
35727 | return node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild) ? "" : printOpeningTagEndMarker(node);
|
35728 | }
|
35729 | function printOpeningTag(path, options, print) {
|
35730 | const node = path.getValue();
|
35731 | return [printOpeningTagStart(node, options), printAttributes(path, options, print), node.isSelfClosing ? "" : printOpeningTagEnd(node)];
|
35732 | }
|
35733 | function printOpeningTagStart(node, options) {
|
35734 | return node.prev && needsToBorrowNextOpeningTagStartMarker(node.prev) ? "" : [printOpeningTagPrefix(node, options), printOpeningTagStartMarker(node)];
|
35735 | }
|
35736 | function printOpeningTagPrefix(node, options) {
|
35737 | return needsToBorrowParentOpeningTagEndMarker(node) ? printOpeningTagEndMarker(node.parent) : needsToBorrowPrevClosingTagEndMarker(node) ? printClosingTagEndMarker(node.prev, options) : "";
|
35738 | }
|
35739 | function printOpeningTagStartMarker(node) {
|
35740 | switch (node.type) {
|
35741 | case "ieConditionalComment":
|
35742 | case "ieConditionalStartComment":
|
35743 | return `<!--[if ${node.condition}`;
|
35744 | case "ieConditionalEndComment":
|
35745 | return "<!--<!";
|
35746 | case "interpolation":
|
35747 | return "{{";
|
35748 | case "docType":
|
35749 | return "<!DOCTYPE";
|
35750 | case "element":
|
35751 | if (node.condition) {
|
35752 | return `<!--[if ${node.condition}]><!--><${node.rawName}`;
|
35753 | }
|
35754 | default:
|
35755 | return `<${node.rawName}`;
|
35756 | }
|
35757 | }
|
35758 | function printOpeningTagEndMarker(node) {
|
35759 | assert(!node.isSelfClosing);
|
35760 | switch (node.type) {
|
35761 | case "ieConditionalComment":
|
35762 | return "]>";
|
35763 | case "element":
|
35764 | if (node.condition) {
|
35765 | return "><!--<![endif]-->";
|
35766 | }
|
35767 | default:
|
35768 | return ">";
|
35769 | }
|
35770 | }
|
35771 | module2.exports = {
|
35772 | printClosingTag,
|
35773 | printClosingTagStart,
|
35774 | printClosingTagStartMarker,
|
35775 | printClosingTagEndMarker,
|
35776 | printClosingTagSuffix,
|
35777 | printClosingTagEnd,
|
35778 | needsToBorrowLastChildClosingTagEndMarker,
|
35779 | needsToBorrowParentClosingTagStartMarker,
|
35780 | needsToBorrowPrevClosingTagEndMarker,
|
35781 | printOpeningTag,
|
35782 | printOpeningTagStart,
|
35783 | printOpeningTagPrefix,
|
35784 | printOpeningTagStartMarker,
|
35785 | printOpeningTagEndMarker,
|
35786 | needsToBorrowNextOpeningTagStartMarker,
|
35787 | needsToBorrowParentOpeningTagEndMarker
|
35788 | };
|
35789 | }
|
35790 | });
|
35791 | var require_parse_srcset = __commonJS2({
|
35792 | "node_modules/parse-srcset/src/parse-srcset.js"(exports2, module2) {
|
35793 | (function(root, factory) {
|
35794 | if (typeof define === "function" && define.amd) {
|
35795 | define([], factory);
|
35796 | } else if (typeof module2 === "object" && module2.exports) {
|
35797 | module2.exports = factory();
|
35798 | } else {
|
35799 | root.parseSrcset = factory();
|
35800 | }
|
35801 | })(exports2, function() {
|
35802 | return function(input, options) {
|
35803 | var logger = options && options.logger || console;
|
35804 | function isSpace(c2) {
|
35805 | return c2 === " " || c2 === " " || c2 === "\n" || c2 === "\f" || c2 === "\r";
|
35806 | }
|
35807 | function collectCharacters(regEx) {
|
35808 | var chars, match = regEx.exec(input.substring(pos));
|
35809 | if (match) {
|
35810 | chars = match[0];
|
35811 | pos += chars.length;
|
35812 | return chars;
|
35813 | }
|
35814 | }
|
35815 | var inputLength = input.length, regexLeadingSpaces = /^[ \t\n\r\u000c]+/, regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/, regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/, regexTrailingCommas = /[,]+$/, regexNonNegativeInteger = /^\d+$/, regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/, url, descriptors, currentDescriptor, state, c, pos = 0, candidates = [];
|
35816 | while (true) {
|
35817 | collectCharacters(regexLeadingCommasOrSpaces);
|
35818 | if (pos >= inputLength) {
|
35819 | return candidates;
|
35820 | }
|
35821 | url = collectCharacters(regexLeadingNotSpaces);
|
35822 | descriptors = [];
|
35823 | if (url.slice(-1) === ",") {
|
35824 | url = url.replace(regexTrailingCommas, "");
|
35825 | parseDescriptors();
|
35826 | } else {
|
35827 | tokenize();
|
35828 | }
|
35829 | }
|
35830 | function tokenize() {
|
35831 | collectCharacters(regexLeadingSpaces);
|
35832 | currentDescriptor = "";
|
35833 | state = "in descriptor";
|
35834 | while (true) {
|
35835 | c = input.charAt(pos);
|
35836 | if (state === "in descriptor") {
|
35837 | if (isSpace(c)) {
|
35838 | if (currentDescriptor) {
|
35839 | descriptors.push(currentDescriptor);
|
35840 | currentDescriptor = "";
|
35841 | state = "after descriptor";
|
35842 | }
|
35843 | } else if (c === ",") {
|
35844 | pos += 1;
|
35845 | if (currentDescriptor) {
|
35846 | descriptors.push(currentDescriptor);
|
35847 | }
|
35848 | parseDescriptors();
|
35849 | return;
|
35850 | } else if (c === "(") {
|
35851 | currentDescriptor = currentDescriptor + c;
|
35852 | state = "in parens";
|
35853 | } else if (c === "") {
|
35854 | if (currentDescriptor) {
|
35855 | descriptors.push(currentDescriptor);
|
35856 | }
|
35857 | parseDescriptors();
|
35858 | return;
|
35859 | } else {
|
35860 | currentDescriptor = currentDescriptor + c;
|
35861 | }
|
35862 | } else if (state === "in parens") {
|
35863 | if (c === ")") {
|
35864 | currentDescriptor = currentDescriptor + c;
|
35865 | state = "in descriptor";
|
35866 | } else if (c === "") {
|
35867 | descriptors.push(currentDescriptor);
|
35868 | parseDescriptors();
|
35869 | return;
|
35870 | } else {
|
35871 | currentDescriptor = currentDescriptor + c;
|
35872 | }
|
35873 | } else if (state === "after descriptor") {
|
35874 | if (isSpace(c)) {
|
35875 | } else if (c === "") {
|
35876 | parseDescriptors();
|
35877 | return;
|
35878 | } else {
|
35879 | state = "in descriptor";
|
35880 | pos -= 1;
|
35881 | }
|
35882 | }
|
35883 | pos += 1;
|
35884 | }
|
35885 | }
|
35886 | function parseDescriptors() {
|
35887 | var pError = false, w, d, h, i, candidate = {}, desc, lastChar, value, intVal, floatVal;
|
35888 | for (i = 0; i < descriptors.length; i++) {
|
35889 | desc = descriptors[i];
|
35890 | lastChar = desc[desc.length - 1];
|
35891 | value = desc.substring(0, desc.length - 1);
|
35892 | intVal = parseInt(value, 10);
|
35893 | floatVal = parseFloat(value);
|
35894 | if (regexNonNegativeInteger.test(value) && lastChar === "w") {
|
35895 | if (w || d) {
|
35896 | pError = true;
|
35897 | }
|
35898 | if (intVal === 0) {
|
35899 | pError = true;
|
35900 | } else {
|
35901 | w = intVal;
|
35902 | }
|
35903 | } else if (regexFloatingPoint.test(value) && lastChar === "x") {
|
35904 | if (w || d || h) {
|
35905 | pError = true;
|
35906 | }
|
35907 | if (floatVal < 0) {
|
35908 | pError = true;
|
35909 | } else {
|
35910 | d = floatVal;
|
35911 | }
|
35912 | } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
|
35913 | if (h || d) {
|
35914 | pError = true;
|
35915 | }
|
35916 | if (intVal === 0) {
|
35917 | pError = true;
|
35918 | } else {
|
35919 | h = intVal;
|
35920 | }
|
35921 | } else {
|
35922 | pError = true;
|
35923 | }
|
35924 | }
|
35925 | if (!pError) {
|
35926 | candidate.url = url;
|
35927 | if (w) {
|
35928 | candidate.w = w;
|
35929 | }
|
35930 | if (d) {
|
35931 | candidate.d = d;
|
35932 | }
|
35933 | if (h) {
|
35934 | candidate.h = h;
|
35935 | }
|
35936 | candidates.push(candidate);
|
35937 | } else if (logger && logger.error) {
|
35938 | logger.error("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
|
35939 | }
|
35940 | }
|
35941 | };
|
35942 | });
|
35943 | }
|
35944 | });
|
35945 | var require_syntax_attribute = __commonJS2({
|
35946 | "src/language-html/syntax-attribute.js"(exports2, module2) {
|
35947 | "use strict";
|
35948 | var parseSrcset = require_parse_srcset();
|
35949 | var {
|
35950 | builders: {
|
35951 | ifBreak,
|
35952 | join,
|
35953 | line
|
35954 | }
|
35955 | } = require("./doc.js");
|
35956 | function printImgSrcset(value) {
|
35957 | const srcset = parseSrcset(value, {
|
35958 | logger: {
|
35959 | error(message) {
|
35960 | throw new Error(message);
|
35961 | }
|
35962 | }
|
35963 | });
|
35964 | const hasW = srcset.some(({
|
35965 | w
|
35966 | }) => w);
|
35967 | const hasH = srcset.some(({
|
35968 | h
|
35969 | }) => h);
|
35970 | const hasX = srcset.some(({
|
35971 | d
|
35972 | }) => d);
|
35973 | if (hasW + hasH + hasX > 1) {
|
35974 | throw new Error("Mixed descriptor in srcset is not supported");
|
35975 | }
|
35976 | const key = hasW ? "w" : hasH ? "h" : "d";
|
35977 | const unit = hasW ? "w" : hasH ? "h" : "x";
|
35978 | const getMax = (values) => Math.max(...values);
|
35979 | const urls = srcset.map((src) => src.url);
|
35980 | const maxUrlLength = getMax(urls.map((url) => url.length));
|
35981 | const descriptors = srcset.map((src) => src[key]).map((descriptor) => descriptor ? descriptor.toString() : "");
|
35982 | const descriptorLeftLengths = descriptors.map((descriptor) => {
|
35983 | const index = descriptor.indexOf(".");
|
35984 | return index === -1 ? descriptor.length : index;
|
35985 | });
|
35986 | const maxDescriptorLeftLength = getMax(descriptorLeftLengths);
|
35987 | return join([",", line], urls.map((url, index) => {
|
35988 | const parts = [url];
|
35989 | const descriptor = descriptors[index];
|
35990 | if (descriptor) {
|
35991 | const urlPadding = maxUrlLength - url.length + 1;
|
35992 | const descriptorPadding = maxDescriptorLeftLength - descriptorLeftLengths[index];
|
35993 | const alignment = " ".repeat(urlPadding + descriptorPadding);
|
35994 | parts.push(ifBreak(alignment, " "), descriptor + unit);
|
35995 | }
|
35996 | return parts;
|
35997 | }));
|
35998 | }
|
35999 | function printClassNames(value) {
|
36000 | return value.trim().split(/\s+/).join(" ");
|
36001 | }
|
36002 | module2.exports = {
|
36003 | printImgSrcset,
|
36004 | printClassNames
|
36005 | };
|
36006 | }
|
36007 | });
|
36008 | var require_syntax_vue = __commonJS2({
|
36009 | "src/language-html/syntax-vue.js"(exports2, module2) {
|
36010 | "use strict";
|
36011 | var {
|
36012 | builders: {
|
36013 | group
|
36014 | }
|
36015 | } = require("./doc.js");
|
36016 | function printVueFor(value, textToDoc) {
|
36017 | const {
|
36018 | left,
|
36019 | operator,
|
36020 | right
|
36021 | } = parseVueFor(value);
|
36022 | return [group(textToDoc(`function _(${left}) {}`, {
|
36023 | parser: "babel",
|
36024 | __isVueForBindingLeft: true
|
36025 | })), " ", operator, " ", textToDoc(right, {
|
36026 | parser: "__js_expression"
|
36027 | }, {
|
36028 | stripTrailingHardline: true
|
36029 | })];
|
36030 | }
|
36031 | function parseVueFor(value) {
|
36032 | const forAliasRE = /(.*?)\s+(in|of)\s+(.*)/s;
|
36033 | const forIteratorRE = /,([^,\]}]*)(?:,([^,\]}]*))?$/;
|
36034 | const stripParensRE = /^\(|\)$/g;
|
36035 | const inMatch = value.match(forAliasRE);
|
36036 | if (!inMatch) {
|
36037 | return;
|
36038 | }
|
36039 | const res = {};
|
36040 | res.for = inMatch[3].trim();
|
36041 | if (!res.for) {
|
36042 | return;
|
36043 | }
|
36044 | const alias = inMatch[1].trim().replace(stripParensRE, "");
|
36045 | const iteratorMatch = alias.match(forIteratorRE);
|
36046 | if (iteratorMatch) {
|
36047 | res.alias = alias.replace(forIteratorRE, "");
|
36048 | res.iterator1 = iteratorMatch[1].trim();
|
36049 | if (iteratorMatch[2]) {
|
36050 | res.iterator2 = iteratorMatch[2].trim();
|
36051 | }
|
36052 | } else {
|
36053 | res.alias = alias;
|
36054 | }
|
36055 | const left = [res.alias, res.iterator1, res.iterator2];
|
36056 | if (left.some((part, index) => !part && (index === 0 || left.slice(index + 1).some(Boolean)))) {
|
36057 | return;
|
36058 | }
|
36059 | return {
|
36060 | left: left.filter(Boolean).join(","),
|
36061 | operator: inMatch[2],
|
36062 | right: res.for
|
36063 | };
|
36064 | }
|
36065 | function printVueBindings(value, textToDoc) {
|
36066 | return textToDoc(`function _(${value}) {}`, {
|
36067 | parser: "babel",
|
36068 | __isVueBindings: true
|
36069 | });
|
36070 | }
|
36071 | function isVueEventBindingExpression(eventBindingValue) {
|
36072 | const fnExpRE = /^(?:[\w$]+|\([^)]*\))\s*=>|^function\s*\(/;
|
36073 | const simplePathRE = /^[$A-Z_a-z][\w$]*(?:\.[$A-Z_a-z][\w$]*|\['[^']*']|\["[^"]*"]|\[\d+]|\[[$A-Z_a-z][\w$]*])*$/;
|
36074 | const value = eventBindingValue.trim();
|
36075 | return fnExpRE.test(value) || simplePathRE.test(value);
|
36076 | }
|
36077 | module2.exports = {
|
36078 | isVueEventBindingExpression,
|
36079 | printVueFor,
|
36080 | printVueBindings
|
36081 | };
|
36082 | }
|
36083 | });
|
36084 | var require_get_node_content = __commonJS2({
|
36085 | "src/language-html/get-node-content.js"(exports2, module2) {
|
36086 | "use strict";
|
36087 | var {
|
36088 | needsToBorrowParentClosingTagStartMarker,
|
36089 | printClosingTagStartMarker,
|
36090 | needsToBorrowLastChildClosingTagEndMarker,
|
36091 | printClosingTagEndMarker,
|
36092 | needsToBorrowParentOpeningTagEndMarker,
|
36093 | printOpeningTagEndMarker
|
36094 | } = require_tag();
|
36095 | function getNodeContent(node, options) {
|
36096 | let start = node.startSourceSpan.end.offset;
|
36097 | if (node.firstChild && needsToBorrowParentOpeningTagEndMarker(node.firstChild)) {
|
36098 | start -= printOpeningTagEndMarker(node).length;
|
36099 | }
|
36100 | let end = node.endSourceSpan.start.offset;
|
36101 | if (node.lastChild && needsToBorrowParentClosingTagStartMarker(node.lastChild)) {
|
36102 | end += printClosingTagStartMarker(node, options).length;
|
36103 | } else if (needsToBorrowLastChildClosingTagEndMarker(node)) {
|
36104 | end -= printClosingTagEndMarker(node.lastChild, options).length;
|
36105 | }
|
36106 | return options.originalText.slice(start, end);
|
36107 | }
|
36108 | module2.exports = getNodeContent;
|
36109 | }
|
36110 | });
|
36111 | var require_embed4 = __commonJS2({
|
36112 | "src/language-html/embed.js"(exports2, module2) {
|
36113 | "use strict";
|
36114 | var {
|
36115 | builders: {
|
36116 | breakParent,
|
36117 | group,
|
36118 | hardline,
|
36119 | indent,
|
36120 | line,
|
36121 | fill,
|
36122 | softline
|
36123 | },
|
36124 | utils: {
|
36125 | mapDoc,
|
36126 | replaceTextEndOfLine
|
36127 | }
|
36128 | } = require("./doc.js");
|
36129 | var printFrontMatter = require_print();
|
36130 | var {
|
36131 | printClosingTag,
|
36132 | printClosingTagSuffix,
|
36133 | needsToBorrowPrevClosingTagEndMarker,
|
36134 | printOpeningTagPrefix,
|
36135 | printOpeningTag
|
36136 | } = require_tag();
|
36137 | var {
|
36138 | printImgSrcset,
|
36139 | printClassNames
|
36140 | } = require_syntax_attribute();
|
36141 | var {
|
36142 | printVueFor,
|
36143 | printVueBindings,
|
36144 | isVueEventBindingExpression
|
36145 | } = require_syntax_vue();
|
36146 | var {
|
36147 | isScriptLikeTag,
|
36148 | isVueNonHtmlBlock,
|
36149 | inferScriptParser,
|
36150 | htmlTrimPreserveIndentation,
|
36151 | dedentString,
|
36152 | unescapeQuoteEntities,
|
36153 | isVueSlotAttribute,
|
36154 | isVueSfcBindingsAttribute,
|
36155 | getTextValueParts
|
36156 | } = require_utils11();
|
36157 | var getNodeContent = require_get_node_content();
|
36158 | function printEmbeddedAttributeValue(node, htmlTextToDoc, options) {
|
36159 | const isKeyMatched = (patterns) => new RegExp(patterns.join("|")).test(node.fullName);
|
36160 | const getValue = () => unescapeQuoteEntities(node.value);
|
36161 | let shouldHug = false;
|
36162 | const __onHtmlBindingRoot = (root, options2) => {
|
36163 | const rootNode = root.type === "NGRoot" ? root.node.type === "NGMicrosyntax" && root.node.body.length === 1 && root.node.body[0].type === "NGMicrosyntaxExpression" ? root.node.body[0].expression : root.node : root.type === "JsExpressionRoot" ? root.node : root;
|
36164 | if (rootNode && (rootNode.type === "ObjectExpression" || rootNode.type === "ArrayExpression" || options2.parser === "__vue_expression" && (rootNode.type === "TemplateLiteral" || rootNode.type === "StringLiteral"))) {
|
36165 | shouldHug = true;
|
36166 | }
|
36167 | };
|
36168 | const printHug = (doc2) => group(doc2);
|
36169 | const printExpand = (doc2, canHaveTrailingWhitespace = true) => group([indent([softline, doc2]), canHaveTrailingWhitespace ? softline : ""]);
|
36170 | const printMaybeHug = (doc2) => shouldHug ? printHug(doc2) : printExpand(doc2);
|
36171 | const attributeTextToDoc = (code, opts) => htmlTextToDoc(code, Object.assign({
|
36172 | __onHtmlBindingRoot,
|
36173 | __embeddedInHtml: true
|
36174 | }, opts));
|
36175 | if (node.fullName === "srcset" && (node.parent.fullName === "img" || node.parent.fullName === "source")) {
|
36176 | return printExpand(printImgSrcset(getValue()));
|
36177 | }
|
36178 | if (node.fullName === "class" && !options.parentParser) {
|
36179 | const value = getValue();
|
36180 | if (!value.includes("{{")) {
|
36181 | return printClassNames(value);
|
36182 | }
|
36183 | }
|
36184 | if (node.fullName === "style" && !options.parentParser) {
|
36185 | const value = getValue();
|
36186 | if (!value.includes("{{")) {
|
36187 | return printExpand(attributeTextToDoc(value, {
|
36188 | parser: "css",
|
36189 | __isHTMLStyleAttribute: true
|
36190 | }));
|
36191 | }
|
36192 | }
|
36193 | if (options.parser === "vue") {
|
36194 | if (node.fullName === "v-for") {
|
36195 | return printVueFor(getValue(), attributeTextToDoc);
|
36196 | }
|
36197 | if (isVueSlotAttribute(node) || isVueSfcBindingsAttribute(node, options)) {
|
36198 | return printVueBindings(getValue(), attributeTextToDoc);
|
36199 | }
|
36200 | const vueEventBindingPatterns = ["^@", "^v-on:"];
|
36201 | const vueExpressionBindingPatterns = ["^:", "^v-bind:"];
|
36202 | const jsExpressionBindingPatterns = ["^v-"];
|
36203 | if (isKeyMatched(vueEventBindingPatterns)) {
|
36204 | const value = getValue();
|
36205 | const parser = isVueEventBindingExpression(value) ? "__js_expression" : options.__should_parse_vue_template_with_ts ? "__vue_ts_event_binding" : "__vue_event_binding";
|
36206 | return printMaybeHug(attributeTextToDoc(value, {
|
36207 | parser
|
36208 | }));
|
36209 | }
|
36210 | if (isKeyMatched(vueExpressionBindingPatterns)) {
|
36211 | return printMaybeHug(attributeTextToDoc(getValue(), {
|
36212 | parser: "__vue_expression"
|
36213 | }));
|
36214 | }
|
36215 | if (isKeyMatched(jsExpressionBindingPatterns)) {
|
36216 | return printMaybeHug(attributeTextToDoc(getValue(), {
|
36217 | parser: "__js_expression"
|
36218 | }));
|
36219 | }
|
36220 | }
|
36221 | if (options.parser === "angular") {
|
36222 | const ngTextToDoc = (code, opts) => attributeTextToDoc(code, Object.assign(Object.assign({}, opts), {}, {
|
36223 | trailingComma: "none"
|
36224 | }));
|
36225 | const ngDirectiveBindingPatterns = ["^\\*"];
|
36226 | const ngStatementBindingPatterns = ["^\\(.+\\)$", "^on-"];
|
36227 | const ngExpressionBindingPatterns = ["^\\[.+\\]$", "^bind(on)?-", "^ng-(if|show|hide|class|style)$"];
|
36228 | const ngI18nPatterns = ["^i18n(-.+)?$"];
|
36229 | if (isKeyMatched(ngStatementBindingPatterns)) {
|
36230 | return printMaybeHug(ngTextToDoc(getValue(), {
|
36231 | parser: "__ng_action"
|
36232 | }));
|
36233 | }
|
36234 | if (isKeyMatched(ngExpressionBindingPatterns)) {
|
36235 | return printMaybeHug(ngTextToDoc(getValue(), {
|
36236 | parser: "__ng_binding"
|
36237 | }));
|
36238 | }
|
36239 | if (isKeyMatched(ngI18nPatterns)) {
|
36240 | const value2 = getValue().trim();
|
36241 | return printExpand(fill(getTextValueParts(node, value2)), !value2.includes("@@"));
|
36242 | }
|
36243 | if (isKeyMatched(ngDirectiveBindingPatterns)) {
|
36244 | return printMaybeHug(ngTextToDoc(getValue(), {
|
36245 | parser: "__ng_directive"
|
36246 | }));
|
36247 | }
|
36248 | const interpolationRegex = /{{(.+?)}}/s;
|
36249 | const value = getValue();
|
36250 | if (interpolationRegex.test(value)) {
|
36251 | const parts = [];
|
36252 | for (const [index, part] of value.split(interpolationRegex).entries()) {
|
36253 | if (index % 2 === 0) {
|
36254 | parts.push(replaceTextEndOfLine(part));
|
36255 | } else {
|
36256 | try {
|
36257 | parts.push(group(["{{", indent([line, ngTextToDoc(part, {
|
36258 | parser: "__ng_interpolation",
|
36259 | __isInHtmlInterpolation: true
|
36260 | })]), line, "}}"]));
|
36261 | } catch {
|
36262 | parts.push("{{", replaceTextEndOfLine(part), "}}");
|
36263 | }
|
36264 | }
|
36265 | }
|
36266 | return group(parts);
|
36267 | }
|
36268 | }
|
36269 | return null;
|
36270 | }
|
36271 | function embed(path, print, textToDoc, options) {
|
36272 | const node = path.getValue();
|
36273 | switch (node.type) {
|
36274 | case "element": {
|
36275 | if (isScriptLikeTag(node) || node.type === "interpolation") {
|
36276 | return;
|
36277 | }
|
36278 | if (!node.isSelfClosing && isVueNonHtmlBlock(node, options)) {
|
36279 | const parser = inferScriptParser(node, options);
|
36280 | if (!parser) {
|
36281 | return;
|
36282 | }
|
36283 | const content = getNodeContent(node, options);
|
36284 | let isEmpty = /^\s*$/.test(content);
|
36285 | let doc2 = "";
|
36286 | if (!isEmpty) {
|
36287 | doc2 = textToDoc(htmlTrimPreserveIndentation(content), {
|
36288 | parser,
|
36289 | __embeddedInHtml: true
|
36290 | }, {
|
36291 | stripTrailingHardline: true
|
36292 | });
|
36293 | isEmpty = doc2 === "";
|
36294 | }
|
36295 | return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), isEmpty ? "" : hardline, doc2, isEmpty ? "" : hardline, printClosingTag(node, options), printClosingTagSuffix(node, options)];
|
36296 | }
|
36297 | break;
|
36298 | }
|
36299 | case "text": {
|
36300 | if (isScriptLikeTag(node.parent)) {
|
36301 | const parser = inferScriptParser(node.parent, options);
|
36302 | if (parser) {
|
36303 | const value = parser === "markdown" ? dedentString(node.value.replace(/^[^\S\n]*\n/, "")) : node.value;
|
36304 | const textToDocOptions = {
|
36305 | parser,
|
36306 | __embeddedInHtml: true
|
36307 | };
|
36308 | if (options.parser === "html" && parser === "babel") {
|
36309 | let sourceType = "script";
|
36310 | const {
|
36311 | attrMap
|
36312 | } = node.parent;
|
36313 | if (attrMap && (attrMap.type === "module" || attrMap.type === "text/babel" && attrMap["data-type"] === "module")) {
|
36314 | sourceType = "module";
|
36315 | }
|
36316 | textToDocOptions.__babelSourceType = sourceType;
|
36317 | }
|
36318 | return [breakParent, printOpeningTagPrefix(node, options), textToDoc(value, textToDocOptions, {
|
36319 | stripTrailingHardline: true
|
36320 | }), printClosingTagSuffix(node, options)];
|
36321 | }
|
36322 | } else if (node.parent.type === "interpolation") {
|
36323 | const textToDocOptions = {
|
36324 | __isInHtmlInterpolation: true,
|
36325 | __embeddedInHtml: true
|
36326 | };
|
36327 | if (options.parser === "angular") {
|
36328 | textToDocOptions.parser = "__ng_interpolation";
|
36329 | textToDocOptions.trailingComma = "none";
|
36330 | } else if (options.parser === "vue") {
|
36331 | textToDocOptions.parser = options.__should_parse_vue_template_with_ts ? "__vue_ts_expression" : "__vue_expression";
|
36332 | } else {
|
36333 | textToDocOptions.parser = "__js_expression";
|
36334 | }
|
36335 | return [indent([line, textToDoc(node.value, textToDocOptions, {
|
36336 | stripTrailingHardline: true
|
36337 | })]), node.parent.next && needsToBorrowPrevClosingTagEndMarker(node.parent.next) ? " " : line];
|
36338 | }
|
36339 | break;
|
36340 | }
|
36341 | case "attribute": {
|
36342 | if (!node.value) {
|
36343 | break;
|
36344 | }
|
36345 | if (/^PRETTIER_HTML_PLACEHOLDER_\d+_\d+_IN_JS$/.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
36346 | return [node.rawName, "=", node.value];
|
36347 | }
|
36348 | if (options.parser === "lwc") {
|
36349 | const interpolationRegex = /^{.*}$/s;
|
36350 | if (interpolationRegex.test(options.originalText.slice(node.valueSpan.start.offset, node.valueSpan.end.offset))) {
|
36351 | return [node.rawName, "=", node.value];
|
36352 | }
|
36353 | }
|
36354 | const embeddedAttributeValueDoc = printEmbeddedAttributeValue(node, (code, opts) => textToDoc(code, Object.assign({
|
36355 | __isInHtmlAttribute: true,
|
36356 | __embeddedInHtml: true
|
36357 | }, opts), {
|
36358 | stripTrailingHardline: true
|
36359 | }), options);
|
36360 | if (embeddedAttributeValueDoc) {
|
36361 | return [node.rawName, '="', group(mapDoc(embeddedAttributeValueDoc, (doc2) => typeof doc2 === "string" ? doc2.replace(/"/g, """) : doc2)), '"'];
|
36362 | }
|
36363 | break;
|
36364 | }
|
36365 | case "front-matter":
|
36366 | return printFrontMatter(node, textToDoc);
|
36367 | }
|
36368 | }
|
36369 | module2.exports = embed;
|
36370 | }
|
36371 | });
|
36372 | var require_children = __commonJS2({
|
36373 | "src/language-html/print/children.js"(exports2, module2) {
|
36374 | "use strict";
|
36375 | var {
|
36376 | builders: {
|
36377 | breakParent,
|
36378 | group,
|
36379 | ifBreak,
|
36380 | line,
|
36381 | softline,
|
36382 | hardline
|
36383 | },
|
36384 | utils: {
|
36385 | replaceTextEndOfLine
|
36386 | }
|
36387 | } = require("./doc.js");
|
36388 | var {
|
36389 | locStart,
|
36390 | locEnd
|
36391 | } = require_loc6();
|
36392 | var {
|
36393 | forceBreakChildren,
|
36394 | forceNextEmptyLine,
|
36395 | isTextLikeNode,
|
36396 | hasPrettierIgnore,
|
36397 | preferHardlineAsLeadingSpaces
|
36398 | } = require_utils11();
|
36399 | var {
|
36400 | printOpeningTagPrefix,
|
36401 | needsToBorrowNextOpeningTagStartMarker,
|
36402 | printOpeningTagStartMarker,
|
36403 | needsToBorrowPrevClosingTagEndMarker,
|
36404 | printClosingTagEndMarker,
|
36405 | printClosingTagSuffix,
|
36406 | needsToBorrowParentClosingTagStartMarker
|
36407 | } = require_tag();
|
36408 | function printChild(childPath, options, print) {
|
36409 | const child = childPath.getValue();
|
36410 | if (hasPrettierIgnore(child)) {
|
36411 | return [printOpeningTagPrefix(child, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(child) + (child.prev && needsToBorrowNextOpeningTagStartMarker(child.prev) ? printOpeningTagStartMarker(child).length : 0), locEnd(child) - (child.next && needsToBorrowPrevClosingTagEndMarker(child.next) ? printClosingTagEndMarker(child, options).length : 0))), printClosingTagSuffix(child, options)];
|
36412 | }
|
36413 | return print();
|
36414 | }
|
36415 | function printBetweenLine(prevNode, nextNode) {
|
36416 | return isTextLikeNode(prevNode) && isTextLikeNode(nextNode) ? prevNode.isTrailingSpaceSensitive ? prevNode.hasTrailingSpaces ? preferHardlineAsLeadingSpaces(nextNode) ? hardline : line : "" : preferHardlineAsLeadingSpaces(nextNode) ? hardline : softline : needsToBorrowNextOpeningTagStartMarker(prevNode) && (hasPrettierIgnore(nextNode) || nextNode.firstChild || nextNode.isSelfClosing || nextNode.type === "element" && nextNode.attrs.length > 0) || prevNode.type === "element" && prevNode.isSelfClosing && needsToBorrowPrevClosingTagEndMarker(nextNode) ? "" : !nextNode.isLeadingSpaceSensitive || preferHardlineAsLeadingSpaces(nextNode) || needsToBorrowPrevClosingTagEndMarker(nextNode) && prevNode.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild) && prevNode.lastChild.lastChild && needsToBorrowParentClosingTagStartMarker(prevNode.lastChild.lastChild) ? hardline : nextNode.hasLeadingSpaces ? line : softline;
|
36417 | }
|
36418 | function printChildren(path, options, print) {
|
36419 | const node = path.getValue();
|
36420 | if (forceBreakChildren(node)) {
|
36421 | return [breakParent, ...path.map((childPath) => {
|
36422 | const childNode = childPath.getValue();
|
36423 | const prevBetweenLine = !childNode.prev ? "" : printBetweenLine(childNode.prev, childNode);
|
36424 | return [!prevBetweenLine ? "" : [prevBetweenLine, forceNextEmptyLine(childNode.prev) ? hardline : ""], printChild(childPath, options, print)];
|
36425 | }, "children")];
|
36426 | }
|
36427 | const groupIds = node.children.map(() => Symbol(""));
|
36428 | return path.map((childPath, childIndex) => {
|
36429 | const childNode = childPath.getValue();
|
36430 | if (isTextLikeNode(childNode)) {
|
36431 | if (childNode.prev && isTextLikeNode(childNode.prev)) {
|
36432 | const prevBetweenLine2 = printBetweenLine(childNode.prev, childNode);
|
36433 | if (prevBetweenLine2) {
|
36434 | if (forceNextEmptyLine(childNode.prev)) {
|
36435 | return [hardline, hardline, printChild(childPath, options, print)];
|
36436 | }
|
36437 | return [prevBetweenLine2, printChild(childPath, options, print)];
|
36438 | }
|
36439 | }
|
36440 | return printChild(childPath, options, print);
|
36441 | }
|
36442 | const prevParts = [];
|
36443 | const leadingParts = [];
|
36444 | const trailingParts = [];
|
36445 | const nextParts = [];
|
36446 | const prevBetweenLine = childNode.prev ? printBetweenLine(childNode.prev, childNode) : "";
|
36447 | const nextBetweenLine = childNode.next ? printBetweenLine(childNode, childNode.next) : "";
|
36448 | if (prevBetweenLine) {
|
36449 | if (forceNextEmptyLine(childNode.prev)) {
|
36450 | prevParts.push(hardline, hardline);
|
36451 | } else if (prevBetweenLine === hardline) {
|
36452 | prevParts.push(hardline);
|
36453 | } else {
|
36454 | if (isTextLikeNode(childNode.prev)) {
|
36455 | leadingParts.push(prevBetweenLine);
|
36456 | } else {
|
36457 | leadingParts.push(ifBreak("", softline, {
|
36458 | groupId: groupIds[childIndex - 1]
|
36459 | }));
|
36460 | }
|
36461 | }
|
36462 | }
|
36463 | if (nextBetweenLine) {
|
36464 | if (forceNextEmptyLine(childNode)) {
|
36465 | if (isTextLikeNode(childNode.next)) {
|
36466 | nextParts.push(hardline, hardline);
|
36467 | }
|
36468 | } else if (nextBetweenLine === hardline) {
|
36469 | if (isTextLikeNode(childNode.next)) {
|
36470 | nextParts.push(hardline);
|
36471 | }
|
36472 | } else {
|
36473 | trailingParts.push(nextBetweenLine);
|
36474 | }
|
36475 | }
|
36476 | return [...prevParts, group([...leadingParts, group([printChild(childPath, options, print), ...trailingParts], {
|
36477 | id: groupIds[childIndex]
|
36478 | })]), ...nextParts];
|
36479 | }, "children");
|
36480 | }
|
36481 | module2.exports = {
|
36482 | printChildren
|
36483 | };
|
36484 | }
|
36485 | });
|
36486 | var require_element = __commonJS2({
|
36487 | "src/language-html/print/element.js"(exports2, module2) {
|
36488 | "use strict";
|
36489 | var {
|
36490 | builders: {
|
36491 | breakParent,
|
36492 | dedentToRoot,
|
36493 | group,
|
36494 | ifBreak,
|
36495 | indentIfBreak,
|
36496 | indent,
|
36497 | line,
|
36498 | softline
|
36499 | },
|
36500 | utils: {
|
36501 | replaceTextEndOfLine
|
36502 | }
|
36503 | } = require("./doc.js");
|
36504 | var getNodeContent = require_get_node_content();
|
36505 | var {
|
36506 | shouldPreserveContent,
|
36507 | isScriptLikeTag,
|
36508 | isVueCustomBlock,
|
36509 | countParents,
|
36510 | forceBreakContent
|
36511 | } = require_utils11();
|
36512 | var {
|
36513 | printOpeningTagPrefix,
|
36514 | printOpeningTag,
|
36515 | printClosingTagSuffix,
|
36516 | printClosingTag,
|
36517 | needsToBorrowPrevClosingTagEndMarker,
|
36518 | needsToBorrowLastChildClosingTagEndMarker
|
36519 | } = require_tag();
|
36520 | var {
|
36521 | printChildren
|
36522 | } = require_children();
|
36523 | function printElement(path, options, print) {
|
36524 | const node = path.getValue();
|
36525 | if (shouldPreserveContent(node, options)) {
|
36526 | return [printOpeningTagPrefix(node, options), group(printOpeningTag(path, options, print)), ...replaceTextEndOfLine(getNodeContent(node, options)), ...printClosingTag(node, options), printClosingTagSuffix(node, options)];
|
36527 | }
|
36528 | const shouldHugContent = node.children.length === 1 && node.firstChild.type === "interpolation" && node.firstChild.isLeadingSpaceSensitive && !node.firstChild.hasLeadingSpaces && node.lastChild.isTrailingSpaceSensitive && !node.lastChild.hasTrailingSpaces;
|
36529 | const attrGroupId = Symbol("element-attr-group-id");
|
36530 | const printTag = (doc2) => group([group(printOpeningTag(path, options, print), {
|
36531 | id: attrGroupId
|
36532 | }), doc2, printClosingTag(node, options)]);
|
36533 | const printChildrenDoc = (childrenDoc) => {
|
36534 | if (shouldHugContent) {
|
36535 | return indentIfBreak(childrenDoc, {
|
36536 | groupId: attrGroupId
|
36537 | });
|
36538 | }
|
36539 | if ((isScriptLikeTag(node) || isVueCustomBlock(node, options)) && node.parent.type === "root" && options.parser === "vue" && !options.vueIndentScriptAndStyle) {
|
36540 | return childrenDoc;
|
36541 | }
|
36542 | return indent(childrenDoc);
|
36543 | };
|
36544 | const printLineBeforeChildren = () => {
|
36545 | if (shouldHugContent) {
|
36546 | return ifBreak(softline, "", {
|
36547 | groupId: attrGroupId
|
36548 | });
|
36549 | }
|
36550 | if (node.firstChild.hasLeadingSpaces && node.firstChild.isLeadingSpaceSensitive) {
|
36551 | return line;
|
36552 | }
|
36553 | if (node.firstChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) {
|
36554 | return dedentToRoot(softline);
|
36555 | }
|
36556 | return softline;
|
36557 | };
|
36558 | const printLineAfterChildren = () => {
|
36559 | const needsToBorrow = node.next ? needsToBorrowPrevClosingTagEndMarker(node.next) : needsToBorrowLastChildClosingTagEndMarker(node.parent);
|
36560 | if (needsToBorrow) {
|
36561 | if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
|
36562 | return " ";
|
36563 | }
|
36564 | return "";
|
36565 | }
|
36566 | if (shouldHugContent) {
|
36567 | return ifBreak(softline, "", {
|
36568 | groupId: attrGroupId
|
36569 | });
|
36570 | }
|
36571 | if (node.lastChild.hasTrailingSpaces && node.lastChild.isTrailingSpaceSensitive) {
|
36572 | return line;
|
36573 | }
|
36574 | if ((node.lastChild.type === "comment" || node.lastChild.type === "text" && node.isWhitespaceSensitive && node.isIndentationSensitive) && new RegExp(`\\n[\\t ]{${options.tabWidth * countParents(path, (node2) => node2.parent && node2.parent.type !== "root")}}$`).test(node.lastChild.value)) {
|
36575 | return "";
|
36576 | }
|
36577 | return softline;
|
36578 | };
|
36579 | if (node.children.length === 0) {
|
36580 | return printTag(node.hasDanglingSpaces && node.isDanglingSpaceSensitive ? line : "");
|
36581 | }
|
36582 | return printTag([forceBreakContent(node) ? breakParent : "", printChildrenDoc([printLineBeforeChildren(), printChildren(path, options, print)]), printLineAfterChildren()]);
|
36583 | }
|
36584 | module2.exports = {
|
36585 | printElement
|
36586 | };
|
36587 | }
|
36588 | });
|
36589 | var require_printer_html = __commonJS2({
|
36590 | "src/language-html/printer-html.js"(exports2, module2) {
|
36591 | "use strict";
|
36592 | var {
|
36593 | builders: {
|
36594 | fill,
|
36595 | group,
|
36596 | hardline,
|
36597 | literalline
|
36598 | },
|
36599 | utils: {
|
36600 | cleanDoc,
|
36601 | getDocParts,
|
36602 | isConcat,
|
36603 | replaceTextEndOfLine
|
36604 | }
|
36605 | } = require("./doc.js");
|
36606 | var clean = require_clean5();
|
36607 | var {
|
36608 | countChars,
|
36609 | unescapeQuoteEntities,
|
36610 | getTextValueParts
|
36611 | } = require_utils11();
|
36612 | var preprocess = require_print_preprocess3();
|
36613 | var {
|
36614 | insertPragma
|
36615 | } = require_pragma5();
|
36616 | var {
|
36617 | locStart,
|
36618 | locEnd
|
36619 | } = require_loc6();
|
36620 | var embed = require_embed4();
|
36621 | var {
|
36622 | printClosingTagSuffix,
|
36623 | printClosingTagEnd,
|
36624 | printOpeningTagPrefix,
|
36625 | printOpeningTagStart
|
36626 | } = require_tag();
|
36627 | var {
|
36628 | printElement
|
36629 | } = require_element();
|
36630 | var {
|
36631 | printChildren
|
36632 | } = require_children();
|
36633 | function genericPrint(path, options, print) {
|
36634 | const node = path.getValue();
|
36635 | switch (node.type) {
|
36636 | case "front-matter":
|
36637 | return replaceTextEndOfLine(node.raw);
|
36638 | case "root":
|
36639 | if (options.__onHtmlRoot) {
|
36640 | options.__onHtmlRoot(node);
|
36641 | }
|
36642 | return [group(printChildren(path, options, print)), hardline];
|
36643 | case "element":
|
36644 | case "ieConditionalComment": {
|
36645 | return printElement(path, options, print);
|
36646 | }
|
36647 | case "ieConditionalStartComment":
|
36648 | case "ieConditionalEndComment":
|
36649 | return [printOpeningTagStart(node), printClosingTagEnd(node)];
|
36650 | case "interpolation":
|
36651 | return [printOpeningTagStart(node, options), ...path.map(print, "children"), printClosingTagEnd(node, options)];
|
36652 | case "text": {
|
36653 | if (node.parent.type === "interpolation") {
|
36654 | const trailingNewlineRegex = /\n[^\S\n]*$/;
|
36655 | const hasTrailingNewline = trailingNewlineRegex.test(node.value);
|
36656 | const value = hasTrailingNewline ? node.value.replace(trailingNewlineRegex, "") : node.value;
|
36657 | return [...replaceTextEndOfLine(value), hasTrailingNewline ? hardline : ""];
|
36658 | }
|
36659 | const printed = cleanDoc([printOpeningTagPrefix(node, options), ...getTextValueParts(node), printClosingTagSuffix(node, options)]);
|
36660 | if (isConcat(printed) || printed.type === "fill") {
|
36661 | return fill(getDocParts(printed));
|
36662 | }
|
36663 | return printed;
|
36664 | }
|
36665 | case "docType":
|
36666 | return [group([printOpeningTagStart(node, options), " ", node.value.replace(/^html\b/i, "html").replace(/\s+/g, " ")]), printClosingTagEnd(node, options)];
|
36667 | case "comment": {
|
36668 | return [printOpeningTagPrefix(node, options), ...replaceTextEndOfLine(options.originalText.slice(locStart(node), locEnd(node)), literalline), printClosingTagSuffix(node, options)];
|
36669 | }
|
36670 | case "attribute": {
|
36671 | if (node.value === null) {
|
36672 | return node.rawName;
|
36673 | }
|
36674 | const value = unescapeQuoteEntities(node.value);
|
36675 | const singleQuoteCount = countChars(value, "'");
|
36676 | const doubleQuoteCount = countChars(value, '"');
|
36677 | const quote = singleQuoteCount < doubleQuoteCount ? "'" : '"';
|
36678 | return [node.rawName, "=", quote, ...replaceTextEndOfLine(quote === '"' ? value.replace(/"/g, """) : value.replace(/'/g, "'")), quote];
|
36679 | }
|
36680 | default:
|
36681 | throw new Error(`Unexpected node type ${node.type}`);
|
36682 | }
|
36683 | }
|
36684 | module2.exports = {
|
36685 | preprocess,
|
36686 | print: genericPrint,
|
36687 | insertPragma,
|
36688 | massageAstNode: clean,
|
36689 | embed
|
36690 | };
|
36691 | }
|
36692 | });
|
36693 | var require_options6 = __commonJS2({
|
36694 | "src/language-html/options.js"(exports2, module2) {
|
36695 | "use strict";
|
36696 | var commonOptions = require_common_options();
|
36697 | var CATEGORY_HTML = "HTML";
|
36698 | module2.exports = {
|
36699 | bracketSameLine: commonOptions.bracketSameLine,
|
36700 | htmlWhitespaceSensitivity: {
|
36701 | since: "1.15.0",
|
36702 | category: CATEGORY_HTML,
|
36703 | type: "choice",
|
36704 | default: "css",
|
36705 | description: "How to handle whitespaces in HTML.",
|
36706 | choices: [{
|
36707 | value: "css",
|
36708 | description: "Respect the default value of CSS display property."
|
36709 | }, {
|
36710 | value: "strict",
|
36711 | description: "Whitespaces are considered sensitive."
|
36712 | }, {
|
36713 | value: "ignore",
|
36714 | description: "Whitespaces are considered insensitive."
|
36715 | }]
|
36716 | },
|
36717 | singleAttributePerLine: commonOptions.singleAttributePerLine,
|
36718 | vueIndentScriptAndStyle: {
|
36719 | since: "1.19.0",
|
36720 | category: CATEGORY_HTML,
|
36721 | type: "boolean",
|
36722 | default: false,
|
36723 | description: "Indent script and style tags in Vue files."
|
36724 | }
|
36725 | };
|
36726 | }
|
36727 | });
|
36728 | var require_parsers6 = __commonJS2({
|
36729 | "src/language-html/parsers.js"(exports2, module2) {
|
36730 | "use strict";
|
36731 | module2.exports = {
|
36732 | get html() {
|
36733 | return require("./parser-html.js").parsers.html;
|
36734 | },
|
36735 | get vue() {
|
36736 | return require("./parser-html.js").parsers.vue;
|
36737 | },
|
36738 | get angular() {
|
36739 | return require("./parser-html.js").parsers.angular;
|
36740 | },
|
36741 | get lwc() {
|
36742 | return require("./parser-html.js").parsers.lwc;
|
36743 | }
|
36744 | };
|
36745 | }
|
36746 | });
|
36747 | var require_HTML = __commonJS2({
|
36748 | "node_modules/linguist-languages/data/HTML.json"(exports2, module2) {
|
36749 | module2.exports = {
|
36750 | name: "HTML",
|
36751 | type: "markup",
|
36752 | tmScope: "text.html.basic",
|
36753 | aceMode: "html",
|
36754 | codemirrorMode: "htmlmixed",
|
36755 | codemirrorMimeType: "text/html",
|
36756 | color: "#e34c26",
|
36757 | aliases: ["xhtml"],
|
36758 | extensions: [".html", ".hta", ".htm", ".html.hl", ".inc", ".xht", ".xhtml"],
|
36759 | languageId: 146
|
36760 | };
|
36761 | }
|
36762 | });
|
36763 | var require_Vue = __commonJS2({
|
36764 | "node_modules/linguist-languages/data/Vue.json"(exports2, module2) {
|
36765 | module2.exports = {
|
36766 | name: "Vue",
|
36767 | type: "markup",
|
36768 | color: "#41b883",
|
36769 | extensions: [".vue"],
|
36770 | tmScope: "text.html.vue",
|
36771 | aceMode: "html",
|
36772 | languageId: 391
|
36773 | };
|
36774 | }
|
36775 | });
|
36776 | var require_language_html = __commonJS2({
|
36777 | "src/language-html/index.js"(exports2, module2) {
|
36778 | "use strict";
|
36779 | var createLanguage = require_create_language();
|
36780 | var printer = require_printer_html();
|
36781 | var options = require_options6();
|
36782 | var parsers = require_parsers6();
|
36783 | var languages = [createLanguage(require_HTML(), () => ({
|
36784 | name: "Angular",
|
36785 | since: "1.15.0",
|
36786 | parsers: ["angular"],
|
36787 | vscodeLanguageIds: ["html"],
|
36788 | extensions: [".component.html"],
|
36789 | filenames: []
|
36790 | })), createLanguage(require_HTML(), (data) => ({
|
36791 | since: "1.15.0",
|
36792 | parsers: ["html"],
|
36793 | vscodeLanguageIds: ["html"],
|
36794 | extensions: [...data.extensions, ".mjml"]
|
36795 | })), createLanguage(require_HTML(), () => ({
|
36796 | name: "Lightning Web Components",
|
36797 | since: "1.17.0",
|
36798 | parsers: ["lwc"],
|
36799 | vscodeLanguageIds: ["html"],
|
36800 | extensions: [],
|
36801 | filenames: []
|
36802 | })), createLanguage(require_Vue(), () => ({
|
36803 | since: "1.10.0",
|
36804 | parsers: ["vue"],
|
36805 | vscodeLanguageIds: ["vue"]
|
36806 | }))];
|
36807 | var printers = {
|
36808 | html: printer
|
36809 | };
|
36810 | module2.exports = {
|
36811 | languages,
|
36812 | printers,
|
36813 | options,
|
36814 | parsers
|
36815 | };
|
36816 | }
|
36817 | });
|
36818 | var require_pragma6 = __commonJS2({
|
36819 | "src/language-yaml/pragma.js"(exports2, module2) {
|
36820 | "use strict";
|
36821 | function isPragma(text) {
|
36822 | return /^\s*@(?:prettier|format)\s*$/.test(text);
|
36823 | }
|
36824 | function hasPragma(text) {
|
36825 | return /^\s*#[^\S\n]*@(?:prettier|format)\s*?(?:\n|$)/.test(text);
|
36826 | }
|
36827 | function insertPragma(text) {
|
36828 | return `# @format
|
36829 |
|
36830 | ${text}`;
|
36831 | }
|
36832 | module2.exports = {
|
36833 | isPragma,
|
36834 | hasPragma,
|
36835 | insertPragma
|
36836 | };
|
36837 | }
|
36838 | });
|
36839 | var require_loc7 = __commonJS2({
|
36840 | "src/language-yaml/loc.js"(exports2, module2) {
|
36841 | "use strict";
|
36842 | function locStart(node) {
|
36843 | return node.position.start.offset;
|
36844 | }
|
36845 | function locEnd(node) {
|
36846 | return node.position.end.offset;
|
36847 | }
|
36848 | module2.exports = {
|
36849 | locStart,
|
36850 | locEnd
|
36851 | };
|
36852 | }
|
36853 | });
|
36854 | var require_embed5 = __commonJS2({
|
36855 | "src/language-yaml/embed.js"(exports2, module2) {
|
36856 | "use strict";
|
36857 | function embed(path, print, textToDoc, options) {
|
36858 | const node = path.getValue();
|
36859 | if (node.type === "root" && options.filepath && /(?:[/\\]|^)\.(?:prettier|stylelint|lintstaged)rc$/.test(options.filepath)) {
|
36860 | return textToDoc(options.originalText, Object.assign(Object.assign({}, options), {}, {
|
36861 | parser: "json"
|
36862 | }));
|
36863 | }
|
36864 | }
|
36865 | module2.exports = embed;
|
36866 | }
|
36867 | });
|
36868 | var require_utils12 = __commonJS2({
|
36869 | "src/language-yaml/utils.js"(exports2, module2) {
|
36870 | "use strict";
|
36871 | var {
|
36872 | getLast,
|
36873 | isNonEmptyArray
|
36874 | } = require_util();
|
36875 | function getAncestorCount(path, filter) {
|
36876 | let counter = 0;
|
36877 | const pathStackLength = path.stack.length - 1;
|
36878 | for (let i = 0; i < pathStackLength; i++) {
|
36879 | const value = path.stack[i];
|
36880 | if (isNode(value) && filter(value)) {
|
36881 | counter++;
|
36882 | }
|
36883 | }
|
36884 | return counter;
|
36885 | }
|
36886 | function isNode(value, types) {
|
36887 | return value && typeof value.type === "string" && (!types || types.includes(value.type));
|
36888 | }
|
36889 | function mapNode(node, callback, parent) {
|
36890 | return callback("children" in node ? Object.assign(Object.assign({}, node), {}, {
|
36891 | children: node.children.map((childNode) => mapNode(childNode, callback, node))
|
36892 | }) : node, parent);
|
36893 | }
|
36894 | function defineShortcut(x, key, getter) {
|
36895 | Object.defineProperty(x, key, {
|
36896 | get: getter,
|
36897 | enumerable: false
|
36898 | });
|
36899 | }
|
36900 | function isNextLineEmpty(node, text) {
|
36901 | let newlineCount = 0;
|
36902 | const textLength = text.length;
|
36903 | for (let i = node.position.end.offset - 1; i < textLength; i++) {
|
36904 | const char = text[i];
|
36905 | if (char === "\n") {
|
36906 | newlineCount++;
|
36907 | }
|
36908 | if (newlineCount === 1 && /\S/.test(char)) {
|
36909 | return false;
|
36910 | }
|
36911 | if (newlineCount === 2) {
|
36912 | return true;
|
36913 | }
|
36914 | }
|
36915 | return false;
|
36916 | }
|
36917 | function isLastDescendantNode(path) {
|
36918 | const node = path.getValue();
|
36919 | switch (node.type) {
|
36920 | case "tag":
|
36921 | case "anchor":
|
36922 | case "comment":
|
36923 | return false;
|
36924 | }
|
36925 | const pathStackLength = path.stack.length;
|
36926 | for (let i = 1; i < pathStackLength; i++) {
|
36927 | const item = path.stack[i];
|
36928 | const parentItem = path.stack[i - 1];
|
36929 | if (Array.isArray(parentItem) && typeof item === "number" && item !== parentItem.length - 1) {
|
36930 | return false;
|
36931 | }
|
36932 | }
|
36933 | return true;
|
36934 | }
|
36935 | function getLastDescendantNode(node) {
|
36936 | return isNonEmptyArray(node.children) ? getLastDescendantNode(getLast(node.children)) : node;
|
36937 | }
|
36938 | function isPrettierIgnore(comment) {
|
36939 | return comment.value.trim() === "prettier-ignore";
|
36940 | }
|
36941 | function hasPrettierIgnore(path) {
|
36942 | const node = path.getValue();
|
36943 | if (node.type === "documentBody") {
|
36944 | const document = path.getParentNode();
|
36945 | return hasEndComments(document.head) && isPrettierIgnore(getLast(document.head.endComments));
|
36946 | }
|
36947 | return hasLeadingComments(node) && isPrettierIgnore(getLast(node.leadingComments));
|
36948 | }
|
36949 | function isEmptyNode(node) {
|
36950 | return !isNonEmptyArray(node.children) && !hasComments(node);
|
36951 | }
|
36952 | function hasComments(node) {
|
36953 | return hasLeadingComments(node) || hasMiddleComments(node) || hasIndicatorComment(node) || hasTrailingComment(node) || hasEndComments(node);
|
36954 | }
|
36955 | function hasLeadingComments(node) {
|
36956 | return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.leadingComments);
|
36957 | }
|
36958 | function hasMiddleComments(node) {
|
36959 | return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.middleComments);
|
36960 | }
|
36961 | function hasIndicatorComment(node) {
|
36962 | return node === null || node === void 0 ? void 0 : node.indicatorComment;
|
36963 | }
|
36964 | function hasTrailingComment(node) {
|
36965 | return node === null || node === void 0 ? void 0 : node.trailingComment;
|
36966 | }
|
36967 | function hasEndComments(node) {
|
36968 | return isNonEmptyArray(node === null || node === void 0 ? void 0 : node.endComments);
|
36969 | }
|
36970 | function splitWithSingleSpace(text) {
|
36971 | const parts = [];
|
36972 | let lastPart;
|
36973 | for (const part of text.split(/( +)/)) {
|
36974 | if (part !== " ") {
|
36975 | if (lastPart === " ") {
|
36976 | parts.push(part);
|
36977 | } else {
|
36978 | parts.push((parts.pop() || "") + part);
|
36979 | }
|
36980 | } else if (lastPart === void 0) {
|
36981 | parts.unshift("");
|
36982 | }
|
36983 | lastPart = part;
|
36984 | }
|
36985 | if (lastPart === " ") {
|
36986 | parts.push((parts.pop() || "") + " ");
|
36987 | }
|
36988 | if (parts[0] === "") {
|
36989 | parts.shift();
|
36990 | parts.unshift(" " + (parts.shift() || ""));
|
36991 | }
|
36992 | return parts;
|
36993 | }
|
36994 | function getFlowScalarLineContents(nodeType, content, options) {
|
36995 | const rawLineContents = content.split("\n").map((lineContent, index, lineContents) => index === 0 && index === lineContents.length - 1 ? lineContent : index !== 0 && index !== lineContents.length - 1 ? lineContent.trim() : index === 0 ? lineContent.trimEnd() : lineContent.trimStart());
|
36996 | if (options.proseWrap === "preserve") {
|
36997 | return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]);
|
36998 | }
|
36999 | return rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !(nodeType === "quoteDouble" && getLast(getLast(reduced)).endsWith("\\")) ? [...reduced.slice(0, -1), [...getLast(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map((lineContentWords) => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords);
|
37000 | }
|
37001 | function getBlockValueLineContents(node, {
|
37002 | parentIndent,
|
37003 | isLastDescendant,
|
37004 | options
|
37005 | }) {
|
37006 | const content = node.position.start.line === node.position.end.line ? "" : options.originalText.slice(node.position.start.offset, node.position.end.offset).match(/^[^\n]*\n(.*)$/s)[1];
|
37007 | let leadingSpaceCount;
|
37008 | if (node.indent === null) {
|
37009 | const matches = content.match(/^(?<leadingSpace> *)[^\n\r ]/m);
|
37010 | leadingSpaceCount = matches ? matches.groups.leadingSpace.length : Number.POSITIVE_INFINITY;
|
37011 | } else {
|
37012 | leadingSpaceCount = node.indent - 1 + parentIndent;
|
37013 | }
|
37014 | const rawLineContents = content.split("\n").map((lineContent) => lineContent.slice(leadingSpaceCount));
|
37015 | if (options.proseWrap === "preserve" || node.type === "blockLiteral") {
|
37016 | return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : [lineContent]));
|
37017 | }
|
37018 | return removeUnnecessaryTrailingNewlines(rawLineContents.map((lineContent) => lineContent.length === 0 ? [] : splitWithSingleSpace(lineContent)).reduce((reduced, lineContentWords, index) => index !== 0 && rawLineContents[index - 1].length > 0 && lineContentWords.length > 0 && !/^\s/.test(lineContentWords[0]) && !/^\s|\s$/.test(getLast(reduced)) ? [...reduced.slice(0, -1), [...getLast(reduced), ...lineContentWords]] : [...reduced, lineContentWords], []).map((lineContentWords) => lineContentWords.reduce((reduced, word) => reduced.length > 0 && /\s$/.test(getLast(reduced)) ? [...reduced.slice(0, -1), getLast(reduced) + " " + word] : [...reduced, word], [])).map((lineContentWords) => options.proseWrap === "never" ? [lineContentWords.join(" ")] : lineContentWords));
|
37019 | function removeUnnecessaryTrailingNewlines(lineContents) {
|
37020 | if (node.chomping === "keep") {
|
37021 | return getLast(lineContents).length === 0 ? lineContents.slice(0, -1) : lineContents;
|
37022 | }
|
37023 | let trailingNewlineCount = 0;
|
37024 | for (let i = lineContents.length - 1; i >= 0; i--) {
|
37025 | if (lineContents[i].length === 0) {
|
37026 | trailingNewlineCount++;
|
37027 | } else {
|
37028 | break;
|
37029 | }
|
37030 | }
|
37031 | return trailingNewlineCount === 0 ? lineContents : trailingNewlineCount >= 2 && !isLastDescendant ? lineContents.slice(0, -(trailingNewlineCount - 1)) : lineContents.slice(0, -trailingNewlineCount);
|
37032 | }
|
37033 | }
|
37034 | function isInlineNode(node) {
|
37035 | if (!node) {
|
37036 | return true;
|
37037 | }
|
37038 | switch (node.type) {
|
37039 | case "plain":
|
37040 | case "quoteDouble":
|
37041 | case "quoteSingle":
|
37042 | case "alias":
|
37043 | case "flowMapping":
|
37044 | case "flowSequence":
|
37045 | return true;
|
37046 | default:
|
37047 | return false;
|
37048 | }
|
37049 | }
|
37050 | module2.exports = {
|
37051 | getLast,
|
37052 | getAncestorCount,
|
37053 | isNode,
|
37054 | isEmptyNode,
|
37055 | isInlineNode,
|
37056 | mapNode,
|
37057 | defineShortcut,
|
37058 | isNextLineEmpty,
|
37059 | isLastDescendantNode,
|
37060 | getBlockValueLineContents,
|
37061 | getFlowScalarLineContents,
|
37062 | getLastDescendantNode,
|
37063 | hasPrettierIgnore,
|
37064 | hasLeadingComments,
|
37065 | hasMiddleComments,
|
37066 | hasIndicatorComment,
|
37067 | hasTrailingComment,
|
37068 | hasEndComments
|
37069 | };
|
37070 | }
|
37071 | });
|
37072 | var require_print_preprocess4 = __commonJS2({
|
37073 | "src/language-yaml/print-preprocess.js"(exports2, module2) {
|
37074 | "use strict";
|
37075 | var {
|
37076 | defineShortcut,
|
37077 | mapNode
|
37078 | } = require_utils12();
|
37079 | function preprocess(ast) {
|
37080 | return mapNode(ast, defineShortcuts);
|
37081 | }
|
37082 | function defineShortcuts(node) {
|
37083 | switch (node.type) {
|
37084 | case "document":
|
37085 | defineShortcut(node, "head", () => node.children[0]);
|
37086 | defineShortcut(node, "body", () => node.children[1]);
|
37087 | break;
|
37088 | case "documentBody":
|
37089 | case "sequenceItem":
|
37090 | case "flowSequenceItem":
|
37091 | case "mappingKey":
|
37092 | case "mappingValue":
|
37093 | defineShortcut(node, "content", () => node.children[0]);
|
37094 | break;
|
37095 | case "mappingItem":
|
37096 | case "flowMappingItem":
|
37097 | defineShortcut(node, "key", () => node.children[0]);
|
37098 | defineShortcut(node, "value", () => node.children[1]);
|
37099 | break;
|
37100 | }
|
37101 | return node;
|
37102 | }
|
37103 | module2.exports = preprocess;
|
37104 | }
|
37105 | });
|
37106 | var require_misc2 = __commonJS2({
|
37107 | "src/language-yaml/print/misc.js"(exports2, module2) {
|
37108 | "use strict";
|
37109 | var {
|
37110 | builders: {
|
37111 | softline,
|
37112 | align
|
37113 | }
|
37114 | } = require("./doc.js");
|
37115 | var {
|
37116 | hasEndComments,
|
37117 | isNextLineEmpty,
|
37118 | isNode
|
37119 | } = require_utils12();
|
37120 | var printedEmptyLineCache = new WeakMap();
|
37121 | function printNextEmptyLine(path, originalText) {
|
37122 | const node = path.getValue();
|
37123 | const root = path.stack[0];
|
37124 | let isNextEmptyLinePrintedSet;
|
37125 | if (printedEmptyLineCache.has(root)) {
|
37126 | isNextEmptyLinePrintedSet = printedEmptyLineCache.get(root);
|
37127 | } else {
|
37128 | isNextEmptyLinePrintedSet = new Set();
|
37129 | printedEmptyLineCache.set(root, isNextEmptyLinePrintedSet);
|
37130 | }
|
37131 | if (!isNextEmptyLinePrintedSet.has(node.position.end.line)) {
|
37132 | isNextEmptyLinePrintedSet.add(node.position.end.line);
|
37133 | if (isNextLineEmpty(node, originalText) && !shouldPrintEndComments(path.getParentNode())) {
|
37134 | return softline;
|
37135 | }
|
37136 | }
|
37137 | return "";
|
37138 | }
|
37139 | function shouldPrintEndComments(node) {
|
37140 | return hasEndComments(node) && !isNode(node, ["documentHead", "documentBody", "flowMapping", "flowSequence"]);
|
37141 | }
|
37142 | function alignWithSpaces(width, doc2) {
|
37143 | return align(" ".repeat(width), doc2);
|
37144 | }
|
37145 | module2.exports = {
|
37146 | alignWithSpaces,
|
37147 | shouldPrintEndComments,
|
37148 | printNextEmptyLine
|
37149 | };
|
37150 | }
|
37151 | });
|
37152 | var require_flow_mapping_sequence = __commonJS2({
|
37153 | "src/language-yaml/print/flow-mapping-sequence.js"(exports2, module2) {
|
37154 | "use strict";
|
37155 | var {
|
37156 | builders: {
|
37157 | ifBreak,
|
37158 | line,
|
37159 | softline,
|
37160 | hardline,
|
37161 | join
|
37162 | }
|
37163 | } = require("./doc.js");
|
37164 | var {
|
37165 | isEmptyNode,
|
37166 | getLast,
|
37167 | hasEndComments
|
37168 | } = require_utils12();
|
37169 | var {
|
37170 | printNextEmptyLine,
|
37171 | alignWithSpaces
|
37172 | } = require_misc2();
|
37173 | function printFlowMapping(path, print, options) {
|
37174 | const node = path.getValue();
|
37175 | const isMapping = node.type === "flowMapping";
|
37176 | const openMarker = isMapping ? "{" : "[";
|
37177 | const closeMarker = isMapping ? "}" : "]";
|
37178 | let bracketSpacing = softline;
|
37179 | if (isMapping && node.children.length > 0 && options.bracketSpacing) {
|
37180 | bracketSpacing = line;
|
37181 | }
|
37182 | const lastItem = getLast(node.children);
|
37183 | const isLastItemEmptyMappingItem = lastItem && lastItem.type === "flowMappingItem" && isEmptyNode(lastItem.key) && isEmptyNode(lastItem.value);
|
37184 | return [openMarker, alignWithSpaces(options.tabWidth, [bracketSpacing, printChildren(path, print, options), options.trailingComma === "none" ? "" : ifBreak(","), hasEndComments(node) ? [hardline, join(hardline, path.map(print, "endComments"))] : ""]), isLastItemEmptyMappingItem ? "" : bracketSpacing, closeMarker];
|
37185 | }
|
37186 | function printChildren(path, print, options) {
|
37187 | const node = path.getValue();
|
37188 | const parts = path.map((childPath, index) => [print(), index === node.children.length - 1 ? "" : [",", line, node.children[index].position.start.line !== node.children[index + 1].position.start.line ? printNextEmptyLine(childPath, options.originalText) : ""]], "children");
|
37189 | return parts;
|
37190 | }
|
37191 | module2.exports = {
|
37192 | printFlowMapping,
|
37193 | printFlowSequence: printFlowMapping
|
37194 | };
|
37195 | }
|
37196 | });
|
37197 | var require_mapping_item = __commonJS2({
|
37198 | "src/language-yaml/print/mapping-item.js"(exports2, module2) {
|
37199 | "use strict";
|
37200 | var {
|
37201 | builders: {
|
37202 | conditionalGroup,
|
37203 | group,
|
37204 | hardline,
|
37205 | ifBreak,
|
37206 | join,
|
37207 | line
|
37208 | }
|
37209 | } = require("./doc.js");
|
37210 | var {
|
37211 | hasLeadingComments,
|
37212 | hasMiddleComments,
|
37213 | hasTrailingComment,
|
37214 | hasEndComments,
|
37215 | isNode,
|
37216 | isEmptyNode,
|
37217 | isInlineNode
|
37218 | } = require_utils12();
|
37219 | var {
|
37220 | alignWithSpaces
|
37221 | } = require_misc2();
|
37222 | function printMappingItem(node, parentNode, path, print, options) {
|
37223 | const {
|
37224 | key,
|
37225 | value
|
37226 | } = node;
|
37227 | const isEmptyMappingKey = isEmptyNode(key);
|
37228 | const isEmptyMappingValue = isEmptyNode(value);
|
37229 | if (isEmptyMappingKey && isEmptyMappingValue) {
|
37230 | return ": ";
|
37231 | }
|
37232 | const printedKey = print("key");
|
37233 | const spaceBeforeColon = needsSpaceInFrontOfMappingValue(node) ? " " : "";
|
37234 | if (isEmptyMappingValue) {
|
37235 | if (node.type === "flowMappingItem" && parentNode.type === "flowMapping") {
|
37236 | return printedKey;
|
37237 | }
|
37238 | if (node.type === "mappingItem" && isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasTrailingComment(key.content) && (!parentNode.tag || parentNode.tag.value !== "tag:yaml.org,2002:set")) {
|
37239 | return [printedKey, spaceBeforeColon, ":"];
|
37240 | }
|
37241 | return ["? ", alignWithSpaces(2, printedKey)];
|
37242 | }
|
37243 | const printedValue = print("value");
|
37244 | if (isEmptyMappingKey) {
|
37245 | return [": ", alignWithSpaces(2, printedValue)];
|
37246 | }
|
37247 | if (hasLeadingComments(value) || !isInlineNode(key.content)) {
|
37248 | return ["? ", alignWithSpaces(2, printedKey), hardline, join("", path.map(print, "value", "leadingComments").map((comment) => [comment, hardline])), ": ", alignWithSpaces(2, printedValue)];
|
37249 | }
|
37250 | if (isSingleLineNode(key.content) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasTrailingComment(key.content) && !hasEndComments(key) && !hasLeadingComments(value.content) && !hasMiddleComments(value.content) && !hasEndComments(value) && isAbsolutelyPrintedAsSingleLineNode(value.content, options)) {
|
37251 | return [printedKey, spaceBeforeColon, ": ", printedValue];
|
37252 | }
|
37253 | const groupId = Symbol("mappingKey");
|
37254 | const groupedKey = group([ifBreak("? "), group(alignWithSpaces(2, printedKey), {
|
37255 | id: groupId
|
37256 | })]);
|
37257 | const explicitMappingValue = [hardline, ": ", alignWithSpaces(2, printedValue)];
|
37258 | const implicitMappingValueParts = [spaceBeforeColon, ":"];
|
37259 | if (hasLeadingComments(value.content) || hasEndComments(value) && value.content && !isNode(value.content, ["mapping", "sequence"]) || parentNode.type === "mapping" && hasTrailingComment(key.content) && isInlineNode(value.content) || isNode(value.content, ["mapping", "sequence"]) && value.content.tag === null && value.content.anchor === null) {
|
37260 | implicitMappingValueParts.push(hardline);
|
37261 | } else if (value.content) {
|
37262 | implicitMappingValueParts.push(line);
|
37263 | }
|
37264 | implicitMappingValueParts.push(printedValue);
|
37265 | const implicitMappingValue = alignWithSpaces(options.tabWidth, implicitMappingValueParts);
|
37266 | if (isAbsolutelyPrintedAsSingleLineNode(key.content, options) && !hasLeadingComments(key.content) && !hasMiddleComments(key.content) && !hasEndComments(key)) {
|
37267 | return conditionalGroup([[printedKey, implicitMappingValue]]);
|
37268 | }
|
37269 | return conditionalGroup([[groupedKey, ifBreak(explicitMappingValue, implicitMappingValue, {
|
37270 | groupId
|
37271 | })]]);
|
37272 | }
|
37273 | function isAbsolutelyPrintedAsSingleLineNode(node, options) {
|
37274 | if (!node) {
|
37275 | return true;
|
37276 | }
|
37277 | switch (node.type) {
|
37278 | case "plain":
|
37279 | case "quoteSingle":
|
37280 | case "quoteDouble":
|
37281 | break;
|
37282 | case "alias":
|
37283 | return true;
|
37284 | default:
|
37285 | return false;
|
37286 | }
|
37287 | if (options.proseWrap === "preserve") {
|
37288 | return node.position.start.line === node.position.end.line;
|
37289 | }
|
37290 | if (/\\$/m.test(options.originalText.slice(node.position.start.offset, node.position.end.offset))) {
|
37291 | return false;
|
37292 | }
|
37293 | switch (options.proseWrap) {
|
37294 | case "never":
|
37295 | return !node.value.includes("\n");
|
37296 | case "always":
|
37297 | return !/[\n ]/.test(node.value);
|
37298 | default:
|
37299 | return false;
|
37300 | }
|
37301 | }
|
37302 | function needsSpaceInFrontOfMappingValue(node) {
|
37303 | return node.key.content && node.key.content.type === "alias";
|
37304 | }
|
37305 | function isSingleLineNode(node) {
|
37306 | if (!node) {
|
37307 | return true;
|
37308 | }
|
37309 | switch (node.type) {
|
37310 | case "plain":
|
37311 | case "quoteDouble":
|
37312 | case "quoteSingle":
|
37313 | return node.position.start.line === node.position.end.line;
|
37314 | case "alias":
|
37315 | return true;
|
37316 | default:
|
37317 | return false;
|
37318 | }
|
37319 | }
|
37320 | module2.exports = printMappingItem;
|
37321 | }
|
37322 | });
|
37323 | var require_block2 = __commonJS2({
|
37324 | "src/language-yaml/print/block.js"(exports2, module2) {
|
37325 | "use strict";
|
37326 | var {
|
37327 | builders: {
|
37328 | dedent,
|
37329 | dedentToRoot,
|
37330 | fill,
|
37331 | hardline,
|
37332 | join,
|
37333 | line,
|
37334 | literalline,
|
37335 | markAsRoot
|
37336 | },
|
37337 | utils: {
|
37338 | getDocParts
|
37339 | }
|
37340 | } = require("./doc.js");
|
37341 | var {
|
37342 | getAncestorCount,
|
37343 | getBlockValueLineContents,
|
37344 | hasIndicatorComment,
|
37345 | isLastDescendantNode,
|
37346 | isNode
|
37347 | } = require_utils12();
|
37348 | var {
|
37349 | alignWithSpaces
|
37350 | } = require_misc2();
|
37351 | function printBlock(path, print, options) {
|
37352 | const node = path.getValue();
|
37353 | const parentIndent = getAncestorCount(path, (ancestorNode) => isNode(ancestorNode, ["sequence", "mapping"]));
|
37354 | const isLastDescendant = isLastDescendantNode(path);
|
37355 | const parts = [node.type === "blockFolded" ? ">" : "|"];
|
37356 | if (node.indent !== null) {
|
37357 | parts.push(node.indent.toString());
|
37358 | }
|
37359 | if (node.chomping !== "clip") {
|
37360 | parts.push(node.chomping === "keep" ? "+" : "-");
|
37361 | }
|
37362 | if (hasIndicatorComment(node)) {
|
37363 | parts.push(" ", print("indicatorComment"));
|
37364 | }
|
37365 | const lineContents = getBlockValueLineContents(node, {
|
37366 | parentIndent,
|
37367 | isLastDescendant,
|
37368 | options
|
37369 | });
|
37370 | const contentsParts = [];
|
37371 | for (const [index, lineWords] of lineContents.entries()) {
|
37372 | if (index === 0) {
|
37373 | contentsParts.push(hardline);
|
37374 | }
|
37375 | contentsParts.push(fill(getDocParts(join(line, lineWords))));
|
37376 | if (index !== lineContents.length - 1) {
|
37377 | contentsParts.push(lineWords.length === 0 ? hardline : markAsRoot(literalline));
|
37378 | } else if (node.chomping === "keep" && isLastDescendant) {
|
37379 | contentsParts.push(dedentToRoot(lineWords.length === 0 ? hardline : literalline));
|
37380 | }
|
37381 | }
|
37382 | if (node.indent === null) {
|
37383 | parts.push(dedent(alignWithSpaces(options.tabWidth, contentsParts)));
|
37384 | } else {
|
37385 | parts.push(dedentToRoot(alignWithSpaces(node.indent - 1 + parentIndent, contentsParts)));
|
37386 | }
|
37387 | return parts;
|
37388 | }
|
37389 | module2.exports = printBlock;
|
37390 | }
|
37391 | });
|
37392 | var require_printer_yaml = __commonJS2({
|
37393 | "src/language-yaml/printer-yaml.js"(exports2, module2) {
|
37394 | "use strict";
|
37395 | var {
|
37396 | builders: {
|
37397 | breakParent,
|
37398 | fill,
|
37399 | group,
|
37400 | hardline,
|
37401 | join,
|
37402 | line,
|
37403 | lineSuffix,
|
37404 | literalline
|
37405 | },
|
37406 | utils: {
|
37407 | getDocParts,
|
37408 | replaceTextEndOfLine
|
37409 | }
|
37410 | } = require("./doc.js");
|
37411 | var {
|
37412 | isPreviousLineEmpty
|
37413 | } = require_util();
|
37414 | var {
|
37415 | insertPragma,
|
37416 | isPragma
|
37417 | } = require_pragma6();
|
37418 | var {
|
37419 | locStart
|
37420 | } = require_loc7();
|
37421 | var embed = require_embed5();
|
37422 | var {
|
37423 | getFlowScalarLineContents,
|
37424 | getLastDescendantNode,
|
37425 | hasLeadingComments,
|
37426 | hasMiddleComments,
|
37427 | hasTrailingComment,
|
37428 | hasEndComments,
|
37429 | hasPrettierIgnore,
|
37430 | isLastDescendantNode,
|
37431 | isNode,
|
37432 | isInlineNode
|
37433 | } = require_utils12();
|
37434 | var preprocess = require_print_preprocess4();
|
37435 | var {
|
37436 | alignWithSpaces,
|
37437 | printNextEmptyLine,
|
37438 | shouldPrintEndComments
|
37439 | } = require_misc2();
|
37440 | var {
|
37441 | printFlowMapping,
|
37442 | printFlowSequence
|
37443 | } = require_flow_mapping_sequence();
|
37444 | var printMappingItem = require_mapping_item();
|
37445 | var printBlock = require_block2();
|
37446 | function genericPrint(path, options, print) {
|
37447 | const node = path.getValue();
|
37448 | const parts = [];
|
37449 | if (node.type !== "mappingValue" && hasLeadingComments(node)) {
|
37450 | parts.push([join(hardline, path.map(print, "leadingComments")), hardline]);
|
37451 | }
|
37452 | const {
|
37453 | tag,
|
37454 | anchor
|
37455 | } = node;
|
37456 | if (tag) {
|
37457 | parts.push(print("tag"));
|
37458 | }
|
37459 | if (tag && anchor) {
|
37460 | parts.push(" ");
|
37461 | }
|
37462 | if (anchor) {
|
37463 | parts.push(print("anchor"));
|
37464 | }
|
37465 | let nextEmptyLine = "";
|
37466 | if (isNode(node, ["mapping", "sequence", "comment", "directive", "mappingItem", "sequenceItem"]) && !isLastDescendantNode(path)) {
|
37467 | nextEmptyLine = printNextEmptyLine(path, options.originalText);
|
37468 | }
|
37469 | if (tag || anchor) {
|
37470 | if (isNode(node, ["sequence", "mapping"]) && !hasMiddleComments(node)) {
|
37471 | parts.push(hardline);
|
37472 | } else {
|
37473 | parts.push(" ");
|
37474 | }
|
37475 | }
|
37476 | if (hasMiddleComments(node)) {
|
37477 | parts.push([node.middleComments.length === 1 ? "" : hardline, join(hardline, path.map(print, "middleComments")), hardline]);
|
37478 | }
|
37479 | const parentNode = path.getParentNode();
|
37480 | if (hasPrettierIgnore(path)) {
|
37481 | parts.push(replaceTextEndOfLine(options.originalText.slice(node.position.start.offset, node.position.end.offset).trimEnd(), literalline));
|
37482 | } else {
|
37483 | parts.push(group(printNode(node, parentNode, path, options, print)));
|
37484 | }
|
37485 | if (hasTrailingComment(node) && !isNode(node, ["document", "documentHead"])) {
|
37486 | parts.push(lineSuffix([node.type === "mappingValue" && !node.content ? "" : " ", parentNode.type === "mappingKey" && path.getParentNode(2).type === "mapping" && isInlineNode(node) ? "" : breakParent, print("trailingComment")]));
|
37487 | }
|
37488 | if (shouldPrintEndComments(node)) {
|
37489 | parts.push(alignWithSpaces(node.type === "sequenceItem" ? 2 : 0, [hardline, join(hardline, path.map((path2) => [isPreviousLineEmpty(options.originalText, path2.getValue(), locStart) ? hardline : "", print()], "endComments"))]));
|
37490 | }
|
37491 | parts.push(nextEmptyLine);
|
37492 | return parts;
|
37493 | }
|
37494 | function printNode(node, parentNode, path, options, print) {
|
37495 | switch (node.type) {
|
37496 | case "root": {
|
37497 | const {
|
37498 | children
|
37499 | } = node;
|
37500 | const parts = [];
|
37501 | path.each((childPath, index) => {
|
37502 | const document = children[index];
|
37503 | const nextDocument = children[index + 1];
|
37504 | if (index !== 0) {
|
37505 | parts.push(hardline);
|
37506 | }
|
37507 | parts.push(print());
|
37508 | if (shouldPrintDocumentEndMarker(document, nextDocument)) {
|
37509 | parts.push(hardline, "...");
|
37510 | if (hasTrailingComment(document)) {
|
37511 | parts.push(" ", print("trailingComment"));
|
37512 | }
|
37513 | } else if (nextDocument && !hasTrailingComment(nextDocument.head)) {
|
37514 | parts.push(hardline, "---");
|
37515 | }
|
37516 | }, "children");
|
37517 | const lastDescendantNode = getLastDescendantNode(node);
|
37518 | if (!isNode(lastDescendantNode, ["blockLiteral", "blockFolded"]) || lastDescendantNode.chomping !== "keep") {
|
37519 | parts.push(hardline);
|
37520 | }
|
37521 | return parts;
|
37522 | }
|
37523 | case "document": {
|
37524 | const nextDocument = parentNode.children[path.getName() + 1];
|
37525 | const parts = [];
|
37526 | if (shouldPrintDocumentHeadEndMarker(node, nextDocument, parentNode, options) === "head") {
|
37527 | if (node.head.children.length > 0 || node.head.endComments.length > 0) {
|
37528 | parts.push(print("head"));
|
37529 | }
|
37530 | if (hasTrailingComment(node.head)) {
|
37531 | parts.push(["---", " ", print(["head", "trailingComment"])]);
|
37532 | } else {
|
37533 | parts.push("---");
|
37534 | }
|
37535 | }
|
37536 | if (shouldPrintDocumentBody(node)) {
|
37537 | parts.push(print("body"));
|
37538 | }
|
37539 | return join(hardline, parts);
|
37540 | }
|
37541 | case "documentHead":
|
37542 | return join(hardline, [...path.map(print, "children"), ...path.map(print, "endComments")]);
|
37543 | case "documentBody": {
|
37544 | const {
|
37545 | children,
|
37546 | endComments
|
37547 | } = node;
|
37548 | let separator = "";
|
37549 | if (children.length > 0 && endComments.length > 0) {
|
37550 | const lastDescendantNode = getLastDescendantNode(node);
|
37551 | if (isNode(lastDescendantNode, ["blockFolded", "blockLiteral"])) {
|
37552 | if (lastDescendantNode.chomping !== "keep") {
|
37553 | separator = [hardline, hardline];
|
37554 | }
|
37555 | } else {
|
37556 | separator = hardline;
|
37557 | }
|
37558 | }
|
37559 | return [join(hardline, path.map(print, "children")), separator, join(hardline, path.map(print, "endComments"))];
|
37560 | }
|
37561 | case "directive":
|
37562 | return ["%", join(" ", [node.name, ...node.parameters])];
|
37563 | case "comment":
|
37564 | return ["#", node.value];
|
37565 | case "alias":
|
37566 | return ["*", node.value];
|
37567 | case "tag":
|
37568 | return options.originalText.slice(node.position.start.offset, node.position.end.offset);
|
37569 | case "anchor":
|
37570 | return ["&", node.value];
|
37571 | case "plain":
|
37572 | return printFlowScalarContent(node.type, options.originalText.slice(node.position.start.offset, node.position.end.offset), options);
|
37573 | case "quoteDouble":
|
37574 | case "quoteSingle": {
|
37575 | const singleQuote = "'";
|
37576 | const doubleQuote = '"';
|
37577 | const raw = options.originalText.slice(node.position.start.offset + 1, node.position.end.offset - 1);
|
37578 | if (node.type === "quoteSingle" && raw.includes("\\") || node.type === "quoteDouble" && /\\[^"]/.test(raw)) {
|
37579 | const originalQuote = node.type === "quoteDouble" ? doubleQuote : singleQuote;
|
37580 | return [originalQuote, printFlowScalarContent(node.type, raw, options), originalQuote];
|
37581 | }
|
37582 | if (raw.includes(doubleQuote)) {
|
37583 | return [singleQuote, printFlowScalarContent(node.type, node.type === "quoteDouble" ? raw.replace(/\\"/g, doubleQuote).replace(/'/g, singleQuote.repeat(2)) : raw, options), singleQuote];
|
37584 | }
|
37585 | if (raw.includes(singleQuote)) {
|
37586 | return [doubleQuote, printFlowScalarContent(node.type, node.type === "quoteSingle" ? raw.replace(/''/g, singleQuote) : raw, options), doubleQuote];
|
37587 | }
|
37588 | const quote = options.singleQuote ? singleQuote : doubleQuote;
|
37589 | return [quote, printFlowScalarContent(node.type, raw, options), quote];
|
37590 | }
|
37591 | case "blockFolded":
|
37592 | case "blockLiteral": {
|
37593 | return printBlock(path, print, options);
|
37594 | }
|
37595 | case "mapping":
|
37596 | case "sequence":
|
37597 | return join(hardline, path.map(print, "children"));
|
37598 | case "sequenceItem":
|
37599 | return ["- ", alignWithSpaces(2, node.content ? print("content") : "")];
|
37600 | case "mappingKey":
|
37601 | case "mappingValue":
|
37602 | return !node.content ? "" : print("content");
|
37603 | case "mappingItem":
|
37604 | case "flowMappingItem": {
|
37605 | return printMappingItem(node, parentNode, path, print, options);
|
37606 | }
|
37607 | case "flowMapping":
|
37608 | return printFlowMapping(path, print, options);
|
37609 | case "flowSequence":
|
37610 | return printFlowSequence(path, print, options);
|
37611 | case "flowSequenceItem":
|
37612 | return print("content");
|
37613 | default:
|
37614 | throw new Error(`Unexpected node type ${node.type}`);
|
37615 | }
|
37616 | }
|
37617 | function shouldPrintDocumentBody(document) {
|
37618 | return document.body.children.length > 0 || hasEndComments(document.body);
|
37619 | }
|
37620 | function shouldPrintDocumentEndMarker(document, nextDocument) {
|
37621 | return hasTrailingComment(document) || nextDocument && (nextDocument.head.children.length > 0 || hasEndComments(nextDocument.head));
|
37622 | }
|
37623 | function shouldPrintDocumentHeadEndMarker(document, nextDocument, root, options) {
|
37624 | if (root.children[0] === document && /---(?:\s|$)/.test(options.originalText.slice(locStart(document), locStart(document) + 4)) || document.head.children.length > 0 || hasEndComments(document.head) || hasTrailingComment(document.head)) {
|
37625 | return "head";
|
37626 | }
|
37627 | if (shouldPrintDocumentEndMarker(document, nextDocument)) {
|
37628 | return false;
|
37629 | }
|
37630 | return nextDocument ? "root" : false;
|
37631 | }
|
37632 | function printFlowScalarContent(nodeType, content, options) {
|
37633 | const lineContents = getFlowScalarLineContents(nodeType, content, options);
|
37634 | return join(hardline, lineContents.map((lineContentWords) => fill(getDocParts(join(line, lineContentWords)))));
|
37635 | }
|
37636 | function clean(node, newNode) {
|
37637 | if (isNode(newNode)) {
|
37638 | delete newNode.position;
|
37639 | switch (newNode.type) {
|
37640 | case "comment":
|
37641 | if (isPragma(newNode.value)) {
|
37642 | return null;
|
37643 | }
|
37644 | break;
|
37645 | case "quoteDouble":
|
37646 | case "quoteSingle":
|
37647 | newNode.type = "quote";
|
37648 | break;
|
37649 | }
|
37650 | }
|
37651 | }
|
37652 | module2.exports = {
|
37653 | preprocess,
|
37654 | embed,
|
37655 | print: genericPrint,
|
37656 | massageAstNode: clean,
|
37657 | insertPragma
|
37658 | };
|
37659 | }
|
37660 | });
|
37661 | var require_options7 = __commonJS2({
|
37662 | "src/language-yaml/options.js"(exports2, module2) {
|
37663 | "use strict";
|
37664 | var commonOptions = require_common_options();
|
37665 | module2.exports = {
|
37666 | bracketSpacing: commonOptions.bracketSpacing,
|
37667 | singleQuote: commonOptions.singleQuote,
|
37668 | proseWrap: commonOptions.proseWrap
|
37669 | };
|
37670 | }
|
37671 | });
|
37672 | var require_parsers7 = __commonJS2({
|
37673 | "src/language-yaml/parsers.js"(exports2, module2) {
|
37674 | "use strict";
|
37675 | module2.exports = {
|
37676 | get yaml() {
|
37677 | return require("./parser-yaml.js").parsers.yaml;
|
37678 | }
|
37679 | };
|
37680 | }
|
37681 | });
|
37682 | var require_YAML = __commonJS2({
|
37683 | "node_modules/linguist-languages/data/YAML.json"(exports2, module2) {
|
37684 | module2.exports = {
|
37685 | name: "YAML",
|
37686 | type: "data",
|
37687 | color: "#cb171e",
|
37688 | tmScope: "source.yaml",
|
37689 | aliases: ["yml"],
|
37690 | extensions: [".yml", ".mir", ".reek", ".rviz", ".sublime-syntax", ".syntax", ".yaml", ".yaml-tmlanguage", ".yaml.sed", ".yml.mysql"],
|
37691 | filenames: [".clang-format", ".clang-tidy", ".gemrc", "CITATION.cff", "glide.lock", "yarn.lock"],
|
37692 | aceMode: "yaml",
|
37693 | codemirrorMode: "yaml",
|
37694 | codemirrorMimeType: "text/x-yaml",
|
37695 | languageId: 407
|
37696 | };
|
37697 | }
|
37698 | });
|
37699 | var require_language_yaml = __commonJS2({
|
37700 | "src/language-yaml/index.js"(exports2, module2) {
|
37701 | "use strict";
|
37702 | var createLanguage = require_create_language();
|
37703 | var printer = require_printer_yaml();
|
37704 | var options = require_options7();
|
37705 | var parsers = require_parsers7();
|
37706 | var languages = [createLanguage(require_YAML(), (data) => ({
|
37707 | since: "1.14.0",
|
37708 | parsers: ["yaml"],
|
37709 | vscodeLanguageIds: ["yaml", "ansible", "home-assistant"],
|
37710 | filenames: [...data.filenames.filter((filename) => filename !== "yarn.lock"), ".prettierrc", ".stylelintrc", ".lintstagedrc"]
|
37711 | }))];
|
37712 | module2.exports = {
|
37713 | languages,
|
37714 | printers: {
|
37715 | yaml: printer
|
37716 | },
|
37717 | options,
|
37718 | parsers
|
37719 | };
|
37720 | }
|
37721 | });
|
37722 | var require_languages = __commonJS2({
|
37723 | "src/languages.js"(exports2, module2) {
|
37724 | "use strict";
|
37725 | module2.exports = [require_language_js(), require_language_css(), require_language_handlebars(), require_language_graphql(), require_language_markdown(), require_language_html(), require_language_yaml()];
|
37726 | }
|
37727 | });
|
37728 | var require_load_plugins = __commonJS2({
|
37729 | "src/common/load-plugins.js"(exports2, module2) {
|
37730 | "use strict";
|
37731 | var fs = require("fs");
|
37732 | var path = require("path");
|
37733 | var fastGlob = require_out4();
|
37734 | var partition = require_partition();
|
37735 | var uniqByKey = require_uniq_by_key();
|
37736 | var internalPlugins = require_languages();
|
37737 | var {
|
37738 | default: mem2,
|
37739 | memClear: memClear2
|
37740 | } = (init_dist(), __toCommonJS(dist_exports));
|
37741 | var thirdParty = require("./third-party.js");
|
37742 | var resolve = require_resolve2();
|
37743 | var memoizedLoad = mem2(load, {
|
37744 | cacheKey: JSON.stringify
|
37745 | });
|
37746 | var memoizedSearch = mem2(findPluginsInNodeModules);
|
37747 | var clearCache = () => {
|
37748 | memClear2(memoizedLoad);
|
37749 | memClear2(memoizedSearch);
|
37750 | };
|
37751 | function load(plugins2, pluginSearchDirs) {
|
37752 | if (!plugins2) {
|
37753 | plugins2 = [];
|
37754 | }
|
37755 | if (pluginSearchDirs === false) {
|
37756 | pluginSearchDirs = [];
|
37757 | } else {
|
37758 | pluginSearchDirs = pluginSearchDirs || [];
|
37759 | if (pluginSearchDirs.length === 0) {
|
37760 | const autoLoadDir = thirdParty.findParentDir(__dirname, "node_modules");
|
37761 | if (autoLoadDir) {
|
37762 | pluginSearchDirs = [autoLoadDir];
|
37763 | }
|
37764 | }
|
37765 | }
|
37766 | const [externalPluginNames, externalPluginInstances] = partition(plugins2, (plugin) => typeof plugin === "string");
|
37767 | const externalManualLoadPluginInfos = externalPluginNames.map((pluginName) => {
|
37768 | let requirePath;
|
37769 | try {
|
37770 | requirePath = resolve(path.resolve(process.cwd(), pluginName));
|
37771 | } catch {
|
37772 | requirePath = resolve(pluginName, {
|
37773 | paths: [process.cwd()]
|
37774 | });
|
37775 | }
|
37776 | return {
|
37777 | name: pluginName,
|
37778 | requirePath
|
37779 | };
|
37780 | });
|
37781 | const externalAutoLoadPluginInfos = pluginSearchDirs.flatMap((pluginSearchDir) => {
|
37782 | const resolvedPluginSearchDir = path.resolve(process.cwd(), pluginSearchDir);
|
37783 | const nodeModulesDir = path.resolve(resolvedPluginSearchDir, "node_modules");
|
37784 | if (!isDirectory(nodeModulesDir) && !isDirectory(resolvedPluginSearchDir)) {
|
37785 | throw new Error(`${pluginSearchDir} does not exist or is not a directory`);
|
37786 | }
|
37787 | return memoizedSearch(nodeModulesDir).map((pluginName) => ({
|
37788 | name: pluginName,
|
37789 | requirePath: resolve(pluginName, {
|
37790 | paths: [resolvedPluginSearchDir]
|
37791 | })
|
37792 | }));
|
37793 | });
|
37794 | const externalPlugins = [...uniqByKey([...externalManualLoadPluginInfos, ...externalAutoLoadPluginInfos], "requirePath").map((externalPluginInfo) => Object.assign({
|
37795 | name: externalPluginInfo.name
|
37796 | }, require(externalPluginInfo.requirePath))), ...externalPluginInstances];
|
37797 | return [...internalPlugins, ...externalPlugins];
|
37798 | }
|
37799 | function findPluginsInNodeModules(nodeModulesDir) {
|
37800 | const pluginPackageJsonPaths = fastGlob.sync(["prettier-plugin-*/package.json", "@*/prettier-plugin-*/package.json", "@prettier/plugin-*/package.json"], {
|
37801 | cwd: nodeModulesDir
|
37802 | });
|
37803 | return pluginPackageJsonPaths.map(path.dirname);
|
37804 | }
|
37805 | function isDirectory(dir) {
|
37806 | try {
|
37807 | return fs.statSync(dir).isDirectory();
|
37808 | } catch {
|
37809 | return false;
|
37810 | }
|
37811 | }
|
37812 | module2.exports = {
|
37813 | loadPlugins: memoizedLoad,
|
37814 | clearCache
|
37815 | };
|
37816 | }
|
37817 | });
|
37818 | var {
|
37819 | version
|
37820 | } = require("./package.json");
|
37821 | var core = require_core();
|
37822 | var {
|
37823 | getSupportInfo
|
37824 | } = require_support();
|
37825 | var getFileInfo = require_get_file_info();
|
37826 | var sharedUtil = require_util_shared();
|
37827 | var plugins = require_load_plugins();
|
37828 | var config = require_resolve_config();
|
37829 | var doc = require("./doc.js");
|
37830 | function _withPlugins(fn, optsArgIdx = 1) {
|
37831 | return (...args) => {
|
37832 | const opts = args[optsArgIdx] || {};
|
37833 | args[optsArgIdx] = Object.assign(Object.assign({}, opts), {}, {
|
37834 | plugins: plugins.loadPlugins(opts.plugins, opts.pluginSearchDirs)
|
37835 | });
|
37836 | return fn(...args);
|
37837 | };
|
37838 | }
|
37839 | function withPlugins(fn, optsArgIdx) {
|
37840 | const resultingFn = _withPlugins(fn, optsArgIdx);
|
37841 | if (fn.sync) {
|
37842 | resultingFn.sync = _withPlugins(fn.sync, optsArgIdx);
|
37843 | }
|
37844 | return resultingFn;
|
37845 | }
|
37846 | var formatWithCursor = withPlugins(core.formatWithCursor);
|
37847 | module.exports = {
|
37848 | formatWithCursor,
|
37849 | format(text, opts) {
|
37850 | return formatWithCursor(text, opts).formatted;
|
37851 | },
|
37852 | check(text, opts) {
|
37853 | const {
|
37854 | formatted
|
37855 | } = formatWithCursor(text, opts);
|
37856 | return formatted === text;
|
37857 | },
|
37858 | doc,
|
37859 | resolveConfig: config.resolveConfig,
|
37860 | resolveConfigFile: config.resolveConfigFile,
|
37861 | clearConfigCache() {
|
37862 | config.clearCache();
|
37863 | plugins.clearCache();
|
37864 | },
|
37865 | getFileInfo: withPlugins(getFileInfo),
|
37866 | getSupportInfo: withPlugins(getSupportInfo, 0),
|
37867 | version,
|
37868 | util: sharedUtil,
|
37869 | __internal: {
|
37870 | errors: require_errors(),
|
37871 | coreOptions: require_core_options(),
|
37872 | createIgnorer: require_create_ignorer(),
|
37873 | optionsModule: require_options(),
|
37874 | optionsNormalizer: require_options_normalizer(),
|
37875 | utils: {
|
37876 | arrayify: require_arrayify(),
|
37877 | getLast: require_get_last(),
|
37878 | partition: require_partition(),
|
37879 | isNonEmptyArray: require_util().isNonEmptyArray
|
37880 | }
|
37881 | },
|
37882 | __debug: {
|
37883 | parse: withPlugins(core.parse),
|
37884 | formatAST: withPlugins(core.formatAST),
|
37885 | formatDoc: withPlugins(core.formatDoc),
|
37886 | printToDoc: withPlugins(core.printToDoc),
|
37887 | printDocToString: withPlugins(core.printDocToString)
|
37888 | }
|
37889 | };
|