@angular/compiler-cli 9.0.0-rc.9 → 9.0.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.
Files changed (158) hide show
  1. package/ngcc/src/analysis/decoration_analyzer.d.ts +9 -23
  2. package/ngcc/src/analysis/decoration_analyzer.js +82 -144
  3. package/ngcc/src/analysis/migration_host.d.ts +5 -16
  4. package/ngcc/src/analysis/migration_host.js +20 -91
  5. package/ngcc/src/analysis/module_with_providers_analyzer.js +2 -2
  6. package/ngcc/src/analysis/ngcc_trait_compiler.d.ts +42 -0
  7. package/ngcc/src/analysis/ngcc_trait_compiler.js +107 -0
  8. package/ngcc/src/analysis/types.d.ts +6 -20
  9. package/ngcc/src/analysis/types.js +1 -1
  10. package/ngcc/src/analysis/util.d.ts +0 -5
  11. package/ngcc/src/analysis/util.js +2 -116
  12. package/ngcc/src/dependencies/dts_dependency_host.d.ts +5 -1
  13. package/ngcc/src/dependencies/dts_dependency_host.js +9 -2
  14. package/ngcc/src/dependencies/esm_dependency_host.d.ts +7 -0
  15. package/ngcc/src/dependencies/esm_dependency_host.js +29 -21
  16. package/ngcc/src/entry_point_finder/targeted_entry_point_finder.d.ts +2 -0
  17. package/ngcc/src/entry_point_finder/targeted_entry_point_finder.js +49 -9
  18. package/ngcc/src/execution/cluster/executor.d.ts +3 -1
  19. package/ngcc/src/execution/cluster/executor.js +11 -6
  20. package/ngcc/src/execution/cluster/package_json_updater.js +3 -2
  21. package/ngcc/src/execution/lock_file.d.ts +43 -0
  22. package/ngcc/src/execution/lock_file.js +129 -0
  23. package/ngcc/src/execution/single_process_executor.d.ts +3 -1
  24. package/ngcc/src/execution/single_process_executor.js +18 -15
  25. package/ngcc/src/host/commonjs_host.js +5 -4
  26. package/ngcc/src/host/esm2015_host.d.ts +3 -1
  27. package/ngcc/src/host/esm2015_host.js +40 -9
  28. package/ngcc/src/host/esm5_host.js +3 -1
  29. package/ngcc/src/host/umd_host.js +5 -4
  30. package/ngcc/src/main.js +62 -122
  31. package/ngcc/src/migrations/migration.d.ts +1 -0
  32. package/ngcc/src/migrations/migration.js +1 -1
  33. package/ngcc/src/packages/build_marker.d.ts +17 -8
  34. package/ngcc/src/packages/build_marker.js +61 -32
  35. package/ngcc/src/packages/entry_point_bundle.js +2 -2
  36. package/ngcc/src/rendering/dts_renderer.js +7 -4
  37. package/ngcc/src/rendering/renderer.js +4 -4
  38. package/ngcc/src/writing/cleaning/cleaning_strategies.d.ts +45 -0
  39. package/ngcc/src/writing/cleaning/cleaning_strategies.js +77 -0
  40. package/ngcc/src/writing/cleaning/package_cleaner.d.ts +39 -0
  41. package/ngcc/src/writing/cleaning/package_cleaner.js +125 -0
  42. package/ngcc/src/writing/cleaning/utils.d.ts +16 -0
  43. package/ngcc/src/writing/cleaning/utils.js +29 -0
  44. package/ngcc/src/writing/in_place_file_writer.d.ts +1 -0
  45. package/ngcc/src/writing/in_place_file_writer.js +3 -2
  46. package/ngcc/src/writing/new_entry_point_file_writer.d.ts +2 -0
  47. package/ngcc/src/writing/new_entry_point_file_writer.js +5 -4
  48. package/ngcc/src/writing/package_json_updater.d.ts +24 -10
  49. package/ngcc/src/writing/package_json_updater.js +53 -10
  50. package/package.json +5 -4
  51. package/src/ngtsc/annotations/src/component.d.ts +1 -1
  52. package/src/ngtsc/annotations/src/component.js +4 -3
  53. package/src/ngtsc/annotations/src/directive.js +4 -3
  54. package/src/ngtsc/annotations/src/injectable.js +2 -1
  55. package/src/ngtsc/annotations/src/ng_module.js +2 -1
  56. package/src/ngtsc/annotations/src/pipe.js +2 -1
  57. package/src/ngtsc/annotations/src/util.js +3 -3
  58. package/src/ngtsc/core/api.d.ts +368 -0
  59. package/src/ngtsc/core/api.js +20 -0
  60. package/src/ngtsc/core/index.d.ts +10 -0
  61. package/src/ngtsc/core/index.js +24 -0
  62. package/src/ngtsc/core/src/compiler.d.ts +120 -0
  63. package/src/ngtsc/core/src/compiler.js +769 -0
  64. package/src/ngtsc/core/src/host.d.ts +85 -0
  65. package/src/ngtsc/core/src/host.js +208 -0
  66. package/src/ngtsc/diagnostics/index.d.ts +1 -1
  67. package/src/ngtsc/diagnostics/index.js +5 -5
  68. package/src/ngtsc/diagnostics/src/error.d.ts +1 -1
  69. package/src/ngtsc/diagnostics/src/error.js +1 -1
  70. package/src/ngtsc/diagnostics/src/{code.d.ts → error_code.d.ts} +4 -6
  71. package/src/ngtsc/diagnostics/src/error_code.js +128 -0
  72. package/src/ngtsc/file_system/src/cached_file_system.d.ts +3 -1
  73. package/src/ngtsc/file_system/src/cached_file_system.js +48 -4
  74. package/src/ngtsc/file_system/src/invalid_file_system.d.ts +3 -1
  75. package/src/ngtsc/file_system/src/invalid_file_system.js +4 -2
  76. package/src/ngtsc/file_system/src/node_js_file_system.d.ts +3 -1
  77. package/src/ngtsc/file_system/src/node_js_file_system.js +8 -4
  78. package/src/ngtsc/file_system/src/types.d.ts +3 -1
  79. package/src/ngtsc/file_system/src/types.js +1 -1
  80. package/src/ngtsc/imports/index.d.ts +3 -3
  81. package/src/ngtsc/imports/index.js +4 -4
  82. package/src/ngtsc/imports/src/alias.d.ts +12 -11
  83. package/src/ngtsc/imports/src/alias.js +21 -16
  84. package/src/ngtsc/imports/src/emitter.d.ts +37 -16
  85. package/src/ngtsc/imports/src/emitter.js +51 -18
  86. package/src/ngtsc/imports/src/references.d.ts +0 -4
  87. package/src/ngtsc/imports/src/references.js +1 -6
  88. package/src/ngtsc/incremental/api.d.ts +2 -1
  89. package/src/ngtsc/incremental/api.js +1 -1
  90. package/src/ngtsc/incremental/src/dependency_tracking.d.ts +4 -3
  91. package/src/ngtsc/incremental/src/dependency_tracking.js +2 -2
  92. package/src/ngtsc/incremental/src/state.js +33 -13
  93. package/src/ngtsc/indexer/index.d.ts +1 -0
  94. package/src/ngtsc/indexer/index.js +4 -2
  95. package/src/ngtsc/modulewithproviders/src/scanner.js +2 -2
  96. package/src/ngtsc/partial_evaluator/src/builtin.d.ts +7 -6
  97. package/src/ngtsc/partial_evaluator/src/builtin.js +54 -9
  98. package/src/ngtsc/partial_evaluator/src/interpreter.js +9 -5
  99. package/src/ngtsc/partial_evaluator/src/known_declaration.d.ts +19 -0
  100. package/src/ngtsc/partial_evaluator/src/known_declaration.js +38 -0
  101. package/src/ngtsc/partial_evaluator/src/result.d.ts +1 -1
  102. package/src/ngtsc/partial_evaluator/src/result.js +1 -1
  103. package/src/ngtsc/partial_evaluator/src/ts_helpers.d.ts +1 -1
  104. package/src/ngtsc/partial_evaluator/src/ts_helpers.js +13 -3
  105. package/src/ngtsc/program.d.ts +46 -64
  106. package/src/ngtsc/program.js +76 -724
  107. package/src/ngtsc/reflection/src/host.d.ts +19 -2
  108. package/src/ngtsc/reflection/src/host.js +17 -3
  109. package/src/ngtsc/reflection/src/typescript.js +4 -4
  110. package/src/ngtsc/resource/index.d.ts +9 -0
  111. package/src/ngtsc/resource/index.js +22 -0
  112. package/src/ngtsc/{resource_loader.d.ts → resource/src/loader.d.ts} +4 -4
  113. package/src/ngtsc/resource/src/loader.js +193 -0
  114. package/src/ngtsc/shims/index.d.ts +1 -1
  115. package/src/ngtsc/shims/index.js +2 -5
  116. package/src/ngtsc/shims/src/api.d.ts +25 -0
  117. package/src/ngtsc/shims/src/api.js +13 -0
  118. package/src/ngtsc/shims/src/factory_generator.d.ts +1 -1
  119. package/src/ngtsc/shims/src/factory_generator.js +1 -1
  120. package/src/ngtsc/shims/src/summary_generator.d.ts +1 -1
  121. package/src/ngtsc/shims/src/summary_generator.js +1 -1
  122. package/src/ngtsc/shims/src/typecheck_shim.d.ts +1 -1
  123. package/src/ngtsc/shims/src/typecheck_shim.js +1 -1
  124. package/src/ngtsc/transform/index.d.ts +2 -0
  125. package/src/ngtsc/transform/index.js +7 -2
  126. package/src/ngtsc/transform/src/alias.d.ts +1 -1
  127. package/src/ngtsc/transform/src/alias.js +1 -1
  128. package/src/ngtsc/transform/src/api.d.ts +16 -0
  129. package/src/ngtsc/transform/src/api.js +1 -1
  130. package/src/ngtsc/transform/src/compilation.d.ts +8 -6
  131. package/src/ngtsc/transform/src/compilation.js +47 -20
  132. package/src/ngtsc/transform/src/declaration.d.ts +1 -1
  133. package/src/ngtsc/transform/src/declaration.js +1 -1
  134. package/src/ngtsc/typecheck/index.d.ts +1 -0
  135. package/src/ngtsc/typecheck/index.js +4 -2
  136. package/src/ngtsc/typecheck/src/api.d.ts +8 -0
  137. package/src/ngtsc/typecheck/src/api.js +1 -1
  138. package/src/ngtsc/typecheck/src/diagnostics.d.ts +13 -3
  139. package/src/ngtsc/typecheck/src/diagnostics.js +14 -5
  140. package/src/ngtsc/typecheck/src/dom.js +3 -3
  141. package/src/ngtsc/typecheck/src/environment.js +7 -3
  142. package/src/ngtsc/typecheck/src/host.d.ts +1 -0
  143. package/src/ngtsc/typecheck/src/host.js +4 -1
  144. package/src/ngtsc/typecheck/src/oob.js +4 -4
  145. package/src/ngtsc/typecheck/src/ts_util.js +36 -1
  146. package/src/ngtsc/typecheck/src/type_check_block.js +31 -18
  147. package/src/ngtsc/util/src/typescript.d.ts +2 -0
  148. package/src/ngtsc/util/src/typescript.js +12 -4
  149. package/src/perform_watch.js +6 -5
  150. package/src/transformers/api.d.ts +3 -206
  151. package/src/transformers/api.js +1 -1
  152. package/src/transformers/compiler_host.js +2 -2
  153. package/src/transformers/program.js +1 -1
  154. package/src/version.js +1 -1
  155. package/src/ngtsc/diagnostics/src/code.js +0 -126
  156. package/src/ngtsc/resource_loader.js +0 -193
  157. package/src/ngtsc/shims/src/host.d.ts +0 -46
  158. package/src/ngtsc/shims/src/host.js +0 -82
@@ -9,82 +9,64 @@
9
9
  import { GeneratedFile } from '@angular/compiler';
10
10
  import * as ts from 'typescript';
11
11
  import * as api from '../transformers/api';
12
- import { ReferencesRegistry } from './annotations';
13
- import { ReferenceGraph } from './entry_point';
14
- import { Reference } from './imports';
12
+ import { NgCompilerOptions } from './core/api';
15
13
  import { IndexedComponent } from './indexer';
14
+ /**
15
+ * Entrypoint to the Angular Compiler (Ivy+) which sits behind the `api.Program` interface, allowing
16
+ * it to be a drop-in replacement for the legacy View Engine compiler to tooling such as the
17
+ * command-line main() function or the Angular CLI.
18
+ */
16
19
  export declare class NgtscProgram implements api.Program {
17
20
  private options;
18
- private host;
21
+ private compiler;
22
+ /**
23
+ * The primary TypeScript program, which is used for analysis and emit.
24
+ */
19
25
  private tsProgram;
26
+ /**
27
+ * The TypeScript program to use for the next incremental compilation.
28
+ *
29
+ * Once a TS program is used to create another (an incremental compilation operation), it can no
30
+ * longer be used to do so again.
31
+ *
32
+ * Since template type-checking uses the primary program to create a type-checking program, after
33
+ * this happens the primary program is no longer suitable for starting a subsequent compilation,
34
+ * and the template type-checking program should be used instead.
35
+ *
36
+ * Thus, the program which should be used for the next incremental compilation is tracked in
37
+ * `reuseTsProgram`, separately from the "primary" program which is always used for emit.
38
+ */
20
39
  private reuseTsProgram;
21
- private resourceManager;
22
- private compilation;
23
- private _coreImportsFrom;
24
- private _importRewriter;
25
- private _reflector;
26
- private _isCore;
27
- private rootDirs;
28
40
  private closureCompilerEnabled;
29
- private entryPoint;
30
- private exportReferenceGraph;
31
- private flatIndexGenerator;
32
- private routeAnalyzer;
33
- private scopeRegistry;
34
- private constructionDiagnostics;
35
- private moduleResolver;
36
- private cycleAnalyzer;
37
- private metaReader;
38
- private aliasingHost;
39
- private refEmitter;
40
- private fileToModuleHost;
41
- private defaultImportTracker;
41
+ private host;
42
42
  private perfRecorder;
43
43
  private perfTracker;
44
- private incrementalDriver;
45
- private typeCheckFilePath;
46
- private factoryTracker;
47
- private modifiedResourceFiles;
48
- private dtsTransforms;
49
- private mwpScanner;
50
- constructor(rootNames: ReadonlyArray<string>, options: api.CompilerOptions, host: api.CompilerHost, oldProgram?: NgtscProgram);
44
+ constructor(rootNames: ReadonlyArray<string>, options: NgCompilerOptions, delegateHost: api.CompilerHost, oldProgram?: NgtscProgram);
51
45
  getTsProgram(): ts.Program;
52
- getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<ts.Diagnostic>;
53
- getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<ts.Diagnostic>;
54
- getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<ts.Diagnostic>;
55
- getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<api.Diagnostic>;
56
- getTsSemanticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<ts.Diagnostic>;
57
- getNgSemanticDiagnostics(fileName?: string | undefined, cancellationToken?: ts.CancellationToken | undefined): ReadonlyArray<ts.Diagnostic>;
46
+ getTsOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
47
+ getTsSyntacticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
48
+ getTsSemanticDiagnostics(sourceFile?: ts.SourceFile | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly ts.Diagnostic[];
49
+ getNgOptionDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly (ts.Diagnostic | api.Diagnostic)[];
50
+ getNgStructuralDiagnostics(cancellationToken?: ts.CancellationToken | undefined): readonly api.Diagnostic[];
51
+ getNgSemanticDiagnostics(fileName?: string | undefined, cancellationToken?: ts.CancellationToken | undefined): readonly (ts.Diagnostic | api.Diagnostic)[];
52
+ /**
53
+ * Ensure that the `NgCompiler` has properly analyzed the program, and allow for the asynchronous
54
+ * loading of any resources during the process.
55
+ *
56
+ * This is used by the Angular CLI to allow for spawning (async) child compilations for things
57
+ * like SASS files used in `styleUrls`.
58
+ */
58
59
  loadNgStructureAsync(): Promise<void>;
59
60
  listLazyRoutes(entryRoute?: string | undefined): api.LazyRoute[];
61
+ emit(opts?: {
62
+ emitFlags?: api.EmitFlags | undefined;
63
+ cancellationToken?: ts.CancellationToken | undefined;
64
+ customTransformers?: api.CustomTransformers | undefined;
65
+ emitCallback?: api.TsEmitCallback | undefined;
66
+ mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback | undefined;
67
+ } | undefined): ts.EmitResult;
68
+ getIndexedComponents(): Map<ts.Declaration, IndexedComponent>;
60
69
  getLibrarySummaries(): Map<string, api.LibrarySummary>;
61
70
  getEmittedGeneratedFiles(): Map<string, GeneratedFile>;
62
71
  getEmittedSourceFiles(): Map<string, ts.SourceFile>;
63
- private scanForMwp;
64
- private ensureAnalyzed;
65
- private resolveCompilation;
66
- emit(opts?: {
67
- emitFlags?: api.EmitFlags;
68
- cancellationToken?: ts.CancellationToken;
69
- customTransformers?: api.CustomTransformers;
70
- emitCallback?: api.TsEmitCallback;
71
- mergeEmitResultsCallback?: api.TsMergeEmitResultsCallback;
72
- }): ts.EmitResult;
73
- private getTemplateDiagnostics;
74
- getIndexedComponents(): Map<ts.Declaration, IndexedComponent>;
75
- private makeCompilation;
76
- /**
77
- * Reifies the inter-dependencies of NgModules and the components within their compilation scopes
78
- * into the `IncrementalDriver`'s dependency graph.
79
- */
80
- private recordNgModuleScopeDependencies;
81
- private get reflector();
82
- private get coreImportsFrom();
83
- private get isCore();
84
- private get importRewriter();
85
- }
86
- export declare class ReferenceGraphAdapter implements ReferencesRegistry {
87
- private graph;
88
- constructor(graph: ReferenceGraph);
89
- add(source: ts.Declaration, ...references: Reference<ts.Declaration>[]): void;
90
72
  }