typedoc 0.25.13 → 0.26.0-beta.1
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/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/lib/application.d.ts +15 -3
- package/dist/lib/application.js +75 -24
- package/dist/lib/cli.js +1 -1
- package/dist/lib/converter/comments/blockLexer.d.ts +1 -1
- package/dist/lib/converter/comments/blockLexer.js +1 -2
- package/dist/lib/converter/comments/declarationReference.js +8 -8
- package/dist/lib/converter/comments/declarationReferenceResolver.d.ts +1 -1
- package/dist/lib/converter/comments/declarationReferenceResolver.js +15 -14
- package/dist/lib/converter/comments/discovery.d.ts +3 -3
- package/dist/lib/converter/comments/discovery.js +21 -19
- package/dist/lib/converter/comments/index.d.ts +1 -1
- package/dist/lib/converter/comments/index.js +35 -16
- package/dist/lib/converter/comments/lineLexer.d.ts +1 -1
- package/dist/lib/converter/comments/lineLexer.js +1 -2
- package/dist/lib/converter/comments/linkResolver.d.ts +2 -2
- package/dist/lib/converter/comments/linkResolver.js +5 -3
- package/dist/lib/converter/comments/parser.d.ts +14 -3
- package/dist/lib/converter/comments/parser.js +147 -39
- package/dist/lib/converter/comments/rawLexer.d.ts +7 -1
- package/dist/lib/converter/comments/rawLexer.js +21 -70
- package/dist/lib/converter/comments/tagName.js +1 -2
- package/dist/lib/converter/context.d.ts +7 -2
- package/dist/lib/converter/context.js +10 -2
- package/dist/lib/converter/convert-expression.js +2 -3
- package/dist/lib/converter/converter.d.ts +9 -4
- package/dist/lib/converter/converter.js +55 -17
- package/dist/lib/converter/factories/index-signature.d.ts +1 -1
- package/dist/lib/converter/factories/index-signature.js +9 -12
- package/dist/lib/converter/factories/signature.d.ts +1 -1
- package/dist/lib/converter/factories/signature.js +14 -15
- package/dist/lib/converter/jsdoc.js +2 -3
- package/dist/lib/converter/plugins/CategoryPlugin.d.ts +3 -3
- package/dist/lib/converter/plugins/CategoryPlugin.js +24 -17
- package/dist/lib/converter/plugins/CommentPlugin.d.ts +3 -1
- package/dist/lib/converter/plugins/CommentPlugin.js +112 -69
- package/dist/lib/converter/plugins/GroupPlugin.d.ts +4 -4
- package/dist/lib/converter/plugins/GroupPlugin.js +52 -18
- package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -3
- package/dist/lib/converter/plugins/InheritDocPlugin.d.ts +1 -1
- package/dist/lib/converter/plugins/InheritDocPlugin.js +5 -6
- package/dist/lib/converter/plugins/LinkResolverPlugin.d.ts +2 -2
- package/dist/lib/converter/plugins/PackagePlugin.d.ts +0 -2
- package/dist/lib/converter/plugins/PackagePlugin.js +8 -30
- package/dist/lib/converter/plugins/SourcePlugin.js +2 -2
- package/dist/lib/converter/symbols.js +6 -11
- package/dist/lib/converter/types.d.ts +1 -1
- package/dist/lib/converter/types.js +4 -5
- package/dist/lib/converter/utils/nodes.js +3 -4
- package/dist/lib/converter/utils/reflections.d.ts +1 -1
- package/dist/lib/converter/utils/reflections.js +1 -2
- package/dist/lib/converter/utils/repository.js +4 -4
- package/dist/lib/converter/utils/symbols.js +1 -2
- package/dist/lib/internationalization/index.d.ts +7 -0
- package/dist/lib/internationalization/index.js +11 -0
- package/dist/lib/internationalization/internationalization.d.ts +92 -0
- package/dist/lib/internationalization/internationalization.js +194 -0
- package/dist/lib/internationalization/locales/en.cjs +3 -0
- package/dist/lib/internationalization/locales/en.d.cts +2 -0
- package/dist/lib/internationalization/locales/test.cjs +8 -0
- package/dist/lib/internationalization/locales/test.d.cts +5 -0
- package/dist/lib/internationalization/translatable.d.ts +304 -0
- package/dist/lib/internationalization/translatable.js +329 -0
- package/dist/lib/models/ReflectionCategory.d.ts +2 -2
- package/dist/lib/models/ReflectionGroup.d.ts +2 -2
- package/dist/lib/models/comments/comment.d.ts +17 -3
- package/dist/lib/models/comments/comment.js +377 -298
- package/dist/lib/models/reflections/ReflectionSymbolId.js +2 -2
- package/dist/lib/models/reflections/abstract.d.ts +11 -8
- package/dist/lib/models/reflections/abstract.js +17 -11
- package/dist/lib/models/reflections/container.d.ts +25 -3
- package/dist/lib/models/reflections/container.js +64 -0
- package/dist/lib/models/reflections/declaration.d.ts +3 -15
- package/dist/lib/models/reflections/declaration.js +16 -21
- package/dist/lib/models/reflections/document.d.ts +27 -0
- package/dist/lib/models/reflections/document.js +43 -0
- package/dist/lib/models/reflections/index.d.ts +4 -3
- package/dist/lib/models/reflections/index.js +5 -4
- package/dist/lib/models/reflections/kind.d.ts +14 -1
- package/dist/lib/models/reflections/kind.js +13 -0
- package/dist/lib/models/reflections/parameter.d.ts +1 -1
- package/dist/lib/models/reflections/project.d.ts +2 -2
- package/dist/lib/models/reflections/project.js +8 -7
- package/dist/lib/models/reflections/signature.d.ts +2 -2
- package/dist/lib/models/reflections/type-parameter.d.ts +1 -1
- package/dist/lib/models/reflections/utils.js +1 -2
- package/dist/lib/models/reflections/variant.d.ts +2 -0
- package/dist/lib/models/types.d.ts +4 -4
- package/dist/lib/models/types.js +3 -3
- package/dist/lib/output/events.d.ts +5 -5
- package/dist/lib/output/events.js +2 -1
- package/dist/lib/output/index.d.ts +1 -1
- package/dist/lib/output/index.js +2 -1
- package/dist/lib/output/plugins/AssetsPlugin.js +1 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +3 -1
- package/dist/lib/output/plugins/JavascriptIndexPlugin.js +28 -8
- package/dist/lib/output/plugins/SitemapPlugin.d.ts +1 -1
- package/dist/lib/output/plugins/SitemapPlugin.js +17 -27
- package/dist/lib/output/renderer.d.ts +3 -1
- package/dist/lib/output/renderer.js +7 -7
- package/dist/lib/output/themes/MarkedPlugin.d.ts +16 -25
- package/dist/lib/output/themes/MarkedPlugin.js +89 -161
- package/dist/lib/output/themes/default/DefaultTheme.d.ts +16 -4
- package/dist/lib/output/themes/default/DefaultTheme.js +66 -17
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +44 -44
- package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +6 -13
- package/dist/lib/output/themes/default/layouts/default.js +2 -2
- package/dist/lib/output/themes/default/partials/analytics.js +1 -2
- package/dist/lib/output/themes/default/partials/anchor-icon.js +2 -3
- package/dist/lib/output/themes/default/partials/comment.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/comment.js +3 -4
- package/dist/lib/output/themes/default/partials/footer.js +31 -5
- package/dist/lib/output/themes/default/partials/header.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/header.js +4 -3
- package/dist/lib/output/themes/default/partials/hierarchy.js +3 -4
- package/dist/lib/output/themes/default/partials/icon.js +7 -2
- package/dist/lib/output/themes/default/partials/index.js +4 -4
- package/dist/lib/output/themes/default/partials/member.d.ts +2 -2
- package/dist/lib/output/themes/default/partials/member.declaration.js +2 -3
- package/dist/lib/output/themes/default/partials/member.js +13 -2
- package/dist/lib/output/themes/default/partials/member.reference.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.reference.js +9 -6
- package/dist/lib/output/themes/default/partials/member.signature.body.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.body.js +4 -4
- package/dist/lib/output/themes/default/partials/member.signature.title.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/member.signature.title.js +1 -2
- package/dist/lib/output/themes/default/partials/member.sources.js +12 -6
- package/dist/lib/output/themes/default/partials/members.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/members.group.js +1 -2
- package/dist/lib/output/themes/default/partials/members.js +1 -2
- package/dist/lib/output/themes/default/partials/navigation.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/navigation.js +19 -17
- package/dist/lib/output/themes/default/partials/parameter.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/parameter.js +15 -15
- package/dist/lib/output/themes/default/partials/reflectionPreview.js +1 -2
- package/dist/lib/output/themes/default/partials/toolbar.js +4 -4
- package/dist/lib/output/themes/default/partials/type.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/type.js +14 -14
- package/dist/lib/output/themes/default/partials/typeAndParent.d.ts +1 -1
- package/dist/lib/output/themes/default/partials/typeParameters.js +2 -3
- package/dist/lib/output/themes/default/templates/document.d.ts +5 -0
- package/dist/lib/output/themes/default/templates/document.js +7 -0
- package/dist/lib/output/themes/default/templates/hierarchy.js +1 -2
- package/dist/lib/output/themes/default/templates/reflection.d.ts +1 -1
- package/dist/lib/output/themes/default/templates/reflection.js +21 -19
- package/dist/lib/output/themes/lib.d.ts +1 -1
- package/dist/lib/output/themes/lib.js +12 -16
- package/dist/lib/serialization/deserializer.d.ts +3 -3
- package/dist/lib/serialization/deserializer.js +7 -5
- package/dist/lib/serialization/schema.d.ts +10 -3
- package/dist/lib/utils/array.js +9 -10
- package/dist/lib/utils/component.d.ts +1 -1
- package/dist/lib/utils/component.js +2 -2
- package/dist/lib/utils/entry-point.d.ts +11 -0
- package/dist/lib/utils/entry-point.js +51 -24
- package/dist/lib/utils/enum.js +6 -7
- package/dist/lib/utils/fs.js +15 -16
- package/dist/lib/utils/general.d.ts +4 -3
- package/dist/lib/utils/general.js +4 -5
- package/dist/lib/utils/highlighter.d.ts +4 -2
- package/dist/lib/utils/highlighter.js +41 -40
- package/dist/lib/utils/html.js +2 -3
- package/dist/lib/utils/index.d.ts +1 -1
- package/dist/lib/utils/index.js +1 -2
- package/dist/lib/utils/jsx.elements.d.ts +13 -1
- package/dist/lib/utils/jsx.js +4 -4
- package/dist/lib/utils/loggers.d.ts +13 -7
- package/dist/lib/utils/loggers.js +13 -10
- package/dist/lib/utils/map.d.ts +1 -1
- package/dist/lib/utils/map.js +1 -1
- package/dist/lib/utils/options/declaration.d.ts +48 -21
- package/dist/lib/utils/options/declaration.js +36 -36
- package/dist/lib/utils/options/help.d.ts +2 -1
- package/dist/lib/utils/options/help.js +10 -10
- package/dist/lib/utils/options/index.d.ts +1 -1
- package/dist/lib/utils/options/index.js +1 -2
- package/dist/lib/utils/options/options.d.ts +5 -34
- package/dist/lib/utils/options/options.js +13 -23
- package/dist/lib/utils/options/readers/arguments.js +3 -5
- package/dist/lib/utils/options/readers/package-json.js +2 -2
- package/dist/lib/utils/options/readers/tsconfig.js +8 -12
- package/dist/lib/utils/options/readers/typedoc.d.ts +1 -1
- package/dist/lib/utils/options/readers/typedoc.js +8 -7
- package/dist/lib/utils/options/sources/typedoc.js +225 -178
- package/dist/lib/utils/options/tsdoc-defaults.d.ts +4 -4
- package/dist/lib/utils/options/tsdoc-defaults.js +27 -20
- package/dist/lib/utils/package-manifest.d.ts +1 -1
- package/dist/lib/utils/package-manifest.js +9 -11
- package/dist/lib/utils/paths.js +4 -5
- package/dist/lib/utils/perf.js +3 -4
- package/dist/lib/utils/plugins.js +4 -5
- package/dist/lib/utils/reflections.d.ts +1 -1
- package/dist/lib/utils/reflections.js +2 -3
- package/dist/lib/utils/set.d.ts +1 -0
- package/dist/lib/utils/set.js +12 -0
- package/dist/lib/utils/sort.d.ts +3 -2
- package/dist/lib/utils/sort.js +37 -6
- package/dist/lib/utils/tsconfig.js +3 -4
- package/dist/lib/utils/tsutils.js +2 -3
- package/dist/lib/utils/validation.js +4 -4
- package/dist/lib/validation/documentation.d.ts +1 -1
- package/dist/lib/validation/documentation.js +9 -4
- package/dist/lib/validation/exports.js +3 -5
- package/dist/lib/validation/links.js +2 -3
- package/package.json +12 -11
- package/static/main.js +4 -4
- package/static/style.css +46 -29
- package/tsdoc.json +22 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ParameterType = exports.ParameterHint = exports.CommentStyle = exports.EmitStrategy = void 0;
|
|
4
|
+
exports.convert = convert;
|
|
5
|
+
exports.getDefaultValue = getDefaultValue;
|
|
4
6
|
const path_1 = require("path");
|
|
5
7
|
/** @enum */
|
|
6
8
|
exports.EmitStrategy = {
|
|
@@ -57,28 +59,28 @@ var ParameterType;
|
|
|
57
59
|
ParameterType[ParameterType["Flags"] = 11] = "Flags";
|
|
58
60
|
})(ParameterType || (exports.ParameterType = ParameterType = {}));
|
|
59
61
|
const converters = {
|
|
60
|
-
[ParameterType.String](value, option) {
|
|
62
|
+
[ParameterType.String](value, option, i18n) {
|
|
61
63
|
const stringValue = value == null ? "" : String(value);
|
|
62
|
-
option.validate?.(stringValue);
|
|
64
|
+
option.validate?.(stringValue, i18n);
|
|
63
65
|
return stringValue;
|
|
64
66
|
},
|
|
65
|
-
[ParameterType.Path](value, option, configPath) {
|
|
67
|
+
[ParameterType.Path](value, option, i18n, configPath) {
|
|
66
68
|
const stringValue = value == null ? "" : (0, path_1.resolve)(configPath, String(value));
|
|
67
|
-
option.validate?.(stringValue);
|
|
69
|
+
option.validate?.(stringValue, i18n);
|
|
68
70
|
return stringValue;
|
|
69
71
|
},
|
|
70
|
-
[ParameterType.Number](value, option) {
|
|
72
|
+
[ParameterType.Number](value, option, i18n) {
|
|
71
73
|
const numValue = parseInt(String(value), 10) || 0;
|
|
72
74
|
if (!valueIsWithinBounds(numValue, option.minValue, option.maxValue)) {
|
|
73
|
-
throw new Error(getBoundsError(option.name, option.minValue, option.maxValue));
|
|
75
|
+
throw new Error(getBoundsError(option.name, i18n, option.minValue, option.maxValue));
|
|
74
76
|
}
|
|
75
|
-
option.validate?.(numValue);
|
|
77
|
+
option.validate?.(numValue, i18n);
|
|
76
78
|
return numValue;
|
|
77
79
|
},
|
|
78
80
|
[ParameterType.Boolean](value) {
|
|
79
81
|
return !!value;
|
|
80
82
|
},
|
|
81
|
-
[ParameterType.Array](value, option) {
|
|
83
|
+
[ParameterType.Array](value, option, i18n) {
|
|
82
84
|
let strArrValue = new Array();
|
|
83
85
|
if (Array.isArray(value)) {
|
|
84
86
|
strArrValue = value.map(String);
|
|
@@ -86,10 +88,10 @@ const converters = {
|
|
|
86
88
|
else if (typeof value === "string") {
|
|
87
89
|
strArrValue = [value];
|
|
88
90
|
}
|
|
89
|
-
option.validate?.(strArrValue);
|
|
91
|
+
option.validate?.(strArrValue, i18n);
|
|
90
92
|
return strArrValue;
|
|
91
93
|
},
|
|
92
|
-
[ParameterType.PathArray](value, option, configPath) {
|
|
94
|
+
[ParameterType.PathArray](value, option, i18n, configPath) {
|
|
93
95
|
let strArrValue = new Array();
|
|
94
96
|
if (Array.isArray(value)) {
|
|
95
97
|
strArrValue = value.map(String);
|
|
@@ -98,10 +100,10 @@ const converters = {
|
|
|
98
100
|
strArrValue = [value];
|
|
99
101
|
}
|
|
100
102
|
strArrValue = strArrValue.map((path) => (0, path_1.resolve)(configPath, path));
|
|
101
|
-
option.validate?.(strArrValue);
|
|
103
|
+
option.validate?.(strArrValue, i18n);
|
|
102
104
|
return strArrValue;
|
|
103
105
|
},
|
|
104
|
-
[ParameterType.ModuleArray](value, option, configPath) {
|
|
106
|
+
[ParameterType.ModuleArray](value, option, i18n, configPath) {
|
|
105
107
|
let strArrValue = new Array();
|
|
106
108
|
if (Array.isArray(value)) {
|
|
107
109
|
strArrValue = value.map(String);
|
|
@@ -110,10 +112,10 @@ const converters = {
|
|
|
110
112
|
strArrValue = [value];
|
|
111
113
|
}
|
|
112
114
|
strArrValue = resolveModulePaths(strArrValue, configPath);
|
|
113
|
-
option.validate?.(strArrValue);
|
|
115
|
+
option.validate?.(strArrValue, i18n);
|
|
114
116
|
return strArrValue;
|
|
115
117
|
},
|
|
116
|
-
[ParameterType.GlobArray](value, option, configPath) {
|
|
118
|
+
[ParameterType.GlobArray](value, option, i18n, configPath) {
|
|
117
119
|
let strArrValue = new Array();
|
|
118
120
|
if (Array.isArray(value)) {
|
|
119
121
|
strArrValue = value.map(String);
|
|
@@ -122,10 +124,10 @@ const converters = {
|
|
|
122
124
|
strArrValue = [value];
|
|
123
125
|
}
|
|
124
126
|
strArrValue = resolveGlobPaths(strArrValue, configPath);
|
|
125
|
-
option.validate?.(strArrValue);
|
|
127
|
+
option.validate?.(strArrValue, i18n);
|
|
126
128
|
return strArrValue;
|
|
127
129
|
},
|
|
128
|
-
[ParameterType.Map](value, option) {
|
|
130
|
+
[ParameterType.Map](value, option, i18n) {
|
|
129
131
|
const key = String(value);
|
|
130
132
|
if (option.map instanceof Map) {
|
|
131
133
|
if (option.map.has(key)) {
|
|
@@ -144,29 +146,29 @@ const converters = {
|
|
|
144
146
|
else if (Object.values(option.map).includes(value)) {
|
|
145
147
|
return value;
|
|
146
148
|
}
|
|
147
|
-
throw new Error(
|
|
149
|
+
throw new Error(getMapError(option.map, i18n, option.name));
|
|
148
150
|
},
|
|
149
|
-
[ParameterType.Mixed](value, option) {
|
|
150
|
-
option.validate?.(value);
|
|
151
|
+
[ParameterType.Mixed](value, option, i18n) {
|
|
152
|
+
option.validate?.(value, i18n);
|
|
151
153
|
return value;
|
|
152
154
|
},
|
|
153
|
-
[ParameterType.Object](value, option, _configPath, oldValue) {
|
|
154
|
-
option.validate?.(value);
|
|
155
|
+
[ParameterType.Object](value, option, i18n, _configPath, oldValue) {
|
|
156
|
+
option.validate?.(value, i18n);
|
|
155
157
|
if (typeof oldValue !== "undefined")
|
|
156
158
|
value = { ...oldValue, ...value };
|
|
157
159
|
return value;
|
|
158
160
|
},
|
|
159
|
-
[ParameterType.Flags](value, option) {
|
|
161
|
+
[ParameterType.Flags](value, option, i18n) {
|
|
160
162
|
if (typeof value === "boolean") {
|
|
161
163
|
value = Object.fromEntries(Object.keys(option.defaults).map((key) => [key, value]));
|
|
162
164
|
}
|
|
163
165
|
if (typeof value !== "object" || value == null) {
|
|
164
|
-
throw new Error(
|
|
166
|
+
throw new Error(i18n.expected_object_with_flag_values_for_0(option.name));
|
|
165
167
|
}
|
|
166
168
|
const obj = { ...value };
|
|
167
169
|
for (const key of Object.keys(obj)) {
|
|
168
170
|
if (!Object.prototype.hasOwnProperty.call(option.defaults, key)) {
|
|
169
|
-
throw new Error(
|
|
171
|
+
throw new Error(i18n.flag_0_is_not_valid_for_1_expected_2(key, option.name, Object.keys(option.defaults).join(", ")));
|
|
170
172
|
}
|
|
171
173
|
if (typeof obj[key] !== "boolean") {
|
|
172
174
|
// Explicit null/undefined, switch to default.
|
|
@@ -174,7 +176,7 @@ const converters = {
|
|
|
174
176
|
obj[key] = option.defaults[key];
|
|
175
177
|
}
|
|
176
178
|
else {
|
|
177
|
-
throw new Error(
|
|
179
|
+
throw new Error(i18n.flag_values_for_0_must_be_booleans(option.name));
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -189,11 +191,10 @@ const converters = {
|
|
|
189
191
|
* @param option The option for which the value should be converted.
|
|
190
192
|
* @returns The result of the conversion. Might be the value or an error.
|
|
191
193
|
*/
|
|
192
|
-
function convert(value, option, configPath, oldValue) {
|
|
194
|
+
function convert(value, option, i18n, configPath, oldValue) {
|
|
193
195
|
const _converters = converters;
|
|
194
|
-
return _converters[option.type ?? ParameterType.String](value, option, configPath, oldValue);
|
|
196
|
+
return _converters[option.type ?? ParameterType.String](value, option, i18n, configPath, oldValue);
|
|
195
197
|
}
|
|
196
|
-
exports.convert = convert;
|
|
197
198
|
const defaultGetters = {
|
|
198
199
|
[ParameterType.String](option) {
|
|
199
200
|
return option.defaultValue ?? "";
|
|
@@ -242,7 +243,6 @@ function getDefaultValue(option) {
|
|
|
242
243
|
const getters = defaultGetters;
|
|
243
244
|
return getters[option.type ?? ParameterType.String](option);
|
|
244
245
|
}
|
|
245
|
-
exports.getDefaultValue = getDefaultValue;
|
|
246
246
|
function resolveGlobPaths(globs, configPath) {
|
|
247
247
|
return globs.map((path) => {
|
|
248
248
|
const start = path.match(/^[!#]+/)?.[0] ?? "";
|
|
@@ -270,7 +270,7 @@ function isTsNumericEnum(map) {
|
|
|
270
270
|
* @param name The name of the option.
|
|
271
271
|
* @returns The error message.
|
|
272
272
|
*/
|
|
273
|
-
function getMapError(map, name) {
|
|
273
|
+
function getMapError(map, i18n, name) {
|
|
274
274
|
let keys = map instanceof Map ? [...map.keys()] : Object.keys(map);
|
|
275
275
|
// If the map is a TS numeric enum we need to filter out the numeric keys.
|
|
276
276
|
// TS numeric enums have the property that every key maps to a value, which maps back to that key.
|
|
@@ -278,7 +278,7 @@ function getMapError(map, name) {
|
|
|
278
278
|
// This works because TS enum keys may not be numeric.
|
|
279
279
|
keys = keys.filter((key) => Number.isNaN(parseInt(key, 10)));
|
|
280
280
|
}
|
|
281
|
-
return
|
|
281
|
+
return i18n.option_0_must_be_one_of_1(name, keys.join(", "));
|
|
282
282
|
}
|
|
283
283
|
/**
|
|
284
284
|
* Returns an error message for a value that is out of bounds of the given min and/or max values.
|
|
@@ -287,15 +287,15 @@ function getMapError(map, name) {
|
|
|
287
287
|
* @param maxValue The upper bound of the range of allowed values.
|
|
288
288
|
* @returns The error message.
|
|
289
289
|
*/
|
|
290
|
-
function getBoundsError(name, minValue, maxValue) {
|
|
290
|
+
function getBoundsError(name, i18n, minValue, maxValue) {
|
|
291
291
|
if (isFiniteNumber(minValue) && isFiniteNumber(maxValue)) {
|
|
292
|
-
return
|
|
292
|
+
return i18n.option_0_must_be_between_1_and_2(name, String(minValue), String(maxValue));
|
|
293
293
|
}
|
|
294
294
|
else if (isFiniteNumber(minValue)) {
|
|
295
|
-
return
|
|
295
|
+
return i18n.option_0_must_be_equal_to_or_greater_than_1(name, String(minValue));
|
|
296
296
|
}
|
|
297
297
|
else {
|
|
298
|
-
return
|
|
298
|
+
return i18n.option_0_must_be_less_than_or_equal_to_1(name, String(maxValue));
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
/**
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Options } from "./options";
|
|
2
|
+
import type { TranslationProxy } from "../../internationalization/internationalization";
|
|
2
3
|
export interface ParameterHelp {
|
|
3
4
|
names: string[];
|
|
4
5
|
helps: string[];
|
|
5
6
|
margin: number;
|
|
6
7
|
}
|
|
7
|
-
export declare function getOptionsHelp(options: Options): string;
|
|
8
|
+
export declare function getOptionsHelp(options: Options, i18n: TranslationProxy): string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getOptionsHelp =
|
|
3
|
+
exports.getOptionsHelp = getOptionsHelp;
|
|
4
4
|
const declaration_1 = require("./declaration");
|
|
5
5
|
const highlighter_1 = require("../highlighter");
|
|
6
|
-
const shiki_1 = require("shiki");
|
|
7
6
|
function hasHint(parameter) {
|
|
8
7
|
return ((parameter.type ?? declaration_1.ParameterType.String) === declaration_1.ParameterType.String &&
|
|
9
8
|
"hint" in parameter);
|
|
@@ -14,7 +13,7 @@ function hasHint(parameter) {
|
|
|
14
13
|
* @param scope The scope of the parameters whose help should be returned.
|
|
15
14
|
* @returns The columns and lines for the help of the requested parameters.
|
|
16
15
|
*/
|
|
17
|
-
function getParameterHelp(options) {
|
|
16
|
+
function getParameterHelp(options, i18n) {
|
|
18
17
|
const parameters = options.getDeclarations();
|
|
19
18
|
parameters.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: "base" }));
|
|
20
19
|
const names = [];
|
|
@@ -29,14 +28,16 @@ function getParameterHelp(options) {
|
|
|
29
28
|
name += " " + declaration_1.ParameterHint[parameter.hint].toUpperCase();
|
|
30
29
|
}
|
|
31
30
|
names.push(name);
|
|
32
|
-
helps.push(parameter.help
|
|
31
|
+
helps.push(typeof parameter.help === "string"
|
|
32
|
+
? parameter.help
|
|
33
|
+
: parameter.help(i18n));
|
|
33
34
|
margin = Math.max(name.length, margin);
|
|
34
35
|
}
|
|
35
36
|
return { names, helps, margin };
|
|
36
37
|
}
|
|
37
38
|
function toEvenColumns(values, maxLineWidth) {
|
|
38
39
|
const columnWidth = values.reduce((acc, val) => Math.max(acc, val.length), 0) + 2;
|
|
39
|
-
const numColumns = Math.max(1, Math.
|
|
40
|
+
const numColumns = Math.max(1, Math.floor(maxLineWidth / columnWidth));
|
|
40
41
|
let line = "";
|
|
41
42
|
const out = [];
|
|
42
43
|
for (let i = 0; i < values.length; ++i) {
|
|
@@ -51,16 +52,15 @@ function toEvenColumns(values, maxLineWidth) {
|
|
|
51
52
|
}
|
|
52
53
|
return out;
|
|
53
54
|
}
|
|
54
|
-
function getOptionsHelp(options) {
|
|
55
|
-
const output = ["
|
|
56
|
-
const columns = getParameterHelp(options);
|
|
55
|
+
function getOptionsHelp(options, i18n) {
|
|
56
|
+
const output = ["typedoc path/to/entry.ts", "", "Options:"];
|
|
57
|
+
const columns = getParameterHelp(options, i18n);
|
|
57
58
|
for (let i = 0; i < columns.names.length; i++) {
|
|
58
59
|
const usage = columns.names[i];
|
|
59
60
|
const description = columns.helps[i];
|
|
60
61
|
output.push(usage.padEnd(columns.margin + 2) + description);
|
|
61
62
|
}
|
|
62
63
|
output.push("", "Supported highlighting languages:", ...toEvenColumns((0, highlighter_1.getSupportedLanguages)(), 80));
|
|
63
|
-
output.push("", "Supported highlighting themes:", ...toEvenColumns(
|
|
64
|
+
output.push("", "Supported highlighting themes:", ...toEvenColumns((0, highlighter_1.getSupportedThemes)(), 80));
|
|
64
65
|
return output.join("\n");
|
|
65
66
|
}
|
|
66
|
-
exports.getOptionsHelp = getOptionsHelp;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Options, Option
|
|
1
|
+
export { Options, Option } from "./options";
|
|
2
2
|
export type { OptionsReader } from "./options";
|
|
3
3
|
export { ArgumentsReader, PackageJsonReader, TypeDocReader, TSConfigReader, } from "./readers";
|
|
4
4
|
export { CommentStyle, EmitStrategy, ParameterType, ParameterHint, } from "./declaration";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.
|
|
3
|
+
exports.ParameterHint = exports.ParameterType = exports.EmitStrategy = exports.CommentStyle = exports.TSConfigReader = exports.TypeDocReader = exports.PackageJsonReader = exports.ArgumentsReader = exports.Option = exports.Options = void 0;
|
|
4
4
|
var options_1 = require("./options");
|
|
5
5
|
Object.defineProperty(exports, "Options", { enumerable: true, get: function () { return options_1.Options; } });
|
|
6
6
|
Object.defineProperty(exports, "Option", { enumerable: true, get: function () { return options_1.Option; } });
|
|
7
|
-
Object.defineProperty(exports, "BindOption", { enumerable: true, get: function () { return options_1.BindOption; } });
|
|
8
7
|
var readers_1 = require("./readers");
|
|
9
8
|
Object.defineProperty(exports, "ArgumentsReader", { enumerable: true, get: function () { return readers_1.ArgumentsReader; } });
|
|
10
9
|
Object.defineProperty(exports, "PackageJsonReader", { enumerable: true, get: function () { return readers_1.PackageJsonReader; } });
|
|
@@ -2,7 +2,8 @@ import type * as ts from "typescript";
|
|
|
2
2
|
import type { NeverIfInternal } from "..";
|
|
3
3
|
import type { Application } from "../../..";
|
|
4
4
|
import type { Logger } from "../loggers";
|
|
5
|
-
import { DeclarationOption, KeyToDeclaration, TypeDocOptionMap, TypeDocOptions, TypeDocOptionValues } from "./declaration";
|
|
5
|
+
import { type DeclarationOption, type KeyToDeclaration, type TypeDocOptionMap, type TypeDocOptions, type TypeDocOptionValues } from "./declaration";
|
|
6
|
+
import type { TranslationProxy } from "../../internationalization/internationalization";
|
|
6
7
|
/**
|
|
7
8
|
* Describes an option reader that discovers user configuration and converts it to the
|
|
8
9
|
* TypeDoc format.
|
|
@@ -68,11 +69,12 @@ export declare class Options {
|
|
|
68
69
|
private _compilerOptions;
|
|
69
70
|
private _fileNames;
|
|
70
71
|
private _projectReferences;
|
|
72
|
+
private _i18n;
|
|
71
73
|
/**
|
|
72
74
|
* In packages mode, the directory of the package being converted.
|
|
73
75
|
*/
|
|
74
76
|
packageDir?: string;
|
|
75
|
-
constructor();
|
|
77
|
+
constructor(i18n: TranslationProxy);
|
|
76
78
|
/**
|
|
77
79
|
* Clones the options, intended for use in packages mode.
|
|
78
80
|
*/
|
|
@@ -183,7 +185,7 @@ export declare class Options {
|
|
|
183
185
|
/**
|
|
184
186
|
* Get the help message to be displayed to the user if `--help` is passed.
|
|
185
187
|
*/
|
|
186
|
-
getHelp(): string;
|
|
188
|
+
getHelp(i18n: TranslationProxy): string;
|
|
187
189
|
}
|
|
188
190
|
/**
|
|
189
191
|
* Binds an option to an accessor. Does not register the option.
|
|
@@ -202,34 +204,3 @@ export declare function Option<K extends keyof TypeDocOptionMap>(name: K): (_: u
|
|
|
202
204
|
}): TypeDocOptionValues[K];
|
|
203
205
|
set(_value: never): never;
|
|
204
206
|
};
|
|
205
|
-
/**
|
|
206
|
-
* Binds an option to the given property. Does not register the option.
|
|
207
|
-
*
|
|
208
|
-
* Note: This is a legacy experimental decorator, and will not work with TS 5.0 decorators
|
|
209
|
-
*
|
|
210
|
-
* @since v0.16.3
|
|
211
|
-
* @deprecated Will be removed in 0.26, use {@link Option | `@Option`} instead.
|
|
212
|
-
*/
|
|
213
|
-
export declare function BindOption<K extends keyof TypeDocOptionMap>(name: K): <IK extends PropertyKey>(target: ({
|
|
214
|
-
application: Application;
|
|
215
|
-
} | {
|
|
216
|
-
options: Options;
|
|
217
|
-
}) & {
|
|
218
|
-
[K2 in IK]: TypeDocOptionValues[K];
|
|
219
|
-
}, key: IK) => void;
|
|
220
|
-
/**
|
|
221
|
-
* Binds an option to the given property. Does not register the option.
|
|
222
|
-
*
|
|
223
|
-
* Note: This is a legacy experimental decorator, and will not work with TS 5.0 decorators
|
|
224
|
-
*
|
|
225
|
-
* @since v0.16.3
|
|
226
|
-
* @deprecated Will be removed in 0.26, use {@link Option | `@Option`} instead
|
|
227
|
-
*
|
|
228
|
-
* @privateRemarks
|
|
229
|
-
* This overload is intended for plugin use only with looser type checks. Do not use internally.
|
|
230
|
-
*/
|
|
231
|
-
export declare function BindOption(name: NeverIfInternal<string>): (target: {
|
|
232
|
-
application: Application;
|
|
233
|
-
} | {
|
|
234
|
-
options: Options;
|
|
235
|
-
}, key: PropertyKey) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Options = void 0;
|
|
4
|
+
exports.Option = Option;
|
|
4
5
|
const declaration_1 = require("./declaration");
|
|
5
6
|
const array_1 = require("../array");
|
|
6
7
|
const declaration_2 = require("./declaration");
|
|
@@ -28,7 +29,7 @@ const optionSnapshots = new WeakMap();
|
|
|
28
29
|
* files.
|
|
29
30
|
*/
|
|
30
31
|
class Options {
|
|
31
|
-
constructor() {
|
|
32
|
+
constructor(i18n) {
|
|
32
33
|
this._readers = [];
|
|
33
34
|
this._declarations = new Map();
|
|
34
35
|
this._values = {};
|
|
@@ -36,17 +37,21 @@ class Options {
|
|
|
36
37
|
this._compilerOptions = {};
|
|
37
38
|
this._fileNames = [];
|
|
38
39
|
this._projectReferences = [];
|
|
40
|
+
this._i18n = i18n;
|
|
39
41
|
(0, sources_1.addTypeDocOptions)(this);
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* Clones the options, intended for use in packages mode.
|
|
43
45
|
*/
|
|
44
46
|
copyForPackage(packageDir) {
|
|
45
|
-
const options = new Options();
|
|
47
|
+
const options = new Options(this._i18n);
|
|
46
48
|
options.packageDir = packageDir;
|
|
47
49
|
options._readers = this._readers.filter((reader) => reader.supportsPackages);
|
|
48
50
|
options._declarations = new Map(this._declarations);
|
|
49
51
|
options.reset();
|
|
52
|
+
for (const [key, val] of Object.entries(this.getValue("packageOptions"))) {
|
|
53
|
+
options.setValue(key, val, packageDir);
|
|
54
|
+
}
|
|
50
55
|
return options;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
@@ -152,7 +157,7 @@ class Options {
|
|
|
152
157
|
const declaration = this.getDeclaration(name);
|
|
153
158
|
if (!declaration) {
|
|
154
159
|
const nearNames = this.getSimilarOptions(name);
|
|
155
|
-
throw new Error(
|
|
160
|
+
throw new Error(this._i18n.unknown_option_0_you_may_have_meant_1(name, nearNames.join("\n\t")));
|
|
156
161
|
}
|
|
157
162
|
return this._values[declaration.name];
|
|
158
163
|
}
|
|
@@ -163,12 +168,12 @@ class Options {
|
|
|
163
168
|
const declaration = this.getDeclaration(name);
|
|
164
169
|
if (!declaration) {
|
|
165
170
|
const nearNames = this.getSimilarOptions(name);
|
|
166
|
-
throw new Error(
|
|
171
|
+
throw new Error(this._i18n.unknown_option_0_you_may_have_meant_1(name, nearNames.join("\n\t")));
|
|
167
172
|
}
|
|
168
173
|
let oldValue = this._values[declaration.name];
|
|
169
174
|
if (typeof oldValue === "undefined")
|
|
170
175
|
oldValue = (0, declaration_2.getDefaultValue)(declaration);
|
|
171
|
-
const converted = (0, declaration_2.convert)(value, declaration, configPath ?? process.cwd(), oldValue);
|
|
176
|
+
const converted = (0, declaration_2.convert)(value, declaration, this._i18n, configPath ?? process.cwd(), oldValue);
|
|
172
177
|
if (declaration.type === declaration_1.ParameterType.Flags) {
|
|
173
178
|
Object.assign(this._values[declaration.name], converted);
|
|
174
179
|
}
|
|
@@ -246,8 +251,8 @@ class Options {
|
|
|
246
251
|
/**
|
|
247
252
|
* Get the help message to be displayed to the user if `--help` is passed.
|
|
248
253
|
*/
|
|
249
|
-
getHelp() {
|
|
250
|
-
return (0, help_1.getOptionsHelp)(this);
|
|
254
|
+
getHelp(i18n) {
|
|
255
|
+
return (0, help_1.getOptionsHelp)(this, i18n);
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
258
|
exports.Options = Options;
|
|
@@ -270,21 +275,6 @@ function Option(name) {
|
|
|
270
275
|
};
|
|
271
276
|
};
|
|
272
277
|
}
|
|
273
|
-
exports.Option = Option;
|
|
274
|
-
function BindOption(name) {
|
|
275
|
-
return function (target, key) {
|
|
276
|
-
Object.defineProperty(target, key, {
|
|
277
|
-
get() {
|
|
278
|
-
const options = "options" in this ? this.options : this.application.options;
|
|
279
|
-
const value = options.getValue(name);
|
|
280
|
-
return value;
|
|
281
|
-
},
|
|
282
|
-
enumerable: true,
|
|
283
|
-
configurable: true,
|
|
284
|
-
});
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
exports.BindOption = BindOption;
|
|
288
278
|
// Based on https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows
|
|
289
279
|
// Slightly modified for improved match results for options
|
|
290
280
|
function editDistance(s, t) {
|
|
@@ -40,7 +40,7 @@ class ArgumentsReader {
|
|
|
40
40
|
: options.getDeclaration("entryPoints");
|
|
41
41
|
if (decl) {
|
|
42
42
|
if (decl.configFileOnly) {
|
|
43
|
-
logger.error(
|
|
43
|
+
logger.error(logger.i18n.option_0_can_only_be_specified_by_config_file(decl.name));
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
46
|
if (seen.has(decl.name) && ARRAY_OPTION_TYPES.has(decl.type)) {
|
|
@@ -61,7 +61,7 @@ class ArgumentsReader {
|
|
|
61
61
|
else {
|
|
62
62
|
if (index === this.args.length) {
|
|
63
63
|
// Only boolean values have optional values.
|
|
64
|
-
logger.warn(
|
|
64
|
+
logger.warn(logger.i18n.option_0_expected_a_value_but_none_provided(decl.name));
|
|
65
65
|
}
|
|
66
66
|
trySet(decl.name, this.args[index]);
|
|
67
67
|
}
|
|
@@ -87,9 +87,7 @@ class ArgumentsReader {
|
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
logger.error(
|
|
91
|
-
.getSimilarOptions(name)
|
|
92
|
-
.join("\n\t")}`);
|
|
90
|
+
logger.error(logger.i18n.unknown_option_0_may_have_meant_1(name, options.getSimilarOptions(name).join("\n\t")));
|
|
93
91
|
index++;
|
|
94
92
|
}
|
|
95
93
|
}
|
|
@@ -20,7 +20,7 @@ class PackageJsonReader {
|
|
|
20
20
|
}
|
|
21
21
|
const { file, content } = result;
|
|
22
22
|
if ("typedoc" in content) {
|
|
23
|
-
logger.warn(
|
|
23
|
+
logger.warn(logger.i18n.typedoc_key_in_0_ignored((0, paths_1.nicePath)(file)));
|
|
24
24
|
}
|
|
25
25
|
const optsKey = "typedocOptions";
|
|
26
26
|
if (!(optsKey in content)) {
|
|
@@ -28,7 +28,7 @@ class PackageJsonReader {
|
|
|
28
28
|
}
|
|
29
29
|
const opts = content[optsKey];
|
|
30
30
|
if (opts === null || typeof opts !== "object") {
|
|
31
|
-
logger.error(
|
|
31
|
+
logger.error(logger.i18n.typedoc_options_must_be_object_in_0((0, paths_1.nicePath)(file)));
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
for (const [opt, val] of Object.entries(opts)) {
|
|
@@ -56,7 +56,7 @@ class TSConfigReader {
|
|
|
56
56
|
if (!fileToRead) {
|
|
57
57
|
// If the user didn't give us this option, we shouldn't complain about not being able to find it.
|
|
58
58
|
if (container.isSet("tsconfig")) {
|
|
59
|
-
logger.error(
|
|
59
|
+
logger.error(logger.i18n.tsconfig_file_0_does_not_exist((0, paths_1.nicePath)(file)));
|
|
60
60
|
}
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
@@ -73,14 +73,11 @@ class TSConfigReader {
|
|
|
73
73
|
}
|
|
74
74
|
const typedocOptions = (0, tsconfig_1.getTypeDocOptionsFromTsConfig)(fileToRead);
|
|
75
75
|
if (typedocOptions.options) {
|
|
76
|
-
logger.error(
|
|
77
|
-
"typedocOptions in tsconfig file specifies an option file to read but the option",
|
|
78
|
-
"file has already been read. This is likely a misconfiguration.",
|
|
79
|
-
].join(" "));
|
|
76
|
+
logger.error(logger.i18n.tsconfig_file_specifies_options_file());
|
|
80
77
|
delete typedocOptions.options;
|
|
81
78
|
}
|
|
82
79
|
if (typedocOptions.tsconfig) {
|
|
83
|
-
logger.error(
|
|
80
|
+
logger.error(logger.i18n.tsconfig_file_specifies_tsconfig_file());
|
|
84
81
|
delete typedocOptions.tsconfig;
|
|
85
82
|
}
|
|
86
83
|
container.setCompilerOptions(parsed.fileNames, parsed.options, parsed.projectReferences);
|
|
@@ -103,8 +100,7 @@ class TSConfigReader {
|
|
|
103
100
|
}
|
|
104
101
|
const overwritten = ["blockTags", "inlineTags", "modifierTags"].filter((opt) => container.isSet(opt));
|
|
105
102
|
if (overwritten.length) {
|
|
106
|
-
logger.warn(
|
|
107
|
-
"be overwritten by configuration in tsdoc.json.");
|
|
103
|
+
logger.warn(logger.i18n.tags_0_defined_in_typedoc_json_overwritten_by_tsdoc_json(overwritten.join(", ")));
|
|
108
104
|
}
|
|
109
105
|
const config = this.readTsDoc(logger, tsdoc);
|
|
110
106
|
if (!config)
|
|
@@ -136,17 +132,17 @@ class TSConfigReader {
|
|
|
136
132
|
}
|
|
137
133
|
readTsDoc(logger, path) {
|
|
138
134
|
if (this.seenTsdocPaths.has(path)) {
|
|
139
|
-
logger.error(
|
|
135
|
+
logger.error(logger.i18n.circular_reference_extends_0((0, paths_1.nicePath)(path)));
|
|
140
136
|
return;
|
|
141
137
|
}
|
|
142
138
|
this.seenTsdocPaths.add(path);
|
|
143
139
|
const { config, error } = typescript_1.default.readConfigFile((0, paths_1.normalizePath)(path), typescript_1.default.sys.readFile);
|
|
144
140
|
if (error) {
|
|
145
|
-
logger.error(
|
|
141
|
+
logger.error(logger.i18n.failed_read_tsdoc_json_0((0, paths_1.nicePath)(path)));
|
|
146
142
|
return;
|
|
147
143
|
}
|
|
148
144
|
if (!(0, validation_1.validate)(tsDocSchema, config)) {
|
|
149
|
-
logger.error(
|
|
145
|
+
logger.error(logger.i18n.invalid_tsdoc_json_0((0, paths_1.nicePath)(path)));
|
|
150
146
|
return;
|
|
151
147
|
}
|
|
152
148
|
const workingConfig = {};
|
|
@@ -158,7 +154,7 @@ class TSConfigReader {
|
|
|
158
154
|
resolvedPath = resolver.resolve(extendedPath);
|
|
159
155
|
}
|
|
160
156
|
catch {
|
|
161
|
-
logger.error(
|
|
157
|
+
logger.error(logger.i18n.failed_resolve_0_to_file_in_1(extendedPath, (0, paths_1.nicePath)(path)));
|
|
162
158
|
return;
|
|
163
159
|
}
|
|
164
160
|
const parentConfig = this.readTsDoc(logger, resolvedPath);
|
|
@@ -30,7 +30,7 @@ export declare class TypeDocReader implements OptionsReader {
|
|
|
30
30
|
*
|
|
31
31
|
* @param path Path to the typedoc.(js|json) file. If path is a directory
|
|
32
32
|
* typedoc file will be attempted to be found at the root of this path
|
|
33
|
-
* @
|
|
33
|
+
* @returns the typedoc.(js|json) file path or undefined
|
|
34
34
|
*/
|
|
35
35
|
private findTypedocFile;
|
|
36
36
|
}
|
|
@@ -58,7 +58,7 @@ class TypeDocReader {
|
|
|
58
58
|
const file = this.findTypedocFile(path);
|
|
59
59
|
if (!file) {
|
|
60
60
|
if (container.isSet("options")) {
|
|
61
|
-
logger.error(
|
|
61
|
+
logger.error(logger.i18n.options_file_0_does_not_exist((0, paths_1.nicePath)(path)));
|
|
62
62
|
}
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
@@ -73,7 +73,7 @@ class TypeDocReader {
|
|
|
73
73
|
*/
|
|
74
74
|
async readFile(file, container, logger, seen) {
|
|
75
75
|
if (seen.has(file)) {
|
|
76
|
-
logger.error(
|
|
76
|
+
logger.error(logger.i18n.circular_reference_extends_0((0, paths_1.nicePath)(file)));
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
seen.add(file);
|
|
@@ -81,7 +81,7 @@ class TypeDocReader {
|
|
|
81
81
|
if (file.endsWith(".json")) {
|
|
82
82
|
const readResult = typescript_1.default.readConfigFile((0, paths_1.normalizePath)(file), (path) => FS.readFileSync(path, "utf-8"));
|
|
83
83
|
if (readResult.error) {
|
|
84
|
-
logger.error(
|
|
84
|
+
logger.error(logger.i18n.failed_read_options_file_0((0, paths_1.nicePath)(file)));
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
@@ -107,12 +107,13 @@ class TypeDocReader {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
catch (error) {
|
|
110
|
-
logger.error(
|
|
110
|
+
logger.error(logger.i18n.failed_read_options_file_0((0, paths_1.nicePath)(file)));
|
|
111
|
+
logger.error(String(error instanceof Error ? error.message : error));
|
|
111
112
|
return;
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
if (typeof fileContent !== "object" || !fileContent) {
|
|
115
|
-
logger.error(
|
|
116
|
+
logger.error(logger.i18n.failed_read_options_file_0((0, paths_1.nicePath)(file)));
|
|
116
117
|
return;
|
|
117
118
|
}
|
|
118
119
|
// clone option object to avoid of property changes in re-calling this file
|
|
@@ -127,7 +128,7 @@ class TypeDocReader {
|
|
|
127
128
|
resolvedParent = resolver.resolve(extendedFile);
|
|
128
129
|
}
|
|
129
130
|
catch {
|
|
130
|
-
logger.error(
|
|
131
|
+
logger.error(logger.i18n.failed_resolve_0_to_file_in_1(extendedFile, (0, paths_1.nicePath)(file)));
|
|
131
132
|
continue;
|
|
132
133
|
}
|
|
133
134
|
await this.readFile(resolvedParent, container, logger, seen);
|
|
@@ -149,7 +150,7 @@ class TypeDocReader {
|
|
|
149
150
|
*
|
|
150
151
|
* @param path Path to the typedoc.(js|json) file. If path is a directory
|
|
151
152
|
* typedoc file will be attempted to be found at the root of this path
|
|
152
|
-
* @
|
|
153
|
+
* @returns the typedoc.(js|json) file path or undefined
|
|
153
154
|
*/
|
|
154
155
|
findTypedocFile(path) {
|
|
155
156
|
path = (0, path_1.resolve)(path);
|