@k4a_l/dirtreeist 0.3.1 → 0.3.2
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/.github/workflows/release.yml +24 -0
- package/README.md +1 -1
- package/dist/constants/constant.d.ts +7 -7
- package/dist/constants/constant.js +31 -31
- package/dist/index.cjs +186 -185
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/modules/convert.d.ts +3 -3
- package/dist/modules/convert.js +74 -74
- package/dist/modules/options.d.ts +3 -3
- package/dist/modules/options.js +43 -43
- package/dist/modules/parse.d.ts +3 -3
- package/dist/modules/parse.js +47 -47
- package/dist/types/index.d.ts +21 -21
- package/dist/types/index.js +1 -1
- package/package.json +5 -1
- package/yarn-error.log +1861 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
tags:
|
|
5
|
+
- 'v*.*.*'
|
|
6
|
+
permissions:
|
|
7
|
+
contents: write
|
|
8
|
+
id-token: write
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: actions/setup-node@v4
|
|
15
|
+
with:
|
|
16
|
+
node-version: '24'
|
|
17
|
+
registry-url: 'https://registry.npmjs.org'
|
|
18
|
+
- run: yarn install --frozen-lockfile
|
|
19
|
+
- run: yarn build
|
|
20
|
+
- run: npm publish
|
|
21
|
+
- name: Create GitHub Release
|
|
22
|
+
uses: softprops/action-gh-release@v2
|
|
23
|
+
with:
|
|
24
|
+
generate_release_notes: true
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { OptionsBase, SymbolSet } from '../types';
|
|
2
|
-
declare const symbolSets: {
|
|
3
|
-
[key in OptionsBase['treeType']]: SymbolSet;
|
|
4
|
-
};
|
|
5
|
-
declare const defaultOptions: OptionsBase;
|
|
6
|
-
declare const treeTypeValues: readonly ["normal", "bold", "ascii"];
|
|
7
|
-
export { symbolSets, defaultOptions, treeTypeValues };
|
|
1
|
+
import { OptionsBase, SymbolSet } from '../types';
|
|
2
|
+
declare const symbolSets: {
|
|
3
|
+
[key in OptionsBase['treeType']]: SymbolSet;
|
|
4
|
+
};
|
|
5
|
+
declare const defaultOptions: OptionsBase;
|
|
6
|
+
declare const treeTypeValues: readonly ["normal", "bold", "ascii"];
|
|
7
|
+
export { symbolSets, defaultOptions, treeTypeValues };
|
|
8
8
|
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const symbolSets = {
|
|
2
|
-
normal: {
|
|
3
|
-
vertical: '│',
|
|
4
|
-
horizontal: '─',
|
|
5
|
-
crossing: '├',
|
|
6
|
-
end: '└',
|
|
7
|
-
space: ' ',
|
|
8
|
-
},
|
|
9
|
-
bold: {
|
|
10
|
-
vertical: '┃',
|
|
11
|
-
horizontal: '━',
|
|
12
|
-
crossing: '┣',
|
|
13
|
-
end: '┗',
|
|
14
|
-
space: ' ',
|
|
15
|
-
},
|
|
16
|
-
ascii: {
|
|
17
|
-
vertical: '|',
|
|
18
|
-
horizontal: '-',
|
|
19
|
-
crossing: '+',
|
|
20
|
-
end: '+',
|
|
21
|
-
space: ' ',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
const defaultOptions = {
|
|
25
|
-
treeType: 'normal',
|
|
26
|
-
spaceBeforeName: false,
|
|
27
|
-
spaceSize: 2,
|
|
28
|
-
emptyBeforeUpperHierarche: false,
|
|
29
|
-
};
|
|
30
|
-
const treeTypeValues = ['normal', 'bold', 'ascii'];
|
|
31
|
-
export { symbolSets, defaultOptions, treeTypeValues };
|
|
1
|
+
const symbolSets = {
|
|
2
|
+
normal: {
|
|
3
|
+
vertical: '│',
|
|
4
|
+
horizontal: '─',
|
|
5
|
+
crossing: '├',
|
|
6
|
+
end: '└',
|
|
7
|
+
space: ' ',
|
|
8
|
+
},
|
|
9
|
+
bold: {
|
|
10
|
+
vertical: '┃',
|
|
11
|
+
horizontal: '━',
|
|
12
|
+
crossing: '┣',
|
|
13
|
+
end: '┗',
|
|
14
|
+
space: ' ',
|
|
15
|
+
},
|
|
16
|
+
ascii: {
|
|
17
|
+
vertical: '|',
|
|
18
|
+
horizontal: '-',
|
|
19
|
+
crossing: '+',
|
|
20
|
+
end: '+',
|
|
21
|
+
space: ' ',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const defaultOptions = {
|
|
25
|
+
treeType: 'normal',
|
|
26
|
+
spaceBeforeName: false,
|
|
27
|
+
spaceSize: 2,
|
|
28
|
+
emptyBeforeUpperHierarche: false,
|
|
29
|
+
};
|
|
30
|
+
const treeTypeValues = ['normal', 'bold', 'ascii'];
|
|
31
|
+
export { symbolSets, defaultOptions, treeTypeValues };
|
|
32
32
|
//# sourceMappingURL=constant.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -9796,201 +9796,202 @@ function defaultOnError(left, right) {
|
|
|
9796
9796
|
}
|
|
9797
9797
|
}
|
|
9798
9798
|
|
|
9799
|
-
const extractText = (content) => {
|
|
9800
|
-
if (!content)
|
|
9801
|
-
return '';
|
|
9802
|
-
if (content.type === 'text')
|
|
9803
|
-
return content.value;
|
|
9804
|
-
if ('children' in content) {
|
|
9805
|
-
return content.children
|
|
9806
|
-
.map((child) => {
|
|
9807
|
-
return extractText(child);
|
|
9808
|
-
})
|
|
9809
|
-
.reduce((prev, cur) => {
|
|
9810
|
-
return prev + cur;
|
|
9811
|
-
}, '');
|
|
9812
|
-
}
|
|
9813
|
-
return '';
|
|
9814
|
-
};
|
|
9815
|
-
const extractListItem = (listItem) => {
|
|
9816
|
-
const name = extractText(listItem.children[0]);
|
|
9817
|
-
const children = listItem.children.length > 1
|
|
9818
|
-
? extractList(listItem.children[1])
|
|
9819
|
-
: [];
|
|
9820
|
-
return { name, children: children };
|
|
9821
|
-
};
|
|
9822
|
-
const extractList = (list) => {
|
|
9823
|
-
if (list.type !== 'list')
|
|
9824
|
-
return [];
|
|
9825
|
-
if (!list.children)
|
|
9826
|
-
return [];
|
|
9827
|
-
return list.children.map((listItem) => {
|
|
9828
|
-
return extractListItem(listItem);
|
|
9829
|
-
});
|
|
9830
|
-
};
|
|
9831
|
-
const parse = (chunk) => {
|
|
9832
|
-
const tree = fromMarkdown(chunk);
|
|
9833
|
-
const lists = tree.children.filter((child) => child.type === 'list');
|
|
9834
|
-
const result = lists.map((list) => {
|
|
9835
|
-
try {
|
|
9836
|
-
return extractList(list);
|
|
9837
|
-
}
|
|
9838
|
-
catch (error) {
|
|
9839
|
-
return [];
|
|
9840
|
-
}
|
|
9841
|
-
});
|
|
9842
|
-
return result;
|
|
9799
|
+
const extractText = (content) => {
|
|
9800
|
+
if (!content)
|
|
9801
|
+
return '';
|
|
9802
|
+
if (content.type === 'text')
|
|
9803
|
+
return content.value;
|
|
9804
|
+
if ('children' in content) {
|
|
9805
|
+
return content.children
|
|
9806
|
+
.map((child) => {
|
|
9807
|
+
return extractText(child);
|
|
9808
|
+
})
|
|
9809
|
+
.reduce((prev, cur) => {
|
|
9810
|
+
return prev + cur;
|
|
9811
|
+
}, '');
|
|
9812
|
+
}
|
|
9813
|
+
return '';
|
|
9814
|
+
};
|
|
9815
|
+
const extractListItem = (listItem) => {
|
|
9816
|
+
const name = extractText(listItem.children[0]);
|
|
9817
|
+
const children = listItem.children.length > 1
|
|
9818
|
+
? extractList(listItem.children[1])
|
|
9819
|
+
: [];
|
|
9820
|
+
return { name, children: children };
|
|
9821
|
+
};
|
|
9822
|
+
const extractList = (list) => {
|
|
9823
|
+
if (list.type !== 'list')
|
|
9824
|
+
return [];
|
|
9825
|
+
if (!list.children)
|
|
9826
|
+
return [];
|
|
9827
|
+
return list.children.map((listItem) => {
|
|
9828
|
+
return extractListItem(listItem);
|
|
9829
|
+
});
|
|
9830
|
+
};
|
|
9831
|
+
const parse = (chunk) => {
|
|
9832
|
+
const tree = fromMarkdown(chunk);
|
|
9833
|
+
const lists = tree.children.filter((child) => child.type === 'list');
|
|
9834
|
+
const result = lists.map((list) => {
|
|
9835
|
+
try {
|
|
9836
|
+
return extractList(list);
|
|
9837
|
+
}
|
|
9838
|
+
catch (error) {
|
|
9839
|
+
return [];
|
|
9840
|
+
}
|
|
9841
|
+
});
|
|
9842
|
+
return result;
|
|
9843
9843
|
};
|
|
9844
9844
|
|
|
9845
|
-
const symbolSets = {
|
|
9846
|
-
normal: {
|
|
9847
|
-
vertical: '│',
|
|
9848
|
-
horizontal: '─',
|
|
9849
|
-
crossing: '├',
|
|
9850
|
-
end: '└',
|
|
9851
|
-
space: ' ',
|
|
9852
|
-
},
|
|
9853
|
-
bold: {
|
|
9854
|
-
vertical: '┃',
|
|
9855
|
-
horizontal: '━',
|
|
9856
|
-
crossing: '┣',
|
|
9857
|
-
end: '┗',
|
|
9858
|
-
space: ' ',
|
|
9859
|
-
},
|
|
9860
|
-
ascii: {
|
|
9861
|
-
vertical: '|',
|
|
9862
|
-
horizontal: '-',
|
|
9863
|
-
crossing: '+',
|
|
9864
|
-
end: '+',
|
|
9865
|
-
space: ' ',
|
|
9866
|
-
},
|
|
9867
|
-
};
|
|
9868
|
-
const defaultOptions = {
|
|
9869
|
-
treeType: 'normal',
|
|
9870
|
-
spaceBeforeName: false,
|
|
9871
|
-
spaceSize: 2,
|
|
9872
|
-
emptyBeforeUpperHierarche: false,
|
|
9873
|
-
};
|
|
9845
|
+
const symbolSets = {
|
|
9846
|
+
normal: {
|
|
9847
|
+
vertical: '│',
|
|
9848
|
+
horizontal: '─',
|
|
9849
|
+
crossing: '├',
|
|
9850
|
+
end: '└',
|
|
9851
|
+
space: ' ',
|
|
9852
|
+
},
|
|
9853
|
+
bold: {
|
|
9854
|
+
vertical: '┃',
|
|
9855
|
+
horizontal: '━',
|
|
9856
|
+
crossing: '┣',
|
|
9857
|
+
end: '┗',
|
|
9858
|
+
space: ' ',
|
|
9859
|
+
},
|
|
9860
|
+
ascii: {
|
|
9861
|
+
vertical: '|',
|
|
9862
|
+
horizontal: '-',
|
|
9863
|
+
crossing: '+',
|
|
9864
|
+
end: '+',
|
|
9865
|
+
space: ' ',
|
|
9866
|
+
},
|
|
9867
|
+
};
|
|
9868
|
+
const defaultOptions = {
|
|
9869
|
+
treeType: 'normal',
|
|
9870
|
+
spaceBeforeName: false,
|
|
9871
|
+
spaceSize: 2,
|
|
9872
|
+
emptyBeforeUpperHierarche: false,
|
|
9873
|
+
};
|
|
9874
9874
|
const treeTypeValues = ['normal', 'bold', 'ascii'];
|
|
9875
9875
|
|
|
9876
|
-
const optionGuard = (value, defaultValue, key) => {
|
|
9877
|
-
if (key === 'spaceSize') {
|
|
9878
|
-
if (typeof value !== 'number')
|
|
9879
|
-
return defaultValue;
|
|
9880
|
-
if (value < 1)
|
|
9881
|
-
return defaultValue;
|
|
9882
|
-
return value;
|
|
9883
|
-
}
|
|
9884
|
-
if (key === 'emptyBeforeUpperHierarche') {
|
|
9885
|
-
if (typeof value !== 'boolean')
|
|
9886
|
-
return defaultValue;
|
|
9887
|
-
return value;
|
|
9888
|
-
}
|
|
9889
|
-
if (key === 'spaceBeforeName') {
|
|
9890
|
-
if (typeof value !== 'boolean')
|
|
9891
|
-
return defaultValue;
|
|
9892
|
-
return value;
|
|
9893
|
-
}
|
|
9894
|
-
if (key === 'treeType') {
|
|
9895
|
-
if (!treeTypeValues.includes(value))
|
|
9896
|
-
return defaultValue;
|
|
9897
|
-
return value;
|
|
9898
|
-
}
|
|
9899
|
-
return defaultValue;
|
|
9900
|
-
};
|
|
9901
|
-
const pickOption = (option, defaultOption, key) => {
|
|
9902
|
-
if (option === undefined)
|
|
9903
|
-
return defaultOptions[key];
|
|
9904
|
-
if (option[key] !== undefined) {
|
|
9905
|
-
return optionGuard(option[key], defaultOption[key], key);
|
|
9906
|
-
}
|
|
9907
|
-
return defaultOption[key];
|
|
9908
|
-
};
|
|
9909
|
-
const buildOption = (options, defaultOptions) => {
|
|
9910
|
-
return Object.fromEntries(Object.entries(defaultOptions).map(([key, value]) => {
|
|
9911
|
-
return [
|
|
9912
|
-
key,
|
|
9913
|
-
pickOption(options, defaultOptions, key),
|
|
9914
|
-
];
|
|
9915
|
-
}));
|
|
9876
|
+
const optionGuard = (value, defaultValue, key) => {
|
|
9877
|
+
if (key === 'spaceSize') {
|
|
9878
|
+
if (typeof value !== 'number')
|
|
9879
|
+
return defaultValue;
|
|
9880
|
+
if (value < 1)
|
|
9881
|
+
return defaultValue;
|
|
9882
|
+
return value;
|
|
9883
|
+
}
|
|
9884
|
+
if (key === 'emptyBeforeUpperHierarche') {
|
|
9885
|
+
if (typeof value !== 'boolean')
|
|
9886
|
+
return defaultValue;
|
|
9887
|
+
return value;
|
|
9888
|
+
}
|
|
9889
|
+
if (key === 'spaceBeforeName') {
|
|
9890
|
+
if (typeof value !== 'boolean')
|
|
9891
|
+
return defaultValue;
|
|
9892
|
+
return value;
|
|
9893
|
+
}
|
|
9894
|
+
if (key === 'treeType') {
|
|
9895
|
+
if (!treeTypeValues.includes(value))
|
|
9896
|
+
return defaultValue;
|
|
9897
|
+
return value;
|
|
9898
|
+
}
|
|
9899
|
+
return defaultValue;
|
|
9900
|
+
};
|
|
9901
|
+
const pickOption = (option, defaultOption, key) => {
|
|
9902
|
+
if (option === undefined)
|
|
9903
|
+
return defaultOptions[key];
|
|
9904
|
+
if (option[key] !== undefined) {
|
|
9905
|
+
return optionGuard(option[key], defaultOption[key], key);
|
|
9906
|
+
}
|
|
9907
|
+
return defaultOption[key];
|
|
9908
|
+
};
|
|
9909
|
+
const buildOption = (options, defaultOptions) => {
|
|
9910
|
+
return Object.fromEntries(Object.entries(defaultOptions).map(([key, value]) => {
|
|
9911
|
+
return [
|
|
9912
|
+
key,
|
|
9913
|
+
pickOption(options, defaultOptions, key),
|
|
9914
|
+
];
|
|
9915
|
+
}));
|
|
9916
9916
|
};
|
|
9917
9917
|
|
|
9918
|
-
const makeSymbol = (symbolSet, isLast) => {
|
|
9919
|
-
if (isLast)
|
|
9920
|
-
return symbolSet.end;
|
|
9921
|
-
return symbolSet.crossing;
|
|
9922
|
-
};
|
|
9923
|
-
const makeAsciiSpace = (spaceSize) => {
|
|
9924
|
-
return new Array(spaceSize).fill(' ').reduce((prev, cur) => {
|
|
9925
|
-
return prev + cur;
|
|
9926
|
-
}, '');
|
|
9927
|
-
};
|
|
9928
|
-
const makeSpace = (spaceSize) => {
|
|
9929
|
-
return (new Array(Math.floor(spaceSize / 2)).fill(' ').reduce((prev, cur) => {
|
|
9930
|
-
return prev + cur;
|
|
9931
|
-
}, '') + (spaceSize % 2 == 1 ? ' ' : ''));
|
|
9932
|
-
};
|
|
9933
|
-
const reduce = (dirTree, options, prefix, hie, isLastGroup) => {
|
|
9934
|
-
let result = ``;
|
|
9935
|
-
dirTree.some((dirNode, dirNodeIndex) => {
|
|
9936
|
-
// 準備
|
|
9937
|
-
const isLast = dirNodeIndex == dirTree.length - 1;
|
|
9938
|
-
const isOneTop = hie === 0 && dirTree.length === 1;
|
|
9939
|
-
const symbolSet = symbolSets[options.treeType];
|
|
9940
|
-
// 現在
|
|
9941
|
-
const makePrefix = () => {
|
|
9942
|
-
if (isOneTop)
|
|
9943
|
-
return '';
|
|
9944
|
-
return (makeSymbol(symbolSet, isLast) +
|
|
9945
|
-
new Array(Math.floor(options.spaceSize / (options.treeType === 'ascii' ? 1 : 2)))
|
|
9946
|
-
.fill(symbolSet.horizontal)
|
|
9947
|
-
.reduce((prev, cur) => prev + cur, '') +
|
|
9948
|
-
(options.spaceBeforeName ? ' ' : ''));
|
|
9949
|
-
};
|
|
9950
|
-
const currentLine = `${prefix + makePrefix()}${dirNode.name}`;
|
|
9951
|
-
// 子
|
|
9952
|
-
const makeNextSpaces = () => {
|
|
9953
|
-
if (isOneTop)
|
|
9954
|
-
return '';
|
|
9955
|
-
return options.treeType === 'ascii'
|
|
9956
|
-
? makeAsciiSpace(options.spaceSize)
|
|
9957
|
-
: makeSpace(options.spaceSize);
|
|
9958
|
-
};
|
|
9959
|
-
const makeNextVertical = () => {
|
|
9960
|
-
if (!isLast)
|
|
9961
|
-
return symbolSet.vertical;
|
|
9962
|
-
if (!isOneTop)
|
|
9963
|
-
return symbolSet.space;
|
|
9964
|
-
return '';
|
|
9965
|
-
};
|
|
9966
|
-
const childrenLines = reduce(dirNode.children, options, prefix + makeNextVertical() + makeNextSpaces(), hie + 1, isLastGroup || isLast);
|
|
9967
|
-
// 追加
|
|
9968
|
-
result +=
|
|
9969
|
-
currentLine +
|
|
9970
|
-
'\n' +
|
|
9971
|
-
childrenLines +
|
|
9972
|
-
(options.emptyBeforeUpperHierarche && isLast && !(isLastGroup || hie == 0)
|
|
9973
|
-
? `${symbolSet.vertical}\n`
|
|
9974
|
-
: '');
|
|
9975
|
-
});
|
|
9976
|
-
return result.slice(0, hie === 0 ? -1 : result.length);
|
|
9977
|
-
};
|
|
9978
|
-
const convert = (dirTree, options) => {
|
|
9979
|
-
try {
|
|
9980
|
-
return reduce(dirTree, buildOption(options, defaultOptions), '', 0, false);
|
|
9981
|
-
}
|
|
9982
|
-
catch (error) {
|
|
9983
|
-
return ('Some errors occurred!\n\n' +
|
|
9984
|
-
String(error) +
|
|
9985
|
-
'\n\n' +
|
|
9986
|
-
'Please contact to developper.');
|
|
9987
|
-
}
|
|
9918
|
+
const makeSymbol = (symbolSet, isLast) => {
|
|
9919
|
+
if (isLast)
|
|
9920
|
+
return symbolSet.end;
|
|
9921
|
+
return symbolSet.crossing;
|
|
9922
|
+
};
|
|
9923
|
+
const makeAsciiSpace = (spaceSize) => {
|
|
9924
|
+
return new Array(spaceSize).fill(' ').reduce((prev, cur) => {
|
|
9925
|
+
return prev + cur;
|
|
9926
|
+
}, '');
|
|
9927
|
+
};
|
|
9928
|
+
const makeSpace = (spaceSize) => {
|
|
9929
|
+
return (new Array(Math.floor(spaceSize / 2)).fill(' ').reduce((prev, cur) => {
|
|
9930
|
+
return prev + cur;
|
|
9931
|
+
}, '') + (spaceSize % 2 == 1 ? ' ' : ''));
|
|
9932
|
+
};
|
|
9933
|
+
const reduce = (dirTree, options, prefix, hie, isLastGroup) => {
|
|
9934
|
+
let result = ``;
|
|
9935
|
+
dirTree.some((dirNode, dirNodeIndex) => {
|
|
9936
|
+
// 準備
|
|
9937
|
+
const isLast = dirNodeIndex == dirTree.length - 1;
|
|
9938
|
+
const isOneTop = hie === 0 && dirTree.length === 1;
|
|
9939
|
+
const symbolSet = symbolSets[options.treeType];
|
|
9940
|
+
// 現在
|
|
9941
|
+
const makePrefix = () => {
|
|
9942
|
+
if (isOneTop)
|
|
9943
|
+
return '';
|
|
9944
|
+
return (makeSymbol(symbolSet, isLast) +
|
|
9945
|
+
new Array(Math.floor(options.spaceSize / (options.treeType === 'ascii' ? 1 : 2)))
|
|
9946
|
+
.fill(symbolSet.horizontal)
|
|
9947
|
+
.reduce((prev, cur) => prev + cur, '') +
|
|
9948
|
+
(options.spaceBeforeName ? ' ' : ''));
|
|
9949
|
+
};
|
|
9950
|
+
const currentLine = `${prefix + makePrefix()}${dirNode.name}`;
|
|
9951
|
+
// 子
|
|
9952
|
+
const makeNextSpaces = () => {
|
|
9953
|
+
if (isOneTop)
|
|
9954
|
+
return '';
|
|
9955
|
+
return options.treeType === 'ascii'
|
|
9956
|
+
? makeAsciiSpace(options.spaceSize)
|
|
9957
|
+
: makeSpace(options.spaceSize);
|
|
9958
|
+
};
|
|
9959
|
+
const makeNextVertical = () => {
|
|
9960
|
+
if (!isLast)
|
|
9961
|
+
return symbolSet.vertical;
|
|
9962
|
+
if (!isOneTop)
|
|
9963
|
+
return symbolSet.space;
|
|
9964
|
+
return '';
|
|
9965
|
+
};
|
|
9966
|
+
const childrenLines = reduce(dirNode.children, options, prefix + makeNextVertical() + makeNextSpaces(), hie + 1, isLastGroup || isLast);
|
|
9967
|
+
// 追加
|
|
9968
|
+
result +=
|
|
9969
|
+
currentLine +
|
|
9970
|
+
'\n' +
|
|
9971
|
+
childrenLines +
|
|
9972
|
+
(options.emptyBeforeUpperHierarche && isLast && !(isLastGroup || hie == 0)
|
|
9973
|
+
? `${symbolSet.vertical}\n`
|
|
9974
|
+
: '');
|
|
9975
|
+
});
|
|
9976
|
+
return result.slice(0, hie === 0 ? -1 : result.length);
|
|
9977
|
+
};
|
|
9978
|
+
const convert = (dirTree, options) => {
|
|
9979
|
+
try {
|
|
9980
|
+
return reduce(dirTree, buildOption(options, defaultOptions), '', 0, false);
|
|
9981
|
+
}
|
|
9982
|
+
catch (error) {
|
|
9983
|
+
return ('Some errors occurred!\n\n' +
|
|
9984
|
+
String(error) +
|
|
9985
|
+
'\n\n' +
|
|
9986
|
+
'Please contact to developper.');
|
|
9987
|
+
}
|
|
9988
9988
|
};
|
|
9989
9989
|
|
|
9990
|
-
const dirtreeist = (markdown, option) => {
|
|
9991
|
-
return parse(markdown).map((dirtree) => convert(dirtree, option));
|
|
9990
|
+
const dirtreeist = (markdown, option) => {
|
|
9991
|
+
return parse(markdown).map((dirtree) => convert(dirtree, option));
|
|
9992
9992
|
};
|
|
9993
9993
|
|
|
9994
9994
|
exports.convert = convert;
|
|
9995
9995
|
exports["default"] = dirtreeist;
|
|
9996
9996
|
exports.parse = parse;
|
|
9997
|
+
exports.symbolSets = symbolSets;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { parse } from './modules/parse.js';
|
|
2
|
-
import { convert } from './modules/convert.js';
|
|
3
|
-
import { DirTree, Options } from './types/index';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
1
|
+
import { parse } from './modules/parse.js';
|
|
2
|
+
import { convert } from './modules/convert.js';
|
|
3
|
+
import { DirTree, Options } from './types/index';
|
|
4
|
+
import { symbolSets } from 'constants/constant.js';
|
|
5
|
+
declare const dirtreeist: (markdown: string, option?: Options) => string[];
|
|
6
|
+
export { parse, convert, symbolSets };
|
|
7
|
+
export default dirtreeist;
|
|
8
|
+
export type { DirTree, Options };
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAE9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,QAAA,MAAM,UAAU,aAAc,MAAM,WAAW,OAAO,aAErD,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;AACrC,eAAe,UAAU,CAAA;AACzB,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { parse } from './modules/parse.js';
|
|
2
|
-
import { convert } from './modules/convert.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
1
|
+
import { parse } from './modules/parse.js';
|
|
2
|
+
import { convert } from './modules/convert.js';
|
|
3
|
+
import { symbolSets } from './constants/constant.js';
|
|
4
|
+
const dirtreeist = (markdown, option) => {
|
|
5
|
+
return parse(markdown).map((dirtree) => convert(dirtree, option));
|
|
6
|
+
};
|
|
7
|
+
export { parse, convert, symbolSets };
|
|
8
|
+
export default dirtreeist;
|
|
8
9
|
//# 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,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAElD,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,MAAgB,EAAE,EAAE;IACxD,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AACnE,CAAC,CAAA;AAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAA;AACrC,eAAe,UAAU,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DirTree, Options } from '../types/index';
|
|
2
|
-
declare const convert: (dirTree: DirTree, options?: Options) => string;
|
|
3
|
-
export { convert };
|
|
1
|
+
import { DirTree, Options } from '../types/index';
|
|
2
|
+
declare const convert: (dirTree: DirTree, options?: Options) => string;
|
|
3
|
+
export { convert };
|
|
4
4
|
//# sourceMappingURL=convert.d.ts.map
|