Socket
Socket
Sign inDemoInstall

dree

Package Overview
Dependencies
Maintainers
1
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dree - npm Package Compare versions

Comparing version 4.8.0 to 4.8.1

2

bundled/bin/index.js
#!/usr/bin/env node
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("../lib/index")):"function"==typeof define&&define.amd?define("dree",["../lib/index"],t):"object"==typeof exports?exports.dree=t(require("../lib/index")):e.dree=t(e.dree)}(this,(e=>(()=>{"use strict";var t={381:function(e,t,o){var n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var n,r=0,i=t.length;r<i;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0});var r=o(314),i=o(896),s=o(699),d=o(699);function a(e){var t=/^\/(?<pattern>.*)\/(?<flags>[igm]*)?$/;return e?e.map((function(e){var o=e.match(t);return o?new RegExp(o.groups.pattern.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),o.groups.flags):e})):[]}function h(e){if(e)switch(e){case"ascending":return d.SortMethodPredefined.ALPHABETICAL;case"descending":return d.SortMethodPredefined.ALPHABETICAL_REVERSE;default:return e}}function c(e){if(e)switch(e){case"ascending":return d.PostSortMethodPredefined.ALPHABETICAL;case"descending":return d.PostSortMethodPredefined.ALPHABETICAL_REVERSE;default:return e}}r.scriptName("dree").command("parse <source>","Save the directory tree as a text file",(function(e){e.positional("source",{describe:"The path of the root of the directory tree",type:"string"})}),(function(e){var t=e,o={symbolicLinks:t.symbolicLinks,followLinks:t.followLinks,showHidden:t.showHidden,depth:t.depth,exclude:a(t.exclude),extensions:t.extensions,sorted:h(t.sorted),homeShortcut:t.homeShortcut,skipErrors:t.skipErrors},n=t.source,r=t.dest,d=!t.dest||t.show,c=s.parse(n,o);d&&console.log(c),r&&(0,i.writeFileSync)(r,c)})).command("scan <source>","Save the directory tree as a json file",(function(e){e.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({tabs:{describe:"How many tabs will be used to indent the resulted json",type:"number",default:0},pretty:{describe:"If the resulted json will be pretty printed with 4 tabs. Overwrites the tabs option",type:"boolean",default:!1}})}),(function(e){var t=e,o={stat:t.stat,normalize:t.normalize,symbolicLinks:t.symbolicLinks,followLinks:t.followLinks,sizeInBytes:t.sizeInBytes,size:t.size,hash:t.hash,hashAlgorithm:t.hashAlgorithm,hashEncoding:t.hashEncoding,showHidden:t.showHidden,depth:t.depth,exclude:a(t.exclude),matches:a(t.matches),emptyDirectory:t.emptyDirectory,excludeEmptyDirectories:t.excludeEmptyDirectories,descendants:t.descendants,descendantsIgnoreDirectories:t.descendantsIgnoreDirectories,extensions:t.extensions,sorted:h(t.sorted),postSorted:c(t.postSorted),homeShortcut:t.homeShortcut,skipErrors:t.skipErrors},n=t.source,r=t.dest,d=!t.dest||t.show,l=t.pretty?4:t.tabs,u=JSON.stringify(s.scan(n,o),null,l);d&&console.log(u),r&&(0,i.writeFileSync)(r,u)})).options({dest:{alias:"d",describe:"The path of the output file destination. If not specified, in any case the result will be printed on the command line.",type:"string"},show:{alias:"s",default:!1,describe:"Whether you want to print the result on the command line. This will be ignored and set to true if no destination is specified.",type:"boolean"},stat:{default:!1,describe:"Whether you want the fs.stat included in the json result",type:"boolean",hidden:!0},normalize:{default:!1,describe:"Whether you want to normalize the path in the json result",type:"boolean",hidden:!0},"symbolic-links":{default:!0,describe:"Whether you want to consider symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"follow-links":{default:!1,describe:"Whether you want to follow symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"size-in-bytes":{default:!0,describe:"Whether you want to include the size in bytes in the json result",type:"boolean",hidden:!0},size:{default:!0,describe:"Whether you want to include the size in a proper unit in the json result",type:"boolean",hidden:!0},hash:{default:!0,describe:"Whether you want to include the hash in the json result",type:"boolean",hidden:!0},"hash-algorithm":{default:"md5",describe:"The hash algorithm that you want to use for the hash in the json result",type:"string",choices:["md5","sha1"],hidden:!0},"hash-encoding":{default:"hex",describe:"The hash encoding that you want to use for the hash in the json result",type:"string",choiches:["hex","base64","latin1"],hidden:!0},"show-hidden":{default:!0,describe:"Whether you want to consider hidden files during the elaboration",type:"boolean",hidden:!0},depth:{default:void 0,describe:"The max depth wich could be reached during the elaboration from the given folder",type:"number",hidden:!0},exclude:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) whose all matched path will not be considered during the elaboration",type:"array",hidden:!0},matches:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) and all the non-matching paths will not be considered by the algorithm. Note: All the ancestors of a matching node will be added",type:"array",hidden:!0},extensions:{describe:"An array of strings containing all the extensions wich will be considered",type:"array",hidden:!0},"empty-directory":{default:!1,describe:"Whether you want to include the property isEmpty in the result",type:"boolean",hidden:!0},"exclude-empty-directories":{default:!1,describe:"Whether you want to exclude all the empty directories from the result, even if they contains nodes excluded by other options",type:"boolean",hidden:!0},sorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done before the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:n(n([],Object.values(d.SortMethodPredefined),!0),["ascending","descending"],!1),hidden:!0},postSorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done after the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:n(n([],Object.values(d.PostSortMethodPredefined),!0),["ascending","descending"],!1),hidden:!0},descendants:{default:!1,describe:"Whether you want the result to contain the number of descendants for each node",type:"boolean",hidden:!0},"descendants-ignore-directories":{default:!1,describe:"Whether you want the result directories to be ignored when calculating the number of descendants",type:"boolean",hidden:!0},"home-shortcut":{default:!1,describe:"Whether you want the unix homedir shortcut ~ to be expanded to the user home directory",type:"boolean",hidden:!0},"skip-errors":{default:!0,describe:"Whether you want to skip folders and files wich give errors during the execution",type:"boolean",hidden:!0},options:{alias:"o",describe:"A path to a json config file. If an option is both on the file and in the command, the command one will be considered",config:!0}}).showHidden("all-options").completion("completion","Creates the completion bash script to add o your .bashrc in order to have the tab autocompletion for this cli service").demandCommand(1,"You must specify a command").strict().epilogue("For more information, find our manual at https://github.com/euberdeveloper/dree#readme").argv},314:e=>{e.exports=require("yargs")},896:e=>{e.exports=require("fs")},699:t=>{t.exports=e}},o={};return function e(n){var r=o[n];if(void 0!==r)return r.exports;var i=o[n]={exports:{}};return t[n].call(i.exports,i,i.exports,e),i.exports}(381)})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("../lib/index")):"function"==typeof define&&define.amd?define("dree",["../lib/index"],t):"object"==typeof exports?exports.dree=t(require("../lib/index")):e.dree=t(e.dree)}(this,(e=>(()=>{"use strict";var t={198:function(e,t,o){var n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var n,r=0,i=t.length;r<i;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0});var r=o(314),i=o(896),s=o(699),d=o(699);function a(e){var t=/^\/(?<pattern>.*)\/(?<flags>[igm]*)?$/;return e?e.map((function(e){var o=e.match(t);return o?new RegExp(o.groups.pattern.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),o.groups.flags):e})):[]}function h(e){if(e)switch(e){case"ascending":return d.SortMethodPredefined.ALPHABETICAL;case"descending":return d.SortMethodPredefined.ALPHABETICAL_REVERSE;default:return e}}function c(e){if(e)switch(e){case"ascending":return d.PostSortMethodPredefined.ALPHABETICAL;case"descending":return d.PostSortMethodPredefined.ALPHABETICAL_REVERSE;default:return e}}r.scriptName("dree").command("parse <source>","Save the directory tree as a text file",(function(e){e.positional("source",{describe:"The path of the root of the directory tree",type:"string"})}),(function(e){var t=e,o={symbolicLinks:t.symbolicLinks,followLinks:t.followLinks,showHidden:t.showHidden,depth:t.depth,exclude:a(t.exclude),extensions:t.extensions,sorted:h(t.sorted),homeShortcut:t.homeShortcut,skipErrors:t.skipErrors},n=t.source,r=t.dest,d=!t.dest||t.show,c=s.parse(n,o);d&&console.log(c),r&&(0,i.writeFileSync)(r,c)})).command("scan <source>","Save the directory tree as a json file",(function(e){e.positional("source",{describe:"The path of the root of the directory tree",type:"string"}).options({tabs:{describe:"How many tabs will be used to indent the resulted json",type:"number",default:0},pretty:{describe:"If the resulted json will be pretty printed with 4 tabs. Overwrites the tabs option",type:"boolean",default:!1}})}),(function(e){var t=e,o={stat:t.stat,normalize:t.normalize,symbolicLinks:t.symbolicLinks,followLinks:t.followLinks,sizeInBytes:t.sizeInBytes,size:t.size,hash:t.hash,hashAlgorithm:t.hashAlgorithm,hashEncoding:t.hashEncoding,showHidden:t.showHidden,depth:t.depth,exclude:a(t.exclude),matches:a(t.matches),emptyDirectory:t.emptyDirectory,excludeEmptyDirectories:t.excludeEmptyDirectories,descendants:t.descendants,descendantsIgnoreDirectories:t.descendantsIgnoreDirectories,extensions:t.extensions,sorted:h(t.sorted),postSorted:c(t.postSorted),homeShortcut:t.homeShortcut,skipErrors:t.skipErrors},n=t.source,r=t.dest,d=!t.dest||t.show,l=t.pretty?4:t.tabs,u=JSON.stringify(s.scan(n,o),null,l);d&&console.log(u),r&&(0,i.writeFileSync)(r,u)})).options({dest:{alias:"d",describe:"The path of the output file destination. If not specified, in any case the result will be printed on the command line.",type:"string"},show:{alias:"s",default:!1,describe:"Whether you want to print the result on the command line. This will be ignored and set to true if no destination is specified.",type:"boolean"},stat:{default:!1,describe:"Whether you want the fs.stat included in the json result",type:"boolean",hidden:!0},normalize:{default:!1,describe:"Whether you want to normalize the path in the json result",type:"boolean",hidden:!0},"symbolic-links":{default:!0,describe:"Whether you want to consider symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"follow-links":{default:!1,describe:"Whether you want to follow symbolic links during the elaboration, could not work on windows",type:"boolean",hidden:!0},"size-in-bytes":{default:!0,describe:"Whether you want to include the size in bytes in the json result",type:"boolean",hidden:!0},size:{default:!0,describe:"Whether you want to include the size in a proper unit in the json result",type:"boolean",hidden:!0},hash:{default:!0,describe:"Whether you want to include the hash in the json result",type:"boolean",hidden:!0},"hash-algorithm":{default:"md5",describe:"The hash algorithm that you want to use for the hash in the json result",type:"string",choices:["md5","sha1"],hidden:!0},"hash-encoding":{default:"hex",describe:"The hash encoding that you want to use for the hash in the json result",type:"string",choiches:["hex","base64","latin1"],hidden:!0},"show-hidden":{default:!0,describe:"Whether you want to consider hidden files during the elaboration",type:"boolean",hidden:!0},depth:{default:void 0,describe:"The max depth wich could be reached during the elaboration from the given folder",type:"number",hidden:!0},exclude:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) whose all matched path will not be considered during the elaboration",type:"array",hidden:!0},matches:{describe:"An array of strings (glob patterns) or regex (just write them as you would with js, e.g. /^[a-b]*$/g) and all the non-matching paths will not be considered by the algorithm. Note: All the ancestors of a matching node will be added",type:"array",hidden:!0},extensions:{describe:"An array of strings containing all the extensions wich will be considered",type:"array",hidden:!0},"empty-directory":{default:!1,describe:"Whether you want to include the property isEmpty in the result",type:"boolean",hidden:!0},"exclude-empty-directories":{default:!1,describe:"Whether you want to exclude all the empty directories from the result, even if they contains nodes excluded by other options",type:"boolean",hidden:!0},sorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done before the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:n(n([],Object.values(d.SortMethodPredefined),!0),["ascending","descending"],!1),hidden:!0},postSorted:{default:void 0,describe:"Whether you want the result to contain values sorted with a dree pre-defined sorting method. 'ascending' or 'descending' are kept for retrocompatibility. The sort is done after the scanning for the scan command. If not specified, the result values are not ordered.",type:"string",choices:n(n([],Object.values(d.PostSortMethodPredefined),!0),["ascending","descending"],!1),hidden:!0},descendants:{default:!1,describe:"Whether you want the result to contain the number of descendants for each node",type:"boolean",hidden:!0},"descendants-ignore-directories":{default:!1,describe:"Whether you want the result directories to be ignored when calculating the number of descendants",type:"boolean",hidden:!0},"home-shortcut":{default:!1,describe:"Whether you want the unix homedir shortcut ~ to be expanded to the user home directory",type:"boolean",hidden:!0},"skip-errors":{default:!0,describe:"Whether you want to skip folders and files wich give errors during the execution",type:"boolean",hidden:!0},options:{alias:"o",describe:"A path to a json config file. If an option is both on the file and in the command, the command one will be considered",config:!0}}).showHidden("all-options").completion("completion","Creates the completion bash script to add o your .bashrc in order to have the tab autocompletion for this cli service").demandCommand(1,"You must specify a command").strict().epilogue("For more information, find our manual at https://github.com/euberdeveloper/dree#readme").argv},314:e=>{e.exports=require("yargs")},896:e=>{e.exports=require("fs")},699:t=>{t.exports=e}},o={};return function e(n){var r=o[n];if(void 0!==r)return r.exports;var i=o[n]={exports:{}};return t[n].call(i.exports,i,i.exports,e),i.exports}(198)})()));

