@k4a_l/dirtreeist 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "htmlWhitespaceSensitivity": "ignore",
5
+ "endOfLine": "auto",
6
+ "printWidth": 80
7
+ }
package/README.md CHANGED
@@ -7,23 +7,24 @@
7
7
  ### ディレクトリ構成図例
8
8
 
9
9
  ```text
10
- ├──components
11
- ├──App.tsx
12
- └──App.css
13
- ├──config.json
14
- └──utils
15
- └──converter.ts
10
+ ├─/components
11
+ ├─App.tsx
12
+ └─App.css
13
+ ├─config.json
14
+ └─/utils
15
+ └─converter.ts
16
+ └─parser.ts
16
17
  ```
17
18
 
18
19
  ## DirTree 構造
19
20
 
20
21
  ```ts
21
22
  type DirNode = {
22
- name: string;
23
- children: DirNode[];
24
- };
23
+ name: string
24
+ children: DirNode[]
25
+ }
25
26
 
26
- type DirTree = DirNode[];
27
+ type DirTree = DirNode[]
27
28
  ```
28
29
 
29
30
  ## 使い方
@@ -31,32 +32,35 @@ type DirTree = DirNode[];
31
32
  ### TypeScript Module
32
33
 
33
34
  ```ts
34
- import { parser, converter, OptionType } from "dirTreeist";
35
+ import { parse, converter, OptionType } from 'dirTreeist'
35
36
 
36
- const markdownList = `
37
- - components
37
+ const markdown = `
38
+ - /components
38
39
  - App.tsx
39
40
  - App.css
40
41
  - config.json
41
- - utils
42
+ - /utils
42
43
  - converter.ts
43
- `;
44
+ - parser.ts
45
+ `
46
+
47
+ const dirTrees = parse(markdown) // markdown => DirTree[]
44
48
 
45
- const dirTree = parser(markdownList); // markdown => DirTree
49
+ const options: OptionType = {}
50
+ const outputs = dirTrees.map((dirTree) => converter(dirtree, options)) // DirTree[] => output[]
46
51
 
47
- const options: OptionType = {};
48
- const output = converter(dirtree, options); // DirTree => output(like Demo)
52
+ console.log(outputs)
49
53
  ```
50
54
 
51
55
  #### オプション
52
56
 
53
57
  ```ts
54
- type OptionType = {
55
- treeType?: 1 | 2 | 3;
56
- emptyBeforeUpperHierarche?: boolean;
57
- spaceBeforeName?: boolean;
58
- spaceSize?: boolean;
59
- };
58
+ type Options = {
59
+ treeType?: 'normal' | 'bold' | 'ascii'
60
+ emptyBeforeUpperHierarche?: boolean
61
+ spaceBeforeName?: boolean
62
+ spaceSize?: number
63
+ }
60
64
  ```
61
65
 
62
66
  ### CLI
@@ -68,7 +72,7 @@ dirTreeist <inputFile> [...options]
68
72
  #### オプション
69
73
 
70
74
  ```test
71
- -t, --treeType [1|2|3]
75
+ -t, --treeType ['normal'|'bold'|'ascii']
72
76
  -e, --empty [boolean]
73
77
  -space, --spaceBeforeName [boolean]
74
78
  -size, --spaceSize [number]
@@ -76,19 +80,51 @@ dirTreeist <inputFile> [...options]
76
80
 
77
81
  ### オプションの説明
78
82
 
83
+ #### treeType
84
+
85
+ デフォルト値:normal
86
+
87
+ normal
88
+
89
+ ```
90
+
91
+ ├─
92
+
93
+ └─
94
+ ```
95
+
96
+ bold
97
+
98
+ ```
99
+
100
+ ┣━
101
+
102
+ ┗━
103
+ ```
104
+
105
+ ascii
106
+
107
+ ```
108
+ |
109
+ +
110
+ |
111
+ +-
112
+ ```
113
+
79
114
  #### emptyLineBeforeUpperHierarchy : boolean
80
115
 
81
116
  デフォルト値:false
82
117
 
83
118
  ```text
84
119
  (true)
85
- ├──components
86
- ├──App.tsx
87
- └──App.css
120
+ ├─/components
121
+ ├─App.tsx
122
+ └─App.css
88
123
 
