()
| 445 | } |
| 446 | |
| 447 | driveIndexer(): Map<DeclarationNode, IndexedComponent<DeclarationNode>> { |
| 448 | if (isNgpTestMode()) { |
| 449 | const {rootNames, options} = readNgcCommandLineAndConfiguration(this.commandLineArgs); |
| 450 | const tsconfigPath = this.fs.resolve(this.basePath, 'tsconfig.json'); |
| 451 | const result = performNgpCompilationSync({ |
| 452 | fs: this.fs, |
| 453 | basePath: this.basePath, |
| 454 | tsconfigPath, |
| 455 | rootNames, |
| 456 | options, |
| 457 | emit: false, |
| 458 | closeAnalyzer: false, |
| 459 | }); |
| 460 | try { |
| 461 | const rawIndexed = runNgpSync( |
| 462 | result.compiler.getIndexedComponents(), |
| 463 | result.compiler.analyzer, |
| 464 | ); |
| 465 | const out = new Map<DeclarationNode, IndexedComponent<DeclarationNode>>(); |
| 466 | for (const [, comp] of rawIndexed.entries()) { |
| 467 | const fsFileUrl = this.fs.resolve(comp.fileUrl); |
| 468 | const sf = |
| 469 | result.originalSourceFiles.get(fsFileUrl) ?? result.tsProgram.getSourceFile(fsFileUrl); |
| 470 | if (!sf) continue; |
| 471 | let classDecl: DeclarationNode | undefined; |
| 472 | for (const stmt of sf.statements) { |
| 473 | if (ts.isClassDeclaration(stmt) && stmt.name?.text === comp.name) { |
| 474 | classDecl = stmt; |
| 475 | break; |
| 476 | } |
| 477 | } |
| 478 | if (!classDecl) continue; |
| 479 | const fsTemplateFileUrl = this.fs.resolve(comp.template.fileUrl); |
| 480 | out.set(classDecl, { |
| 481 | ...comp, |
| 482 | fileUrl: fsFileUrl, |
| 483 | template: { |
| 484 | ...comp.template, |
| 485 | fileUrl: fsTemplateFileUrl, |
| 486 | }, |
| 487 | } as unknown as IndexedComponent<DeclarationNode>); |
| 488 | } |
| 489 | return out; |
| 490 | } finally { |
| 491 | result.compiler.analyzer.close(); |
| 492 | } |
| 493 | } |
| 494 | const {rootNames, options} = readNgcCommandLineAndConfiguration(this.commandLineArgs); |
| 495 | const host = createCompilerHost({options}); |
| 496 | const program = createProgram({rootNames, host, options}); |
| 497 | return (program as NgtscProgram).getIndexedComponents(); |
| 498 | } |
| 499 | |
| 500 | driveDocsExtraction(entryPoint: string): DocEntry[] { |
| 501 | if (isNgpTestMode()) { |
no test coverage detected