@@ -1,1 +0,1 @@

!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("dree",[],r):"object"==typeof exports?exports.dree=r():e.dree=r()}(this,(()=>(()=>{"use strict";var e={499:function(e,r,t){var n=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(s,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?s(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,a)}u((n=n.apply(e,r||[])).next())}))},s=this&&this.__generator||function(e,r){var t,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(o=0)),o;)try{if(t=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(6===a[0]&&o.label<s[1]){o.label=s[1],s=a;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(a);break}s[2]&&o.ops.pop(),o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e],n=0}finally{t=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(r,"__esModule",{value:!0}),r.parseTreeAsync=r.parseTree=r.parseAsync=r.parse=r.scanAsync=r.scan=r.PostSortMethodPredefined=r.SortMethodPredefined=r.Type=void 0;var i,o,a,u=t(928),c=t(857),l=t(982),f=t(756),h=t(896),d=t(943);!function(e){e.DIRECTORY="directory",e.FILE="file"}(i||(r.Type=i={})),function(e){e.ALPHABETICAL="alpha",e.ALPHABETICAL_REVERSE="antialpha",e.ALPHABETICAL_INSENSITIVE="alpha-insensitive",e.ALPHABETICAL_INSENSITIVE_REVERSE="antialpha-insensitive"}(o||(r.SortMethodPredefined=o={})),function(e){e.ALPHABETICAL="alpha",e.ALPHABETICAL_REVERSE="antialpha",e.ALPHABETICAL_INSENSITIVE="alpha-insensitive",e.ALPHABETICAL_INSENSITIVE_REVERSE="antialpha-insensitive",e.FOLDERS_FIRST="folders-first",e.FILES_FIRST="files-first"}(a||(r.PostSortMethodPredefined=a={}));var p={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},E={symbolicLinks:!0,followLinks:!1,showHidden:!0,depth:void 0,exclude:void 0,extensions:void 0,sorted:!1,postSorted:!1,homeShortcut:!1,skipErrors:!0};function v(e,r){return(0,u.resolve)(r.homeShortcut?e.replace(/^~($|\/|\\)/,(0,c.homedir)()+"$1"):e)}function y(e){return(Array.isArray(e)?e:[e]).map((function(e){return e instanceof RegExp?e:(0,f.makeRe)(e,{dot:!0})})).filter((function(e){return e instanceof RegExp}))}function I(e){var r={};if(e){for(var t in p)r[t]=void 0!==e[t]?e[t]:p[t];r.depth<0&&(r.depth=0)}else r=p;return r}function m(e){var r={};if(e){for(var t in E)r[t]=void 0!==e[t]?e[t]:E[t];r.depth<0&&(r.depth=0)}else r=E;return r}function L(e){var r,t=["B","KB","MB","GB","TB"];for(r=0;r<t.length&&e>1e3;r++)e/=1e3;return Math.round(100*e)/100+" "+t[r]}function A(e,r){return e.localeCompare(r)}function S(e,r){return e.toLowerCase().localeCompare(r.toLowerCase())}function b(e,r){if(!r)return e;if(!0===r)return e.sort(A);if("string"==typeof r)switch(r){case o.ALPHABETICAL:return e.sort(A);case o.ALPHABETICAL_REVERSE:return e.sort(A).reverse();case o.ALPHABETICAL_INSENSITIVE:return e.sort(S);case o.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort(S).reverse();default:return e}else if("function"==typeof r)return e.sort(r)}function w(e,r){return A(e.name,r.name)}function R(e,r){return S(e.name,r.name)}function k(e,r){return e.type===i.DIRECTORY&&r.type===i.FILE?-1:e.type===i.FILE&&r.type===i.DIRECTORY?1:0}function x(e,r){return e.type===i.FILE&&r.type===i.DIRECTORY?-1:e.type===i.DIRECTORY&&r.type===i.FILE?1:0}function T(e,r){if(!r)return e;if(!0===r)return e.sort(w);if("string"==typeof r)switch(r){case a.ALPHABETICAL:return e.sort(w);case a.ALPHABETICAL_REVERSE:return e.sort(w).reverse();case a.ALPHABETICAL_INSENSITIVE:return e.sort(R);case a.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort(R).reverse();case a.FOLDERS_FIRST:return e.sort(k);case a.FILES_FIRST:return e.sort(x);default:return e}else if("function"==typeof r)return e.sort(r)}function g(e,r){if(!r)return e;if(!0===r)return e.sort((function(e,r){return A(e.relativePath,r.relativePath)}));if("string"==typeof r)switch(r){case o.ALPHABETICAL:return e.sort((function(e,r){return A(e.relativePath,r.relativePath)}));case o.ALPHABETICAL_REVERSE:return e.sort((function(e,r){return A(e.relativePath,r.relativePath)})).reverse();case o.ALPHABETICAL_INSENSITIVE:return e.sort((function(e,r){return S(e.relativePath,r.relativePath)}));case o.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort((function(e,r){return S(e.relativePath,r.relativePath)})).reverse();default:return e}else if("function"==typeof r)return e.sort((function(e,t){return r(e.relativePath,t.relativePath)}))}function B(e,r,t,n,s,o){if(void 0!==n.depth&&t>n.depth)return null;var a=e===r?".":(0,u.relative)(e,r);if(n.exclude&&e!==r&&y(n.exclude).some((function(e){return e.test("/".concat(a))})))return null;var c,f,d=(0,u.basename)(r);try{c=(0,h.statSync)(r)}catch(e){if(n.skipErrors)return null;throw e}try{f=(0,h.lstatSync)(r)}catch(e){if(n.skipErrors)return null;throw e}var p,E=f.isSymbolicLink(),v=c.isFile()?i.FILE:i.DIRECTORY;if(!n.showHidden&&"."===d.charAt(0))return null;if(!n.symbolicLinks&&E)return null;if(n.hash){var I=n.hashAlgorithm;(p=(0,l.createHash)(I)).update(d)}var m={name:d,path:n.normalize?r.replace(/\\/g,"/"):r,relativePath:n.normalize?a.replace(/\\/g,"/"):a,type:v,isSymbolicLink:E,stat:n.followLinks?c:f};switch(n.stat||delete m.stat,v){case i.DIRECTORY:var A=[],S=void 0;if(n.followLinks||!E){try{S=b(S=(0,h.readdirSync)(r),n.sorted)}catch(e){if(n.skipErrors)return null;throw e}if(n.emptyDirectory&&(m.isEmpty=!S.length),S.forEach((function(i){var a=B(e,(0,u.resolve)(r,i),t+1,n,s,o);null!==a&&A.push(a)})),n.excludeEmptyDirectories&&!A.length)return null}if(n.matches&&e!==r){var w=y(n.matches);if(!A.length&&w.some((function(e){return!e.test("/".concat(a))})))return null}if(n.sizeInBytes||n.size){var R=A.reduce((function(e,r){return e+r.sizeInBytes}),0);m.sizeInBytes=R,m.size=n.size?L(R):void 0,n.sizeInBytes||A.forEach((function(e){return e.sizeInBytes=void 0}))}if(n.hash){A.forEach((function(e){p.update(e.hash)}));var k=n.hashEncoding;m.hash=p.digest(k)}n.descendants&&(m.descendants=A.reduce((function(e,r){var t;return e+(r.type===i.DIRECTORY&&n.descendantsIgnoreDirectories?0:1)+(null!==(t=r.descendants)&&void 0!==t?t:0)}),0)),A.length&&(m.children=n.postSorted?T(A,n.postSorted):A);break;case i.FILE:if(m.extension=(0,u.extname)(r).replace(".",""),n.extensions&&-1===n.extensions.indexOf(m.extension))return null;if(n.matches&&e!==r&&(w=y(n.matches)).some((function(e){return!e.test("/".concat(a))})))return null;if((n.sizeInBytes||n.size)&&(R=n.followLinks?c.size:f.size,m.sizeInBytes=R,m.size=n.size?L(R):void 0),n.hash){var x=void 0;try{x=(0,h.readFileSync)(r)}catch(e){if(n.skipErrors)return null;throw e}p.update(x),k=n.hashEncoding,m.hash=p.digest(k)}break;default:return null}return s&&v===i.FILE?s(m,n.followLinks?c:f):o&&v===i.DIRECTORY&&o(m,n.followLinks?c:f),m}function C(e,r,t,o,a,c){return n(this,void 0,void 0,(function(){var f,h,p,E,v,I,m,A,S,w,R,k,x,g,B,P,z,D,F,_=this;return s(this,(function(H){switch(H.label){case 0:if(void 0!==o.depth&&t>o.depth)return[2,null];if(f=e===r?".":(0,u.relative)(e,r),o.exclude&&e!==r&&y(o.exclude).some((function(e){return e.test("/".concat(f))})))return[2,null];h=(0,u.basename)(r),H.label=1;case 1:return H.trys.push([1,3,,4]),[4,(0,d.stat)(r)];case 2:return p=H.sent(),[3,4];case 3:if(E=H.sent(),o.skipErrors)return[2,null];throw E;case 4:return H.trys.push([4,6,,7]),[4,(0,d.lstat)(r)];case 5:return v=H.sent(),[3,7];case 6:if(I=H.sent(),o.skipErrors)return[2,null];throw I;case 7:if(m=v.isSymbolicLink(),A=p.isFile()?i.FILE:i.DIRECTORY,!o.showHidden&&"."===h.charAt(0))return[2,null];if(!o.symbolicLinks&&m)return[2,null];switch(o.hash&&(w=o.hashAlgorithm,(S=(0,l.createHash)(w)).update(h)),R={name:h,path:o.normalize?r.replace(/\\/g,"/"):r,relativePath:o.normalize?f.replace(/\\/g,"/"):f,type:A,isSymbolicLink:m,stat:o.followLinks?p:v},o.stat||delete R.stat,A){case i.DIRECTORY:return[3,8];case i.FILE:return[3,15]}return[3,21];case 8:if(k=[],x=void 0,!o.followLinks&&m)return[3,14];H.label=9;case 9:return H.trys.push([9,11,,12]),[4,(0,d.readdir)(r)];case 10:return x=b(x=H.sent(),o.sorted),[3,12];case 11:if(g=H.sent(),o.skipErrors)return[2,null];throw g;case 12:return o.emptyDirectory&&(R.isEmpty=!x.length),[4,Promise.all(x.map((function(i){return n(_,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,C(e,(0,u.resolve)(r,i),t+1,o,a,c)];case 1:return[2,n.sent()]}}))}))})))];case 13:if(k=(k=H.sent()).filter((function(e){return null!==e})),o.excludeEmptyDirectories&&!k.length)return[2,null];H.label=14;case 14:return o.matches&&e!==r&&(B=y(o.matches),!k.length&&B.some((function(e){return!e.test("/".concat(f))})))?[2,null]:((o.sizeInBytes||o.size)&&(P=k.reduce((function(e,r){return e+r.sizeInBytes}),0),R.sizeInBytes=P,R.size=o.size?L(P):void 0,o.sizeInBytes||k.forEach((function(e){return e.sizeInBytes=void 0}))),o.hash&&(k.forEach((function(e){S.update(e.hash)})),F=o.hashEncoding,R.hash=S.digest(F)),o.descendants&&(R.descendants=k.reduce((function(e,r){var t;return e+(r.type===i.DIRECTORY&&o.descendantsIgnoreDirectories?0:1)+(null!==(t=r.descendants)&&void 0!==t?t:0)}),0)),k.length&&(R.children=o.postSorted?T(k,o.postSorted):k),[3,22]);case 15:if(R.extension=(0,u.extname)(r).replace(".",""),o.extensions&&-1===o.extensions.indexOf(R.extension))return[2,null];if(o.matches&&e!==r&&(B=y(o.matches)).some((function(e){return!e.test("/".concat(f))})))return[2,null];if((o.sizeInBytes||o.size)&&(P=o.followLinks?p.size:v.size,R.sizeInBytes=P,R.size=o.size?L(P):void 0),!o.hash)return[3,20];z=void 0,H.label=16;case 16:return H.trys.push([16,18,,19]),[4,(0,d.readFile)(r)];case 17:return z=H.sent(),[3,19];case 18:if(D=H.sent(),o.skipErrors)return[2,null];throw D;case 19:S.update(z),F=o.hashEncoding,R.hash=S.digest(F),H.label=20;case 20:return[3,22];case 21:return[2,null];case 22:return a&&A===i.FILE?[4,a(R,o.followLinks?p:v)]:[3,24];case 23:return H.sent(),[3,26];case 24:return c&&A===i.DIRECTORY?[4,c(R,o.followLinks?p:v)]:[3,26];case 25:H.sent(),H.label=26;case 26:return[2,R]}}))}))}function P(e,r,t){return!r.symbolicLinks&&e.isSymbolicLink||!r.showHidden&&"."===e.name.charAt(0)||void 0!==r.extensions&&e.type===i.FILE&&-1===r.extensions.indexOf(e.extension)||r.exclude&&y(r.exclude).some((function(r){return r.test("/".concat(e.relativePath))}))||void 0!==r.depth&&t>r.depth}function z(e,r,t,n,s){var o="",a=r.map((function(o,a){var c="";if(void 0!==n.depth&&s>n.depth)return"";if(n.exclude&&y(n.exclude).some((function(r){return r.test("/".concat((0,u.relative)(e,o)))})))return"";var l,f,d=(0,u.basename)(o);try{l=(0,h.statSync)(o)}catch(e){if(n.skipErrors)return null;throw e}try{f=(0,h.lstatSync)(o)}catch(e){if(n.skipErrors)return null;throw e}var p=f.isSymbolicLink(),E=l.isFile()?i.FILE:i.DIRECTORY;if(!n.showHidden&&"."===d.charAt(0))return"";if(!n.symbolicLinks&&p)return"";var v=(0,u.extname)(o).replace(".","");if(n.extensions&&E===i.FILE&&-1===n.extensions.indexOf(v))return"";var I=p?">>":E===i.DIRECTORY?"─> ":"── ",m=t+(a===r.length-1?" ":"│ ");if(c+=I+d,(n.followLinks||!p)&&E===i.DIRECTORY){var L;try{L=b(L=(0,h.readdirSync)(o).map((function(e){return(0,u.resolve)(o,e)})),n.sorted)}catch(e){if(n.skipErrors)return null;throw e}c+=L.length?z(e,L,m,n,s+1):""}return c}));return a.filter((function(e){return!!e})).forEach((function(e,r,n){o+=t+(r===n.length-1?"└"+e:"├"+e)})),o}function D(e,r,t,o,a){return n(this,void 0,void 0,(function(){var c,l=this;return s(this,(function(f){switch(f.label){case 0:return c="",[4,Promise.all(r.map((function(c,f){return n(l,void 0,void 0,(function(){var n,l,h,p,E,v,I,m,L,A,S,w,R,k,x;return s(this,(function(s){switch(s.label){case 0:if(n="",void 0!==o.depth&&a>o.depth)return[2,""];if(o.exclude&&y(o.exclude).some((function(r){return r.test("/".concat((0,u.relative)(e,c)))})))return[2,""];l=(0,u.basename)(c),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,d.stat)(c)];case 2:return h=s.sent(),[3,4];case 3:if(p=s.sent(),o.skipErrors)return[2,null];throw p;case 4:return s.trys.push([4,6,,7]),[4,(0,d.lstat)(c)];case 5:return E=s.sent(),[3,7];case 6:if(v=s.sent(),o.skipErrors)return[2,null];throw v;case 7:if(I=E.isSymbolicLink(),m=h.isFile()?i.FILE:i.DIRECTORY,!o.showHidden&&"."===l.charAt(0))return[2,""];if(!o.symbolicLinks&&I)return[2,""];if(L=(0,u.extname)(c).replace(".",""),o.extensions&&m===i.FILE&&-1===o.extensions.indexOf(L))return[2,""];if(A=I?">>":m===i.DIRECTORY?"─> ":"── ",S=t+(f===r.length-1?" ":"│ "),n+=A+l,!o.followLinks&&I||m!==i.DIRECTORY)return[3,15];s.label=8;case 8:return s.trys.push([8,10,,11]),[4,(0,d.readdir)(c)];case 9:return w=b(w=s.sent().map((function(e){return(0,u.resolve)(c,e)})),o.sorted),[3,11];case 10:if(R=s.sent(),o.skipErrors)return[2,null];throw R;case 11:return k=n,w.length?[4,D(e,w,S,o,a+1)]:[3,13];case 12:return x=s.sent(),[3,14];case 13:x="",s.label=14;case 14:n=k+x,s.label=15;case 15:return[2,n]}}))}))})))];case 1:return f.sent().filter((function(e){return!!e})).forEach((function(e,r,n){c+=t+(r===n.length-1?"└"+e:"├"+e)})),[2,c]}}))}))}function F(e,r,t,n){var s="";return(e=g(e,t.sorted)).filter((function(e){return!P(e,t,n)})).forEach((function(e,o,a){var u=e.isSymbolicLink?">>":e.type===i.DIRECTORY?"─> ":"── ",c=o===a.length-1?"└"+u:"├"+u,l=r+(o===a.length-1?" ":"│ ");s+=r+c+e.name,s+=!e.children||!t.followLinks&&e.isSymbolicLink?"":F(e.children,l,t,n+1)})),s}function _(e,r,t,o){return n(this,void 0,void 0,(function(){var n,a,u,c,l,f,h,d,p;return s(this,(function(s){switch(s.label){case 0:n="",e=g(e,t.sorted),a=e.filter((function(e){return!P(e,t,o)})),u=0,s.label=1;case 1:return u<a.length?(c=a[u],l=c.isSymbolicLink?">>":c.type===i.DIRECTORY?"─> ":"── ",f=u===a.length-1?"└"+l:"├"+l,h=r+(u===a.length-1?" ":"│ "),n+=r+f+c.name,d=n,!c.children||!t.followLinks&&c.isSymbolicLink?[3,3]:[4,_(c.children,h,t,o+1)]):[3,6];case 2:return p=s.sent(),[3,4];case 3:p="",s.label=4;case 4:n=d+p,s.label=5;case 5:return u++,[3,1];case 6:return[2,n]}}))}))}r.scan=function(e,r,t,n){var s=I(r),i=v(e,s),o=B(i,i,0,s,t,n);return o&&(o.sizeInBytes=s.sizeInBytes?o.sizeInBytes:void 0),o},r.scanAsync=function(e,r,t,i){return n(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return n=I(r),[4,C(o=v(e,n),o,0,n,t,i)];case 1:return(a=s.sent())&&(a.sizeInBytes=n.sizeInBytes?a.sizeInBytes:void 0),[2,a]}}))}))},r.parse=function(e,r){var t,n,s="",i=m(r),o=v(e,i);s+=(0,u.basename)(o);try{t=(0,h.statSync)(o)}catch(e){if(i.skipErrors)return null;throw e}try{n=(0,h.lstatSync)(o)}catch(e){if(i.skipErrors)return null;throw e}var a=n.isSymbolicLink();if((i.followLinks||!a)&&t.isDirectory()){var c=void 0;try{c=b(c=(0,h.readdirSync)(o).map((function(e){return(0,u.resolve)(o,e)})),i.sorted)}catch(e){if(i.skipErrors)return null;throw e}s+=c.length?z(o,c,"\n ",i,1):""}return s},r.parseAsync=function(e,r){return n(this,void 0,void 0,(function(){var t,n,i,o,a,c,l,f,h,p,E,y,I;return s(this,(function(s){switch(s.label){case 0:t="",n=m(r),i=v(e,n),o=(0,u.basename)(i),t+=o,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,d.stat)(i)];case 2:return a=s.sent(),[3,4];case 3:if(c=s.sent(),n.skipErrors)return[2,null];throw c;case 4:return s.trys.push([4,6,,7]),[4,(0,d.lstat)(i)];case 5:return l=s.sent(),[3,7];case 6:if(f=s.sent(),n.skipErrors)return[2,null];throw f;case 7:if(h=l.isSymbolicLink(),!n.followLinks&&h||!a.isDirectory())return[3,15];p=void 0,s.label=8;case 8:return s.trys.push([8,10,,11]),[4,(0,d.readdir)(i)];case 9:return p=b(p=s.sent().map((function(e){return(0,u.resolve)(i,e)})),n.sorted),[3,11];case 10:if(E=s.sent(),n.skipErrors)return[2,null];throw E;case 11:return y=t,p.length?[4,D(i,p,"\n ",n,1)]:[3,13];case 12:return I=s.sent(),[3,14];case 13:I="",s.label=14;case 14:t=y+I,s.label=15;case 15:return[2,t]}}))}))},r.parseTree=function(e,r){var t="",n=m(r);return(t+=e?e.name:"")+(e.children?F(e.children,"\n ",n,1):"")},r.parseTreeAsync=function(e,r){return n(this,void 0,void 0,(function(){var t,n,i,o;return s(this,(function(s){switch(s.label){case 0:return t="",n=m(r),t+=e?e.name:"",i=t,e.children?[4,_(e.children,"\n ",n,1)]:[3,2];case 1:return o=s.sent(),[3,3];case 2:o="",s.label=3;case 3:return[2,t=i+o]}}))}))}},756:e=>{e.exports=require("minimatch")},982:e=>{e.exports=require("crypto")},896:e=>{e.exports=require("fs")},943:e=>{e.exports=require("fs/promises")},857:e=>{e.exports=require("os")},928:e=>{e.exports=require("path")}},r={};return function t(n){var s=r[n];if(void 0!==s)return s.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(499)})()));
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("dree",[],r):"object"==typeof exports?exports.dree=r():e.dree=r()}(this,(()=>(()=>{"use strict";var e={934:function(e,r,t){var n=this&&this.__awaiter||function(e,r,t,n){return new(t||(t=Promise))((function(s,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var r;e.done?s(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,a)}u((n=n.apply(e,r||[])).next())}))},s=this&&this.__generator||function(e,r){var t,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(o=0)),o;)try{if(t=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(6===a[0]&&o.label<s[1]){o.label=s[1],s=a;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(a);break}s[2]&&o.ops.pop(),o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e],n=0}finally{t=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(r,"__esModule",{value:!0}),r.parseTreeAsync=r.parseTree=r.parseAsync=r.parse=r.scanAsync=r.scan=r.PostSortMethodPredefined=r.SortMethodPredefined=r.Type=void 0;var i,o,a,u=t(928),c=t(857),l=t(982),f=t(756),h=t(896),d=t(943);!function(e){e.DIRECTORY="directory",e.FILE="file"}(i||(r.Type=i={})),function(e){e.ALPHABETICAL="alpha",e.ALPHABETICAL_REVERSE="antialpha",e.ALPHABETICAL_INSENSITIVE="alpha-insensitive",e.ALPHABETICAL_INSENSITIVE_REVERSE="antialpha-insensitive"}(o||(r.SortMethodPredefined=o={})),function(e){e.ALPHABETICAL="alpha",e.ALPHABETICAL_REVERSE="antialpha",e.ALPHABETICAL_INSENSITIVE="alpha-insensitive",e.ALPHABETICAL_INSENSITIVE_REVERSE="antialpha-insensitive",e.FOLDERS_FIRST="folders-first",e.FILES_FIRST="files-first"}(a||(r.PostSortMethodPredefined=a={}));var p={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},E={symbolicLinks:!0,followLinks:!1,showHidden:!0,depth:void 0,exclude:void 0,extensions:void 0,sorted:!1,postSorted:!1,homeShortcut:!1,skipErrors:!0};function v(e,r){return(0,u.resolve)(r.homeShortcut?e.replace(/^~($|\/|\\)/,(0,c.homedir)()+"$1"):e)}function y(e){return(Array.isArray(e)?e:[e]).map((function(e){return e instanceof RegExp?e:(0,f.makeRe)(e,{dot:!0})})).filter((function(e){return e instanceof RegExp}))}function I(e){var r={};if(e){for(var t in p)r[t]=void 0!==e[t]?e[t]:p[t];r.depth<0&&(r.depth=0)}else r=p;return r}function m(e){var r={};if(e){for(var t in E)r[t]=void 0!==e[t]?e[t]:E[t];r.depth<0&&(r.depth=0)}else r=E;return r}function L(e){var r,t=["B","KB","MB","GB","TB"];for(r=0;r<t.length&&e>1e3;r++)e/=1e3;return Math.round(100*e)/100+" "+t[r]}function A(e,r){return e.localeCompare(r)}function S(e,r){return e.toLowerCase().localeCompare(r.toLowerCase())}function b(e,r){if(!r)return e;if(!0===r)return e.sort(A);if("string"==typeof r)switch(r){case o.ALPHABETICAL:return e.sort(A);case o.ALPHABETICAL_REVERSE:return e.sort(A).reverse();case o.ALPHABETICAL_INSENSITIVE:return e.sort(S);case o.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort(S).reverse();default:return e}else if("function"==typeof r)return e.sort(r)}function w(e,r){return A(e.name,r.name)}function R(e,r){return S(e.name,r.name)}function k(e,r){return e.type===i.DIRECTORY&&r.type===i.FILE?-1:e.type===i.FILE&&r.type===i.DIRECTORY?1:0}function x(e,r){return e.type===i.FILE&&r.type===i.DIRECTORY?-1:e.type===i.DIRECTORY&&r.type===i.FILE?1:0}function T(e,r){if(!r)return e;if(!0===r)return e.sort(w);if("string"==typeof r)switch(r){case a.ALPHABETICAL:return e.sort(w);case a.ALPHABETICAL_REVERSE:return e.sort(w).reverse();case a.ALPHABETICAL_INSENSITIVE:return e.sort(R);case a.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort(R).reverse();case a.FOLDERS_FIRST:return e.sort(k);case a.FILES_FIRST:return e.sort(x);default:return e}else if("function"==typeof r)return e.sort(r)}function g(e,r){if(!r)return e;if(!0===r)return e.sort((function(e,r){return A(e.relativePath,r.relativePath)}));if("string"==typeof r)switch(r){case o.ALPHABETICAL:return e.sort((function(e,r){return A(e.relativePath,r.relativePath)}));case o.ALPHABETICAL_REVERSE:return e.sort((function(e,r){return A(e.relativePath,r.relativePath)})).reverse();case o.ALPHABETICAL_INSENSITIVE:return e.sort((function(e,r){return S(e.relativePath,r.relativePath)}));case o.ALPHABETICAL_INSENSITIVE_REVERSE:return e.sort((function(e,r){return S(e.relativePath,r.relativePath)})).reverse();default:return e}else if("function"==typeof r)return e.sort((function(e,t){return r(e.relativePath,t.relativePath)}))}function B(e,r,t,n,s,o){if(void 0!==n.depth&&t>n.depth)return null;var a=e===r?".":(0,u.relative)(e,r);if(n.exclude&&e!==r&&y(n.exclude).some((function(e){return e.test("/".concat(a))})))return null;var c,f,d=(0,u.basename)(r);try{c=(0,h.statSync)(r)}catch(e){if(n.skipErrors)return null;throw e}try{f=(0,h.lstatSync)(r)}catch(e){if(n.skipErrors)return null;throw e}var p,E=f.isSymbolicLink(),v=c.isFile()?i.FILE:i.DIRECTORY;if(!n.showHidden&&"."===d.charAt(0))return null;if(!n.symbolicLinks&&E)return null;if(n.hash){var I=n.hashAlgorithm;(p=(0,l.createHash)(I)).update(d)}var m={name:d,path:n.normalize?r.replace(/\\/g,"/"):r,relativePath:n.normalize?a.replace(/\\/g,"/"):a,type:v,isSymbolicLink:E,stat:n.followLinks?c:f};switch(n.stat||delete m.stat,v){case i.DIRECTORY:var A=[],S=void 0;if(n.followLinks||!E){try{S=b(S=(0,h.readdirSync)(r),n.sorted)}catch(e){if(n.skipErrors)return null;throw e}if(n.emptyDirectory&&(m.isEmpty=!S.length),S.forEach((function(i){var a=B(e,(0,u.resolve)(r,i),t+1,n,s,o);null!==a&&A.push(a)})),n.excludeEmptyDirectories&&!A.length)return null}if(n.matches&&e!==r){var w=y(n.matches);if(!A.length&&w.some((function(e){return!e.test("/".concat(a))})))return null}if(n.sizeInBytes||n.size){var R=A.reduce((function(e,r){return e+r.sizeInBytes}),0);m.sizeInBytes=R,m.size=n.size?L(R):void 0,n.sizeInBytes||A.forEach((function(e){return e.sizeInBytes=void 0}))}if(n.hash){A.forEach((function(e){p.update(e.hash)}));var k=n.hashEncoding;m.hash=p.digest(k)}n.descendants&&(m.descendants=A.reduce((function(e,r){var t;return e+(r.type===i.DIRECTORY&&n.descendantsIgnoreDirectories?0:1)+(null!==(t=r.descendants)&&void 0!==t?t:0)}),0)),A.length&&(m.children=n.postSorted?T(A,n.postSorted):A);break;case i.FILE:if(m.extension=(0,u.extname)(r).replace(".",""),n.extensions&&-1===n.extensions.indexOf(m.extension))return null;if(n.matches&&e!==r&&(w=y(n.matches)).some((function(e){return!e.test("/".concat(a))})))return null;if((n.sizeInBytes||n.size)&&(R=n.followLinks?c.size:f.size,m.sizeInBytes=R,m.size=n.size?L(R):void 0),n.hash){var x=void 0;try{x=(0,h.readFileSync)(r)}catch(e){if(n.skipErrors)return null;throw e}p.update(x),k=n.hashEncoding,m.hash=p.digest(k)}break;default:return null}return s&&v===i.FILE?s(m,n.followLinks?c:f):o&&v===i.DIRECTORY&&o(m,n.followLinks?c:f),m}function C(e,r,t,o,a,c){return n(this,void 0,void 0,(function(){var f,h,p,E,v,I,m,A,S,w,R,k,x,g,B,P,z,D,F,_=this;return s(this,(function(H){switch(H.label){case 0:if(void 0!==o.depth&&t>o.depth)return[2,null];if(f=e===r?".":(0,u.relative)(e,r),o.exclude&&e!==r&&y(o.exclude).some((function(e){return e.test("/".concat(f))})))return[2,null];h=(0,u.basename)(r),H.label=1;case 1:return H.trys.push([1,3,,4]),[4,(0,d.stat)(r)];case 2:return p=H.sent(),[3,4];case 3:if(E=H.sent(),o.skipErrors)return[2,null];throw E;case 4:return H.trys.push([4,6,,7]),[4,(0,d.lstat)(r)];case 5:return v=H.sent(),[3,7];case 6:if(I=H.sent(),o.skipErrors)return[2,null];throw I;case 7:if(m=v.isSymbolicLink(),A=p.isFile()?i.FILE:i.DIRECTORY,!o.showHidden&&"."===h.charAt(0))return[2,null];if(!o.symbolicLinks&&m)return[2,null];switch(o.hash&&(w=o.hashAlgorithm,(S=(0,l.createHash)(w)).update(h)),R={name:h,path:o.normalize?r.replace(/\\/g,"/"):r,relativePath:o.normalize?f.replace(/\\/g,"/"):f,type:A,isSymbolicLink:m,stat:o.followLinks?p:v},o.stat||delete R.stat,A){case i.DIRECTORY:return[3,8];case i.FILE:return[3,15]}return[3,21];case 8:if(k=[],x=void 0,!o.followLinks&&m)return[3,14];H.label=9;case 9:return H.trys.push([9,11,,12]),[4,(0,d.readdir)(r)];case 10:return x=b(x=H.sent(),o.sorted),[3,12];case 11:if(g=H.sent(),o.skipErrors)return[2,null];throw g;case 12:return o.emptyDirectory&&(R.isEmpty=!x.length),[4,Promise.all(x.map((function(i){return n(_,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,C(e,(0,u.resolve)(r,i),t+1,o,a,c)];case 1:return[2,n.sent()]}}))}))})))];case 13:if(k=(k=H.sent()).filter((function(e){return null!==e})),o.excludeEmptyDirectories&&!k.length)return[2,null];H.label=14;case 14:return o.matches&&e!==r&&(B=y(o.matches),!k.length&&B.some((function(e){return!e.test("/".concat(f))})))?[2,null]:((o.sizeInBytes||o.size)&&(P=k.reduce((function(e,r){return e+r.sizeInBytes}),0),R.sizeInBytes=P,R.size=o.size?L(P):void 0,o.sizeInBytes||k.forEach((function(e){return e.sizeInBytes=void 0}))),o.hash&&(k.forEach((function(e){S.update(e.hash)})),F=o.hashEncoding,R.hash=S.digest(F)),o.descendants&&(R.descendants=k.reduce((function(e,r){var t;return e+(r.type===i.DIRECTORY&&o.descendantsIgnoreDirectories?0:1)+(null!==(t=r.descendants)&&void 0!==t?t:0)}),0)),k.length&&(R.children=o.postSorted?T(k,o.postSorted):k),[3,22]);case 15:if(R.extension=(0,u.extname)(r).replace(".",""),o.extensions&&-1===o.extensions.indexOf(R.extension))return[2,null];if(o.matches&&e!==r&&(B=y(o.matches)).some((function(e){return!e.test("/".concat(f))})))return[2,null];if((o.sizeInBytes||o.size)&&(P=o.followLinks?p.size:v.size,R.sizeInBytes=P,R.size=o.size?L(P):void 0),!o.hash)return[3,20];z=void 0,H.label=16;case 16:return H.trys.push([16,18,,19]),[4,(0,d.readFile)(r)];case 17:return z=H.sent(),[3,19];case 18:if(D=H.sent(),o.skipErrors)return[2,null];throw D;case 19:S.update(z),F=o.hashEncoding,R.hash=S.digest(F),H.label=20;case 20:return[3,22];case 21:return[2,null];case 22:return a&&A===i.FILE?[4,a(R,o.followLinks?p:v)]:[3,24];case 23:return H.sent(),[3,26];case 24:return c&&A===i.DIRECTORY?[4,c(R,o.followLinks?p:v)]:[3,26];case 25:H.sent(),H.label=26;case 26:return[2,R]}}))}))}function P(e,r,t){return!r.symbolicLinks&&e.isSymbolicLink||!r.showHidden&&"."===e.name.charAt(0)||void 0!==r.extensions&&e.type===i.FILE&&-1===r.extensions.indexOf(e.extension)||r.exclude&&y(r.exclude).some((function(r){return r.test("/".concat(e.relativePath))}))||void 0!==r.depth&&t>r.depth}function z(e,r,t,n,s){var o="",a=r.map((function(o,a){var c="";if(void 0!==n.depth&&s>n.depth)return"";if(n.exclude&&y(n.exclude).some((function(r){return r.test("/".concat((0,u.relative)(e,o)))})))return"";var l,f,d=(0,u.basename)(o);try{l=(0,h.statSync)(o)}catch(e){if(n.skipErrors)return null;throw e}try{f=(0,h.lstatSync)(o)}catch(e){if(n.skipErrors)return null;throw e}var p=f.isSymbolicLink(),E=l.isFile()?i.FILE:i.DIRECTORY;if(!n.showHidden&&"."===d.charAt(0))return"";if(!n.symbolicLinks&&p)return"";var v=(0,u.extname)(o).replace(".","");if(n.extensions&&E===i.FILE&&-1===n.extensions.indexOf(v))return"";var I=p?">>":E===i.DIRECTORY?"─> ":"── ",m=t+(a===r.length-1?" ":"│ ");if(c+=I+d,(n.followLinks||!p)&&E===i.DIRECTORY){var L;try{L=b(L=(0,h.readdirSync)(o).map((function(e){return(0,u.resolve)(o,e)})),n.sorted)}catch(e){if(n.skipErrors)return null;throw e}c+=L.length?z(e,L,m,n,s+1):""}return c}));return a.filter((function(e){return!!e})).forEach((function(e,r,n){o+=t+(r===n.length-1?"└"+e:"├"+e)})),o}function D(e,r,t,o,a){return n(this,void 0,void 0,(function(){var c,l=this;return s(this,(function(f){switch(f.label){case 0:return c="",[4,Promise.all(r.map((function(c,f){return n(l,void 0,void 0,(function(){var n,l,h,p,E,v,I,m,L,A,S,w,R,k,x;return s(this,(function(s){switch(s.label){case 0:if(n="",void 0!==o.depth&&a>o.depth)return[2,""];if(o.exclude&&y(o.exclude).some((function(r){return r.test("/".concat((0,u.relative)(e,c)))})))return[2,""];l=(0,u.basename)(c),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,d.stat)(c)];case 2:return h=s.sent(),[3,4];case 3:if(p=s.sent(),o.skipErrors)return[2,null];throw p;case 4:return s.trys.push([4,6,,7]),[4,(0,d.lstat)(c)];case 5:return E=s.sent(),[3,7];case 6:if(v=s.sent(),o.skipErrors)return[2,null];throw v;case 7:if(I=E.isSymbolicLink(),m=h.isFile()?i.FILE:i.DIRECTORY,!o.showHidden&&"."===l.charAt(0))return[2,""];if(!o.symbolicLinks&&I)return[2,""];if(L=(0,u.extname)(c).replace(".",""),o.extensions&&m===i.FILE&&-1===o.extensions.indexOf(L))return[2,""];if(A=I?">>":m===i.DIRECTORY?"─> ":"── ",S=t+(f===r.length-1?" ":"│ "),n+=A+l,!o.followLinks&&I||m!==i.DIRECTORY)return[3,15];s.label=8;case 8:return s.trys.push([8,10,,11]),[4,(0,d.readdir)(c)];case 9:return w=b(w=s.sent().map((function(e){return(0,u.resolve)(c,e)})),o.sorted),[3,11];case 10:if(R=s.sent(),o.skipErrors)return[2,null];throw R;case 11:return k=n,w.length?[4,D(e,w,S,o,a+1)]:[3,13];case 12:return x=s.sent(),[3,14];case 13:x="",s.label=14;case 14:n=k+x,s.label=15;case 15:return[2,n]}}))}))})))];case 1:return f.sent().filter((function(e){return!!e})).forEach((function(e,r,n){c+=t+(r===n.length-1?"└"+e:"├"+e)})),[2,c]}}))}))}function F(e,r,t,n){var s="";return(e=g(e,t.sorted)).filter((function(e){return!P(e,t,n)})).forEach((function(e,o,a){var u=e.isSymbolicLink?">>":e.type===i.DIRECTORY?"─> ":"── ",c=o===a.length-1?"└"+u:"├"+u,l=r+(o===a.length-1?" ":"│ ");s+=r+c+e.name,s+=!e.children||!t.followLinks&&e.isSymbolicLink?"":F(e.children,l,t,n+1)})),s}function _(e,r,t,o){return n(this,void 0,void 0,(function(){var n,a,u,c,l,f,h,d,p;return s(this,(function(s){switch(s.label){case 0:n="",e=g(e,t.sorted),a=e.filter((function(e){return!P(e,t,o)})),u=0,s.label=1;case 1:return u<a.length?(c=a[u],l=c.isSymbolicLink?">>":c.type===i.DIRECTORY?"─> ":"── ",f=u===a.length-1?"└"+l:"├"+l,h=r+(u===a.length-1?" ":"│ "),n+=r+f+c.name,d=n,!c.children||!t.followLinks&&c.isSymbolicLink?[3,3]:[4,_(c.children,h,t,o+1)]):[3,6];case 2:return p=s.sent(),[3,4];case 3:p="",s.label=4;case 4:n=d+p,s.label=5;case 5:return u++,[3,1];case 6:return[2,n]}}))}))}r.scan=function(e,r,t,n){var s=I(r),i=v(e,s),o=B(i,i,0,s,t,n);return o&&(o.sizeInBytes=s.sizeInBytes?o.sizeInBytes:void 0),o},r.scanAsync=function(e,r,t,i){return n(this,void 0,void 0,(function(){var n,o,a;return s(this,(function(s){switch(s.label){case 0:return n=I(r),[4,C(o=v(e,n),o,0,n,t,i)];case 1:return(a=s.sent())&&(a.sizeInBytes=n.sizeInBytes?a.sizeInBytes:void 0),[2,a]}}))}))},r.parse=function(e,r){var t,n,s="",i=m(r),o=v(e,i);s+=(0,u.basename)(o);try{t=(0,h.statSync)(o)}catch(e){if(i.skipErrors)return null;throw e}try{n=(0,h.lstatSync)(o)}catch(e){if(i.skipErrors)return null;throw e}var a=n.isSymbolicLink();if((i.followLinks||!a)&&t.isDirectory()){var c=void 0;try{c=b(c=(0,h.readdirSync)(o).map((function(e){return(0,u.resolve)(o,e)})),i.sorted)}catch(e){if(i.skipErrors)return null;throw e}s+=c.length?z(o,c,"\n ",i,1):""}return s},r.parseAsync=function(e,r){return n(this,void 0,void 0,(function(){var t,n,i,o,a,c,l,f,h,p,E,y,I;return s(this,(function(s){switch(s.label){case 0:t="",n=m(r),i=v(e,n),o=(0,u.basename)(i),t+=o,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,(0,d.stat)(i)];case 2:return a=s.sent(),[3,4];case 3:if(c=s.sent(),n.skipErrors)return[2,null];throw c;case 4:return s.trys.push([4,6,,7]),[4,(0,d.lstat)(i)];case 5:return l=s.sent(),[3,7];case 6:if(f=s.sent(),n.skipErrors)return[2,null];throw f;case 7:if(h=l.isSymbolicLink(),!n.followLinks&&h||!a.isDirectory())return[3,15];p=void 0,s.label=8;case 8:return s.trys.push([8,10,,11]),[4,(0,d.readdir)(i)];case 9:return p=b(p=s.sent().map((function(e){return(0,u.resolve)(i,e)})),n.sorted),[3,11];case 10:if(E=s.sent(),n.skipErrors)return[2,null];throw E;case 11:return y=t,p.length?[4,D(i,p,"\n ",n,1)]:[3,13];case 12:return I=s.sent(),[3,14];case 13:I="",s.label=14;case 14:t=y+I,s.label=15;case 15:return[2,t]}}))}))},r.parseTree=function(e,r){var t="",n=m(r);return(t+=e?e.name:"")+(e.children?F(e.children,"\n ",n,1):"")},r.parseTreeAsync=function(e,r){return n(this,void 0,void 0,(function(){var t,n,i,o;return s(this,(function(s){switch(s.label){case 0:return t="",n=m(r),t+=e?e.name:"",i=t,e.children?[4,_(e.children,"\n ",n,1)]:[3,2];case 1:return o=s.sent(),[3,3];case 2:o="",s.label=3;case 3:return[2,t=i+o]}}))}))}},756:e=>{e.exports=require("minimatch")},982:e=>{e.exports=require("crypto")},896:e=>{e.exports=require("fs")},943:e=>{e.exports=require("fs/promises")},857:e=>{e.exports=require("os")},928:e=>{e.exports=require("path")}},r={};return function t(n){var s=r[n];if(void 0!==s)return s.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(934)})()));
## [4.8.1](https://github.com/euberdeveloper/dree/compare/4.8.0...4.8.1) (2024-04-28)
# [4.8.0](https://github.com/euberdeveloper/dree/compare/4.7.0...4.8.0) (2024-04-28)