89
- ├──config.json
90
- └──utils
91
- └──converter.ts
124
+ ├─config.json
125
+ └─/utils
126
+ └─converter.ts
127
+ └─parser.ts
92
128
  ```
93
129
 
94
130
  #### spaceBeforeName : boolean
@@ -97,13 +133,13 @@ dirTreeist <inputFile> [...options]
97
133
 
98
134
  ```text
99
135
  (true)
100
- ├── components
101
- ├── App.tsx
102
- └── App.css
103
-
104
- ├── config.json
105
- └── utils
106
- └── converter.ts
136
+ ├─ /components
137
+ ├─ App.tsx
138
+ └─ App.css
139
+ ├─ config.json
140
+ └─ /utils
141
+ └─ converter.ts
142
+ └─ parser.ts
107
143
  ```
108
144
 
109
145
  #### spaceSize : number
@@ -112,11 +148,11 @@ dirTreeist <inputFile> [...options]
112
148
 
113
149
  ```text
114
150
  (4)
115
- ├──── components
116
- │ ├── App.tsx
117
- │ └── App.css
118
-
119
- ├──── config.json
120
- └──── utils
121
- └── converter.ts
151
+ ├──/components
152
+ │ ├──App.tsx
153
+ │ └──App.css
154
+ ├──config.json
155
+ └──/utils
156
+ └──converter.ts
157
+ └──parser.ts
122
158
  ```
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ presets: [
3
+ [
4
+ '@babel/preset-env',
5
+ {
6
+ targets: {
7
+ node: 'current',
8
+ },
9
+ },
10
+ ],
11
+ ],
12
+ plugins: ['@babel/plugin-transform-modules-commonjs'],
13
+ }
@@ -0,0 +1,7 @@
1
+ import { OptionsBase, SymbolSet } from 'types';
2
+ declare const symbolSets: {
3
+ [key in OptionsBase['treeType']]: SymbolSet;
4
+ };
5
+ declare const defaultOptions: OptionsBase;
6
+ export { symbolSets, defaultOptions };
7
+ //# sourceMappingURL=constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../src/constants/constant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE9C,QAAA,MAAM,UAAU,EAAE;KACf,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,GAAG,SAAS;CAuB5C,CAAA;AAED,QAAA,MAAM,cAAc,EAAE,WAKrB,CAAA;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultOptions = exports.symbolSets = void 0;
4
+ const symbolSets = {
5
+ normal: {
6
+ vertical: '│',
7
+ horizontal: '─',
8
+ crossing: '├',
9
+ end: '└',
10
+ space: ' ',
11
+ },
12
+ bold: {
13
+ vertical: '┃',
14
+ horizontal: '━',
15
+ crossing: '┣',
16
+ end: '┗',
17
+ space: ' ',
18
+ },
19
+ ascii: {
20
+ vertical: '|',
21
+ horizontal: '-',
22
+ crossing: '+',
23
+ end: '+',
24
+ space: ' ',
25
+ },
26
+ };
27
+ exports.symbolSets = symbolSets;
28
+ const defaultOptions = {
29
+ treeType: 'normal',
30
+ spaceBeforeName: false,
31
+ spaceSize: 2,
32
+ emptyBeforeUpperHierarche: false,
33
+ };
34
+ exports.defaultOptions = defaultOptions;
35
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/constants/constant.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAEZ;IACF,MAAM,EAAE;QACN,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,GAAG;QACb,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,IAAI;KACZ;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,GAAG;QACb,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,IAAI;KACZ;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,GAAG;QACf,QAAQ,EAAE,GAAG;QACb,GAAG,EAAE,GAAG;QACR,KAAK,EAAE,GAAG;KACX;CACF,CAAA;AASQ,gCAAU;AAPnB,MAAM,cAAc,GAAgB;IAClC,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,KAAK;IACtB,SAAS,EAAE,CAAC;IACZ,yBAAyB,EAAE,KAAK;CACjC,CAAA;AAEoB,wCAAc"}
package/dist/index.d.ts CHANGED
@@ -1 +1,5 @@
1
+ import { parse } from './modules/parse';
2
+ import { convert } from './modules/convert';
3
+ import { DirTree } from './types/index';
4
+ export { parse, convert, DirTree };
1
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
1
  "use strict";
2
- console.log("hello world");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convert = exports.parse = void 0;
4
+ const parse_1 = require("./modules/parse");
5
+ Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_1.parse; } });
6
+ const convert_1 = require("./modules/convert");
7
+ Object.defineProperty(exports, "convert", { enumerable: true, get: function () { return convert_1.convert; } });
3
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAK9B,sFALA,aAAK,OAKA;AAJd,+CAA2C;AAI3B,wFAJP,iBAAO,OAIO"}
@@ -0,0 +1,4 @@
1
+ import { DirTree, Options } from 'types/index';
2
+ declare const convert: (dirTree: DirTree, options?: Options) => string;
3
+ export { convert };
4
+ //# sourceMappingURL=convert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAA0B,MAAM,aAAa,CAAA;AA6DtE,QAAA,MAAM,OAAO,+BAAgC,OAAO,KAAG,MAEtD,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convert = void 0;
4
+ const constant_1 = require("constants/constant");
5
+ const options_1 = require("./options");
6
+ const makeSymbol = (symbolSet, isLast) => {
7
+ if (isLast)
8
+ return symbolSet.end;
9
+ return symbolSet.crossing;
10
+ };
11
+ const reduce = (dirTree, options, prefix, hie, isLastGroup) => {
12
+ let result = ``;
13
+ dirTree.some((dirNode, dirNodeIndex) => {
14
+ // 準備
15
+ const isLast = dirNodeIndex == dirTree.length - 1;
16
+ const symbolSet = constant_1.symbolSets[options.treeType];
17
+ const symbol = makeSymbol(symbolSet, isLast);
18
+ // 現在
19
+ const currentPrefix = prefix +
20
+ symbol +
21
+ new Array(options.spaceSize / 2)
22
+ .fill(symbolSet.horizontal)
23
+ .reduce((prev, cur) => prev + cur, '');
24
+ const currentLine = `${currentPrefix}${options.spaceBeforeName ? ' ' : ''}${dirNode.name}`;
25
+ // 子
26
+ const spaces = new Array(options.spaceSize)
27
+ .fill(' ')
28
+ .reduce((prev, cur) => {
29
+ return prev + cur;
30
+ }, '');
31
+ const childrenLines = reduce(dirNode.children, options, prefix + (isLast ? symbolSet.space : symbolSet.vertical) + spaces, hie + 1, isLastGroup || isLast);
32
+ // 追加
33
+ result +=
34
+ currentLine +
35
+ '\n' +
36
+ childrenLines +
37
+ (options.emptyBeforeUpperHierarche && isLast && !(isLastGroup || hie == 0)
38
+ ? `${symbolSet.vertical}\n`
39
+ : '');
40
+ });
41
+ return result.slice(0, hie === 0 ? -1 : result.length);
42
+ };
43
+ const convert = (dirTree, options) => {
44
+ return reduce(dirTree, (0, options_1.buildOption)(options, constant_1.defaultOptions), '', 0, false);
45
+ };
46
+ exports.convert = convert;
47
+ //# sourceMappingURL=convert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":";;;AAAA,iDAA+D;AAE/D,uCAAuC;AAEvC,MAAM,UAAU,GAAG,CAAC,SAAoB,EAAE,MAAe,EAAU,EAAE;IACnE,IAAI,MAAM;QAAE,OAAO,SAAS,CAAC,GAAG,CAAA;IAChC,OAAO,SAAS,CAAC,QAAQ,CAAA;AAC3B,CAAC,CAAA;AAED,MAAM,MAAM,GAAG,CACb,OAAgB,EAChB,OAAoB,EACpB,MAAc,EACd,GAAW,EACX,WAAoB,EACZ,EAAE;IACV,IAAI,MAAM,GAAG,EAAE,CAAA;IACf,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE;QACrC,KAAK;QACL,MAAM,MAAM,GAAG,YAAY,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAA;QACjD,MAAM,SAAS,GAAG,qBAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;QAE5C,KAAK;QACL,MAAM,aAAa,GACjB,MAAM;YACN,MAAM;YACN,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;iBAC7B,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC;iBAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,GAAG,EAAE,EAAE,CAAC,CAAA;QAE1C,MAAM,WAAW,GAAG,GAAG,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GACvE,OAAO,CAAC,IACV,EAAE,CAAA;QAEF,IAAI;QACJ,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;aACxC,IAAI,CAAC,GAAG,CAAC;aACT,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACpB,OAAO,IAAI,GAAG,GAAG,CAAA;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;QACR,MAAM,aAAa,GAAG,MAAM,CAC1B,OAAO,CAAC,QAAQ,EAChB,OAAO,EACP,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,MAAM,EACjE,GAAG,GAAG,CAAC,EACP,WAAW,IAAI,MAAM,CACtB,CAAA;QAED,KAAK;QACL,MAAM;YACJ,WAAW;gBACX,IAAI;gBACJ,aAAa;gBACb,CAAC,OAAO,CAAC,yBAAyB,IAAI,MAAM,IAAI,CAAC,CAAC,WAAW,IAAI,GAAG,IAAI,CAAC,CAAC;oBACxE,CAAC,CAAC,GAAG,SAAS,CAAC,QAAQ,IAAI;oBAC3B,CAAC,CAAC,EAAE,CAAC,CAAA;IACX,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AACxD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,OAAiB,EAAU,EAAE;IAC9D,OAAO,MAAM,CAAC,OAAO,EAAE,IAAA,qBAAW,EAAC,OAAO,EAAE,yBAAc,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;AAC5E,CAAC,CAAA;AAEQ,0BAAO"}
@@ -0,0 +1,4 @@
1
+ import { Options, OptionsBase } from 'types';
2
+ declare const buildOption: (options: Options | undefined, defaultOptions: OptionsBase) => OptionsBase;
3
+ export { buildOption };
4
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/modules/options.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAY5C,QAAA,MAAM,WAAW,YACN,OAAO,GAAG,SAAS,kBACZ,WAAW,KAC1B,WASF,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildOption = void 0;
4
+ const constant_1 = require("constants/constant");
5
+ const pickOption = (option, defaultOption, key) => {
6
+ if (option === undefined)
7
+ return constant_1.defaultOptions[key];
8
+ if (option[key] !== undefined)
9
+ return option[key];
10
+ return defaultOption[key];
11
+ };
12
+ const buildOption = (options, defaultOptions) => {
13
+ return Object.fromEntries(Object.entries(defaultOptions).map(([key, value]) => {
14
+ return [
15
+ key,
16
+ pickOption(options, defaultOptions, key),
17
+ ];
18
+ }));
19
+ };
20
+ exports.buildOption = buildOption;
21
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/modules/options.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAGnD,MAAM,UAAU,GAAG,CACjB,MAA2B,EAC3B,aAA0B,EAC1B,GAAsB,EACnB,EAAE;IACL,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,yBAAc,CAAC,GAAG,CAAM,CAAA;IACzD,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,GAAG,CAAM,CAAA;IACtD,OAAO,aAAa,CAAC,GAAG,CAAM,CAAA;AAChC,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAClB,OAA4B,EAC5B,cAA2B,EACd,EAAE;IACf,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAClD,OAAO;YACL,GAAG;YACH,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,GAAwB,CAAC;SAC9D,CAAA;IACH,CAAC,CAAC,CACY,CAAA;AAClB,CAAC,CAAA;AAEQ,kCAAW"}
@@ -0,0 +1,4 @@
1
+ import { DirTree } from 'types/index';
2
+ declare const parse: (chunk: string) => DirTree[];
3
+ export { parse };
4
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,OAAO,EAAE,MAAM,aAAa,CAAA;AAuC9C,QAAA,MAAM,KAAK,UAAW,MAAM,KAAG,OAAO,EAUrC,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = void 0;
4
+ const mdast_util_from_markdown_1 = require("mdast-util-from-markdown");
5
+ const extractText = (content) => {
6
+ if (content.type === 'text')
7
+ return content.value;
8
+ if ('children' in content) {
9
+ return content.children
10
+ .map((child) => {
11
+ return extractText(child);
12
+ })
13
+ .reduce((prev, cur) => {
14
+ return prev + cur;
15
+ }, '');
16
+ }
17
+ return '';
18
+ };
19
+ const extractListItem = (listItem) => {
20
+ const name = extractText(listItem.children[0]);
21
+ const children = listItem.children.length > 1
22
+ ? extractList(listItem.children[1])
23
+ : [];
24
+ return { name, children: children };
25
+ };
26
+ const extractList = (list) => {
27
+ return list.children.map((listItem) => {
28
+ return extractListItem(listItem);
29
+ });
30
+ };
31
+ const parse = (chunk) => {
32
+ const tree = (0, mdast_util_from_markdown_1.fromMarkdown)(chunk);
33
+ const lists = tree.children.filter((child) => child.type === 'list');
34
+ const result = lists.map((list) => {
35
+ return extractList(list);
36
+ });
37
+ return result;
38
+ };
39
+ exports.parse = parse;
40
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":";;;AAEA,uEAAuD;AAIvD,MAAM,WAAW,GAAG,CAAC,OAAgB,EAAU,EAAE;IAC/C,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC,KAAK,CAAA;IAEjD,IAAI,UAAU,IAAI,OAAO,EAAE;QACzB,OAAO,OAAO,CAAC,QAAQ;aACpB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,OAAO,WAAW,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;YACpB,OAAO,IAAI,GAAG,GAAG,CAAA;QACnB,CAAC,EAAE,EAAE,CAAC,CAAA;KACT;IAED,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,CAAC,QAAkB,EAAW,EAAE;IACtD,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAE9C,MAAM,QAAQ,GACZ,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC1B,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAS,CAAC;QAC3C,CAAC,CAAC,EAAE,CAAA;IAER,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAA;AACrC,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAAC,IAAU,EAAW,EAAE;IAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,KAAa,EAAa,EAAE;IACzC,MAAM,IAAI,GAAG,IAAA,uCAAY,EAAC,KAAK,CAAC,CAAA;IAEhC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAW,CAAA;IAE9E,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,IAAI,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAEQ,sBAAK"}
@@ -0,0 +1,21 @@
1
+ declare type DirNode = {
2
+ name: string;
3
+ children: DirNode[];
4
+ };
5
+ declare type DirTree = DirNode[];
6
+ declare type OptionsBase = {
7
+ treeType: 'normal' | 'bold' | 'ascii';
8
+ emptyBeforeUpperHierarche: boolean;
9
+ spaceBeforeName: boolean;
10
+ spaceSize: number;
11
+ };
12
+ declare type SymbolSet = {
13
+ vertical: string;
14
+ horizontal: string;
15
+ crossing: string;
16
+ end: string;
17
+ space: string;
18
+ };
19
+ declare type Options = Partial<OptionsBase>;
20
+ export { DirNode, DirTree, Options, OptionsBase, SymbolSet };
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,EAAE,CAAA;CACpB,CAAA;AAED,aAAK,OAAO,GAAG,OAAO,EAAE,CAAA;AAExB,aAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;IACrC,yBAAyB,EAAE,OAAO,CAAA;IAClC,eAAe,EAAE,OAAO,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,aAAK,SAAS,GAAG;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,aAAK,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@k4a_l/dirtreeist",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "kasahala",
7
7
  "license": "MIT",
8
8
  "scripts": {
9
9
  "dev": "ts-node-dev --respawn src/index.ts",
10
- "build": "tsc",
11
- "test": "jest"
10
+ "build": "rm -rf ./dist/ && tsc",
11
+ "test": "vitest",
12
+ "coverage": "vitest run --coverage",
13
+ "deploy": "yarn build && yarn publish --access=public"
12
14
  },
13
15
  "devDependencies": {
14
16
  "@types/jest": "^29.0.0",
17
+ "@types/mdast": "^3.0.10",
15
18
  "@typescript-eslint/eslint-plugin": "^5.36.2",
16
19
  "@typescript-eslint/parser": "^5.36.2",
17
20
  "eslint": "^8.23.0",
@@ -20,6 +23,14 @@
20
23
  "prettier": "^2.7.1",
21
24
  "ts-jest": "^28.0.8",
22
25
  "ts-node-dev": "^2.0.0",
23
- "typescript": "^4.8.2"
26
+ "typescript": "^4.8.2",
27
+ "vite-tsconfig-paths": "^3.5.0",
28
+ "vitest": "^0.23.1"
29
+ },
30
+ "dependencies": {
31
+ "mdast-util-from-markdown": "^1.2.0",
32
+ "remark-parse": "^10.0.1",
33
+ "ts-dedent": "^2.2.0",
34
+ "unified": "^10.1.2"
24
35
  }
25
36
  }
@@ -0,0 +1,3 @@
1
+ declare const _default: import("vitest/dist/config").UserConfigExport;
2
+ export default _default;
3
+ //# sourceMappingURL=vitest.config.d.ts.map
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import tsconfigPaths from 'vite-tsconfig-paths'
3
+
4
+ export default defineConfig({
5
+ plugins: [tsconfigPaths()],
6
+
7
+ test: {
8
+ // ...
9
+ },
10
+ })
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- roots: ["<rootDir>/src"],
3
- testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"],
4
- transform: {
5
- "^.+\\.(ts|tsx)$": "ts-jest",
6
- },
7
- };
@@ -1 +0,0 @@
1
- "use strict";
File without changes
@@ -1 +0,0 @@
1
- "use strict";
File without changes