vuepress-jsdoc 4.3.1 → 5.0.0

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.
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -19,58 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
19
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
20
9
  });
21
10
  };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __read = (this && this.__read) || function (o, n) {
50
- var m = typeof Symbol === "function" && o[Symbol.iterator];
51
- if (!m) return o;
52
- var i = m.call(o), r, ar = [], e;
53
- try {
54
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
55
- }
56
- catch (error) { e = { error: error }; }
57
- finally {
58
- try {
59
- if (r && !r.done && (m = i["return"])) m.call(i);
60
- }
61
- finally { if (e) throw e.error; }
62
- }
63
- return ar;
64
- };
65
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
66
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
67
- if (ar || !(i in from)) {
68
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
69
- ar[i] = from[i];
70
- }
71
- }
72
- return to.concat(ar || Array.prototype.slice.call(from));
73
- };
74
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
75
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
76
13
  };
@@ -82,14 +19,14 @@ exports.writeContentToFile = exports.parseVueFile = exports.parseFile = void 0;
82
19
  * headline: lib/parser.ts
83
20
  * ---
84
21
  */
85
- var promises_1 = __importDefault(require("fs/promises"));
86
- var jsdoc_to_markdown_1 = __importDefault(require("jsdoc-to-markdown"));
87
- var mkdirp_1 = __importDefault(require("mkdirp"));
88
- var path_1 = require("path");
89
- var compileTemplates_1 = __importDefault(require("vue-docgen-cli/lib/compileTemplates"));
90
- var docgen_1 = require("vue-docgen-cli/lib/docgen");
91
- var constants_1 = require("../constants");
92
- var comment_parser_1 = require("./comment-parser");
22
+ const jsdoc_to_markdown_1 = __importDefault(require("jsdoc-to-markdown"));
23
+ const mkdirp_1 = require("mkdirp");
24
+ const promises_1 = __importDefault(require("node:fs/promises"));
25
+ const node_path_1 = require("node:path");
26
+ const compileTemplates_1 = __importDefault(require("vue-docgen-cli/lib/compileTemplates"));
27
+ const docgen_1 = require("vue-docgen-cli/lib/docgen");
28
+ const constants_1 = require("../constants");
29
+ const comment_parser_1 = require("./comment-parser");
93
30
  /**
94
31
  * Parse a typescript or javascript file
95
32
  * @param file {DirectoryFile}
@@ -99,69 +36,57 @@ var comment_parser_1 = require("./comment-parser");
99
36
  * @param partials {string | string[]}
100
37
  * @returns {object} file data
101
38
  */
