@ng-doc/builder 15.11.3 → 15.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,30 +5,53 @@ const tslib_1 = require("tslib");
5
5
  const core_1 = require("@ng-doc/core");
6
6
  const glob = tslib_1.__importStar(require("glob"));
7
7
  const engine_1 = require("../engine");
8
- const is_not_excluded_path_1 = require("./is-not-excluded-path");
9
8
  const is_supported_declaration_1 = require("./is-supported-declaration");
10
9
  /**
11
10
  *
12
11
  * @param apiRootEntity
13
12
  */
14
13
  function generateApiEntities(apiRootEntity) {
15
- var _a;
14
+ var _a, _b;
16
15
  const result = [];
17
- (_a = apiRootEntity.target) === null || _a === void 0 ? void 0 : _a.scopes.forEach((scope) => {
16
+ const scopes = new Map();
17
+ const duplicatesInScope = new Map();
18
+ const paths = (_b = (_a = apiRootEntity.target) === null || _a === void 0 ? void 0 : _a.scopes.map((scope) => {
18
19
  const scopeEntity = new engine_1.NgDocApiScopeEntity(apiRootEntity.builder, apiRootEntity.sourceFile, apiRootEntity.context, apiRootEntity, scope);
20
+ const files = (0, core_1.asArray)(scope.include)
21
+ .map((i) => glob.sync(i, {
22
+ ignore: scope.exclude,
23
+ absolute: true,
24
+ }))
25
+ .flat();
26
+ files.forEach((f) => scopes.set(f, scopeEntity));
19
27
  result.push(scopeEntity);
20
- (0, core_1.asArray)(scope.include).forEach((include) => (0, core_1.asArray)(new Set(apiRootEntity.builder.project
21
- .addSourceFilesAtPaths(glob.sync(include).filter((p) => (0, is_not_excluded_path_1.isNotExcludedPath)(p, (0, core_1.asArray)(scope.exclude))))
22
- .map((sourceFile) => (0, core_1.asArray)(sourceFile.getExportedDeclarations().values()))
23
- .flat(2)))
24
- .filter(is_supported_declaration_1.isSupportedDeclaration)
25
- .forEach((declaration, _i, declarations) => {
26
- const name = declaration.getName();
27
- const duplicates = declarations.filter((d) => d.getName() === name && d.getKindName() === declaration.getKindName());
28
- if (name) {
29
- result.push(new engine_1.NgDocApiPageEntity(apiRootEntity.builder, declaration.getSourceFile(), apiRootEntity.context, scopeEntity, name, duplicates.indexOf(declaration)));
28
+ return files;
29
+ }).flat()) !== null && _b !== void 0 ? _b : [];
30
+ apiRootEntity.builder.project
31
+ .addSourceFilesAtPaths(paths)
32
+ .map((sourceFile) => sourceFile.getExportedDeclarations())
33
+ .reduce((acc, declarations) => {
34
+ declarations.forEach((value, key) => {
35
+ const existing = acc.get(key);
36
+ const supported = value.filter(is_supported_declaration_1.isSupportedDeclaration);
37
+ existing ? acc.set(key, (0, core_1.asArray)(new Set(existing.concat(supported)))) : acc.set(key, supported);
38
+ });
39
+ return acc;
40
+ }, new Map())
41
+ .forEach((declarations, name) => {
42
+ declarations.forEach((declaration) => {
43
+ var _a, _b;
44
+ const sourceFile = declaration.getSourceFile();
45
+ const scope = scopes.get(sourceFile.getFilePath());
46
+ if (scope) {
47
+ const duplicates = (_a = duplicatesInScope.get(scope)) !== null && _a !== void 0 ? _a : new Map();
48
+ const count = (_b = duplicates.get(name)) !== null && _b !== void 0 ? _b : 0;
49
+ const page = new engine_1.NgDocApiPageEntity(apiRootEntity.builder, sourceFile, apiRootEntity.context, scope, name, count);
50
+ duplicates.set(name, count + 1);
51
+ duplicatesInScope.set(scope, duplicates);
52
+ result.push(page);
30
53
  }
31
- }));
54
+ });
32
55
  });
33
56
  return result;
34
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate-api-entities.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/generate-api-entities.ts"],"names":[],"mappings":";;;;AAAA,uCAAoD;AACpD,mDAA6B;AAG7B,sCAAkF;AAElF,iEAAyD;AACzD,yEAAkE;AAElE;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,aAA6B;;IAChE,MAAM,MAAM,GAAoD,EAAE,CAAC;IAEnE,MAAA,aAAa,CAAC,MAAM,0CAAE,MAAM,CAAC,OAAO,CAAC,CAAC,KAAoB,EAAE,EAAE;QAC7D,MAAM,WAAW,GAA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AC,WAAW,CAAC,CAC/B,CACD,CAAC;aACF;QACF,CAAC,CACD,CACF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AACf,CAAC;AAxDD,kDAwDC"}
1
+ {"version":3,"file":"generate-api-entities.js","sourceRoot":"","sources":["../../../../libs/builder/helpers/generate-api-entities.ts"],"names":[],"mappings":";;;;AAAA,uCAAoD;AACpD,mDAA6B;AAG7B,sCAAkF;AAElF,yEAAkE;AAElE;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,aAA6B;;IAChE,MAAM,MAAM,GAAoD,EAAE,CAAC;IACnE,MAAM,MAAM,GAAqC,IAAI,GAAG,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAkD,IAAI,GAAG,EAAE,CAAC;IAEnF,MAAM,KAAK,GACV,MAAA,MAAA,aAAa,CAAC,MAAM,0CAAE,MAAM,CAC1B,GAAG,CAAC,CAAC,KAAoB,EAAE,EAAE;QAC7B,MAAM,WAAW,GAAwB,IAAI,4BAAmB,CAC/D,aAAa,CAAC,OAAO,EACrB,aAAa,CAAC,UAAU,EACxB,aAAa,CAAC,OAAO,EACrB,aAAa,EACb,KAAK,CACL,CAAC;QACF,MAAM,KAAK,GAAa,IAAA,cAAO,EAAC,KAAK,CAAC,OAAO,CAAC;aAC5C,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAClB,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE;YACZ,MAAM,EAAE,KAAK,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI;SACd,CAAC,CACF;aACA,IAAI,EAAE,CAAC;QAET,KAAK,CAAC,OAAO,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;QAEzD,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEzB,OAAO,KAAK,CAAC;IACd,CAAC,EACA,IAAI,EAAE,mCAAI,EAAE,CAAC;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,2BAAkB,CACtD,aAAa,CAAC,OAAO,EACrB,UAAU,EACV,aAAa,CAAC,OAAO,EACrB,KAAK,EACL,IAAI,EACJ,KAAK,CACL,CAAC;gBAEF,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;gBAChC,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;gBAEzC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAClB;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEJ,OAAO,MAAM,CAAC;AACf,CAAC;AA3ED,kDA2EC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ng-doc/builder",
3
- "version": "15.11.3",
3
+ "version": "15.12.0",
4
4
  "type": "commonjs",
5
5
  "builders": "./builders.json",
6
6
  "schematics": "./schematics/collection.json",
7
7
  "dependencies": {
8
- "@ng-doc/core": "15.11.3",
9
- "@ng-doc/utils": "15.11.3",
8
+ "@ng-doc/core": "15.12.0",
9
+ "@ng-doc/utils": "15.12.0",
10
10
  "@angular-devkit/architect": ">=0.1500.0",
11
11
  "chokidar": "3.5.3",
12
12
  "minimatch": "5.1.0",