@@ -4,0 +6,0 @@

{
"name": "dree",
"version": "4.8.0",
"version": "4.8.1",
"description": "A nodejs module wich helps you handle a directory tree providing you its abstraction through tested functions and a custom configuration.",

@@ -60,5 +60,5 @@ "main": "bundled/lib/index.js",

"@release-it/conventional-changelog": "^8.0.1",
"@types/node": "^20.11.19",
"@types/node": "^20.12.7",
"@types/yargs": "^17.0.32",
"bundle-declarations-webpack-plugin": "^5.0.1",
"bundle-declarations-webpack-plugin": "^5.1.1",
"chai": "^4.4.1",

@@ -68,12 +68,12 @@ "chai-as-promised": "^7.1.1",

"coveralls": "^3.1.1",
"dotenv-cli": "^7.3.0",
"mocha": "^10.3.0",
"dotenv-cli": "^7.4.1",
"mocha": "^10.4.0",
"nyc": "^15.1.0",
"release-it": "^17.1.1",
"release-it": "^17.2.1",
"shebang-loader": "^0.0.1",
"shx": "^0.3.4",
"ts-loader": "^9.5.1",
"typedoc": "^0.25.8",
"typescript": "^5.3.3",
"webpack": "^5.90.3",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",

@@ -88,5 +88,5 @@ "webpack-node-externals": "^3.0.0"

"dependencies": {
"minimatch": "^9.0.3",
"minimatch": "^9.0.4",
"yargs": "^17.7.2"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc