@ng-doc/builder 16.2.1 → 16.3.0-beta.2

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.
Files changed (157) hide show
  1. package/engine/.cache/apps/ng-doc/src/app/pages/docs/api-documentation/ng-doc.category.js +1 -2
  2. package/engine/.cache/apps/ng-doc/src/app/pages/docs/api-documentation/templating/ng-doc.page.js +2 -3
  3. package/engine/.cache/apps/ng-doc/src/app/pages/docs/customization/layout/ng-doc.page.js +2 -3
  4. package/engine/.cache/apps/ng-doc/src/app/pages/docs/customization/ng-doc.category.js +1 -2
  5. package/engine/.cache/apps/ng-doc/src/app/pages/docs/customization/search/ng-doc.page.js +2 -3
  6. package/engine/.cache/apps/ng-doc/src/app/pages/docs/customization/themes/ng-doc.page.js +2 -3
  7. package/engine/.cache/apps/ng-doc/src/app/pages/docs/customization/type-controls/ng-doc.page.js +2 -3
  8. package/engine/.cache/apps/ng-doc/src/app/pages/docs/develop/ng-doc.page.js +2 -3
  9. package/engine/.cache/apps/ng-doc/src/app/pages/docs/features/cache/ng-doc.page.js +2 -3
  10. package/engine/.cache/apps/ng-doc/src/app/pages/docs/features/keywords/ng-doc.page.js +2 -3
  11. package/engine/.cache/apps/ng-doc/src/app/pages/docs/features/ng-doc.category.js +1 -2
  12. package/engine/.cache/apps/ng-doc/src/app/pages/docs/file-entities/api/ng-doc.page.js +2 -3
  13. package/engine/.cache/apps/ng-doc/src/app/pages/docs/file-entities/category/ng-doc.page.js +2 -3
  14. package/engine/.cache/apps/ng-doc/src/app/pages/docs/file-entities/ng-doc.category.js +1 -2
  15. package/engine/.cache/apps/ng-doc/src/app/pages/docs/file-entities/page/ng-doc.page.js +2 -3
  16. package/engine/.cache/apps/ng-doc/src/app/pages/docs/getting-started/configuration/ng-doc.page.js +2 -3
  17. package/engine/.cache/apps/ng-doc/src/app/pages/docs/getting-started/installation/ng-doc.page.js +2 -3
  18. package/engine/.cache/apps/ng-doc/src/app/pages/docs/{file-entities/dependencies → getting-started/migrations}/ng-doc.page.js +11 -15
  19. package/engine/.cache/apps/ng-doc/src/app/pages/docs/getting-started/ng-doc.category.js +1 -2
  20. package/engine/.cache/apps/ng-doc/src/app/pages/docs/getting-started/what-is-ng-doc/ng-doc.page.js +2 -3
  21. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/demo/ng-doc.page.js +2 -3
  22. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/demo-pane/ng-doc.page.js +2 -3
  23. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/ng-doc.category.js +1 -2
  24. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/playground/ng-doc.page.js +2 -3
  25. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/snippets/ng-doc.page.js +2 -3
  26. package/engine/.cache/apps/ng-doc/src/app/pages/docs/guides/templating/ng-doc.page.js +2 -3
  27. package/engine/.cache/apps/ng-doc/src/app/pages/docs/ng-doc.api.js +2 -4
  28. package/engine/actions/playground.action.js +5 -9
  29. package/engine/actions/playground.action.js.map +1 -1
  30. package/engine/builder.js +10 -20
  31. package/engine/builder.js.map +1 -1
  32. package/engine/entities/abstractions/file.entity.d.ts +2 -0
  33. package/engine/entities/abstractions/file.entity.js +3 -9
  34. package/engine/entities/abstractions/file.entity.js.map +1 -1
  35. package/engine/entities/abstractions/source-file.entity.d.ts +1 -7
  36. package/engine/entities/abstractions/source-file.entity.js +0 -12
  37. package/engine/entities/abstractions/source-file.entity.js.map +1 -1
  38. package/engine/entities/index.d.ts +0 -1
  39. package/engine/entities/index.js +0 -1
  40. package/engine/entities/index.js.map +1 -1
  41. package/engine/entities/page.entity.d.ts +26 -11
  42. package/engine/entities/page.entity.js +88 -22
  43. package/engine/entities/page.entity.js.map +1 -1
  44. package/engine/renderer.js +4 -2
  45. package/engine/renderer.js.map +1 -1
  46. package/engine/template-filters.d.ts +1 -1
  47. package/engine/template-filters.js +2 -1
  48. package/engine/template-filters.js.map +1 -1
  49. package/engine/variables.d.ts +3 -1
  50. package/engine/variables.js +4 -2
  51. package/engine/variables.js.map +1 -1
  52. package/helpers/angular/component-decorator.d.ts +8 -0
  53. package/helpers/angular/component-decorator.js +30 -0
  54. package/helpers/angular/component-decorator.js.map +1 -0
  55. package/helpers/angular/directive-decorator.d.ts +8 -0
  56. package/helpers/angular/directive-decorator.js +26 -0
  57. package/helpers/angular/directive-decorator.js.map +1 -0
  58. package/helpers/angular/index.d.ts +3 -0
  59. package/helpers/angular/index.js +7 -0
  60. package/helpers/angular/index.js.map +1 -0
  61. package/helpers/angular/is-standalone.d.ts +7 -0
  62. package/helpers/angular/is-standalone.js +16 -0
  63. package/helpers/angular/is-standalone.js.map +1 -0
  64. package/helpers/build-file-entity.d.ts +9 -0
  65. package/helpers/build-file-entity.js +68 -0
  66. package/helpers/build-file-entity.js.map +1 -0
  67. package/helpers/entity-type.d.ts +1 -6
  68. package/helpers/entity-type.js +1 -9
  69. package/helpers/entity-type.js.map +1 -1
  70. package/helpers/extract-selectors.js +4 -8
  71. package/helpers/extract-selectors.js.map +1 -1
  72. package/helpers/get-component-asset.js +3 -6
  73. package/helpers/get-component-asset.js.map +1 -1
  74. package/helpers/get-demo-class-declarations.js +2 -3
  75. package/helpers/get-demo-class-declarations.js.map +1 -1
  76. package/helpers/get-entity-constructor.js +0 -3
  77. package/helpers/get-entity-constructor.js.map +1 -1
  78. package/helpers/get-playground-by-id.js.map +1 -1
  79. package/helpers/get-playground-targets.d.ts +6 -0
  80. package/helpers/get-playground-targets.js +21 -0
  81. package/helpers/get-playground-targets.js.map +1 -0
  82. package/helpers/get-playgrounds-expression.d.ts +7 -0
  83. package/helpers/get-playgrounds-expression.js +23 -0
  84. package/helpers/get-playgrounds-expression.js.map +1 -0
  85. package/helpers/get-playgrounds-ids.d.ts +6 -0
  86. package/helpers/get-playgrounds-ids.js +17 -0
  87. package/helpers/get-playgrounds-ids.js.map +1 -0
  88. package/helpers/index.d.ts +5 -1
  89. package/helpers/index.js +5 -1
  90. package/helpers/index.js.map +1 -1
  91. package/{resolvers/string-expression.resolver.d.ts → helpers/string-expression.d.ts} +2 -2
  92. package/{resolvers/string-expression.resolver.js → helpers/string-expression.js} +5 -5
  93. package/helpers/string-expression.js.map +1 -0
  94. package/helpers/typescript/create-project.js +1 -5
  95. package/helpers/typescript/create-project.js.map +1 -1
  96. package/helpers/typescript/declaration-import.d.ts +6 -0
  97. package/helpers/typescript/declaration-import.js +20 -0
  98. package/helpers/typescript/declaration-import.js.map +1 -0
  99. package/helpers/typescript/get-object-expression-from-default.d.ts +7 -0
  100. package/helpers/typescript/get-object-expression-from-default.js +19 -0
  101. package/helpers/typescript/get-object-expression-from-default.js.map +1 -0
  102. package/helpers/typescript/index.d.ts +2 -0
  103. package/helpers/typescript/index.js +2 -0
  104. package/helpers/typescript/index.js.map +1 -1
  105. package/helpers/typescript/property/get-property-assignment.js.map +1 -0
  106. package/helpers/typescript/property/index.d.ts +1 -0
  107. package/helpers/typescript/property/index.js +1 -0
  108. package/helpers/typescript/property/index.js.map +1 -1
  109. package/interfaces/renderer-options.d.ts +1 -0
  110. package/package.json +4 -4
  111. package/schematics/category/index.js +3 -3
  112. package/schematics/category/index.js.map +1 -1
  113. package/schematics/category/schema.json +1 -1
  114. package/schematics/collection.json +4 -4
  115. package/schematics/migrations/standalone-pages/index.d.ts +8 -0
  116. package/schematics/migrations/standalone-pages/index.js +112 -0
  117. package/schematics/migrations/standalone-pages/index.js.map +1 -0
  118. package/schematics/migrations/standalone-pages/schema.d.ts +2 -0
  119. package/schematics/migrations/standalone-pages/schema.js.map +1 -0
  120. package/schematics/{dependencies → migrations/standalone-pages}/schema.json +2 -7
  121. package/schematics/page/files/ng-doc.page.ts.template +4 -2
  122. package/schematics/page/index.js +5 -6
  123. package/schematics/page/index.js.map +1 -1
  124. package/schematics/page/schema.d.ts +3 -4
  125. package/schematics/page/schema.json +4 -4
  126. package/schematics/utils/extract-default-export-name.d.ts +3 -1
  127. package/schematics/utils/extract-default-export-name.js +4 -5
  128. package/schematics/utils/extract-default-export-name.js.map +1 -1
  129. package/{helpers → schematics/utils}/find-closest-file.d.ts +3 -1
  130. package/{helpers → schematics/utils}/find-closest-file.js +4 -4
  131. package/schematics/utils/find-closest-file.js.map +1 -0
  132. package/schematics/utils/index.d.ts +1 -0
  133. package/schematics/utils/index.js +1 -0
  134. package/schematics/utils/index.js.map +1 -1
  135. package/templates/{component-assets.ts.nunj → demo-assets.ts.nunj} +2 -2
  136. package/templates/page.module.ts.nunj +18 -20
  137. package/templates/playgrounds.ts.nunj +17 -7
  138. package/engine/entities/dependencies.entity.d.ts +0 -31
  139. package/engine/entities/dependencies.entity.js +0 -155
  140. package/engine/entities/dependencies.entity.js.map +0 -1
  141. package/helpers/find-closest-file.js.map +0 -1
  142. package/resolvers/common/get-property-assignment.js.map +0 -1
  143. package/resolvers/component-decorator.resolver.d.ts +0 -9
  144. package/resolvers/component-decorator.resolver.js +0 -23
  145. package/resolvers/component-decorator.resolver.js.map +0 -1
  146. package/resolvers/string-expression.resolver.js.map +0 -1
  147. package/schematics/dependencies/files/ng-doc.dependencies.ts.template +0 -10
  148. package/schematics/dependencies/files/ng-doc.module.ts.template +0 -9
  149. package/schematics/dependencies/index.d.ts +0 -9
  150. package/schematics/dependencies/index.js +0 -38
  151. package/schematics/dependencies/index.js.map +0 -1
  152. package/schematics/dependencies/schema.d.ts +0 -20
  153. package/schematics/dependencies/schema.js.map +0 -1
  154. package/schematics/page/files/ng-doc.dependencies.ts.template +0 -10
  155. /package/{resolvers/common → helpers/typescript/property}/get-property-assignment.d.ts +0 -0
  156. /package/{resolvers/common → helpers/typescript/property}/get-property-assignment.js +0 -0
  157. /package/schematics/{dependencies → migrations/standalone-pages}/schema.js +0 -0
package/helpers/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./angular"), exports);
4
5
  tslib_1.__exportStar(require("./build-assets"), exports);
6
+ tslib_1.__exportStar(require("./build-file-entity"), exports);
5
7
  tslib_1.__exportStar(require("./code-type-from-ext"), exports);
6
8
  tslib_1.__exportStar(require("./create-builder-context"), exports);
7
9
  tslib_1.__exportStar(require("./declaration-folder-name"), exports);
@@ -11,7 +13,6 @@ tslib_1.__exportStar(require("./extract-docs"), exports);
11
13
  tslib_1.__exportStar(require("./extract-path-anchor"), exports);
12
14
  tslib_1.__exportStar(require("./extract-selectors"), exports);
13
15
  tslib_1.__exportStar(require("./filter-useless-members"), exports);
14
- tslib_1.__exportStar(require("./find-closest-file"), exports);
15
16
  tslib_1.__exportStar(require("./format-code"), exports);
16
17
  tslib_1.__exportStar(require("./generate-api-entities"), exports);
17
18
  tslib_1.__exportStar(require("./get-component-asset"), exports);
@@ -23,6 +24,8 @@ tslib_1.__exportStar(require("./get-kind-type"), exports);
23
24
  tslib_1.__exportStar(require("./get-page-type"), exports);
24
25
  tslib_1.__exportStar(require("./get-playground-by-id"), exports);
25
26
  tslib_1.__exportStar(require("./get-playground-properties"), exports);
27
+ tslib_1.__exportStar(require("./get-playground-targets"), exports);
28
+ tslib_1.__exportStar(require("./get-playgrounds-ids"), exports);
26
29
  tslib_1.__exportStar(require("./import-es-module"), exports);
27
30
  tslib_1.__exportStar(require("./is-not-excluded-path"), exports);
28
31
  tslib_1.__exportStar(require("./is-supported-declaration"), exports);
@@ -37,6 +40,7 @@ tslib_1.__exportStar(require("./process-snippets"), exports);
37
40
  tslib_1.__exportStar(require("./repo-link"), exports);
38
41
  tslib_1.__exportStar(require("./slash"), exports);
39
42
  tslib_1.__exportStar(require("./sort-navigation-entities"), exports);
43
+ tslib_1.__exportStar(require("./string-expression"), exports);
40
44
  tslib_1.__exportStar(require("./to-template-string"), exports);
41
45
  tslib_1.__exportStar(require("./typescript"), exports);
42
46
  tslib_1.__exportStar(require("./unique-name"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,8DAAoC;AACpC,wDAA8B;AAC9B,kEAAwC;AACxC,gEAAsC;AACtC,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,0DAAgC;AAChC,iEAAuC;AACvC,sEAA4C;AAC5C,6DAAmC;AACnC,iEAAuC;AACvC,qEAA2C;AAC3C,mDAAyB;AACzB,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,yDAA+B;AAC/B,2DAAiC;AACjC,yDAA+B;AAC/B,6DAAmC;AACnC,sDAA4B;AAC5B,kDAAwB;AACxB,qEAA2C;AAC3C,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,yDAA+B;AAC/B,8DAAoC;AACpC,+DAAqC;AACrC,mEAAyC;AACzC,oEAA0C;AAC1C,8DAAoC;AACpC,wDAA8B;AAC9B,yDAA+B;AAC/B,gEAAsC;AACtC,8DAAoC;AACpC,mEAAyC;AACzC,wDAA8B;AAC9B,kEAAwC;AACxC,gEAAsC;AACtC,iEAAuC;AACvC,wEAA8C;AAC9C,mEAAyC;AACzC,yEAA+C;AAC/C,0DAAgC;AAChC,0DAAgC;AAChC,iEAAuC;AACvC,sEAA4C;AAC5C,mEAAyC;AACzC,gEAAsC;AACtC,6DAAmC;AACnC,iEAAuC;AACvC,qEAA2C;AAC3C,mDAAyB;AACzB,qDAA2B;AAC3B,2DAAiC;AACjC,6DAAmC;AACnC,yDAA+B;AAC/B,2DAAiC;AACjC,yDAA+B;AAC/B,6DAAmC;AACnC,sDAA4B;AAC5B,kDAAwB;AACxB,qEAA2C;AAC3C,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,wDAA8B"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Run expression and return result
2
+ * Runs string expression and return result
3
3
  *
4
4
  * @param {string} expression - expression to run
5
5
  * @returns {T} result of expression
6
6
  * @template T
7
7
  */
8
- export declare function stringExpressionResolver<T>(expression: string): T;
8
+ export declare function stringExpression<T>(expression: string): T;
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringExpressionResolver = void 0;
3
+ exports.stringExpression = void 0;
4
4
  /**
5
- * Run expression and return result
5
+ * Runs string expression and return result
6
6
  *
7
7
  * @param {string} expression - expression to run
8
8
  * @returns {T} result of expression
9
9
  * @template T
10
10
  */
11
- function stringExpressionResolver(expression) {
11
+ function stringExpression(expression) {
12
12
  return new Function('return ' + expression)();
13
13
  }
14
- exports.stringExpressionResolver = stringExpressionResolver;
15
- //# sourceMappingURL=string-expression.resolver.js.map
14
+ exports.stringExpression = stringExpression;
15
+ //# sourceMappingURL=string-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-expression.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/string-expression.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAgB,gBAAgB,CAAI,UAAkB;IACrD,OAAO,IAAI,QAAQ,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC;AAC/C,CAAC;AAFD,4CAEC"}
@@ -1,10 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createProject = void 0;
4
- const tslib_1 = require("tslib");
5
- const path = tslib_1.__importStar(require("path"));
6
4
  const ts_morph_1 = require("ts-morph");
7
- const variables_1 = require("../../engine/variables");
8
5
  /**
9
6
  * Creates typescript project
10
7
  *
@@ -20,10 +17,9 @@ function createProject(options) {
20
17
  incremental: true,
21
18
  declaration: false,
22
19
  skipLibCheck: true,
23
- noEmit: true,
24
- tsBuildInfoFile: path.join(variables_1.CACHE_PATH, 'ng-doc.buildinfo.json'),
25
20
  moduleResolution: ts_morph_1.ModuleResolutionKind.NodeJs,
26
21
  isolatedModules: true,
22
+ noEmit: true,
27
23
  types: [],
28
24
  ...options === null || options === void 0 ? void 0 : options.compilerOptions,
29
25
  },
@@ -1 +1 @@
1
- {"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/create-project.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,uCAAmF;AAEnF,sDAAkD;AAElD;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAAwB;IACrD,OAAO,IAAI,kBAAO,CAAC;QAClB,GAAG,OAAO;QACV,eAAe,EAAE;YAChB,MAAM,EAAE,qBAAU,CAAC,QAAQ;YAC3B,SAAS,EAAE,KAAK;YAChB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,IAAI;YACZ,eAAe,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAU,EAAE,uBAAuB,CAAC;YAC/D,gBAAgB,EAAE,+BAAoB,CAAC,MAAM;YAC7C,eAAe,EAAE,IAAI;YACrB,KAAK,EAAE,EAAE;YACT,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe;SAC3B;QACD,2BAA2B,EAAE,IAAI;QACjC,4BAA4B,EAAE,KAAK;QACnC,mBAAmB,EAAE,KAAK;KAC1B,CAAC,CAAC;AACJ,CAAC;AApBD,sCAoBC"}
1
+ {"version":3,"file":"create-project.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/create-project.ts"],"names":[],"mappings":";;;AAAA,uCAAmF;AAEnF;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,OAAwB;IACrD,OAAO,IAAI,kBAAO,CAAC;QAClB,GAAG,OAAO;QACV,eAAe,EAAE;YAChB,MAAM,EAAE,qBAAU,CAAC,QAAQ;YAC3B,SAAS,EAAE,KAAK;YAChB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,KAAK;YAClB,YAAY,EAAE,IAAI;YAClB,gBAAgB,EAAE,+BAAoB,CAAC,MAAM;YAC7C,eAAe,EAAE,IAAI;YACrB,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE,EAAE;YACT,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe;SAC3B;QACD,2BAA2B,EAAE,IAAI;QACjC,4BAA4B,EAAE,KAAK;QACnC,mBAAmB,EAAE,KAAK;KAC1B,CAAC,CAAC;AACJ,CAAC;AAnBD,sCAmBC"}
@@ -0,0 +1,6 @@
1
+ import { NgDocSupportedDeclarations } from '../../types';
2
+ /**
3
+ *
4
+ * @param declaration
5
+ */
6
+ export declare function declarationImport(declaration: NgDocSupportedDeclarations): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.declarationImport = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path = tslib_1.__importStar(require("path"));
6
+ const variables_1 = require("../../engine/variables");
7
+ /**
8
+ *
9
+ * @param declaration
10
+ */
11
+ function declarationImport(declaration) {
12
+ if (declaration.isExported()) {
13
+ const filePath = declaration.getSourceFile().getFilePath();
14
+ const relativeImport = path.relative(variables_1.GLOBALS.workspaceRoot, filePath).replace(/.ts$/, '');
15
+ return `import {${declaration.getName()}} from '${relativeImport}';`;
16
+ }
17
+ return '';
18
+ }
19
+ exports.declarationImport = declarationImport;
20
+ //# sourceMappingURL=declaration-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declaration-import.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/declaration-import.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAE7B,sDAA+C;AAG/C;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,WAAuC;IACxE,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE;QAC7B,MAAM,QAAQ,GAAW,WAAW,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,CAAC;QACnE,MAAM,cAAc,GAAW,IAAI,CAAC,QAAQ,CAAC,mBAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAElG,OAAO,WAAW,WAAW,CAAC,OAAO,EAAE,WAAW,cAAc,IAAI,CAAC;KACrE;IAED,OAAO,EAAE,CAAC;AACX,CAAC;AATD,8CASC"}
@@ -0,0 +1,7 @@
1
+ import { ObjectLiteralExpression, SourceFile } from 'ts-morph';
2
+ /**
3
+ * Returns object expression from default export in the current sourceFile
4
+ *
5
+ * @param sourceFile - source file to get object expression from
6
+ */
7
+ export declare function getObjectExpressionFromDefault(sourceFile: SourceFile): ObjectLiteralExpression | undefined;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getObjectExpressionFromDefault = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ /**
6
+ * Returns object expression from default export in the current sourceFile
7
+ *
8
+ * @param sourceFile - source file to get object expression from
9
+ */
10
+ function getObjectExpressionFromDefault(sourceFile) {
11
+ var _a, _b;
12
+ const defaultExport = (_b = (_a = sourceFile.getExportedDeclarations()) === null || _a === void 0 ? void 0 : _a.get('default')) === null || _b === void 0 ? void 0 : _b[0];
13
+ if (ts_morph_1.Node.isVariableDeclaration(defaultExport)) {
14
+ return defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.getFirstChildByKindOrThrow(ts_morph_1.SyntaxKind.ObjectLiteralExpression);
15
+ }
16
+ return undefined;
17
+ }
18
+ exports.getObjectExpressionFromDefault = getObjectExpressionFromDefault;
19
+ //# sourceMappingURL=get-object-expression-from-default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-object-expression-from-default.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/get-object-expression-from-default.ts"],"names":[],"mappings":";;;AAAA,uCAAqG;AAErG;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,UAAsB;;IACpE,MAAM,aAAa,GAAqC,MAAA,MAAA,UAAU,CAAC,uBAAuB,EAAE,0CAAE,GAAG,CAAC,SAAS,CAAC,0CAAG,CAAC,CAAC,CAAC;IAElH,IAAI,eAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,EAAE;QAC9C,OAAO,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,0BAA0B,CAAC,qBAAU,CAAC,uBAAuB,CAAC,CAAC;KACrF;IAED,OAAO,SAAS,CAAC;AAClB,CAAC;AARD,wEAQC"}
@@ -1,10 +1,12 @@
1
1
  export * from './accessor';
2
2
  export * from './class';
3
3
  export * from './create-project';
4
+ export * from './declaration-import';
4
5
  export * from './display-type';
5
6
  export * from './filter-by-scope';
6
7
  export * from './filter-by-static';
7
8
  export * from './first-node-with-comment';
9
+ export * from './get-object-expression-from-default';
8
10
  export * from './interface';
9
11
  export * from './member';
10
12
  export * from './method';
@@ -4,10 +4,12 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./accessor"), exports);
5
5
  tslib_1.__exportStar(require("./class"), exports);
6
6
  tslib_1.__exportStar(require("./create-project"), exports);
7
+ tslib_1.__exportStar(require("./declaration-import"), exports);
7
8
  tslib_1.__exportStar(require("./display-type"), exports);
8
9
  tslib_1.__exportStar(require("./filter-by-scope"), exports);
9
10
  tslib_1.__exportStar(require("./filter-by-static"), exports);
10
11
  tslib_1.__exportStar(require("./first-node-with-comment"), exports);
12
+ tslib_1.__exportStar(require("./get-object-expression-from-default"), exports);
11
13
  tslib_1.__exportStar(require("./interface"), exports);
12
14
  tslib_1.__exportStar(require("./member"), exports);
13
15
  tslib_1.__exportStar(require("./method"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,kDAAwB;AACxB,2DAAiC;AACjC,yDAA+B;AAC/B,4DAAkC;AAClC,6DAAmC;AACnC,oEAA0C;AAC1C,sDAA4B;AAC5B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,qDAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/helpers/typescript/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,kDAAwB;AACxB,2DAAiC;AACjC,+DAAqC;AACrC,yDAA+B;AAC/B,4DAAkC;AAClC,6DAAmC;AACnC,oEAA0C;AAC1C,+EAAqD;AACrD,sDAA4B;AAC5B,mDAAyB;AACzB,mDAAyB;AACzB,iDAAuB;AACvB,qDAA2B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-property-assignment.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/get-property-assignment.ts"],"names":[],"mappings":";;;AAAA,uCAAwD;AAExD;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,wBAAmD;;IACxF,OAAO,eAAI,CAAC,oBAAoB,CAAC,wBAAwB,CAAC;QACzD,CAAC,CAAC,MAAA,MAAA,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,cAAc,EAAE,0CAAE,OAAO,EAAE,mCAAI,EAAE;QAC7D,CAAC,CAAC,EAAE,CAAC;AACP,CAAC;AAJD,sDAIC"}
@@ -1,3 +1,4 @@
1
1
  export * from './get-class-properties';
2
2
  export * from './get-interface-properties';
3
+ export * from './get-property-assignment';
3
4
  export * from './get-property-chain';
@@ -3,5 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./get-class-properties"), exports);
5
5
  tslib_1.__exportStar(require("./get-interface-properties"), exports);
6
+ tslib_1.__exportStar(require("./get-property-assignment"), exports);
6
7
  tslib_1.__exportStar(require("./get-property-chain"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,qEAA2C;AAC3C,+DAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/builder/helpers/typescript/property/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,qEAA2C;AAC3C,oEAA0C;AAC1C,+DAAqC"}
@@ -3,4 +3,5 @@ export interface NgDocRendererOptions<T> {
3
3
  scope?: string;
4
4
  dependenciesStore?: ObservableSet<string>;
5
5
  context?: T;
6
+ filters?: boolean;
6
7
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@ng-doc/builder",
3
- "version": "16.2.1",
3
+ "version": "16.3.0-beta.2",
4
4
  "type": "commonjs",
5
5
  "builders": "./builders.json",
6
6
  "schematics": "./schematics/collection.json",
7
7
  "dependencies": {
8
- "@ng-doc/core": "16.2.1",
9
- "@ng-doc/utils": "16.2.1",
8
+ "@ng-doc/core": "16.3.0-beta.2",
9
+ "@ng-doc/utils": "16.3.0-beta.2",
10
10
  "@angular-devkit/architect": ">=0.1600.0",
11
11
  "chokidar": "3.5.3",
12
12
  "minimatch": "5.1.0",
13
13
  "rxjs": "^6.6.7",
14
- "ts-morph": "17.0.1",
14
+ "ts-morph": "18.0.0",
15
15
  "nunjucks": "3.2.4",
16
16
  "@orama/orama": "1.0.0-beta.16",
17
17
  "@orama/plugin-parsedoc": "1.0.0-beta.16",
@@ -5,7 +5,7 @@ const strings_1 = require("@angular-devkit/core/src/utils/strings");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
6
  const path_1 = require("path");
7
7
  const variables_1 = require("../../engine/variables");
8
- const find_closest_file_1 = require("../../helpers/find-closest-file");
8
+ const utils_1 = require("../utils");
9
9
  const extract_default_export_name_1 = require("../utils/extract-default-export-name");
10
10
  /**
11
11
  * Generates a NgDocCategory
@@ -17,9 +17,9 @@ function build(options) {
17
17
  return (host) => {
18
18
  const path = (0, path_1.join)(options.path, `/${(0, strings_1.dasherize)(options.title)}`);
19
19
  const closestCategoryFile = options.category
20
- ? (0, find_closest_file_1.findClosestFile)(options.path, variables_1.CATEGORY_NAME)
20
+ ? (0, utils_1.findClosestFile)(host, options.path, variables_1.CATEGORY_NAME)
21
21
  : null;
22
- const categoryConstantName = options.category && closestCategoryFile ? (0, extract_default_export_name_1.extractDefaultExportName)(closestCategoryFile) : null;
22
+ const categoryConstantName = options.category && closestCategoryFile ? (0, extract_default_export_name_1.extractDefaultExportName)(host, closestCategoryFile) : null;
23
23
  const categoryImportPath = closestCategoryFile
24
24
  ? (0, path_1.relative)(path, closestCategoryFile).replace(/.ts$/, '')
25
25
  : null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/schematics/category/index.ts"],"names":[],"mappings":";;;AAAA,oEAA2E;AAC3E,2DAYoC;AACpC,+BAAoC;AAEpC,sDAAqD;AACrD,uEAAgE;AAChE,sFAA8E;AAG9E;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,OAAiC;IACtD,OAAO,CAAC,IAAU,EAAE,EAAE;QACrB,MAAM,IAAI,GAAW,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAI,IAAA,mBAAS,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxE,MAAM,mBAAmB,GAAkB,OAAO,CAAC,QAAQ;YAC1D,CAAC,CAAC,IAAA,mCAAe,EAAC,OAAO,CAAC,IAAI,EAAE,yBAAa,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC;QACR,MAAM,oBAAoB,GACzB,OAAO,CAAC,QAAQ,IAAI,mBAAmB,CAAC,CAAC,CAAC,IAAA,sDAAwB,EAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChG,MAAM,kBA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-33,7 +33,7 @@
33
33
  "alias": "c"
34
34
  },
35
35
  "order": {
36
- "type": "boolean",
36
+ "type": "number",
37
37
  "description": "Order category in sidebar",
38
38
  "alias": "o"
39
39
  },
@@ -16,10 +16,10 @@
16
16
  "factory": "./api/index#build",
17
17
  "schema": "./api/schema.json"
18
18
  },
19
- "dependencies": {
20
- "description": "Generates NgDoc dependencies entity",
21
- "factory": "./dependencies/index#build",
22
- "schema": "./dependencies/schema.json"
19
+ "standalone-pages-migration": {
20
+ "description": "Moves all dependencies from ng-doc.dependencies.ts to ng-doc.page.ts",
21
+ "factory": "./migrations/standalone-pages/index#migrate",
22
+ "schema": "./migrations/standalone-pages/schema.json"
23
23
  }
24
24
  }
25
25
  }
@@ -0,0 +1,8 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { NgDocStandalonePagesSchema } from './schema';
3
+ /**
4
+ * Moves all dependencies from `ng-doc.dependencies.ts` to `ng-doc.page.ts` and removes the `ng-doc.dependencies.ts` file.
5
+ *
6
+ * @param options
7
+ */
8
+ export declare function migrate(options: NgDocStandalonePagesSchema): Rule;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrate = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ng_morph_1 = require("ng-morph");
6
+ const path = tslib_1.__importStar(require("path"));
7
+ /**
8
+ * Moves all dependencies from `ng-doc.dependencies.ts` to `ng-doc.page.ts` and removes the `ng-doc.dependencies.ts` file.
9
+ *
10
+ * @param options
11
+ */
12
+ function migrate(options) {
13
+ return (tree) => {
14
+ (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(tree, options.path, ['**/**/ng-doc.dependencies.ts', '**/**/ng-doc.page.ts']));
15
+ const sourceFiles = (0, ng_morph_1.getSourceFiles)('**/**/ng-doc.dependencies.ts');
16
+ for (const sourceFile of sourceFiles) {
17
+ const pageSourceFile = (0, ng_morph_1.getSourceFiles)(path.join(sourceFile.getDirectoryPath(), 'ng-doc.page.ts'))[0];
18
+ if (!pageSourceFile) {
19
+ continue;
20
+ }
21
+ const objectExpression = getObjectExpressionFromDefault(sourceFile);
22
+ const pageObjectExpression = getObjectExpressionFromDefault(pageSourceFile);
23
+ if (!objectExpression || !pageObjectExpression) {
24
+ continue;
25
+ }
26
+ migrateProperty(objectExpression, pageObjectExpression, 'module', 'imports', (initializer) => `[${initializer}]`);
27
+ migrateProperty(objectExpression, pageObjectExpression, 'demo', 'demos');
28
+ migrateProperty(objectExpression, pageObjectExpression, 'playgrounds');
29
+ sourceFile.delete();
30
+ }
31
+ (0, ng_morph_1.saveActiveProject)();
32
+ };
33
+ }
34
+ exports.migrate = migrate;
35
+ /**
36
+ *
37
+ * @param sourceFile
38
+ */
39
+ function getObjectExpressionFromDefault(sourceFile) {
40
+ var _a, _b;
41
+ const defaultExport = (_b = (_a = sourceFile.getExportedDeclarations()) === null || _a === void 0 ? void 0 : _a.get('default')) === null || _b === void 0 ? void 0 : _b[0];
42
+ if (ng_morph_1.Node.isVariableDeclaration(defaultExport)) {
43
+ return defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.getFirstChildByKindOrThrow(ng_morph_1.SyntaxKind.ObjectLiteralExpression);
44
+ }
45
+ return undefined;
46
+ }
47
+ /**
48
+ *
49
+ * @param original
50
+ * @param destination
51
+ * @param propertyName
52
+ * @param newPropertyName
53
+ * @param initializer
54
+ */
55
+ function migrateProperty(original, destination, propertyName, newPropertyName = propertyName, initializer = (initializer) => initializer) {
56
+ const sourceFile = original.getSourceFile();
57
+ const property = original.getProperty(propertyName);
58
+ sourceFile.getProject().manipulationSettings.set({
59
+ quoteKind: ng_morph_1.QuoteKind.Single,
60
+ });
61
+ if (property) {
62
+ if (ng_morph_1.Node.isPropertyAssignment(property) || ng_morph_1.Node.isShorthandPropertyAssignment(property)) {
63
+ if (ng_morph_1.Node.isPropertyAssignment(property)) {
64
+ const structure = property.getStructure();
65
+ destination.addProperty({
66
+ ...structure,
67
+ name: newPropertyName,
68
+ initializer: initializer(structure.initializer),
69
+ });
70
+ }
71
+ if (ng_morph_1.Node.isShorthandPropertyAssignment(property)) {
72
+ const structure = property.getStructure();
73
+ destination.addProperty({
74
+ ...structure,
75
+ name: newPropertyName,
76
+ });
77
+ }
78
+ const imports = sourceFile
79
+ .getImportDeclarations()
80
+ .filter((importDeclaration) => {
81
+ return (importDeclaration.getNamedImports().filter((importSpecifier) => {
82
+ return (importSpecifier
83
+ .getNameNode()
84
+ .findReferencesAsNodes()
85
+ .filter((node) => {
86
+ return isChildOf(node, property);
87
+ }).length > 0);
88
+ }).length > 0);
89
+ })
90
+ .flat();
91
+ destination
92
+ .getSourceFile()
93
+ .addImportDeclarations(imports.map((importDeclaration) => importDeclaration.getStructure()));
94
+ }
95
+ }
96
+ }
97
+ /**
98
+ *
99
+ * @param node
100
+ * @param parent
101
+ */
102
+ function isChildOf(node, parent) {
103
+ if (node === parent) {
104
+ return true;
105
+ }
106
+ const p = node.getParent();
107
+ if (p) {
108
+ return isChildOf(p, parent);
109
+ }
110
+ return false;
111
+ }
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/builder/schematics/migrations/standalone-pages/index.ts"],"names":[],"mappings":";;;;AACA,uCAakB;AAClB,mDAA6B;AAI7B;;;;GAIG;AACH,SAAgB,OAAO,CAAC,OAAmC;IAC1D,OAAO,CAAC,IAAU,EAAE,EAAE;QACrB,IAAA,2BAAgB,EAAC,IAAA,wBAAa,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,8BAA8B,EAAE,sBAAsB,CAAC,CAAC,CAAC,CAAC;QAE9G,MAAM,WAAW,GAAG,IAAA,yBAAc,EAAC,8BAA8B,CAAC,CAAC;QAEnE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACrC,MAAM,cAAc,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU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CACd,CAAC;gBACH,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CACb,CAAC;YACH,CAAC,CAAC;iBACD,IAAI,EAAE,CAAC;YAET,WAAW;iBACT,aAAa,EAAE;iBACf,qBAAqB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,iBAAoC,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;SACjH;KACD;AACF,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,IAAU,EAAE,MAAY;IAC1C,IAAI,IAAI,KAAK,MAAM,EAAE;QACpB,OAAO,IAAI,CAAC;KACZ;IAED,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAE3B,IAAI,CAAC,EAAE;QACN,OAAO,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;KAC5B;IAED,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { SchematicArgv } from '../../schematic-argv';
2
+ export type NgDocStandalonePagesSchema = SchematicArgv;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../libs/builder/schematics/migrations/standalone-pages/schema.ts"],"names":[],"mappings":""}
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "NgDocDependencies",
4
- "title": "NgDocDependencies schematic",
3
+ "$id": "StandalonePagesMigration",
4
+ "title": "StandalonePagesMigration schematic",
5
5
  "type": "object",
6
6
  "properties": {
7
- "module": {
8
- "type": "boolean",
9
- "description": "Should NgDoc generates module",
10
- "alias": "m"
11
- },
12
7
  "path": {
13
8
  "type": "string",
14
9
  "format": "path",
@@ -1,5 +1,6 @@
1
1
  import {NgDocPage} from '@ng-doc/core';<% if (importPath && categoryName) { %>
2
- import <%= categoryName %> from '<%= importPath %>';<% } %>
2
+ import <%= categoryName %> from '<%= importPath %>';<% } %><% if (module) { %>
3
+ import {<%= pageName %>Module} from './ng-doc.module';<% } %>
3
4
 
4
5
  const <%= pageName %>: NgDocPage = {
5
6
  title: `<%= title %>`,
@@ -7,7 +8,8 @@ const <%= pageName %>: NgDocPage = {
7
8
  route: `<%= route %>`,<% } %><% if (importPath && categoryName) { %>
8
9
  category: <%= categoryName %>,<% } %><% if (order) { %>
9
10
  order: <%= order %>,<% } %><% if (keyword) { %>
10
- keyword: `<%= keyword %>`,<% } %>
11
+ keyword: `<%= keyword %>`,<% } %><% if (module) { %>
12
+ imports: [<%= pageName %>Module],<% } %>
11
13
  };
12
14
 
13
15
  export default <%= pageName %>;
@@ -5,9 +5,9 @@ const strings_1 = require("@angular-devkit/core/src/utils/strings");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
6
  const path_1 = require("path");
7
7
  const variables_1 = require("../../engine/variables");
8
- const find_closest_file_1 = require("../../helpers/find-closest-file");
8
+ const utils_1 = require("../utils");
9
9
  const extract_default_export_name_1 = require("../utils/extract-default-export-name");
10
- const demoTemplates = ['ng-doc.module.ts.template', 'ng-doc.dependencies.ts.template'];
10
+ const demoTemplates = ['ng-doc.module.ts.template'];
11
11
  /**
12
12
  * Generates a NgDocPage
13
13
  *
@@ -18,17 +18,16 @@ function build(options) {
18
18
  return (host) => {
19
19
  const path = (0, path_1.join)(options.path, `/${(0, strings_1.dasherize)(options.title)}`);
20
20
  const closestCategoryFile = options.category
21
- ? (0, find_closest_file_1.findClosestFile)(options.path, variables_1.CATEGORY_NAME)
21
+ ? (0, utils_1.findClosestFile)(host, options.path, variables_1.CATEGORY_NAME)
22
22
  : null;
23
23
  const pageName = (0, strings_1.classify)(options.title + 'Page');
24
- const categoryConstantName = options.category && closestCategoryFile ? (0, extract_default_export_name_1.extractDefaultExportName)(closestCategoryFile) : null;
24
+ const categoryConstantName = options.category && closestCategoryFile ? (0, extract_default_export_name_1.extractDefaultExportName)(host, closestCategoryFile) : null;
25
25
  const categoryImportPath = closestCategoryFile
26
26
  ? (0, path_1.relative)(path, closestCategoryFile).replace(/.ts$/, '')
27
27
  : null;
28
28
  return (0, schematics_1.chain)([
29
29
  (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)('./files'), [
30
- (0, schematics_1.filter)((path) => (demoTemplates.includes((0, path_1.basename)(path)) && options.demo) ||
31
- !demoTemplates.includes((0, path_1.basename)(path))),
30
+ (0, schematics_1.filter)((path) => (demoTemplates.includes((0, path_1.basename)(path)) && options.module) || !demoTemplates.includes((0, path_1.basename)(path))),
32
31
  (0, schematics_1.applyTemplates)({
33
32
  ...options,
34
33
  categoryName: categoryConstantName,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/builder/schematics/page/index.ts"],"names":[],"mappings":";;;AAAA,oEAA2E;AAC3E,2DAaoC;AACpC,+BAA8C;AAE9C,sDAAqD;AACrD,uEAAgE;AAChE,sFAA8E;AAG9E,MAAM,aAAa,GAAa,CAAC,2BAA2B,EAAE,iCAAiC,CAAC,CAAC;AAEjG;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,OAA6B;IAClD,OAAO,CAAC,IAAU,EAAE,EAAE;QACrB,MAAM,IAAI,GAAW,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,IAAI,IAAA,mBAAS,EAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACxE,MAAM,mBAAmB,GAAkB,OAAO,CAAC,QAAQ;YAC1D,CAAC,CAAC,IAAA,mCAAe,EAAC,OAAO,CAAC,IAAI,EAAE,yBAAa,CAAC;YAC9C,CAAC,CAAC,IAAI,CAAC;QACR,MAAM,QAAQ,GAAW,IAAA,kBAAQ,EAAC,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC;QAC1D,MAAM,oBAAoB,GACzB,OAAO,CAAC,QAAQ,IAAI,mBAAmB,CAAC,CAAC,CAAC,IAAA,sDAAwB,EAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChG,MAAM,kBA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G,OAAO;oBACV,YAAY,EAAE,oBAAoB;oBAClC,UAAU,EAAE,kBAAkB;oBAC9B,QAAQ;oBACR,OAAO,EAAE,OAAO,CAAC,OAAO;iBACxB,CAAC;gBACF,IAAA,iBAAI,EAAC,IAAI,CAAC;gBACV,IAAA,oBAAO,EAAC,CAAC,SAAoB,EAAE,EAAE;oBAChC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;wBAChC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;qBAClD;oBACD,OAAO,SAAS,CAAC;gBAClB,CAAC,CAAC;aACF,CAAC,EACF,0BAAa,CAAC,SAAS,CACvB;SACD,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAvCD,sBAuCC"}
@@ -9,7 +9,7 @@ import { SchematicArgv } from '../schematic-argv';
9
9
  *
10
10
  * Here is an example showing how you can call a generator with all parameters
11
11
  * ```bash
12
- * ng g @ng-doc/builder:page MyPage -r custom-route -d -c -o 1
12
+ * ng g @ng-doc/builder:page MyPage -r custom-route -m -c -o 1
13
13
  * ```
14
14
  */
15
15
  export interface NgDocBuildPageSchema extends SchematicArgv {
@@ -26,10 +26,9 @@ export interface NgDocBuildPageSchema extends SchematicArgv {
26
26
  */
27
27
  order?: number;
28
28
  /**
29
- * Provide true if you are going to use demo, playground on the page,
30
- * then generator will generate module and dependencies file (alias is `-d`)
29
+ * Provide true if you need add module file for the page (alias is `-m`)
31
30
  */
32
- demo?: boolean;
31
+ module?: boolean;
33
32
  /**
34
33
  * If parameter was provided, generator will import first parent category automatically (alias is `-c`)
35
34
  */
@@ -27,10 +27,10 @@
27
27
  "description": "The route of the page",
28
28
  "alias": "r"
29
29
  },
30
- "demo": {
30
+ "module": {
31
31
  "type": "boolean",
32
- "description": "Generate module and page dependency file for demos.",
33
- "alias": "d"
32
+ "description": "Generate module for demos and playgrounds",
33
+ "alias": "m"
34
34
  },
35
35
  "category": {
36
36
  "type": "boolean",
@@ -38,7 +38,7 @@
38
38
  "alias": "c"
39
39
  },
40
40
  "order": {
41
- "type": "boolean",
41
+ "type": "number",
42
42
  "description": "Order page in sidebar",
43
43
  "alias": "o"
44
44
  }
@@ -1,7 +1,9 @@
1
+ import { Tree } from '@angular-devkit/schematics';
1
2
  /**
2
3
  * Extracts the category name from the given file path.
3
4
  *
5
+ * @param tree
4
6
  * @param {string} filePath The file path.
5
7
  * @returns {string | null} The category name.
6
8
  */
7
- export declare function extractDefaultExportName(filePath: string): string | null;
9
+ export declare function extractDefaultExportName(tree: Tree, filePath: string): string | null;
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractDefaultExportName = void 0;
4
- const tslib_1 = require("tslib");
5
- const fs = tslib_1.__importStar(require("fs"));
6
4
  /**
7
5
  * Extracts the category name from the given file path.
8
6
  *
7
+ * @param tree
9
8
  * @param {string} filePath The file path.
10
9
  * @returns {string | null} The category name.
11
10
  */
12
- function extractDefaultExportName(filePath) {
13
- if (fs.existsSync(filePath)) {
14
- const fileContent = fs.readFileSync(filePath, 'utf8');
11
+ function extractDefaultExportName(tree, filePath) {
12
+ if (tree.get(filePath)) {
13
+ const fileContent = tree.readText(filePath);
15
14
  const matchResult = /export\s*default\s*(\w*)/gm.exec(fileContent);
16
15
  return matchResult ? matchResult[1] : null;
17
16
  }