1 var __create = Object.create;
2 var __defProp = Object.defineProperty;
3 var __getProtoOf = Object.getPrototypeOf;
4 var __hasOwnProp = Object.prototype.hasOwnProperty;
5 var __getOwnPropNames = Object.getOwnPropertyNames;
6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7 var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
8 var __commonJS = (callback, module2) => () => {
10 module2 = {exports: {}};
11 callback(module2.exports, module2);
13 return module2.exports;
15 var __export = (target, all) => {
17 __defProp(target, name, {get: all[name], enumerable: true});
19 var __exportStar = (target, module2, desc) => {
20 if (module2 && typeof module2 === "object" || typeof module2 === "function") {
21 for (let key of __getOwnPropNames(module2))
22 if (!__hasOwnProp.call(target, key) && key !== "default")
23 __defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
27 var __toModule = (module2) => {
28 if (module2 && module2.__esModule)
30 return __exportStar(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", {value: module2, enumerable: true})), module2);
33 // node_modules/resolve-from/index.js
34 var require_resolve_from = __commonJS((exports2, module2) => {
36 var path5 = require("path");
37 var Module = require("module");
38 var fs = require("fs");
39 var resolveFrom2 = (fromDirectory, moduleId, silent) => {
40 if (typeof fromDirectory !== "string") {
41 throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
43 if (typeof moduleId !== "string") {
44 throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``);
47 fromDirectory = fs.realpathSync(fromDirectory);
49 if (error.code === "ENOENT") {
50 fromDirectory = path5.resolve(fromDirectory);
57 const fromFile = path5.join(fromDirectory, "noop.js");
58 const resolveFileName = () => Module._resolveFilename(moduleId, {
61 paths: Module._nodeModulePaths(fromDirectory)
65 return resolveFileName();
70 return resolveFileName();
72 module2.exports = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId);
73 module2.exports.silent = (fromDirectory, moduleId) => resolveFrom2(fromDirectory, moduleId, true);
76 // node_modules/semver/internal/constants.js
77 var require_constants = __commonJS((exports2, module2) => {
78 var SEMVER_SPEC_VERSION = "2.0.0";
80 var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
81 var MAX_SAFE_COMPONENT_LENGTH = 16;
86 MAX_SAFE_COMPONENT_LENGTH
90 // node_modules/semver/internal/debug.js
91 var require_debug = __commonJS((exports2, module2) => {
92 var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
94 module2.exports = debug;
97 // node_modules/semver/internal/re.js
98 var require_re = __commonJS((exports2, module2) => {
99 var {MAX_SAFE_COMPONENT_LENGTH} = require_constants();
100 var debug = require_debug();
101 exports2 = module2.exports = {};
102 var re = exports2.re = [];
103 var src = exports2.src = [];
104 var t = exports2.t = {};
106 var createToken = (name, value, isGlobal) => {
111 re[index] = new RegExp(value, isGlobal ? "g" : void 0);
113 createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
114 createToken("NUMERICIDENTIFIERLOOSE", "[0-9]+");
115 createToken("NONNUMERICIDENTIFIER", "\\d*[a-zA-Z-][a-zA-Z0-9-]*");
116 createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
117 createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
118 createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
119 createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
120 createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
121 createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
122 createToken("BUILDIDENTIFIER", "[0-9A-Za-z-]+");
123 createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
124 createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
125 createToken("FULL", `^${src[t.FULLPLAIN]}$`);
126 createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
127 createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
128 createToken("GTLT", "((?:<|>)?=?)");
129 createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
130 createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
131 createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
132 createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
133 createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
134 createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
135 createToken("COERCE", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:$|[^\\d])`);
136 createToken("COERCERTL", src[t.COERCE], true);
137 createToken("LONETILDE", "(?:~>?)");
138 createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
139 exports2.tildeTrimReplace = "$1~";
140 createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
141 createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
142 createToken("LONECARET", "(?:\\^)");
143 createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
144 exports2.caretTrimReplace = "$1^";
145 createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
146 createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
147 createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
148 createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
149 createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
150 exports2.comparatorTrimReplace = "$1$2$3";
151 createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
152 createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
153 createToken("STAR", "(<|>)?=?\\s*\\*");
154 createToken("GTE0", "^\\s*>=\\s*0.0.0\\s*$");
155 createToken("GTE0PRE", "^\\s*>=\\s*0.0.0-0\\s*$");
158 // node_modules/semver/internal/parse-options.js
159 var require_parse_options = __commonJS((exports2, module2) => {
160 var opts = ["includePrerelease", "loose", "rtl"];
161 var parseOptions = (options) => !options ? {} : typeof options !== "object" ? {loose: true} : opts.filter((k) => options[k]).reduce((options2, k) => {
165 module2.exports = parseOptions;
168 // node_modules/semver/internal/identifiers.js
169 var require_identifiers = __commonJS((exports2, module2) => {
170 var numeric = /^[0-9]+$/;
171 var compareIdentifiers = (a, b) => {
172 const anum = numeric.test(a);
173 const bnum = numeric.test(b);
178 return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
180 var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
187 // node_modules/semver/classes/semver.js
188 var require_semver = __commonJS((exports2, module2) => {
189 var debug = require_debug();
190 var {MAX_LENGTH, MAX_SAFE_INTEGER} = require_constants();
191 var {re, t} = require_re();
192 var parseOptions = require_parse_options();
193 var {compareIdentifiers} = require_identifiers();
195 constructor(version, options) {
196 options = parseOptions(options);
197 if (version instanceof SemVer) {
198 if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
201 version = version.version;
203 } else if (typeof version !== "string") {
204 throw new TypeError(`Invalid Version: ${version}`);
206 if (version.length > MAX_LENGTH) {
207 throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
209 debug("SemVer", version, options);
210 this.options = options;
211 this.loose = !!options.loose;
212 this.includePrerelease = !!options.includePrerelease;
213 const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
215 throw new TypeError(`Invalid Version: ${version}`);
221 if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
222 throw new TypeError("Invalid major version");
224 if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
225 throw new TypeError("Invalid minor version");
227 if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
228 throw new TypeError("Invalid patch version");
231 this.prerelease = [];
233 this.prerelease = m[4].split(".").map((id) => {
234 if (/^[0-9]+$/.test(id)) {
236 if (num >= 0 && num < MAX_SAFE_INTEGER) {
243 this.build = m[5] ? m[5].split(".") : [];
247 this.version = `${this.major}.${this.minor}.${this.patch}`;
248 if (this.prerelease.length) {
249 this.version += `-${this.prerelease.join(".")}`;
257 debug("SemVer.compare", this.version, this.options, other);
258 if (!(other instanceof SemVer)) {
259 if (typeof other === "string" && other === this.version) {
262 other = new SemVer(other, this.options);
264 if (other.version === this.version) {
267 return this.compareMain(other) || this.comparePre(other);
270 if (!(other instanceof SemVer)) {
271 other = new SemVer(other, this.options);
273 return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
276 if (!(other instanceof SemVer)) {
277 other = new SemVer(other, this.options);
279 if (this.prerelease.length && !other.prerelease.length) {
281 } else if (!this.prerelease.length && other.prerelease.length) {
283 } else if (!this.prerelease.length && !other.prerelease.length) {
288 const a = this.prerelease[i];
289 const b = other.prerelease[i];
290 debug("prerelease compare", i, a, b);
291 if (a === void 0 && b === void 0) {
293 } else if (b === void 0) {
295 } else if (a === void 0) {
297 } else if (a === b) {
300 return compareIdentifiers(a, b);
304 compareBuild(other) {
305 if (!(other instanceof SemVer)) {
306 other = new SemVer(other, this.options);
310 const a = this.build[i];
311 const b = other.build[i];
312 debug("prerelease compare", i, a, b);
313 if (a === void 0 && b === void 0) {
315 } else if (b === void 0) {
317 } else if (a === void 0) {
319 } else if (a === b) {
322 return compareIdentifiers(a, b);
326 inc(release, identifier) {
329 this.prerelease.length = 0;
333 this.inc("pre", identifier);
336 this.prerelease.length = 0;
339 this.inc("pre", identifier);
342 this.prerelease.length = 0;
343 this.inc("patch", identifier);
344 this.inc("pre", identifier);
347 if (this.prerelease.length === 0) {
348 this.inc("patch", identifier);
350 this.inc("pre", identifier);
353 if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
358 this.prerelease = [];
361 if (this.patch !== 0 || this.prerelease.length === 0) {
365 this.prerelease = [];
368 if (this.prerelease.length === 0) {
371 this.prerelease = [];
374 if (this.prerelease.length === 0) {
375 this.prerelease = [0];
377 let i = this.prerelease.length;
379 if (typeof this.prerelease[i] === "number") {
380 this.prerelease[i]++;
385 this.prerelease.push(0);
389 if (this.prerelease[0] === identifier) {
390 if (isNaN(this.prerelease[1])) {
391 this.prerelease = [identifier, 0];
394 this.prerelease = [identifier, 0];
399 throw new Error(`invalid increment argument: ${release}`);
402 this.raw = this.version;
406 module2.exports = SemVer;
409 // node_modules/semver/functions/parse.js
410 var require_parse = __commonJS((exports2, module2) => {
411 var {MAX_LENGTH} = require_constants();
412 var {re, t} = require_re();
413 var SemVer = require_semver();
414 var parseOptions = require_parse_options();
415 var parse = (version, options) => {
416 options = parseOptions(options);
417 if (version instanceof SemVer) {
420 if (typeof version !== "string") {
423 if (version.length > MAX_LENGTH) {
426 const r = options.loose ? re[t.LOOSE] : re[t.FULL];
427 if (!r.test(version)) {
431 return new SemVer(version, options);
436 module2.exports = parse;
439 // node_modules/semver/functions/valid.js
440 var require_valid = __commonJS((exports2, module2) => {
441 var parse = require_parse();
442 var valid = (version, options) => {
443 const v = parse(version, options);
444 return v ? v.version : null;
446 module2.exports = valid;
449 // node_modules/semver/functions/clean.js
450 var require_clean = __commonJS((exports2, module2) => {
451 var parse = require_parse();
452 var clean = (version, options) => {
453 const s = parse(version.trim().replace(/^[=v]+/, ""), options);
454 return s ? s.version : null;
456 module2.exports = clean;
459 // node_modules/semver/functions/inc.js
460 var require_inc = __commonJS((exports2, module2) => {
461 var SemVer = require_semver();
462 var inc = (version, release, options, identifier) => {
463 if (typeof options === "string") {
464 identifier = options;
468 return new SemVer(version, options).inc(release, identifier).version;
473 module2.exports = inc;
476 // node_modules/semver/functions/compare.js
477 var require_compare = __commonJS((exports2, module2) => {
478 var SemVer = require_semver();
479 var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
480 module2.exports = compare;
483 // node_modules/semver/functions/eq.js
484 var require_eq = __commonJS((exports2, module2) => {
485 var compare = require_compare();
486 var eq = (a, b, loose) => compare(a, b, loose) === 0;
487 module2.exports = eq;
490 // node_modules/semver/functions/diff.js
491 var require_diff = __commonJS((exports2, module2) => {
492 var parse = require_parse();
493 var eq = require_eq();
494 var diff = (version1, version2) => {
495 if (eq(version1, version2)) {
498 const v1 = parse(version1);
499 const v2 = parse(version2);
500 const hasPre = v1.prerelease.length || v2.prerelease.length;
501 const prefix = hasPre ? "pre" : "";
502 const defaultResult = hasPre ? "prerelease" : "";
503 for (const key in v1) {
504 if (key === "major" || key === "minor" || key === "patch") {
505 if (v1[key] !== v2[key]) {
510 return defaultResult;
513 module2.exports = diff;
516 // node_modules/semver/functions/major.js
517 var require_major = __commonJS((exports2, module2) => {
518 var SemVer = require_semver();
519 var major = (a, loose) => new SemVer(a, loose).major;
520 module2.exports = major;
523 // node_modules/semver/functions/minor.js
524 var require_minor = __commonJS((exports2, module2) => {
525 var SemVer = require_semver();
526 var minor = (a, loose) => new SemVer(a, loose).minor;
527 module2.exports = minor;
530 // node_modules/semver/functions/patch.js
531 var require_patch = __commonJS((exports2, module2) => {
532 var SemVer = require_semver();
533 var patch = (a, loose) => new SemVer(a, loose).patch;
534 module2.exports = patch;
537 // node_modules/semver/functions/prerelease.js
538 var require_prerelease = __commonJS((exports2, module2) => {
539 var parse = require_parse();
540 var prerelease = (version, options) => {
541 const parsed = parse(version, options);
542 return parsed && parsed.prerelease.length ? parsed.prerelease : null;
544 module2.exports = prerelease;
547 // node_modules/semver/functions/rcompare.js
548 var require_rcompare = __commonJS((exports2, module2) => {
549 var compare = require_compare();
550 var rcompare = (a, b, loose) => compare(b, a, loose);
551 module2.exports = rcompare;
554 // node_modules/semver/functions/compare-loose.js
555 var require_compare_loose = __commonJS((exports2, module2) => {
556 var compare = require_compare();
557 var compareLoose = (a, b) => compare(a, b, true);
558 module2.exports = compareLoose;
561 // node_modules/semver/functions/compare-build.js
562 var require_compare_build = __commonJS((exports2, module2) => {
563 var SemVer = require_semver();
564 var compareBuild = (a, b, loose) => {
565 const versionA = new SemVer(a, loose);
566 const versionB = new SemVer(b, loose);
567 return versionA.compare(versionB) || versionA.compareBuild(versionB);
569 module2.exports = compareBuild;
572 // node_modules/semver/functions/sort.js
573 var require_sort = __commonJS((exports2, module2) => {
574 var compareBuild = require_compare_build();
575 var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
576 module2.exports = sort;
579 // node_modules/semver/functions/rsort.js
580 var require_rsort = __commonJS((exports2, module2) => {
581 var compareBuild = require_compare_build();
582 var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
583 module2.exports = rsort;
586 // node_modules/semver/functions/gt.js
587 var require_gt = __commonJS((exports2, module2) => {
588 var compare = require_compare();
589 var gt = (a, b, loose) => compare(a, b, loose) > 0;
590 module2.exports = gt;
593 // node_modules/semver/functions/lt.js
594 var require_lt = __commonJS((exports2, module2) => {
595 var compare = require_compare();
596 var lt = (a, b, loose) => compare(a, b, loose) < 0;
597 module2.exports = lt;
600 // node_modules/semver/functions/neq.js
601 var require_neq = __commonJS((exports2, module2) => {
602 var compare = require_compare();
603 var neq = (a, b, loose) => compare(a, b, loose) !== 0;
604 module2.exports = neq;
607 // node_modules/semver/functions/gte.js
608 var require_gte = __commonJS((exports2, module2) => {
609 var compare = require_compare();
610 var gte = (a, b, loose) => compare(a, b, loose) >= 0;
611 module2.exports = gte;
614 // node_modules/semver/functions/lte.js
615 var require_lte = __commonJS((exports2, module2) => {
616 var compare = require_compare();
617 var lte = (a, b, loose) => compare(a, b, loose) <= 0;
618 module2.exports = lte;
621 // node_modules/semver/functions/cmp.js
622 var require_cmp = __commonJS((exports2, module2) => {
623 var eq = require_eq();
624 var neq = require_neq();
625 var gt = require_gt();
626 var gte = require_gte();
627 var lt = require_lt();
628 var lte = require_lte();
629 var cmp = (a, op, b, loose) => {
632 if (typeof a === "object")
634 if (typeof b === "object")
638 if (typeof a === "object")
640 if (typeof b === "object")
646 return eq(a, b, loose);
648 return neq(a, b, loose);
650 return gt(a, b, loose);
652 return gte(a, b, loose);
654 return lt(a, b, loose);
656 return lte(a, b, loose);
658 throw new TypeError(`Invalid operator: ${op}`);
661 module2.exports = cmp;
664 // node_modules/semver/functions/coerce.js
665 var require_coerce = __commonJS((exports2, module2) => {
666 var SemVer = require_semver();
667 var parse = require_parse();
668 var {re, t} = require_re();
669 var coerce = (version, options) => {
670 if (version instanceof SemVer) {
673 if (typeof version === "number") {
674 version = String(version);
676 if (typeof version !== "string") {
679 options = options || {};
682 match = version.match(re[t.COERCE]);
685 while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) {
686 if (!match || next.index + next[0].length !== match.index + match[0].length) {
689 re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;
691 re[t.COERCERTL].lastIndex = -1;
695 return parse(`${match[2]}.${match[3] || "0"}.${match[4] || "0"}`, options);
697 module2.exports = coerce;
700 // node_modules/yallist/iterator.js
701 var require_iterator = __commonJS((exports2, module2) => {
703 module2.exports = function(Yallist) {
704 Yallist.prototype[Symbol.iterator] = function* () {
705 for (let walker = this.head; walker; walker = walker.next) {
712 // node_modules/yallist/yallist.js
713 var require_yallist = __commonJS((exports2, module2) => {
715 module2.exports = Yallist;
717 Yallist.create = Yallist;
718 function Yallist(list) {
720 if (!(self instanceof Yallist)) {
721 self = new Yallist();
726 if (list && typeof list.forEach === "function") {
727 list.forEach(function(item) {
730 } else if (arguments.length > 0) {
731 for (var i = 0, l = arguments.length; i < l; i++) {
732 self.push(arguments[i]);
737 Yallist.prototype.removeNode = function(node) {
738 if (node.list !== this) {
739 throw new Error("removing node which does not belong to this list");
741 var next = node.next;
742 var prev = node.prev;
749 if (node === this.head) {
752 if (node === this.tail) {
761 Yallist.prototype.unshiftNode = function(node) {
762 if (node === this.head) {
766 node.list.removeNode(node);
768 var head = this.head;
780 Yallist.prototype.pushNode = function(node) {
781 if (node === this.tail) {
785 node.list.removeNode(node);
787 var tail = this.tail;
799 Yallist.prototype.push = function() {
800 for (var i = 0, l = arguments.length; i < l; i++) {
801 push(this, arguments[i]);
805 Yallist.prototype.unshift = function() {
806 for (var i = 0, l = arguments.length; i < l; i++) {
807 unshift(this, arguments[i]);
811 Yallist.prototype.pop = function() {
815 var res = this.tail.value;
816 this.tail = this.tail.prev;
818 this.tail.next = null;
825 Yallist.prototype.shift = function() {
829 var res = this.head.value;
830 this.head = this.head.next;
832 this.head.prev = null;
839 Yallist.prototype.forEach = function(fn, thisp) {
840 thisp = thisp || this;
841 for (var walker = this.head, i = 0; walker !== null; i++) {
842 fn.call(thisp, walker.value, i, this);
843 walker = walker.next;
846 Yallist.prototype.forEachReverse = function(fn, thisp) {
847 thisp = thisp || this;
848 for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
849 fn.call(thisp, walker.value, i, this);
850 walker = walker.prev;
853 Yallist.prototype.get = function(n) {
854 for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
855 walker = walker.next;
857 if (i === n && walker !== null) {
861 Yallist.prototype.getReverse = function(n) {
862 for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
863 walker = walker.prev;
865 if (i === n && walker !== null) {
869 Yallist.prototype.map = function(fn, thisp) {
870 thisp = thisp || this;
871 var res = new Yallist();
872 for (var walker = this.head; walker !== null; ) {
873 res.push(fn.call(thisp, walker.value, this));
874 walker = walker.next;
878 Yallist.prototype.mapReverse = function(fn, thisp) {
879 thisp = thisp || this;
880 var res = new Yallist();
881 for (var walker = this.tail; walker !== null; ) {
882 res.push(fn.call(thisp, walker.value, this));
883 walker = walker.prev;
887 Yallist.prototype.reduce = function(fn, initial) {
889 var walker = this.head;
890 if (arguments.length > 1) {
892 } else if (this.head) {
893 walker = this.head.next;
894 acc = this.head.value;
896 throw new TypeError("Reduce of empty list with no initial value");
898 for (var i = 0; walker !== null; i++) {
899 acc = fn(acc, walker.value, i);
900 walker = walker.next;
904 Yallist.prototype.reduceReverse = function(fn, initial) {
906 var walker = this.tail;
907 if (arguments.length > 1) {
909 } else if (this.tail) {
910 walker = this.tail.prev;
911 acc = this.tail.value;
913 throw new TypeError("Reduce of empty list with no initial value");
915 for (var i = this.length - 1; walker !== null; i--) {
916 acc = fn(acc, walker.value, i);
917 walker = walker.prev;
921 Yallist.prototype.toArray = function() {
922 var arr = new Array(this.length);
923 for (var i = 0, walker = this.head; walker !== null; i++) {
924 arr[i] = walker.value;
925 walker = walker.next;
929 Yallist.prototype.toArrayReverse = function() {
930 var arr = new Array(this.length);
931 for (var i = 0, walker = this.tail; walker !== null; i++) {
932 arr[i] = walker.value;
933 walker = walker.prev;
937 Yallist.prototype.slice = function(from, to) {
938 to = to || this.length;
946 var ret = new Yallist();
947 if (to < from || to < 0) {
953 if (to > this.length) {
956 for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
957 walker = walker.next;
959 for (; walker !== null && i < to; i++, walker = walker.next) {
960 ret.push(walker.value);
964 Yallist.prototype.sliceReverse = function(from, to) {
965 to = to || this.length;
973 var ret = new Yallist();
974 if (to < from || to < 0) {
980 if (to > this.length) {
983 for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
984 walker = walker.prev;
986 for (; walker !== null && i > from; i--, walker = walker.prev) {
987 ret.push(walker.value);
991 Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
992 if (start > this.length) {
993 start = this.length - 1;
996 start = this.length + start;
998 for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
999 walker = walker.next;
1002 for (var i = 0; walker && i < deleteCount; i++) {
1003 ret.push(walker.value);
1004 walker = this.removeNode(walker);
1006 if (walker === null) {
1009 if (walker !== this.head && walker !== this.tail) {
1010 walker = walker.prev;
1012 for (var i = 0; i < nodes.length; i++) {
1013 walker = insert(this, walker, nodes[i]);
1017 Yallist.prototype.reverse = function() {
1018 var head = this.head;
1019 var tail = this.tail;
1020 for (var walker = head; walker !== null; walker = walker.prev) {
1021 var p = walker.prev;
1022 walker.prev = walker.next;
1029 function insert(self, node, value) {
1030 var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
1031 if (inserted.next === null) {
1032 self.tail = inserted;
1034 if (inserted.prev === null) {
1035 self.head = inserted;
1040 function push(self, item) {
1041 self.tail = new Node(item, self.tail, null, self);
1043 self.head = self.tail;
1047 function unshift(self, item) {
1048 self.head = new Node(item, null, self.head, self);
1050 self.tail = self.head;
1054 function Node(value, prev, next, list) {
1055 if (!(this instanceof Node)) {
1056 return new Node(value, prev, next, list);
1074 require_iterator()(Yallist);
1079 // node_modules/lru-cache/index.js
1080 var require_lru_cache = __commonJS((exports2, module2) => {
1082 var Yallist = require_yallist();
1083 var MAX = Symbol("max");
1084 var LENGTH = Symbol("length");
1085 var LENGTH_CALCULATOR = Symbol("lengthCalculator");
1086 var ALLOW_STALE = Symbol("allowStale");
1087 var MAX_AGE = Symbol("maxAge");
1088 var DISPOSE = Symbol("dispose");
1089 var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
1090 var LRU_LIST = Symbol("lruList");
1091 var CACHE = Symbol("cache");
1092 var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
1093 var naiveLength = () => 1;
1094 var LRUCache = class {
1095 constructor(options) {
1096 if (typeof options === "number")
1097 options = {max: options};
1100 if (options.max && (typeof options.max !== "number" || options.max < 0))
1101 throw new TypeError("max must be a non-negative number");
1102 const max = this[MAX] = options.max || Infinity;
1103 const lc = options.length || naiveLength;
1104 this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
1105 this[ALLOW_STALE] = options.stale || false;
1106 if (options.maxAge && typeof options.maxAge !== "number")
1107 throw new TypeError("maxAge must be a number");
1108 this[MAX_AGE] = options.maxAge || 0;
1109 this[DISPOSE] = options.dispose;
1110 this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1111 this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
1115 if (typeof mL !== "number" || mL < 0)
1116 throw new TypeError("max must be a non-negative number");
1117 this[MAX] = mL || Infinity;
1123 set allowStale(allowStale) {
1124 this[ALLOW_STALE] = !!allowStale;
1127 return this[ALLOW_STALE];
1130 if (typeof mA !== "number")
1131 throw new TypeError("maxAge must be a non-negative number");
1136 return this[MAX_AGE];
1138 set lengthCalculator(lC) {
1139 if (typeof lC !== "function")
1141 if (lC !== this[LENGTH_CALCULATOR]) {
1142 this[LENGTH_CALCULATOR] = lC;
1144 this[LRU_LIST].forEach((hit) => {
1145 hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1146 this[LENGTH] += hit.length;
1151 get lengthCalculator() {
1152 return this[LENGTH_CALCULATOR];
1155 return this[LENGTH];
1158 return this[LRU_LIST].length;
1160 rforEach(fn, thisp) {
1161 thisp = thisp || this;
1162 for (let walker = this[LRU_LIST].tail; walker !== null; ) {
1163 const prev = walker.prev;
1164 forEachStep(this, fn, walker, thisp);
1168 forEach(fn, thisp) {
1169 thisp = thisp || this;
1170 for (let walker = this[LRU_LIST].head; walker !== null; ) {
1171 const next = walker.next;
1172 forEachStep(this, fn, walker, thisp);
1177 return this[LRU_LIST].toArray().map((k) => k.key);
1180 return this[LRU_LIST].toArray().map((k) => k.value);
1183 if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1184 this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
1186 this[CACHE] = new Map();
1187 this[LRU_LIST] = new Yallist();
1191 return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
1194 e: hit.now + (hit.maxAge || 0)
1195 }).toArray().filter((h) => h);
1198 return this[LRU_LIST];
1200 set(key, value, maxAge) {
1201 maxAge = maxAge || this[MAX_AGE];
1202 if (maxAge && typeof maxAge !== "number")
1203 throw new TypeError("maxAge must be a number");
1204 const now = maxAge ? Date.now() : 0;
1205 const len = this[LENGTH_CALCULATOR](value, key);
1206 if (this[CACHE].has(key)) {
1207 if (len > this[MAX]) {
1208 del(this, this[CACHE].get(key));
1211 const node = this[CACHE].get(key);
1212 const item = node.value;
1213 if (this[DISPOSE]) {
1214 if (!this[NO_DISPOSE_ON_SET])
1215 this[DISPOSE](key, item.value);
1218 item.maxAge = maxAge;
1220 this[LENGTH] += len - item.length;
1226 const hit = new Entry(key, value, len, now, maxAge);
1227 if (hit.length > this[MAX]) {
1229 this[DISPOSE](key, value);
1232 this[LENGTH] += hit.length;
1233 this[LRU_LIST].unshift(hit);
1234 this[CACHE].set(key, this[LRU_LIST].head);
1239 if (!this[CACHE].has(key))
1241 const hit = this[CACHE].get(key).value;
1242 return !isStale(this, hit);
1245 return get(this, key, true);
1248 return get(this, key, false);
1251 const node = this[LRU_LIST].tail;
1258 del(this, this[CACHE].get(key));
1262 const now = Date.now();
1263 for (let l = arr.length - 1; l >= 0; l--) {
1265 const expiresAt = hit.e || 0;
1266 if (expiresAt === 0)
1267 this.set(hit.k, hit.v);
1269 const maxAge = expiresAt - now;
1271 this.set(hit.k, hit.v, maxAge);
1277 this[CACHE].forEach((value, key) => get(this, key, false));
1280 var get = (self, key, doUse) => {
1281 const node = self[CACHE].get(key);
1283 const hit = node.value;
1284 if (isStale(self, hit)) {
1286 if (!self[ALLOW_STALE])
1290 if (self[UPDATE_AGE_ON_GET])
1291 node.value.now = Date.now();
1292 self[LRU_LIST].unshiftNode(node);
1298 var isStale = (self, hit) => {
1299 if (!hit || !hit.maxAge && !self[MAX_AGE])
1301 const diff = Date.now() - hit.now;
1302 return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
1304 var trim = (self) => {
1305 if (self[LENGTH] > self[MAX]) {
1306 for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
1307 const prev = walker.prev;
1313 var del = (self, node) => {
1315 const hit = node.value;
1317 self[DISPOSE](hit.key, hit.value);
1318 self[LENGTH] -= hit.length;
1319 self[CACHE].delete(hit.key);
1320 self[LRU_LIST].removeNode(node);
1324 constructor(key, value, length, now, maxAge) {
1327 this.length = length;
1329 this.maxAge = maxAge || 0;
1332 var forEachStep = (self, fn, node, thisp) => {
1333 let hit = node.value;
1334 if (isStale(self, hit)) {
1336 if (!self[ALLOW_STALE])
1340 fn.call(thisp, hit.value, hit.key, self);
1342 module2.exports = LRUCache;
1345 // node_modules/semver/classes/range.js
1346 var require_range = __commonJS((exports2, module2) => {
1347 var Range2 = class {
1348 constructor(range, options) {
1349 options = parseOptions(options);
1350 if (range instanceof Range2) {
1351 if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
1354 return new Range2(range.raw, options);
1357 if (range instanceof Comparator) {
1358 this.raw = range.value;
1359 this.set = [[range]];
1363 this.options = options;
1364 this.loose = !!options.loose;
1365 this.includePrerelease = !!options.includePrerelease;
1367 this.set = range.split(/\s*\|\|\s*/).map((range2) => this.parseRange(range2.trim())).filter((c) => c.length);
1368 if (!this.set.length) {
1369 throw new TypeError(`Invalid SemVer Range: ${range}`);
1371 if (this.set.length > 1) {
1372 const first = this.set[0];
1373 this.set = this.set.filter((c) => !isNullSet(c[0]));
1374 if (this.set.length === 0)
1376 else if (this.set.length > 1) {
1377 for (const c of this.set) {
1378 if (c.length === 1 && isAny(c[0])) {
1388 this.range = this.set.map((comps) => {
1389 return comps.join(" ").trim();
1390 }).join("||").trim();
1397 range = range.trim();
1398 const memoOpts = Object.keys(this.options).join(",");
1399 const memoKey = `parseRange:${memoOpts}:${range}`;
1400 const cached = cache.get(memoKey);
1403 const loose = this.options.loose;
1404 const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1405 range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1406 debug("hyphen replace", range);
1407 range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1408 debug("comparator trim", range, re[t.COMPARATORTRIM]);
1409 range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1410 range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1411 range = range.split(/\s+/).join(" ");
1412 const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1413 const rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options)).filter(this.options.loose ? (comp) => !!comp.match(compRe) : () => true).map((comp) => new Comparator(comp, this.options));
1414 const l = rangeList.length;
1415 const rangeMap = new Map();
1416 for (const comp of rangeList) {
1417 if (isNullSet(comp))
1419 rangeMap.set(comp.value, comp);
1421 if (rangeMap.size > 1 && rangeMap.has(""))
1422 rangeMap.delete("");
1423 const result = [...rangeMap.values()];
1424 cache.set(memoKey, result);
1427 intersects(range, options) {
1428 if (!(range instanceof Range2)) {
1429 throw new TypeError("a Range is required");
1431 return this.set.some((thisComparators) => {
1432 return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
1433 return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
1434 return rangeComparators.every((rangeComparator) => {
1435 return thisComparator.intersects(rangeComparator, options);
1445 if (typeof version === "string") {
1447 version = new SemVer(version, this.options);
1452 for (let i = 0; i < this.set.length; i++) {
1453 if (testSet(this.set[i], version, this.options)) {
1460 module2.exports = Range2;
1461 var LRU = require_lru_cache();
1462 var cache = new LRU({max: 1e3});
1463 var parseOptions = require_parse_options();
1464 var Comparator = require_comparator();
1465 var debug = require_debug();
1466 var SemVer = require_semver();
1470 comparatorTrimReplace,
1474 var isNullSet = (c) => c.value === "<0.0.0-0";
1475 var isAny = (c) => c.value === "";
1476 var isSatisfiable = (comparators, options) => {
1478 const remainingComparators = comparators.slice();
1479 let testComparator = remainingComparators.pop();
1480 while (result && remainingComparators.length) {
1481 result = remainingComparators.every((otherComparator) => {
1482 return testComparator.intersects(otherComparator, options);
1484 testComparator = remainingComparators.pop();
1488 var parseComparator = (comp, options) => {
1489 debug("comp", comp, options);
1490 comp = replaceCarets(comp, options);
1491 debug("caret", comp);
1492 comp = replaceTildes(comp, options);
1493 debug("tildes", comp);
1494 comp = replaceXRanges(comp, options);
1495 debug("xrange", comp);
1496 comp = replaceStars(comp, options);
1497 debug("stars", comp);
1500 var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
1501 var replaceTildes = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
1502 return replaceTilde(comp2, options);
1504 var replaceTilde = (comp, options) => {
1505 const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1506 return comp.replace(r, (_, M, m, p, pr) => {
1507 debug("tilde", comp, _, M, m, p, pr);
1511 } else if (isX(m)) {
1512 ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1513 } else if (isX(p)) {
1514 ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
1516 debug("replaceTilde pr", pr);
1517 ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1519 ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
1521 debug("tilde return", ret);
1525 var replaceCarets = (comp, options) => comp.trim().split(/\s+/).map((comp2) => {
1526 return replaceCaret(comp2, options);
1528 var replaceCaret = (comp, options) => {
1529 debug("caret", comp, options);
1530 const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
1531 const z = options.includePrerelease ? "-0" : "";
1532 return comp.replace(r, (_, M, m, p, pr) => {
1533 debug("caret", comp, _, M, m, p, pr);
1537 } else if (isX(m)) {
1538 ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
1539 } else if (isX(p)) {
1541 ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
1543 ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
1546 debug("replaceCaret pr", pr);
1549 ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
1551 ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
1554 ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
1560 ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
1562 ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
1565 ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
1568 debug("caret return", ret);
1572 var replaceXRanges = (comp, options) => {
1573 debug("replaceXRanges", comp, options);
1574 return comp.split(/\s+/).map((comp2) => {
1575 return replaceXRange(comp2, options);
1578 var replaceXRange = (comp, options) => {
1580 const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
1581 return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
1582 debug("xRange", comp, ret, gtlt, M, m, p, pr);
1584 const xm = xM || isX(m);
1585 const xp = xm || isX(p);
1587 if (gtlt === "=" && anyX) {
1590 pr = options.includePrerelease ? "-0" : "";
1592 if (gtlt === ">" || gtlt === "<") {
1597 } else if (gtlt && anyX) {
1612 } else if (gtlt === "<=") {
1622 ret = `${gtlt + M}.${m}.${p}${pr}`;
1624 ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
1626 ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
1628 debug("xRange return", ret);
1632 var replaceStars = (comp, options) => {
1633 debug("replaceStars", comp, options);
1634 return comp.trim().replace(re[t.STAR], "");
1636 var replaceGTE0 = (comp, options) => {
1637 debug("replaceGTE0", comp, options);
1638 return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
1640 var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
1643 } else if (isX(fm)) {
1644 from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
1645 } else if (isX(fp)) {
1646 from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
1650 from = `>=${from}${incPr ? "-0" : ""}`;
1654 } else if (isX(tm)) {
1655 to = `<${+tM + 1}.0.0-0`;
1656 } else if (isX(tp)) {
1657 to = `<${tM}.${+tm + 1}.0-0`;
1659 to = `<=${tM}.${tm}.${tp}-${tpr}`;
1661 to = `<${tM}.${tm}.${+tp + 1}-0`;
1665 return `${from} ${to}`.trim();
1667 var testSet = (set, version, options) => {
1668 for (let i = 0; i < set.length; i++) {
1669 if (!set[i].test(version)) {
1673 if (version.prerelease.length && !options.includePrerelease) {
1674 for (let i = 0; i < set.length; i++) {
1675 debug(set[i].semver);
1676 if (set[i].semver === Comparator.ANY) {
1679 if (set[i].semver.prerelease.length > 0) {
1680 const allowed = set[i].semver;
1681 if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
1692 // node_modules/semver/classes/comparator.js
1693 var require_comparator = __commonJS((exports2, module2) => {
1694 var ANY = Symbol("SemVer ANY");
1695 var Comparator = class {
1699 constructor(comp, options) {
1700 options = parseOptions(options);
1701 if (comp instanceof Comparator) {
1702 if (comp.loose === !!options.loose) {
1708 debug("comparator", comp, options);
1709 this.options = options;
1710 this.loose = !!options.loose;
1712 if (this.semver === ANY) {
1715 this.value = this.operator + this.semver.version;
1717 debug("comp", this);
1720 const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
1721 const m = comp.match(r);
1723 throw new TypeError(`Invalid comparator: ${comp}`);
1725 this.operator = m[1] !== void 0 ? m[1] : "";
1726 if (this.operator === "=") {
1732 this.semver = new SemVer(m[2], this.options.loose);
1739 debug("Comparator.test", version, this.options.loose);
1740 if (this.semver === ANY || version === ANY) {
1743 if (typeof version === "string") {
1745 version = new SemVer(version, this.options);
1750 return cmp(version, this.operator, this.semver, this.options);
1752 intersects(comp, options) {
1753 if (!(comp instanceof Comparator)) {
1754 throw new TypeError("a Comparator is required");
1756 if (!options || typeof options !== "object") {
1759 includePrerelease: false
1762 if (this.operator === "") {
1763 if (this.value === "") {
1766 return new Range2(comp.value, options).test(this.value);
1767 } else if (comp.operator === "") {
1768 if (comp.value === "") {
1771 return new Range2(this.value, options).test(comp.semver);
1773 const sameDirectionIncreasing = (this.operator === ">=" || this.operator === ">") && (comp.operator === ">=" || comp.operator === ">");
1774 const sameDirectionDecreasing = (this.operator === "<=" || this.operator === "<") && (comp.operator === "<=" || comp.operator === "<");
1775 const sameSemVer = this.semver.version === comp.semver.version;
1776 const differentDirectionsInclusive = (this.operator === ">=" || this.operator === "<=") && (comp.operator === ">=" || comp.operator === "<=");
1777 const oppositeDirectionsLessThan = cmp(this.semver, "<", comp.semver, options) && (this.operator === ">=" || this.operator === ">") && (comp.operator === "<=" || comp.operator === "<");
1778 const oppositeDirectionsGreaterThan = cmp(this.semver, ">", comp.semver, options) && (this.operator === "<=" || this.operator === "<") && (comp.operator === ">=" || comp.operator === ">");
1779 return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan;
1782 module2.exports = Comparator;
1783 var parseOptions = require_parse_options();
1784 var {re, t} = require_re();
1785 var cmp = require_cmp();
1786 var debug = require_debug();
1787 var SemVer = require_semver();
1788 var Range2 = require_range();
1791 // node_modules/semver/functions/satisfies.js
1792 var require_satisfies = __commonJS((exports2, module2) => {
1793 var Range2 = require_range();
1794 var satisfies = (version, range, options) => {
1796 range = new Range2(range, options);
1800 return range.test(version);
1802 module2.exports = satisfies;
1805 // node_modules/semver/ranges/to-comparators.js
1806 var require_to_comparators = __commonJS((exports2, module2) => {
1807 var Range2 = require_range();
1808 var toComparators = (range, options) => new Range2(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
1809 module2.exports = toComparators;
1812 // node_modules/semver/ranges/max-satisfying.js
1813 var require_max_satisfying = __commonJS((exports2, module2) => {
1814 var SemVer = require_semver();
1815 var Range2 = require_range();
1816 var maxSatisfying = (versions, range, options) => {
1819 let rangeObj = null;
1821 rangeObj = new Range2(range, options);
1825 versions.forEach((v) => {
1826 if (rangeObj.test(v)) {
1827 if (!max || maxSV.compare(v) === -1) {
1829 maxSV = new SemVer(max, options);
1835 module2.exports = maxSatisfying;
1838 // node_modules/semver/ranges/min-satisfying.js
1839 var require_min_satisfying = __commonJS((exports2, module2) => {
1840 var SemVer = require_semver();
1841 var Range2 = require_range();
1842 var minSatisfying = (versions, range, options) => {
1845 let rangeObj = null;
1847 rangeObj = new Range2(range, options);
1851 versions.forEach((v) => {
1852 if (rangeObj.test(v)) {
1853 if (!min || minSV.compare(v) === 1) {
1855 minSV = new SemVer(min, options);
1861 module2.exports = minSatisfying;
1864 // node_modules/semver/ranges/min-version.js
1865 var require_min_version = __commonJS((exports2, module2) => {
1866 var SemVer = require_semver();
1867 var Range2 = require_range();
1868 var gt = require_gt();
1869 var minVersion = (range, loose) => {
1870 range = new Range2(range, loose);
1871 let minver = new SemVer("0.0.0");
1872 if (range.test(minver)) {
1875 minver = new SemVer("0.0.0-0");
1876 if (range.test(minver)) {
1880 for (let i = 0; i < range.set.length; ++i) {
1881 const comparators = range.set[i];
1883 comparators.forEach((comparator) => {
1884 const compver = new SemVer(comparator.semver.version);
1885 switch (comparator.operator) {
1887 if (compver.prerelease.length === 0) {
1890 compver.prerelease.push(0);
1892 compver.raw = compver.format();
1895 if (!setMin || gt(compver, setMin)) {
1903 throw new Error(`Unexpected operation: ${comparator.operator}`);
1906 if (setMin && (!minver || gt(minver, setMin)))
1909 if (minver && range.test(minver)) {
1914 module2.exports = minVersion;
1917 // node_modules/semver/ranges/valid.js
1918 var require_valid2 = __commonJS((exports2, module2) => {
1919 var Range2 = require_range();
1920 var validRange = (range, options) => {
1922 return new Range2(range, options).range || "*";
1927 module2.exports = validRange;
1930 // node_modules/semver/ranges/outside.js
1931 var require_outside = __commonJS((exports2, module2) => {
1932 var SemVer = require_semver();
1933 var Comparator = require_comparator();
1934 var {ANY} = Comparator;
1935 var Range2 = require_range();
1936 var satisfies = require_satisfies();
1937 var gt = require_gt();
1938 var lt = require_lt();
1939 var lte = require_lte();
1940 var gte = require_gte();
1941 var outside = (version, range, hilo, options) => {
1942 version = new SemVer(version, options);
1943 range = new Range2(range, options);
1944 let gtfn, ltefn, ltfn, comp, ecomp;
1961 throw new TypeError('Must provide a hilo val of "<" or ">"');
1963 if (satisfies(version, range, options)) {
1966 for (let i = 0; i < range.set.length; ++i) {
1967 const comparators = range.set[i];
1970 comparators.forEach((comparator) => {
1971 if (comparator.semver === ANY) {
1972 comparator = new Comparator(">=0.0.0");
1974 high = high || comparator;
1975 low = low || comparator;
1976 if (gtfn(comparator.semver, high.semver, options)) {
1978 } else if (ltfn(comparator.semver, low.semver, options)) {
1982 if (high.operator === comp || high.operator === ecomp) {
1985 if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
1987 } else if (low.operator === ecomp && ltfn(version, low.semver)) {
1993 module2.exports = outside;
1996 // node_modules/semver/ranges/gtr.js
1997 var require_gtr = __commonJS((exports2, module2) => {
1998 var outside = require_outside();
1999 var gtr = (version, range, options) => outside(version, range, ">", options);
2000 module2.exports = gtr;
2003 // node_modules/semver/ranges/ltr.js
2004 var require_ltr = __commonJS((exports2, module2) => {
2005 var outside = require_outside();
2006 var ltr = (version, range, options) => outside(version, range, "<", options);
2007 module2.exports = ltr;
2010 // node_modules/semver/ranges/intersects.js
2011 var require_intersects = __commonJS((exports2, module2) => {
2012 var Range2 = require_range();
2013 var intersects = (r1, r2, options) => {
2014 r1 = new Range2(r1, options);
2015 r2 = new Range2(r2, options);
2016 return r1.intersects(r2);
2018 module2.exports = intersects;
2021 // node_modules/semver/ranges/simplify.js
2022 var require_simplify = __commonJS((exports2, module2) => {
2023 var satisfies = require_satisfies();
2024 var compare = require_compare();
2025 module2.exports = (versions, range, options) => {
2029 const v = versions.sort((a, b) => compare(a, b, options));
2030 for (const version of v) {
2031 const included = satisfies(version, range, options);
2038 set.push([min, prev]);
2045 set.push([min, null]);
2047 for (const [min2, max] of set) {
2050 else if (!max && min2 === v[0])
2053 ranges.push(`>=${min2}`);
2054 else if (min2 === v[0])
2055 ranges.push(`<=${max}`);
2057 ranges.push(`${min2} - ${max}`);
2059 const simplified = ranges.join(" || ");
2060 const original = typeof range.raw === "string" ? range.raw : String(range);
2061 return simplified.length < original.length ? simplified : range;
2065 // node_modules/semver/ranges/subset.js
2066 var require_subset = __commonJS((exports2, module2) => {
2067 var Range2 = require_range();
2068 var {ANY} = require_comparator();
2069 var satisfies = require_satisfies();
2070 var compare = require_compare();
2071 var subset = (sub, dom, options) => {
2074 sub = new Range2(sub, options);
2075 dom = new Range2(dom, options);
2076 let sawNonNull = false;
2078 for (const simpleSub of sub.set) {
2079 for (const simpleDom of dom.set) {
2080 const isSub = simpleSubset(simpleSub, simpleDom, options);
2081 sawNonNull = sawNonNull || isSub !== null;
2090 var simpleSubset = (sub, dom, options) => {
2093 if (sub.length === 1 && sub[0].semver === ANY)
2094 return dom.length === 1 && dom[0].semver === ANY;
2095 const eqSet = new Set();
2097 for (const c of sub) {
2098 if (c.operator === ">" || c.operator === ">=")
2099 gt = higherGT(gt, c, options);
2100 else if (c.operator === "<" || c.operator === "<=")
2101 lt = lowerLT(lt, c, options);
2103 eqSet.add(c.semver);
2109 gtltComp = compare(gt.semver, lt.semver, options);
2112 else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<="))
2115 for (const eq of eqSet) {
2116 if (gt && !satisfies(eq, String(gt), options))
2118 if (lt && !satisfies(eq, String(lt), options))
2120 for (const c of dom) {
2121 if (!satisfies(eq, String(c), options))
2127 let hasDomLT, hasDomGT;
2128 for (const c of dom) {
2129 hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
2130 hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
2132 if (c.operator === ">" || c.operator === ">=") {
2133 higher = higherGT(gt, c, options);
2134 if (higher === c && higher !== gt)
2136 } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options))
2140 if (c.operator === "<" || c.operator === "<=") {
2141 lower = lowerLT(lt, c, options);
2142 if (lower === c && lower !== lt)
2144 } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options))
2147 if (!c.operator && (lt || gt) && gtltComp !== 0)
2150 if (gt && hasDomLT && !lt && gtltComp !== 0)
2152 if (lt && hasDomGT && !gt && gtltComp !== 0)
2156 var higherGT = (a, b, options) => {
2159 const comp = compare(a.semver, b.semver, options);
2160 return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
2162 var lowerLT = (a, b, options) => {
2165 const comp = compare(a.semver, b.semver, options);
2166 return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
2168 module2.exports = subset;
2171 // node_modules/semver/index.js
2172 var require_semver2 = __commonJS((exports2, module2) => {
2173 var internalRe = require_re();
2176 src: internalRe.src,
2177 tokens: internalRe.t,
2178 SEMVER_SPEC_VERSION: require_constants().SEMVER_SPEC_VERSION,
2179 SemVer: require_semver(),
2180 compareIdentifiers: require_identifiers().compareIdentifiers,
2181 rcompareIdentifiers: require_identifiers().rcompareIdentifiers,
2182 parse: require_parse(),
2183 valid: require_valid(),
2184 clean: require_clean(),
2186 diff: require_diff(),
2187 major: require_major(),
2188 minor: require_minor(),
2189 patch: require_patch(),
2190 prerelease: require_prerelease(),
2191 compare: require_compare(),
2192 rcompare: require_rcompare(),
2193 compareLoose: require_compare_loose(),
2194 compareBuild: require_compare_build(),
2195 sort: require_sort(),
2196 rsort: require_rsort(),
2204 coerce: require_coerce(),
2205 Comparator: require_comparator(),
2206 Range: require_range(),
2207 satisfies: require_satisfies(),
2208 toComparators: require_to_comparators(),
2209 maxSatisfying: require_max_satisfying(),
2210 minSatisfying: require_min_satisfying(),
2211 minVersion: require_min_version(),
2212 validRange: require_valid2(),
2213 outside: require_outside(),
2216 intersects: require_intersects(),
2217 simplifyRange: require_simplify(),
2218 subset: require_subset()
2222 // node_modules/ignore/index.js
2223 var require_ignore = __commonJS((exports2, module2) => {
2224 function makeArray(subject) {
2225 return Array.isArray(subject) ? subject : [subject];
2230 var REGEX_TEST_BLANK_LINE = /^\s+$/;
2231 var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
2232 var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
2233 var REGEX_SPLITALL_CRLF = /\r?\n/g;
2234 var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
2236 var KEY_IGNORE = typeof Symbol !== "undefined" ? Symbol.for("node-ignore") : "node-ignore";
2237 var define = (object, key, value) => Object.defineProperty(object, key, {value});
2238 var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
2239 var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
2240 var cleanRangeBackSlash = (slashes) => {
2241 const {length} = slashes;
2242 return slashes.slice(0, length - length % 2);
2247 (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
2255 (match) => `\\${match}`
2275 function startingReplacer() {
2276 return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
2280 /\\\/\\\*\\\*(?=\\\/|$)/g,
2281 (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
2284 /(^|[^\\]+)\\\*(?=.+)/g,
2285 (_, p1) => `${p1}[^\\/]*`
2288 /\\\\\\(?=[$.|*+(){^])/g,
2296 /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
2297 (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
2301 (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
2306 const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
2307 return `${prefix}(?=$|\\/$)`;
2311 var regexCache = Object.create(null);
2312 var makeRegex = (pattern, negative, ignorecase) => {
2313 const r = regexCache[pattern];
2317 const source = REPLACERS.reduce((prev, current) => prev.replace(current[0], current[1].bind(pattern)), pattern);
2318 return regexCache[pattern] = ignorecase ? new RegExp(source, "i") : new RegExp(source);
2320 var isString = (subject) => typeof subject === "string";
2321 var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && pattern.indexOf("#") !== 0;
2322 var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
2323 var IgnoreRule = class {
2324 constructor(origin, pattern, negative, regex) {
2325 this.origin = origin;
2326 this.pattern = pattern;
2327 this.negative = negative;
2331 var createRule = (pattern, ignorecase) => {
2332 const origin = pattern;
2333 let negative = false;
2334 if (pattern.indexOf("!") === 0) {
2336 pattern = pattern.substr(1);
2338 pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
2339 const regex = makeRegex(pattern, negative, ignorecase);
2340 return new IgnoreRule(origin, pattern, negative, regex);
2342 var throwError = (message, Ctor) => {
2343 throw new Ctor(message);
2345 var checkPath = (path5, originalPath, doThrow) => {
2346 if (!isString(path5)) {
2347 return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
2350 return doThrow(`path must not be empty`, TypeError);
2352 if (checkPath.isNotRelative(path5)) {
2353 const r = "`path.relative()`d";
2354 return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
2358 var isNotRelative = (path5) => REGEX_TEST_INVALID_PATH.test(path5);
2359 checkPath.isNotRelative = isNotRelative;
2360 checkPath.convert = (p) => p;
2361 var Ignore = class {
2366 this._ignorecase = ignorecase;
2367 define(this, KEY_IGNORE, true);
2371 this._ignoreCache = Object.create(null);
2372 this._testCache = Object.create(null);
2374 _addPattern(pattern) {
2375 if (pattern && pattern[KEY_IGNORE]) {
2376 this._rules = this._rules.concat(pattern._rules);
2380 if (checkPattern(pattern)) {
2381 const rule = createRule(pattern, this._ignorecase);
2383 this._rules.push(rule);
2387 this._added = false;
2388 makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._addPattern, this);
2394 addPattern(pattern) {
2395 return this.add(pattern);
2397 _testOne(path5, checkUnignored) {
2398 let ignored = false;
2399 let unignored = false;
2400 this._rules.forEach((rule) => {
2401 const {negative} = rule;
2402 if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
2405 const matched = rule.regex.test(path5);
2407 ignored = !negative;
2408 unignored = negative;
2416 _test(originalPath, cache, checkUnignored, slices) {
2417 const path5 = originalPath && checkPath.convert(originalPath);
2418 checkPath(path5, originalPath, throwError);
2419 return this._t(path5, cache, checkUnignored, slices);
2421 _t(path5, cache, checkUnignored, slices) {
2422 if (path5 in cache) {
2423 return cache[path5];
2426 slices = path5.split(SLASH);
2429 if (!slices.length) {
2430 return cache[path5] = this._testOne(path5, checkUnignored);
2432 const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
2433 return cache[path5] = parent.ignored ? parent : this._testOne(path5, checkUnignored);
2436 return this._test(path5, this._ignoreCache, false).ignored;
2439 return (path5) => !this.ignores(path5);
2442 return makeArray(paths).filter(this.createFilter());
2445 return this._test(path5, this._testCache, true);
2448 var factory = (options) => new Ignore(options);
2449 var returnFalse = () => false;
2450 var isPathValid = (path5) => checkPath(path5 && checkPath.convert(path5), path5, returnFalse);
2451 factory.isPathValid = isPathValid;
2452 factory.default = factory;
2453 module2.exports = factory;
2454 if (typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")) {
2455 const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
2456 checkPath.convert = makePosix;
2457 const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
2458 checkPath.isNotRelative = (path5) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path5) || isNotRelative(path5);
2463 __markAsModule(exports);
2465 activate: () => activate
2467 var import_coc6 = __toModule(require("coc.nvim"));
2469 // src/configCacheHandler.ts
2470 var import_coc = __toModule(require("coc.nvim"));
2471 var prettier = require("prettier");
2472 var PRETTIER_CONFIG_FILES = [
2479 "prettier.config.js"
2481 function fileListener() {
2482 const fileWatcher = import_coc.workspace.createFileSystemWatcher(`**/{${PRETTIER_CONFIG_FILES.join(",")}}`);
2483 fileWatcher.onDidChange(prettier.clearConfigCache);
2484 fileWatcher.onDidCreate(prettier.clearConfigCache);
2485 fileWatcher.onDidDelete(prettier.clearConfigCache);
2488 var configCacheHandler_default = fileListener;
2490 // src/errorHandler.ts
2491 var import_coc2 = __toModule(require("coc.nvim"));
2493 function addFilePath(msg, fileName) {
2494 const lines = msg.split("\n");
2495 if (lines.length > 0) {
2496 lines[0] = lines[0].replace(/(\d*):(\d*)/g, `${fileName}:$1:$2`);
2497 return lines.join("\n");
2501 function addToOutput(message, type = "Trace") {
2504 const title = `${type} - ${new Date().toLocaleString()}:`;
2505 outputChannel.appendLine("");
2506 outputChannel.appendLine(`[${title}] ${message}
2509 function safeExecution(cb, defaultText, fileName) {
2510 if (cb instanceof Promise) {
2511 return cb.then((returnValue) => {
2514 addToOutput(addFilePath(err.message, fileName), "Error");
2519 const returnValue = cb();
2522 addToOutput(addFilePath(err.message, fileName), "Error");
2526 function setupErrorHandler() {
2527 outputChannel = import_coc2.window.createOutputChannel("prettier");
2528 return import_coc2.commands.registerCommand("prettier.open-output", () => {
2529 outputChannel.show();
2533 // src/ignoreFileHandler.ts
2534 var import_coc4 = __toModule(require("coc.nvim"));
2535 var import_fs = __toModule(require("fs"));
2536 var path3 = __toModule(require("path"));
2539 var import_coc3 = __toModule(require("coc.nvim"));
2540 var import_path2 = __toModule(require("path"));
2542 // src/requirePkg.ts
2543 var import_resolve_from = __toModule(require_resolve_from());
2544 var import_path = __toModule(require("path"));
2545 function requireLocalPkg(fspath, pkgName, options = {silent: true, ignoreBundled: false}) {
2546 let modulePath = import_resolve_from.default.silent(fspath, pkgName);
2547 if (modulePath !== void 0) {
2549 return require(modulePath);
2551 if (!options.silent) {
2552 addToOutput(`Failed to load require ${pkgName} from ${modulePath}.${options.ignoreBundled ? `` : ` Using bundled`}`, "Error");
2556 if (options.ignoreBundled) {
2560 return require(pkgName);
2562 addToOutput(`Failed to load ${pkgName} from ${import_path.default.dirname(__dirname)}`, "Error");
2568 var import_semver = __toModule(require_semver2());
2569 function getConfig(uri) {
2570 return import_coc3.workspace.getConfiguration("prettier", uri ? uri.toString() : void 0);
2572 async function getPrettierInstance() {
2573 const document = await import_coc3.workspace.document;
2574 const uri = import_coc3.Uri.parse(document.uri);
2575 const fileName = uri.fsPath;
2576 const vscodeConfig = getConfig(uri);
2577 const localOnly = vscodeConfig.onlyUseLocalVersion;
2578 const resolvedPrettier = await requireLocalPkg(import_path2.default.dirname(fileName), "prettier", {silent: true, ignoreBundled: localOnly});
2579 if (!resolvedPrettier) {
2580 addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, "Error");
2582 return resolvedPrettier;
2584 function getParsersFromLanguageId(languageId, prettierInstance, path5) {
2585 const supportedLanguages = getSupportLanguages(prettierInstance);
2586 const language = supportedLanguages.find((lang) => Array.isArray(lang.vscodeLanguageIds) && lang.vscodeLanguageIds.includes(languageId) && (lang.extensions.length > 0 || path5 != null && lang.filenames != null && lang.filenames.includes(import_path2.basename(path5))));
2590 return language.parsers;
2592 function allLanguages(prettierInstance) {
2593 const supportedLanguages = getSupportLanguages(prettierInstance);
2594 return supportedLanguages.reduce((ids, language) => [...ids, ...language.vscodeLanguageIds || []], []);
2596 function enabledLanguages(prettierInstance) {
2597 const {disableLanguages} = getConfig();
2598 const languages2 = allLanguages(prettierInstance);
2599 return languages2.filter((x) => disableLanguages.indexOf(x) == -1);
2601 function rangeLanguages() {
2602 const {disableLanguages} = getConfig();
2610 ].filter((x) => disableLanguages.indexOf(x) == -1);
2612 function getSupportLanguages(prettierInstance) {
2613 if (import_semver.default.gte(prettierInstance.version, "2.0.0")) {
2614 return prettierInstance.getSupportInfo({
2615 showUnreleased: true
2618 return prettierInstance.getSupportInfo().languages;
2620 function hasLocalPrettierInstalled(filePath) {
2621 const localPrettier = requireLocalPkg(filePath, "prettier", {
2625 return localPrettier != null;
2628 // src/ignoreFileHandler.ts
2629 var ignore = require_ignore();
2630 var nullIgnorer = {ignores: () => false};
2631 function ignoreFileHandler(disposables) {
2632 const ignorers = new Map();
2633 disposables.push({dispose: () => ignorers.clear()});
2635 fileIsIgnored(filePath) {
2636 const {ignorer, ignoreFilePath} = getIgnorerForFile(filePath);
2637 return ignorer.ignores(path3.relative(path3.dirname(ignoreFilePath), filePath));
2640 function getIgnorerForFile(fsPath) {
2641 const absolutePath = getIgnorePathForFile(fsPath, getConfig(import_coc4.Uri.file(fsPath)).ignorePath);
2642 if (!absolutePath) {
2643 return {ignoreFilePath: "", ignorer: nullIgnorer};
2645 if (!ignorers.has(absolutePath)) {
2646 loadIgnorer(import_coc4.Uri.file(absolutePath));
2648 if (!import_fs.existsSync(absolutePath)) {
2649 const ignorePath = getConfig(import_coc4.Uri.file(fsPath)).ignorePath;
2650 if (ignorePath !== ".prettierignore") {
2651 addToOutput(`Wrong prettier.ignorePath provided in your settings. The path (${ignorePath}) does not exist.`, "Warning");
2653 return {ignoreFilePath: "", ignorer: nullIgnorer};
2656 ignoreFilePath: absolutePath,
2657 ignorer: ignorers.get(absolutePath)
2660 function loadIgnorer(ignoreUri) {
2661 let ignorer = nullIgnorer;
2662 if (!ignorers.has(ignoreUri.fsPath)) {
2663 const fileWatcher = import_coc4.workspace.createFileSystemWatcher(ignoreUri.fsPath);
2664 disposables.push(fileWatcher);
2665 fileWatcher.onDidCreate(loadIgnorer, null, disposables);
2666 fileWatcher.onDidChange(loadIgnorer, null, disposables);
2667 fileWatcher.onDidDelete(unloadIgnorer, null, disposables);
2669 if (import_fs.existsSync(ignoreUri.fsPath)) {
2670 const ignoreFileContents = import_fs.readFileSync(ignoreUri.fsPath, "utf8");
2671 ignorer = ignore().add(ignoreFileContents);
2673 ignorers.set(ignoreUri.fsPath, ignorer);
2675 function unloadIgnorer(ignoreUri) {
2676 ignorers.set(ignoreUri.fsPath, nullIgnorer);
2679 function getIgnorePathForFile(_filePath, ignorePath) {
2683 if (import_coc4.workspace.workspaceFolder) {
2684 const folder = import_coc4.workspace.workspaceFolder;
2685 return folder ? getPath(ignorePath, import_coc4.Uri.parse(folder.uri).fsPath) : null;
2689 function getPath(fsPath, relativeTo) {
2690 return path3.isAbsolute(fsPath) ? fsPath : path3.join(relativeTo, fsPath);
2692 var ignoreFileHandler_default = ignoreFileHandler;
2694 // src/PrettierEditProvider.ts
2695 var import_coc5 = __toModule(require("coc.nvim"));
2696 var import_path3 = __toModule(require("path"));
2697 var STYLE_PARSERS = ["postcss", "css", "less", "scss"];
2698 async function resolveConfig(filePath, options) {
2700 const localPrettier = await requireLocalPkg(import_path3.default.dirname(filePath), "prettier", {silent: true, ignoreBundled: true});
2701 let prettierInstance = localPrettier;
2702 if (!prettierInstance && !options.onlyUseLocalVersion) {
2703 prettierInstance = require("prettier");
2705 const config = await prettierInstance.resolveConfig(filePath, options);
2708 return {config: null, error};
2711 function mergeConfig(hasPrettierConfig, additionalConfig, prettierConfig, vscodeConfig) {
2712 return hasPrettierConfig ? Object.assign({
2713 parser: vscodeConfig.parser,
2714 filepath: vscodeConfig.filepath
2715 }, prettierConfig, additionalConfig) : Object.assign(vscodeConfig, prettierConfig, additionalConfig);
2717 async function format(text, {languageId, uri}, customOptions) {
2718 let u = import_coc5.Uri.parse(uri);
2719 const isUntitled = u.scheme == "untitled";
2720 const fileName = u.fsPath;
2721 const vscodeConfig = getConfig(u);
2722 const localOnly = vscodeConfig.onlyUseLocalVersion;
2723 const resolvedPrettier = await getPrettierInstance();
2724 if (!resolvedPrettier) {
2725 addToOutput(`Prettier module not found, prettier.onlyUseLocalVersion: ${vscodeConfig.onlyUseLocalVersion}`, "Error");
2727 let supportedLanguages = allLanguages(resolvedPrettier);
2728 if (supportedLanguages.indexOf(languageId) == -1) {
2729 import_coc5.window.showMessage(`${languageId} not supported by prettier`, "error");
2732 const dynamicParsers = getParsersFromLanguageId(languageId, resolvedPrettier, isUntitled ? void 0 : fileName);
2733 let useBundled = false;
2735 if (!dynamicParsers.length) {
2736 const bundledParsers = getParsersFromLanguageId(languageId, require("prettier"), isUntitled ? void 0 : fileName);
2737 parser = bundledParsers[0] || "babylon";
2739 } else if (dynamicParsers.includes(vscodeConfig.parser)) {
2740 parser = vscodeConfig.parser;
2742 parser = dynamicParsers[0];
2744 const doesParserSupportEslint = [
2750 ].includes(languageId);
2751 const {config: fileOptions, error} = await resolveConfig(fileName, {
2753 onlyUseLocalVersion: localOnly,
2754 requireConfig: vscodeConfig.requireConfig
2756 const hasConfig = fileOptions != null;
2757 if (!hasConfig && vscodeConfig.requireConfig) {
2761 addToOutput(`Failed to resolve config for ${fileName}. Falling back to the default config settings.`, "Error");
2763 const prettierOptions = mergeConfig(hasConfig, customOptions, fileOptions || {}, {
2764 printWidth: vscodeConfig.printWidth,
2765 tabWidth: vscodeConfig.tabWidth,
2766 singleQuote: vscodeConfig.singleQuote,
2767 jsxSingleQuote: vscodeConfig.jsxSingleQuote,
2768 trailingComma: vscodeConfig.trailingComma,
2769 bracketSpacing: vscodeConfig.bracketSpacing,
2770 jsxBracketSameLine: vscodeConfig.jsxBracketSameLine,
2772 semi: vscodeConfig.semi,
2773 useTabs: vscodeConfig.useTabs,
2774 proseWrap: vscodeConfig.proseWrap,
2775 arrowParens: vscodeConfig.arrowParens,
2778 if (vscodeConfig.tslintIntegration && parser === "typescript") {
2779 return safeExecution(() => {
2780 const prettierTslint = requireLocalPkg(u.fsPath, "prettier-tslint").format;
2781 return prettierTslint({
2784 fallbackPrettierOptions: prettierOptions
2788 if (vscodeConfig.eslintIntegration && doesParserSupportEslint) {
2789 return safeExecution(() => {
2790 const prettierEslint = requireLocalPkg(u.fsPath, "prettier-eslint");
2791 return prettierEslint({
2794 fallbackPrettierOptions: prettierOptions
2798 if (vscodeConfig.stylelintIntegration && STYLE_PARSERS.includes(parser)) {
2799 const prettierStylelint = requireLocalPkg(u.fsPath, "prettier-stylelint");
2800 return safeExecution(prettierStylelint.format({
2804 }), text, fileName);
2806 if (!doesParserSupportEslint && useBundled) {
2807 let bundledPrettier = require("prettier");
2808 return safeExecution(() => {
2809 const warningMessage = `prettier@${bundledPrettier.version} doesn't support ${languageId}. Falling back to bundled prettier@${bundledPrettier.version}.`;
2810 addToOutput(warningMessage, "Warning");
2811 return bundledPrettier.format(text, prettierOptions);
2814 return safeExecution(() => resolvedPrettier.format(text, prettierOptions), text, fileName);
2816 function fullDocumentRange(document) {
2817 const lastLineId = document.lineCount - 1;
2818 let doc = import_coc5.workspace.getDocument(document.uri);
2820 start: {character: 0, line: 0},
2821 end: {character: doc.getline(lastLineId).length, line: lastLineId}
2824 var PrettierEditProvider = class {
2825 constructor(_fileIsIgnored) {
2826 this._fileIsIgnored = _fileIsIgnored;
2828 provideDocumentRangeFormattingEdits(document, range, _options, _token) {
2829 return this._provideEdits(document, {
2830 rangeStart: document.offsetAt(range.start),
2831 rangeEnd: document.offsetAt(range.end)
2834 provideDocumentFormattingEdits(document, _options, _token) {
2835 return this._provideEdits(document, {});
2837 async _provideEdits(document, options) {
2838 let fileName = import_coc5.Uri.parse(document.uri).fsPath;
2839 if (!document.uri.startsWith("untitled") && this._fileIsIgnored(fileName)) {
2840 return Promise.resolve([]);
2842 const code = await format(document.getText(), document, options);
2844 range: fullDocumentRange(document),
2847 const {disableSuccessMessage} = getConfig();
2848 if (edits && edits.length && !disableSuccessMessage) {
2849 import_coc5.window.showMessage("Formatted by prettier");
2851 addToOutput(`Formatted file: ${document.uri}`);
2852 addToOutput(`Prettier format edits: ${JSON.stringify(edits, null, 2)}`);
2856 var PrettierEditProvider_default = PrettierEditProvider;
2859 var formatterHandler;
2860 var rangeFormatterHandler;
2861 function disposeHandlers() {
2862 if (formatterHandler) {
2863 formatterHandler.dispose();
2865 if (rangeFormatterHandler) {
2866 rangeFormatterHandler.dispose();
2868 formatterHandler = void 0;
2869 rangeFormatterHandler = void 0;
2871 function selectors(prettierInstance) {
2872 let languageSelector = enabledLanguages(prettierInstance).reduce((curr, language) => {
2873 return curr.concat([
2874 {language, scheme: "file"},
2875 {language, scheme: "untitled"}
2878 let rangeLanguageSelector = rangeLanguages().reduce((curr, language) => {
2879 return curr.concat([
2880 {language, scheme: "file"},
2881 {language, scheme: "untitled"}
2886 rangeLanguageSelector
2890 return new Promise((resolve) => {
2896 async function activate(context) {
2897 context.subscriptions.push(setupErrorHandler());
2898 const {fileIsIgnored} = ignoreFileHandler_default(context.subscriptions);
2899 const editProvider = new PrettierEditProvider_default(fileIsIgnored);
2900 const statusItem = import_coc6.window.createStatusBarItem(0);
2901 context.subscriptions.push(statusItem);
2902 const config = import_coc6.workspace.getConfiguration("prettier");
2903 statusItem.text = config.get("statusItemText", "Prettier");
2904 let priority = config.get("formatterPriority", 1);
2905 const prettierInstance = await getPrettierInstance();
2906 if (!prettierInstance)
2908 async function checkDocument() {
2910 let doc = import_coc6.workspace.getDocument(import_coc6.workspace.bufnr);
2911 let languageIds = enabledLanguages(prettierInstance);
2912 if (doc && languageIds.indexOf(doc.filetype) !== -1) {
2918 function registerFormatter() {
2920 const {languageSelector, rangeLanguageSelector} = selectors(prettierInstance);
2921 rangeFormatterHandler = import_coc6.languages.registerDocumentRangeFormatProvider(rangeLanguageSelector, editProvider, priority);
2922 formatterHandler = import_coc6.languages.registerDocumentFormatProvider(languageSelector, editProvider, priority);
2924 registerFormatter();
2925 checkDocument().catch((_e) => {
2927 import_coc6.events.on("BufEnter", async () => {
2928 await checkDocument();
2929 }, null, context.subscriptions);
2930 context.subscriptions.push(configCacheHandler_default());
2931 context.subscriptions.push(import_coc6.commands.registerCommand("prettier.formatFile", async () => {
2932 let document = await import_coc6.workspace.document;
2933 let prettierConfig = import_coc6.workspace.getConfiguration("prettier", document.uri);
2934 let onlyUseLocalVersion = prettierConfig.get("onlyUseLocalVersion", false);
2935 if (onlyUseLocalVersion && (!hasLocalPrettierInstalled(import_coc6.Uri.parse(document.uri).fsPath) || document.schema != "file")) {
2936 import_coc6.window.showMessage(`Flag prettier.onlyUseLocalVersion is set, but prettier is not installed locally. No operation will be made.`, "warning");
2939 let edits = await format(document.content, document.textDocument, {}).then((code) => {
2943 range: fullDocumentRange(document.textDocument),
2947 if (edits && edits.length) {
2948 await document.applyEdits(edits);
2952 //# sourceMappingURL=index.js.map