@ng-doc/builder 16.10.0 → 16.11.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/classes/observable-set.d.ts +1 -0
- package/classes/observable-set.js +4 -0
- package/classes/observable-set.js.map +1 -1
- package/engine/.cache/apps/ng-doc/docs/ng-doc.api.js +3 -8
- package/engine/.cache/apps/ng-doc/docs/recipes/ignoring-file-lines/ng-doc.page.js +41 -0
- package/engine/.cache/apps/ng-doc/docs/recipes/ng-doc.category.js +30 -0
- package/engine/actions/playground.action.js +2 -2
- package/engine/actions/playground.action.js.map +1 -1
- package/engine/build-ng-doc.js +10 -2
- package/engine/build-ng-doc.js.map +1 -1
- package/engine/builder-operators/build.d.ts +2 -3
- package/engine/builder-operators/build.js +8 -4
- package/engine/builder-operators/build.js.map +1 -1
- package/engine/builder-operators/compile.d.ts +1 -1
- package/engine/builder-operators/compile.js.map +1 -1
- package/engine/builder-operators/emit.d.ts +2 -2
- package/engine/builder-operators/emit.js.map +1 -1
- package/engine/builder-operators/post-build.d.ts +6 -0
- package/engine/builder-operators/post-build.js +23 -0
- package/engine/builder-operators/post-build.js.map +1 -0
- package/engine/builder-operators/post-process.d.ts +2 -2
- package/engine/builder-operators/post-process.js +4 -5
- package/engine/builder-operators/post-process.js.map +1 -1
- package/engine/builder-operators/task.d.ts +1 -1
- package/engine/builder-operators/task.js.map +1 -1
- package/engine/builder-operators/to-builder-output.d.ts +6 -0
- package/engine/builder-operators/to-builder-output.js +13 -0
- package/engine/builder-operators/to-builder-output.js.map +1 -0
- package/engine/entities/abstractions/entity.d.ts +11 -11
- package/engine/entities/abstractions/entity.js +2 -5
- package/engine/entities/abstractions/entity.js.map +1 -1
- package/engine/entities/abstractions/file.entity.d.ts +2 -2
- package/engine/entities/abstractions/file.entity.js.map +1 -1
- package/engine/entities/abstractions/module.entity.d.ts +1 -1
- package/engine/entities/abstractions/module.entity.js.map +1 -1
- package/engine/entities/abstractions/navigation.entity.d.ts +1 -1
- package/engine/entities/abstractions/navigation.entity.js.map +1 -1
- package/engine/entities/abstractions/route.entity.d.ts +3 -4
- package/engine/entities/abstractions/route.entity.js +2 -2
- package/engine/entities/abstractions/route.entity.js.map +1 -1
- package/engine/entities/api-list.entity.d.ts +20 -0
- package/engine/entities/api-list.entity.js +69 -0
- package/engine/entities/api-list.entity.js.map +1 -0
- package/engine/entities/api-page.entity.d.ts +2 -3
- package/engine/entities/api-page.entity.js +26 -28
- package/engine/entities/api-page.entity.js.map +1 -1
- package/engine/entities/api-scope.entity.d.ts +2 -3
- package/engine/entities/api-scope.entity.js +13 -7
- package/engine/entities/api-scope.entity.js.map +1 -1
- package/engine/entities/api.entity.d.ts +3 -4
- package/engine/entities/api.entity.js +26 -29
- package/engine/entities/api.entity.js.map +1 -1
- package/engine/entities/category.entity.d.ts +2 -3
- package/engine/entities/category.entity.js +11 -13
- package/engine/entities/category.entity.js.map +1 -1
- package/engine/entities/context.entity.d.ts +11 -0
- package/engine/entities/context.entity.js +34 -0
- package/engine/entities/context.entity.js.map +1 -0
- package/engine/entities/generated-module.entity.d.ts +12 -0
- package/engine/entities/generated-module.entity.js +52 -0
- package/engine/entities/generated-module.entity.js.map +1 -0
- package/engine/entities/index-file.entity.d.ts +12 -0
- package/engine/entities/index-file.entity.js +52 -0
- package/engine/entities/index-file.entity.js.map +1 -0
- package/engine/entities/index.d.ts +8 -1
- package/engine/entities/index.js +8 -1
- package/engine/entities/index.js.map +1 -1
- package/engine/entities/indexes.entity.d.ts +3 -4
- package/engine/entities/indexes.entity.js +12 -14
- package/engine/entities/indexes.entity.js.map +1 -1
- package/engine/entities/keywords.entity.d.ts +12 -0
- package/engine/entities/keywords.entity.js +32 -0
- package/engine/entities/keywords.entity.js.map +1 -0
- package/engine/entities/page-demo.entity.d.ts +20 -0
- package/engine/entities/page-demo.entity.js +87 -0
- package/engine/entities/page-demo.entity.js.map +1 -0
- package/engine/entities/page-playground.entity.d.ts +21 -0
- package/engine/entities/page-playground.entity.js +80 -0
- package/engine/entities/page-playground.entity.js.map +1 -0
- package/engine/entities/page.entity.d.ts +6 -18
- package/engine/entities/page.entity.js +39 -107
- package/engine/entities/page.entity.js.map +1 -1
- package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.d.ts +5 -0
- package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js +20 -0
- package/engine/entities/plugins/entity-plugins/add-to-dependencies.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/apply.plugin.d.ts +26 -0
- package/engine/entities/plugins/entity-plugins/apply.plugin.js +65 -0
- package/engine/entities/plugins/entity-plugins/apply.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.d.ts +6 -0
- package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js +23 -0
- package/engine/entities/plugins/entity-plugins/extract-snippets.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.d.ts +6 -0
- package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js +27 -0
- package/engine/entities/plugins/entity-plugins/fill-indexes.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/index.d.ts +9 -0
- package/engine/entities/plugins/entity-plugins/index.js +13 -0
- package/engine/entities/plugins/entity-plugins/index.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.d.ts +5 -0
- package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js +21 -0
- package/engine/entities/plugins/entity-plugins/markdown-to-html.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/post-process-html.plugin.d.ts +5 -0
- package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js +18 -0
- package/engine/entities/plugins/entity-plugins/post-process-html.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/process-html.plugin.d.ts +5 -0
- package/engine/entities/plugins/entity-plugins/process-html.plugin.js +18 -0
- package/engine/entities/plugins/entity-plugins/process-html.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/remove-lines.plugin.d.ts +6 -0
- package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js +23 -0
- package/engine/entities/plugins/entity-plugins/remove-lines.plugin.js.map +1 -0
- package/engine/entities/plugins/entity-plugins/wrap-code.plugin.d.ts +6 -0
- package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js +21 -0
- package/engine/entities/plugins/entity-plugins/wrap-code.plugin.js.map +1 -0
- package/engine/entities/plugins/helpers/execute-plugins.d.ts +10 -0
- package/engine/entities/plugins/helpers/execute-plugins.js +18 -0
- package/engine/entities/plugins/helpers/execute-plugins.js.map +1 -0
- package/engine/entities/plugins/helpers/index.d.ts +1 -0
- package/engine/entities/plugins/helpers/index.js +5 -0
- package/engine/entities/plugins/helpers/index.js.map +1 -0
- package/engine/entities/plugins/index.d.ts +3 -0
- package/engine/entities/plugins/index.js +7 -0
- package/engine/entities/plugins/index.js.map +1 -0
- package/engine/entities/plugins/types/entity-plugin.d.ts +5 -0
- package/engine/entities/plugins/types/entity-plugin.js +3 -0
- package/engine/entities/plugins/types/entity-plugin.js.map +1 -0
- package/engine/entities/plugins/types/index.d.ts +1 -0
- package/engine/entities/plugins/types/index.js +5 -0
- package/engine/entities/plugins/types/index.js.map +1 -0
- package/engine/entities/routes.entity.d.ts +11 -0
- package/engine/entities/routes.entity.js +34 -0
- package/engine/entities/routes.entity.js.map +1 -0
- package/engine/entity-store.d.ts +1 -0
- package/engine/entity-store.js +3 -0
- package/engine/entity-store.js.map +1 -1
- package/engine/nunjucks/filters.d.ts +2 -2
- package/engine/nunjucks/filters.js +3 -2
- package/engine/nunjucks/filters.js.map +1 -1
- package/engine/variables.d.ts +1 -0
- package/engine/variables.js +1 -0
- package/engine/variables.js.map +1 -1
- package/helpers/angular/get-component-assets.d.ts +8 -0
- package/helpers/angular/get-component-assets.js +15 -0
- package/helpers/angular/get-component-assets.js.map +1 -0
- package/helpers/angular/get-component-source-files.d.ts +7 -0
- package/helpers/angular/get-component-source-files.js +23 -0
- package/helpers/angular/get-component-source-files.js.map +1 -0
- package/helpers/angular/index.d.ts +2 -0
- package/helpers/angular/index.js +2 -0
- package/helpers/angular/index.js.map +1 -1
- package/helpers/build-file-assets.d.ts +7 -0
- package/helpers/build-file-assets.js +25 -0
- package/helpers/build-file-assets.js.map +1 -0
- package/helpers/build-file-entity.js +14 -1
- package/helpers/build-file-entity.js.map +1 -1
- package/helpers/demo/assets-from-component-asset.d.ts +6 -0
- package/helpers/demo/assets-from-component-asset.js +14 -0
- package/helpers/demo/assets-from-component-asset.js.map +1 -0
- package/helpers/demo/index.d.ts +1 -0
- package/helpers/demo/index.js +5 -0
- package/helpers/demo/index.js.map +1 -0
- package/helpers/emit-built-output.d.ts +2 -2
- package/helpers/emit-built-output.js.map +1 -1
- package/helpers/entity-type.d.ts +1 -1
- package/helpers/extract-docs.js +4 -4
- package/helpers/extract-docs.js.map +1 -1
- package/helpers/format-code.d.ts +1 -1
- package/helpers/format-code.js +14 -3
- package/helpers/format-code.js.map +1 -1
- package/helpers/get-code-type-from-lang.d.ts +6 -0
- package/helpers/get-code-type-from-lang.js +31 -0
- package/helpers/get-code-type-from-lang.js.map +1 -0
- package/helpers/get-demo-class-declarations.d.ts +1 -1
- package/helpers/get-demo-class-declarations.js +18 -7
- package/helpers/get-demo-class-declarations.js.map +1 -1
- package/helpers/index.d.ts +7 -3
- package/helpers/index.js +7 -3
- package/helpers/index.js.map +1 -1
- package/helpers/markdown-to-html.d.ts +10 -0
- package/helpers/{marked.js → markdown-to-html.js} +11 -8
- package/helpers/markdown-to-html.js.map +1 -0
- package/helpers/process-html.d.ts +3 -3
- package/helpers/process-html.js +14 -11
- package/helpers/process-html.js.map +1 -1
- package/helpers/process-legacy-snippets.d.ts +9 -0
- package/helpers/process-legacy-snippets.js +70 -0
- package/helpers/process-legacy-snippets.js.map +1 -0
- package/helpers/process-snippets.d.ts +5 -5
- package/helpers/process-snippets.js +63 -50
- package/helpers/process-snippets.js.map +1 -1
- package/helpers/remove-lines-from-code.d.ts +6 -0
- package/helpers/remove-lines-from-code.js +30 -0
- package/helpers/remove-lines-from-code.js.map +1 -0
- package/helpers/snippets-from-asset.d.ts +9 -0
- package/helpers/snippets-from-asset.js +26 -0
- package/helpers/snippets-from-asset.js.map +1 -0
- package/interfaces/asset.d.ts +5 -7
- package/interfaces/build-result.d.ts +10 -0
- package/{types/snippet-type.js → interfaces/build-result.js} +1 -1
- package/interfaces/build-result.js.map +1 -0
- package/interfaces/index.d.ts +3 -0
- package/interfaces/index.js +3 -0
- package/interfaces/index.js.map +1 -1
- package/interfaces/output.d.ts +1 -3
- package/interfaces/snippet-config.d.ts +8 -0
- package/interfaces/snippet-config.js +3 -0
- package/interfaces/snippet-config.js.map +1 -0
- package/interfaces/snippet.d.ts +5 -4
- package/operators/error-handler.d.ts +1 -1
- package/package.json +5 -5
- package/parsers/helpers/index.d.ts +3 -0
- package/parsers/helpers/index.js +7 -0
- package/parsers/helpers/index.js.map +1 -0
- package/parsers/helpers/number.d.ts +2 -0
- package/parsers/helpers/number.js +7 -0
- package/parsers/helpers/number.js.map +1 -0
- package/parsers/helpers/param-value.d.ts +2 -0
- package/parsers/helpers/param-value.js +8 -0
- package/parsers/helpers/param-value.js.map +1 -0
- package/parsers/helpers/param.d.ts +7 -0
- package/parsers/helpers/param.js +19 -0
- package/parsers/helpers/param.js.map +1 -0
- package/parsers/parse-code-block-params.js +8 -13
- package/parsers/parse-code-block-params.js.map +1 -1
- package/parsers/parse-snippet.d.ts +6 -0
- package/parsers/parse-snippet.js +27 -0
- package/parsers/parse-snippet.js.map +1 -0
- package/schematics/category/index.js +2 -1
- package/schematics/category/index.js.map +1 -1
- package/schematics/page/index.js +2 -1
- package/schematics/page/index.js.map +1 -1
- package/templates/demo-assets.ts.nunj +13 -4
- package/templates/page.module.ts.nunj +3 -2
- package/templates/parts/usage-notes.html.nunj +1 -1
- package/templates/playgrounds.ts.nunj +5 -7
- package/types/index.d.ts +0 -1
- package/types/index.js +0 -1
- package/types/index.js.map +1 -1
- package/engine/entities/skeleton.entity.d.ts +0 -16
- package/engine/entities/skeleton.entity.js +0 -44
- package/engine/entities/skeleton.entity.js.map +0 -1
- package/helpers/build-assets.d.ts +0 -10
- package/helpers/build-assets.js +0 -55
- package/helpers/build-assets.js.map +0 -1
- package/helpers/get-component-asset.d.ts +0 -10
- package/helpers/get-component-asset.js +0 -50
- package/helpers/get-component-asset.js.map +0 -1
- package/helpers/marked.d.ts +0 -9
- package/helpers/marked.js.map +0 -1
- package/types/snippet-type.d.ts +0 -1
- package/types/snippet-type.js.map +0 -1
package/helpers/format-code.js
CHANGED
|
@@ -10,8 +10,14 @@ exports.formatCode = void 0;
|
|
|
10
10
|
*/
|
|
11
11
|
function formatCode(code, codeType = 'TypeScript') {
|
|
12
12
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
if (codeType) {
|
|
14
|
+
const parser = getPrettierParserFromCodeType(codeType);
|
|
15
|
+
const config = require('prettier').resolveConfig.sync(process.cwd());
|
|
16
|
+
return require('prettier')
|
|
17
|
+
.format(code, Object.assign(Object.assign({}, config), { parser, embeddedLanguageFormatting: 'auto' }))
|
|
18
|
+
.trim();
|
|
19
|
+
}
|
|
20
|
+
return code.trim();
|
|
15
21
|
}
|
|
16
22
|
catch (e) {
|
|
17
23
|
return code;
|
|
@@ -31,8 +37,13 @@ function getPrettierParserFromCodeType(codeType) {
|
|
|
31
37
|
case 'SCSS':
|
|
32
38
|
case 'SASS':
|
|
33
39
|
return 'css';
|
|
40
|
+
case 'HTML':
|
|
41
|
+
return 'html';
|
|
42
|
+
case 'TypeScript':
|
|
43
|
+
case 'JavaScript':
|
|
44
|
+
return 'typescript';
|
|
34
45
|
default:
|
|
35
|
-
return
|
|
46
|
+
return undefined;
|
|
36
47
|
}
|
|
37
48
|
}
|
|
38
49
|
//# sourceMappingURL=format-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-code.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/format-code.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"format-code.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/format-code.ts"],"names":[],"mappings":";;;AAGA;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,WAAiC,YAAY;IACrF,IAAI;QACH,IAAI,QAAQ,EAAE;YACb,MAAM,MAAM,GAAkC,6BAA6B,CAAC,QAAQ,CAAC,CAAC;YACtF,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAErE,OAAO,OAAO,CAAC,UAAU,CAAC;iBACvB,MAAM,CAAC,IAAI,kCAAM,MAAM,KAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,IAAE;iBACrE,IAAI,EAAE,CAAA;SACT;QAED,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;KACnB;IAAC,OAAO,CAAC,EAAE;QACX,OAAO,IAAI,CAAC;KACZ;AACF,CAAC;AAfD,gCAeC;AAED;;;;;GAKG;AACH,SAAS,6BAA6B,CAAC,QAAuB;IAC7D,QAAQ,QAAQ,EAAE;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM,CAAC;QACZ,KAAK,MAAM;YACV,OAAO,KAAK,CAAC;QACd,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,YAAY,CAAC;QAClB,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB;YACC,OAAO,SAAS,CAAC;KAClB;AACF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCodeTypeFromLang = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param lang
|
|
7
|
+
*/
|
|
8
|
+
function getCodeTypeFromLang(lang) {
|
|
9
|
+
switch (lang) {
|
|
10
|
+
case 'css':
|
|
11
|
+
return 'CSS';
|
|
12
|
+
case 'less':
|
|
13
|
+
return 'LESS';
|
|
14
|
+
case 'scss':
|
|
15
|
+
return 'SCSS';
|
|
16
|
+
case 'sass':
|
|
17
|
+
return 'SASS';
|
|
18
|
+
case 'html':
|
|
19
|
+
return 'HTML';
|
|
20
|
+
case 'ts':
|
|
21
|
+
case 'typescript':
|
|
22
|
+
return 'TypeScript';
|
|
23
|
+
case 'js':
|
|
24
|
+
case 'javascript':
|
|
25
|
+
return 'JavaScript';
|
|
26
|
+
default:
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.getCodeTypeFromLang = getCodeTypeFromLang;
|
|
31
|
+
//# sourceMappingURL=get-code-type-from-lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-code-type-from-lang.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-code-type-from-lang.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC/C,QAAQ,IAAI,EAAE;QACb,KAAK,KAAK;YACT,OAAO,KAAK,CAAC;QACd,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,MAAM;YACV,OAAO,MAAM,CAAC;QACf,KAAK,IAAI,CAAC;QACV,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB,KAAK,IAAI,CAAC;QACV,KAAK,YAAY;YAChB,OAAO,YAAY,CAAC;QACrB;YACC,OAAO,IAAI,CAAC;KACb;AACF,CAAC;AArBD,kDAqBC"}
|
|
@@ -3,4 +3,4 @@ import { ClassDeclaration, ObjectLiteralExpression } from 'ts-morph';
|
|
|
3
3
|
*
|
|
4
4
|
* @param objectExpression
|
|
5
5
|
*/
|
|
6
|
-
export declare function getDemoClassDeclarations(objectExpression: ObjectLiteralExpression): ClassDeclaration
|
|
6
|
+
export declare function getDemoClassDeclarations(objectExpression: ObjectLiteralExpression): Record<string, ClassDeclaration>;
|
|
@@ -11,15 +11,26 @@ function getDemoClassDeclarations(objectExpression) {
|
|
|
11
11
|
const demoProperty = objectExpression.getProperty('demos');
|
|
12
12
|
if (demoProperty && (ts_morph_1.Node.isPropertyAssignment(demoProperty) || ts_morph_1.Node.isShorthandPropertyAssignment(demoProperty))) {
|
|
13
13
|
const initializer = demoProperty.getInitializer();
|
|
14
|
-
if (
|
|
15
|
-
return initializer
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.
|
|
19
|
-
|
|
14
|
+
if (ts_morph_1.Node.isObjectLiteralExpression(initializer)) {
|
|
15
|
+
return initializer.getProperties().reduce((acc, property) => {
|
|
16
|
+
var _a;
|
|
17
|
+
const classDeclaration = (_a = property.getType().getSymbol()) === null || _a === void 0 ? void 0 : _a.getValueDeclaration();
|
|
18
|
+
if (ts_morph_1.Node.isClassDeclaration(classDeclaration)) {
|
|
19
|
+
if (ts_morph_1.Node.isShorthandPropertyAssignment(property) && classDeclaration.getName()) {
|
|
20
|
+
const className = classDeclaration.getName();
|
|
21
|
+
if ((0, core_1.isPresent)(className)) {
|
|
22
|
+
acc[className] = classDeclaration;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (ts_morph_1.Node.isPropertyAssignment(property)) {
|
|
26
|
+
acc[property.getName()] = classDeclaration;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return acc;
|
|
30
|
+
}, {});
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
|
-
return
|
|
33
|
+
return {};
|
|
23
34
|
}
|
|
24
35
|
exports.getDemoClassDeclarations = getDemoClassDeclarations;
|
|
25
36
|
//# sourceMappingURL=get-demo-class-declarations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-demo-class-declarations.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-demo-class-declarations.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAA+G;AAE/G;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,gBAAyC;IACjF,MAAM,YAAY,GAAyC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEjG,IAAI,YAAY,IAAI,CAAC,eAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,IAAI,eAAI,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,EAAE;QAClH,MAAM,WAAW,GAA2B,YAAY,CAAC,cAAc,EAAE,CAAC;QAE1E,IAAI,
|
|
1
|
+
{"version":3,"file":"get-demo-class-declarations.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/get-demo-class-declarations.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,uCAA+G;AAE/G;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,gBAAyC;IACjF,MAAM,YAAY,GAAyC,gBAAgB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEjG,IAAI,YAAY,IAAI,CAAC,eAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,IAAI,eAAI,CAAC,6BAA6B,CAAC,YAAY,CAAC,CAAC,EAAE;QAClH,MAAM,WAAW,GAA2B,YAAY,CAAC,cAAc,EAAE,CAAC;QAE1E,IAAI,eAAI,CAAC,yBAAyB,CAAC,WAAW,CAAC,EAAE;YAChD,OAAO,WAAW,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,CAAC,GAAqC,EAAE,QAAQ,EAAE,EAAE;;gBAC7F,MAAM,gBAAgB,GAAG,MAAA,QAAQ,CAAC,OAAO,EAAE,CAAC,SAAS,EAAE,0CAAE,mBAAmB,EAAE,CAAC;gBAE/E,IAAI,eAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE;oBAC9C,IAAI,eAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,OAAO,EAAE,EAAE;wBAC/E,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,CAAC;wBAE7C,IAAI,IAAA,gBAAS,EAAC,SAAS,CAAC,EAAE;4BACzB,GAAG,CAAC,SAAS,CAAC,GAAG,gBAAgB,CAAC;yBAClC;qBACD;yBAAM,IAAI,eAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE;wBAC/C,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,gBAAgB,CAAC;qBAC3C;iBACD;gBAED,OAAO,GAAG,CAAC;YACZ,CAAC,EAAE,EAAE,CAAC,CAAC;SACP;KACD;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AA5BD,4DA4BC"}
|
package/helpers/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export * from './angular';
|
|
2
|
-
export * from './build-assets';
|
|
3
2
|
export * from './build-entity-keyword';
|
|
3
|
+
export * from './build-file-assets';
|
|
4
4
|
export * from './build-file-entity';
|
|
5
5
|
export * from './code-type-from-ext';
|
|
6
6
|
export * from './create-builder-context';
|
|
7
7
|
export * from './declaration-folder-name';
|
|
8
|
+
export * from './demo';
|
|
8
9
|
export * from './emit-built-output';
|
|
9
10
|
export * from './entity-type';
|
|
10
11
|
export * from './extract-docs';
|
|
@@ -13,7 +14,7 @@ export * from './extract-selectors';
|
|
|
13
14
|
export * from './filter-useless-members';
|
|
14
15
|
export * from './format-code';
|
|
15
16
|
export * from './generate-api-entities';
|
|
16
|
-
export * from './get-
|
|
17
|
+
export * from './get-code-type-from-lang';
|
|
17
18
|
export * from './get-declaration-type';
|
|
18
19
|
export * from './get-demo-class-declarations';
|
|
19
20
|
export * from './get-entity-constructor';
|
|
@@ -24,7 +25,7 @@ export * from './import-es-module';
|
|
|
24
25
|
export * from './is-not-excluded-path';
|
|
25
26
|
export * from './is-supported-declaration';
|
|
26
27
|
export * from './keyword-key';
|
|
27
|
-
export * from './
|
|
28
|
+
export * from './markdown-to-html';
|
|
28
29
|
export * from './mini-pattern';
|
|
29
30
|
export * from './no-empty';
|
|
30
31
|
export * from './no-line-breaks';
|
|
@@ -33,9 +34,12 @@ export * from './playground';
|
|
|
33
34
|
export * from './presentation';
|
|
34
35
|
export * from './print';
|
|
35
36
|
export * from './process-html';
|
|
37
|
+
export * from './process-legacy-snippets';
|
|
36
38
|
export * from './process-snippets';
|
|
39
|
+
export * from './remove-lines-from-code';
|
|
37
40
|
export * from './repo-link';
|
|
38
41
|
export * from './slash';
|
|
42
|
+
export * from './snippets-from-asset';
|
|
39
43
|
export * from './sort-navigation-entities';
|
|
40
44
|
export * from './string-expression';
|
|
41
45
|
export * from './to-template-string';
|
package/helpers/index.js
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./angular"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./build-assets"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./build-entity-keyword"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./build-file-assets"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./build-file-entity"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./code-type-from-ext"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./create-builder-context"), exports);
|
|
10
10
|
tslib_1.__exportStar(require("./declaration-folder-name"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./demo"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./emit-built-output"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./entity-type"), exports);
|
|
13
14
|
tslib_1.__exportStar(require("./extract-docs"), exports);
|
|
@@ -16,7 +17,7 @@ tslib_1.__exportStar(require("./extract-selectors"), exports);
|
|
|
16
17
|
tslib_1.__exportStar(require("./filter-useless-members"), exports);
|
|
17
18
|
tslib_1.__exportStar(require("./format-code"), exports);
|
|
18
19
|
tslib_1.__exportStar(require("./generate-api-entities"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./get-
|
|
20
|
+
tslib_1.__exportStar(require("./get-code-type-from-lang"), exports);
|
|
20
21
|
tslib_1.__exportStar(require("./get-declaration-type"), exports);
|
|
21
22
|
tslib_1.__exportStar(require("./get-demo-class-declarations"), exports);
|
|
22
23
|
tslib_1.__exportStar(require("./get-entity-constructor"), exports);
|
|
@@ -27,7 +28,7 @@ tslib_1.__exportStar(require("./import-es-module"), exports);
|
|
|
27
28
|
tslib_1.__exportStar(require("./is-not-excluded-path"), exports);
|
|
28
29
|
tslib_1.__exportStar(require("./is-supported-declaration"), exports);
|
|
29
30
|
tslib_1.__exportStar(require("./keyword-key"), exports);
|
|
30
|
-
tslib_1.__exportStar(require("./
|
|
31
|
+
tslib_1.__exportStar(require("./markdown-to-html"), exports);
|
|
31
32
|
tslib_1.__exportStar(require("./mini-pattern"), exports);
|
|
32
33
|
tslib_1.__exportStar(require("./no-empty"), exports);
|
|
33
34
|
tslib_1.__exportStar(require("./no-line-breaks"), exports);
|
|
@@ -36,9 +37,12 @@ tslib_1.__exportStar(require("./playground"), exports);
|
|
|
36
37
|
tslib_1.__exportStar(require("./presentation"), exports);
|
|
37
38
|
tslib_1.__exportStar(require("./print"), exports);
|
|
38
39
|
tslib_1.__exportStar(require("./process-html"), exports);
|
|
40
|
+
tslib_1.__exportStar(require("./process-legacy-snippets"), exports);
|
|
39
41
|
tslib_1.__exportStar(require("./process-snippets"), exports);
|
|
42
|
+
tslib_1.__exportStar(require("./remove-lines-from-code"), exports);
|
|
40
43
|
tslib_1.__exportStar(require("./repo-link"), exports);
|
|
41
44
|
tslib_1.__exportStar(require("./slash"), exports);
|
|
45
|
+
tslib_1.__exportStar(require("./snippets-from-asset"), exports);
|
|
42
46
|
tslib_1.__exportStar(require("./sort-navigation-entities"), exports);
|
|
43
47
|
tslib_1.__exportStar(require("./string-expression"), exports);
|
|
44
48
|
tslib_1.__exportStar(require("./to-template-string"), exports);
|
package/helpers/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,iEAAuC;AACvC,8DAAoC;AACpC,8DAAoC;AACpC,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,iDAAuB;AACvB,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,wDAA8B;AAC9B,kEAAwC;AACxC,oEAA0C;AAC1C,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,0DAAgC;AAChC,6DAAmC;AACnC,iEAAuC;AACvC,qEAA2C;AAC3C,wDAA8B;AAC9B,6DAAmC;AACnC,yDAA+B;AAC/B,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,uDAA6B;AAC7B,yDAA+B;AAC/B,kDAAwB;AACxB,yDAA+B;AAC/B,oEAA0C;AAC1C,6DAAmC;AACnC,mEAAyC;AACzC,sDAA4B;AAC5B,kDAAwB;AACxB,gEAAsC;AACtC,qEAA2C;AAC3C,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.markdownToHtml = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const builder_1 = require("@ng-doc/builder");
|
|
6
6
|
const core_1 = require("@ng-doc/core");
|
|
@@ -8,6 +8,7 @@ const fs = tslib_1.__importStar(require("fs"));
|
|
|
8
8
|
const marked_1 = require("marked");
|
|
9
9
|
const node_os_1 = require("node:os");
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
|
+
const remove_lines_from_code_1 = require("./remove-lines-from-code");
|
|
11
12
|
const NOTE_ANCHOR = '<p><strong>Note</strong>';
|
|
12
13
|
const WARNING_ANCHOR = '<p><strong>Warning</strong>';
|
|
13
14
|
/**
|
|
@@ -16,22 +17,24 @@ const WARNING_ANCHOR = '<p><strong>Warning</strong>';
|
|
|
16
17
|
* @param markdown
|
|
17
18
|
* @param contextFolder
|
|
18
19
|
* @param page
|
|
20
|
+
* @param context
|
|
21
|
+
* @param addDependency
|
|
19
22
|
*/
|
|
20
|
-
function
|
|
23
|
+
function markdownToHtml(markdown, context, addDependency) {
|
|
21
24
|
const renderer = {
|
|
22
25
|
code(code, lang) {
|
|
23
26
|
var _a;
|
|
24
27
|
const { language, file, name, highlightedLines, fileLineStart, fileLineEnd, group, active, icon, } = (0, builder_1.parseCodeBlockParams)((_a = lang === null || lang === void 0 ? void 0 : lang.trim()) !== null && _a !== void 0 ? _a : 'typescript');
|
|
25
|
-
if (file &&
|
|
26
|
-
const relativeFilePath = path.join(
|
|
28
|
+
if (file && context) {
|
|
29
|
+
const relativeFilePath = path.join(context, file);
|
|
27
30
|
const fileContent = fs
|
|
28
31
|
.readFileSync(relativeFilePath !== null && relativeFilePath !== void 0 ? relativeFilePath : '', 'utf8')
|
|
29
32
|
.split(node_os_1.EOL)
|
|
30
33
|
.slice(fileLineStart, fileLineEnd)
|
|
31
34
|
.join(node_os_1.EOL)
|
|
32
35
|
.trim();
|
|
33
|
-
|
|
34
|
-
code = fileContent;
|
|
36
|
+
addDependency && addDependency(relativeFilePath);
|
|
37
|
+
code = (0, remove_lines_from_code_1.removeLinesFromCode)(fileContent);
|
|
35
38
|
}
|
|
36
39
|
const codeElement = `<pre><code class="language-${language !== null && language !== void 0 ? language : 'ts'}"
|
|
37
40
|
lang="${language}"
|
|
@@ -55,5 +58,5 @@ function marked(markdown, page) {
|
|
|
55
58
|
marked_1.marked.use({ renderer });
|
|
56
59
|
return marked_1.marked.parse(markdown, { headerIds: false });
|
|
57
60
|
}
|
|
58
|
-
exports.
|
|
59
|
-
//# sourceMappingURL=
|
|
61
|
+
exports.markdownToHtml = markdownToHtml;
|
|
62
|
+
//# sourceMappingURL=markdown-to-html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-to-html.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/markdown-to-html.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NgDocEntity } from '../engine/entities/abstractions/entity';
|
|
2
2
|
/**
|
|
3
3
|
* Processes html content for the current entity
|
|
4
4
|
*
|
|
5
5
|
* @param entity - The current entity
|
|
6
6
|
* @param html - The html content to process
|
|
7
7
|
*/
|
|
8
|
-
export declare function processHtml(
|
|
8
|
+
export declare function processHtml(html: string, entity: NgDocEntity): Promise<string>;
|
|
9
9
|
/**
|
|
10
10
|
* Post-Processes html content for the current entity
|
|
11
11
|
*
|
|
12
12
|
* @param entity - The current entity
|
|
13
13
|
* @param html - The html content to process
|
|
14
14
|
*/
|
|
15
|
-
export declare function postProcessHtml(
|
|
15
|
+
export declare function postProcessHtml(html: string, entity?: NgDocEntity): Promise<string>;
|
package/helpers/process-html.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.postProcessHtml = exports.processHtml = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@ng-doc/core");
|
|
6
|
+
const entity_type_1 = require("./entity-type");
|
|
5
7
|
const import_es_module_1 = require("./import-es-module");
|
|
6
8
|
/**
|
|
7
9
|
* Processes html content for the current entity
|
|
@@ -9,15 +11,15 @@ const import_es_module_1 = require("./import-es-module");
|
|
|
9
11
|
* @param entity - The current entity
|
|
10
12
|
* @param html - The html content to process
|
|
11
13
|
*/
|
|
12
|
-
function processHtml(
|
|
13
|
-
var _a;
|
|
14
|
+
function processHtml(html, entity) {
|
|
15
|
+
var _a, _b;
|
|
14
16
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
17
|
const utils = yield (0, import_es_module_1.importEsModule)('@ng-doc/utils');
|
|
16
18
|
return utils.htmlProcessor(html, {
|
|
17
|
-
headings: (_a = entity.context.config.guide) === null || _a === void 0 ? void 0 : _a.anchorHeadings,
|
|
18
|
-
route: entity.fullRoute,
|
|
19
|
-
raiseError: entity.warnings.push.bind(entity.warnings),
|
|
20
|
-
addAnchor: (anchor) => entity.anchors.push(anchor),
|
|
19
|
+
headings: (_a = entity === null || entity === void 0 ? void 0 : entity.context.config.guide) === null || _a === void 0 ? void 0 : _a.anchorHeadings,
|
|
20
|
+
route: (0, entity_type_1.isRouteEntity)(entity) ? entity.fullRoute : undefined,
|
|
21
|
+
raiseError: (_b = entity === null || entity === void 0 ? void 0 : entity.warnings.push.bind(entity.warnings)) !== null && _b !== void 0 ? _b : core_1.EMPTY_FUNCTION,
|
|
22
|
+
addAnchor: (anchor) => ((0, entity_type_1.isRouteEntity)(entity) ? entity.anchors.push(anchor) : undefined),
|
|
21
23
|
});
|
|
22
24
|
});
|
|
23
25
|
}
|
|
@@ -28,14 +30,15 @@ exports.processHtml = processHtml;
|
|
|
28
30
|
* @param entity - The current entity
|
|
29
31
|
* @param html - The html content to process
|
|
30
32
|
*/
|
|
31
|
-
function postProcessHtml(
|
|
33
|
+
function postProcessHtml(html, entity) {
|
|
34
|
+
var _a;
|
|
32
35
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
33
36
|
const utils = yield (0, import_es_module_1.importEsModule)('@ng-doc/utils');
|
|
34
37
|
return utils.htmlPostProcessor(html, {
|
|
35
|
-
raiseError: entity.warnings.push.bind(entity.warnings),
|
|
36
|
-
addUsedKeyword: entity.usedKeywords.add.bind(entity.usedKeywords),
|
|
37
|
-
addPotentialKeyword: entity.potentialKeywords.add.bind(entity.potentialKeywords),
|
|
38
|
-
getKeyword: entity.store.getByKeyword.bind(entity.store),
|
|
38
|
+
raiseError: (_a = entity === null || entity === void 0 ? void 0 : entity.warnings.push.bind(entity.warnings)) !== null && _a !== void 0 ? _a : core_1.EMPTY_FUNCTION,
|
|
39
|
+
addUsedKeyword: entity === null || entity === void 0 ? void 0 : entity.usedKeywords.add.bind(entity.usedKeywords),
|
|
40
|
+
addPotentialKeyword: entity === null || entity === void 0 ? void 0 : entity.potentialKeywords.add.bind(entity.potentialKeywords),
|
|
41
|
+
getKeyword: entity === null || entity === void 0 ? void 0 : entity.store.getByKeyword.bind(entity.store),
|
|
39
42
|
});
|
|
40
43
|
});
|
|
41
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-html.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/process-html.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"process-html.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/process-html.ts"],"names":[],"mappings":";;;;AAAA,uCAA+D;AAG/D,+CAA4C;AAC5C,yDAAkD;AAIlD;;;;;GAKG;AACH,SAAsB,WAAW,CAAC,IAAY,EAAE,MAAmB;;;QAClE,MAAM,KAAK,GAAU,MAAM,IAAA,iCAAc,EAAQ,eAAe,CAAC,CAAC;QAElE,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,EAAE;YAChC,QAAQ,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CAAC,MAAM,CAAC,KAAK,0CAAE,cAAc;YACtD,KAAK,EAAE,IAAA,2BAAa,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YAC3D,UAAU,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAI,qBAAc;YACzE,SAAS,EAAE,CAAC,MAAyB,EAAE,EAAE,CAAC,CAAC,IAAA,2BAAa,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;SAC3G,CAAC,CAAC;;CACH;AATD,kCASC;AAED;;;;;GAKG;AACH,SAAsB,eAAe,CAAC,IAAY,EAAE,MAAoB;;;QACvE,MAAM,KAAK,GAAU,MAAM,IAAA,iCAAc,EAAQ,eAAe,CAAC,CAAC;QAElE,OAAO,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE;YACpC,UAAU,EAAE,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAI,qBAAc;YACzE,cAAc,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAClE,mBAAmB,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC;YACjF,UAAU,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;SACzD,CAAC,CAAC;;CACH;AATD,0CASC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NgDocSnippet } from '../interfaces/snippet';
|
|
2
|
+
/**
|
|
3
|
+
* Finds and return all the snippets in the given string.
|
|
4
|
+
*
|
|
5
|
+
* @deprecated - Use `processSnippets` instead
|
|
6
|
+
* @param content - Content
|
|
7
|
+
* @returns - Array of snippets
|
|
8
|
+
*/
|
|
9
|
+
export declare function processLegacySnippets(content: string): NgDocSnippet[];
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processLegacySnippets = void 0;
|
|
4
|
+
const escape_regexp_1 = require("@ng-doc/core/helpers/escape-regexp");
|
|
5
|
+
const HTMLSnippetStart = /^.*(<!--\s*NgDocHTMLSnippetStart(\(.+\))?\s*-->).*$/gm;
|
|
6
|
+
const StylesSnippetStart = /^.*(\/\*\s*NgDocStyleSnippetStart(\(.+\))?\s*\*\/).*$/gm;
|
|
7
|
+
const TypeScriptSnippetStart = /^.*(\/\*\s*NgDocCodeSnippetStart(\(.+\))?\s*\*\/).*$/gm;
|
|
8
|
+
const HTMLSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(<!--\\s*NgDocHTMLSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*-->).*$`, 'gm');
|
|
9
|
+
const StylesSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(\\/\\*\\s*NgDocStyleSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*\\*\\/).*$`, 'gm');
|
|
10
|
+
const TypeScriptSnippetEnd = (group = '', escape = true) => new RegExp(`^.*(\\/\\*\\s*NgDocCodeSnippetEnd(\\(${escape ? (0, escape_regexp_1.escapeRegexp)(group) : group}\\))?\\s*\\*\\/).*$`, 'gm');
|
|
11
|
+
/**
|
|
12
|
+
* Finds and return all the snippets in the given string.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated - Use `processSnippets` instead
|
|
15
|
+
* @param content - Content
|
|
16
|
+
* @returns - Array of snippets
|
|
17
|
+
*/
|
|
18
|
+
function processLegacySnippets(content) {
|
|
19
|
+
return [
|
|
20
|
+
...findSnippet(content, 'HTML', HTMLSnippetStart, HTMLSnippetEnd),
|
|
21
|
+
...findSnippet(content, 'styles', StylesSnippetStart, StylesSnippetEnd),
|
|
22
|
+
...findSnippet(content, 'TypeScript', TypeScriptSnippetStart, TypeScriptSnippetEnd),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
exports.processLegacySnippets = processLegacySnippets;
|
|
26
|
+
/**
|
|
27
|
+
* Finds the snippets in the given content.
|
|
28
|
+
*
|
|
29
|
+
* @param content - Content
|
|
30
|
+
* @param type - Snippet type
|
|
31
|
+
* @param snippetStart - Snippet start
|
|
32
|
+
* @param snippetEnd - Snippet end
|
|
33
|
+
*/
|
|
34
|
+
function findSnippet(content, type, snippetStart, snippetEnd) {
|
|
35
|
+
var _a;
|
|
36
|
+
const snippets = [];
|
|
37
|
+
const startRegexp = new RegExp(snippetStart);
|
|
38
|
+
let matchStart;
|
|
39
|
+
// eslint-disable-next-line no-cond-assign
|
|
40
|
+
while ((matchStart = startRegexp.exec(content))) {
|
|
41
|
+
const group = (_a = matchStart[2]) === null || _a === void 0 ? void 0 : _a.slice(1, matchStart[2].length - 1);
|
|
42
|
+
const matchEnd = snippetEnd(group).exec(content);
|
|
43
|
+
if (matchEnd) {
|
|
44
|
+
const snippetCode = content.slice(matchStart.index + matchStart[0].length, matchEnd.index).trim();
|
|
45
|
+
if (snippetCode) {
|
|
46
|
+
snippets.push({
|
|
47
|
+
code: removeSnippetsInCode(snippetCode),
|
|
48
|
+
title: group,
|
|
49
|
+
lang: type,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return snippets;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Removes the snippets from the given code.
|
|
58
|
+
*
|
|
59
|
+
* @param code - Code
|
|
60
|
+
*/
|
|
61
|
+
function removeSnippetsInCode(code) {
|
|
62
|
+
return code
|
|
63
|
+
.replace(HTMLSnippetStart, '')
|
|
64
|
+
.replace(StylesSnippetStart, '')
|
|
65
|
+
.replace(TypeScriptSnippetStart, '')
|
|
66
|
+
.replace(HTMLSnippetEnd('.*', false), '')
|
|
67
|
+
.replace(StylesSnippetEnd('.*', false), '')
|
|
68
|
+
.replace(TypeScriptSnippetEnd('.*', false), '');
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=process-legacy-snippets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-legacy-snippets.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/process-legacy-snippets.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { NgDocSnippet } from '../interfaces
|
|
1
|
+
import { NgDocSnippet } from '../interfaces';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Process snippets from code
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @
|
|
5
|
+
* @param code - code to process
|
|
6
|
+
* @param basePath - base path to file
|
|
7
7
|
*/
|
|
8
|
-
export declare function processSnippets(
|
|
8
|
+
export declare function processSnippets(code: string, basePath?: string): NgDocSnippet[];
|
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processSnippets = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@ng-doc/core");
|
|
6
|
+
const fs = tslib_1.__importStar(require("fs"));
|
|
7
|
+
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
+
const parse_snippet_1 = require("../parsers/parse-snippet");
|
|
9
|
+
const format_code_1 = require("./format-code");
|
|
10
|
+
const get_code_type_from_lang_1 = require("./get-code-type-from-lang");
|
|
11
|
+
const snippet = (id) => id
|
|
12
|
+
? new RegExp(`\\n?\\r?^.*((\\/\\/|<!--|\\/\\*)\\s*)(snippet#${(0, core_1.escapeRegexp)(id)}.*?(?=(-->|\\*\\/)?))\\s*(-->|\\*\\/)?$`, 'gm')
|
|
13
|
+
: new RegExp(`\\n?\\r?^.*((\\/\\/|<!--|\\/\\*)\\s*)(snippet.*?(?=(-->|\\*\\/)?))\\s*(-->|\\*\\/)?$`, 'gm');
|
|
11
14
|
/**
|
|
12
|
-
*
|
|
15
|
+
* Process snippets from code
|
|
13
16
|
*
|
|
14
|
-
* @param
|
|
15
|
-
* @
|
|
17
|
+
* @param code - code to process
|
|
18
|
+
* @param basePath - base path to file
|
|
16
19
|
*/
|
|
17
|
-
function processSnippets(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
exports.processSnippets = processSnippets;
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* @param content
|
|
28
|
-
* @param type
|
|
29
|
-
* @param snippetStart
|
|
30
|
-
* @param snippetEnd
|
|
31
|
-
*/
|
|
32
|
-
function findSnippet(content, type, snippetStart, snippetEnd) {
|
|
33
|
-
let snippetCounter = 0;
|
|
34
|
-
const snippets = [];
|
|
35
|
-
const startRegexp = new RegExp(snippetStart);
|
|
36
|
-
let matchStart;
|
|
20
|
+
function processSnippets(code, basePath) {
|
|
21
|
+
var _a;
|
|
22
|
+
const result = [];
|
|
23
|
+
const endings = new Set();
|
|
24
|
+
const startRegexp = snippet();
|
|
25
|
+
let match;
|
|
37
26
|
// eslint-disable-next-line no-cond-assign
|
|
38
|
-
while ((
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
while ((match = startRegexp.exec(code))) {
|
|
28
|
+
const isHTMLComment = match[2] === '<!--';
|
|
29
|
+
if (((_a = match[3]) === null || _a === void 0 ? void 0 : _a.includes('snippet-from-file=')) && basePath) {
|
|
30
|
+
const config = (0, parse_snippet_1.parseSnippet)(match[3].trim());
|
|
31
|
+
if (config) {
|
|
32
|
+
const { title, lang, icon, opened, fromFile } = config;
|
|
33
|
+
const language = lang || (isHTMLComment ? 'html' : 'ts');
|
|
34
|
+
if (fromFile) {
|
|
35
|
+
const snippetCode = fs.readFileSync(path_1.default.join(basePath, fromFile), 'utf-8');
|
|
36
|
+
result.push({
|
|
37
|
+
title: title !== null && title !== void 0 ? title : path_1.default.basename(fromFile),
|
|
38
|
+
lang: language,
|
|
39
|
+
icon,
|
|
40
|
+
opened,
|
|
41
|
+
code: (0, format_code_1.formatCode)(removeSnippets(snippetCode), (0, get_code_type_from_lang_1.getCodeTypeFromLang)(language)).trim(),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (!endings.has(match.index)) {
|
|
47
|
+
const config = (0, parse_snippet_1.parseSnippet)(match[3].trim());
|
|
48
|
+
if (config) {
|
|
49
|
+
const { id, title, lang, icon, opened } = config;
|
|
50
|
+
const endRegexp = snippet(id);
|
|
51
|
+
endRegexp.lastIndex = match.index + match[0].length;
|
|
52
|
+
const matchEnd = endRegexp.exec(code);
|
|
53
|
+
if (matchEnd) {
|
|
54
|
+
endings.add(matchEnd.index);
|
|
55
|
+
const snippetCode = code.slice(match.index + match[0].length, matchEnd.index);
|
|
56
|
+
const language = lang || (isHTMLComment ? 'html' : 'ts');
|
|
57
|
+
if (snippetCode) {
|
|
58
|
+
result.push({
|
|
59
|
+
title,
|
|
60
|
+
lang: language,
|
|
61
|
+
icon,
|
|
62
|
+
opened,
|
|
63
|
+
code: (0, format_code_1.formatCode)(removeSnippets(snippetCode), (0, get_code_type_from_lang_1.getCodeTypeFromLang)(language)).trim(),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
49
67
|
}
|
|
50
68
|
}
|
|
51
69
|
}
|
|
52
|
-
return
|
|
70
|
+
return result;
|
|
53
71
|
}
|
|
72
|
+
exports.processSnippets = processSnippets;
|
|
54
73
|
/**
|
|
55
74
|
*
|
|
56
75
|
* @param code
|
|
57
76
|
*/
|
|
58
|
-
function
|
|
59
|
-
return code
|
|
60
|
-
.replace(HTMLSnippetStart, '')
|
|
61
|
-
.replace(StylesSnippetStart, '')
|
|
62
|
-
.replace(TypeScriptSnippetStart, '')
|
|
63
|
-
.replace(HTMLSnippetEnd('.*', false), '')
|
|
64
|
-
.replace(StylesSnippetEnd('.*', false), '')
|
|
65
|
-
.replace(TypeScriptSnippetEnd('.*', false), '');
|
|
77
|
+
function removeSnippets(code) {
|
|
78
|
+
return code.replace(snippet(), '');
|
|
66
79
|
}
|
|
67
80
|
//# sourceMappingURL=process-snippets.js.map
|