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.6 to 5.0.0

bundled/bin/index.js.map

3

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={501: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}(501)})()));
import b from"yargs";import{hideBin as m}from"yargs/helpers";import{writeFileSync as u}from"node:fs";import*as s from"../lib/esm/index.esm.js";import{PostSortMethodPredefined as h,SortMethodPredefined as c}from"../lib/esm/index.esm.js";function y(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function a(t){let e=/^\/(?<pattern>.*)\/(?<flags>[igm]*)?$/;return t?t.map(n=>{let o=n.match(e);return o?new RegExp(y(o.groups.pattern),o.groups.flags):n}):[]}function p(t){if(t)switch(t){case"ascending":return c.ALPHABETICAL;case"descending":return c.ALPHABETICAL_REVERSE;default:return t}}function g(t){if(t)switch(t){case"ascending":return h.ALPHABETICAL;case"descending":return h.ALPHABETICAL_REVERSE;default:return t}}async function w(){await b(m(process.argv)).scriptName("dree").version("5.0.0").command("parse <source>","Save the directory tree as a text file",t=>{t.positional("source",{describe:"The path of the root of the directory tree",type:"string"})},t=>{let e=t,n={symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),extensions:e.extensions,sorted:p(e.sorted),homeShortcut:e.homeShortcut,skipErrors:e.skipErrors},o=e.source,r=e.dest,i=!e.dest||e.show,d=s.parse(o,n);i&&console.log(d),r&&u(r,d)}).command("scan <source>","Save the directory tree as a json file",t=>{t.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}})},t=>{let e=t,n={stat:e.stat,normalize:e.normalize,symbolicLinks:e.symbolicLinks,followLinks:e.followLinks,sizeInBytes:e.sizeInBytes,size:e.size,hash:e.hash,hashAlgorithm:e.hashAlgorithm,hashEncoding:e.hashEncoding,showHidden:e.showHidden,depth:e.depth,exclude:a(e.exclude),matches:a(e.matches),emptyDirectory:e.emptyDirectory,excludeEmptyDirectories:e.excludeEmptyDirectories,descendants:e.descendants,descendantsIgnoreDirectories:e.descendantsIgnoreDirectories,extensions:e.extensions,sorted:p(e.sorted),postSorted:g(e.postSorted),homeShortcut:e.homeShortcut,skipErrors:e.skipErrors},o=e.source,r=e.dest,i=!e.dest||e.show,f=e.pretty?4:e.tabs,l=JSON.stringify(s.scan(o,n),null,f);i&&console.log(l),r&&u(r,l)}).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:[...Object.values(c),"ascending","descending"],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:[...Object.values(h),"ascending","descending"],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}w();
//# sourceMappingURL=index.js.map
# [5.0.0](https://github.com/euberdeveloper/dree/compare/4.8.6...5.0.0) (2024-06-12)
### Bug Fixes
* **build.mjs:** fix cli import ([7e7b947](https://github.com/euberdeveloper/dree/commit/7e7b947eb468eaf42240cbceedd09df678265d92))
### Features
* fix esm build and provide esm/cjs bundle ([1f4db9a](https://github.com/euberdeveloper/dree/commit/1f4db9a2e612f4d8dace8a2871646a5bd8cf95eb))
### BREAKING CHANGES
* The ESM introduction could have unexpected changes in behaviour
## [4.8.6](https://github.com/euberdeveloper/dree/compare/4.8.5...4.8.6) (2024-06-11)

@@ -4,0 +21,0 @@

{
"name": "dree",
"version": "4.8.6",
"version": "5.0.0",
"description": "A nodejs module wich helps you handle a directory tree providing you its abstraction through tested functions and a custom configuration.",
"main": "bundled/lib/index.js",
"types": "bundled/lib/index.d.ts",
"main": "bundled/lib/commonjs/index.js",
"types": "bundled/lib/commonjs/index.d.ts",
"module": "./bundled/lib/esm/index.esm.js",
"bin": {
"dree": "bundled/bin/index.js"
},
"exports": {
".": {
"require": {
"default": "./bundled/lib/commonjs/index.js",
"types": "./bundled/lib/commonjs/index.d.ts"
},
"import": {
"default": "./bundled/lib/esm/index.esm.js",
"types": "./bundled/lib/esm/index.d.ts"
}
}
},
"files": [

@@ -17,2 +30,3 @@ "package.json",

],
"type": "module",
"scripts": {

@@ -22,16 +36,19 @@ "pretranspile": "shx rm -rf dist",

"prebundle": "shx rm -rf dist bundled",
"bundle": "webpack",
"bundle:esm": "node build.mjs",
"bundle:dts": "dts-bundle-generator -o bundled/lib/commonjs/index.d.ts --project source/tsconfig.json source/lib/index.ts",
"bundle": "pnpm bundle:esm && pnpm bundle:dts",
"postbundle:dts": "cp bundled/lib/commonjs/index.d.ts bundled/lib/esm/index.d.ts",
"script:getr:linux": "node scripts/generate-expected-tests-results linux",
"script:getr:mac": "node scripts/generate-expected-tests-results mac",
"script:getr:windows": "node scripts/generate-expected-tests-results windows",
"test": "mocha --reporter spec test/test.mjs",
"nyc": "nyc --extension=ts --reporter=html --reporter=text --reporter=lcov npm run test",
"cover:coveralls": "nyc report --extension=ts --reporter=text-lcov | coveralls",
"cover:codecov": "nyc report --extension=ts --reporter=text-lcov > coverage.lcov && codecov",
"cover": "npm run cover:coveralls && npm run cover:codecov",
"test": "mocha --reporter spec test/test.js",
"test:cover": "c8 --reporter=html --reporter=text --reporter=lcov pnpm test",
"cover:coveralls": "c8 report --reporter=text-lcov | coveralls",
"cover:codecov": "c8 report --reporter=text-lcov > coverage.lcov && codecov",
"cover": "pnpm cover:coveralls && pnpm cover:codecov",
"docs:html": "typedoc",
"docs:html-dev": "typedoc --options typedoc.dev.js",
"docs:html-dev": "typedoc --options typedoc.dev.cjs",
"predocs": "shx rm -rf docs/documentation",
"docs": "npm run docs:html && npm run docs:html-dev",
"prepublishOnly": "npm run bundle",
"docs": "pnpm docs:html && pnpm docs:html-dev",
"prepublishOnly": "pnpm bundle",
"release": "dotenv release-it"

@@ -73,3 +90,3 @@ },

"@types/yargs": "^17.0.32",
"bundle-declarations-webpack-plugin": "^5.1.1",
"c8": "^10.1.1",
"chai": "^5.1.1",

@@ -80,14 +97,11 @@ "chai-as-promised": "^8.0.0",

"dotenv-cli": "^7.4.2",
"dts-bundle-generator": "^9.5.1",
"esbuild": "^0.21.5",
"esbuild-plugin-import-map": "^2.1.0",
"mocha": "^10.4.0",
"nyc": "^17.0.0",
"release-it": "^17.3.0",
"shebang-loader": "^0.0.1",
"shx": "^0.3.4",
"ts-loader": "^9.5.1",
"typedoc": "^0.25.13",
"typescript": "^5.4.5",
"webpack": "^5.92.0",
"webpack-cli": "^5.1.4",
"webpack-node-externals": "^3.0.0"
"typescript": "^5.4.5"
}
}

@@ -594,2 +594,3 @@ ![Test](https://github.com/euberdeveloper/dree/workflows/Test/badge.svg)

├── README.md
├── build.mjs
├─> docs

@@ -604,3 +605,4 @@ │ └─> tree

│ ├─> bin
│ │ └── index.ts
│ │ ├── index.ts
│ │ └── shims.d.ts
│ ├─> lib

@@ -615,6 +617,5 @@ │ │ └── index.ts

│ ├─> scan
│ └── test.mjs
├── typedoc.dev.js
├── typedoc.js
└── webpack.config.js
│ └── test.js
├── typedoc.cjs
└── typedoc.dev.cjs
```

@@ -640,3 +641,3 @@ [//]: # (dree - END)

To bundle the library with webpack:
To bundle the library with esbuild:

@@ -643,0 +644,0 @@ ```bash

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