@ng-doc/builder 15.0.0-beta.27 → 15.0.0-beta.29
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/engine/.cache/libs/app/components/api-list/api-list.component.js +7 -7
- package/engine/.cache/libs/app/components/code/code.component.js +12 -16
- package/engine/.cache/libs/app/components/demo/demo.component.js +8 -10
- package/engine/.cache/libs/app/components/navbar/navbar.component.js +1 -1
- package/engine/.cache/libs/app/components/page/page.module.js +1 -0
- package/engine/.cache/libs/app/components/page-map/page-map.component.js +1 -2
- package/engine/.cache/libs/app/components/playground/playground.component.js +5 -10
- package/engine/.cache/libs/app/components/playground-demo/playground-demo.component.js +8 -9
- package/engine/.cache/libs/app/components/playground-properties/playground-properties.component.js +1 -2
- package/engine/.cache/libs/app/components/playground-property/playground-property.component.js +9 -10
- package/engine/.cache/libs/app/components/root/root.component.js +2 -3
- package/engine/.cache/libs/app/components/sidebar/sidebar-category/sidebar-category.component.js +3 -5
- package/engine/.cache/libs/app/components/sidebar/sidebar.component.js +1 -2
- package/engine/.cache/libs/app/directives/code-highlighter/code-highlighter.directive.js +1 -2
- package/engine/.cache/libs/app/helpers/generate-page-map/generate-page-map.js +1 -2
- package/engine/.cache/libs/app/modules/root/ng-doc.module.js +3 -3
- package/engine/.cache/libs/app/pipes/filter-by-text/filter-by-text.pipe.js +1 -2
- package/engine/.cache/libs/app/processors/code-processor/code-processor.directive.js +2 -5
- package/engine/.cache/libs/app/processors/html-processor/html-processor.directive.js +1 -2
- package/engine/.cache/libs/app/processors/icon-processor/icon-processor.directive.js +2 -3
- package/engine/.cache/libs/app/processors/index.js +1 -0
- package/engine/.cache/libs/app/processors/playground-processor/playground-processor.directive.js +2 -3
- package/engine/.cache/libs/app/processors/tooltip-processor/index.js +6 -0
- package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-processor.directive.js +30 -0
- package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-processor.module.js +18 -0
- package/engine/.cache/libs/app/processors/tooltip-processor/tooltip-wrapper.component.js +30 -0
- package/engine/.cache/libs/app/services/theme/theme.service.js +1 -2
- package/engine/.cache/libs/builder/engine/actions/demo.action.js +1 -2
- package/engine/.cache/libs/builder/engine/actions/playground.action.js +3 -4
- package/engine/.cache/libs/builder/engine/actions.js +1 -2
- package/engine/.cache/libs/builder/engine/builder.js +2 -2
- package/engine/.cache/libs/builder/engine/entities/abstractions/entity.js +2 -3
- package/engine/.cache/libs/builder/engine/entities/abstractions/file.entity.js +7 -2
- package/engine/.cache/libs/builder/engine/entities/abstractions/module.entity.js +1 -2
- package/engine/.cache/libs/builder/engine/entities/abstractions/route.entity.js +1 -2
- package/engine/.cache/libs/builder/engine/entities/abstractions/source-file.entity.js +3 -3
- package/engine/.cache/libs/builder/engine/entities/api-page.entity.js +4 -4
- package/engine/.cache/libs/builder/engine/entities/api-scope.entity.js +1 -2
- package/engine/.cache/libs/builder/engine/entities/api.entity.js +9 -16
- package/engine/.cache/libs/builder/engine/entities/category.entity.js +6 -12
- package/engine/.cache/libs/builder/engine/entities/dependencies.entity.js +20 -9
- package/engine/.cache/libs/builder/engine/entities/page.entity.js +13 -20
- package/engine/.cache/libs/builder/engine/entities/playground.entity.js +4 -3
- package/engine/.cache/libs/builder/engine/entity-store.js +3 -5
- package/engine/.cache/libs/builder/engine/functions/build-candidates.js +1 -2
- package/engine/.cache/libs/builder/engine/post-processors/html-plugins/keywords-processor.js +19 -16
- package/engine/.cache/libs/builder/engine/post-processors/html-post-processor.js +5 -2
- package/engine/.cache/libs/builder/engine/renderer.js +10 -7
- package/engine/.cache/libs/builder/engine/template-filters.js +16 -1
- package/engine/.cache/libs/builder/engine/watcher.js +1 -1
- package/engine/.cache/libs/builder/helpers/build-assets.js +2 -0
- package/engine/.cache/libs/builder/helpers/build-global-indexes.js +1 -2
- package/engine/.cache/libs/builder/helpers/create-builder-context.js +3 -4
- package/engine/.cache/libs/builder/helpers/declaration-to-playground.js +6 -4
- package/engine/.cache/libs/builder/helpers/extract-path-anchor.js +2 -3
- package/engine/.cache/libs/builder/helpers/extract-selectors.js +2 -3
- package/engine/.cache/libs/builder/helpers/format-code.js +3 -6
- package/engine/.cache/libs/builder/helpers/generate-api-entities.js +1 -2
- package/engine/.cache/libs/builder/helpers/index.js +1 -0
- package/engine/.cache/libs/builder/helpers/marked.js +1 -1
- package/engine/.cache/libs/builder/helpers/no-empty.js +12 -0
- package/engine/.cache/libs/builder/helpers/not-empty-assets.js +1 -1
- package/engine/.cache/libs/builder/helpers/presentation.js +76 -5
- package/engine/.cache/libs/builder/helpers/typescript/class/find-base-class.js +21 -0
- package/engine/.cache/libs/builder/helpers/typescript/class/find-class.js +21 -0
- package/engine/.cache/libs/builder/helpers/typescript/class/for-all-classes.js +15 -0
- package/engine/.cache/libs/builder/helpers/typescript/class/index.js +6 -0
- package/engine/.cache/libs/builder/helpers/typescript/create-project.js +17 -2
- package/engine/.cache/libs/builder/helpers/typescript/find-declaration.js +3 -4
- package/engine/.cache/libs/builder/helpers/typescript/first-node-with-comment.js +13 -0
- package/engine/.cache/libs/builder/helpers/typescript/index.js +6 -0
- package/engine/.cache/libs/builder/helpers/typescript/interface/find-interface.js +29 -0
- package/engine/.cache/libs/builder/helpers/typescript/interface/for-all-interfaces.js +20 -0
- package/engine/.cache/libs/builder/helpers/typescript/interface/index.js +5 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/get-class-methods.js +22 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/get-implemented-method.js +44 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/get-interface-methods.js +22 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/get-method-chain.js +32 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/get-overridden-method.js +26 -0
- package/engine/.cache/libs/builder/helpers/typescript/method/index.js +8 -0
- package/engine/.cache/libs/builder/helpers/typescript/node/index.js +4 -0
- package/engine/.cache/libs/builder/helpers/typescript/node/sort-by-nodes-name.js +11 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/get-class-properties.js +22 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/get-implemented-property.js +44 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/get-interface-properties.js +22 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/get-overridden-property.js +26 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/get-property-chain.js +33 -0
- package/engine/.cache/libs/builder/helpers/typescript/property/index.js +8 -0
- package/engine/.cache/libs/builder/resolvers/common/get-property-assignment.js +1 -2
- package/engine/.cache/libs/builder/schematics/api/index.js +1 -1
- package/engine/.cache/libs/builder/schematics/category/index.js +1 -1
- package/engine/.cache/libs/builder/schematics/dependencies/index.js +2 -3
- package/engine/.cache/libs/builder/schematics/page/index.js +7 -1
- package/engine/.cache/libs/builder/templates-env/code.env.js +2 -0
- package/engine/.cache/libs/builder/templates-env/index.js +1 -0
- package/engine/.cache/libs/core/helpers/extract-value.js +1 -1
- package/engine/.cache/libs/core/helpers/kebab-case.js +4 -3
- package/engine/.cache/libs/ui-kit/cdk/combobox-host/combobox-host.component.js +8 -11
- package/engine/.cache/libs/ui-kit/components/clear-control/clear-control.component.js +3 -6
- package/engine/.cache/libs/ui-kit/components/dropdown/dropdown.component.js +27 -17
- package/engine/.cache/libs/ui-kit/components/input-wrapper/input-wrapper.component.js +3 -6
- package/engine/.cache/libs/ui-kit/components/list/list.component.js +7 -10
- package/engine/.cache/libs/ui-kit/components/option/option.component.js +2 -4
- package/engine/.cache/libs/ui-kit/components/overlay-container/overlay-container.component.js +5 -9
- package/engine/.cache/libs/ui-kit/components/selection/selection-host.directive.js +1 -2
- package/engine/.cache/libs/ui-kit/components/tab-group/tab-group.component.js +1 -2
- package/engine/.cache/libs/ui-kit/components/toggle/toggle.component.js +2 -3
- package/engine/.cache/libs/ui-kit/directives/media-query/media-query.directive.js +1 -2
- package/engine/.cache/libs/ui-kit/directives/tooltip/tooltip.directive.js +14 -7
- package/engine/.cache/libs/ui-kit/helpers/merge-overlay-configs.js +5 -3
- package/engine/.cache/libs/ui-kit/modules/root/root.module.js +1 -2
- package/engine/.cache/libs/ui-kit/services/notify/notify.service.js +2 -2
- package/engine/.cache/libs/ui-kit/services/overlay/overlay.service.js +2 -3
- package/engine/.cache/libs/ui-kit/services/overlay-strategy/overlay-strategy.js +4 -7
- package/engine/.cache/libs/ui-kit/utils/overlay-utils.js +1 -1
- package/engine/entities/api-page.entity.d.ts +1 -1
- package/engine/entities/dependencies.entity.js +14 -4
- package/engine/entities/dependencies.entity.js.map +1 -1
- package/engine/post-processors/html-plugins/keywords-processor.js +18 -15
- package/engine/post-processors/html-plugins/keywords-processor.js.map +1 -1
- package/engine/renderer.d.ts +1 -0
- package/engine/renderer.js +4 -1
- package/engine/renderer.js.map +1 -1
- package/engine/template-filters.d.ts +1 -1
- package/engine/template-filters.js +16 -1
- package/engine/template-filters.js.map +1 -1
- package/helpers/build-assets.js +2 -0
- package/helpers/build-assets.js.map +1 -1
- package/helpers/format-code.js +3 -6
- package/helpers/format-code.js.map +1 -1
- package/helpers/index.d.ts +1 -0
- package/helpers/index.js +1 -0
- package/helpers/index.js.map +1 -1
- package/helpers/no-empty.d.ts +5 -0
- package/helpers/no-empty.js +13 -0
- package/helpers/no-empty.js.map +1 -0
- package/helpers/not-empty-assets.js +1 -1
- package/helpers/not-empty-assets.js.map +1 -1
- package/helpers/presentation.d.ts +11 -1
- package/helpers/presentation.js +77 -4
- package/helpers/presentation.js.map +1 -1
- package/helpers/typescript/class/find-base-class.d.ts +7 -0
- package/helpers/typescript/class/find-base-class.js +22 -0
- package/helpers/typescript/class/find-base-class.js.map +1 -0
- package/helpers/typescript/class/find-class.d.ts +7 -0
- package/helpers/typescript/class/find-class.js +22 -0
- package/helpers/typescript/class/find-class.js.map +1 -0
- package/helpers/typescript/class/for-all-classes.d.ts +7 -0
- package/helpers/typescript/class/for-all-classes.js +16 -0
- package/helpers/typescript/class/for-all-classes.js.map +1 -0
- package/helpers/typescript/class/index.d.ts +3 -0
- package/helpers/typescript/class/index.js +7 -0
- package/helpers/typescript/class/index.js.map +1 -0
- package/helpers/typescript/first-node-with-comment.d.ts +8 -0
- package/helpers/typescript/first-node-with-comment.js +15 -0
- package/helpers/typescript/first-node-with-comment.js.map +1 -0
- package/helpers/typescript/index.d.ts +6 -0
- package/helpers/typescript/index.js +6 -0
- package/helpers/typescript/index.js.map +1 -1
- package/helpers/typescript/interface/find-interface.d.ts +7 -0
- package/helpers/typescript/interface/find-interface.js +30 -0
- package/helpers/typescript/interface/find-interface.js.map +1 -0
- package/helpers/typescript/interface/for-all-interfaces.d.ts +7 -0
- package/helpers/typescript/interface/for-all-interfaces.js +21 -0
- package/helpers/typescript/interface/for-all-interfaces.js.map +1 -0
- package/helpers/typescript/interface/index.d.ts +2 -0
- package/helpers/typescript/interface/index.js +6 -0
- package/helpers/typescript/interface/index.js.map +1 -0
- package/helpers/typescript/method/get-class-methods.d.ts +6 -0
- package/helpers/typescript/method/get-class-methods.js +23 -0
- package/helpers/typescript/method/get-class-methods.js.map +1 -0
- package/helpers/typescript/method/get-implemented-method.d.ts +7 -0
- package/helpers/typescript/method/get-implemented-method.js +46 -0
- package/helpers/typescript/method/get-implemented-method.js.map +1 -0
- package/helpers/typescript/method/get-interface-methods.d.ts +6 -0
- package/helpers/typescript/method/get-interface-methods.js +23 -0
- package/helpers/typescript/method/get-interface-methods.js.map +1 -0
- package/helpers/typescript/method/get-method-chain.d.ts +6 -0
- package/helpers/typescript/method/get-method-chain.js +33 -0
- package/helpers/typescript/method/get-method-chain.js.map +1 -0
- package/helpers/typescript/method/get-overridden-method.d.ts +7 -0
- package/helpers/typescript/method/get-overridden-method.js +28 -0
- package/helpers/typescript/method/get-overridden-method.js.map +1 -0
- package/helpers/typescript/method/index.d.ts +5 -0
- package/helpers/typescript/method/index.js +9 -0
- package/helpers/typescript/method/index.js.map +1 -0
- package/helpers/typescript/node/index.d.ts +1 -0
- package/helpers/typescript/node/index.js +5 -0
- package/helpers/typescript/node/index.js.map +1 -0
- package/helpers/typescript/node/sort-by-nodes-name.d.ts +6 -0
- package/helpers/typescript/node/sort-by-nodes-name.js +12 -0
- package/helpers/typescript/node/sort-by-nodes-name.js.map +1 -0
- package/helpers/typescript/property/get-class-properties.d.ts +6 -0
- package/helpers/typescript/property/get-class-properties.js +23 -0
- package/helpers/typescript/property/get-class-properties.js.map +1 -0
- package/helpers/typescript/property/get-implemented-property.d.ts +7 -0
- package/helpers/typescript/property/get-implemented-property.js +46 -0
- package/helpers/typescript/property/get-implemented-property.js.map +1 -0
- package/helpers/typescript/property/get-interface-properties.d.ts +6 -0
- package/helpers/typescript/property/get-interface-properties.js +23 -0
- package/helpers/typescript/property/get-interface-properties.js.map +1 -0
- package/helpers/typescript/property/get-overridden-property.d.ts +7 -0
- package/helpers/typescript/property/get-overridden-property.js +28 -0
- package/helpers/typescript/property/get-overridden-property.js.map +1 -0
- package/helpers/typescript/property/get-property-chain.d.ts +6 -0
- package/helpers/typescript/property/get-property-chain.js +34 -0
- package/helpers/typescript/property/get-property-chain.js.map +1 -0
- package/helpers/typescript/property/index.d.ts +5 -0
- package/helpers/typescript/property/index.js +9 -0
- package/helpers/typescript/property/index.js.map +1 -0
- package/interfaces/asset.d.ts +1 -0
- package/package.json +2 -2
- package/templates/api/class.html.nunj +22 -8
- package/templates/api/function.html.nunj +1 -1
- package/templates/api/interface.html.nunj +4 -4
- package/templates/code.html.nunj +3 -0
- package/templates/helpers/code.html.nunj +1 -1
- package/templates/helpers/constructor.html.nunj +34 -0
- package/templates/helpers/declaration-modifiers.html.nunj +5 -8
- package/templates/helpers/method.html.nunj +19 -4
- package/templates/helpers/methods.html.nunj +2 -2
- package/templates/helpers/parameters.html.nunj +2 -1
- package/templates/helpers/properties.html.nunj +19 -2
- package/templates-env/code.env.d.ts +4 -0
- package/templates-env/code.env.js +3 -0
- package/templates-env/code.env.js.map +1 -0
- package/templates-env/index.d.ts +1 -0
- package/templates-env/index.js +1 -0
- package/templates-env/index.js.map +1 -1
|
@@ -14,7 +14,6 @@ const component_decorator_resolver_1 = require("../../resolvers/component-decora
|
|
|
14
14
|
*/
|
|
15
15
|
function playgroundAction(playgroundId) {
|
|
16
16
|
return (project, page) => {
|
|
17
|
-
var _a, _b, _c;
|
|
18
17
|
try {
|
|
19
18
|
if (!page.playground) {
|
|
20
19
|
throw new Error(`Can't find the playground file for the page ${page.route}`);
|
|
@@ -23,10 +22,10 @@ function playgroundAction(playgroundId) {
|
|
|
23
22
|
if (!declaration) {
|
|
24
23
|
throw new Error(`Playground action didn't find the class declaration for the current target.`);
|
|
25
24
|
}
|
|
26
|
-
const decorator =
|
|
27
|
-
const decoratorArgument = decorator
|
|
25
|
+
const decorator = declaration.getDecorator('Component') ?? declaration.getDecorator('Directive');
|
|
26
|
+
const decoratorArgument = decorator?.getArguments()[0];
|
|
28
27
|
const selectors = ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)
|
|
29
|
-
? (
|
|
28
|
+
? (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument).selector?.replace(/[\n\s]/gm, '') ?? ''
|
|
30
29
|
: '';
|
|
31
30
|
const playgroundData = (0, declaration_to_playground_1.declarationToPlayground)(declaration);
|
|
32
31
|
return {
|
|
@@ -15,9 +15,8 @@ class NgDocActions {
|
|
|
15
15
|
return output.output;
|
|
16
16
|
}
|
|
17
17
|
performAction(action) {
|
|
18
|
-
var _a;
|
|
19
18
|
const output = action(this.page.sourceFile.getProject(), this.page);
|
|
20
|
-
this.page.dependencies.add(...(
|
|
19
|
+
this.page.dependencies.add(...(output.dependencies ?? []));
|
|
21
20
|
return output;
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -62,7 +62,7 @@ class NgDocBuilder {
|
|
|
62
62
|
.onChange(...dependencies)
|
|
63
63
|
.pipe((0, operators_1.tap)(() => entity.dependenciesChanged()))), (0, operators_1.startWith)(null), (0, operators_1.mapTo)(entity), (0, operators_1.takeUntil)((0, rxjs_1.merge)(entity.onDestroy(), this.watcher.onChange(...entity.rootFiles))))))
|
|
64
64
|
: (0, rxjs_1.of)(null)));
|
|
65
|
-
}), (0, operators_2.bufferDebounce)(500), (0, operators_1.map)((entities) => entities.filter(core_1.isPresent)), (0, operators_1.tap)(() =>
|
|
65
|
+
}), (0, operators_2.bufferDebounce)(500), (0, operators_1.map)((entities) => entities.filter(core_1.isPresent)), (0, operators_1.tap)(() => this.entities.updateKeywordMap(this.context.options.ngDoc?.keywords)),
|
|
66
66
|
// Build touched entities and their dependencies
|
|
67
67
|
(0, operators_1.concatMap)((entities) => (0, fork_join_or_empty_1.forkJoinOrEmpty)((0, build_candidates_1.buildCandidates)(entities).map((entity) => entity.destroyed ? (0, rxjs_1.of)([]) : entity.buildArtifacts())).pipe((0, operators_1.switchMap)((output) => this.skeleton
|
|
68
68
|
.buildArtifacts()
|
|
@@ -80,7 +80,7 @@ class NgDocBuilder {
|
|
|
80
80
|
}
|
|
81
81
|
get(id, canBeBuilt) {
|
|
82
82
|
const entity = this.entities.get(id);
|
|
83
|
-
return (0, core_1.isPresent)(canBeBuilt) ? (
|
|
83
|
+
return (0, core_1.isPresent)(canBeBuilt) ? (entity?.canBeBuilt === canBeBuilt ? entity : undefined) : entity;
|
|
84
84
|
}
|
|
85
85
|
collectGarbage() {
|
|
86
86
|
this.entities.asArray().forEach((entity) => {
|
|
@@ -43,8 +43,7 @@ class NgDocEntity {
|
|
|
43
43
|
* @type {Array<NgDocEntity>}
|
|
44
44
|
*/
|
|
45
45
|
get parentEntities() {
|
|
46
|
-
|
|
47
|
-
return [(_a = this.parent) !== null && _a !== void 0 ? _a : [], (_c = (_b = this.parent) === null || _b === void 0 ? void 0 : _b.parentEntities) !== null && _c !== void 0 ? _c : []].flat();
|
|
46
|
+
return [this.parent ?? [], this.parent?.parentEntities ?? []].flat();
|
|
48
47
|
}
|
|
49
48
|
/**
|
|
50
49
|
* The children of the entity.
|
|
@@ -100,7 +99,7 @@ class NgDocEntity {
|
|
|
100
99
|
We are checking that artifacts result was changed, otherwise we don't want to emit
|
|
101
100
|
the same files to file system, because it will force Angular to rebuild application
|
|
102
101
|
*/
|
|
103
|
-
if (artifacts.every((a, i) =>
|
|
102
|
+
if (artifacts.every((a, i) => a.content === this.artifacts[i]?.content)) {
|
|
104
103
|
return [];
|
|
105
104
|
}
|
|
106
105
|
this.artifacts = artifacts;
|
|
@@ -29,8 +29,13 @@ class NgDocFileEntity extends source_file_entity_1.NgDocSourceFileEntity {
|
|
|
29
29
|
return (0, rxjs_1.of)(void 0);
|
|
30
30
|
}
|
|
31
31
|
getParentFromCategory() {
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const sourceFilePath = this.getObjectExpressionFromDefault()
|
|
33
|
+
?.getProperty('category')
|
|
34
|
+
?.getChildrenOfKind(ts_morph_1.SyntaxKind.Identifier)
|
|
35
|
+
?.pop()
|
|
36
|
+
?.getDefinitions()[0]
|
|
37
|
+
?.getSourceFile()
|
|
38
|
+
?.getFilePath();
|
|
34
39
|
if (sourceFilePath && (0, minimatch_1.default)(sourceFilePath, variables_1.CATEGORY_PATTERN) && sourceFilePath !== this.sourceFilePath) {
|
|
35
40
|
const parent = this.builder.get(path.relative(this.context.context.workspaceRoot, sourceFilePath));
|
|
36
41
|
return (0, helpers_1.isCategoryEntity)(parent) ? parent : undefined;
|
|
@@ -6,8 +6,7 @@ const helpers_1 = require("../../../helpers");
|
|
|
6
6
|
const file_entity_1 = require("./file.entity");
|
|
7
7
|
class NgDocModuleEntity extends file_entity_1.NgDocFileEntity {
|
|
8
8
|
get folderPath() {
|
|
9
|
-
|
|
10
|
-
return path.join((_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.folderPath) !== null && _b !== void 0 ? _b : this.context.modulesPath, this.folderName);
|
|
9
|
+
return path.join(this.parent?.folderPath ?? this.context.modulesPath, this.folderName);
|
|
11
10
|
}
|
|
12
11
|
/**
|
|
13
12
|
* Returns paths to the module in generated folder
|
|
@@ -14,10 +14,9 @@ class NgDocRouteEntity extends module_entity_1.NgDocModuleEntity {
|
|
|
14
14
|
this.usedKeywords = new Set();
|
|
15
15
|
}
|
|
16
16
|
get fullRoute() {
|
|
17
|
-
var _a, _b;
|
|
18
17
|
const parentRoute = this.parent instanceof NgDocRouteEntity
|
|
19
18
|
? this.parent.fullRoute
|
|
20
|
-
:
|
|
19
|
+
: this.context.options.ngDoc?.routePrefix ?? '';
|
|
21
20
|
return (0, helpers_1.slash)(path.join('/', parentRoute, this.route));
|
|
22
21
|
}
|
|
23
22
|
}
|
|
@@ -62,9 +62,9 @@ class NgDocSourceFileEntity extends entity_1.NgDocEntity {
|
|
|
62
62
|
*/
|
|
63
63
|
getObjectExpressionFromDefault() {
|
|
64
64
|
const defaultExport = this.sourceFile.getDefaultExportSymbol();
|
|
65
|
-
const exportAlias = defaultExport
|
|
66
|
-
const valueDeclaration = exportAlias
|
|
67
|
-
return valueDeclaration
|
|
65
|
+
const exportAlias = defaultExport?.getAliasedSymbol();
|
|
66
|
+
const valueDeclaration = exportAlias?.getValueDeclarationOrThrow();
|
|
67
|
+
return valueDeclaration?.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
exports.NgDocSourceFileEntity = NgDocSourceFileEntity;
|
|
@@ -32,9 +32,8 @@ class NgDocApiPageEntity extends route_entity_1.NgDocRouteEntity {
|
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
34
|
get route() {
|
|
35
|
-
var _a, _b, _c;
|
|
36
35
|
return this.declaration
|
|
37
|
-
? (0, helpers_1.slash)(path.join((0, helpers_1.declarationFolderName)(this.declaration),
|
|
36
|
+
? (0, helpers_1.slash)(path.join((0, helpers_1.declarationFolderName)(this.declaration), this.declaration?.getSymbol()?.getName() ?? ''))
|
|
38
37
|
: '';
|
|
39
38
|
}
|
|
40
39
|
emit() {
|
|
@@ -82,8 +81,9 @@ class NgDocApiPageEntity extends route_entity_1.NgDocRouteEntity {
|
|
|
82
81
|
scope: this.parent.target,
|
|
83
82
|
});
|
|
84
83
|
return renderer.render('./api-page.html.nunj').pipe((0, operators_1.map)((output) => ({ content: output, filePath: this.builtPagePath })), (0, operators_1.catchError)((error) => {
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
this.logger.error(`\nError happened while processing Api Page for entity "${this.declaration
|
|
85
|
+
?.getSymbol()
|
|
86
|
+
?.getName()}":\n${error}"`);
|
|
87
87
|
return (0, rxjs_1.of)(null);
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
@@ -44,8 +44,7 @@ class NgDocApiScopeEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
44
44
|
return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
|
|
45
45
|
}
|
|
46
46
|
get order() {
|
|
47
|
-
|
|
48
|
-
return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
|
|
47
|
+
return this.target?.order;
|
|
49
48
|
}
|
|
50
49
|
get pages() {
|
|
51
50
|
return (0, core_1.asArray)(this.children.values()).filter(helpers_1.isPageEntity);
|
|
@@ -16,8 +16,7 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
16
16
|
this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-api-list')}.module.ts`;
|
|
17
17
|
}
|
|
18
18
|
get route() {
|
|
19
|
-
|
|
20
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.route) !== null && _b !== void 0 ? _b : 'api';
|
|
19
|
+
return this.target?.route ?? 'api';
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Returns full url from the root
|
|
@@ -28,16 +27,13 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
28
27
|
return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
|
|
29
28
|
}
|
|
30
29
|
get isRoot() {
|
|
31
|
-
|
|
32
|
-
return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
|
|
30
|
+
return !this.target?.category;
|
|
33
31
|
}
|
|
34
32
|
get title() {
|
|
35
|
-
|
|
36
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
|
|
33
|
+
return this.target?.title ?? '';
|
|
37
34
|
}
|
|
38
35
|
get order() {
|
|
39
|
-
|
|
40
|
-
return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
|
|
36
|
+
return this.target?.order;
|
|
41
37
|
}
|
|
42
38
|
get buildCandidates() {
|
|
43
39
|
return this.parentEntities;
|
|
@@ -81,14 +77,11 @@ class NgDocApiEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
81
77
|
buildApiList() {
|
|
82
78
|
const apiItems = this.children.filter(helpers_1.isApiScopeEntity).map((scope) => ({
|
|
83
79
|
title: scope.title,
|
|
84
|
-
items: scope.children.filter(helpers_1.isApiPageEntity).map((page) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
name: (_d = (_c = page.declaration) === null || _c === void 0 ? void 0 : _c.getName()) !== null && _d !== void 0 ? _d : '',
|
|
90
|
-
});
|
|
91
|
-
}),
|
|
80
|
+
items: scope.children.filter(helpers_1.isApiPageEntity).map((page) => ({
|
|
81
|
+
route: (0, helpers_1.slash)(path.join(scope.route, page.route)),
|
|
82
|
+
type: (0, core_1.humanizeDeclarationName)(page.declaration?.getKindName() ?? ''),
|
|
83
|
+
name: page.declaration?.getName() ?? '',
|
|
84
|
+
})),
|
|
92
85
|
}));
|
|
93
86
|
return (0, rxjs_1.of)({
|
|
94
87
|
content: JSON.stringify(apiItems, undefined, 2),
|
|
@@ -15,9 +15,8 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
15
15
|
this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-category')}.module.ts`;
|
|
16
16
|
}
|
|
17
17
|
get route() {
|
|
18
|
-
var _a, _b;
|
|
19
18
|
const folderName = path.basename(path.dirname(this.sourceFile.getFilePath()));
|
|
20
|
-
return
|
|
19
|
+
return this.target?.route ?? folderName;
|
|
21
20
|
}
|
|
22
21
|
/**
|
|
23
22
|
* Returns full url from the root
|
|
@@ -28,12 +27,10 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
28
27
|
return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
|
|
29
28
|
}
|
|
30
29
|
get isRoot() {
|
|
31
|
-
|
|
32
|
-
return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
|
|
30
|
+
return !this.target?.category;
|
|
33
31
|
}
|
|
34
32
|
get order() {
|
|
35
|
-
|
|
36
|
-
return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
|
|
33
|
+
return this.target?.order;
|
|
37
34
|
}
|
|
38
35
|
get pages() {
|
|
39
36
|
return (0, core_1.asArray)(this.children.values()).filter(helpers_1.isPageEntity);
|
|
@@ -45,19 +42,16 @@ class NgDocCategoryEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
45
42
|
return [];
|
|
46
43
|
}
|
|
47
44
|
get title() {
|
|
48
|
-
|
|
49
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
|
|
45
|
+
return this.target?.title ?? '';
|
|
50
46
|
}
|
|
51
47
|
get buildCandidates() {
|
|
52
48
|
return this.childEntities;
|
|
53
49
|
}
|
|
54
50
|
get expandable() {
|
|
55
|
-
|
|
56
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.expandable) !== null && _b !== void 0 ? _b : true;
|
|
51
|
+
return this.target?.expandable ?? true;
|
|
57
52
|
}
|
|
58
53
|
get expanded() {
|
|
59
|
-
|
|
60
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.expanded) !== null && _b !== void 0 ? _b : false;
|
|
54
|
+
return this.target?.expanded ?? false;
|
|
61
55
|
}
|
|
62
56
|
update() {
|
|
63
57
|
return super.update().pipe((0, operators_1.tap)(() => {
|
|
@@ -21,8 +21,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
|
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
get folderPath() {
|
|
24
|
-
|
|
25
|
-
return ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.folderPath) || '';
|
|
24
|
+
return this.parent?.folderPath || '';
|
|
26
25
|
}
|
|
27
26
|
get buildCandidates() {
|
|
28
27
|
return (0, core_1.asArray)(this.parent);
|
|
@@ -68,7 +67,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
|
|
|
68
67
|
const classDeclarations = this.getDemoClassDeclarations(objectExpression);
|
|
69
68
|
this.componentsAssets = classDeclarations
|
|
70
69
|
.map((classDeclarations) => this.getComponentAssets(classDeclarations))
|
|
71
|
-
.reduce((acc, curr) => (
|
|
70
|
+
.reduce((acc, curr) => ({ ...acc, ...curr }), {});
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
buildComponentAssets() {
|
|
@@ -87,7 +86,7 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
|
|
|
87
86
|
if (initializer && initializer instanceof ts_morph_1.ObjectLiteralExpression) {
|
|
88
87
|
return initializer
|
|
89
88
|
.getProperties()
|
|
90
|
-
.map((property) =>
|
|
89
|
+
.map((property) => property.getType().getSymbol()?.getValueDeclaration())
|
|
91
90
|
.filter(core_1.isPresent)
|
|
92
91
|
.filter(ts_morph_1.Node.isClassDeclaration);
|
|
93
92
|
}
|
|
@@ -95,9 +94,9 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
|
|
|
95
94
|
return [];
|
|
96
95
|
}
|
|
97
96
|
getComponentAssets(classDeclaration) {
|
|
98
|
-
|
|
97
|
+
const render = new renderer_1.NgDocRenderer(this.builder);
|
|
99
98
|
const decorator = classDeclaration.getDecorator('Component');
|
|
100
|
-
const decoratorArgument = decorator
|
|
99
|
+
const decoratorArgument = decorator?.getArguments()[0];
|
|
101
100
|
if (ts_morph_1.Node.isObjectLiteralExpression(decoratorArgument)) {
|
|
102
101
|
const decoratorData = (0, component_decorator_resolver_1.componentDecoratorResolver)(decoratorArgument);
|
|
103
102
|
const filePath = classDeclaration.getSourceFile().getFilePath();
|
|
@@ -112,9 +111,21 @@ class NgDocDependenciesEntity extends source_file_entity_1.NgDocSourceFileEntity
|
|
|
112
111
|
.flat(),
|
|
113
112
|
];
|
|
114
113
|
return {
|
|
115
|
-
[
|
|
116
|
-
|
|
117
|
-
return
|
|
114
|
+
[classDeclaration.getName() ?? '']: assets.map((asset) => {
|
|
115
|
+
const code = (0, helpers_1.formatCode)(asset.output, asset.type);
|
|
116
|
+
return {
|
|
117
|
+
...asset,
|
|
118
|
+
code,
|
|
119
|
+
output: render
|
|
120
|
+
.renderSync('./code.html.nunj', {
|
|
121
|
+
overrideContext: {
|
|
122
|
+
code,
|
|
123
|
+
lang: asset.type,
|
|
124
|
+
},
|
|
125
|
+
})
|
|
126
|
+
.trim(),
|
|
127
|
+
outputPath: (0, helpers_1.slash)(path.join(this.parent?.assetsFolder ?? this.folderPath, `${asset.name}.html`)),
|
|
128
|
+
};
|
|
118
129
|
}),
|
|
119
130
|
};
|
|
120
131
|
}
|
|
@@ -19,9 +19,8 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
19
19
|
this.moduleFileName = `${(0, helpers_1.uniqueName)('ng-doc-page')}.module.ts`;
|
|
20
20
|
}
|
|
21
21
|
get route() {
|
|
22
|
-
var _a, _b;
|
|
23
22
|
const folderName = path.basename(path.dirname(this.sourceFile.getFilePath()));
|
|
24
|
-
return
|
|
23
|
+
return this.target?.route ?? folderName;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
26
|
* Returns full url from the root
|
|
@@ -32,31 +31,25 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
32
31
|
return `${this.parent ? this.parent.url + '/' : ''}${this.route}`;
|
|
33
32
|
}
|
|
34
33
|
get isRoot() {
|
|
35
|
-
|
|
36
|
-
return !((_a = this.target) === null || _a === void 0 ? void 0 : _a.category);
|
|
34
|
+
return !this.target?.category;
|
|
37
35
|
}
|
|
38
36
|
get title() {
|
|
39
|
-
|
|
40
|
-
return (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : '';
|
|
37
|
+
return this.target?.title ?? '';
|
|
41
38
|
}
|
|
42
39
|
get canBeBuilt() {
|
|
43
|
-
var _a, _b;
|
|
44
40
|
return (!this.target ||
|
|
45
|
-
!
|
|
41
|
+
!this.context.options.ngDoc?.tag ||
|
|
46
42
|
!this.target.onlyForTags ||
|
|
47
|
-
(0, core_1.asArray)(this.target.onlyForTags).includes(
|
|
43
|
+
(0, core_1.asArray)(this.target.onlyForTags).includes(this.context.options.ngDoc?.tag));
|
|
48
44
|
}
|
|
49
45
|
get order() {
|
|
50
|
-
|
|
51
|
-
return (_a = this.target) === null || _a === void 0 ? void 0 : _a.order;
|
|
46
|
+
return this.target?.order;
|
|
52
47
|
}
|
|
53
48
|
get keywords() {
|
|
54
|
-
|
|
55
|
-
return [...(0, core_1.asArray)((_a = this.target) === null || _a === void 0 ? void 0 : _a.keyword)].map((k) => `*${k}`);
|
|
49
|
+
return [...(0, core_1.asArray)(this.target?.keyword)].map((k) => `*${k}`);
|
|
56
50
|
}
|
|
57
51
|
get mdPath() {
|
|
58
|
-
|
|
59
|
-
return path.join(this.sourceFileFolder, (_b = (_a = this.target) === null || _a === void 0 ? void 0 : _a.mdFile) !== null && _b !== void 0 ? _b : '');
|
|
52
|
+
return path.join(this.sourceFileFolder, this.target?.mdFile ?? '');
|
|
60
53
|
}
|
|
61
54
|
get builtPagePath() {
|
|
62
55
|
return (0, helpers_1.slash)(path.relative(this.context.context.workspaceRoot, path.join(this.folderPath, variables_1.RENDERED_PAGE_NAME)));
|
|
@@ -88,8 +81,7 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
88
81
|
}
|
|
89
82
|
update() {
|
|
90
83
|
return super.update().pipe((0, operators_1.tap)(() => {
|
|
91
|
-
|
|
92
|
-
if (!(0, core_1.isPresent)((_a = this.target) === null || _a === void 0 ? void 0 : _a.mdFile) || !fs.existsSync(this.mdPath)) {
|
|
84
|
+
if (!(0, core_1.isPresent)(this.target?.mdFile) || !fs.existsSync(this.mdPath)) {
|
|
93
85
|
throw new Error(`Failed to load ${this.sourceFile.getFilePath()}. Make sure that you define mdFile property correctly and .md file exists.`);
|
|
94
86
|
}
|
|
95
87
|
if (!this.title) {
|
|
@@ -117,17 +109,18 @@ class NgDocPageEntity extends navigation_entity_1.NgDocNavigationEntity {
|
|
|
117
109
|
return (0, rxjs_1.of)();
|
|
118
110
|
}
|
|
119
111
|
buildPage() {
|
|
120
|
-
var _a, _b, _c;
|
|
121
112
|
this.dependencies.clear();
|
|
122
113
|
if (this.target) {
|
|
123
114
|
this.dependencies.add(this.mdPath);
|
|
124
115
|
this.playgroundFile && this.dependencies.add(this.playgroundFile);
|
|
125
|
-
|
|
116
|
+
this.playground?.sourceFile
|
|
117
|
+
?.getReferencedSourceFiles()
|
|
118
|
+
.forEach((sourceFile) => sourceFile.refreshFromFileSystemSync());
|
|
126
119
|
const renderer = new renderer_1.NgDocRenderer(this.builder, {
|
|
127
120
|
NgDocPage: this.target,
|
|
128
121
|
NgDocActions: new actions_1.NgDocActions(this),
|
|
129
122
|
}, this.dependencies);
|
|
130
|
-
return renderer.render(
|
|
123
|
+
return renderer.render(this.target?.mdFile, { scope: this.sourceFileFolder }).pipe((0, operators_1.map)((markdown) => (0, helpers_1.marked)(markdown)), (0, operators_1.map)((output) => ({ content: output, filePath: this.builtPagePath })));
|
|
131
124
|
}
|
|
132
125
|
return (0, rxjs_1.of)();
|
|
133
126
|
}
|
|
@@ -35,7 +35,6 @@ class NgDocPlaygroundEntity extends file_entity_1.NgDocFileEntity {
|
|
|
35
35
|
}), (0, operators_1.mapTo)(void 0));
|
|
36
36
|
}
|
|
37
37
|
getTargetForPlayground(playgroundId) {
|
|
38
|
-
var _a, _b;
|
|
39
38
|
const expression = this.getObjectExpressionFromDefault();
|
|
40
39
|
if (!expression) {
|
|
41
40
|
throw new Error(`Failed to load ${this.sourceFile.getFilePath()}. Make sure that you have exported it as default.`);
|
|
@@ -48,8 +47,10 @@ class NgDocPlaygroundEntity extends file_entity_1.NgDocFileEntity {
|
|
|
48
47
|
if (ts_morph_1.Node.isPropertyAssignment(target)) {
|
|
49
48
|
const targetInitializer = target.getInitializer();
|
|
50
49
|
if (ts_morph_1.Node.isIdentifier(targetInitializer)) {
|
|
51
|
-
const declaration =
|
|
52
|
-
.getType()
|
|
50
|
+
const declaration = targetInitializer
|
|
51
|
+
.getType()
|
|
52
|
+
?.getSymbol()
|
|
53
|
+
?.getDeclarations()[0];
|
|
53
54
|
if (ts_morph_1.Node.isClassDeclaration(declaration)) {
|
|
54
55
|
return declaration;
|
|
55
56
|
}
|
|
@@ -12,9 +12,8 @@ class NgDocEntityStore extends Map {
|
|
|
12
12
|
return (0, core_1.asArray)(this.values());
|
|
13
13
|
}
|
|
14
14
|
set(key, value) {
|
|
15
|
-
var _a;
|
|
16
15
|
if (this.get(key) !== value) {
|
|
17
|
-
|
|
16
|
+
this.get(key)?.destroy();
|
|
18
17
|
}
|
|
19
18
|
return super.set(key, value);
|
|
20
19
|
}
|
|
@@ -29,13 +28,12 @@ class NgDocEntityStore extends Map {
|
|
|
29
28
|
}
|
|
30
29
|
updateKeywordMap(globalKeywords) {
|
|
31
30
|
this.keywordMap = new Map();
|
|
32
|
-
(0, core_1.objectKeys)(globalKeywords
|
|
33
|
-
var _a;
|
|
31
|
+
(0, core_1.objectKeys)(globalKeywords ?? {}).forEach((key) => {
|
|
34
32
|
if (globalKeywords) {
|
|
35
33
|
const globalKeyword = globalKeywords[key];
|
|
36
34
|
if (globalKeyword) {
|
|
37
35
|
this.addKeyword(key, {
|
|
38
|
-
title:
|
|
36
|
+
title: globalKeyword.title ?? key,
|
|
39
37
|
path: globalKeyword.path,
|
|
40
38
|
isCodeLink: !!globalKeyword.isCodeLink,
|
|
41
39
|
});
|
|
@@ -11,8 +11,7 @@ const helpers_1 = require("../../helpers");
|
|
|
11
11
|
* @returns List of entities that should be rebuilt (including source entities)
|
|
12
12
|
*/
|
|
13
13
|
function buildCandidates(entities) {
|
|
14
|
-
|
|
15
|
-
const entitiesFromStore = (0, core_1.asArray)((_a = entities[0]) === null || _a === void 0 ? void 0 : _a.builder.entities.asArray());
|
|
14
|
+
const entitiesFromStore = (0, core_1.asArray)(entities[0]?.builder.entities.asArray());
|
|
16
15
|
const candidates = (0, core_1.asArray)(new Set(entities.map((buildable) => [buildable, ...buildable.buildCandidates]).flat()));
|
|
17
16
|
const candidatesKeywords = (0, core_1.asArray)(new Set(candidates
|
|
18
17
|
.filter(helpers_1.isRouteEntity)
|
package/engine/.cache/libs/builder/engine/post-processors/html-plugins/keywords-processor.js
CHANGED
|
@@ -4,6 +4,7 @@ const helpers_1 = require("../../../helpers");
|
|
|
4
4
|
const visit = require('unist-util-visit-parents');
|
|
5
5
|
const is = require('hast-util-is-element');
|
|
6
6
|
const textContent = require('hast-util-to-string');
|
|
7
|
+
const languages = ['typescript'];
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* @param entityStore
|
|
@@ -19,21 +20,23 @@ function keywordsProcessor(entityStore, entity) {
|
|
|
19
20
|
}
|
|
20
21
|
const parent = ancestors[ancestors.length - 1];
|
|
21
22
|
const isInlineCode = !is(parent, 'pre');
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
if (isInlineCode || languages.includes(node.properties.lang)) {
|
|
24
|
+
visit(node, 'text', (node, ancestors) => {
|
|
25
|
+
if (hasLinkAncestor(ancestors)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const parent = ancestors[ancestors.length - 1];
|
|
29
|
+
const index = parent.children.indexOf(node);
|
|
30
|
+
// Parse the text for words that we can convert to links
|
|
31
|
+
const nodes = getNodes(node, parent, entityStore, isInlineCode, entity);
|
|
32
|
+
// Replace the text node with the links and leftover text nodes
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
Array.prototype.splice.apply(parent.children, [index, 1].concat(nodes));
|
|
36
|
+
// Do not visit this node's children or the newly added nodes
|
|
37
|
+
return [visit.SKIP, index + nodes.length];
|
|
38
|
+
});
|
|
39
|
+
}
|
|
37
40
|
});
|
|
38
41
|
}
|
|
39
42
|
exports.default = keywordsProcessor;
|
|
@@ -73,7 +76,7 @@ function getNodes(node, parent, entityStore, inlineLink, e) {
|
|
|
73
76
|
(0, helpers_1.printWarning)(`Keyword "${word}" is missing.`);
|
|
74
77
|
}
|
|
75
78
|
// Convert code tag to link if it's a link to the page entity
|
|
76
|
-
if (inlineLink &&
|
|
79
|
+
if (inlineLink && keyword?.isCodeLink === false) {
|
|
77
80
|
parent.tagName = 'a';
|
|
78
81
|
parent.properties = { href: keyword.path };
|
|
79
82
|
return { type: 'text', value: keyword.title };
|
|
@@ -11,13 +11,16 @@ const keywords_processor_1 = require("./html-plugins/keywords-processor");
|
|
|
11
11
|
* @param content
|
|
12
12
|
*/
|
|
13
13
|
function htmlPostProcessor(entity, content) {
|
|
14
|
-
return
|
|
14
|
+
return {
|
|
15
|
+
...content,
|
|
16
|
+
content: require('rehype')()
|
|
15
17
|
.use(require('rehype-format'))
|
|
16
18
|
.use(require('rehype-highlight'))
|
|
17
19
|
.use(require('rehype-slug'))
|
|
18
20
|
.use(autolink_headings_1.default, (0, helpers_1.isRouteEntity)(entity) ? entity.fullRoute : undefined)
|
|
19
21
|
.use(keywords_processor_1.default, entity.builder.entities, (0, helpers_1.isRouteEntity)(entity) ? entity : undefined)
|
|
20
22
|
.processSync(content.content)
|
|
21
|
-
.toString()
|
|
23
|
+
.toString()
|
|
24
|
+
};
|
|
22
25
|
}
|
|
23
26
|
exports.htmlPostProcessor = htmlPostProcessor;
|
|
@@ -15,9 +15,8 @@ class NgDocRelativeLoader {
|
|
|
15
15
|
this.dependenciesStore = dependenciesStore;
|
|
16
16
|
}
|
|
17
17
|
getSource(name) {
|
|
18
|
-
var _a;
|
|
19
18
|
const fullPath = path.join(this.path, name);
|
|
20
|
-
|
|
19
|
+
this.dependenciesStore?.add(fullPath);
|
|
21
20
|
return {
|
|
22
21
|
src: fs.readFileSync(fullPath, 'utf-8'),
|
|
23
22
|
path: fullPath,
|
|
@@ -33,23 +32,27 @@ class NgDocRenderer {
|
|
|
33
32
|
}
|
|
34
33
|
render(template, options) {
|
|
35
34
|
return new rxjs_1.Observable((observer) => {
|
|
36
|
-
this.getEnvironment(options).render(template, this.getContext(options
|
|
35
|
+
this.getEnvironment(options).render(template, this.getContext(options?.overrideContext), (err, data) => {
|
|
37
36
|
if (err) {
|
|
38
37
|
observer.error(err);
|
|
39
38
|
}
|
|
40
39
|
else {
|
|
41
|
-
observer.next(data
|
|
40
|
+
observer.next(data ?? '');
|
|
42
41
|
observer.complete();
|
|
43
42
|
}
|
|
44
43
|
});
|
|
45
44
|
});
|
|
46
45
|
}
|
|
46
|
+
renderSync(template, options) {
|
|
47
|
+
return this.getEnvironment(options).render(template, this.getContext(options?.overrideContext));
|
|
48
|
+
}
|
|
47
49
|
getContext(context) {
|
|
48
|
-
return
|
|
50
|
+
return {
|
|
51
|
+
...(context ?? this.context),
|
|
52
|
+
};
|
|
49
53
|
}
|
|
50
54
|
getEnvironment(options) {
|
|
51
|
-
|
|
52
|
-
let environment = new nunjucks_1.Environment(new NgDocRelativeLoader((_a = options === null || options === void 0 ? void 0 : options.scope) !== null && _a !== void 0 ? _a : variables_1.TEMPLATES_PATH, this.dependenciesStore), { autoescape: false });
|
|
55
|
+
let environment = new nunjucks_1.Environment(new NgDocRelativeLoader(options?.scope ?? variables_1.TEMPLATES_PATH, this.dependenciesStore), { autoescape: false });
|
|
53
56
|
(0, core_1.objectKeys)(filters).forEach((filter) => (environment = environment.addFilter(filter, filters[filter])));
|
|
54
57
|
environment.addGlobal('Node', ts_morph_1.Node);
|
|
55
58
|
environment.addGlobal('NgDocBuilder', this.builder);
|