diff --git a/ChangeLog b/ChangeLog index 3452feb..203921b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024.11.04, v3.18.5 + +feature: +- 134ae37 package: keywords: bun + 2024.11.04, v3.18.4 feature: diff --git a/bundle/putout.js b/bundle/putout.js index 99e72fc..41c5461 100644 --- a/bundle/putout.js +++ b/bundle/putout.js @@ -174,15 +174,15 @@ var versions = {}; var release$1 = {}; var config = {}; -function noop$7() {} +function noop$6() {} -var on = noop$7; -var addListener = noop$7; -var once$a = noop$7; -var off = noop$7; -var removeListener = noop$7; -var removeAllListeners = noop$7; -var emit = noop$7; +var on = noop$6; +var addListener = noop$6; +var once$a = noop$6; +var off = noop$6; +var removeListener = noop$6; +var removeAllListeners = noop$6; +var emit = noop$6; function binding(name) { throw new Error('process.binding is not supported'); @@ -257,7 +257,7 @@ var lookup = []; var revLookup = []; var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; var inited = false; -function init$5 () { +function init$4 () { inited = true; var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; for (var i = 0, len = code.length; i < len; ++i) { @@ -271,7 +271,7 @@ function init$5 () { function toByteArray (b64) { if (!inited) { - init$5(); + init$4(); } var i, j, l, tmp, placeHolders, arr; var len = b64.length; @@ -330,7 +330,7 @@ function encodeChunk (uint8, start, end) { function fromByteArray (uint8) { if (!inited) { - init$5(); + init$4(); } var tmp; var len = uint8.length; @@ -450,7 +450,7 @@ function write (buffer, value, offset, isLE, mLen, nBytes) { var toString = {}.toString; -var isArray$j = Array.isArray || function (arr) { +var isArray$i = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; @@ -734,7 +734,7 @@ function fromObject (that, obj) { return fromArrayLike(that, obj) } - if (obj.type === 'Buffer' && isArray$j(obj.data)) { + if (obj.type === 'Buffer' && isArray$i(obj.data)) { return fromArrayLike(that, obj.data) } } @@ -799,7 +799,7 @@ Buffer.isEncoding = function isEncoding (encoding) { }; Buffer.concat = function concat (list, length) { - if (!isArray$j(list)) { + if (!isArray$i(list)) { throw new TypeError('"list" argument must be an Array of Buffers') } @@ -2448,7 +2448,7 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || var formatRegExp = /%[sdj%]/g; function format(f) { - if (!isString$f(f)) { + if (!isString$e(f)) { var objects = []; for (var i = 0; i < arguments.length; i++) { objects.push(inspect(arguments[i])); @@ -2641,7 +2641,7 @@ function formatValue(ctx, value, recurseTimes) { // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes, ctx); - if (!isString$f(ret)) { + if (!isString$e(ret)) { ret = formatValue(ctx, ret, recurseTimes); } return ret; @@ -2688,7 +2688,7 @@ function formatValue(ctx, value, recurseTimes) { var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array - if (isArray$i(value)) { + if (isArray$h(value)) { array = true; braces = ['[', ']']; } @@ -2746,7 +2746,7 @@ function formatValue(ctx, value, recurseTimes) { function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); - if (isString$f(value)) { + if (isString$e(value)) { var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; @@ -2867,7 +2867,7 @@ function reduceToSingleString(output, base, braces) { // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. -function isArray$i(ar) { +function isArray$h(ar) { return Array.isArray(ar); } @@ -2887,7 +2887,7 @@ function isNumber$3(arg) { return typeof arg === 'number'; } -function isString$f(arg) { +function isString$e(arg) { return typeof arg === 'string'; } @@ -3094,12 +3094,12 @@ var _polyfillNode_util = { isRegExp: isRegExp$1, isUndefined: isUndefined, isSymbol: isSymbol, - isString: isString$f, + isString: isString$e, isNumber: isNumber$3, isNullOrUndefined: isNullOrUndefined, isNull: isNull$1, isBoolean: isBoolean, - isArray: isArray$i, + isArray: isArray$h, inspect: inspect, deprecate: deprecate, format: format, @@ -3118,7 +3118,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({ format: format, inherits: inherits$1, inspect: inspect, - isArray: isArray$i, + isArray: isArray$h, isBoolean: isBoolean, isBuffer: isBuffer, isDate: isDate, @@ -3130,7 +3130,7 @@ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({ isObject: isObject$6, isPrimitive: isPrimitive$1, isRegExp: isRegExp$1, - isString: isString$f, + isString: isString$e, isSymbol: isSymbol, isUndefined: isUndefined, log: log$6, @@ -8990,7 +8990,7 @@ __export(lib_exports, { return newExpression$1; }, Noop: function() { - return noop$6; + return noop$5; }, NullLiteral: function() { return nullLiteral; @@ -11312,7 +11312,7 @@ __export(lib_exports, { return isPrivateName; }, isProgram: function() { - return isProgram$7; + return isProgram$6; }, isProperty: function() { return isProperty$1; @@ -11825,7 +11825,7 @@ __export(lib_exports, { return newExpression$1; }, noop: function() { - return noop$6; + return noop$5; }, nullLiteral: function() { return nullLiteral; @@ -13999,7 +13999,7 @@ function isNewExpression(node, opts) { if (node.type !== "NewExpression") return false; return opts == null || shallowEqual(node, opts); } -function isProgram$7(node, opts) { +function isProgram$6(node, opts) { if (!node) return false; if (node.type !== "Program") return false; return opts == null || shallowEqual(node, opts); @@ -23216,7 +23216,7 @@ function jsxClosingFragment() { type: "JSXClosingFragment" }; } -function noop$6() { +function noop$5() { return { type: "Noop" }; @@ -27414,7 +27414,7 @@ var TokContext = function TokContext(token, preserveSpace) { this.token = token; this.preserveSpace = !!preserveSpace; }; -var types$A = { +var types$z = { brace: new TokContext("{"), j_oTag: new TokContext(" { +var fullstore$5 = (value) => { const data = { value, }; @@ -78662,9 +78662,9 @@ var fullstore$6 = (value) => { }; }; -var types$y = {}; +var types$x = {}; -types$y.TYPES = { +types$x.TYPES = { TOKEN: 'Token', NEWLINE: 'Newline', LINEBREAK: 'Linebreak', @@ -78684,7 +78684,7 @@ var arrowFunctionExpression = {}; var is$3 = {}; -const {types: types$x} = bundle; +const {types: types$w} = bundle; const { isStringLiteral: isStringLiteral$9, isSpreadElement: isSpreadElement$3, @@ -78696,7 +78696,7 @@ const { isMemberExpression: isMemberExpression$5, isArrayExpression: isArrayExpression$4, isObjectExpression: isObjectExpression$6, -} = types$x; +} = types$w; const isParentProgram$1 = (path) => path.parentPath?.isProgram(); const isParentBlock$3 = (path) => path.parentPath.isBlockStatement(); @@ -78875,7 +78875,7 @@ maybeInsideFn$1.maybeInsideFn = (insideFn, {print, indent}) => { indent.dec(); }; -const {types: types$w} = bundle; +const {types: types$v} = bundle; const { hasTrailingComment: hasTrailingComment$4, satisfy: satisfy$4, @@ -78891,7 +78891,7 @@ const { isClassProperty, isTSPropertySignature, isSpreadElement: isSpreadElement$2, -} = types$w; +} = types$v; const isProperty = satisfy$4([ isObjectProperty$1, @@ -79630,7 +79630,7 @@ var memberExpressions$1 = {}; var chain$1 = {}; -const {assign: assign$f} = Object; +const {assign: assign$e} = Object; chain$1.chain = (path) => { const all = [ @@ -79695,7 +79695,7 @@ function build(path) { }; if (path.isCallExpression()) - assign$f(prop, { + assign$e(prop, { args: path.node.arguments.length, name: path.node.callee.property?.name || '', }); @@ -79929,12 +79929,12 @@ var callExpression = {}; const {exists: exists$c} = is$3; const {maybeParens: maybeParens$4} = maybeParens$8; -const {isArray: isArray$h} = Array; +const {isArray: isArray$g} = Array; const parseArgs = (path) => { const argsPath = path.get('arguments'); - if (!isArray$h(argsPath)) + if (!isArray$g(argsPath)) return []; return argsPath; @@ -80071,8 +80071,8 @@ const { const {parseComments: parseComments$4} = comment; const {likeChain} = memberExpressions$1; -const {types: types$v} = bundle; -const {isStringLiteral: isStringLiteral$8} = types$v; +const {types: types$u} = bundle; +const {isStringLiteral: isStringLiteral$8} = types$u; const isBodyOfArrow = (path) => path.parentPath.node.body === path.node; const isLogical = (path) => path.get('argument').isLogicalExpression(); @@ -80781,13 +80781,13 @@ var operate = {}; var getBinding$2 = {}; -const {types: types$u} = bundle; +const {types: types$t} = bundle; const { isIdentifier: isIdentifier$8, isMemberExpression: isMemberExpression$3, -} = types$u; +} = types$t; -const isString$e = (a) => typeof a === 'string'; +const isString$d = (a) => typeof a === 'string'; getBinding$2.getBinding = getBinding$1; function getBinding$1(path, node) { @@ -80798,7 +80798,7 @@ function getBinding$1(path, node) { getBinding$2.getBindingPath = (path, name) => getBinding$1(path, name)?.path; const parseName$1 = (node) => { - if (isString$e(node)) + if (isString$d(node)) return node; if (isIdentifier$8(node)) @@ -80812,13 +80812,13 @@ const parseName$1 = (node) => { var isSimple$2 = {}; -const {types: types$t} = bundle; +const {types: types$s} = bundle; const { isOptionalMemberExpression, isMemberExpression: isMemberExpression$2, isIdentifier: isIdentifier$7, isLiteral: isLiteral$3, -} = types$t; +} = types$s; isSimple$2.isSimple = (a) => { if (isLiteral$3(a)) @@ -80835,7 +80835,7 @@ isSimple$2.isSimple = (a) => { var extract$6 = {}; -const {types: types$s} = bundle; +const {types: types$r} = bundle; const { isArrayExpression: isArrayExpression$3, isLiteral: isLiteral$2, @@ -80849,7 +80849,7 @@ const { isJSXAttribute: isJSXAttribute$1, isTSTypeReference: isTSTypeReference$2, isTSTypeParameter, -} = types$s; +} = types$r; extract$6.extract = extract$5; @@ -81173,9 +81173,9 @@ rename$1.rename = (path, from, to) => { bindingPath.scope.rename(from, to); }; -var setLiteralValue$5 = {}; +var setLiteralValue$4 = {}; -setLiteralValue$5.setLiteralValue = (path, newValue) => { +setLiteralValue$4.setLiteralValue = (path, newValue) => { const node = path.node || path; const { raw, @@ -81232,15 +81232,15 @@ function isRequire$1(path) { var properties = {}; -var traverseProperties$7 = {}; +var traverseProperties$6 = {}; -const {traverse: traverse$b, types: types$r} = bundle; +const {traverse: traverse$b, types: types$q} = bundle; const {extract: extract$3} = extract$6; const { isObjectExpression: isObjectExpression$5, isCallExpression: isCallExpression$3, -} = types$r; +} = types$q; const nodeOrPath = (path) => path.node || path; @@ -81257,7 +81257,7 @@ function getNode(path) { }; } -traverseProperties$7.traverseProperties = (path, name, {firstLevel = false} = {}) => { +traverseProperties$6.traverseProperties = (path, name, {firstLevel = false} = {}) => { const collector = []; const node = getNode(path); @@ -81297,9 +81297,9 @@ const { isObjectPattern: isObjectPattern$1, } = bundle.types; const {extract: extract$2} = extract$6; -const {traverseProperties: traverseProperties$6} = traverseProperties$7; +const {traverseProperties: traverseProperties$5} = traverseProperties$6; -properties.traverseProperties = traverseProperties$6; +properties.traverseProperties = traverseProperties$5; properties.getProperties = (path, names) => { const result = {}; @@ -81341,7 +81341,7 @@ properties.getProperty = (path, name) => { var getLiteralRaw$1 = {}; -const isString$d = (a) => typeof a === 'string'; +const isString$c = (a) => typeof a === 'string'; getLiteralRaw$1.getLiteralRaw = (path) => { const { @@ -81350,10 +81350,10 @@ getLiteralRaw$1.getLiteralRaw = (path) => { value, } = path.node || path; - if (isString$d(raw)) + if (isString$c(raw)) return raw; - if (extra && isString$d(extra.raw)) + if (extra && isString$c(extra.raw)) return extra.raw; return `'${maybeEncode$1(value)}'`; @@ -81372,13 +81372,13 @@ var replaceWithMultiple$2 = {}; var maybeBody$2 = {}; -const {types: types$q} = bundle; +const {types: types$p} = bundle; const { isStatement: isStatement$4, isBlockStatement: isBlockStatement$3, BlockStatement: BlockStatement$1, ExpressionStatement: ExpressionStatement$5, -} = types$q; +} = types$p; maybeBody$2.maybeBody = (path, node) => { const {parentPath} = path; @@ -81399,12 +81399,12 @@ maybeBody$2.maybeBody = (path, node) => { var toExpression$3 = {}; -const {types: types$p} = bundle; +const {types: types$o} = bundle; const { isExpression: isExpression$1, ExpressionStatement: ExpressionStatement$4, toStatement, -} = types$p; +} = types$o; toExpression$3.toExpression = (el) => { const {type} = el; @@ -81454,7 +81454,7 @@ replaceWithMultiple$2.replaceWithMultiple = (path, nodes) => { var replaceWith$6 = {}; const {maybeBody} = maybeBody$2; -const {assign: assign$e} = Object; +const {assign: assign$d} = Object; replaceWith$6.replaceWith = (path, node) => { if (path?.parentPath?.isExpressionStatement() && !path.parentPath.isProgram()) @@ -81465,7 +81465,7 @@ replaceWith$6.replaceWith = (path, node) => { currentPath.replaceWith(node); - assign$e(currentPath.node, { + assign$d(currentPath.node, { comments, loc, }); @@ -81481,7 +81481,7 @@ replaceWith$7.replaceWith = replaceWith$5; replaceWith$7.replaceWithMultiple = replaceWithMultiple$1; replaceWith$7.toExpression = toExpression$1; -const {types: types$o} = bundle; +const {types: types$n} = bundle; const {getBinding, getBindingPath} = getBinding$2; const {isSimple: isSimple$1} = isSimple$2; @@ -81491,13 +81491,13 @@ const {remove: remove$1} = remove$2; const {getExportDefault} = getExportDefault$1; const {rename} = rename$1; const {renameProperty} = renameProperty$2; -const {setLiteralValue: setLiteralValue$4} = setLiteralValue$5; +const {setLiteralValue: setLiteralValue$3} = setLiteralValue$4; const {getPathAfterRequires} = getPathAfterRequires$1; const { - getProperty: getProperty$6, + getProperty: getProperty$5, getProperties, - traverseProperties: traverseProperties$5, + traverseProperties: traverseProperties$4, } = properties; const {getLiteralRaw} = getLiteralRaw$1; @@ -81514,7 +81514,7 @@ const { isImportDeclaration: isImportDeclaration$1, isExportDeclaration: isExportDeclaration$4, isStatement: isStatement$3, -} = types$o; +} = types$n; operate.getBinding = getBinding; operate.getBindingPath = getBindingPath; @@ -81527,11 +81527,11 @@ operate.toExpression = toExpression; operate.isSimple = isSimple$1; operate.rename = rename; operate.renameProperty = renameProperty; -operate.setLiteralValue = setLiteralValue$4; +operate.setLiteralValue = setLiteralValue$3; -operate.getProperty = getProperty$6; +operate.getProperty = getProperty$5; operate.getProperties = getProperties; -operate.traverseProperties = traverseProperties$5; +operate.traverseProperties = traverseProperties$4; operate.replaceWithMultiple = replaceWithMultiple; @@ -81896,13 +81896,13 @@ newline.isCurrentNewLine = (path) => { var indent = {}; -const {types: types$n} = bundle; +const {types: types$m} = bundle; const {isIndented} = is$3; const { isStringLiteral: isStringLiteral$5, isArrayExpression: isArrayExpression$1, -} = types$n; +} = types$m; const isInsideArray$1 = (path) => path.parentPath.isArrayExpression(); @@ -81965,7 +81965,7 @@ isObjectAfterSimple$1.isObjectAfterSimple = (a) => { return SIMPLE_TYPES.includes(type); }; -const {types: types$m} = bundle; +const {types: types$l} = bundle; const { isCoupleLines: isCoupleLines$5, isStringAndIdentifier, @@ -81995,7 +81995,7 @@ const { isStringLiteral: isStringLiteral$4, isIdentifier: isIdentifier$5, isFunction: isFunction$2, -} = types$m; +} = types$l; const isNextString = (path) => isStringLiteral$4(path.getNextSibling()); const isPrevString = (path) => isStringLiteral$4(path.getPrevSibling()); @@ -82449,19 +82449,19 @@ staticBlock.StaticBlock = (path, {print, traverse}) => { var recordExpression = {}; -const {ObjectExpression: ObjectExpression$6} = objectExpression; +const {ObjectExpression: ObjectExpression$5} = objectExpression; recordExpression.RecordExpression = (path, operations, semantics) => { const {write} = operations; write('#'); - ObjectExpression$6(path, operations, semantics); + ObjectExpression$5(path, operations, semantics); }; var tupleExpression = {}; var maybe = {}; -const isString$c = (a) => typeof a === 'string'; +const isString$b = (a) => typeof a === 'string'; const constant = (a) => () => a; const {keys: keys$3} = Object; @@ -82487,7 +82487,7 @@ var rendy$1 = (template, values, modifiers) => { }; function check$c(template, values) { - if (!isString$c(template)) + if (!isString$b(template)) throw Error('template should be a string!'); if (typeof values !== 'object') @@ -82549,7 +82549,7 @@ const rendy = rendy$1; const maybeSatisfy = satisfy_1; const { - isProgram: isProgram$6, + isProgram: isProgram$5, isFile: isFile$1, File, ExpressionStatement: ExpressionStatement$2, @@ -82571,7 +82571,7 @@ maybe.maybeThrow = (a, path, b) => { const maybeStatement = (ast) => isStatement$2(ast) ? ast : ExpressionStatement$2(ast); -const maybeProgram = (ast) => isProgram$6(ast) ? ast : Program$1([ +const maybeProgram = (ast) => isProgram$5(ast) ? ast : Program$1([ maybeStatement(ast), ]); @@ -82604,13 +82604,13 @@ function objectPlugin(plugin, path, printer, options) { after(path, printer); } -const {ArrayExpression: ArrayExpression$7} = arrayExpression; +const {ArrayExpression: ArrayExpression$6} = arrayExpression; const {maybeVisitor: maybeVisitor$2} = maybe; tupleExpression.TupleExpression = (path, operations, semantics) => { const {write} = operations; write('#'); - maybeVisitor$2(ArrayExpression$7, path, operations, semantics); + maybeVisitor$2(ArrayExpression$6, path, operations, semantics); }; var importExpression = {}; @@ -82648,8 +82648,8 @@ const { const {NewExpression} = newExpression; -const {ObjectExpression: ObjectExpression$5} = objectExpression; -const {ObjectProperty: ObjectProperty$6} = objectProperty; +const {ObjectExpression: ObjectExpression$4} = objectExpression; +const {ObjectProperty: ObjectProperty$5} = objectProperty; const {ObjectPattern: ObjectPattern$1} = objectPattern; const { @@ -82660,7 +82660,7 @@ const { } = classProperty; const {AssignmentExpression} = assignmentExpression; -const {ArrayExpression: ArrayExpression$6} = arrayExpression; +const {ArrayExpression: ArrayExpression$5} = arrayExpression; const {ArrayPattern} = arrayPattern; const {AssignmentPattern} = assignmentPattern; const {RestElement} = restElement; @@ -82684,7 +82684,7 @@ var expressions$1 = { ...unaryExpressions, ...memberExpressions, ArrayPattern, - ArrayExpression: ArrayExpression$6, + ArrayExpression: ArrayExpression$5, AssignmentExpression, AssignmentPattern, BinaryExpression, @@ -82698,8 +82698,8 @@ var expressions$1 = { NewExpression, LogicalExpression, OptionalCallExpression, - ObjectExpression: ObjectExpression$5, - ObjectProperty: ObjectProperty$6, + ObjectExpression: ObjectExpression$4, + ObjectProperty: ObjectProperty$5, ObjectPattern: ObjectPattern$1, PrivateName: PrivateName$1, RestElement, @@ -84412,7 +84412,7 @@ const {TemplateLiteral} = templateLiteral; const {Identifier: Identifier$2} = identifier; const {Decorator} = decorator; -const {StringLiteral: StringLiteral$8} = stringLiteral; +const {StringLiteral: StringLiteral$7} = stringLiteral; var literals$1 = { Identifier: Identifier$2, @@ -84443,7 +84443,7 @@ var literals$1 = { BooleanLiteral(path, {write}) { write(path.node.value); }, - StringLiteral: StringLiteral$8, + StringLiteral: StringLiteral$7, RegExpLiteral(path, {print}) { const {raw, pattern} = path.node; print(raw || `/${pattern}/`); @@ -84550,8 +84550,8 @@ tsTypeAliasDeclaration.TSTypeAliasDeclaration = { var tsMappedType = {}; -const {types: types$l} = bundle; -const {isTSConditionalType} = types$l; +const {types: types$k} = bundle; +const {isTSConditionalType} = types$k; tsMappedType.TSMappedType = (path, {print, indent, maybe}) => { const { @@ -85019,20 +85019,37 @@ tsTupleType.TSTupleType = (path, {write, traverse, indent, maybe}) => { write('['); indent.inc(); - maybe.write.newline(elementTypes.length); - for (const elementType of elementTypes) { - indent(); + const isSame = isSameType(elementTypes); + maybe.write.newline(isSame && elementTypes.length); + const n = elementTypes.length - 1; + + for (const [i, elementType] of elementTypes.entries()) { + maybe.indent(isSame); traverse(elementType); - write(','); - write.newline(); + maybe.write(i < n || isSame, ','); + maybe.write.newline(isSame); + maybe.write.space(i < n && !isSame); } indent.dec(); - indent(); + maybe.indent(isSame && elementTypes.length); write(']'); }; +function isSameType(array) { + let type; + + for (const current of array) { + if (type && current.type !== type) + return false; + + ({type} = current); + } + + return true; +} + var tsNamedTupleMember = {}; tsNamedTupleMember.TSNamedTupleMember = (path, {print}) => { @@ -85707,7 +85724,7 @@ function snakeCase(str) { } const {stringify: stringify$8} = JSON; -const {TYPES: TYPES$2} = types$y; +const {TYPES: TYPES$2} = types$x; const toSnakeCase = justSnakeCase; const {codeFrameColumns: codeFrameColumns$1} = bundle; @@ -85875,10 +85892,10 @@ function initSemantics(semantics = {}) { } const {round} = Math; -const fullstore$5 = fullstore$6; +const fullstore$4 = fullstore$5; const isObject$4 = (a) => a && typeof a === 'object'; const babelTraverse$2 = bundle.traverse; -const {TYPES: TYPES$1} = types$y; +const {TYPES: TYPES$1} = types$x; const baseVisitors = visitors$1; const { @@ -85897,8 +85914,8 @@ const { const {parseOverrides} = overrides; -const isString$b = (a) => typeof a === 'string'; -const {assign: assign$d, freeze} = Object; +const isString$a = (a) => typeof a === 'string'; +const {assign: assign$c, freeze} = Object; const GET = '__'; const get = (path, command) => path.get(command.replace(GET, '')); @@ -85949,7 +85966,7 @@ tokenize$1.tokenize = (ast, overrides) => { }); }; - assign$d(indent, { + assign$c(indent, { inc: incIndent, dec: decIndent, }); @@ -85999,7 +86016,7 @@ tokenize$1.tokenize = (ast, overrides) => { }); }; - assign$d(write, { + assign$c(write, { indent, newline, linebreak, @@ -86010,7 +86027,7 @@ tokenize$1.tokenize = (ast, overrides) => { endOfFile, }); - assign$d(maybeWrite, { + assign$c(maybeWrite, { newline: maybeNewline, breakline: maybeBreakline, linebreak: maybeLinebreak, @@ -86024,7 +86041,7 @@ tokenize$1.tokenize = (ast, overrides) => { space: maybeSpace, }; - assign$d(maybe.indent, { + assign$c(maybe.indent, { inc: maybeIndentInc, dec: maybeIndentDec, }); @@ -86037,7 +86054,7 @@ tokenize$1.tokenize = (ast, overrides) => { traverse, maybe, quote, - store: fullstore$5(), + store: fullstore$4(), }); const currentTraversers = { @@ -86067,7 +86084,7 @@ tokenize$1.tokenize = (ast, overrides) => { traverse, }); - assign$d(print, write, { + assign$c(print, write, { space, round, }); @@ -86079,14 +86096,14 @@ tokenize$1.tokenize = (ast, overrides) => { const maybePrint = (a, b) => a && print(b); - assign$d(maybePrint, { + assign$c(maybePrint, { newline: maybeNewline, breakline: maybeBreakline, linebreak: maybeLinebreak, space: maybeSpace, }); - assign$d(printer.maybe, { + assign$c(printer.maybe, { print: maybePrint, }); @@ -86129,7 +86146,7 @@ const createPrint = (path, {traverse, write}) => (maybeLine) => { }; const computePath = (path, maybeLine) => { - if (isString$b(maybeLine) && maybeLine.startsWith(GET)) + if (isString$a(maybeLine) && maybeLine.startsWith(GET)) return get(path, maybeLine); if (isObject$4(maybeLine)) @@ -86347,9 +86364,9 @@ const putoutPrinter = printer; const {generate: generate$5} = bundle; const {stringify: stringify$7} = JSON; -const {isArray: isArray$g} = Array; +const {isArray: isArray$f} = Array; -const maybeArray$a = (a) => isArray$g(a) ? a : [a, {}]; +const maybeArray$9 = (a) => isArray$f(a) ? a : [a, {}]; const btoa$1 = (a) => Buffer.from(a, 'binary').toString('base64'); @@ -86358,7 +86375,7 @@ const fixStrictMode = (a) => a.replace(`\n\n\n'use strict'`, `\n\n'use strict'`) var print$4 = (ast, options = {}) => { const {sourceMapName} = options; - const [printer = 'putout', printerOptions] = maybeArray$a(options.printer); + const [printer = 'putout', printerOptions] = maybeArray$9(options.printer); if (printer === 'recast') { const printOptions = { @@ -86402,7 +86419,7 @@ const { ObjectMethod, } = bundle.types; -const {assign: assign$c} = Object; +const {assign: assign$b} = Object; var traverseObjectExpression$1 = (propertiesPaths) => { for (const propPath of propertiesPaths) { @@ -86416,7 +86433,7 @@ var traverseObjectExpression$1 = (propertiesPaths) => { if (method && isFunctionExpression(value)) { propPath.replaceWith(ObjectMethod('method', key, value.params, value.body, computed)); - assign$c(propPath.node, { + assign$b(propPath.node, { id: null, method: true, generator: value.generator, @@ -86445,7 +86462,7 @@ const { Identifier: Identifier$1, } = bundle.types; -const {assign: assign$b} = Object; +const {assign: assign$a} = Object; var setClassMethod$1 = (path) => { const {node} = path; @@ -86473,7 +86490,7 @@ var setClassMethod$1 = (path) => { }); path.replaceWith(method); - assign$b(path.node, { + assign$a(path.node, { loc, expression, generator, @@ -86567,12 +86584,12 @@ var convertImportDeclaration$1 = (path) => { path.node.attributes = attributes; }; -const {assign: assign$a} = Object; +const {assign: assign$9} = Object; var convertExportDeclaration$1 = (path) => { const {attributes = []} = path.node; - assign$a(path.node, { + assign$9(path.node, { attributes, }); }; @@ -86701,7 +86718,7 @@ function getCommentGroup({trailing, leading}) { return 'innerComments'; // Dangling comments, such as `[/* a */]`. } -const isString$a = (a) => typeof a === 'string'; +const isString$9 = (a) => typeof a === 'string'; const isNumber$1 = (a) => typeof a === 'number'; const isNull = (a) => a === null; const isBool$3 = (a) => typeof a === 'boolean'; @@ -86717,7 +86734,7 @@ var setLiteral$1 = (node) => { return; } - if (isString$a(value)) { + if (isString$9(value)) { node.type = 'StringLiteral'; return; } @@ -86773,7 +86790,7 @@ var getAst = (node) => { return ast; }; -const {traverse: traverse$a, types: types$k} = bundle; +const {traverse: traverse$a, types: types$j} = bundle; const traverseObjectExpression = traverseObjectExpression$1; const setClassMethod = setClassMethod$1; @@ -86799,7 +86816,7 @@ const getAST = getAst; const { isObjectExpression, isExportDeclaration, -} = types$k; +} = types$j; var estreeToBabel = (node) => { const ast = getAST(node); @@ -94381,7 +94398,7 @@ const options = options$1; const getFlow = (a) => !a.indexOf('// @flow'); const clean = (a) => a.filter(Boolean); const initBabel = once$6(() => bundle); -const {assign: assign$9} = Object; +const {assign: assign$8} = Object; // There is a difference in options naming for babel and recast // recast -> sourceFileName @@ -94403,7 +94420,7 @@ babel$1.parse = function babelParse(source, {sourceFilename, isTS, isJSX = true, ]), }; - sourceFilename && assign$9(parserOptions, { + sourceFilename && assign$8(parserOptions, { sourceFilename, }); @@ -107198,7 +107215,7 @@ function isAbsolute(path) { } // posix version -function join$6() { +function join$5() { var paths = Array.prototype.slice.call(arguments, 0); return normalize(filter$1(paths, function(p, index) { if (typeof p !== 'string') { @@ -107273,7 +107290,7 @@ function dirname$1(path) { return root + dir; } -function basename$6(path, ext) { +function basename$5(path, ext) { var f = splitPath(path)[2]; // TODO: make this comparison case-insensitive on windows? if (ext && f.substr(-1 * ext.length) === ext) { @@ -107288,12 +107305,12 @@ function extname(path) { } var _polyfillNode_path = { extname: extname, - basename: basename$6, + basename: basename$5, dirname: dirname$1, sep: sep, delimiter: delimiter, relative: relative$1, - join: join$6, + join: join$5, isAbsolute: isAbsolute, normalize: normalize, resolve: resolve @@ -107318,13 +107335,13 @@ var substr = 'ab'.substr(-1) === 'b' ? var _polyfillNode_path$1 = /*#__PURE__*/Object.freeze({ __proto__: null, - basename: basename$6, + basename: basename$5, default: _polyfillNode_path, delimiter: delimiter, dirname: dirname$1, extname: extname, isAbsolute: isAbsolute, - join: join$6, + join: join$5, normalize: normalize, relative: relative$1, resolve: resolve, @@ -112423,7 +112440,7 @@ hermes$1.parse = function hermesParse(source) { return parser.parse(source, options); }; -var tryCatch$9 = (fn, ...args) => { +var tryCatch$8 = (fn, ...args) => { try { return [null, fn(...args)]; } catch(e) { @@ -112431,11 +112448,11 @@ var tryCatch$9 = (fn, ...args) => { } }; -const tryCatch$8 = tryCatch$9; +const tryCatch$7 = tryCatch$8; var secondChance$1 = (fn, source, messages, args) => { const [a, ...others] = args; - const [errorA, resultA] = tryCatch$8(fn, source, a); + const [errorA, resultA] = tryCatch$7(fn, source, a); if (!errorA) return resultA; @@ -112444,7 +112461,7 @@ var secondChance$1 = (fn, source, messages, args) => { throw errorA; for (const b of others) { - const [errorB, resultB] = tryCatch$8(fn, source, b); + const [errorB, resultB] = tryCatch$7(fn, source, b); if (!errorB) return resultB; @@ -112533,13 +112550,13 @@ function customParse(source, {parser, isTS, isFlow, isJSX, isRecovery}) { return commonjsRequire(parser).parse(source); } -const {types: types$j} = bundle; +const {types: types$i} = bundle; const { - StringLiteral: StringLiteral$7, + StringLiteral: StringLiteral$6, ExpressionStatement, -} = types$j; +} = types$i; -const {assign: assign$8} = Object; +const {assign: assign$7} = Object; var moveOutDirectives$1 = (ast) => { const {body, directives} = ast.program; @@ -112552,7 +112569,7 @@ var moveOutDirectives$1 = (ast) => { for (const directive of directives) { const {leadingComments} = directive; const {value} = directive.value; - const expression = assign$8(ExpressionStatement(StringLiteral$7(value)), { + const expression = assign$7(ExpressionStatement(StringLiteral$6(value)), { leadingComments, }); @@ -112876,9 +112893,9 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_module$1); const {createRequire} = require$$1; -const tryCatch$7 = tryCatch$9; +const tryCatch$6 = tryCatch$8; const once$1 = onceExports; -const {assign: assign$7} = Object; +const {assign: assign$6} = Object; const bigFirst = (a) => `${a[0].toUpperCase()}${a.slice(1)}`; @@ -112888,11 +112905,11 @@ const load = (type) => ({name, namespace}) => { if (!pluginPath) throw Error(`${bigFirst(type)} "${namespace}-${type}-${name}" could not be found!`); - const [error, result] = tryCatch$7(customRequire, pluginPath); + const [error, result] = tryCatch$6(customRequire, pluginPath); /* c8 ignore start */ if (error?.code === 'ERR_REQUIRE_ESM') - assign$7(error, { + assign$6(error, { message: `☝️ Looks like '${name}' is ESM, use 'await putoutAsync()' instead`, name, }); @@ -112940,12 +112957,12 @@ function getModulePath(name) { const customRequire = createCustomRequire(); const putoutRequire = createPutoutRequire(); - [, path] = tryCatch$7(putoutRequire.resolve, name); + [, path] = tryCatch$6(putoutRequire.resolve, name); if (path) return [path, putoutRequire]; - [, path] = tryCatch$7(customRequire.resolve, name); + [, path] = tryCatch$6(customRequire.resolve, name); return [path, customRequire]; } @@ -112979,7 +112996,7 @@ const {nanomemoize} = require$$0$1; const tryToCatch = tryToCatch$1; const {simpleImport} = simpleImport$1; -const {assign: assign$6} = Object; +const {assign: assign$5} = Object; const stub$2 = () => () => {}; asyncLoader.createAsyncLoader = (type) => nanomemoize(async (name, load) => { @@ -113008,14 +113025,14 @@ async function cleverLoad(names, load = simpleImport) { if (e.code === 'ERR_MODULE_NOT_FOUND') continue; - assign$6(e, { + assign$5(e, { message: `${name}: ${e.message}`, }); throw e; } - assign$6(e, { + assign$5(e, { message: e.message.replace(/\simported.*/, ''), }); @@ -113025,7 +113042,7 @@ async function cleverLoad(names, load = simpleImport) { var parsePluginNames$2 = {}; const isStr$4 = (a) => typeof a === 'string'; -const {isArray: isArray$f} = Array; +const {isArray: isArray$e} = Array; const {entries: entries$9} = Object; parsePluginNames$2.parsePluginNames = (plugins) => { @@ -113037,7 +113054,7 @@ parsePluginNames$2.parsePluginNames = (plugins) => { continue; } - if (isArray$f(plugin)) { + if (isArray$e(plugin)) { const [pluginName, fn] = plugin; result.push([pluginName, fn]); continue; @@ -113050,7 +113067,7 @@ parsePluginNames$2.parsePluginNames = (plugins) => { }; const isStr$3 = (a) => typeof a === 'string'; -const {isArray: isArray$e} = Array; +const {isArray: isArray$d} = Array; const isOn = (a) => a === 'on'; const isOff = (a) => a === 'off'; @@ -113064,7 +113081,7 @@ var parseProcessorNames$1 = (plugins) => { continue; } - if (isArray$e(plugin)) { + if (isArray$d(plugin)) { const [pluginName, fn] = plugin; if (isOff(fn)) @@ -113109,7 +113126,7 @@ var loadPluginsAsync$1 = {}; var parseRules$3 = {}; -const {isArray: isArray$d} = Array; +const {isArray: isArray$c} = Array; const isBool$2 = (a) => typeof a === 'boolean'; const isStr$2 = (a) => typeof a === 'string'; const isObj$1 = (a) => typeof a === 'object'; @@ -113163,7 +113180,7 @@ parseRules$3.parseRules = (rules) => { continue; } - const looksLikeArray = isArray$d(value); + const looksLikeArray = isArray$c(value); const looksLikeNormalArray = looksLikeArray && value.length; if (looksLikeNormalArray) { @@ -113365,8 +113382,8 @@ var filterEnabledPlugins$2 = {}; const {isEnabled: isEnabled$2, mergeRules} = rules; -const {isArray: isArray$c} = Array; -const maybeTuple = (a) => isArray$c(a) ? a : ['on', a]; +const {isArray: isArray$b} = Array; +const maybeTuple = (a) => isArray$b(a) ? a : ['on', a]; // Would be great to have ability to filter // disabled plugins and prevent them from loading @@ -113408,7 +113425,7 @@ function isExectRuleEnabled(name, status, rules) { var check$9 = {}; -const isString$9 = (a) => typeof a === 'string'; +const isString$8 = (a) => typeof a === 'string'; check$9.check = (options) => { if (!options || typeof options !== 'object') @@ -113416,11 +113433,11 @@ check$9.check = (options) => { }; check$9.checkRule = (rule) => { - if (!isString$9(rule)) + if (!isString$8(rule)) throw Error(`☝️ Looks like plugin name type is not 'string', but: '${typeof rule}'`); }; -const {basename: basename$5} = require$$0$2; +const {basename: basename$4} = require$$0$2; const { parseRules: parseRules$1, @@ -113515,7 +113532,7 @@ function extendRules$1(rule, plugin) { function parseRuleName(rule) { if (rule.startsWith('import:')) { - const shortName = basename$5(rule.replace('import:', '')); + const shortName = basename$4(rule.replace('import:', '')); return shortName.replace('plugin-', ''); } @@ -113539,7 +113556,7 @@ const { const {filterEnabledPlugins} = filterEnabledPlugins$2; const {check: check$7, checkRule} = check$9; -const {isArray: isArray$b} = Array; +const {isArray: isArray$a} = Array; lib$1.loadPluginsAsync = loadPluginsAsync; lib$1.loadProcessorsAsync = async (options, load) => { @@ -113607,7 +113624,7 @@ function parseRule(rule) { .replace('@putout/plugin-', ''); } -const maybeFromTuple = (a) => isArray$b(a) ? a[1] : a; +const maybeFromTuple = (a) => isArray$a(a) ? a[1] : a; function loadPlugins({items, loadedRules}) { const plugins = []; @@ -114378,7 +114395,7 @@ var common = setup; var browserExports = browser.exports; browserExports.default; -const tryCatch$6 = tryCatch$9; +const tryCatch$5 = tryCatch$8; const debug$4 = browserExports('putout:runner:fix'); const {enabled} = debug$4; const {stringify: stringify$5} = JSON; @@ -114402,7 +114419,7 @@ const chooseFixArgs = ({path, pathOptions, options}) => { }; const tryToFix = (fix, {path, pathOptions, position, options}) => { - const [e] = tryCatch$6(fix, ...chooseFixArgs({ + const [e] = tryCatch$5(fix, ...chooseFixArgs({ path, pathOptions, options, @@ -114477,14 +114494,14 @@ function validatePath(path) { throw Error(`☝️ Looks like 'push' called without a 'path' argument.`); } -const {isArray: isArray$a} = Array; -const maybeArray$9 = (a) => isArray$a(a) ? a : [a]; +const {isArray: isArray$9} = Array; +const maybeArray$8 = (a) => isArray$9(a) ? a : [a]; var maybeArray_1 = (a) => { if (!a) return []; - return maybeArray$9(a); + return maybeArray$8(a); }; var validate$2 = {}; @@ -114502,7 +114519,7 @@ var store = {}; const { values, entries: entries$7, - assign: assign$5, + assign: assign$4, } = Object; const toArray = (a) => Array.from(a); @@ -114528,7 +114545,7 @@ store.upStore = createStore({ }, set(map, name, data) { map[name] = map[name] || {}; - assign$5(map[name], data); + assign$4(map[name], data); }, }); @@ -114593,7 +114610,7 @@ const {generate: generate$2} = parser$6; const runFix$2 = runFix$3; const {getPosition: getPosition$1} = getPosition$2; -const maybeArray$8 = maybeArray_1; +const maybeArray$7 = maybeArray_1; const {validate: validate$1} = validate$2; const { @@ -114607,18 +114624,18 @@ const { const shouldSkip = (a) => !a.parent; const {merge: merge$2} = traverse$9.visitors; -const {assign: assign$4} = Object; +const {assign: assign$3} = Object; const parse$3 = (name, plugin, options) => { const list = []; if (plugin[name]) { validate$1(name, plugin[name]); - list.push(...maybeArray$8(plugin[name]())); + list.push(...maybeArray$7(plugin[name]())); } if (options[name]) - list.push(...maybeArray$8(options[name])); + list.push(...maybeArray$7(options[name])); return list; }; @@ -114660,7 +114677,7 @@ var mergeVisitors$1 = (pluginsToMerge, {fix, shebang, template}) => { if (!visitor) throw Error(`☝️ Visitors cannot be empty in "${rule}"`); - assign$4(options, { + assign$3(options, { include: parse$3('include', plugin, options), exclude: parse$3('exclude', plugin, options), }); @@ -114734,7 +114751,7 @@ function getStore(plugin, {fix, rule, shebang, msg, options}) { mergeVisitors$1.default; -const {traverse: babelTraverse$1, types: types$i} = bundle; +const {traverse: babelTraverse$1, types: types$h} = bundle; const {generate: generate$1} = parser$6; const {merge: merge$1} = babelTraverse$1.visitors; @@ -114753,7 +114770,7 @@ var superFind$1 = function superFind({rule, find, ast, options, template}) { template, }), generate: generate$1, - types: types$i, + types: types$h, push, options, }); @@ -114777,7 +114794,7 @@ function traverse$8({rule, options, template}) { } const log$5 = browserExports('putout:runner:include'); -const maybeArray$7 = maybeArray_1; +const maybeArray$6 = maybeArray_1; const {validate} = validate$2; const stub$1 = () => []; @@ -114804,7 +114821,7 @@ var include$2 = ({rule, plugin, msg, options}) => { ...options, exclude: [ ...exclude(), - ...maybeArray$7(options.exclude), + ...maybeArray$6(options.exclude), ], }, plugin: { @@ -114933,7 +114950,7 @@ function check$5(selector) { var is$2 = {}; const {template: template$8} = parser$6; -const {types: types$h} = bundle; +const {types: types$g} = bundle; const { isBlockStatement: isBlockStatement$1, isBooleanLiteral, @@ -114949,7 +114966,7 @@ const { isJSXAttribute, isTSTypeReference: isTSTypeReference$1, isTSTypeParameterDeclaration, -} = types$h; +} = types$g; const isStr$1 = (a) => typeof a === 'string'; @@ -115059,7 +115076,7 @@ const isBool$1 = (a, b) => { }; const isEqualType$1 = (a, b) => a.type === b.type; -const {isArray: isArray$9} = Array; +const {isArray: isArray$8} = Array; is$2.isId = isId$1; is$2.isBool = isBool$1; @@ -115082,7 +115099,7 @@ is$2.isAnyLiteral = (a, b) => { }; is$2.isArgs = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; return isIdentifier$3(b, { name: ARGS, @@ -115112,12 +115129,12 @@ is$2.isEqualTypeParams = (a, b) => { }; is$2.isLinkedArgs = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; return isIdentifier$3(b) && LINKED_ARGS.test(b.name); }; is$2.isJSXChildren = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; return isJSXText$1(b, { value: JSX_CHILDREN, @@ -115125,7 +115142,7 @@ is$2.isJSXChildren = (a) => { }; is$2.isJSXAttributes = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; if (!isJSXAttribute(b)) return false; @@ -115157,27 +115174,27 @@ is$2.isLinkedRegExp = (a, b) => { }; is$2.isPath = (path) => Boolean(path.node); -is$2.isArray = isArray$9; +is$2.isArray = isArray$8; is$2.isObject = (a) => { if (!a) return false; - if (isArray$9(a)) + if (isArray$8(a)) return false; return typeof a === 'object'; }; is$2.isArrays = (a, b) => { - if (!isArray$9(a) || !isArray$9(b)) + if (!isArray$8(a) || !isArray$8(b)) return false; return a.length === b.length; }; is$2.isImports = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; if (!isImportDefaultSpecifier(b)) return false; @@ -115188,7 +115205,7 @@ is$2.isImports = (a) => { }; is$2.isExports = (a) => { - const b = !isArray$9(a) ? a : a[0]; + const b = !isArray$8(a) ? a : a[0]; if (!isExportSpecifier(b)) return false; @@ -115292,7 +115309,7 @@ is$2.isInsideTypeReference = (path) => path.isIdentifier() && path.parentPath?.i const jessy = jessy$1; const nessy = nessy$1; -const {traverse: traverse$7, types: types$g} = bundle; +const {traverse: traverse$7, types: types$f} = bundle; const {template: template$7} = parser$6; const {replaceWith: replaceWith$3, extract} = operate; @@ -115316,13 +115333,13 @@ const { isStringLiteral: isStringLiteral$3, isTemplateLiteral: isTemplateLiteral$1, TemplateElement, -} = types$g; +} = types$f; const {extractExpression: extractExpression$1} = template$7; const {entries: entries$6} = Object; const isNumber = (a) => typeof a === 'number'; -const isString$8 = (a) => typeof a === 'string'; +const isString$7 = (a) => typeof a === 'string'; const parseNode$1 = (a) => a.node || a; const {stringify: stringify$3} = JSON; @@ -115330,7 +115347,7 @@ const {stringify: stringify$3} = JSON; const BODY_AND_CLASS_REG = /\.body\.0(\.key)?$/; vars.getTemplateValues = (node, str) => { - if (!isString$8(str)) + if (!isString$7(str)) throw Error(`☝️ Looks like argument 'template' of 'getTemplateValues(node, template)': is not a string, but '${stringify$3(str)}'`); node = parseNode$1(node); @@ -115469,7 +115486,7 @@ var log$4 = {exports: {}}; const debug$3 = browserExports('putout:compare'); -const {isArray: isArray$8} = Array; +const {isArray: isArray$7} = Array; const isObject$2 = (a) => a && typeof a === 'object'; log$4.exports = (a, b) => { @@ -115484,7 +115501,7 @@ log$4.exports = (a, b) => { log$4.exports._parseValue = parseValue; function parseValue(a) { - if (isArray$8(a) && a[0]) { + if (isArray$7(a) && a[0]) { const [{ type, name, @@ -115509,14 +115526,14 @@ function parseValue(a) { var logExports = log$4.exports; -const {types: types$f} = bundle; +const {types: types$e} = bundle; const { isIdentifier: isIdentifier$1, isLiteral, isStringLiteral: isStringLiteral$2, isTemplateElement: isTemplateElement$1, isTSTypeReference, -} = types$f; +} = types$e; const parseName = (node) => { node = node[0] || node; @@ -115585,13 +115602,13 @@ const { isLinkedRegExp: isLinkedRegExp$1, } = is$2; -const {types: types$e} = bundle; +const {types: types$d} = bundle; const { isClassBody, isBlock, isJSXText, isTemplateElement, -} = types$e; +} = types$d; const isEmptyBlock = (a) => isBlock(a) && !a.body.length; const isPrimitive = (a) => typeof a !== 'object' || a === null; @@ -115700,7 +115717,7 @@ function compareJSXTexts(node, template) { var topLevelComparators = {}; -const {types: types$d} = bundle; +const {types: types$c} = bundle; const { isEqualBody, isEqualAnyObject, @@ -115714,7 +115731,7 @@ const { const { isIdentifier, isStringLiteral: isStringLiteral$1, -} = types$d; +} = types$c; const comparators = [ isEqualAnyObject, @@ -115772,13 +115789,13 @@ const { const {extractExpression} = template$6; const {keys: keys$2} = Object; -const {isArray: isArray$7} = Array; -const noop$5 = () => {}; -const isEmptyArray = (a) => isArray$7(a) && !a.length; +const {isArray: isArray$6} = Array; +const noop$4 = () => {}; +const isEmptyArray = (a) => isArray$6(a) && !a.length; const compareType = (type) => (path) => path.type === type; const superPush = (array) => (a, b) => array.push([a, b]); -const maybeArray$6 = (a) => isArray$7(a) ? a : [a]; +const maybeArray$5 = (a) => isArray$6(a) ? a : [a]; const findParent = (path, type) => { const newPathNode = path.findParent(compareType(type)); @@ -115808,7 +115825,7 @@ compare$5.getValues = getValues$1; compare$5.setValues = setValues$1; compare$5.getTemplateValues = getTemplateValues$1; -function compare$4(path, template, options = {}, equal = noop$5) { +function compare$4(path, template, options = {}, equal = noop$4) { const {findUp = true} = options; if (!path && !template) @@ -115842,7 +115859,7 @@ function compare$4(path, template, options = {}, equal = noop$5) { } compare$5.compareAny = (path, templateNodes, options) => { - templateNodes = maybeArray$6(templateNodes); + templateNodes = maybeArray$5(templateNodes); for (const template of templateNodes) { if (compare$4(path, template, options)) @@ -115853,7 +115870,7 @@ compare$5.compareAny = (path, templateNodes, options) => { }; compare$5.compareAll = (path, templateNodes, options) => { - templateNodes = maybeArray$6(templateNodes); + templateNodes = maybeArray$5(templateNodes); for (const template of templateNodes) { if (!compare$4(path, template, options)) @@ -115934,7 +115951,7 @@ function check$3(fn) { } const {entries: entries$5} = Object; -const {isArray: isArray$6} = Array; +const {isArray: isArray$5} = Array; var findPath$1 = (parentPath) => { let current = { @@ -115953,7 +115970,7 @@ function findKey(path, parent) { const {node} = path; for (const [key, value] of entries$5(parent)) { - if (isArray$6(value)) { + if (isArray$5(value)) { const index = value.indexOf(node); if (index >= 0) @@ -115969,14 +115986,14 @@ function findKey(path, parent) { const wraptile = wraptile$1; const findPath = findPath$1; -const {types: types$c} = bundle; -const {isProgram: isProgram$5} = types$c; +const {types: types$b} = bundle; +const {isProgram: isProgram$4} = types$b; const name = '__putout_runner_replace'; const hasWatermark = (watermark) => (path) => path.node?.[name]?.has(watermark); watermark$1.exports = (from, to, path) => { const {watermark, highWatermark} = create(from, to, path); - const program = path.findParent(isProgram$5) || path; + const program = path.findParent(isProgram$4) || path; const options = { watermark, highWatermark, @@ -115985,7 +116002,7 @@ watermark$1.exports = (from, to, path) => { }; return { - init: wraptile(init$4, options), + init: wraptile(init$3, options), has: wraptile(has, options), add: wraptile(add, options), }; @@ -116004,8 +116021,8 @@ function create(from, to, path) { }; } -watermark$1.exports.init = init$4; -function init$4({path, program}) { +watermark$1.exports.init = init$3; +function init$3({path, program}) { if (path.node) path.node[name] = path.node[name] || new Set(); @@ -116014,7 +116031,7 @@ function init$4({path, program}) { watermark$1.exports.add = add; function add({path, program, watermark, highWatermark}) { - init$4({ + init$3({ path, program, }); @@ -116035,7 +116052,7 @@ var watermarkExports = watermark$1.exports; const {template: template$5, print: print$2} = parser$6; const {remove, replaceWith: replaceWith$2} = operate; -const {types: types$b} = bundle; +const {types: types$a} = bundle; const { compare: compare$3, @@ -116045,14 +116062,14 @@ const { } = compare$5; const debug$2 = browserExports('putout:runner:replace'); -const maybeArray$5 = maybeArray_1; +const maybeArray$4 = maybeArray_1; const watermark = watermarkExports; const { isExpression, isStatement, isExpressionStatement, -} = types$b; +} = types$a; const PRINT_OPTIONS = { printer: ['putout', { @@ -116065,7 +116082,7 @@ const PRINT_OPTIONS = { }], }; -const isString$7 = (a) => typeof a === 'string'; +const isString$6 = (a) => typeof a === 'string'; const log$2 = (from, path) => { debug$2.enabled && debug$2(`${from} -> ${path}\n`); @@ -116102,7 +116119,7 @@ replace$1.exports = ({rule, plugin, msg, options}) => { ...options, exclude: [ ...exclude(), - ...maybeArray$5(options.exclude), + ...maybeArray$4(options.exclude), ], }, plugin: { @@ -116214,7 +116231,7 @@ function parseTo(to, values, path) { return toStr; } - if (!isString$7(toStr)) + if (!isString$6(toStr)) throw Error(`☝️ Looks like you passed 'replace' value with a wrong type. Allowed: 'string', 'node' and 'path'. Received: '${typeof toStr}' with value '${toStr}'.`); return template$5.ast.fresh(toStr); @@ -116297,14 +116314,14 @@ const { setModuleType, } = record; -const {types: types$a} = bundle; +const {types: types$9} = bundle; const { isImportDeclaration, isVariableDeclaration, -} = types$a; +} = types$9; const {keys} = Object; -const isString$6 = (a) => typeof a === 'string'; +const isString$5 = (a) => typeof a === 'string'; const getLastVarPath = (bodyPath) => bodyPath.filter(isVariableDeclaration).pop(); const isLast = (insertionPath, bodyPath) => bodyPath.at(-1) === insertionPath; @@ -116402,7 +116419,7 @@ function isUseStrict(path) { } const parseCode = (type, current) => { - if (isString$6(current)) + if (isString$5(current)) return current; return current[type]; @@ -116500,406 +116517,11 @@ function validateDeclare(declare) { throw Error(`☝️ Looks like 'declare' property value is not a 'function', but '${typeof declare}' with value '${stringify$1(declare)}'.`); } -var filesystem$3 = {}; - -var maybeFs$3 = {}; - -const fullstore$4 = fullstore$6; -const driverStore$3 = fullstore$4(); - -const {assign: assign$3} = Object; -const noop$4 = () => {}; -const returns$3 = (a) => () => a; - -const defaultFS$3 = { - renameFile: noop$4, - removeFile: noop$4, - createDirectory: noop$4, - readFileContent: returns$3(''), - writeFileContent: noop$4, - copyFile: noop$4, -}; - -const maybeFS$7 = assign$3({}, defaultFS$3); - -maybeFs$3.renameFile = (oldName, newName) => { - maybeFS$7.renameFile(oldName, newName); -}; - -maybeFs$3.removeFile = (name) => { - maybeFS$7.removeFile(name); -}; - -maybeFs$3.copyFile = (from, to) => { - maybeFS$7.copyFile(from, to); -}; - -maybeFs$3.createDirectory = (name) => { - maybeFS$7.createDirectory(name); -}; - -maybeFs$3.readFileContent = (name) => { - return maybeFS$7.readFileContent(name); -}; - -maybeFs$3.writeFileContent = (name, content) => { - maybeFS$7.writeFileContent(name, content); -}; - -maybeFs$3.init = init$3; - -function init$3(fsDriver) { - assign$3(maybeFS$7, fsDriver); -} - -maybeFs$3.pause = () => { - driverStore$3(maybeFS$7); - deinit$3(); -}; - -maybeFs$3.start = () => { - init$3(driverStore$3()); -}; - -maybeFs$3.deinit = deinit$3; - -function deinit$3() { - assign$3(maybeFS$7, defaultFS$3); -} - -const {join: join$5, basename: basename$4} = require$$0$2; -const tryCatch$5 = tryCatch$9; -const {types: types$9} = bundle; - -const { - setLiteralValue: setLiteralValue$3, - getProperty: getProperty$5, - traverseProperties: traverseProperties$4, -} = operate; - -const maybeFS$6 = maybeFs$3; -const isString$5 = (a) => typeof a === 'string'; -const {isArray: isArray$5} = Array; -const maybeArray$4 = (a) => isArray$5(a) ? a : [a]; - -const toBase64$3 = (content) => { - const [e, result] = tryCatch$5(btoa, content); - - if (e) - return btoa(encodeURI(content)); - - return result; -}; - -const fromBase64$3 = (content) => { - const [e, decoded] = tryCatch$5(atob, content); - - if (!e) - return decodeURI(decoded); - - return content; -}; - -const { - ObjectExpression: ObjectExpression$4, - ArrayExpression: ArrayExpression$5, - StringLiteral: StringLiteral$6, - ObjectProperty: ObjectProperty$5, - isProgram: isProgram$4, -} = types$9; - -const getRegExp$3 = (wildcard) => { - const escaped = wildcard - .replace(/\./g, '\\.') - .replace(/\*/g, '.*') - .replace('?', '.?'); - - return RegExp(`^${escaped}$`); -}; - -filesystem$3.getParentDirectory = (filePath) => { - const {parentPath} = filePath.parentPath.parentPath; - - if (isProgram$4(parentPath)) - return null; - - return parentPath; -}; - -filesystem$3.findFile = findFile$8; - -function findFile$8(node, name) { - checkName$3(name); - - const filePaths = []; - const names = maybeArray$4(name); - - for (const filenamePath of traverseProperties$4(node, 'filename')) { - const {value} = filenamePath.node.value; - const base = basename$4(value); - - for (const name of names) { - if (value === name || getRegExp$3(name).test(base)) - filePaths.push(filenamePath.parentPath); - } - } - - return filePaths; -} - -function checkName$3(name) { - if (!isString$5(name) && !isArray$5(name)) - throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`); -} - -function getFilenamePath$3(filePath) { - const filenamePath = getProperty$5(filePath, 'filename'); - return filenamePath.get('value'); -} - -function getFilename$7(filePath) { - const {value} = getFilenamePath$3(filePath).node; - return value; -} - -filesystem$3.getFileType = getFileType$5; - -function getFileType$5(filePath) { - const typePath = getProperty$5(filePath, 'type'); - return typePath.node.value.value; -} - -filesystem$3.getFileContent = getFileContent$3; - -function getFileContent$3(filePath) { - const content = getProperty$5(filePath, 'content'); - - return [ - Boolean(content), - content?.node.value.value, - ]; -} - -filesystem$3.getFilename = getFilename$7; - -filesystem$3.renameFile = (filePath, name) => { - const oldName = getFilename$7(filePath); - const valuePath = getFilenamePath$3(filePath); - const baseName = oldName - .split('/') - .pop(); - - const newName = name - .split('/') - .pop(); - - const newFilename = oldName.replace(baseName, newName); - - setLiteralValue$3(valuePath, newFilename); - maybeFS$6.renameFile(oldName, newFilename); -}; - -filesystem$3.removeFile = (filePath) => { - const filename = getFilename$7(filePath); - - filePath.remove(); - maybeFS$6.removeFile(filename); -}; - -filesystem$3.moveFile = (filePath, dirPath) => { - if (filePath === dirPath) - return; - - const dirname = getFilename$7(dirPath); - const filename = getFilename$7(filePath); - const dirPathFiles = getProperty$5(dirPath, 'files'); - const filenamePath = getProperty$5(filePath, 'filename'); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$5(dirname, basename); - - maybeRemoveFile$3(dirPath, newFilename); - - setLiteralValue$3(filenamePath.get('value'), newFilename); - dirPathFiles.node.value.elements.push(filePath.node); - - filePath.remove(); - maybeFS$6.renameFile(filename, newFilename); -}; - -filesystem$3.copyFile = (filePath, dirPath) => { - const dirname = getFilename$7(dirPath); - const filename = getFilename$7(filePath); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$5(dirname, basename); - const [hasContent, content] = getFileContent$3(filePath); - - const copiedFile = ObjectExpression$4([ - createTypeProperty$3('file'), - createFilenameProperty$3(newFilename), - hasContent && createContentProperty$3(content), - ].filter(Boolean)); - - maybeRemoveFile$3(dirPath, newFilename); - - const dirPathFiles = getFiles$4(dirPath); - dirPathFiles.node.value.elements.push(copiedFile); - - maybeFS$6.copyFile(filename, newFilename); -}; - -function maybeRemoveFile$3(dirPath, filename) { - const type = getFileType$5(dirPath); - - if (type !== 'directory') { - const filename = getFilename$7(dirPath); - throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`); - } - - const dirPathFiles = getProperty$5(dirPath, 'files'); - const name = join$5(getFilename$7(dirPath), basename$4(filename)); - const [fileToOverwrite] = findFile$8(dirPathFiles, name); - - if (!fileToOverwrite) - return; - - fileToOverwrite.remove(); -} - -const createTypeProperty$3 = (type) => ObjectProperty$5(StringLiteral$6('type'), StringLiteral$6(type)); - -filesystem$3.createTypeProperty = createTypeProperty$3; - -const createFilesProperty$3 = (files) => ObjectProperty$5(StringLiteral$6('files'), ArrayExpression$5(files)); - -filesystem$3.createFilesProperty = createFilesProperty$3; - -const createFilenameProperty$3 = (filename) => ObjectProperty$5(StringLiteral$6('filename'), StringLiteral$6(filename)); - -filesystem$3.createFilenameProperty = createFilenameProperty$3; - -const createContentProperty$3 = (content) => ObjectProperty$5(StringLiteral$6('content'), StringLiteral$6(content)); - -filesystem$3.createContentProperty = createContentProperty$3; - -filesystem$3.createFile = (dirPath, name, content) => { - maybeRemoveFile$3(dirPath, name); - - const dirPathFiles = getFiles$4(dirPath); - const parentFilename = getFilename$7(dirPath); - const filename = join$5(parentFilename, name); - - const typeProperty = createTypeProperty$3('file'); - const filenameProperty = createFilenameProperty$3(filename); - - const properties = [ - typeProperty, - filenameProperty, - content && createContentProperty$3(content), - ].filter(Boolean); - - dirPathFiles.node.value.elements.push(ObjectExpression$4(properties)); - - const filePath = dirPathFiles - .get('value.elements') - .at(-1); - - if (isString$5(content)) - writeFileContent$4(filePath, content); - - return filePath; -}; - -function getFiles$4(dirPath) { - return getProperty$5(dirPath, 'files'); -} - -filesystem$3.createDirectory = (dirPath, name) => { - const dirPathFiles = getFiles$4(dirPath); - const parentFilename = getFilename$7(dirPath); - const filename = join$5(parentFilename, name); - - const typeProperty = createTypeProperty$3('directory'); - const filesProperty = createFilesProperty$3([]); - const filenameProperty = createFilenameProperty$3(filename); - - dirPathFiles.node.value.elements.push(ObjectExpression$4([ - typeProperty, - filenameProperty, - filesProperty, - ])); - - maybeFS$6.createDirectory(filename); - - return dirPathFiles - .get('value.elements') - .at(-1); -}; - -filesystem$3.readFileContent = (filePath) => { - const fileType = getFileType$5(filePath); - - if (fileType === 'directory') - return ''; - - const [hasContent, content] = getFileContent$3(filePath); - - if (hasContent) - return fromBase64$3(content); - - const filename = getFilename$7(filePath); - const fileContent = maybeFS$6.readFileContent(filename); - - const property = createContentProperty$3(toBase64$3(fileContent)); - - filePath.node.properties.push(property); - - return fileContent; -}; - -filesystem$3.writeFileContent = writeFileContent$4; - -function writeFileContent$4(filePath, content) { - const fileType = getFileType$5(filePath); - - if (fileType === 'directory') - return; - - const filename = getFilename$7(filePath); - - maybeFS$6.writeFileContent(filename, content); - - const contentPath = getProperty$5(filePath, 'content'); - - if (contentPath) { - setLiteralValue$3(contentPath.node.value, toBase64$3(content)); - return; - } - - const property = createContentProperty$3(toBase64$3(content)); - filePath.node.properties.push(property); -} - -filesystem$3.init = maybeFS$6.init; -filesystem$3.deinit = maybeFS$6.deinit; - -filesystem$3.pause = maybeFS$6.pause; -filesystem$3.start = maybeFS$6.start; - -var convertSimpleFilesystemToFilesystem = {}; - var filesystem$2 = {}; var maybeFs$2 = {}; -const fullstore$3 = fullstore$6; +const fullstore$3 = fullstore$5; const driverStore$2 = fullstore$3(); const {assign: assign$2} = Object; @@ -116963,7 +116585,7 @@ function deinit$2() { } const {join: join$4, basename: basename$3} = require$$0$2; -const tryCatch$4 = tryCatch$9; +const tryCatch$4 = tryCatch$8; const {types: types$8} = bundle; const { @@ -117288,27 +116910,422 @@ filesystem$2.deinit = maybeFS$4.deinit; filesystem$2.pause = maybeFS$4.pause; filesystem$2.start = maybeFS$4.start; +var convertSimpleFilesystemToFilesystem = {}; + +var filesystem$1 = {}; + +var maybeFs$1 = {}; + +const fullstore$2 = fullstore$5; +const driverStore$1 = fullstore$2(); + +const {assign: assign$1} = Object; +const noop$2 = () => {}; +const returns$1 = (a) => () => a; + +const defaultFS$1 = { + renameFile: noop$2, + removeFile: noop$2, + createDirectory: noop$2, + readFileContent: returns$1(''), + writeFileContent: noop$2, + copyFile: noop$2, +}; + +const maybeFS$3 = assign$1({}, defaultFS$1); + +maybeFs$1.renameFile = (oldName, newName) => { + maybeFS$3.renameFile(oldName, newName); +}; + +maybeFs$1.removeFile = (name) => { + maybeFS$3.removeFile(name); +}; + +maybeFs$1.copyFile = (from, to) => { + maybeFS$3.copyFile(from, to); +}; + +maybeFs$1.createDirectory = (name) => { + maybeFS$3.createDirectory(name); +}; + +maybeFs$1.readFileContent = (name) => { + return maybeFS$3.readFileContent(name); +}; + +maybeFs$1.writeFileContent = (name, content) => { + maybeFS$3.writeFileContent(name, content); +}; + +maybeFs$1.init = init$1; + +function init$1(fsDriver) { + assign$1(maybeFS$3, fsDriver); +} + +maybeFs$1.pause = () => { + driverStore$1(maybeFS$3); + deinit$1(); +}; + +maybeFs$1.start = () => { + init$1(driverStore$1()); +}; + +maybeFs$1.deinit = deinit$1; + +function deinit$1() { + assign$1(maybeFS$3, defaultFS$1); +} + +const {join: join$3, basename: basename$2} = require$$0$2; +const tryCatch$3 = tryCatch$8; const {types: types$7} = bundle; -const {basename: basename$2, dirname} = require$$0$2; + const { - createDirectory, - getFileType: getFileType$3, - getFilename: getFilename$5, - findFile: findFile$6, -} = filesystem$2; + setLiteralValue: setLiteralValue$1, + getProperty: getProperty$3, + traverseProperties: traverseProperties$2, +} = operate; -const {__filesystem_name: __filesystem_name$2} = json; -const {replaceWith: replaceWith$1, getProperty: getProperty$3} = operate; +const maybeFS$2 = maybeFs$1; +const isString$3 = (a) => typeof a === 'string'; +const {isArray: isArray$3} = Array; +const maybeArray$2 = (a) => isArray$3(a) ? a : [a]; + +const toBase64$1 = (content) => { + const [e, result] = tryCatch$3(btoa, content); + + if (e) + return btoa(encodeURI(content)); + + return result; +}; + +const fromBase64$1 = (content) => { + const [e, decoded] = tryCatch$3(atob, content); + + if (!e) + return decodeURI(decoded); + + return content; +}; const { ObjectExpression: ObjectExpression$2, ArrayExpression: ArrayExpression$3, StringLiteral: StringLiteral$4, ObjectProperty: ObjectProperty$3, + isProgram: isProgram$2, +} = types$7; + +const getRegExp$1 = (wildcard) => { + const escaped = wildcard + .replace(/\./g, '\\.') + .replace(/\*/g, '.*') + .replace('?', '.?'); + + return RegExp(`^${escaped}$`); +}; + +filesystem$1.getParentDirectory = (filePath) => { + const {parentPath} = filePath.parentPath.parentPath; + + if (isProgram$2(parentPath)) + return null; + + return parentPath; +}; + +filesystem$1.findFile = findFile$6; + +function findFile$6(node, name) { + checkName$1(name); + + const filePaths = []; + const names = maybeArray$2(name); + + for (const filenamePath of traverseProperties$2(node, 'filename')) { + const {value} = filenamePath.node.value; + const base = basename$2(value); + + for (const name of names) { + if (value === name || getRegExp$1(name).test(base)) + filePaths.push(filenamePath.parentPath); + } + } + + return filePaths; +} + +function checkName$1(name) { + if (!isString$3(name) && !isArray$3(name)) + throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`); +} + +function getFilenamePath$1(filePath) { + const filenamePath = getProperty$3(filePath, 'filename'); + return filenamePath.get('value'); +} + +function getFilename$5(filePath) { + const {value} = getFilenamePath$1(filePath).node; + return value; +} + +filesystem$1.getFileType = getFileType$3; + +function getFileType$3(filePath) { + const typePath = getProperty$3(filePath, 'type'); + return typePath.node.value.value; +} + +filesystem$1.getFileContent = getFileContent$1; + +function getFileContent$1(filePath) { + const content = getProperty$3(filePath, 'content'); + + return [ + Boolean(content), + content?.node.value.value, + ]; +} + +filesystem$1.getFilename = getFilename$5; + +filesystem$1.renameFile = (filePath, name) => { + const oldName = getFilename$5(filePath); + const valuePath = getFilenamePath$1(filePath); + const baseName = oldName + .split('/') + .pop(); + + const newName = name + .split('/') + .pop(); + + const newFilename = oldName.replace(baseName, newName); + + setLiteralValue$1(valuePath, newFilename); + maybeFS$2.renameFile(oldName, newFilename); +}; + +filesystem$1.removeFile = (filePath) => { + const filename = getFilename$5(filePath); + + filePath.remove(); + maybeFS$2.removeFile(filename); +}; + +filesystem$1.moveFile = (filePath, dirPath) => { + if (filePath === dirPath) + return; + + const dirname = getFilename$5(dirPath); + const filename = getFilename$5(filePath); + const dirPathFiles = getProperty$3(dirPath, 'files'); + const filenamePath = getProperty$3(filePath, 'filename'); + + const basename = filename + .split('/') + .pop(); + + const newFilename = join$3(dirname, basename); + + maybeRemoveFile$1(dirPath, newFilename); + + setLiteralValue$1(filenamePath.get('value'), newFilename); + dirPathFiles.node.value.elements.push(filePath.node); + + filePath.remove(); + maybeFS$2.renameFile(filename, newFilename); +}; + +filesystem$1.copyFile = (filePath, dirPath) => { + const dirname = getFilename$5(dirPath); + const filename = getFilename$5(filePath); + + const basename = filename + .split('/') + .pop(); + + const newFilename = join$3(dirname, basename); + const [hasContent, content] = getFileContent$1(filePath); + + const copiedFile = ObjectExpression$2([ + createTypeProperty$1('file'), + createFilenameProperty$1(newFilename), + hasContent && createContentProperty$1(content), + ].filter(Boolean)); + + maybeRemoveFile$1(dirPath, newFilename); + + const dirPathFiles = getFiles$2(dirPath); + dirPathFiles.node.value.elements.push(copiedFile); + + maybeFS$2.copyFile(filename, newFilename); +}; + +function maybeRemoveFile$1(dirPath, filename) { + const type = getFileType$3(dirPath); + + if (type !== 'directory') { + const filename = getFilename$5(dirPath); + throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`); + } + + const dirPathFiles = getProperty$3(dirPath, 'files'); + const name = join$3(getFilename$5(dirPath), basename$2(filename)); + const [fileToOverwrite] = findFile$6(dirPathFiles, name); + + if (!fileToOverwrite) + return; + + fileToOverwrite.remove(); +} + +const createTypeProperty$1 = (type) => ObjectProperty$3(StringLiteral$4('type'), StringLiteral$4(type)); + +filesystem$1.createTypeProperty = createTypeProperty$1; + +const createFilesProperty$1 = (files) => ObjectProperty$3(StringLiteral$4('files'), ArrayExpression$3(files)); + +filesystem$1.createFilesProperty = createFilesProperty$1; + +const createFilenameProperty$1 = (filename) => ObjectProperty$3(StringLiteral$4('filename'), StringLiteral$4(filename)); + +filesystem$1.createFilenameProperty = createFilenameProperty$1; + +const createContentProperty$1 = (content) => ObjectProperty$3(StringLiteral$4('content'), StringLiteral$4(content)); + +filesystem$1.createContentProperty = createContentProperty$1; + +filesystem$1.createFile = (dirPath, name, content) => { + maybeRemoveFile$1(dirPath, name); + + const dirPathFiles = getFiles$2(dirPath); + const parentFilename = getFilename$5(dirPath); + const filename = join$3(parentFilename, name); + + const typeProperty = createTypeProperty$1('file'); + const filenameProperty = createFilenameProperty$1(filename); + + const properties = [ + typeProperty, + filenameProperty, + content && createContentProperty$1(content), + ].filter(Boolean); + + dirPathFiles.node.value.elements.push(ObjectExpression$2(properties)); + + const filePath = dirPathFiles + .get('value.elements') + .at(-1); + + if (isString$3(content)) + writeFileContent$2(filePath, content); + + return filePath; +}; + +function getFiles$2(dirPath) { + return getProperty$3(dirPath, 'files'); +} + +filesystem$1.createDirectory = (dirPath, name) => { + const dirPathFiles = getFiles$2(dirPath); + const parentFilename = getFilename$5(dirPath); + const filename = join$3(parentFilename, name); + + const typeProperty = createTypeProperty$1('directory'); + const filesProperty = createFilesProperty$1([]); + const filenameProperty = createFilenameProperty$1(filename); + + dirPathFiles.node.value.elements.push(ObjectExpression$2([ + typeProperty, + filenameProperty, + filesProperty, + ])); + + maybeFS$2.createDirectory(filename); + + return dirPathFiles + .get('value.elements') + .at(-1); +}; + +filesystem$1.readFileContent = (filePath) => { + const fileType = getFileType$3(filePath); + + if (fileType === 'directory') + return ''; + + const [hasContent, content] = getFileContent$1(filePath); + + if (hasContent) + return fromBase64$1(content); + + const filename = getFilename$5(filePath); + const fileContent = maybeFS$2.readFileContent(filename); + + const property = createContentProperty$1(toBase64$1(fileContent)); + + filePath.node.properties.push(property); + + return fileContent; +}; + +filesystem$1.writeFileContent = writeFileContent$2; + +function writeFileContent$2(filePath, content) { + const fileType = getFileType$3(filePath); + + if (fileType === 'directory') + return; + + const filename = getFilename$5(filePath); + + maybeFS$2.writeFileContent(filename, content); + + const contentPath = getProperty$3(filePath, 'content'); + + if (contentPath) { + setLiteralValue$1(contentPath.node.value, toBase64$1(content)); + return; + } + + const property = createContentProperty$1(toBase64$1(content)); + filePath.node.properties.push(property); +} + +filesystem$1.init = maybeFS$2.init; +filesystem$1.deinit = maybeFS$2.deinit; + +filesystem$1.pause = maybeFS$2.pause; +filesystem$1.start = maybeFS$2.start; + +const {types: types$6} = bundle; +const {basename: basename$1, dirname} = require$$0$2; +const { + createDirectory, + getFileType: getFileType$2, + getFilename: getFilename$4, + findFile: findFile$5, +} = filesystem$1; + +const {__filesystem_name: __filesystem_name$2} = json; +const {replaceWith: replaceWith$1, getProperty: getProperty$2} = operate; + +const { + ObjectExpression: ObjectExpression$1, + ArrayExpression: ArrayExpression$2, + StringLiteral: StringLiteral$3, + ObjectProperty: ObjectProperty$2, isArrayExpression, isStringLiteral, isTemplateLiteral, -} = types$7; +} = types$6; convertSimpleFilesystemToFilesystem.report = () => `Convert Simple Filesystem to Filesystem`; @@ -117316,22 +117333,22 @@ const isDirectory = (a) => a.endsWith('/'); const getType = (a) => { const type = isDirectory(a) ? 'directory' : 'file'; - return ObjectProperty$3(StringLiteral$4('type'), StringLiteral$4(type)); + return ObjectProperty$2(StringLiteral$3('type'), StringLiteral$3(type)); }; const createFilename = (filename) => { - return ObjectProperty$3(StringLiteral$4('filename'), StringLiteral$4(filename)); + return ObjectProperty$2(StringLiteral$3('filename'), StringLiteral$3(filename)); }; -const getFiles$2 = (a) => { +const getFiles$1 = (a) => { if (isDirectory(a)) - return ObjectProperty$3(StringLiteral$4('files'), ArrayExpression$3([])); + return ObjectProperty$2(StringLiteral$3('files'), ArrayExpression$2([])); return null; }; const getContent = (a) => { - return ObjectProperty$3(StringLiteral$4('content'), StringLiteral$4(a)); + return ObjectProperty$2(StringLiteral$3('content'), StringLiteral$3(a)); }; function parseContent(node, path) { @@ -117345,7 +117362,7 @@ function parseContent(node, path) { } convertSimpleFilesystemToFilesystem.fix = (path) => { - const array = ArrayExpression$3([]); + const array = ArrayExpression$2([]); for (const element of path.get('elements')) { if (isArrayExpression(element)) { @@ -117354,7 +117371,7 @@ convertSimpleFilesystemToFilesystem.fix = (path) => { const content = parseContent(nodeContent, element); - array.elements.push(ObjectExpression$2([ + array.elements.push(ObjectExpression$1([ getType(value), createFilename(value), getContent(content), @@ -117365,10 +117382,10 @@ convertSimpleFilesystemToFilesystem.fix = (path) => { if (isStringLiteral(element)) { const {value} = element.node; - array.elements.push(ObjectExpression$2([ + array.elements.push(ObjectExpression$1([ getType(value), createFilename(noTrailingSlash(value)), - getFiles$2(value), + getFiles$1(value), ].filter(Boolean))); continue; } @@ -117394,19 +117411,19 @@ const noTrailingSlash = (a) => { }; function buildTree(path, list) { - const [root, ...files] = findFile$6(list, '*'); + const [root, ...files] = findFile$5(list, '*'); for (const filePath of files) { - const filename = getFilename$5(filePath); + const filename = getFilename$4(filePath); check$2(filename); - const type = getFileType$3(filePath); + const type = getFileType$2(filePath); const dir = dirname(filename); - const name = basename$2(filename); - const [dirPath] = findFile$6(root, dir); + const name = basename$1(filename); + const [dirPath] = findFile$5(root, dir); - if (!dirPath || getFileType$3(dirPath) !== 'directory') + if (!dirPath || getFileType$2(dirPath) !== 'directory') throw Error(`☝️ Looks like directory '${dir}/' is missing`); if (type === 'directory') { @@ -117414,7 +117431,7 @@ function buildTree(path, list) { continue; } - const filesProperty = getProperty$3(dirPath, 'files'); + const filesProperty = getProperty$2(dirPath, 'files'); filesProperty.node.value.elements.push(filePath.node); } @@ -117428,22 +117445,22 @@ function check$2(filename) { var convertFilesystemToSimpleFilesystem = {}; -const {types: types$6} = bundle; -const {replaceWith, getProperty: getProperty$2} = operate; +const {types: types$5} = bundle; +const {replaceWith, getProperty: getProperty$1} = operate; const {__filesystem_name: __filesystem_name$1} = json; const { - findFile: findFile$5, - getFilename: getFilename$4, - getFileType: getFileType$2, -} = filesystem$2; + findFile: findFile$4, + getFilename: getFilename$3, + getFileType: getFileType$1, +} = filesystem$1; const { - StringLiteral: StringLiteral$3, - ArrayExpression: ArrayExpression$2, -} = types$6; + StringLiteral: StringLiteral$2, + ArrayExpression: ArrayExpression$1, +} = types$5; -const {isArray: isArray$3} = Array; +const {isArray: isArray$2} = Array; const maybeAddSlash = (a) => a === '/' ? a : `${a}/`; convertFilesystemToSimpleFilesystem.report = () => `Convert Filesystem to Simple Filesystem`; @@ -117452,9 +117469,9 @@ convertFilesystemToSimpleFilesystem.fix = (root, {files}) => { const names = []; for (const file of files) { - const filename = getFilename$4(file); - const type = getFileType$2(file); - const contentPath = getProperty$2(file, 'content'); + const filename = getFilename$3(file); + const type = getFileType$1(file); + const contentPath = getProperty$1(file, 'content'); const content = contentPath?.node?.value; if (content) { @@ -117473,24 +117490,24 @@ convertFilesystemToSimpleFilesystem.fix = (root, {files}) => { const list = []; for (const name of names) { - if (isArray$3(name)) { - list.push(ArrayExpression$2([ - StringLiteral$3(name[0]), - StringLiteral$3(name[1]), + if (isArray$2(name)) { + list.push(ArrayExpression$1([ + StringLiteral$2(name[0]), + StringLiteral$2(name[1]), ])); continue; } - list.push(StringLiteral$3(name)); + list.push(StringLiteral$2(name)); } - replaceWith(root, ArrayExpression$2(list)); + replaceWith(root, ArrayExpression$1(list)); }; convertFilesystemToSimpleFilesystem.traverse = ({push}) => ({ [`${__filesystem_name$1}(__object)`]: (path) => { const root = path.get('arguments.0'); - const files = findFile$5(root, '*'); + const files = findFile$4(root, '*'); push(root, { files, @@ -117498,15 +117515,15 @@ convertFilesystemToSimpleFilesystem.traverse = ({push}) => ({ }, }); -const fullstore$2 = fullstore$6; +const fullstore$1 = fullstore$5; const {compare: compare$1} = compare$5; const {__filesystem_name} = json; const { - findFile: findFile$4, + findFile: findFile$3, pause, start, -} = filesystem$3; +} = filesystem$2; const log$1 = browserExports('putout:runner:scanner'); @@ -117558,7 +117575,7 @@ const createFileProgress = ({rule, progress}) => ({i, n}) => { }; const createTrackFile = (fileProgress) => function*(...a) { - const files = findFile$4(...a); + const files = findFile$3(...a); const n = files.length; for (const [i, file] of files.entries()) { @@ -117576,7 +117593,7 @@ const getTraverse = ({scan, rule, progress}) => ({push, options}) => ({ progress.start(rule); const rootPath = path.get('arguments.0'); - const isSimple = fullstore$2(false); + const isSimple = fullstore$1(false); const fileProgress = createFileProgress({ rule, @@ -117660,7 +117677,7 @@ function parseVisitor(visitors) { var template$3 = {exports: {}}; -const tryCatch$3 = tryCatch$9; +const tryCatch$2 = tryCatch$8; const { compareAny: compareAny$1, @@ -117669,7 +117686,7 @@ const { isTemplate: isTemplate$1, } = compare$5; -const maybeArray$2 = maybeArray_1; +const maybeArray$1 = maybeArray_1; const debug$1 = browserExports('putout:runner:template'); const {entries: entries$3} = Object; @@ -117703,8 +117720,8 @@ const exclude = ({rule, tmpl, fn, nodesExclude}) => { template$3.exports = ({rule, visitor, options}) => { const parsed = []; - const nodesExclude = maybeArray$2(options.exclude); - const nodesInclude = maybeArray$2(options.include); + const nodesExclude = maybeArray$1(options.exclude); + const nodesInclude = maybeArray$1(options.include); for (const [tmpl, fn] of entries$3(visitor)) { if (!tmpl) @@ -117755,7 +117772,7 @@ function wrapWithCheck({rule, nodesInclude, nodesExclude, fn}) { if (!isFn(fn)) throw Error(`☝️ Looks like provided visitor is not a function: ${stringify(fn)}. More on using Traverser: https://git.io/JqcMn`); - const [e] = tryCatch$3(fn, path); + const [e] = tryCatch$2(fn, path); if (e) { e.rule = rule; @@ -118548,7 +118565,7 @@ function cutBrackets(a) { return a.replace(/\s\(\d:\d+\)/, ''); } -const tryCatch$2 = tryCatch$9; +const tryCatch$1 = tryCatch$8; const {defaultOptions: defaultOptions$1} = defaultOptions$4; const {cutShebang: cutShebang$1} = shebang; const parseError$1 = parseError$2; @@ -118581,7 +118598,7 @@ transform$5.transform = (ast, source, opts) => { const [, shebang] = cutShebang$1(source); - const [validationError] = tryCatch$2(validateRules, { + const [validationError] = tryCatch$1(validateRules, { rules, pluginNames, }); @@ -118623,7 +118640,7 @@ transform$5.transformAsync = async (ast, source, opts) => { const [, shebang] = cutShebang$1(source); - const [validationError] = tryCatch$2(validateRules, { + const [validationError] = tryCatch$1(validateRules, { rules, pluginNames, }); @@ -118667,8 +118684,8 @@ findPlaces$2.findPlacesAsync = async (ast, source, opts) => { }); }; -const {isArray: isArray$2} = Array; -const noop$2 = () => {}; +const {isArray: isArray$1} = Array; +const noop$1 = () => {}; var report$3 = () => { let filesCount = 0; @@ -118682,11 +118699,11 @@ var report$3 = () => { places, index = 0, count = 1, - trace = noop$2, + trace = noop$1, formatterOptions = {}, } = options; - if (!isArray$2(places)) + if (!isArray$1(places)) throw Error(`☝️ Looks like for 'places: Places[]' you passed the wrong type: '${typeof places}'`); if (places.length) @@ -118724,7 +118741,7 @@ report$3.default; var traverse$5 = {}; -const {types: types$5, traverse: babelTraverse} = bundle; +const {types: types$4, traverse: babelTraverse} = bundle; const { compare, @@ -118733,7 +118750,7 @@ const { getTemplateValues, } = compare$5; -const {isFile, isProgram: isProgram$2} = types$5; +const {isFile, isProgram: isProgram$1} = types$4; const {merge} = babelTraverse.visitors; const {entries: entries$2} = Object; @@ -118744,7 +118761,7 @@ const createTraverse = (path) => { if (isPath(path)) return path.traverse.bind(path); - const noScope = !isFile(path) && !isProgram$2(path); + const noScope = !isFile(path) && !isProgram$1(path); return (visitors) => { babelTraverse(path, { @@ -125921,16 +125938,16 @@ var addArgs = {}; const {compareAny} = compare$5; const {template: template$1} = parser$6; -const {types: types$4} = bundle; +const {types: types$3} = bundle; const { ObjectPattern, - ObjectProperty: ObjectProperty$2, + ObjectProperty: ObjectProperty$1, isBlockStatement, isFunction, isLabeledStatement, isObjectPattern, isCallExpression, -} = types$4; +} = types$3; const {entries: entries$1} = Object; @@ -126032,12 +126049,12 @@ const traverse$1 = (args) => ({push, options}) => { function createProperty(node) { if (!isLabeledStatement(node)) { const {expression} = node; - return ObjectProperty$2(expression, expression, !COMPUTED, SHORTHAND); + return ObjectProperty$1(expression, expression, !COMPUTED, SHORTHAND); } const {label, body} = node; - return ObjectProperty$2(label, body.expression, !COMPUTED, SHORTHAND); + return ObjectProperty$1(label, body.expression, !COMPUTED, SHORTHAND); } function getObjectPattern(params) { @@ -126052,6 +126069,399 @@ function getObjectPattern(params) { ]; } +var filesystem = {}; + +var maybeFs = {}; + +const fullstore = fullstore$5; +const driverStore = fullstore(); + +const {assign} = Object; +const noop = () => {}; +const returns = (a) => () => a; + +const defaultFS = { + renameFile: noop, + removeFile: noop, + createDirectory: noop, + readFileContent: returns(''), + writeFileContent: noop, + copyFile: noop, +}; + +const maybeFS$1 = assign({}, defaultFS); + +maybeFs.renameFile = (oldName, newName) => { + maybeFS$1.renameFile(oldName, newName); +}; + +maybeFs.removeFile = (name) => { + maybeFS$1.removeFile(name); +}; + +maybeFs.copyFile = (from, to) => { + maybeFS$1.copyFile(from, to); +}; + +maybeFs.createDirectory = (name) => { + maybeFS$1.createDirectory(name); +}; + +maybeFs.readFileContent = (name) => { + return maybeFS$1.readFileContent(name); +}; + +maybeFs.writeFileContent = (name, content) => { + maybeFS$1.writeFileContent(name, content); +}; + +maybeFs.init = init; + +function init(fsDriver) { + assign(maybeFS$1, fsDriver); +} + +maybeFs.pause = () => { + driverStore(maybeFS$1); + deinit(); +}; + +maybeFs.start = () => { + init(driverStore()); +}; + +maybeFs.deinit = deinit; + +function deinit() { + assign(maybeFS$1, defaultFS); +} + +const {join: join$2, basename} = require$$0$2; +const tryCatch = tryCatch$8; +const {types: types$2} = bundle; + +const { + setLiteralValue, + getProperty, + traverseProperties: traverseProperties$1, +} = operate; + +const maybeFS = maybeFs; +const isString$2 = (a) => typeof a === 'string'; +const {isArray} = Array; +const maybeArray = (a) => isArray(a) ? a : [a]; + +const toBase64 = (content) => { + const [e, result] = tryCatch(btoa, content); + + if (e) + return btoa(encodeURI(content)); + + return result; +}; + +const fromBase64 = (content) => { + const [e, decoded] = tryCatch(atob, content); + + if (!e) + return decodeURI(decoded); + + return content; +}; + +const { + ObjectExpression, + ArrayExpression, + StringLiteral: StringLiteral$1, + ObjectProperty, + isProgram, +} = types$2; + +const getRegExp = (wildcard) => { + const escaped = wildcard + .replace(/\./g, '\\.') + .replace(/\*/g, '.*') + .replace('?', '.?'); + + return RegExp(`^${escaped}$`); +}; + +filesystem.getParentDirectory = (filePath) => { + const {parentPath} = filePath.parentPath.parentPath; + + if (isProgram(parentPath)) + return null; + + return parentPath; +}; + +filesystem.findFile = findFile$2; + +function findFile$2(node, name) { + checkName(name); + + const filePaths = []; + const names = maybeArray(name); + + for (const filenamePath of traverseProperties$1(node, 'filename')) { + const {value} = filenamePath.node.value; + const base = basename(value); + + for (const name of names) { + if (value === name || getRegExp(name).test(base)) + filePaths.push(filenamePath.parentPath); + } + } + + return filePaths; +} + +function checkName(name) { + if (!isString$2(name) && !isArray(name)) + throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`); +} + +function getFilenamePath(filePath) { + const filenamePath = getProperty(filePath, 'filename'); + return filenamePath.get('value'); +} + +function getFilename$2(filePath) { + const {value} = getFilenamePath(filePath).node; + return value; +} + +filesystem.getFileType = getFileType; + +function getFileType(filePath) { + const typePath = getProperty(filePath, 'type'); + return typePath.node.value.value; +} + +filesystem.getFileContent = getFileContent; + +function getFileContent(filePath) { + const content = getProperty(filePath, 'content'); + + return [ + Boolean(content), + content?.node.value.value, + ]; +} + +filesystem.getFilename = getFilename$2; + +filesystem.renameFile = (filePath, name) => { + const oldName = getFilename$2(filePath); + const valuePath = getFilenamePath(filePath); + const baseName = oldName + .split('/') + .pop(); + + const newName = name + .split('/') + .pop(); + + const newFilename = oldName.replace(baseName, newName); + + setLiteralValue(valuePath, newFilename); + maybeFS.renameFile(oldName, newFilename); +}; + +filesystem.removeFile = (filePath) => { + const filename = getFilename$2(filePath); + + filePath.remove(); + maybeFS.removeFile(filename); +}; + +filesystem.moveFile = (filePath, dirPath) => { + if (filePath === dirPath) + return; + + const dirname = getFilename$2(dirPath); + const filename = getFilename$2(filePath); + const dirPathFiles = getProperty(dirPath, 'files'); + const filenamePath = getProperty(filePath, 'filename'); + + const basename = filename + .split('/') + .pop(); + + const newFilename = join$2(dirname, basename); + + maybeRemoveFile(dirPath, newFilename); + + setLiteralValue(filenamePath.get('value'), newFilename); + dirPathFiles.node.value.elements.push(filePath.node); + + filePath.remove(); + maybeFS.renameFile(filename, newFilename); +}; + +filesystem.copyFile = (filePath, dirPath) => { + const dirname = getFilename$2(dirPath); + const filename = getFilename$2(filePath); + + const basename = filename + .split('/') + .pop(); + + const newFilename = join$2(dirname, basename); + const [hasContent, content] = getFileContent(filePath); + + const copiedFile = ObjectExpression([ + createTypeProperty('file'), + createFilenameProperty(newFilename), + hasContent && createContentProperty(content), + ].filter(Boolean)); + + maybeRemoveFile(dirPath, newFilename); + + const dirPathFiles = getFiles(dirPath); + dirPathFiles.node.value.elements.push(copiedFile); + + maybeFS.copyFile(filename, newFilename); +}; + +function maybeRemoveFile(dirPath, filename) { + const type = getFileType(dirPath); + + if (type !== 'directory') { + const filename = getFilename$2(dirPath); + throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`); + } + + const dirPathFiles = getProperty(dirPath, 'files'); + const name = join$2(getFilename$2(dirPath), basename(filename)); + const [fileToOverwrite] = findFile$2(dirPathFiles, name); + + if (!fileToOverwrite) + return; + + fileToOverwrite.remove(); +} + +const createTypeProperty = (type) => ObjectProperty(StringLiteral$1('type'), StringLiteral$1(type)); + +filesystem.createTypeProperty = createTypeProperty; + +const createFilesProperty = (files) => ObjectProperty(StringLiteral$1('files'), ArrayExpression(files)); + +filesystem.createFilesProperty = createFilesProperty; + +const createFilenameProperty = (filename) => ObjectProperty(StringLiteral$1('filename'), StringLiteral$1(filename)); + +filesystem.createFilenameProperty = createFilenameProperty; + +const createContentProperty = (content) => ObjectProperty(StringLiteral$1('content'), StringLiteral$1(content)); + +filesystem.createContentProperty = createContentProperty; + +filesystem.createFile = (dirPath, name, content) => { + maybeRemoveFile(dirPath, name); + + const dirPathFiles = getFiles(dirPath); + const parentFilename = getFilename$2(dirPath); + const filename = join$2(parentFilename, name); + + const typeProperty = createTypeProperty('file'); + const filenameProperty = createFilenameProperty(filename); + + const properties = [ + typeProperty, + filenameProperty, + content && createContentProperty(content), + ].filter(Boolean); + + dirPathFiles.node.value.elements.push(ObjectExpression(properties)); + + const filePath = dirPathFiles + .get('value.elements') + .at(-1); + + if (isString$2(content)) + writeFileContent$1(filePath, content); + + return filePath; +}; + +function getFiles(dirPath) { + return getProperty(dirPath, 'files'); +} + +filesystem.createDirectory = (dirPath, name) => { + const dirPathFiles = getFiles(dirPath); + const parentFilename = getFilename$2(dirPath); + const filename = join$2(parentFilename, name); + + const typeProperty = createTypeProperty('directory'); + const filesProperty = createFilesProperty([]); + const filenameProperty = createFilenameProperty(filename); + + dirPathFiles.node.value.elements.push(ObjectExpression([ + typeProperty, + filenameProperty, + filesProperty, + ])); + + maybeFS.createDirectory(filename); + + return dirPathFiles + .get('value.elements') + .at(-1); +}; + +filesystem.readFileContent = (filePath) => { + const fileType = getFileType(filePath); + + if (fileType === 'directory') + return ''; + + const [hasContent, content] = getFileContent(filePath); + + if (hasContent) + return fromBase64(content); + + const filename = getFilename$2(filePath); + const fileContent = maybeFS.readFileContent(filename); + + const property = createContentProperty(toBase64(fileContent)); + + filePath.node.properties.push(property); + + return fileContent; +}; + +filesystem.writeFileContent = writeFileContent$1; + +function writeFileContent$1(filePath, content) { + const fileType = getFileType(filePath); + + if (fileType === 'directory') + return; + + const filename = getFilename$2(filePath); + + maybeFS.writeFileContent(filename, content); + + const contentPath = getProperty(filePath, 'content'); + + if (contentPath) { + setLiteralValue(contentPath.node.value, toBase64(content)); + return; + } + + const property = createContentProperty(toBase64(content)); + filePath.node.properties.push(property); +} + +filesystem.init = maybeFS.init; +filesystem.deinit = maybeFS.deinit; + +filesystem.pause = maybeFS.pause; +filesystem.start = maybeFS.start; + var matchFiles = {}; // A simple implementation of make-array @@ -126394,11 +126804,11 @@ const makeRegex = (pattern, ignoreCase) => { : new RegExp(source) }; -const isString$3 = subject => typeof subject === 'string'; +const isString$1 = subject => typeof subject === 'string'; // > A blank line matches no files, so it can serve as a separator for readability. const checkPattern = pattern => pattern - && isString$3(pattern) + && isString$1(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) @@ -126454,7 +126864,7 @@ const throwError = (message, Ctor) => { }; const checkPath = (path, originalPath, doThrow) => { - if (!isString$3(path)) { + if (!isString$1(path)) { return doThrow( `path must be a string, but got \`${originalPath}\``, TypeError @@ -126522,7 +126932,7 @@ class Ignore { this._added = false; makeArray( - isString$3(pattern) + isString$1(pattern) ? splitPattern(pattern) : pattern ).forEach(this._addPattern, this); @@ -126724,399 +127134,6 @@ function mergeIgnores(ignores) { ignores$2.default; -var filesystem$1 = {}; - -var maybeFs$1 = {}; - -const fullstore$1 = fullstore$6; -const driverStore$1 = fullstore$1(); - -const {assign: assign$1} = Object; -const noop$1 = () => {}; -const returns$1 = (a) => () => a; - -const defaultFS$1 = { - renameFile: noop$1, - removeFile: noop$1, - createDirectory: noop$1, - readFileContent: returns$1(''), - writeFileContent: noop$1, - copyFile: noop$1, -}; - -const maybeFS$3 = assign$1({}, defaultFS$1); - -maybeFs$1.renameFile = (oldName, newName) => { - maybeFS$3.renameFile(oldName, newName); -}; - -maybeFs$1.removeFile = (name) => { - maybeFS$3.removeFile(name); -}; - -maybeFs$1.copyFile = (from, to) => { - maybeFS$3.copyFile(from, to); -}; - -maybeFs$1.createDirectory = (name) => { - maybeFS$3.createDirectory(name); -}; - -maybeFs$1.readFileContent = (name) => { - return maybeFS$3.readFileContent(name); -}; - -maybeFs$1.writeFileContent = (name, content) => { - maybeFS$3.writeFileContent(name, content); -}; - -maybeFs$1.init = init$1; - -function init$1(fsDriver) { - assign$1(maybeFS$3, fsDriver); -} - -maybeFs$1.pause = () => { - driverStore$1(maybeFS$3); - deinit$1(); -}; - -maybeFs$1.start = () => { - init$1(driverStore$1()); -}; - -maybeFs$1.deinit = deinit$1; - -function deinit$1() { - assign$1(maybeFS$3, defaultFS$1); -} - -const {join: join$3, basename: basename$1} = require$$0$2; -const tryCatch$1 = tryCatch$9; -const {types: types$3} = bundle; - -const { - setLiteralValue: setLiteralValue$1, - getProperty: getProperty$1, - traverseProperties: traverseProperties$2, -} = operate; - -const maybeFS$2 = maybeFs$1; -const isString$2 = (a) => typeof a === 'string'; -const {isArray: isArray$1} = Array; -const maybeArray$1 = (a) => isArray$1(a) ? a : [a]; - -const toBase64$1 = (content) => { - const [e, result] = tryCatch$1(btoa, content); - - if (e) - return btoa(encodeURI(content)); - - return result; -}; - -const fromBase64$1 = (content) => { - const [e, decoded] = tryCatch$1(atob, content); - - if (!e) - return decodeURI(decoded); - - return content; -}; - -const { - ObjectExpression: ObjectExpression$1, - ArrayExpression: ArrayExpression$1, - StringLiteral: StringLiteral$2, - ObjectProperty: ObjectProperty$1, - isProgram: isProgram$1, -} = types$3; - -const getRegExp$1 = (wildcard) => { - const escaped = wildcard - .replace(/\./g, '\\.') - .replace(/\*/g, '.*') - .replace('?', '.?'); - - return RegExp(`^${escaped}$`); -}; - -filesystem$1.getParentDirectory = (filePath) => { - const {parentPath} = filePath.parentPath.parentPath; - - if (isProgram$1(parentPath)) - return null; - - return parentPath; -}; - -filesystem$1.findFile = findFile$3; - -function findFile$3(node, name) { - checkName$1(name); - - const filePaths = []; - const names = maybeArray$1(name); - - for (const filenamePath of traverseProperties$2(node, 'filename')) { - const {value} = filenamePath.node.value; - const base = basename$1(value); - - for (const name of names) { - if (value === name || getRegExp$1(name).test(base)) - filePaths.push(filenamePath.parentPath); - } - } - - return filePaths; -} - -function checkName$1(name) { - if (!isString$2(name) && !isArray$1(name)) - throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`); -} - -function getFilenamePath$1(filePath) { - const filenamePath = getProperty$1(filePath, 'filename'); - return filenamePath.get('value'); -} - -function getFilename$3(filePath) { - const {value} = getFilenamePath$1(filePath).node; - return value; -} - -filesystem$1.getFileType = getFileType$1; - -function getFileType$1(filePath) { - const typePath = getProperty$1(filePath, 'type'); - return typePath.node.value.value; -} - -filesystem$1.getFileContent = getFileContent$1; - -function getFileContent$1(filePath) { - const content = getProperty$1(filePath, 'content'); - - return [ - Boolean(content), - content?.node.value.value, - ]; -} - -filesystem$1.getFilename = getFilename$3; - -filesystem$1.renameFile = (filePath, name) => { - const oldName = getFilename$3(filePath); - const valuePath = getFilenamePath$1(filePath); - const baseName = oldName - .split('/') - .pop(); - - const newName = name - .split('/') - .pop(); - - const newFilename = oldName.replace(baseName, newName); - - setLiteralValue$1(valuePath, newFilename); - maybeFS$2.renameFile(oldName, newFilename); -}; - -filesystem$1.removeFile = (filePath) => { - const filename = getFilename$3(filePath); - - filePath.remove(); - maybeFS$2.removeFile(filename); -}; - -filesystem$1.moveFile = (filePath, dirPath) => { - if (filePath === dirPath) - return; - - const dirname = getFilename$3(dirPath); - const filename = getFilename$3(filePath); - const dirPathFiles = getProperty$1(dirPath, 'files'); - const filenamePath = getProperty$1(filePath, 'filename'); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$3(dirname, basename); - - maybeRemoveFile$1(dirPath, newFilename); - - setLiteralValue$1(filenamePath.get('value'), newFilename); - dirPathFiles.node.value.elements.push(filePath.node); - - filePath.remove(); - maybeFS$2.renameFile(filename, newFilename); -}; - -filesystem$1.copyFile = (filePath, dirPath) => { - const dirname = getFilename$3(dirPath); - const filename = getFilename$3(filePath); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$3(dirname, basename); - const [hasContent, content] = getFileContent$1(filePath); - - const copiedFile = ObjectExpression$1([ - createTypeProperty$1('file'), - createFilenameProperty$1(newFilename), - hasContent && createContentProperty$1(content), - ].filter(Boolean)); - - maybeRemoveFile$1(dirPath, newFilename); - - const dirPathFiles = getFiles$1(dirPath); - dirPathFiles.node.value.elements.push(copiedFile); - - maybeFS$2.copyFile(filename, newFilename); -}; - -function maybeRemoveFile$1(dirPath, filename) { - const type = getFileType$1(dirPath); - - if (type !== 'directory') { - const filename = getFilename$3(dirPath); - throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`); - } - - const dirPathFiles = getProperty$1(dirPath, 'files'); - const name = join$3(getFilename$3(dirPath), basename$1(filename)); - const [fileToOverwrite] = findFile$3(dirPathFiles, name); - - if (!fileToOverwrite) - return; - - fileToOverwrite.remove(); -} - -const createTypeProperty$1 = (type) => ObjectProperty$1(StringLiteral$2('type'), StringLiteral$2(type)); - -filesystem$1.createTypeProperty = createTypeProperty$1; - -const createFilesProperty$1 = (files) => ObjectProperty$1(StringLiteral$2('files'), ArrayExpression$1(files)); - -filesystem$1.createFilesProperty = createFilesProperty$1; - -const createFilenameProperty$1 = (filename) => ObjectProperty$1(StringLiteral$2('filename'), StringLiteral$2(filename)); - -filesystem$1.createFilenameProperty = createFilenameProperty$1; - -const createContentProperty$1 = (content) => ObjectProperty$1(StringLiteral$2('content'), StringLiteral$2(content)); - -filesystem$1.createContentProperty = createContentProperty$1; - -filesystem$1.createFile = (dirPath, name, content) => { - maybeRemoveFile$1(dirPath, name); - - const dirPathFiles = getFiles$1(dirPath); - const parentFilename = getFilename$3(dirPath); - const filename = join$3(parentFilename, name); - - const typeProperty = createTypeProperty$1('file'); - const filenameProperty = createFilenameProperty$1(filename); - - const properties = [ - typeProperty, - filenameProperty, - content && createContentProperty$1(content), - ].filter(Boolean); - - dirPathFiles.node.value.elements.push(ObjectExpression$1(properties)); - - const filePath = dirPathFiles - .get('value.elements') - .at(-1); - - if (isString$2(content)) - writeFileContent$2(filePath, content); - - return filePath; -}; - -function getFiles$1(dirPath) { - return getProperty$1(dirPath, 'files'); -} - -filesystem$1.createDirectory = (dirPath, name) => { - const dirPathFiles = getFiles$1(dirPath); - const parentFilename = getFilename$3(dirPath); - const filename = join$3(parentFilename, name); - - const typeProperty = createTypeProperty$1('directory'); - const filesProperty = createFilesProperty$1([]); - const filenameProperty = createFilenameProperty$1(filename); - - dirPathFiles.node.value.elements.push(ObjectExpression$1([ - typeProperty, - filenameProperty, - filesProperty, - ])); - - maybeFS$2.createDirectory(filename); - - return dirPathFiles - .get('value.elements') - .at(-1); -}; - -filesystem$1.readFileContent = (filePath) => { - const fileType = getFileType$1(filePath); - - if (fileType === 'directory') - return ''; - - const [hasContent, content] = getFileContent$1(filePath); - - if (hasContent) - return fromBase64$1(content); - - const filename = getFilename$3(filePath); - const fileContent = maybeFS$2.readFileContent(filename); - - const property = createContentProperty$1(toBase64$1(fileContent)); - - filePath.node.properties.push(property); - - return fileContent; -}; - -filesystem$1.writeFileContent = writeFileContent$2; - -function writeFileContent$2(filePath, content) { - const fileType = getFileType$1(filePath); - - if (fileType === 'directory') - return; - - const filename = getFilename$3(filePath); - - maybeFS$2.writeFileContent(filename, content); - - const contentPath = getProperty$1(filePath, 'content'); - - if (contentPath) { - setLiteralValue$1(contentPath.node.value, toBase64$1(content)); - return; - } - - const property = createContentProperty$1(toBase64$1(content)); - filePath.node.properties.push(property); -} - -filesystem$1.init = maybeFS$2.init; -filesystem$1.deinit = maybeFS$2.deinit; - -filesystem$1.pause = maybeFS$2.pause; -filesystem$1.start = maybeFS$2.start; - const path = require$$0$2; const {parse: parse$2, print: print$1} = parser$6; @@ -127128,15 +127145,15 @@ const {toJS, fromJS} = json; const { readFileContent: readFileContent$1, - findFile: findFile$2, - writeFileContent: writeFileContent$1, - getFilename: getFilename$2, + findFile: findFile$1, + writeFileContent, + getFilename: getFilename$1, createFile, removeFile, getParentDirectory: getParentDirectory$1, } = filesystem$1; -const {join: join$2} = path; +const {join: join$1} = path; const isObject = (a) => a && typeof a === 'object'; const {entries} = Object; @@ -127164,7 +127181,7 @@ function fix$1(inputFile, {dirPath, mainPath, matchInputFilename, outputFilename inputFile, }); - writeFileContent$1(outputFile, matchedJSON); + writeFileContent(outputFile, matchedJSON); if (inputFile !== outputFile) removeFile(inputFile); @@ -127172,15 +127189,15 @@ function fix$1(inputFile, {dirPath, mainPath, matchInputFilename, outputFilename const createScan = (files) => (mainPath, {push, progress, options}) => { const allFiles = []; - const cwd = getFilename$2(mainPath); + const cwd = getFilename$1(mainPath); for (const [filename, rawOptions] of entries(files)) { const [matchInputFilename, outputFilename = matchInputFilename] = parseMatcher(filename, options); - const inputFiles = findFile$2(mainPath, matchInputFilename); + const inputFiles = findFile$1(mainPath, matchInputFilename); for (const inputFile of inputFiles) { const dirPath = getParentDirectory$1(inputFile); - const inputFilename = getFilename$2(inputFile); + const inputFilename = getFilename$1(inputFile); if (ignores$1(cwd, inputFilename, options)) continue; @@ -127281,8 +127298,8 @@ function getOutputFile(path, {dirPath, matchInputFilename, outputFilename, input if (matchInputFilename === outputFilename) return inputFile; - const name = join$2(getFilename$2(dirPath), outputFilename); - const [outputFile] = findFile$2(dirPath, name); + const name = join$1(getFilename$1(dirPath), outputFilename); + const [outputFile] = findFile$1(dirPath, name); if (outputFile) return outputFile; @@ -127321,399 +127338,6 @@ function parseOptions(inputFilename, rawOptions) { var renameFiles = {}; -var filesystem = {}; - -var maybeFs = {}; - -const fullstore = fullstore$6; -const driverStore = fullstore(); - -const {assign} = Object; -const noop = () => {}; -const returns = (a) => () => a; - -const defaultFS = { - renameFile: noop, - removeFile: noop, - createDirectory: noop, - readFileContent: returns(''), - writeFileContent: noop, - copyFile: noop, -}; - -const maybeFS$1 = assign({}, defaultFS); - -maybeFs.renameFile = (oldName, newName) => { - maybeFS$1.renameFile(oldName, newName); -}; - -maybeFs.removeFile = (name) => { - maybeFS$1.removeFile(name); -}; - -maybeFs.copyFile = (from, to) => { - maybeFS$1.copyFile(from, to); -}; - -maybeFs.createDirectory = (name) => { - maybeFS$1.createDirectory(name); -}; - -maybeFs.readFileContent = (name) => { - return maybeFS$1.readFileContent(name); -}; - -maybeFs.writeFileContent = (name, content) => { - maybeFS$1.writeFileContent(name, content); -}; - -maybeFs.init = init; - -function init(fsDriver) { - assign(maybeFS$1, fsDriver); -} - -maybeFs.pause = () => { - driverStore(maybeFS$1); - deinit(); -}; - -maybeFs.start = () => { - init(driverStore()); -}; - -maybeFs.deinit = deinit; - -function deinit() { - assign(maybeFS$1, defaultFS); -} - -const {join: join$1, basename} = require$$0$2; -const tryCatch = tryCatch$9; -const {types: types$2} = bundle; - -const { - setLiteralValue, - getProperty, - traverseProperties: traverseProperties$1, -} = operate; - -const maybeFS = maybeFs; -const isString$1 = (a) => typeof a === 'string'; -const {isArray} = Array; -const maybeArray = (a) => isArray(a) ? a : [a]; - -const toBase64 = (content) => { - const [e, result] = tryCatch(btoa, content); - - if (e) - return btoa(encodeURI(content)); - - return result; -}; - -const fromBase64 = (content) => { - const [e, decoded] = tryCatch(atob, content); - - if (!e) - return decodeURI(decoded); - - return content; -}; - -const { - ObjectExpression, - ArrayExpression, - StringLiteral: StringLiteral$1, - ObjectProperty, - isProgram, -} = types$2; - -const getRegExp = (wildcard) => { - const escaped = wildcard - .replace(/\./g, '\\.') - .replace(/\*/g, '.*') - .replace('?', '.?'); - - return RegExp(`^${escaped}$`); -}; - -filesystem.getParentDirectory = (filePath) => { - const {parentPath} = filePath.parentPath.parentPath; - - if (isProgram(parentPath)) - return null; - - return parentPath; -}; - -filesystem.findFile = findFile$1; - -function findFile$1(node, name) { - checkName(name); - - const filePaths = []; - const names = maybeArray(name); - - for (const filenamePath of traverseProperties$1(node, 'filename')) { - const {value} = filenamePath.node.value; - const base = basename(value); - - for (const name of names) { - if (value === name || getRegExp(name).test(base)) - filePaths.push(filenamePath.parentPath); - } - } - - return filePaths; -} - -function checkName(name) { - if (!isString$1(name) && !isArray(name)) - throw Error(`☝️ Looks like you forget to pass the 'name' of a file to 'findFile(filePath: Path|FilePath, name: string | string[]): FilePath'`); -} - -function getFilenamePath(filePath) { - const filenamePath = getProperty(filePath, 'filename'); - return filenamePath.get('value'); -} - -function getFilename$1(filePath) { - const {value} = getFilenamePath(filePath).node; - return value; -} - -filesystem.getFileType = getFileType; - -function getFileType(filePath) { - const typePath = getProperty(filePath, 'type'); - return typePath.node.value.value; -} - -filesystem.getFileContent = getFileContent; - -function getFileContent(filePath) { - const content = getProperty(filePath, 'content'); - - return [ - Boolean(content), - content?.node.value.value, - ]; -} - -filesystem.getFilename = getFilename$1; - -filesystem.renameFile = (filePath, name) => { - const oldName = getFilename$1(filePath); - const valuePath = getFilenamePath(filePath); - const baseName = oldName - .split('/') - .pop(); - - const newName = name - .split('/') - .pop(); - - const newFilename = oldName.replace(baseName, newName); - - setLiteralValue(valuePath, newFilename); - maybeFS.renameFile(oldName, newFilename); -}; - -filesystem.removeFile = (filePath) => { - const filename = getFilename$1(filePath); - - filePath.remove(); - maybeFS.removeFile(filename); -}; - -filesystem.moveFile = (filePath, dirPath) => { - if (filePath === dirPath) - return; - - const dirname = getFilename$1(dirPath); - const filename = getFilename$1(filePath); - const dirPathFiles = getProperty(dirPath, 'files'); - const filenamePath = getProperty(filePath, 'filename'); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$1(dirname, basename); - - maybeRemoveFile(dirPath, newFilename); - - setLiteralValue(filenamePath.get('value'), newFilename); - dirPathFiles.node.value.elements.push(filePath.node); - - filePath.remove(); - maybeFS.renameFile(filename, newFilename); -}; - -filesystem.copyFile = (filePath, dirPath) => { - const dirname = getFilename$1(dirPath); - const filename = getFilename$1(filePath); - - const basename = filename - .split('/') - .pop(); - - const newFilename = join$1(dirname, basename); - const [hasContent, content] = getFileContent(filePath); - - const copiedFile = ObjectExpression([ - createTypeProperty('file'), - createFilenameProperty(newFilename), - hasContent && createContentProperty(content), - ].filter(Boolean)); - - maybeRemoveFile(dirPath, newFilename); - - const dirPathFiles = getFiles(dirPath); - dirPathFiles.node.value.elements.push(copiedFile); - - maybeFS.copyFile(filename, newFilename); -}; - -function maybeRemoveFile(dirPath, filename) { - const type = getFileType(dirPath); - - if (type !== 'directory') { - const filename = getFilename$1(dirPath); - throw Error(`☝️ Looks like '${filename}' is not a directory, but: '${type}'. Rename to '${filename}/'`); - } - - const dirPathFiles = getProperty(dirPath, 'files'); - const name = join$1(getFilename$1(dirPath), basename(filename)); - const [fileToOverwrite] = findFile$1(dirPathFiles, name); - - if (!fileToOverwrite) - return; - - fileToOverwrite.remove(); -} - -const createTypeProperty = (type) => ObjectProperty(StringLiteral$1('type'), StringLiteral$1(type)); - -filesystem.createTypeProperty = createTypeProperty; - -const createFilesProperty = (files) => ObjectProperty(StringLiteral$1('files'), ArrayExpression(files)); - -filesystem.createFilesProperty = createFilesProperty; - -const createFilenameProperty = (filename) => ObjectProperty(StringLiteral$1('filename'), StringLiteral$1(filename)); - -filesystem.createFilenameProperty = createFilenameProperty; - -const createContentProperty = (content) => ObjectProperty(StringLiteral$1('content'), StringLiteral$1(content)); - -filesystem.createContentProperty = createContentProperty; - -filesystem.createFile = (dirPath, name, content) => { - maybeRemoveFile(dirPath, name); - - const dirPathFiles = getFiles(dirPath); - const parentFilename = getFilename$1(dirPath); - const filename = join$1(parentFilename, name); - - const typeProperty = createTypeProperty('file'); - const filenameProperty = createFilenameProperty(filename); - - const properties = [ - typeProperty, - filenameProperty, - content && createContentProperty(content), - ].filter(Boolean); - - dirPathFiles.node.value.elements.push(ObjectExpression(properties)); - - const filePath = dirPathFiles - .get('value.elements') - .at(-1); - - if (isString$1(content)) - writeFileContent(filePath, content); - - return filePath; -}; - -function getFiles(dirPath) { - return getProperty(dirPath, 'files'); -} - -filesystem.createDirectory = (dirPath, name) => { - const dirPathFiles = getFiles(dirPath); - const parentFilename = getFilename$1(dirPath); - const filename = join$1(parentFilename, name); - - const typeProperty = createTypeProperty('directory'); - const filesProperty = createFilesProperty([]); - const filenameProperty = createFilenameProperty(filename); - - dirPathFiles.node.value.elements.push(ObjectExpression([ - typeProperty, - filenameProperty, - filesProperty, - ])); - - maybeFS.createDirectory(filename); - - return dirPathFiles - .get('value.elements') - .at(-1); -}; - -filesystem.readFileContent = (filePath) => { - const fileType = getFileType(filePath); - - if (fileType === 'directory') - return ''; - - const [hasContent, content] = getFileContent(filePath); - - if (hasContent) - return fromBase64(content); - - const filename = getFilename$1(filePath); - const fileContent = maybeFS.readFileContent(filename); - - const property = createContentProperty(toBase64(fileContent)); - - filePath.node.properties.push(property); - - return fileContent; -}; - -filesystem.writeFileContent = writeFileContent; - -function writeFileContent(filePath, content) { - const fileType = getFileType(filePath); - - if (fileType === 'directory') - return; - - const filename = getFilename$1(filePath); - - maybeFS.writeFileContent(filename, content); - - const contentPath = getProperty(filePath, 'content'); - - if (contentPath) { - setLiteralValue(contentPath.node.value, toBase64(content)); - return; - } - - const property = createContentProperty(toBase64(content)); - filePath.node.properties.push(property); -} - -filesystem.init = maybeFS.init; -filesystem.deinit = maybeFS.deinit; - -filesystem.pause = maybeFS.pause; -filesystem.start = maybeFS.start; - const {join} = require$$0$2; const { @@ -127722,7 +127346,7 @@ const { readFileContent, findFile, renameFile, -} = filesystem; +} = filesystem$1; const {parse: parse$1} = JSON; @@ -128050,7 +127674,7 @@ var operator = putout$1.exports.operator = { ...declare$2, ...regexp, ...addArgs, - ...filesystem$3, + ...filesystem, ...matchFiles, ...renameFiles, ...ignore, diff --git a/bundle/putout.min.js b/bundle/putout.min.js index 871acc8..52bfe83 100644 --- a/bundle/putout.min.js +++ b/bundle/putout.min.js @@ -1 +1 @@ -var A="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(A){if(A.__esModule)return A;var e=A.default;if("function"==typeof e){var t=function A(){return this instanceof A?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(A).forEach((function(e){var r=Object.getOwnPropertyDescriptor(A,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:function(){return A[e]}})})),t}var t={exports:{}},r="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}var a=i,s=n;function o(A){if(a===setTimeout)return setTimeout(A,0);if((a===i||!a)&&setTimeout)return a=setTimeout,setTimeout(A,0);try{return a(A,0)}catch(e){try{return a.call(null,A,0)}catch(e){return a.call(this,A,0)}}}"function"==typeof r.setTimeout&&(a=setTimeout),"function"==typeof r.clearTimeout&&(s=clearTimeout);var g,I=[],C=!1,u=-1;function c(){C&&g&&(C=!1,g.length?I=g.concat(I):u=-1,I.length&&l())}function l(){if(!C){var A=o(c);C=!0;for(var e=I.length;e;){for(g=I,I=[];++u1)for(var t=1;t>18&63]+k[i>>12&63]+k[i>>6&63]+k[63&i]);return n.join("")}function T(A){var e;b||F();for(var t=A.length,r=t%3,i="",n=[],a=16383,s=0,o=t-r;so?o:s+a));return 1===r?(e=A[t-1],i+=k[e>>2],i+=k[e<<4&63],i+="=="):2===r&&(e=(A[t-2]<<8)+A[t-1],i+=k[e>>10],i+=k[e>>4&63],i+=k[e<<2&63],i+="="),n.push(i),n.join("")}function R(A,e,t,r,i){var n,a,s=8*i-r-1,o=(1<>1,I=-7,C=t?i-1:0,u=t?-1:1,c=A[e+C];for(C+=u,n=c&(1<<-I)-1,c>>=-I,I+=s;I>0;n=256*n+A[e+C],C+=u,I-=8);for(a=n&(1<<-I)-1,n>>=-I,I+=r;I>0;a=256*a+A[e+C],C+=u,I-=8);if(0===n)n=1-g;else{if(n===o)return a?NaN:1/0*(c?-1:1);a+=Math.pow(2,r),n-=g}return(c?-1:1)*a*Math.pow(2,n-r)}function G(A,e,t,r,i,n){var a,s,o,g=8*n-i-1,I=(1<>1,u=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,c=r?0:n-1,l=r?1:-1,B=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=I):(a=Math.floor(Math.log(e)/Math.LN2),e*(o=Math.pow(2,-a))<1&&(a--,o*=2),(e+=a+C>=1?u/o:u*Math.pow(2,1-C))*o>=2&&(a++,o/=2),a+C>=I?(s=0,a=I):a+C>=1?(s=(e*o-1)*Math.pow(2,i),a+=C):(s=e*Math.pow(2,C-1)*Math.pow(2,i),a=0));i>=8;A[t+c]=255&s,c+=l,s/=256,i-=8);for(a=a<0;A[t+c]=255&a,c+=l,a/=256,g-=8);A[t+c-l]|=128*B}var M={}.toString,L=Array.isArray||function(A){return"[object Array]"==M.call(A)};function P(){return J.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function U(A,e){if(P()=P())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P().toString(16)+" bytes");return 0|A}function z(A){return!(null==A||!A._isBuffer)}function q(A,e){if(z(A))return A.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(A)||A instanceof ArrayBuffer))return A.byteLength;"string"!=typeof A&&(A=""+A);var t=A.length;if(0===t)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return yA(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return mA(A).length;default:if(r)return yA(A).length;e=(""+e).toLowerCase(),r=!0}}function V(A,e,t){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(e>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return IA(this,e,t);case"utf8":case"utf-8":return aA(this,e,t);case"ascii":return oA(this,e,t);case"latin1":case"binary":return gA(this,e,t);case"base64":return nA(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CA(this,e,t);default:if(r)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),r=!0}}function W(A,e,t){var r=A[e];A[e]=A[t],A[t]=r}function X(A,e,t,r,i){if(0===A.length)return-1;if("string"==typeof t?(r=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:A.length-1),t<0&&(t=A.length+t),t>=A.length){if(i)return-1;t=A.length-1}else if(t<0){if(!i)return-1;t=0}if("string"==typeof e&&(e=J.from(e,r)),z(e))return 0===e.length?-1:Z(A,e,t,r,i);if("number"==typeof e)return e&=255,J.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(A,e,t):Uint8Array.prototype.lastIndexOf.call(A,e,t):Z(A,[e],t,r,i);throw new TypeError("val must be string, number or Buffer")}function Z(A,e,t,r,i){var n,a=1,s=A.length,o=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(A.length<2||e.length<2)return-1;a=2,s/=2,o/=2,t/=2}function g(A,e){return 1===a?A[e]:A.readUInt16BE(e*a)}if(i){var I=-1;for(n=t;ns&&(t=s-o),n=t;n>=0;n--){for(var C=!0,u=0;ui&&(r=i):r=i;var n=e.length;if(n%2!=0)throw new TypeError("Invalid hex string");r>n/2&&(r=n/2);for(var a=0;a>8,i=t%256,n.push(i),n.push(r);return n}(e,A.length-t),A,t,r)}function nA(A,e,t){return 0===e&&t===A.length?T(A):T(A.slice(e,t))}function aA(A,e,t){t=Math.min(A.length,t);for(var r=[],i=e;i239?4:g>223?3:g>191?2:1;if(i+C<=t)switch(C){case 1:g<128&&(I=g);break;case 2:128==(192&(n=A[i+1]))&&(o=(31&g)<<6|63&n)>127&&(I=o);break;case 3:n=A[i+1],a=A[i+2],128==(192&n)&&128==(192&a)&&(o=(15&g)<<12|(63&n)<<6|63&a)>2047&&(o<55296||o>57343)&&(I=o);break;case 4:n=A[i+1],a=A[i+2],s=A[i+3],128==(192&n)&&128==(192&a)&&128==(192&s)&&(o=(15&g)<<18|(63&n)<<12|(63&a)<<6|63&s)>65535&&o<1114112&&(I=o)}null===I?(I=65533,C=1):I>65535&&(I-=65536,r.push(I>>>10&1023|55296),I=56320|1023&I),r.push(I),i+=C}return function(A){var e=A.length;if(e<=sA)return String.fromCharCode.apply(String,A);var t="",r=0;for(;r0&&(A=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(A+=" ... ")),""},J.prototype.compare=function(A,e,t,r,i){if(!z(A))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===t&&(t=A?A.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||t>A.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=t)return 0;if(r>=i)return-1;if(e>=t)return 1;if(this===A)return 0;for(var n=(i>>>=0)-(r>>>=0),a=(t>>>=0)-(e>>>=0),s=Math.min(n,a),o=this.slice(r,i),g=A.slice(e,t),I=0;Ii)&&(t=i),A.length>0&&(t<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var n=!1;;)switch(r){case"hex":return $(this,A,e,t);case"utf8":case"utf-8":return AA(this,A,e,t);case"ascii":return eA(this,A,e,t);case"latin1":case"binary":return tA(this,A,e,t);case"base64":return rA(this,A,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return iA(this,A,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),n=!0}},J.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var sA=4096;function oA(A,e,t){var r="";t=Math.min(A.length,t);for(var i=e;ir)&&(t=r);for(var i="",n=e;nt)throw new RangeError("Trying to access beyond buffer length")}function cA(A,e,t,r,i,n){if(!z(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||eA.length)throw new RangeError("Index out of range")}function lA(A,e,t,r){e<0&&(e=65535+e+1);for(var i=0,n=Math.min(A.length-t,2);i>>8*(r?i:1-i)}function BA(A,e,t,r){e<0&&(e=4294967295+e+1);for(var i=0,n=Math.min(A.length-t,4);i>>8*(r?i:3-i)&255}function EA(A,e,t,r,i,n){if(t+r>A.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function QA(A,e,t,r,i){return i||EA(A,0,t,4),G(A,e,t,r,23,4),t+4}function pA(A,e,t,r,i){return i||EA(A,0,t,8),G(A,e,t,r,52,8),t+8}J.prototype.slice=function(A,e){var t,r=this.length;if((A=~~A)<0?(A+=r)<0&&(A=0):A>r&&(A=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)r+=this[A+--e]*i;return r},J.prototype.readUInt8=function(A,e){return e||uA(A,1,this.length),this[A]},J.prototype.readUInt16LE=function(A,e){return e||uA(A,2,this.length),this[A]|this[A+1]<<8},J.prototype.readUInt16BE=function(A,e){return e||uA(A,2,this.length),this[A]<<8|this[A+1]},J.prototype.readUInt32LE=function(A,e){return e||uA(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+16777216*this[A+3]},J.prototype.readUInt32BE=function(A,e){return e||uA(A,4,this.length),16777216*this[A]+(this[A+1]<<16|this[A+2]<<8|this[A+3])},J.prototype.readIntLE=function(A,e,t){A|=0,e|=0,t||uA(A,e,this.length);for(var r=this[A],i=1,n=0;++n=(i*=128)&&(r-=Math.pow(2,8*e)),r},J.prototype.readIntBE=function(A,e,t){A|=0,e|=0,t||uA(A,e,this.length);for(var r=e,i=1,n=this[A+--r];r>0&&(i*=256);)n+=this[A+--r]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},J.prototype.readInt8=function(A,e){return e||uA(A,1,this.length),128&this[A]?-1*(255-this[A]+1):this[A]},J.prototype.readInt16LE=function(A,e){e||uA(A,2,this.length);var t=this[A]|this[A+1]<<8;return 32768&t?4294901760|t:t},J.prototype.readInt16BE=function(A,e){e||uA(A,2,this.length);var t=this[A+1]|this[A]<<8;return 32768&t?4294901760|t:t},J.prototype.readInt32LE=function(A,e){return e||uA(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},J.prototype.readInt32BE=function(A,e){return e||uA(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},J.prototype.readFloatLE=function(A,e){return e||uA(A,4,this.length),R(this,A,!0,23,4)},J.prototype.readFloatBE=function(A,e){return e||uA(A,4,this.length),R(this,A,!1,23,4)},J.prototype.readDoubleLE=function(A,e){return e||uA(A,8,this.length),R(this,A,!0,52,8)},J.prototype.readDoubleBE=function(A,e){return e||uA(A,8,this.length),R(this,A,!1,52,8)},J.prototype.writeUIntLE=function(A,e,t,r){(A=+A,e|=0,t|=0,r)||cA(this,A,e,t,Math.pow(2,8*t)-1,0);var i=1,n=0;for(this[e]=255&A;++n=0&&(n*=256);)this[e+i]=A/n&255;return e+t},J.prototype.writeUInt8=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,1,255,0),J.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),this[e]=255&A,e+1},J.prototype.writeUInt16LE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,2,65535,0),J.TYPED_ARRAY_SUPPORT?(this[e]=255&A,this[e+1]=A>>>8):lA(this,A,e,!0),e+2},J.prototype.writeUInt16BE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,2,65535,0),J.TYPED_ARRAY_SUPPORT?(this[e]=A>>>8,this[e+1]=255&A):lA(this,A,e,!1),e+2},J.prototype.writeUInt32LE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,4,4294967295,0),J.TYPED_ARRAY_SUPPORT?(this[e+3]=A>>>24,this[e+2]=A>>>16,this[e+1]=A>>>8,this[e]=255&A):BA(this,A,e,!0),e+4},J.prototype.writeUInt32BE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,4,4294967295,0),J.TYPED_ARRAY_SUPPORT?(this[e]=A>>>24,this[e+1]=A>>>16,this[e+2]=A>>>8,this[e+3]=255&A):BA(this,A,e,!1),e+4},J.prototype.writeIntLE=function(A,e,t,r){if(A=+A,e|=0,!r){var i=Math.pow(2,8*t-1);cA(this,A,e,t,i-1,-i)}var n=0,a=1,s=0;for(this[e]=255&A;++n=0&&(a*=256);)A<0&&0===s&&0!==this[e+n+1]&&(s=1),this[e+n]=(A/a|0)-s&255;return e+t},J.prototype.writeInt8=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,1,127,-128),J.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),A<0&&(A=255+A+1),this[e]=255&A,e+1},J.prototype.writeInt16LE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,2,32767,-32768),J.TYPED_ARRAY_SUPPORT?(this[e]=255&A,this[e+1]=A>>>8):lA(this,A,e,!0),e+2},J.prototype.writeInt16BE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,2,32767,-32768),J.TYPED_ARRAY_SUPPORT?(this[e]=A>>>8,this[e+1]=255&A):lA(this,A,e,!1),e+2},J.prototype.writeInt32LE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,4,2147483647,-2147483648),J.TYPED_ARRAY_SUPPORT?(this[e]=255&A,this[e+1]=A>>>8,this[e+2]=A>>>16,this[e+3]=A>>>24):BA(this,A,e,!0),e+4},J.prototype.writeInt32BE=function(A,e,t){return A=+A,e|=0,t||cA(this,A,e,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),J.TYPED_ARRAY_SUPPORT?(this[e]=A>>>24,this[e+1]=A>>>16,this[e+2]=A>>>8,this[e+3]=255&A):BA(this,A,e,!1),e+4},J.prototype.writeFloatLE=function(A,e,t){return QA(this,A,e,!0,t)},J.prototype.writeFloatBE=function(A,e,t){return QA(this,A,e,!1,t)},J.prototype.writeDoubleLE=function(A,e,t){return pA(this,A,e,!0,t)},J.prototype.writeDoubleBE=function(A,e,t){return pA(this,A,e,!1,t)},J.prototype.copy=function(A,e,t,r){if(t||(t=0),r||0===r||(r=this.length),e>=A.length&&(e=A.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),A.length-e=0;--i)A[i+e]=this[i+t];else if(n<1e3||!J.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,t=void 0===t?this.length:t>>>0,A||(A=0),"number"==typeof A)for(n=e;n55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&n.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&n.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&n.push(239,191,189),i=t;continue}t=65536+(i-55296<<10|t-56320)}else i&&(e-=3)>-1&&n.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;n.push(t)}else if(t<2048){if((e-=2)<0)break;n.push(t>>6|192,63&t|128)}else if(t<65536){if((e-=3)<0)break;n.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;n.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return n}function mA(A){return function(A){var e,t,r,i,n,a;b||F();var s=A.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");n="="===A[s-2]?2:"="===A[s-1]?1:0,a=new x(3*s/4-n),r=n>0?s-4:s;var o=0;for(e=0,t=0;e>16&255,a[o++]=i>>8&255,a[o++]=255&i;return 2===n?(i=v[A.charCodeAt(e)]<<2|v[A.charCodeAt(e+1)]>>4,a[o++]=255&i):1===n&&(i=v[A.charCodeAt(e)]<<10|v[A.charCodeAt(e+1)]<<4|v[A.charCodeAt(e+2)]>>2,a[o++]=i>>8&255,a[o++]=255&i),a}(function(A){if((A=function(A){return A.trim?A.trim():A.replace(/^\s+|\s+$/g,"")}(A).replace(dA,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(A))}function DA(A,e,t,r){for(var i=0;i=e.length||i>=A.length);++i)e[i+t]=A[i];return i}function wA(A){return!!A.constructor&&"function"==typeof A.constructor.isBuffer&&A.constructor.isBuffer(A)}function SA(){if(void 0===hA){var A=new ArrayBuffer(2),e=new Uint8Array(A),t=new Uint16Array(A);if(e[0]=1,e[1]=2,258===t[0])hA="BE";else{if(513!==t[0])throw new Error("unable to figure out endianess");hA="LE"}}return hA}function NA(){return void 0!==r.location?r.location.hostname:""}function kA(){return[]}function vA(){return 0}function xA(){return Number.MAX_VALUE}function bA(){return Number.MAX_VALUE}function FA(){return[]}function YA(){return"Browser"}function TA(){return void 0!==r.navigator?r.navigator.appVersion:""}function RA(){return{}}function GA(){return{}}function MA(){return"javascript"}function LA(){return"browser"}function PA(){return"/tmp"}var UA=PA;function JA(){return"$HOME"}var KA={homedir:JA,EOL:"\n",arch:MA,platform:LA,tmpdir:UA,tmpDir:PA,networkInterfaces:RA,getNetworkInterfaces:GA,release:TA,type:YA,cpus:FA,totalmem:bA,freemem:xA,uptime:vA,loadavg:kA,hostname:NA,endianness:SA},HA=e(Object.freeze({__proto__:null,EOL:"\n",arch:MA,cpus:FA,default:KA,endianness:SA,freemem:xA,getNetworkInterfaces:GA,homedir:JA,hostname:NA,loadavg:kA,networkInterfaces:RA,platform:LA,release:TA,tmpDir:PA,tmpdir:UA,totalmem:bA,type:YA,uptime:vA}));function OA(){return!1}function _A(){throw new Error("tty.ReadStream is not implemented")}function jA(){throw new Error("tty.ReadStream is not implemented")}var zA,qA={isatty:OA,ReadStream:_A,WriteStream:jA},VA=e(Object.freeze({__proto__:null,ReadStream:_A,WriteStream:jA,default:qA,isatty:OA}));zA="function"==typeof Object.create?function(A,e){A.super_=e,A.prototype=Object.create(e.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}})}:function(A,e){A.super_=e;var t=function(){};t.prototype=e.prototype,A.prototype=new t,A.prototype.constructor=A};var WA=Object.getOwnPropertyDescriptors||function(A){for(var e=Object.keys(A),t={},r=0;r=i)return A;switch(A){case"%s":return String(r[t++]);case"%d":return Number(r[t++]);case"%j":try{return JSON.stringify(r[t++])}catch(A){return"[Circular]"}default:return A}})),a=r[t];t=3&&(t.depth=arguments[2]),arguments.length>=4&&(t.colors=arguments[3]),Ie(e)?t.showHidden=e:e&&ke(t,e),Ee(t.showHidden)&&(t.showHidden=!1),Ee(t.depth)&&(t.depth=2),Ee(t.colors)&&(t.colors=!1),Ee(t.customInspect)&&(t.customInspect=!0),t.colors&&(t.stylize=ie),ae(t,A,t.depth)}function ie(A,e){var t=re.styles[e];return t?"["+re.colors[t][0]+"m"+A+"["+re.colors[t][1]+"m":A}function ne(A,e){return A}function ae(A,e,t){if(A.customInspect&&e&&fe(e.inspect)&&e.inspect!==re&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(t,A);return le(r)||(r=ae(A,r,t)),r}var i=function(A,e){if(Ee(e))return A.stylize("undefined","undefined");if(le(e)){var t="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return A.stylize(t,"string")}if(ce(e))return A.stylize(""+e,"number");if(Ie(e))return A.stylize(""+e,"boolean");if(Ce(e))return A.stylize("null","null")}(A,e);if(i)return i;var n=Object.keys(e),a=function(A){var e={};return A.forEach((function(A,t){e[A]=!0})),e}(n);if(A.showHidden&&(n=Object.getOwnPropertyNames(e)),de(e)&&(n.indexOf("message")>=0||n.indexOf("description")>=0))return se(e);if(0===n.length){if(fe(e)){var s=e.name?": "+e.name:"";return A.stylize("[Function"+s+"]","special")}if(Qe(e))return A.stylize(RegExp.prototype.toString.call(e),"regexp");if(he(e))return A.stylize(Date.prototype.toString.call(e),"date");if(de(e))return se(e)}var o,g="",I=!1,C=["{","}"];(ge(e)&&(I=!0,C=["[","]"]),fe(e))&&(g=" [Function"+(e.name?": "+e.name:"")+"]");return Qe(e)&&(g=" "+RegExp.prototype.toString.call(e)),he(e)&&(g=" "+Date.prototype.toUTCString.call(e)),de(e)&&(g=" "+se(e)),0!==n.length||I&&0!=e.length?t<0?Qe(e)?A.stylize(RegExp.prototype.toString.call(e),"regexp"):A.stylize("[Object]","special"):(A.seen.push(e),o=I?function(A,e,t,r,i){for(var n=[],a=0,s=e.length;a60)return t[0]+(""===e?"":e+"\n ")+" "+A.join(",\n ")+" "+t[1];return t[0]+e+" "+A.join(", ")+" "+t[1]}(o,g,C)):C[0]+g+C[1]}function se(A){return"["+Error.prototype.toString.call(A)+"]"}function oe(A,e,t,r,i,n){var a,s,o;if((o=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=o.set?A.stylize("[Getter/Setter]","special"):A.stylize("[Getter]","special"):o.set&&(s=A.stylize("[Setter]","special")),ve(r,i)||(a="["+i+"]"),s||(A.seen.indexOf(o.value)<0?(s=Ce(t)?ae(A,o.value,null):ae(A,o.value,t-1)).indexOf("\n")>-1&&(s=n?s.split("\n").map((function(A){return" "+A})).join("\n").substr(2):"\n"+s.split("\n").map((function(A){return" "+A})).join("\n")):s=A.stylize("[Circular]","special")),Ee(a)){if(n&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=A.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=A.stylize(a,"string"))}return a+": "+s}function ge(A){return Array.isArray(A)}function Ie(A){return"boolean"==typeof A}function Ce(A){return null===A}function ue(A){return null==A}function ce(A){return"number"==typeof A}function le(A){return"string"==typeof A}function Be(A){return"symbol"==typeof A}function Ee(A){return void 0===A}function Qe(A){return pe(A)&&"[object RegExp]"===De(A)}function pe(A){return"object"==typeof A&&null!==A}function he(A){return pe(A)&&"[object Date]"===De(A)}function de(A){return pe(A)&&("[object Error]"===De(A)||A instanceof Error)}function fe(A){return"function"==typeof A}function ye(A){return null===A||"boolean"==typeof A||"number"==typeof A||"string"==typeof A||"symbol"==typeof A||void 0===A}function me(A){return J.isBuffer(A)}function De(A){return Object.prototype.toString.call(A)}function we(A){return A<10?"0"+A.toString(10):A.toString(10)}re.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},re.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Se=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ne(){var A,e;console.log("%s - %s",(A=new Date,e=[we(A.getHours()),we(A.getMinutes()),we(A.getSeconds())].join(":"),[A.getDate(),Se[A.getMonth()],e].join(" ")),ZA.apply(null,arguments))}function ke(A,e){if(!e||!pe(e))return A;for(var t=Object.keys(e),r=t.length;r--;)A[t[r]]=e[t[r]];return A}function ve(A,e){return Object.prototype.hasOwnProperty.call(A,e)}var xe="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function be(A){if("function"!=typeof A)throw new TypeError('The "original" argument must be of type Function');if(xe&&A[xe]){var e;if("function"!=typeof(e=A[xe]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,xe,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,t,r=new Promise((function(A,r){e=A,t=r})),i=[],n=0;nA.length)&&(e=A.length);for(var t=0,r=new Array(e);t0&&i[i.length-1])||6!==n[0]&&2!==n[0])){a=0;continue}if(3===n[0]&&(!i||n[1]>i[0]&&n[1]=A.length&&(A=void 0),{value:A&&A[r++],done:!A}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function et(){var A=qe(["pipelineOperator"]);return et=function(){return A},A}function tt(){var A=qe(["flow"]);return tt=function(){return A},A}function rt(){var A=qe(["jsx"]);return rt=function(){return A},A}function it(){var A=qe(["typescript"]);return it=function(){return A},A}function nt(){var A=qe(["placeholders"]);return nt=function(){return A},A}function at(){var A=qe(["\n (function (",") {\n function ","(",") {\n return ",".apply(this, arguments);\n }\n\n ",".toString = function () {\n return ",".toString();\n }\n\n return ",";\n })(",")\n "]);return at=function(){return A},A}var st=Object.create,ot=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,It=Object.getOwnPropertyNames,Ct=Object.getPrototypeOf,ut=Object.prototype.hasOwnProperty,ct=function(A,e){return function(){return e||(0,A[It(A)[0]])((e={exports:{}}).exports,e),e.exports}},lt=function(A,e){for(var t in e)ot(A,t,{get:e[t],enumerable:!0})},Bt=function(A,e,t,r){if(e&&"object"===(void 0===e?"undefined":We(e))||"function"==typeof e){var i=!0,n=!1,a=void 0;try{for(var s,o=function(){var i=s.value;ut.call(A,i)||i===t||ot(A,i,{get:function(){return e[i]},enumerable:!(r=gt(e,i))||r.enumerable})},g=It(e)[Symbol.iterator]();!(i=(s=g.next()).done);i=!0)o()}catch(A){n=!0,a=A}finally{try{i||null==g.return||g.return()}finally{if(n)throw a}}}return A},Et=function(A,e,t){return t=null!=A?st(Ct(A)):{},Bt(ot(t,"default",{value:A,enumerable:!0}),A)},Qt=function(A,e,t){return function(A,e,t){return e in A?ot(A,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):A[e]=t}(A,"symbol"!==(void 0===e?"undefined":We(e))?e+"":e,t)},pt=ct({"node_modules/picocolors/picocolors.js":function(A,e){var t=N||{},r=t.argv||[],i=t.env||{},n=!(i.NO_COLOR||r.includes("--no-color"))&&(!!i.FORCE_COLOR||r.includes("--color")||"win32"===t.platform||(t.stdout||{}).isTTY&&"dumb"!==i.TERM||!!i.CI),a=function(A,e){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A;return function(r){var i=""+r,n=i.indexOf(e,A.length);return~n?A+s(i,e,t,n)+e:A+i+e}},s=function(A,e,t,r){var i="",n=0;do{i+=A.substring(n,r)+t,n=r+e.length,r=A.indexOf(e,n)}while(~r);return i+A.substring(n)},o=function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,e=A?a:function(){return String};return{isColorSupported:A,reset:e("",""),bold:e("","",""),dim:e("","",""),italic:e("",""),underline:e("",""),inverse:e("",""),hidden:e("",""),strikethrough:e("",""),black:e("",""),red:e("",""),green:e("",""),yellow:e("",""),blue:e("",""),magenta:e("",""),cyan:e("",""),white:e("",""),gray:e("",""),bgBlack:e("",""),bgRed:e("",""),bgGreen:e("",""),bgYellow:e("",""),bgBlue:e("",""),bgMagenta:e("",""),bgCyan:e("",""),bgWhite:e("",""),blackBright:e("",""),redBright:e("",""),greenBright:e("",""),yellowBright:e("",""),blueBright:e("",""),magentaBright:e("",""),cyanBright:e("",""),whiteBright:e("",""),bgBlackBright:e("",""),bgRedBright:e("",""),bgGreenBright:e("",""),bgYellowBright:e("",""),bgBlueBright:e("",""),bgMagentaBright:e("",""),bgCyanBright:e("",""),bgWhiteBright:e("","")}};e.exports=o(),e.exports.createColors=o}}),ht=ct({"node_modules/@babel/code-frame/node_modules/js-tokens/index.js":function(A,e){var t,r,i,n,a,s,o,g,I,C,u,c,l,B,E,Q,p,h,d;l=RegExp("\\/(?![*\\/])(?:\\[(?:[^\\]\\\\\\n\\r\\u2028\\u2029]+|\\\\.)*\\]|[^\\/\\\\\\n\\r\\u2028\\u2029]+|\\\\.)*(\\/[$_\\u200C\\u200D\\p{ID_Continue}]*|\\\\)?","yu"),c=RegExp("--|\\+\\+|=>|\\.{3}|\\??\\.(?!\\d)|(?:&&|\\|\\||\\?\\?|[+\\-%&|^]|\\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\\/(?![\\/*]))=?|[?~,:;[\\](){}]","y"),t=RegExp("(\\x23?)(?=[$_\\p{ID_Start}\\\\])(?:[$_\\u200C\\u200D\\p{ID_Continue}]+|\\\\u[\\da-fA-F]{4}|\\\\u\\{[\\da-fA-F]+\\})+","yu"),E=RegExp("(['\"])(?:[^'\"\\\\\\n\\r]+|(?!\\1)['\"]|\\\\(?:\\r\\n|[^]))*(\\1)?","y"),u=RegExp("(?:0[xX][\\da-fA-F](?:_?[\\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\\d)*n|(?:(?:0(?!\\d)|0\\d*[89]\\d*|[1-9](?:_?\\d)*)(?:\\.(?:\\d(?:_?\\d)*)?)?|\\.\\d(?:_?\\d)*)(?:[eE][+-]?\\d(?:_?\\d)*)?|0[0-7]+","y"),Q=RegExp("[`}](?:[^`\\\\$]+|\\\\[^]|\\$(?!\\{))*(`|\\$\\{)?","y"),d=RegExp("[\\t\\v\\f\\ufeff\\p{Zs}]+","yu"),g=RegExp("\\r?\\n|[\\r\\u2028\\u2029]","y"),I=RegExp("\\/\\*(?:[^*]+|\\*(?!\\/))*(\\*\\/)?","y"),B=RegExp("\\/\\/.*","y"),i=RegExp("[<>.:={}]|\\/(?![\\/*])","y"),r=RegExp("[$_\\p{ID_Start}][$_\\u200C\\u200D\\p{ID_Continue}-]*","yu"),n=RegExp("(['\"])(?:[^'\"]+|(?!\\1)['\"])*(\\1)?","y"),a=RegExp("[^<>{}]+","y"),h=/^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/,p=/^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/,s=/^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/,o=/^(?:return|throw|yield)$/,C=RegExp(g.source),e.exports=function(A){var e,f,y,m,D,w,S,N,k,v,x,b,F,Y,T,R,G=arguments;return $e(this,(function(M){switch(M.label){case 0:e=(G.length>1&&void 0!==G[1]?G[1]:{}).jsx,f=void 0!==e&&e,N=A.length,w=0,S="",R=[{tag:"JS"}],y=[],F=0,Y=!1,M.label=1;case 1:if(!(w":R.pop(),"/"===S||"JSXTagEnd"===v.tag?(b="?JSX",Y=!0):R.push({tag:"JSXChildren"});break;case"{":R.push({tag:"InterpolationInJSX",nesting:y.length}),b="?InterpolationInJSX",Y=!1;break;case"/":"<"===S&&(R.pop(),"JSXChildren"===R[R.length-1].tag&&R.pop(),R.push({tag:"JSXTagEnd"}))}return S=b,[4,{type:"JSXPunctuator",value:k[0]}];case 39:return M.sent(),[3,1];case 40:return r.lastIndex=w,(k=r.exec(A))?(w=r.lastIndex,S=k[0],[4,{type:"JSXIdentifier",value:k[0]}]):[3,42];case 41:return M.sent(),[3,1];case 42:return n.lastIndex=w,(k=n.exec(A))?(w=n.lastIndex,S=k[0],[4,{type:"JSXString",value:k[0],closed:void 0!==k[2]}]):[3,44];case 43:return M.sent(),[3,1];case 44:return[3,52];case 45:return a.lastIndex=w,(k=a.exec(A))?(w=a.lastIndex,S=k[0],[4,{type:"JSXText",value:k[0]}]):[3,47];case 46:return M.sent(),[3,1];case 47:switch(A[w]){case"<":return[3,48];case"{":return[3,50]}return[3,52];case 48:return R.push({tag:"JSXTag"}),w++,S="<",[4,{type:"JSXPunctuator",value:"<"}];case 49:return M.sent(),[3,1];case 50:return R.push({tag:"InterpolationInJSX",nesting:y.length}),w++,S="?InterpolationInJSX",Y=!1,[4,{type:"JSXPunctuator",value:"{"}];case 51:return M.sent(),[3,1];case 52:return d.lastIndex=w,(k=d.exec(A))?(w=d.lastIndex,[4,{type:"WhiteSpace",value:k[0]}]):[3,54];case 53:return M.sent(),[3,1];case 54:return g.lastIndex=w,(k=g.exec(A))?(w=g.lastIndex,Y=!1,o.test(S)&&(S="?NoLineTerminatorHere"),[4,{type:"LineTerminatorSequence",value:k[0]}]):[3,56];case 55:return M.sent(),[3,1];case 56:return I.lastIndex=w,(k=I.exec(A))?(w=I.lastIndex,C.test(k[0])&&(Y=!1,o.test(S)&&(S="?NoLineTerminatorHere")),[4,{type:"MultiLineComment",value:k[0],closed:void 0!==k[1]}]):[3,58];case 57:return M.sent(),[3,1];case 58:return B.lastIndex=w,(k=B.exec(A))?(w=B.lastIndex,Y=!1,[4,{type:"SingleLineComment",value:k[0]}]):[3,60];case 59:return M.sent(),[3,1];case 60:return m=String.fromCodePoint(A.codePointAt(w)),w+=m.length,S=m,Y=!1,[4,{type:v.tag.startsWith("JSX")?"JSXInvalid":"Invalid",value:m}];case 61:return M.sent(),[3,1];case 62:return[2,void 0]}}))}}}),dt=ct({"node_modules/jsesc/jsesc.js":function(A,e){var t={},r=t.hasOwnProperty,i=function(A,e){for(var t in A)r.call(A,t)&&e(t,A[t])},n=function(A){return"\\u"+("0000"+A).slice(-4)},a=function(A,e){var t=A.toString(16);return e?t:t.toUpperCase()},s=t.toString,o=Array.isArray,g={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},I=/[\\\b\f\n\r\t]/,C=/[0-9]/,u=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,c=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,l=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,B=function(A,e){var t,r,E=function(){D=m,++e.indentLevel,m=e.indent.repeat(e.indentLevel)},Q={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",indentLevel:0,__inline1__:!1,__inline2__:!1},p=e&&e.json;p&&(Q.quotes="double",Q.wrap=!0),t=Q,e=(r=e)?(i(r,(function(A,e){t[A]=e})),t):t,"single"!=e.quotes&&"double"!=e.quotes&&"backtick"!=e.quotes&&(e.quotes="single");var h,d="double"==e.quotes?'"':"backtick"==e.quotes?"`":"'",f=e.compact,y=e.lowercaseHex,m=e.indent.repeat(e.indentLevel),D="",w=e.__inline1__,S=e.__inline2__,N=f?"":"\n",k=!0,v="binary"==e.numbers,x="octal"==e.numbers,b="decimal"==e.numbers,F="hexadecimal"==e.numbers;if(p&&A&&"function"==typeof A.toJSON&&(A=A.toJSON()),!function(A){return"string"==typeof A||"[object String]"==s.call(A)}(A)){if(function(A){return"[object Map]"==s.call(A)}(A))return 0==A.size?"new Map()":(f||(e.__inline1__=!0,e.__inline2__=!1),"new Map("+B(Array.from(A),e)+")");if(function(A){return"[object Set]"==s.call(A)}(A))return 0==A.size?"new Set()":"new Set("+B(Array.from(A),e)+")";if(function(A){return Array.isArray(A)}(A))return 0==A.length?"Buffer.from([])":"Buffer.from("+B(Array.from(A),e)+")";if(o(A))return h=[],e.wrap=!0,w&&(e.__inline1__=!1,e.__inline2__=!0),S||E(),function(A,e){for(var t=A.length,r=-1;++r2?n(B):"\\x"+("00"+B).slice(-2)})),"`"==d&&(h=h.replace(/\$\{/g,"\\${")),e.isScriptContext&&(h=h.replace(/<\/(script|style)/gi,"<\\/$1").replace(/