UNPKG

prettier

Version:

Prettier is an opinionated code formatter

1,536 lines (1,521 loc) 219 kB
import { createRequire as __prettierCreateRequire } from "module"; import { fileURLToPath as __prettierFileUrlToPath } from "url"; import { dirname as __prettierDirname } from "path"; const require = __prettierCreateRequire(import.meta.url); const __filename = __prettierFileUrlToPath(import.meta.url); const __dirname = __prettierDirname(__filename); var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) { if (typeof require !== "undefined") return require.apply(this, arguments); throw Error('Dynamic require of "' + x + '" is not supported'); }); var __commonJS = (cb, mod) => function __require2() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __accessCheck = (obj, member, msg) => { if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateGet = (obj, member, getter) => { __accessCheck(obj, member, "read from private field"); return getter ? getter.call(obj) : member.get(obj); }; var __privateAdd = (obj, member, value) => { if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateSet = (obj, member, value, setter) => { __accessCheck(obj, member, "write to private field"); setter ? setter.call(obj, value) : member.set(obj, value); return value; }; var __privateWrapper = (obj, member, setter, getter) => ({ set _(value) { __privateSet(obj, member, value, setter); }, get _() { return __privateGet(obj, member, getter); } }); // node_modules/clone/clone.js var require_clone = __commonJS({ "node_modules/clone/clone.js"(exports, module) { var clone = function() { "use strict"; function clone2(parent, circular, depth, prototype) { var filter; if (typeof circular === "object") { depth = circular.depth; prototype = circular.prototype; filter = circular.filter; circular = circular.circular; } var allParents = []; var allChildren = []; var useBuffer = typeof Buffer != "undefined"; if (typeof circular == "undefined") circular = true; if (typeof depth == "undefined") depth = Infinity; function _clone(parent2, depth2) { if (parent2 === null) return null; if (depth2 == 0) return parent2; var child; var proto2; if (typeof parent2 != "object") { return parent2; } if (clone2.__isArray(parent2)) { child = []; } else if (clone2.__isRegExp(parent2)) { child = new RegExp(parent2.source, __getRegExpFlags(parent2)); if (parent2.lastIndex) child.lastIndex = parent2.lastIndex; } else if (clone2.__isDate(parent2)) { child = new Date(parent2.getTime()); } else if (useBuffer && Buffer.isBuffer(parent2)) { if (Buffer.allocUnsafe) { child = Buffer.allocUnsafe(parent2.length); } else { child = new Buffer(parent2.length); } parent2.copy(child); return child; } else { if (typeof prototype == "undefined") { proto2 = Object.getPrototypeOf(parent2); child = Object.create(proto2); } else { child = Object.create(prototype); proto2 = prototype; } } if (circular) { var index = allParents.indexOf(parent2); if (index != -1) { return allChildren[index]; } allParents.push(parent2); allChildren.push(child); } for (var i in parent2) { var attrs; if (proto2) { attrs = Object.getOwnPropertyDescriptor(proto2, i); } if (attrs && attrs.set == null) { continue; } child[i] = _clone(parent2[i], depth2 - 1); } return child; } return _clone(parent, depth); } clone2.clonePrototype = function clonePrototype(parent) { if (parent === null) return null; var c = function() { }; c.prototype = parent; return new c(); }; function __objToStr(o) { return Object.prototype.toString.call(o); } ; clone2.__objToStr = __objToStr; function __isDate(o) { return typeof o === "object" && __objToStr(o) === "[object Date]"; } ; clone2.__isDate = __isDate; function __isArray(o) { return typeof o === "object" && __objToStr(o) === "[object Array]"; } ; clone2.__isArray = __isArray; function __isRegExp(o) { return typeof o === "object" && __objToStr(o) === "[object RegExp]"; } ; clone2.__isRegExp = __isRegExp; function __getRegExpFlags(re) { var flags = ""; if (re.global) flags += "g"; if (re.ignoreCase) flags += "i"; if (re.multiline) flags += "m"; return flags; } ; clone2.__getRegExpFlags = __getRegExpFlags; return clone2; }(); if (typeof module === "object" && module.exports) { module.exports = clone; } } }); // node_modules/defaults/index.js var require_defaults = __commonJS({ "node_modules/defaults/index.js"(exports, module) { var clone = require_clone(); module.exports = function(options, defaults) { options = options || {}; Object.keys(defaults).forEach(function(key) { if (typeof options[key] === "undefined") { options[key] = clone(defaults[key]); } }); return options; }; } }); // node_modules/wcwidth/combining.js var require_combining = __commonJS({ "node_modules/wcwidth/combining.js"(exports, module) { module.exports = [ [768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531], [68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999] ]; } }); // node_modules/wcwidth/index.js var require_wcwidth = __commonJS({ "node_modules/wcwidth/index.js"(exports, module) { "use strict"; var defaults = require_defaults(); var combining = require_combining(); var DEFAULTS = { nul: 0, control: 0 }; module.exports = function wcwidth3(str) { return wcswidth(str, DEFAULTS); }; module.exports.config = function(opts) { opts = defaults(opts || {}, DEFAULTS); return function wcwidth3(str) { return wcswidth(str, opts); }; }; function wcswidth(str, opts) { if (typeof str !== "string") return wcwidth2(str, opts); var s = 0; for (var i = 0; i < str.length; i++) { var n = wcwidth2(str.charCodeAt(i), opts); if (n < 0) return -1; s += n; } return s; } function wcwidth2(ucs, opts) { if (ucs === 0) return opts.nul; if (ucs < 32 || ucs >= 127 && ucs < 160) return opts.control; if (bisearch(ucs)) return 0; return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi ucs >= 44032 && ucs <= 55203 || // Hangul Syllables ucs >= 63744 && ucs <= 64255 || // CJK Compatibility Ideographs ucs >= 65040 && ucs <= 65049 || // Vertical forms ucs >= 65072 && ucs <= 65135 || // CJK Compatibility Forms ucs >= 65280 && ucs <= 65376 || // Fullwidth Forms ucs >= 65504 && ucs <= 65510 || ucs >= 131072 && ucs <= 196605 || ucs >= 196608 && ucs <= 262141)); } function bisearch(ucs) { var min = 0; var max = combining.length - 1; var mid; if (ucs < combining[0][0] || ucs > combining[max][1]) return false; while (max >= min) { mid = Math.floor((min + max) / 2); if (ucs > combining[mid][1]) min = mid + 1; else if (ucs < combining[mid][0]) max = mid - 1; else return true; } return false; } } }); // node_modules/dashify/index.js var require_dashify = __commonJS({ "node_modules/dashify/index.js"(exports, module) { "use strict"; module.exports = (str, options) => { if (typeof str !== "string") throw new TypeError("expected a string"); return str.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\W/g, (m) => /[À-ž]/.test(m) ? m : "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, (m) => options && options.condense ? "-" : m).toLowerCase(); }; } }); // node_modules/minimist/index.js var require_minimist = __commonJS({ "node_modules/minimist/index.js"(exports, module) { "use strict"; function hasKey(obj, keys) { var o = obj; keys.slice(0, -1).forEach(function(key2) { o = o[key2] || {}; }); var key = keys[keys.length - 1]; return key in o; } function isNumber(x) { if (typeof x === "number") { return true; } if (/^0x[0-9a-f]+$/i.test(x)) { return true; } return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); } function isConstructorOrProto(obj, key) { return key === "constructor" && typeof obj[key] === "function" || key === "__proto__"; } module.exports = function(args, opts) { if (!opts) { opts = {}; } var flags = { bools: {}, strings: {}, unknownFn: null }; if (typeof opts.unknown === "function") { flags.unknownFn = opts.unknown; } if (typeof opts.boolean === "boolean" && opts.boolean) { flags.allBools = true; } else { [].concat(opts.boolean).filter(Boolean).forEach(function(key2) { flags.bools[key2] = true; }); } var aliases = {}; function aliasIsBoolean(key2) { return aliases[key2].some(function(x) { return flags.bools[x]; }); } Object.keys(opts.alias || {}).forEach(function(key2) { aliases[key2] = [].concat(opts.alias[key2]); aliases[key2].forEach(function(x) { aliases[x] = [key2].concat(aliases[key2].filter(function(y) { return x !== y; })); }); }); [].concat(opts.string).filter(Boolean).forEach(function(key2) { flags.strings[key2] = true; if (aliases[key2]) { [].concat(aliases[key2]).forEach(function(k) { flags.strings[k] = true; }); } }); var defaults = opts.default || {}; var argv = { _: [] }; function argDefined(key2, arg2) { return flags.allBools && /^--[^=]+$/.test(arg2) || flags.strings[key2] || flags.bools[key2] || aliases[key2]; } function setKey(obj, keys, value2) { var o = obj; for (var i2 = 0; i2 < keys.length - 1; i2++) { var key2 = keys[i2]; if (isConstructorOrProto(o, key2)) { return; } if (o[key2] === void 0) { o[key2] = {}; } if (o[key2] === Object.prototype || o[key2] === Number.prototype || o[key2] === String.prototype) { o[key2] = {}; } if (o[key2] === Array.prototype) { o[key2] = []; } o = o[key2]; } var lastKey = keys[keys.length - 1]; if (isConstructorOrProto(o, lastKey)) { return; } if (o === Object.prototype || o === Number.prototype || o === String.prototype) { o = {}; } if (o === Array.prototype) { o = []; } if (o[lastKey] === void 0 || flags.bools[lastKey] || typeof o[lastKey] === "boolean") { o[lastKey] = value2; } else if (Array.isArray(o[lastKey])) { o[lastKey].push(value2); } else { o[lastKey] = [o[lastKey], value2]; } } function setArg(key2, val, arg2) { if (arg2 && flags.unknownFn && !argDefined(key2, arg2)) { if (flags.unknownFn(arg2) === false) { return; } } var value2 = !flags.strings[key2] && isNumber(val) ? Number(val) : val; setKey(argv, key2.split("."), value2); (aliases[key2] || []).forEach(function(x) { setKey(argv, x.split("."), value2); }); } Object.keys(flags.bools).forEach(function(key2) { setArg(key2, defaults[key2] === void 0 ? false : defaults[key2]); }); var notFlags = []; if (args.indexOf("--") !== -1) { notFlags = args.slice(args.indexOf("--") + 1); args = args.slice(0, args.indexOf("--")); } for (var i = 0; i < args.length; i++) { var arg = args[i]; var key; var next; if (/^--.+=/.test(arg)) { var m = arg.match(/^--([^=]+)=([\s\S]*)$/); key = m[1]; var value = m[2]; if (flags.bools[key]) { value = value !== "false"; } setArg(key, value, arg); } else if (/^--no-.+/.test(arg)) { key = arg.match(/^--no-(.+)/)[1]; setArg(key, false, arg); } else if (/^--.+/.test(arg)) { key = arg.match(/^--(.+)/)[1]; next = args[i + 1]; if (next !== void 0 && !/^(-|--)[^-]/.test(next) && !flags.bools[key] && !flags.allBools && (aliases[key] ? !aliasIsBoolean(key) : true)) { setArg(key, next, arg); i += 1; } else if (/^(true|false)$/.test(next)) { setArg(key, next === "true", arg); i += 1; } else { setArg(key, flags.strings[key] ? "" : true, arg); } } else if (/^-[^-]+/.test(arg)) { var letters = arg.slice(1, -1).split(""); var broken = false; for (var j = 0; j < letters.length; j++) { next = arg.slice(j + 2); if (next === "-") { setArg(letters[j], next, arg); continue; } if (/[A-Za-z]/.test(letters[j]) && next[0] === "=") { setArg(letters[j], next.slice(1), arg); broken = true; break; } if (/[A-Za-z]/.test(letters[j]) && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { setArg(letters[j], next, arg); broken = true; break; } if (letters[j + 1] && letters[j + 1].match(/\W/)) { setArg(letters[j], arg.slice(j + 2), arg); broken = true; break; } else { setArg(letters[j], flags.strings[letters[j]] ? "" : true, arg); } } key = arg.slice(-1)[0]; if (!broken && key !== "-") { if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1]) && !flags.bools[key] && (aliases[key] ? !aliasIsBoolean(key) : true)) { setArg(key, args[i + 1], arg); i += 1; } else if (args[i + 1] && /^(true|false)$/.test(args[i + 1])) { setArg(key, args[i + 1] === "true", arg); i += 1; } else { setArg(key, flags.strings[key] ? "" : true, arg); } } } else { if (!flags.unknownFn || flags.unknownFn(arg) !== false) { argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg)); } if (opts.stopEarly) { argv._.push.apply(argv._, args.slice(i + 1)); break; } } } Object.keys(defaults).forEach(function(k) { if (!hasKey(argv, k.split("."))) { setKey(argv, k.split("."), defaults[k]); (aliases[k] || []).forEach(function(x) { setKey(argv, x.split("."), defaults[k]); }); } }); if (opts["--"]) { argv["--"] = notFlags.slice(); } else { notFlags.forEach(function(k) { argv._.push(k); }); } return argv; }; } }); // node_modules/diff/lib/diff/base.js var require_base = __commonJS({ "node_modules/diff/lib/diff/base.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = Diff; function Diff() { } Diff.prototype = { /*istanbul ignore start*/ /*istanbul ignore end*/ diff: function diff2(oldString, newString) { var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}; var callback = options.callback; if (typeof options === "function") { callback = options; options = {}; } this.options = options; var self = this; function done(value) { if (callback) { setTimeout(function() { callback(void 0, value); }, 0); return true; } else { return value; } } oldString = this.castInput(oldString); newString = this.castInput(newString); oldString = this.removeEmpty(this.tokenize(oldString)); newString = this.removeEmpty(this.tokenize(newString)); var newLen = newString.length, oldLen = oldString.length; var editLength = 1; var maxEditLength = newLen + oldLen; if (options.maxEditLength) { maxEditLength = Math.min(maxEditLength, options.maxEditLength); } var bestPath = [{ newPos: -1, components: [] }]; var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) { return done([{ value: this.join(newString), count: newString.length }]); } function execEditLength() { for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) { var basePath = ( /*istanbul ignore start*/ void 0 ); var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; if (addPath) { bestPath[diagonalPath - 1] = void 0; } var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen; if (!canAdd && !canRemove) { bestPath[diagonalPath] = void 0; continue; } if (!canAdd || canRemove && addPath.newPos < removePath.newPos) { basePath = clonePath(removePath); self.pushComponent(basePath.components, void 0, true); } else { basePath = addPath; basePath.newPos++; self.pushComponent(basePath.components, true, void 0); } _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath); if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) { return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken)); } else { bestPath[diagonalPath] = basePath; } } editLength++; } if (callback) { (function exec() { setTimeout(function() { if (editLength > maxEditLength) { return callback(); } if (!execEditLength()) { exec(); } }, 0); })(); } else { while (editLength <= maxEditLength) { var ret = execEditLength(); if (ret) { return ret; } } } }, /*istanbul ignore start*/ /*istanbul ignore end*/ pushComponent: function pushComponent(components, added, removed) { var last = components[components.length - 1]; if (last && last.added === added && last.removed === removed) { components[components.length - 1] = { count: last.count + 1, added, removed }; } else { components.push({ count: 1, added, removed }); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) { var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0; while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) { newPos++; oldPos++; commonCount++; } if (commonCount) { basePath.components.push({ count: commonCount }); } basePath.newPos = newPos; return oldPos; }, /*istanbul ignore start*/ /*istanbul ignore end*/ equals: function equals(left, right) { if (this.options.comparator) { return this.options.comparator(left, right); } else { return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase(); } }, /*istanbul ignore start*/ /*istanbul ignore end*/ removeEmpty: function removeEmpty(array2) { var ret = []; for (var i = 0; i < array2.length; i++) { if (array2[i]) { ret.push(array2[i]); } } return ret; }, /*istanbul ignore start*/ /*istanbul ignore end*/ castInput: function castInput(value) { return value; }, /*istanbul ignore start*/ /*istanbul ignore end*/ tokenize: function tokenize(value) { return value.split(""); }, /*istanbul ignore start*/ /*istanbul ignore end*/ join: function join(chars) { return chars.join(""); } }; function buildValues(diff2, components, newString, oldString, useLongestToken) { var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0; for (; componentPos < componentLen; componentPos++) { var component = components[componentPos]; if (!component.removed) { if (!component.added && useLongestToken) { var value = newString.slice(newPos, newPos + component.count); value = value.map(function(value2, i) { var oldValue = oldString[oldPos + i]; return oldValue.length > value2.length ? oldValue : value2; }); component.value = diff2.join(value); } else { component.value = diff2.join(newString.slice(newPos, newPos + component.count)); } newPos += component.count; if (!component.added) { oldPos += component.count; } } else { component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count)); oldPos += component.count; if (componentPos && components[componentPos - 1].added) { var tmp = components[componentPos - 1]; components[componentPos - 1] = components[componentPos]; components[componentPos] = tmp; } } } var lastComponent = components[componentLen - 1]; if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff2.equals("", lastComponent.value)) { components[componentLen - 2].value += lastComponent.value; components.pop(); } return components; } function clonePath(path10) { return { newPos: path10.newPos, components: path10.components.slice(0) }; } } }); // node_modules/diff/lib/util/params.js var require_params = __commonJS({ "node_modules/diff/lib/util/params.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOptions = generateOptions; function generateOptions(options, defaults) { if (typeof options === "function") { defaults.callback = options; } else if (options) { for (var name in options) { if (options.hasOwnProperty(name)) { defaults[name] = options[name]; } } } return defaults; } } }); // node_modules/diff/lib/diff/line.js var require_line = __commonJS({ "node_modules/diff/lib/diff/line.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.diffLines = diffLines; exports.diffTrimmedLines = diffTrimmedLines; exports.lineDiff = void 0; var _base = _interopRequireDefault(require_base()); var _params = require_params(); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var lineDiff = new /*istanbul ignore start*/ _base[ /*istanbul ignore start*/ "default" /*istanbul ignore end*/ ](); exports.lineDiff = lineDiff; lineDiff.tokenize = function(value) { var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/); if (!linesAndNewlines[linesAndNewlines.length - 1]) { linesAndNewlines.pop(); } for (var i = 0; i < linesAndNewlines.length; i++) { var line = linesAndNewlines[i]; if (i % 2 && !this.options.newlineIsToken) { retLines[retLines.length - 1] += line; } else { if (this.options.ignoreWhitespace) { line = line.trim(); } retLines.push(line); } } return retLines; }; function diffLines(oldStr, newStr, callback) { return lineDiff.diff(oldStr, newStr, callback); } function diffTrimmedLines(oldStr, newStr, callback) { var options = ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ /*istanbul ignore start*/ _params.generateOptions)(callback, { ignoreWhitespace: true }) ); return lineDiff.diff(oldStr, newStr, options); } } }); // node_modules/diff/lib/patch/create.js var require_create = __commonJS({ "node_modules/diff/lib/patch/create.js"(exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.structuredPatch = structuredPatch; exports.formatPatch = formatPatch; exports.createTwoFilesPatch = createTwoFilesPatch2; exports.createPatch = createPatch; var _line = require_line(); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { if (!options) { options = {}; } if (typeof options.context === "undefined") { options.context = 4; } var diff2 = ( /*istanbul ignore start*/ (0, /*istanbul ignore end*/ /*istanbul ignore start*/ _line.diffLines)(oldStr, newStr, options) ); if (!diff2) { return; } diff2.push({ value: "", lines: [] }); function contextLines(lines) { return lines.map(function(entry) { return " " + entry; }); } var hunks = []; var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1; var _loop = function _loop2(i2) { var current = diff2[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n"); current.lines = lines; if (current.added || current.removed) { var _curRange; if (!oldRangeStart) { var prev = diff2[i2 - 1]; oldRangeStart = oldLine; newRangeStart = newLine; if (prev) { curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : []; oldRangeStart -= curRange.length; newRangeStart -= curRange.length; } } (_curRange = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ lines.map(function(entry) { return (current.added ? "+" : "-") + entry; }) ) ); if (current.added) { newLine += lines.length; } else { oldLine += lines.length; } } else { if (oldRangeStart) { if (lines.length <= options.context * 2 && i2 < diff2.length - 2) { var _curRange2; (_curRange2 = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange2, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ contextLines(lines) ) ); } else { var _curRange3; var contextSize = Math.min(lines.length, options.context); (_curRange3 = /*istanbul ignore end*/ curRange).push.apply( /*istanbul ignore start*/ _curRange3, /*istanbul ignore start*/ _toConsumableArray( /*istanbul ignore end*/ contextLines(lines.slice(0, contextSize)) ) ); var hunk = { oldStart: oldRangeStart, oldLines: oldLine - oldRangeStart + contextSize, newStart: newRangeStart, newLines: newLine - newRangeStart + contextSize, lines: curRange }; if (i2 >= diff2.length - 2 && lines.length <= options.context) { var oldEOFNewline = /\n$/.test(oldStr); var newEOFNewline = /\n$/.test(newStr); var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines; if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) { curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file"); } if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) { curRange.push("\\ No newline at end of file"); } } hunks.push(hunk); oldRangeStart = 0; newRangeStart = 0; curRange = []; } } oldLine += lines.length; newLine += lines.length; } }; for (var i = 0; i < diff2.length; i++) { _loop( /*istanbul ignore end*/ i ); } return { oldFileName, newFileName, oldHeader, newHeader, hunks }; } function formatPatch(diff2) { var ret = []; if (diff2.oldFileName == diff2.newFileName) { ret.push("Index: " + diff2.oldFileName); } ret.push("==================================================================="); ret.push("--- " + diff2.oldFileName + (typeof diff2.oldHeader === "undefined" ? "" : " " + diff2.oldHeader)); ret.push("+++ " + diff2.newFileName + (typeof diff2.newHeader === "undefined" ? "" : " " + diff2.newHeader)); for (var i = 0; i < diff2.hunks.length; i++) { var hunk = diff2.hunks[i]; if (hunk.oldLines === 0) { hunk.oldStart -= 1; } if (hunk.newLines === 0) { hunk.newStart -= 1; } ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@"); ret.push.apply(ret, hunk.lines); } return ret.join("\n") + "\n"; } function createTwoFilesPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) { return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options)); } function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) { return createTwoFilesPatch2(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options); } } }); // node_modules/common-path-prefix/index.js var require_common_path_prefix = __commonJS({ "node_modules/common-path-prefix/index.js"(exports, module) { "use strict"; var { sep: DEFAULT_SEPARATOR } = __require("path"); var determineSeparator = (paths) => { for (const path10 of paths) { const match = /(\/|\\)/.exec(path10); if (match !== null) return match[0]; } return DEFAULT_SEPARATOR; }; module.exports = function commonPathPrefix2(paths, sep = determineSeparator(paths)) { const [first = "", ...remaining] = paths; if (first === "" || remaining.length === 0) return ""; const parts = first.split(sep); let endOfPrefix = parts.length; for (const path10 of remaining) { const compare = path10.split(sep); for (let i = 0; i < endOfPrefix; i++) { if (compare[i] !== parts[i]) { endOfPrefix = i; } } if (endOfPrefix === 0) return ""; } const prefix = parts.slice(0, endOfPrefix).join(sep); return prefix.endsWith(sep) ? prefix : prefix + sep; }; } }); // node_modules/flatted/cjs/index.js var require_cjs = __commonJS({ "node_modules/flatted/cjs/index.js"(exports) { "use strict"; var { parse: $parse, stringify: $stringify } = JSON; var { keys } = Object; var Primitive = String; var primitive = "string"; var ignore = {}; var object = "object"; var noop = (_, value) => value; var primitives = (value) => value instanceof Primitive ? Primitive(value) : value; var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value; var revive = (input, parsed, output, $) => { const lazy = []; for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) { const k = ke[y]; const value = output[k]; if (value instanceof Primitive) { const tmp = input[value]; if (typeof tmp === object && !parsed.has(tmp)) { parsed.add(tmp); output[k] = ignore; lazy.push({ k, a: [input, parsed, tmp, $] }); } else output[k] = $.call(output, k, tmp); } else if (output[k] !== ignore) output[k] = $.call(output, k, value); } for (let { length } = lazy, i = 0; i < length; i++) { const { k, a } = lazy[i]; output[k] = $.call(output, k, revive.apply(null, a)); } return output; }; var set = (known, input, value) => { const index = Primitive(input.push(value) - 1); known.set(value, index); return index; }; var parse = (text, reviver) => { const input = $parse(text, Primitives).map(primitives); const value = input[0]; const $ = reviver || noop; const tmp = typeof value === object && value ? revive(input, /* @__PURE__ */ new Set(), value, $) : value; return $.call({ "": tmp }, "", tmp); }; exports.parse = parse; var stringify4 = (value, replacer, space) => { const $ = replacer && typeof replacer === object ? (k, v) => k === "" || -1 < replacer.indexOf(k) ? v : void 0 : replacer || noop; const known = /* @__PURE__ */ new Map(); const input = []; const output = []; let i = +set(known, input, $.call({ "": value }, "", value)); let firstRun = !i; while (i < input.length) { firstRun = true; output[i] = $stringify(input[i++], replace, space); } return "[" + output.join(",") + "]"; function replace(key, value2) { if (firstRun) { firstRun = !firstRun; return value2; } const after = $.call(this, key, value2); switch (typeof after) { case object: if (after === null) return after; case primitive: return known.get(after) || set(known, input, after); } return after; } }; exports.stringify = stringify4; var toJSON = (any) => $parse(stringify4(any)); exports.toJSON = toJSON; var fromJSON = (any) => parse($stringify(any)); exports.fromJSON = fromJSON; } }); // node_modules/flat-cache/src/utils.js var require_utils = __commonJS({ "node_modules/flat-cache/src/utils.js"(exports, module) { var fs6 = __require("fs"); var path10 = __require("path"); var flatted = require_cjs(); module.exports = { tryParse: function(filePath, defaultValue) { var result; try { result = this.readJSON(filePath); } catch (ex) { result = defaultValue; } return result; }, /** * Read json file synchronously using flatted * * @method readJSON * @param {String} filePath Json filepath * @returns {*} parse result */ readJSON: function(filePath) { return flatted.parse( fs6.readFileSync(filePath, { encoding: "utf8" }) ); }, /** * Write json file synchronously using circular-json * * @method writeJSON * @param {String} filePath Json filepath * @param {*} data Object to serialize */ writeJSON: function(filePath, data) { fs6.mkdirSync(path10.dirname(filePath), { recursive: true }); fs6.writeFileSync(filePath, flatted.stringify(data)); } }; } }); // node_modules/fs.realpath/old.js var require_old = __commonJS({ "node_modules/fs.realpath/old.js"(exports) { var pathModule = __require("path"); var isWindows = process.platform === "win32"; var fs6 = __require("fs"); var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); function rethrow() { var callback; if (DEBUG) { var backtrace = new Error(); callback = debugCallback; } else callback = missingCallback; return callback; function debugCallback(err) { if (err) { backtrace.message = err.message; err = backtrace; missingCallback(err); } } function missingCallback(err) { if (err) { if (process.throwDeprecation) throw err; else if (!process.noDeprecation) { var msg = "fs: missing callback " + (err.stack || err.message); if (process.traceDeprecation) console.trace(msg); else console.error(msg); } } } } function maybeCallback(cb) { return typeof cb === "function" ? cb : rethrow(); } var normalize = pathModule.normalize; if (isWindows) { nextPartRe = /(.*?)(?:[\/\\]+|$)/g; } else { nextPartRe = /(.*?)(?:[\/]+|$)/g; } var nextPartRe; if (isWindows) { splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; } else { splitRootRe = /^[\/]*/; } var splitRootRe; exports.realpathSync = function realpathSync(p, cache) { p = pathModule.resolve(p); if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { return cache[p]; } var original = p, seenLinks = {}, knownHard = {}; var pos; var current; var base; var previous; start(); function start() { var m = splitRootRe.exec(p); pos = m[0].length; current = m[0]; base = m[0]; previous = ""; if (isWindows && !knownHard[base]) { fs6.lstatSync(base); knownHard[base] = true; } } while (pos < p.length) { nextPartRe.lastIndex = pos; var result = nextPartRe.exec(p); previous = current; current += result[0]; base = previous + result[1]; pos = nextPartRe.lastIndex; if (knownHard[base] || cache && cache[base] === base) { continue; } var resolvedLink; if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { resolvedLink = cache[base]; } else { var stat = fs6.lstatSync(base); if (!stat.isSymbolicLink()) { knownHard[base] = true; if (cache) cache[base] = base; continue; } var linkTarget = null; if (!isWindows) { var id = stat.dev.toString(32) + ":" + stat.ino.toString(32); if (seenLinks.hasOwnProperty(id)) { linkTarget = seenLinks[id]; } } if (linkTarget === null) { fs6.statSync(base); linkTarget = fs6.readlinkSync(base); } resolvedLink = pathModule.resolve(previous, linkTarget); if (cache) cache[base] = resolvedLink; if (!isWindows) seenLinks[id] = linkTarget; } p = pathModule.resolve(resolvedLink, p.slice(pos)); start(); } if (cache) cache[original] = p; return p; }; exports.realpath = function realpath(p, cache, cb) { if (typeof cb !== "function") { cb = maybeCallback(cache); cache = null; } p = pathModule.resolve(p); if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { return process.nextTick(cb.bind(null, null, cache[p])); } var original = p, seenLinks = {}, knownHard = {}; var pos; var current; var base; var previous; start(); function start() { var m = splitRootRe.exec(p); pos = m[0].length; current = m[0]; base = m[0]; previous = ""; if (isWindows && !knownHard[base]) { fs6.lstat(base, function(err) { if (err) return cb(err); knownHard[base] = true; LOOP(); }); } else { process.nextTick(LOOP); } } function LOOP() { if (pos >= p.length) { if (cache) cache[original] = p; return cb(null, p); } nextPartRe.lastIndex = pos; var result = nextPartRe.exec(p); previous = current; current += result[0]; base = previous + result[1]; pos = nextPartRe.lastIndex; if (knownHard[base] || cache && cache[base] === base) { return process.nextTick(LOOP); } if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { return gotResolvedLink(cache[base]); } return fs6.lstat(base, gotStat); } function gotStat(err, stat) { if (err) return cb(err); if (!stat.isSymbolicLink()) { knownHard[base] = true; if (cache) cache[base] = base; return process.nextTick(LOOP); } if (!isWindows) { var id = stat.dev.toString(32) + ":" + stat.ino.toString(32); if (seenLinks.hasOwnProperty(id)) { return gotTarget(null, seenLinks[id], base); } } fs6.stat(base, function(err2) { if (err2) return cb(err2); fs6.readlink(base, function(err3, target) { if (!isWindows) seenLinks[id] = target; gotTarget(err3, target); }); }); } function gotTarget(err, target, base2) { if (err) return cb(err); var resolvedLink = pathModule.resolve(previous, target); if (cache) cache[base2] = resolvedLink; gotResolvedLink(resolvedLink); } function gotResolvedLink(resolvedLink) { p = pathModule.resolve(resolvedLink, p.slice(p