// -> /+ if (!this.preserveMultipleSlashes) { + for (var i = 1; i < parts.length - 1; i++) { + var p = parts[i]; + // don't squeeze out UNC patterns + if (i === 1 && p === '' && parts[0] === '') continue; + if (p === '.' || p === '') { + didSomething = true; + parts.splice(i, 1); + i--; + } + } + if (parts[0] === '.' && parts.length === 2 && (parts[1] === '.' || parts[1] === '')) { + didSomething = true; + parts.pop(); + } + } + // //../
-> /+ var dd = 0; + while (-1 !== (dd = parts.indexOf('..', dd + 1))) { + var _p = parts[dd - 1]; + if (_p && _p !== '.' && _p !== '..' && _p !== '**') { + didSomething = true; + parts.splice(dd - 1, 2); + dd -= 2; + } + } + } while (didSomething); + return parts.length === 0 ? [''] : parts; + } + // First phase: single-pattern processing + // is 1 or more portions + //is 1 or more portions + // is any portion other than ., .., '', or ** + //
is . or '' + // + // **/.. is *brutal* for filesystem walking performance, because + // it effectively resets the recursive walk each time it occurs, + // and ** cannot be reduced out by a .. pattern part like a regexp + // or most strings (other than .., ., and '') can be. + // + // /**/..//
/
-> { /..//
/
, /**//
/
} + // // -> /+ // //../
-> /+ // **/**/ -> **/ + // + // **/*/ -> */**/ <== not valid because ** doesn't follow + // this WOULD be allowed if ** did follow symlinks, or * didn't + }, { + key: "firstPhasePreProcess", + value: function firstPhasePreProcess(globParts) { + var didSomething = false; + do { + didSomething = false; + // /**/..//
/
-> { /..//
/
, /**//
/
} + var _iterator3 = (0,createForOfIteratorHelper/* default */.A)(globParts), + _step3; + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var parts = _step3.value; + var gs = -1; + while (-1 !== (gs = parts.indexOf('**', gs + 1))) { + var gss = gs; + while (parts[gss + 1] === '**') { + // /**/**/-> /**/+ gss++; + } + // eg, if gs is 2 and gss is 4, that means we have 3 ** + // parts, and can remove 2 of them. + if (gss > gs) { + parts.splice(gs + 1, gss - gs); + } + var next = parts[gs + 1]; + var p = parts[gs + 2]; + var p2 = parts[gs + 3]; + if (next !== '..') continue; + if (!p || p === '.' || p === '..' || !p2 || p2 === '.' || p2 === '..') { + continue; + } + didSomething = true; + // edit parts in place, and push the new one + parts.splice(gs, 1); + var other = parts.slice(0); + other[gs] = '**'; + globParts.push(other); + gs--; + } + // // -> /+ if (!this.preserveMultipleSlashes) { + for (var i = 1; i < parts.length - 1; i++) { + var _p2 = parts[i]; + // don't squeeze out UNC patterns + if (i === 1 && _p2 === '' && parts[0] === '') continue; + if (_p2 === '.' || _p2 === '') { + didSomething = true; + parts.splice(i, 1); + i--; + } + } + if (parts[0] === '.' && parts.length === 2 && (parts[1] === '.' || parts[1] === '')) { + didSomething = true; + parts.pop(); + } + } + // //../
-> /+ var dd = 0; + while (-1 !== (dd = parts.indexOf('..', dd + 1))) { + var _p3 = parts[dd - 1]; + if (_p3 && _p3 !== '.' && _p3 !== '..' && _p3 !== '**') { + didSomething = true; + var needDot = dd === 1 && parts[dd + 1] === '**'; + var splin = needDot ? ['.'] : []; + parts.splice.apply(parts, [dd - 1, 2].concat(splin)); + if (parts.length === 0) parts.push(''); + dd -= 2; + } + } + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + } while (didSomething); + return globParts; + } + // second phase: multi-pattern dedupes + // { /*/, //
} -> /*/+ // { /, /} -> /+ // { /**/, /} -> /**/+ // + // { /**/, /**//
} -> /**/+ // ^-- not valid because ** doens't follow symlinks + }, { + key: "secondPhasePreProcess", + value: function secondPhasePreProcess(globParts) { + for (var i = 0; i < globParts.length - 1; i++) { + for (var j = i + 1; j < globParts.length; j++) { + var matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes); + if (matched) { + globParts[i] = []; + globParts[j] = matched; + break; + } + } + } + return globParts.filter(function (gs) { + return gs.length; + }); + } + }, { + key: "partsMatch", + value: function partsMatch(a, b) { + var emptyGSMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var ai = 0; + var bi = 0; + var result = []; + var which = ''; + while (ai < a.length && bi < b.length) { + if (a[ai] === b[bi]) { + result.push(which === 'b' ? b[bi] : a[ai]); + ai++; + bi++; + } else if (emptyGSMatch && a[ai] === '**' && b[bi] === a[ai + 1]) { + result.push(a[ai]); + ai++; + } else if (emptyGSMatch && b[bi] === '**' && a[ai] === b[bi + 1]) { + result.push(b[bi]); + bi++; + } else if (a[ai] === '*' && b[bi] && (this.options.dot || !b[bi].startsWith('.')) && b[bi] !== '**') { + if (which === 'b') return false; + which = 'a'; + result.push(a[ai]); + ai++; + bi++; + } else if (b[bi] === '*' && a[ai] && (this.options.dot || !a[ai].startsWith('.')) && a[ai] !== '**') { + if (which === 'a') return false; + which = 'b'; + result.push(b[bi]); + ai++; + bi++; + } else { + return false; + } + } + // if we fall out of the loop, it means they two are identical + // as long as their lengths match + return a.length === b.length && result; + } + }, { + key: "parseNegate", + value: function parseNegate() { + if (this.nonegate) return; + var pattern = this.pattern; + var negate = false; + var negateOffset = 0; + for (var i = 0; i < pattern.length && pattern.charAt(i) === '!'; i++) { + negate = !negate; + negateOffset++; + } + if (negateOffset) this.pattern = pattern.slice(negateOffset); + this.negate = negate; + } + // set partial to true to test if, for example, + // "/a/b" matches the start of "/*/b/*/d" + // Partial means, if you run out of file before you run + // out of pattern, then that's fine, as long as all + // the parts match. + }, { + key: "matchOne", + value: function matchOne(file, pattern) { + var partial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var options = this.options; + // UNC paths like //?/X:/... can match X:/... and vice versa + // Drive letters in absolute drive or unc paths are always compared + // case-insensitively. + if (this.isWindows) { + var fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]); + var fileUNC = !fileDrive && file[0] === '' && file[1] === '' && file[2] === '?' && /^[a-z]:$/i.test(file[3]); + var patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]); + var patternUNC = !patternDrive && pattern[0] === '' && pattern[1] === '' && pattern[2] === '?' && typeof pattern[3] === 'string' && /^[a-z]:$/i.test(pattern[3]); + var fdi = fileUNC ? 3 : fileDrive ? 0 : undefined; + var pdi = patternUNC ? 3 : patternDrive ? 0 : undefined; + if (typeof fdi === 'number' && typeof pdi === 'number') { + var _ref13 = [file[fdi], pattern[pdi]], + fd = _ref13[0], + pd = _ref13[1]; + if (fd.toLowerCase() === pd.toLowerCase()) { + pattern[pdi] = fd; + if (pdi > fdi) { + pattern = pattern.slice(pdi); + } else if (fdi > pdi) { + file = file.slice(fdi); + } + } + } + } + // resolve and reduce . and .. portions in the file as well. + // dont' need to do the second phase, because it's only one string[] + var _this$options$optimiz2 = this.options.optimizationLevel, + optimizationLevel = _this$options$optimiz2 === void 0 ? 1 : _this$options$optimiz2; + if (optimizationLevel >= 2) { + file = this.levelTwoFileOptimize(file); + } + this.debug('matchOne', this, { + file: file, + pattern: pattern + }); + this.debug('matchOne', file.length, pattern.length); + for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { + this.debug('matchOne loop'); + var p = pattern[pi]; + var f = file[fi]; + this.debug(pattern, p, f); + // should be impossible. + // some invalid regexp stuff in the set. + /* c8 ignore start */ + if (p === false) { + return false; + } + /* c8 ignore stop */ + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]); + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi; + var pr = pi + 1; + if (pr === pl) { + this.debug('** at the end'); + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || !options.dot && file[fi].charAt(0) === '.') return false; + } + return true; + } + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr]; + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee); + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee); + // found a match. + return true; + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || !options.dot && swallowee.charAt(0) === '.') { + this.debug('dot detected!', file, fr, pattern, pr); + break; + } + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue'); + fr++; + } + } + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + /* c8 ignore start */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr); + if (fr === fl) { + return true; + } + } + /* c8 ignore stop */ + return false; + } + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit = void 0; + if (typeof p === 'string') { + hit = f === p; + this.debug('string match', p, f, hit); + } else { + hit = p.test(f); + this.debug('pattern match', p, f, hit); + } + if (!hit) return false; + } + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true; + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial; + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return fi === fl - 1 && file[fi] === ''; + /* c8 ignore start */ + } else { + // should be unreachable. + throw new Error('wtf?'); + } + /* c8 ignore stop */ + } + }, { + key: "braceExpand", + value: function braceExpand() { + return _braceExpand(this.pattern, this.options); + } + }, { + key: "parse", + value: function parse(pattern) { + assertValidPattern(pattern); + var options = this.options; + // shortcuts + if (pattern === '**') return GLOBSTAR; + if (pattern === '') return ''; + // far and away, the most common glob pattern parts are + // *, *.*, and *. Add a fast check method for those. + var m; + var fastTest = null; + if (m = pattern.match(starRE)) { + fastTest = options.dot ? starTestDot : starTest; + } else if (m = pattern.match(starDotExtRE)) { + fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]); + } else if (m = pattern.match(qmarksRE)) { + fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m); + } else if (m = pattern.match(starDotStarRE)) { + fastTest = options.dot ? starDotStarTestDot : starDotStarTest; + } else if (m = pattern.match(dotStarRE)) { + fastTest = dotStarTest; + } + var re = AST.fromGlob(pattern, this.options).toMMPattern(); + if (fastTest && typeof re === 'object') { + // Avoids overriding in frozen environments + Reflect.defineProperty(re, 'test', { + value: fastTest + }); + } + return re; + } + }, { + key: "makeRe", + value: function makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set; + if (!set.length) { + this.regexp = false; + return this.regexp; + } + var options = this.options; + var twoStar = options.noglobstar ? esm_star : options.dot ? twoStarDot : twoStarNoDot; + var flags = new Set(options.nocase ? ['i'] : []); + // regexpify non-globstar patterns + // if ** is only item, then we just do one twoStar + // if ** is first, and there are more, prepend (\/|twoStar\/)? to next + // if ** is last, append (\/twoStar|) to previous + // if ** is in the middle, append (\/|\/twoStar\/) to previous + // then filter out GLOBSTAR symbols + var re = set.map(function (pattern) { + var pp = pattern.map(function (p) { + if (p instanceof RegExp) { + var _iterator4 = (0,createForOfIteratorHelper/* default */.A)(p.flags.split('')), + _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { + var f = _step4.value; + flags.add(f); + } + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + } + return typeof p === 'string' ? esm_regExpEscape(p) : p === GLOBSTAR ? GLOBSTAR : p._src; + }); + pp.forEach(function (p, i) { + var next = pp[i + 1]; + var prev = pp[i - 1]; + if (p !== GLOBSTAR || prev === GLOBSTAR) { + return; + } + if (prev === undefined) { + if (next !== undefined && next !== GLOBSTAR) { + pp[i + 1] = '(?:\\/|' + twoStar + '\\/)?' + next; + } else { + pp[i] = twoStar; + } + } else if (next === undefined) { + pp[i - 1] = prev + '(?:\\/|' + twoStar + ')?'; + } else if (next !== GLOBSTAR) { + pp[i - 1] = prev + '(?:\\/|\\/' + twoStar + '\\/)' + next; + pp[i + 1] = GLOBSTAR; + } + }); + return pp.filter(function (p) { + return p !== GLOBSTAR; + }).join('/'); + }).join('|'); + // need to wrap in parens if we had more than one thing with |, + // otherwise only the first will be anchored to ^ and the last to $ + var _ref14 = set.length > 1 ? ['(?:', ')'] : ['', ''], + _ref15 = (0,slicedToArray/* default */.A)(_ref14, 2), + open = _ref15[0], + close = _ref15[1]; + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^' + open + re + close + '$'; + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').+$'; + try { + this.regexp = new RegExp(re, (0,toConsumableArray/* default */.A)(flags).join('')); + /* c8 ignore start */ + } catch (ex) { + // should be impossible + this.regexp = false; + } + /* c8 ignore stop */ + return this.regexp; + } + }, { + key: "slashSplit", + value: function slashSplit(p) { + // if p starts with // on windows, we preserve that + // so that UNC paths aren't broken. Otherwise, any number of + // / characters are coalesced into one, unless + // preserveMultipleSlashes is set to true. + if (this.preserveMultipleSlashes) { + return p.split('/'); + } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) { + // add an extra '' for the one we lose + return [''].concat((0,toConsumableArray/* default */.A)(p.split(/\/+/))); + } else { + return p.split(/\/+/); + } + } + }, { + key: "match", + value: function match(f) { + var partial = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.partial; + this.debug('match', f, this.pattern); + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) { + return false; + } + if (this.empty) { + return f === ''; + } + if (f === '/' && partial) { + return true; + } + var options = this.options; + // windows: need to use /, not \ + if (this.isWindows) { + f = f.split('\\').join('/'); + } + // treat the test path as a set of pathparts. + var ff = this.slashSplit(f); + this.debug(this.pattern, 'split', ff); + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + var set = this.set; + this.debug(this.pattern, 'set', set); + // Find the basename of the path by looking for the last non-empty segment + var filename = ff[ff.length - 1]; + if (!filename) { + for (var i = ff.length - 2; !filename && i >= 0; i--) { + filename = ff[i]; + } + } + for (var _i = 0; _i < set.length; _i++) { + var pattern = set[_i]; + var file = ff; + if (options.matchBase && pattern.length === 1) { + file = [filename]; + } + var hit = this.matchOne(file, pattern, partial); + if (hit) { + if (options.flipNegate) { + return true; + } + return !this.negate; + } + } + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) { + return false; + } + return this.negate; + } + }], [{ + key: "defaults", + value: function defaults(def) { + return minimatch.defaults(def).Minimatch; + } + }]); +}(); +/* c8 ignore start */ + + + +/* c8 ignore stop */ +minimatch.AST = AST; +minimatch.Minimatch = Minimatch; +minimatch.escape = escape_escape; +minimatch.unescape = unescape_unescape; +//# sourceMappingURL=index.js.map +;// CONCATENATED MODULE: ./node_modules/dree/bundled/lib/esm/index.esm.js + + + + + + + + +var re = function (n) { + return n.DIRECTORY = "directory", n.FILE = "file", n; + }(re || {}), + ne = function (a) { + return a.ALPHABETICAL = "alpha", a.ALPHABETICAL_REVERSE = "antialpha", a.ALPHABETICAL_INSENSITIVE = "alpha-insensitive", a.ALPHABETICAL_INSENSITIVE_REVERSE = "antialpha-insensitive", a; + }(ne || {}), + se = function (l) { + return l.ALPHABETICAL = "alpha", l.ALPHABETICAL_REVERSE = "antialpha", l.ALPHABETICAL_INSENSITIVE = "alpha-insensitive", l.ALPHABETICAL_INSENSITIVE_REVERSE = "antialpha-insensitive", l.FOLDERS_FIRST = "folders-first", l.FILES_FIRST = "files-first", l; + }(se || {}), + C = { + stat: !1, + normalize: !1, + symbolicLinks: !0, + followLinks: !1, + sizeInBytes: !0, + size: !0, + hash: !0, + hashAlgorithm: "md5", + hashEncoding: "hex", + showHidden: !0, + depth: void 0, + exclude: void 0, + matches: void 0, + extensions: void 0, + emptyDirectory: !1, + excludeEmptyDirectories: !1, + descendants: !1, + descendantsIgnoreDirectories: !1, + sorted: !1, + postSorted: !1, + homeShortcut: !1, + skipErrors: !0 + }, + B = { + symbolicLinks: !0, + followLinks: !1, + showHidden: !0, + depth: void 0, + exclude: void 0, + extensions: void 0, + sorted: !1, + postSorted: !1, + homeShortcut: !1, + skipErrors: !0 + }; +function D(r, t) { + return (0,external_node_path_namespaceObject.resolve)(t.homeShortcut ? r.replace(/^~($|\/|\\)/, (0,external_node_os_namespaceObject.homedir)() + "$1") : r); +} +function x(r) { + return (Array.isArray(r) ? r : [r]).map(function (t) { + return t instanceof RegExp ? t : makeRe(t, { + dot: !0 + }); + }).filter(function (t) { + return t instanceof RegExp; + }); +} +function M(r) { + var t = {}; + if (r) { + for (var n in C) t[n] = r[n] !== void 0 ? r[n] : C[n]; + t.depth < 0 && (t.depth = 0); + } else t = C; + return t; +} +function p(r) { + var t = {}; + if (r) { + for (var n in B) t[n] = r[n] !== void 0 ? r[n] : B[n]; + t.depth < 0 && (t.depth = 0); + } else t = B; + return t; +} +function P(r) { + var t = ["B", "KB", "MB", "GB", "TB"], + n; + for (n = 0; n < t.length && r > 1e3; n++) r /= 1e3; + return Math.round(r * 100) / 100 + " " + t[n]; +} +function L(r, t) { + return r.localeCompare(t); +} +function k(r, t) { + return r.toLowerCase().localeCompare(t.toLowerCase()); +} +function A(r, t) { + if (!t) return r; + if (t === !0) return r.sort(L); + if (typeof t == "string") switch (t) { + case "alpha": + return r.sort(L); + case "antialpha": + return r.sort(L).reverse(); + case "alpha-insensitive": + return r.sort(k); + case "antialpha-insensitive": + return r.sort(k).reverse(); + default: + return r; + } else if (typeof t == "function") return r.sort(t); +} +function z(r, t) { + return L(r.name, t.name); +} +function Y(r, t) { + return k(r.name, t.name); +} +function ie(r, t) { + return r.type === "directory" && t.type === "file" ? -1 : r.type === "file" && t.type === "directory" ? 1 : 0; +} +function ae(r, t) { + return r.type === "file" && t.type === "directory" ? -1 : r.type === "directory" && t.type === "file" ? 1 : 0; +} +function $(r, t) { + if (!t) return r; + if (t === !0) return r.sort(z); + if (typeof t == "string") switch (t) { + case "alpha": + return r.sort(z); + case "antialpha": + return r.sort(z).reverse(); + case "alpha-insensitive": + return r.sort(Y); + case "antialpha-insensitive": + return r.sort(Y).reverse(); + case "folders-first": + return r.sort(ie); + case "files-first": + return r.sort(ae); + default: + return r; + } else if (typeof t == "function") return r.sort(t); +} +function q(r, t) { + if (!t) return r; + if (t === !0) return r.sort(function (n, e) { + return L(n.relativePath, e.relativePath); + }); + if (typeof t == "string") switch (t) { + case "alpha": + return r.sort(function (n, e) { + return L(n.relativePath, e.relativePath); + }); + case "antialpha": + return r.sort(function (n, e) { + return L(n.relativePath, e.relativePath); + }).reverse(); + case "alpha-insensitive": + return r.sort(function (n, e) { + return k(n.relativePath, e.relativePath); + }); + case "antialpha-insensitive": + return r.sort(function (n, e) { + return k(n.relativePath, e.relativePath); + }).reverse(); + default: + return r; + } else if (typeof t == "function") return r.sort(function (n, e) { + return t(n.relativePath, e.relativePath); + }); +} +function U(r, t, n, e, a, d) { + if (e.depth !== void 0 && n > e.depth) return null; + var l = r === t ? "." : w(r, t); + if (e.exclude && r !== t && x(e.exclude).some(function (g) { + return g.test("/".concat(l)); + })) return null; + var s = b(t), + h; + try { + h = N(t); + } catch (c) { + if (e.skipErrors) return null; + throw c; + } + var i; + try { + i = v(t); + } catch (c) { + if (e.skipErrors) return null; + throw c; + } + var E = i.isSymbolicLink(), + I = h.isFile() ? "file" : "directory"; + if (!e.showHidden && s.charAt(0) === "." || !e.symbolicLinks && E) return null; + var m; + if (e.hash) { + var c = e.hashAlgorithm; + m = V(c), m.update(s); + } + var o = { + name: s, + path: e.normalize ? t.replace(/\\/g, "/") : t, + relativePath: e.normalize ? l.replace(/\\/g, "/") : l, + type: I, + isSymbolicLink: E, + stat: e.followLinks ? h : i + }; + switch (e.stat || delete o.stat, I) { + case "directory": + var _c = [], + g; + if (e.followLinks || !E) { + try { + g = O(t), g = A(g, e.sorted); + } catch (u) { + if (e.skipErrors) return null; + throw u; + } + if (e.emptyDirectory && (o.isEmpty = !g.length), g.forEach(function (u) { + var f = U(r, T(t, u), n + 1, e, a, d); + f !== null && _c.push(f); + }), e.excludeEmptyDirectories && !_c.length) return null; + } + if (e.matches && r !== t) { + var u = x(e.matches); + if (!_c.length && u.some(function (f) { + return !f.test("/".concat(l)); + })) return null; + } + if (e.sizeInBytes || e.size) { + var _u = _c.reduce(function (f, y) { + return f + y.sizeInBytes; + }, 0); + o.sizeInBytes = _u, o.size = e.size ? P(_u) : void 0, e.sizeInBytes || _c.forEach(function (f) { + return f.sizeInBytes = void 0; + }); + } + if (e.hash) { + _c.forEach(function (f) { + m.update(f.hash); + }); + var _u2 = e.hashEncoding; + o.hash = m.digest(_u2); + } + e.descendants && (o.descendants = _c.reduce(function (u, f) { + var _f$descendants; + return u + (f.type === "directory" && e.descendantsIgnoreDirectories ? 0 : 1) + ((_f$descendants = f.descendants) !== null && _f$descendants !== void 0 ? _f$descendants : 0); + }, 0)), _c.length && (o.children = e.postSorted ? $(_c, e.postSorted) : _c); + break; + case "file": + if (o.extension = R(t).replace(".", ""), e.extensions && e.extensions.indexOf(o.extension) === -1 || e.matches && r !== t && x(e.matches).some(function (f) { + return !f.test("/".concat(l)); + })) return null; + if (e.sizeInBytes || e.size) { + var _u3 = e.followLinks ? h.size : i.size; + o.sizeInBytes = _u3, o.size = e.size ? P(_u3) : void 0; + } + if (e.hash) { + var _u4; + try { + _u4 = Z(t); + } catch (y) { + if (e.skipErrors) return null; + throw y; + } + m.update(_u4); + var f = e.hashEncoding; + o.hash = m.digest(f); + } + break; + default: + return null; + } + return a && I === "file" ? a(o, e.followLinks ? h : i) : d && I === "directory" && d(o, e.followLinks ? h : i), o; +} +function G(_x, _x2, _x3, _x4, _x5, _x6) { + return _G.apply(this, arguments); +} +function _G() { + _G = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(r, t, n, e, a, d) { + var l, s, h, i, E, I, m, c, o, _c2, g, u, _u5, _u6, _u7, _u8, f; + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + if (!(e.depth !== void 0 && n > e.depth)) { + _context2.next = 2; + break; + } + return _context2.abrupt("return", null); + case 2: + l = r === t ? "." : w(r, t); + if (!(e.exclude && r !== t && x(e.exclude).some(function (g) { + return g.test("/".concat(l)); + }))) { + _context2.next = 5; + break; + } + return _context2.abrupt("return", null); + case 5: + s = b(t); + _context2.prev = 6; + _context2.next = 9; + return F(t); + case 9: + h = _context2.sent; + _context2.next = 17; + break; + case 12: + _context2.prev = 12; + _context2.t0 = _context2["catch"](6); + if (!e.skipErrors) { + _context2.next = 16; + break; + } + return _context2.abrupt("return", null); + case 16: + throw _context2.t0; + case 17: + _context2.prev = 17; + _context2.next = 20; + return H(t); + case 20: + i = _context2.sent; + _context2.next = 28; + break; + case 23: + _context2.prev = 23; + _context2.t1 = _context2["catch"](17); + if (!e.skipErrors) { + _context2.next = 27; + break; + } + return _context2.abrupt("return", null); + case 27: + throw _context2.t1; + case 28: + E = i.isSymbolicLink(), I = h.isFile() ? "file" : "directory"; + if (!(!e.showHidden && s.charAt(0) === "." || !e.symbolicLinks && E)) { + _context2.next = 31; + break; + } + return _context2.abrupt("return", null); + case 31: + if (e.hash) { + c = e.hashAlgorithm; + m = V(c), m.update(s); + } + o = { + name: s, + path: e.normalize ? t.replace(/\\/g, "/") : t, + relativePath: e.normalize ? l.replace(/\\/g, "/") : l, + type: I, + isSymbolicLink: E, + stat: e.followLinks ? h : i + }; + _context2.t2 = (e.stat || delete o.stat, I); + _context2.next = _context2.t2 === "directory" ? 36 : _context2.t2 === "file" ? 65 : 84; + break; + case 36: + _c2 = []; + if (!(e.followLinks || !E)) { + _context2.next = 57; + break; + } + _context2.prev = 38; + _context2.next = 41; + return _(t); + case 41: + g = _context2.sent; + g = A(g, e.sorted); + _context2.next = 50; + break; + case 45: + _context2.prev = 45; + _context2.t3 = _context2["catch"](38); + if (!e.skipErrors) { + _context2.next = 49; + break; + } + return _context2.abrupt("return", null); + case 49: + throw _context2.t3; + case 50: + e.emptyDirectory && (o.isEmpty = !g.length); + _context2.next = 53; + return Promise.all(g.map( /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(u) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return G(r, T(t, u), n + 1, e, a, d); + case 2: + return _context.abrupt("return", _context.sent); + case 3: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function (_x24) { + return _ref.apply(this, arguments); + }; + }())); + case 53: + _c2 = _context2.sent; + _c2 = _c2.filter(function (u) { + return u !== null; + }); + if (!(e.excludeEmptyDirectories && !_c2.length)) { + _context2.next = 57; + break; + } + return _context2.abrupt("return", null); + case 57: + if (!(e.matches && r !== t)) { + _context2.next = 61; + break; + } + u = x(e.matches); + if (!(!_c2.length && u.some(function (f) { + return !f.test("/".concat(l)); + }))) { + _context2.next = 61; + break; + } + return _context2.abrupt("return", null); + case 61: + if (e.sizeInBytes || e.size) { + _u5 = _c2.reduce(function (f, y) { + return f + y.sizeInBytes; + }, 0); + o.sizeInBytes = _u5, o.size = e.size ? P(_u5) : void 0, e.sizeInBytes || _c2.forEach(function (f) { + return f.sizeInBytes = void 0; + }); + } + if (e.hash) { + _c2.forEach(function (f) { + m.update(f.hash); + }); + _u6 = e.hashEncoding; + o.hash = m.digest(_u6); + } + e.descendants && (o.descendants = _c2.reduce(function (u, f) { + var _f$descendants2; + return u + (f.type === "directory" && e.descendantsIgnoreDirectories ? 0 : 1) + ((_f$descendants2 = f.descendants) !== null && _f$descendants2 !== void 0 ? _f$descendants2 : 0); + }, 0)), _c2.length && (o.children = e.postSorted ? $(_c2, e.postSorted) : _c2); + return _context2.abrupt("break", 85); + case 65: + if (!(o.extension = R(t).replace(".", ""), e.extensions && e.extensions.indexOf(o.extension) === -1 || e.matches && r !== t && x(e.matches).some(function (f) { + return !f.test("/".concat(l)); + }))) { + _context2.next = 67; + break; + } + return _context2.abrupt("return", null); + case 67: + if (e.sizeInBytes || e.size) { + _u7 = e.followLinks ? h.size : i.size; + o.sizeInBytes = _u7, o.size = e.size ? P(_u7) : void 0; + } + if (!e.hash) { + _context2.next = 83; + break; + } + _context2.prev = 69; + _context2.next = 72; + return ee(t); + case 72: + _u8 = _context2.sent; + _context2.next = 80; + break; + case 75: + _context2.prev = 75; + _context2.t4 = _context2["catch"](69); + if (!e.skipErrors) { + _context2.next = 79; + break; + } + return _context2.abrupt("return", null); + case 79: + throw _context2.t4; + case 80: + m.update(_u8); + f = e.hashEncoding; + o.hash = m.digest(f); + case 83: + return _context2.abrupt("break", 85); + case 84: + return _context2.abrupt("return", null); + case 85: + if (!(a && I === "file")) { + _context2.next = 90; + break; + } + _context2.next = 88; + return a(o, e.followLinks ? h : i); + case 88: + _context2.next = 94; + break; + case 90: + _context2.t5 = d && I === "directory"; + if (!_context2.t5) { + _context2.next = 94; + break; + } + _context2.next = 94; + return d(o, e.followLinks ? h : i); + case 94: + return _context2.abrupt("return", o); + case 95: + case "end": + return _context2.stop(); + } + }, _callee2, null, [[6, 12], [17, 23], [38, 45], [69, 75]]); + })); + return _G.apply(this, arguments); +} +function K(r, t, n) { + return !t.symbolicLinks && r.isSymbolicLink || !t.showHidden && r.name.charAt(0) === "." || t.extensions !== void 0 && r.type === "file" && t.extensions.indexOf(r.extension) === -1 || t.exclude && x(t.exclude).some(function (e) { + return e.test("/".concat(r.relativePath)); + }) || t.depth !== void 0 && n > t.depth; +} +function j(r, t, n, e, a) { + var d = ""; + return t.map(function (s, h) { + var i = ""; + if (e.depth !== void 0 && a > e.depth || e.exclude && x(e.exclude).some(function (S) { + return S.test("/".concat((0,external_node_path_namespaceObject.relative)(r, s))); + })) return ""; + var E = (0,external_node_path_namespaceObject.basename)(s), + I; + try { + I = (0,external_node_fs_namespaceObject.statSync)(s); + } catch (y) { + if (e.skipErrors) return null; + throw y; + } + var m; + try { + m = (0,external_node_fs_namespaceObject.lstatSync)(s); + } catch (y) { + if (e.skipErrors) return null; + throw y; + } + var o = m.isSymbolicLink(), + c = I.isFile() ? "file" : "directory"; + if (!e.showHidden && E.charAt(0) === "." || !e.symbolicLinks && o) return ""; + var g = (0,external_node_path_namespaceObject.extname)(s).replace(".", ""); + if (e.extensions && c === "file" && e.extensions.indexOf(g) === -1) return ""; + var u = o ? ">>" : c === "directory" ? "\u2500> " : "\u2500\u2500 ", + f = n + (h === t.length - 1 ? " " : "\u2502 "); + if (i += u + E, (e.followLinks || !o) && c === "directory") { + var y; + try { + y = (0,external_node_fs_namespaceObject.readdirSync)(s).map(function (S) { + return (0,external_node_path_namespaceObject.resolve)(s, S); + }), y = A(y, e.sorted); + } catch (S) { + if (e.skipErrors) return null; + throw S; + } + i += y.length ? j(r, y, f, e, a + 1) : ""; + } + return i; + }).filter(function (s) { + return !!s; + }).forEach(function (s, h, i) { + d += n + (h === i.length - 1 ? "\u2514" + s : "\u251C" + s); + }), d; +} +function J(_x7, _x8, _x9, _x10, _x11) { + return _J.apply(this, arguments); +} +function _J() { + _J = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(r, t, n, e, a) { + var d; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + d = ""; + _context4.next = 3; + return Promise.all(t.map( /*#__PURE__*/function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(s, h) { + var i, E, I, m, o, c, g, u, f, y; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + i = ""; + if (!(e.depth !== void 0 && a > e.depth || e.exclude && x(e.exclude).some(function (S) { + return S.test("/".concat(w(r, s))); + }))) { + _context3.next = 3; + break; + } + return _context3.abrupt("return", ""); + case 3: + E = b(s); + _context3.prev = 4; + _context3.next = 7; + return F(s); + case 7: + I = _context3.sent; + _context3.next = 15; + break; + case 10: + _context3.prev = 10; + _context3.t0 = _context3["catch"](4); + if (!e.skipErrors) { + _context3.next = 14; + break; + } + return _context3.abrupt("return", null); + case 14: + throw _context3.t0; + case 15: + _context3.prev = 15; + _context3.next = 18; + return H(s); + case 18: + m = _context3.sent; + _context3.next = 26; + break; + case 21: + _context3.prev = 21; + _context3.t1 = _context3["catch"](15); + if (!e.skipErrors) { + _context3.next = 25; + break; + } + return _context3.abrupt("return", null); + case 25: + throw _context3.t1; + case 26: + o = m.isSymbolicLink(), c = I.isFile() ? "file" : "directory"; + if (!(!e.showHidden && E.charAt(0) === "." || !e.symbolicLinks && o)) { + _context3.next = 29; + break; + } + return _context3.abrupt("return", ""); + case 29: + g = R(s).replace(".", ""); + if (!(e.extensions && c === "file" && e.extensions.indexOf(g) === -1)) { + _context3.next = 32; + break; + } + return _context3.abrupt("return", ""); + case 32: + u = o ? ">>" : c === "directory" ? "\u2500> " : "\u2500\u2500 ", f = n + (h === t.length - 1 ? " " : "\u2502 "); + if (!(i += u + E, (e.followLinks || !o) && c === "directory")) { + _context3.next = 55; + break; + } + _context3.prev = 34; + _context3.next = 37; + return _(s); + case 37: + y = _context3.sent.map(function (S) { + return T(s, S); + }); + y = A(y, e.sorted); + _context3.next = 46; + break; + case 41: + _context3.prev = 41; + _context3.t2 = _context3["catch"](34); + if (!e.skipErrors) { + _context3.next = 45; + break; + } + return _context3.abrupt("return", null); + case 45: + throw _context3.t2; + case 46: + _context3.t3 = i; + if (!y.length) { + _context3.next = 53; + break; + } + _context3.next = 50; + return J(r, y, f, e, a + 1); + case 50: + _context3.t4 = _context3.sent; + _context3.next = 54; + break; + case 53: + _context3.t4 = ""; + case 54: + i = _context3.t3 += _context3.t4; + case 55: + return _context3.abrupt("return", i); + case 56: + case "end": + return _context3.stop(); + } + }, _callee3, null, [[4, 10], [15, 21], [34, 41]]); + })); + return function (_x25, _x26) { + return _ref2.apply(this, arguments); + }; + }())); + case 3: + _context4.sent.filter(function (s) { + return !!s; + }).forEach(function (s, h, i) { + d += n + (h === i.length - 1 ? "\u2514" + s : "\u251C" + s); + }); + return _context4.abrupt("return", d); + case 5: + case "end": + return _context4.stop(); + } + }, _callee4); + })); + return _J.apply(this, arguments); +} +function Q(r, t, n, e) { + var a = ""; + return r = q(r, n.sorted), r.filter(function (d) { + return !K(d, n, e); + }).forEach(function (d, l, s) { + var h = d.isSymbolicLink ? ">>" : d.type === "directory" ? "\u2500> " : "\u2500\u2500 ", + i = l === s.length - 1 ? "\u2514" + h : "\u251C" + h, + E = t + (l === s.length - 1 ? " " : "\u2502 "); + a += t + i + d.name, a += d.children && (n.followLinks || !d.isSymbolicLink) ? Q(d.children, E, n, e + 1) : ""; + }), a; +} +function W(_x12, _x13, _x14, _x15) { + return _W.apply(this, arguments); +} +function _W() { + _W = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(r, t, n, e) { + var a, d, l, s, h, i, E; + return _regeneratorRuntime().wrap(function _callee5$(_context5) { + while (1) switch (_context5.prev = _context5.next) { + case 0: + a = ""; + r = q(r, n.sorted); + d = r.filter(function (l) { + return !K(l, n, e); + }); + l = 0; + case 4: + if (!(l < d.length)) { + _context5.next = 19; + break; + } + s = d[l], h = s.isSymbolicLink ? ">>" : s.type === "directory" ? "\u2500> " : "\u2500\u2500 ", i = l === d.length - 1 ? "\u2514" + h : "\u251C" + h, E = t + (l === d.length - 1 ? " " : "\u2502 "); + a += t + i + s.name; + _context5.t0 = a; + if (!(s.children && (n.followLinks || !s.isSymbolicLink))) { + _context5.next = 14; + break; + } + _context5.next = 11; + return W(s.children, E, n, e + 1); + case 11: + _context5.t1 = _context5.sent; + _context5.next = 15; + break; + case 14: + _context5.t1 = ""; + case 15: + a = _context5.t0 += _context5.t1; + case 16: + l++; + _context5.next = 4; + break; + case 19: + return _context5.abrupt("return", a); + case 20: + case "end": + return _context5.stop(); + } + }, _callee5); + })); + return _W.apply(this, arguments); +} +function me(r, t, n, e) { + var a = M(t), + d = D(r, a), + l = U(d, d, 0, a, n, e); + return l && (l.sizeInBytes = a.sizeInBytes ? l.sizeInBytes : void 0), l; +} +function ge(_x16, _x17, _x18, _x19) { + return _ge.apply(this, arguments); +} +function _ge() { + _ge = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(r, t, n, e) { + var a, d, l; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + a = M(t); + d = D(r, a); + _context6.next = 4; + return G(d, d, 0, a, n, e); + case 4: + l = _context6.sent; + return _context6.abrupt("return", (l && (l.sizeInBytes = a.sizeInBytes ? l.sizeInBytes : void 0), l)); + case 6: + case "end": + return _context6.stop(); + } + }, _callee6); + })); + return _ge.apply(this, arguments); +} +function Ie(r, t) { + var n = "", + e = p(t), + a = D(r, e), + d = (0,external_node_path_namespaceObject.basename)(a); + n += d; + var l; + try { + l = (0,external_node_fs_namespaceObject.statSync)(a); + } catch (i) { + if (e.skipErrors) return null; + throw i; + } + var s; + try { + s = (0,external_node_fs_namespaceObject.lstatSync)(a); + } catch (i) { + if (e.skipErrors) return null; + throw i; + } + var h = s.isSymbolicLink(); + if ((e.followLinks || !h) && l.isDirectory()) { + var i; + try { + i = (0,external_node_fs_namespaceObject.readdirSync)(a).map(function (E) { + return (0,external_node_path_namespaceObject.resolve)(a, E); + }), i = A(i, e.sorted); + } catch (E) { + if (e.skipErrors) return null; + throw E; + } + n += i.length ? j(a, i, "\n ", e, 1) : ""; + } + return n; +} +function Se(_x20, _x21) { + return _Se.apply(this, arguments); +} +function _Se() { + _Se = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(r, t) { + var n, e, a, d, l, s, h, i; + return _regeneratorRuntime().wrap(function _callee7$(_context7) { + while (1) switch (_context7.prev = _context7.next) { + case 0: + n = "", e = p(t), a = D(r, e), d = b(a); + n += d; + _context7.prev = 2; + _context7.next = 5; + return F(a); + case 5: + l = _context7.sent; + _context7.next = 13; + break; + case 8: + _context7.prev = 8; + _context7.t0 = _context7["catch"](2); + if (!e.skipErrors) { + _context7.next = 12; + break; + } + return _context7.abrupt("return", null); + case 12: + throw _context7.t0; + case 13: + _context7.prev = 13; + _context7.next = 16; + return H(a); + case 16: + s = _context7.sent; + _context7.next = 24; + break; + case 19: + _context7.prev = 19; + _context7.t1 = _context7["catch"](13); + if (!e.skipErrors) { + _context7.next = 23; + break; + } + return _context7.abrupt("return", null); + case 23: + throw _context7.t1; + case 24: + h = s.isSymbolicLink(); + if (!((e.followLinks || !h) && l.isDirectory())) { + _context7.next = 47; + break; + } + _context7.prev = 26; + _context7.next = 29; + return _(a); + case 29: + i = _context7.sent.map(function (E) { + return T(a, E); + }); + i = A(i, e.sorted); + _context7.next = 38; + break; + case 33: + _context7.prev = 33; + _context7.t2 = _context7["catch"](26); + if (!e.skipErrors) { + _context7.next = 37; + break; + } + return _context7.abrupt("return", null); + case 37: + throw _context7.t2; + case 38: + _context7.t3 = n; + if (!i.length) { + _context7.next = 45; + break; + } + _context7.next = 42; + return J(a, i, "\n ", e, 1); + case 42: + _context7.t4 = _context7.sent; + _context7.next = 46; + break; + case 45: + _context7.t4 = ""; + case 46: + n = _context7.t3 += _context7.t4; + case 47: + return _context7.abrupt("return", n); + case 48: + case "end": + return _context7.stop(); + } + }, _callee7, null, [[2, 8], [13, 19], [26, 33]]); + })); + return _Se.apply(this, arguments); +} +function xe(r, t) { + var n = "", + e = p(t); + return n += r ? r.name : "", n += r.children ? Q(r.children, "\n ", e, 1) : "", n; +} +function Le(_x22, _x23) { + return _Le.apply(this, arguments); +} +function _Le() { + _Le = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(r, t) { + var n, e; + return _regeneratorRuntime().wrap(function _callee8$(_context8) { + while (1) switch (_context8.prev = _context8.next) { + case 0: + n = "", e = p(t); + n += r ? r.name : ""; + _context8.t0 = n; + if (!r.children) { + _context8.next = 9; + break; + } + _context8.next = 6; + return W(r.children, "\n ", e, 1); + case 6: + _context8.t1 = _context8.sent; + _context8.next = 10; + break; + case 9: + _context8.t1 = ""; + case 10: + n = _context8.t0 += _context8.t1; + return _context8.abrupt("return", n); + case 12: + case "end": + return _context8.stop(); + } + }, _callee8); + })); + return _Le.apply(this, arguments); +} + +;// CONCATENATED MODULE: ./src/index.ts +function convertToNumber(str){var num=+str;return isNaN(num)?5:num;};(0,asyncToGenerator/* default */.A)(/*#__PURE__*/(0,regeneratorRuntime/* default */.A)().mark(function _callee(){var folderPath,depth,_context$repo,owner,repo,dreeResult;return (0,regeneratorRuntime/* default */.A)().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:folderPath=(0,core.getInput)('path')||".";depth=convertToNumber((0,core.getInput)('depth')||"5");_context$repo=github.context.repo,owner=_context$repo.owner,repo=_context$repo.repo;dreeResult=Ie(folderPath,{depth:depth});(0,core.startGroup)("\x1B[32;1m ".concat(owner,"/").concat(repo," \x1B[0m tree: "));(0,core.info)("".concat(dreeResult));(0,core.endGroup)();(0,core.setOutput)('content',dreeResult);case 8:case"end":return _context.stop();}},_callee);}))(); +})(); + +module.exports = __webpack_exports__; +/******/ })() +; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..6639a36 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "github-action-folder-tree", + "version": "0.0.1", + "description": "View the folder directory tree structure, similar to the output of the tree command", + "homepage": "https://github.com/jaywcjlove/github-action-folder-tree#readme", + "main": "dist/index.js", + "scripts": { + "prepare": "husky", + "start": "npm run watch", + "build": "ncc build src/index.ts -o dist", + "watch": "ncc watch src/index.ts -o dist" + }, + "repository": { + "type": "git", + "url": "https://github.com/jaywcjlove/github-action-folder-tree.git" + }, + "keywords": [ + "actions", + "folder", + "tree", + "github" + ], + "author": "jaywcjlove", + "license": "MIT", + "engines": { + "node": ">=v20.11.0", + "npm": ">=10.2.4" + }, + "dependencies": { + "@actions/core": "^1.10.1", + "@actions/github": "^6.0.0", + "dree": "^5.0.8" + }, + "devDependencies": { + "@kkt/ncc": "^1.1.2", + "husky": "^9.1.3", + "lint-staged": "^15.2.7" + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..568dd0b --- /dev/null +++ b/renovate.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:base" + ], + "packageRules": [ + { + "matchPackagePatterns": ["*"], + "rangeStrategy": "replace" + } + ] +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..68c6c79 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,20 @@ +import { context } from '@actions/github'; +import { getInput, setOutput, startGroup, info, endGroup } from '@actions/core'; +import * as dree from 'dree'; + +function convertToNumber(str: string): number { + const num = +str; + return isNaN(num) ? 5 : num; +} + +;(async () => { + const folderPath = getInput('path') || "."; + const depth: number = convertToNumber(getInput('depth') || "5"); + const {owner, repo} = context.repo + const dreeResult = dree.parse(folderPath, { depth }); + + startGroup(`\x1b[32;1m ${owner}/${repo} \x1b[0m tree: `); + info(`${dreeResult}`); + endGroup(); + setOutput('content', dreeResult); +})(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..669966f --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es2015", + "module": "commonjs", + "outDir": "./lib", + "rootDir": "./src", + "strict": true, + "noImplicitAny": true, + "declaration": true, + "noEmit": true, + "esModuleInterop": true, + "moduleResolution": "node", + }, + "include": [ + "src/**/*.ts", + ], + "exclude": [ + "node_modules" + ] +}