102
- var parseFile = function (file, srcFolder, destFolder, configPath, partials) { return __awaiter(void 0, void 0, void 0, function () {
103
- var root, relativePathDest, folderInDest, folderInSrc, success, empty, excluded, fileContent, content, fileName, _a, e_1;
104
- return __generator(this, function (_b) {
105
- switch (_b.label) {
106
- case 0:
107
- if (!file.folder)
108
- return [2 /*return*/, null];
109
- root = process.cwd();
110
- relativePathDest = (0, path_1.join)(destFolder, file.folder.replace(srcFolder, ''));
111
- folderInDest = (0, path_1.join)(root, relativePathDest);
112
- folderInSrc = (0, path_1.join)(root, file.folder);
113
- success = true;
114
- empty = false;
115
- excluded = false;
116
- fileContent = '';
117
- _b.label = 1;
118
- case 1:
119
- _b.trys.push([1, 4, , 5]);
120
- content = '';
121
- fileName = file.name;
122
- if (fileName === '__index__') {
123
- fileName = 'index';
124
- }
125
- return [4 /*yield*/, jsdoc_to_markdown_1.default.render({
126
- 'no-cache': configPath ? true : false,
127
- files: [(0, path_1.join)(process.cwd(), file.folder, fileName + file.ext)],
128
- configure: configPath,
129
- partial: __spreadArray([
130
- (0, path_1.resolve)(__filename, '../../../template/header.hbs'),
131
- (0, path_1.resolve)(__filename, '../../../template/main.hbs')
132
- ], __read(partials), false)
133
- })];
134
- case 2:
135
- content = _b.sent();
136
- _a = comment_parser_1.parseVuepressFileHeader;
137
- return [4 /*yield*/, promises_1.default.readFile("".concat((0, path_1.join)(folderInSrc, fileName + file.ext)), 'utf-8')];
138
- case 3:
139
- fileContent = _a.apply(void 0, [_b.sent(), file]);
140
- if (content) {
141
- fileContent += content;
142
- }
143
- else {
144
- empty = true;
145
- }
146
- return [3 /*break*/, 5];
147
- case 4:
148
- e_1 = _b.sent();
149
- success = false;
150
- excluded = true;
151
- return [3 /*break*/, 5];
152
- case 5: return [2 /*return*/, {
153
- success: success,
154
- file: file,
155
- empty: empty,
156
- excluded: excluded,
157
- relativePathDest: relativePathDest,
158
- relativePathSrc: file.folder,
159
- dest: folderInDest,
160
- content: fileContent
161
- }];
39
+ const parseFile = (file, srcFolder, destFolder, configPath, partials) => __awaiter(void 0, void 0, void 0, function* () {
40
+ if (!file.folder)
41
+ return null;
42
+ const root = process.cwd();
43
+ const relativePathDest = (0, node_path_1.join)(destFolder, file.folder.replace(srcFolder, ''));
44
+ const folderInDest = (0, node_path_1.join)(root, relativePathDest);
45
+ const folderInSrc = (0, node_path_1.join)(root, file.folder);
46
+ let success = true;
47
+ let empty = false;
48
+ let excluded = false;
49
+ let fileContent = '';
50
+ // parse file
51
+ try {
52
+ let content = '';
53
+ let fileName = file.name;
54
+ if (fileName.endsWith('index')) {
55
+ fileName = 'index';
162
56
  }
163
- });
164
- }); };
57
+ content = yield jsdoc_to_markdown_1.default.render({
58
+ 'no-cache': configPath ? true : false,
59
+ files: [(0, node_path_1.join)(process.cwd(), file.folder, fileName + file.ext)],
60
+ configure: configPath,
61
+ partial: [
62
+ (0, node_path_1.resolve)(__filename, '../../../template/header.hbs'),
63
+ (0, node_path_1.resolve)(__filename, '../../../template/main.hbs'),
64
+ ...partials
65
+ ]
66
+ });
67
+ fileContent = (0, comment_parser_1.parseVuepressFileHeader)(yield promises_1.default.readFile(`${(0, node_path_1.join)(folderInSrc, fileName + file.ext)}`, 'utf-8'), file);
68
+ if (content) {
69
+ fileContent += content;
70
+ }
71
+ else {
72
+ empty = true;
73
+ }
74
+ }
75
+ catch (e) {
76
+ success = false;
77
+ excluded = true;
78
+ }
79
+ return {
80
+ success,
81
+ file,
82
+ empty,
83
+ excluded,
84
+ relativePathDest,
85
+ relativePathSrc: file.folder,
86
+ dest: folderInDest,
87
+ content: fileContent
88
+ };
89
+ });
165
90
  exports.parseFile = parseFile;
166
91
  /**
167
92
  * Parse a vue file
@@ -170,59 +95,47 @@ exports.parseFile = parseFile;
170
95
  * @param {string} destFolder
171
96
  * @returns {object} file data
172
97
  */
173
- var parseVueFile = function (file, srcFolder, destFolder) { return __awaiter(void 0, void 0, void 0, function () {
174
- var root, relativePathDest, folderInDest, folderInSrc, config, success, empty, fileContent, fileName, data, _a, e_2;
175
- return __generator(this, function (_b) {
176
- switch (_b.label) {
177
- case 0:
178
- if (!file.folder)
179
- return [2 /*return*/, null];
180
- root = process.cwd();
181
- relativePathDest = (0, path_1.join)(destFolder, file.folder.replace(srcFolder, ''));
182
- folderInDest = (0, path_1.join)(root, relativePathDest);
183
- folderInSrc = (0, path_1.join)(root, file.folder);
184
- config = __assign(__assign({}, (0, docgen_1.extractConfig)((0, path_1.join)(root, file.folder))), { components: file.name + file.ext });
185
- success = true;
186
- empty = false;
187
- fileContent = '';
188
- _b.label = 1;
189
- case 1:
190
- _b.trys.push([1, 4, , 5]);
191
- fileName = file.name;
192
- if (fileName === '__index__') {
193
- fileName = 'index';
194
- }
195
- return [4 /*yield*/, (0, compileTemplates_1.default)((0, path_1.join)(config.componentsRoot, fileName + file.ext), config, fileName + file.ext)];
196
- case 2:
197
- data = _b.sent();
198
- _a = comment_parser_1.parseVuepressFileHeader;
199
- return [4 /*yield*/, promises_1.default.readFile("".concat((0, path_1.join)(folderInSrc, fileName + file.ext)), 'utf-8')];
200
- case 3:
201
- fileContent = _a.apply(void 0, [_b.sent(), file]);
202
- if (data.content) {
203
- fileContent += data.content;
204
- }
205
- else {
206
- empty = true;
207
- }
208
- return [3 /*break*/, 5];
209
- case 4:
210
- e_2 = _b.sent();
211
- console.log(e_2);
212
- success = false;
213
- return [3 /*break*/, 5];
214
- case 5: return [2 /*return*/, {
215
- success: success,
216
- file: file,
217
- empty: empty,
218
- relativePathDest: relativePathDest,
219
- relativePathSrc: file.folder,
220
- dest: folderInDest,
221
- content: fileContent
222
- }];
98
+ const parseVueFile = (file, srcFolder, destFolder) => __awaiter(void 0, void 0, void 0, function* () {
99
+ if (!file.folder)
100
+ return null;
101
+ const root = process.cwd();
102
+ const relativePathDest = (0, node_path_1.join)(destFolder, file.folder.replace(srcFolder, ''));
103
+ const folderInDest = (0, node_path_1.join)(root, relativePathDest);
104
+ const folderInSrc = (0, node_path_1.join)(root, file.folder);
105
+ const vueDocGenCliConf = yield (0, docgen_1.extractConfig)((0, node_path_1.join)(root, file.folder));
106
+ const config = Object.assign(Object.assign({}, vueDocGenCliConf), { components: file.name + file.ext });
107
+ let success = true;
108
+ let empty = false;
109
+ let fileContent = '';
110
+ try {
111
+ let fileName = file.name;
112
+ if (fileName.endsWith('index')) {
113
+ fileName = 'index';
223
114
  }
224
- });
225
- }); };
115
+ // parse file
116
+ const data = yield (0, compileTemplates_1.default)('add', (0, node_path_1.join)(config.componentsRoot, fileName + file.ext), config, fileName + file.ext);
117
+ fileContent = (0, comment_parser_1.parseVuepressFileHeader)(yield promises_1.default.readFile(`${(0, node_path_1.join)(folderInSrc, fileName + file.ext)}`, 'utf-8'), file);
118
+ if (data.content) {
119
+ fileContent += data.content;
120
+ }
121
+ else {
122
+ empty = true;
123
+ }
124
+ }
125
+ catch (e) {
126
+ console.log(e);
127
+ success = false;
128
+ }
129
+ return {
130
+ success,
131
+ file,
132
+ empty,
133
+ relativePathDest,
134
+ relativePathSrc: file.folder,
135
+ dest: folderInDest,
136
+ content: fileContent
137
+ };
138
+ });
226
139
  exports.parseVueFile = parseVueFile;
227
140
  /**
228
141
  * Write content on disk
@@ -230,36 +143,23 @@ exports.parseVueFile = parseVueFile;
230
143
  * @param {string} dest
231
144
  * @returns {Promise | null} null or type with some data of the saved file
232
145
  */
233
- var writeContentToFile = function (parseData, dest) { return __awaiter(void 0, void 0, void 0, function () {
234
- var root, type, path, _a;
235
- return __generator(this, function (_b) {
236
- switch (_b.label) {
237
- case 0:
238
- root = process.cwd();
239
- dest = (0, path_1.join)(root, dest);
240
- type = constants_1.StatisticType.ERROR;
241
- if (parseData === null || parseData === void 0 ? void 0 : parseData.excluded) {
242
- type = constants_1.StatisticType.EXCLUDE;
243
- }
244
- _b.label = 1;
245
- case 1:
246
- _b.trys.push([1, 5, , 6]);
247
- if (!(parseData === null || parseData === void 0 ? void 0 : parseData.content)) return [3 /*break*/, 4];
248
- path = "".concat((0, path_1.join)(dest, parseData.file.name), ".md");
249
- return [4 /*yield*/, (0, mkdirp_1.default)(dest)];
250
- case 2:
251
- _b.sent();
252
- return [4 /*yield*/, promises_1.default.writeFile(path, parseData.content, 'utf-8')];
253
- case 3:
254
- _b.sent();
255
- type = (parseData === null || parseData === void 0 ? void 0 : parseData.empty) ? constants_1.StatisticType.EMPTY : constants_1.StatisticType.INCLUDE;
256
- _b.label = 4;
257
- case 4: return [2 /*return*/, __assign(__assign({}, parseData), { type: type })];
258
- case 5:
259
- _a = _b.sent();
260
- return [3 /*break*/, 6];
261
- case 6: return [2 /*return*/, null];
146
+ const writeContentToFile = (parseData, dest) => __awaiter(void 0, void 0, void 0, function* () {
147
+ const root = process.cwd();
148
+ dest = (0, node_path_1.join)(root, dest);
149
+ let type = constants_1.StatisticType.ERROR;
150
+ if (parseData === null || parseData === void 0 ? void 0 : parseData.excluded) {
151
+ type = constants_1.StatisticType.EXCLUDE;
152
+ }
153
+ try {
154
+ if (parseData === null || parseData === void 0 ? void 0 : parseData.content) {
155
+ const path = `${(0, node_path_1.join)(dest, parseData.file.name)}.md`;
156
+ yield (0, mkdirp_1.mkdirp)(dest);
157
+ yield promises_1.default.writeFile(path, parseData.content, 'utf-8');
158
+ type = (parseData === null || parseData === void 0 ? void 0 : parseData.empty) ? constants_1.StatisticType.EMPTY : constants_1.StatisticType.INCLUDE;
262
159
  }
263
- });
264
- }); };
160
+ return Object.assign(Object.assign({}, parseData), { type });
161
+ }
162
+ catch (_a) { }
163
+ return null;
164
+ });
265
165
  exports.writeContentToFile = writeContentToFile;
package/dist/lib/utils.js CHANGED
@@ -12,9 +12,7 @@ exports.getFilename = exports.checkExtension = exports.getExtension = void 0;
12
12
  * @param {string} path
13
13
  * @returns {string} extension of file
14
14
  */
15
- var getExtension = function (path) {
16
- return path && typeof path === 'string' ? path.substring(path.length, path.lastIndexOf('.')) : '';
17
- };
15
+ const getExtension = (path) => path && typeof path === 'string' ? path.substring(path.length, path.lastIndexOf('.')) : '';
18
16
  exports.getExtension = getExtension;
19
17
  /**
20
18
  * Check if extension ist correct
@@ -22,7 +20,7 @@ exports.getExtension = getExtension;
22
20
  * @param {string[]} extensions
23
21
  * @returns {boolean}
24
22
  */
25
- var checkExtension = function (path, extensions) {
23
+ const checkExtension = (path, extensions) => {
26
24
  if (!extensions || !path || typeof path !== 'string')
27
25
  return false;
28
26
  return extensions.indexOf((0, exports.getExtension)(path)) >= 0;
@@ -33,11 +31,11 @@ exports.checkExtension = checkExtension;
33
31
  * @param {string} path
34
32
  * @returns {string} filename
35
33
  */
36
- var getFilename = function (path) {
34
+ const getFilename = (path) => {
37
35
  var _a;
38
36
  if (!path || (path && typeof path !== 'string'))
39
37
  return '';
40
- var splitted = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : path;
38
+ const splitted = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : path;
41
39
  return splitted.substring(0, splitted.lastIndexOf('.'));
42
40
  };
43
41
  exports.getFilename = getFilename;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Runs through the given tree structure and creates a vuepress config
3
- * @param {object} data Informations to build config
4
- * @param {array} data.fileTree tree strcture
3
+ * @param {object} data Information to build config
4
+ * @param {array} data.fileTree tree structure
5
5
  * @param {string} data.codeFolder ./code/ folder
6
6
  * @param {string} data.srcFolder ./src/ folder
7
7
  * @param {string} data.docsFolder ./documentation/ folder
8
8
  * @param {string} data.title title string
9
- * @returns {object} returns the vuepress menu strcture
9
+ * @returns {object} returns the vuepress menu structure
10
10
  */
11
11
  export declare const generateVueSidebar: ({ fileTree, codeFolder, srcFolder, docsFolder, title }: {
12
12
  fileTree: any;
@@ -16,8 +16,11 @@ export declare const generateVueSidebar: ({ fileTree, codeFolder, srcFolder, doc
16
16
  title: string;
17
17
  }) => {
18
18
  [x: string]: {
19
- title: string;
19
+ text: string;
20
20
  collapsable: boolean;
21
- children: string[][];
21
+ children: {
22
+ link: string;
23
+ text: string;
24
+ }[];
22
25
  }[];
23
26
  };
@@ -1,15 +1,4 @@
1
1
  "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
@@ -21,62 +10,50 @@ exports.generateVueSidebar = void 0;
21
10
  * headline: lib/vue-sidebar.ts
22
11
  * ---
23
12
  */
24
- var fs_1 = __importDefault(require("fs"));
25
- var path_1 = require("path");
13
+ const node_fs_1 = __importDefault(require("node:fs"));
14
+ const node_path_1 = require("node:path");
26
15
  /**
27
16
  * Runs through the given tree structure and creates a vuepress config
28
- * @param {object} data Informations to build config
29
- * @param {array} data.fileTree tree strcture
17
+ * @param {object} data Information to build config
18
+ * @param {array} data.fileTree tree structure
30
19
  * @param {string} data.codeFolder ./code/ folder
31
20
  * @param {string} data.srcFolder ./src/ folder
32
21
  * @param {string} data.docsFolder ./documentation/ folder
33
22
  * @param {string} data.title title string
34
- * @returns {object} returns the vuepress menu strcture
23
+ * @returns {object} returns the vuepress menu structure
35
24
  */
36
- var generateVueSidebar = function (_a) {
37
- var _b;
38
- var fileTree = _a.fileTree, codeFolder = _a.codeFolder, srcFolder = _a.srcFolder, docsFolder = _a.docsFolder, title = _a.title;
39
- var rootFiles = [['', '::vuepress-jsdoc-title::']];
40
- rootFiles = rootFiles.concat(fileTree.filter(function (file) { return !file.children; }).map(function (file) { return file.name; }));
41
- var rootFolder = fileTree.filter(function (file) { return file.children && file.children.length > 0; });
42
- var buildChildren = function (children, name, depth) {
43
- var e_1, _a;
44
- var newChildren = [];
45
- try {
46
- for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
47
- var child = children_1_1.value;
48
- if (child.children && child.children.length > 0) {
49
- newChildren = newChildren.concat(buildChildren(child.children, child.name, depth + 1));
50
- }
51
- else if (child.fullPath) {
52
- if (fs_1.default.existsSync((0, path_1.join)(docsFolder, child.fullPath.replace(srcFolder, '')) + '.md')) {
53
- newChildren.push(child.fullPath.replace("".concat(srcFolder, "/"), ''));
54
- }
55
- }
25
+ const generateVueSidebar = ({ fileTree, codeFolder, srcFolder, docsFolder, title }) => {
26
+ let rootFiles = [{ link: `/${codeFolder}/`, text: '::vuepress-jsdoc-title::' }];
27
+ rootFiles = rootFiles.concat(fileTree.filter((file) => !file.children).map((file) => `/${(0, node_path_1.join)(codeFolder, file.name)}`));
28
+ const rootFolder = fileTree.filter((file) => file.children && file.children.length > 0);
29
+ const buildChildren = (children, name, depth) => {
30
+ let newChildren = [];
31
+ for (const child of children) {
32
+ if (child.children && child.children.length > 0) {
33
+ newChildren = newChildren.concat(buildChildren(child.children, child.name, depth + 1));
56
34
  }
57
- }
58
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
59
- finally {
60
- try {
61
- if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
35
+ else if (child.fullPath) {
36
+ const path = child.fullPath.replace(srcFolder, '');
37
+ if (node_fs_1.default.existsSync(`${(0, node_path_1.join)(docsFolder, path)}.md`)) {
38
+ newChildren.push(`/${(0, node_path_1.join)(codeFolder, path)}`);
39
+ }
62
40
  }
63
- finally { if (e_1) throw e_1.error; }
64
41
  }
65
42
  return newChildren;
66
43
  };
67
- var tree = rootFolder.map(function (folder) { return ({
68
- title: folder.name,
44
+ const tree = rootFolder.map((folder) => ({
45
+ text: folder.name,
69
46
  collapsable: false,
70
47
  children: buildChildren(folder.children, folder.name, 0)
71
- }); });
72
- return _b = {},
73
- _b["/".concat(codeFolder, "/")] = [
48
+ }));
49
+ return {
50
+ [`/${codeFolder}/`]: [
74
51
  {
75
- title: title,
52
+ text: title,
76
53
  collapsable: false,
77
54
  children: rootFiles
78
55
  }
79
- ].concat(tree),
80
- _b;
56
+ ].concat(tree)
57
+ };
81
58
  };
82
59
  exports.generateVueSidebar = generateVueSidebar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-jsdoc",
3
- "version": "4.3.1",
3
+ "version": "5.0.0",
4
4
  "description": "Generate jsdoc markdown files for vuepress",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -14,8 +14,8 @@
14
14
  "prepare": "husky install",
15
15
  "version": "conventional-changelog -p karma -i CHANGELOG.md -s -r 0 && git add .",
16
16
  "docs": "./bin/vuepress-jsdoc.js --source=./dist --partials=./example/partials/*.hbs --readme ./README.md --include=\"**/*.(ts|js)\" --exclude=\"**/*.d.ts,**/interfaces.*,**/constants.*\"",
17
- "docs:dev": "npx concurrently --kill-others \"npm run dev\" \"npm run docs -- -w\" \"npx vuepress dev documentation\"",
18
- "docs:build": "npm run build && npm run docs && npx vuepress build documentation"
17
+ "docs:dev": "npx concurrently --kill-others \"npm run dev\" \"npm run docs -- -w\" \"vuepress dev documentation\"",
18
+ "docs:build": "npm run build && npm run docs && vuepress build documentation"
19
19
  },
20
20
  "keywords": [
21
21
  "jsdoc",
@@ -79,37 +79,39 @@
79
79
  "vuepress-jsdoc": "bin/vuepress-jsdoc.js"
80
80
  },
81
81
  "dependencies": {
82
- "chalk": "^4.1.2",
83
82
  "chokidar": "^3.5.3",
84
- "commander": "^9.4.1",
83
+ "commander": "^11.1.0",
85
84
  "del": "^6.0.0",
86
85
  "front-matter": "^4.0.2",
87
- "jsdoc-to-markdown": "^7.1.1",
86
+ "jsdoc-to-markdown": "^8.0.0",
87
+ "kleur": "^4.1.5",
88
88
  "micromatch": "^4.0.5",
89
- "mkdirp": "^1.0.4",
90
- "vue-docgen-cli": "^4.51.0"
89
+ "mkdirp": "^3.0.1",
90
+ "vue-docgen-cli": "^4.67.0"
91
91
  },
92
92
  "devDependencies": {
93
- "@types/jest": "^29.1.1",
94
- "@types/jsdoc-to-markdown": "^7.0.3",
95
- "@types/micromatch": "^4.0.2",
93
+ "@types/jest": "^29.5.10",
94
+ "@types/jsdoc-to-markdown": "^7.0.6",
95
+ "@types/micromatch": "^4.0.6",
96
96
  "@types/mkdirp": "^1.0.2",
97
- "@typescript-eslint/eslint-plugin": "^5.39.0",
98
- "@typescript-eslint/parser": "^5.39.0",
99
- "babel-jest": "^29.1.2",
97
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
98
+ "@typescript-eslint/parser": "^6.12.0",
99
+ "@vuepress/client": "^2.0.0-rc.0",
100
+ "babel-jest": "^29.7.0",
100
101
  "cross-env": "^7.0.3",
101
- "eslint": "^8.24.0",
102
- "eslint-config-prettier": "^8.5.0",
103
- "eslint-plugin-import": "^2.26.0",
104
- "eslint-plugin-jest": "^27.1.1",
102
+ "eslint": "^8.54.0",
103
+ "eslint-config-prettier": "^9.0.0",
104
+ "eslint-plugin-import": "^2.29.0",
105
+ "eslint-plugin-jest": "^27.6.0",
105
106
  "eslint-plugin-prefer-arrow": "^1.2.3",
106
- "husky": "^8.0.1",
107
- "jest": "^29.1.2",
108
- "lint-staged": "^13.0.3",
109
- "memfs": "^3.4.7",
110
- "ts-jest": "^29.0.3",
111
- "typescript": "^4.8.4",
112
- "vue": "^2.7.8"
107
+ "husky": "^8.0.3",
108
+ "jest": "^29.7.0",
109
+ "lint-staged": "^15.1.0",
110
+ "memfs": "^4.6.0",
111
+ "ts-jest": "^29.1.1",
112
+ "typescript": "^5.3.2",
113
+ "vue": "^3.3.8",
114
+ "vuepress": "^2.0.0-rc.0"
113
115
  },
114
116
  "lint-staged": {
115
117
  "src/**/*.{css,scss,json}": [