@k4a_l/dirtreeist 0.1.1 → 0.1.4
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/README.md +2 -2
- package/dist/constants/constant.d.ts +7 -0
- package/dist/constants/constant.d.ts.map +1 -0
- package/dist/constants/constant.js +31 -0
- package/dist/constants/constant.js.map +1 -0
- package/dist/index.cjs +9922 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -7
- package/dist/index.js.map +1 -1
- package/dist/modules/convert.d.ts +2 -1
- package/dist/modules/convert.d.ts.map +1 -1
- package/dist/modules/convert.js +43 -5
- package/dist/modules/convert.js.map +1 -1
- package/dist/modules/options.d.ts +4 -0
- package/dist/modules/options.d.ts.map +1 -0
- package/dist/modules/options.js +18 -0
- package/dist/modules/options.js.map +1 -0
- package/dist/modules/parse.d.ts +2 -1
- package/dist/modules/parse.d.ts.map +1 -1
- package/dist/modules/parse.js +36 -5
- package/dist/modules/parse.js.map +1 -1
- package/dist/types/index.d.ts +15 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -2
- package/package.json +18 -4
- package/rollup.config.js +21 -0
- package/vitest.config.d.ts +3 -0
- package/vitest.config.ts +0 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { DirTree } from './types/index';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
parse: (chunk: string) => DirTree[];
|
|
4
|
+
convert: (dirTree: DirTree, options?: Partial<import("./types/index").OptionsBase> | undefined) => string;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
export type { DirTree };
|
|
5
8
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;;;;;AAEvC,wBAAiC;AAEjC,YAAY,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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; } });
|
|
1
|
+
import { parse } from './modules/parse';
|
|
2
|
+
import { convert } from './modules/convert';
|
|
3
|
+
export default { parse, convert };
|
|
4
|
+
console.log('hello');
|
|
8
5
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAI3C,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAIjC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/modules/convert.js
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { symbolSets, defaultOptions } from 'constants/constant';
|
|
2
|
+
import { buildOption } from './options';
|
|
3
|
+
const makeSymbol = (symbolSet, isLast) => {
|
|
4
|
+
if (isLast)
|
|
5
|
+
return symbolSet.end;
|
|
6
|
+
return symbolSet.crossing;
|
|
7
|
+
};
|
|
8
|
+
const reduce = (dirTree, options, prefix, hie, isLastGroup) => {
|
|
9
|
+
let result = ``;
|
|
10
|
+
dirTree.some((dirNode, dirNodeIndex) => {
|
|
11
|
+
// 準備
|
|
12
|
+
const isLast = dirNodeIndex == dirTree.length - 1;
|
|
13
|
+
const symbolSet = symbolSets[options.treeType];
|
|
14
|
+
const symbol = makeSymbol(symbolSet, isLast);
|
|
15
|
+
// 現在
|
|
16
|
+
const currentPrefix = prefix +
|
|
17
|
+
symbol +
|
|
18
|
+
new Array(options.spaceSize / 2)
|
|
19
|
+
.fill(symbolSet.horizontal)
|
|
20
|
+
.reduce((prev, cur) => prev + cur, '');
|
|
21
|
+
const currentLine = `${currentPrefix}${options.spaceBeforeName ? ' ' : ''}${dirNode.name}`;
|
|
22
|
+
// 子
|
|
23
|
+
const spaces = new Array(options.spaceSize)
|
|
24
|
+
.fill(' ')
|
|
25
|
+
.reduce((prev, cur) => {
|
|
26
|
+
return prev + cur;
|
|
27
|
+
}, '');
|
|
28
|
+
const childrenLines = reduce(dirNode.children, options, prefix + (isLast ? symbolSet.space : symbolSet.vertical) + spaces, hie + 1, isLastGroup || isLast);
|
|
29
|
+
// 追加
|
|
30
|
+
result +=
|
|
31
|
+
currentLine +
|
|
32
|
+
'\n' +
|
|
33
|
+
childrenLines +
|
|
34
|
+
(options.emptyBeforeUpperHierarche && isLast && !(isLastGroup || hie == 0)
|
|
35
|
+
? `${symbolSet.vertical}\n`
|
|
36
|
+
: '');
|
|
37
|
+
});
|
|
38
|
+
return result.slice(0, hie === 0 ? -1 : result.length);
|
|
39
|
+
};
|
|
40
|
+
const convert = (dirTree, options) => {
|
|
41
|
+
return reduce(dirTree, buildOption(options, defaultOptions), '', 0, false);
|
|
42
|
+
};
|
|
43
|
+
export { convert };
|
|
6
44
|
//# sourceMappingURL=convert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"convert.js","sourceRoot":"","sources":["../../src/modules/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;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,UAAU,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,OAA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CAAA;AAED,MAAM,OAAO,GAAG,CAAC,OAAgB,EAAE,OAAiB,EAAU,EAAE;IAC9D,OAAO,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;AAC5E,CAAC,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
|
@@ -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,18 @@
|
|
|
1
|
+
import { defaultOptions } from 'constants/constant';
|
|
2
|
+
const pickOption = (option, defaultOption, key) => {
|
|
3
|
+
if (option === undefined)
|
|
4
|
+
return defaultOptions[key];
|
|
5
|
+
if (option[key] !== undefined)
|
|
6
|
+
return option[key];
|
|
7
|
+
return defaultOption[key];
|
|
8
|
+
};
|
|
9
|
+
const buildOption = (options, defaultOptions) => {
|
|
10
|
+
return Object.fromEntries(Object.entries(defaultOptions).map(([key, value]) => {
|
|
11
|
+
return [
|
|
12
|
+
key,
|
|
13
|
+
pickOption(options, defaultOptions, key),
|
|
14
|
+
];
|
|
15
|
+
}));
|
|
16
|
+
};
|
|
17
|
+
export { buildOption };
|
|
18
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/modules/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGnD,MAAM,UAAU,GAAG,CACjB,MAA2B,EAC3B,aAA0B,EAC1B,GAAsB,EACnB,EAAE;IACL,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,cAAc,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;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/modules/parse.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,KAAK,
|
|
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"}
|
package/dist/modules/parse.js
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { fromMarkdown } from 'mdast-util-from-markdown';
|
|
2
|
+
const extractText = (content) => {
|
|
3
|
+
if (content.type === 'text')
|
|
4
|
+
return content.value;
|
|
5
|
+
if ('children' in content) {
|
|
6
|
+
return content.children
|
|
7
|
+
.map((child) => {
|
|
8
|
+
return extractText(child);
|
|
9
|
+
})
|
|
10
|
+
.reduce((prev, cur) => {
|
|
11
|
+
return prev + cur;
|
|
12
|
+
}, '');
|
|
13
|
+
}
|
|
14
|
+
return '';
|
|
15
|
+
};
|
|
16
|
+
const extractListItem = (listItem) => {
|
|
17
|
+
const name = extractText(listItem.children[0]);
|
|
18
|
+
const children = listItem.children.length > 1
|
|
19
|
+
? extractList(listItem.children[1])
|
|
20
|
+
: [];
|
|
21
|
+
return { name, children: children };
|
|
22
|
+
};
|
|
23
|
+
const extractList = (list) => {
|
|
24
|
+
return list.children.map((listItem) => {
|
|
25
|
+
return extractListItem(listItem);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
const parse = (chunk) => {
|
|
29
|
+
const tree = fromMarkdown(chunk);
|
|
30
|
+
const lists = tree.children.filter((child) => child.type === 'list');
|
|
31
|
+
const result = lists.map((list) => {
|
|
32
|
+
return extractList(list);
|
|
33
|
+
});
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
export { parse };
|
|
6
37
|
//# sourceMappingURL=parse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/modules/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;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,CA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/dist/types/index.d.ts
CHANGED
|
@@ -3,5 +3,19 @@ declare type DirNode = {
|
|
|
3
3
|
children: DirNode[];
|
|
4
4
|
};
|
|
5
5
|
declare type DirTree = DirNode[];
|
|
6
|
-
|
|
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 type { DirNode, DirTree, Options, OptionsBase, SymbolSet };
|
|
7
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,
|
|
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,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k4a_l/dirtreeist",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
+
"exports": {
|
|
6
|
+
"import": "./dist/index.js",
|
|
7
|
+
"require": "./dist/index.cjs"
|
|
8
|
+
},
|
|
5
9
|
"types": "dist/index.d.ts",
|
|
6
10
|
"author": "kasahala",
|
|
7
11
|
"license": "MIT",
|
|
12
|
+
"type": "module",
|
|
8
13
|
"scripts": {
|
|
9
|
-
"dev": "
|
|
10
|
-
"
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"clean": "rm -rf ./dist/ ",
|
|
16
|
+
"build:esm": "tsc",
|
|
17
|
+
"build:cjs": "rollup -c rollup.config.js",
|
|
18
|
+
"build": "yarn clean && yarn build:esm && yarn build:cjs",
|
|
11
19
|
"test": "vitest",
|
|
12
|
-
"coverage": "vitest run --coverage"
|
|
20
|
+
"coverage": "vitest run --coverage",
|
|
21
|
+
"deploy": "yarn build && yarn publish --access=public"
|
|
13
22
|
},
|
|
14
23
|
"devDependencies": {
|
|
24
|
+
"@rollup/plugin-commonjs": "^22.0.2",
|
|
25
|
+
"@rollup/plugin-node-resolve": "^14.0.1",
|
|
26
|
+
"@rollup/plugin-typescript": "^8.5.0",
|
|
15
27
|
"@types/jest": "^29.0.0",
|
|
16
28
|
"@types/mdast": "^3.0.10",
|
|
17
29
|
"@typescript-eslint/eslint-plugin": "^5.36.2",
|
|
@@ -20,8 +32,10 @@
|
|
|
20
32
|
"eslint-config-prettier": "^8.5.0",
|
|
21
33
|
"jest": "^29.0.2",
|
|
22
34
|
"prettier": "^2.7.1",
|
|
35
|
+
"rollup": "^2.79.0",
|
|
23
36
|
"ts-jest": "^28.0.8",
|
|
24
37
|
"ts-node-dev": "^2.0.0",
|
|
38
|
+
"tslib": "^2.4.0",
|
|
25
39
|
"typescript": "^4.8.2",
|
|
26
40
|
"vite-tsconfig-paths": "^3.5.0",
|
|
27
41
|
"vitest": "^0.23.1"
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import typescript from '@rollup/plugin-typescript'
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs'
|
|
3
|
+
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
input: './src/index.ts',
|
|
7
|
+
output: {
|
|
8
|
+
file: './dist/index.cjs',
|
|
9
|
+
format: 'cjs',
|
|
10
|
+
exports: 'default',
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
typescript({
|
|
14
|
+
//module: 'commonjs'
|
|
15
|
+
}),
|
|
16
|
+
nodeResolve(),
|
|
17
|
+
commonjs({
|
|
18
|
+
// extensions: ['.js', '.ts']
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
}
|