@angular/compiler-cli 11.1.0-next.4 → 11.1.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.
Files changed (147) hide show
  1. package/linker/babel/src/ast/babel_ast_factory.d.ts +5 -0
  2. package/linker/babel/src/ast/babel_ast_factory.js +10 -5
  3. package/linker/babel/src/es2015_linker_plugin.d.ts +2 -2
  4. package/linker/babel/src/es2015_linker_plugin.js +26 -11
  5. package/linker/babel/src/linker_plugin_options.d.ts +21 -0
  6. package/linker/babel/src/linker_plugin_options.js +13 -0
  7. package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +3 -3
  8. package/linker/src/file_linker/emit_scopes/emit_scope.js +6 -6
  9. package/linker/src/file_linker/emit_scopes/iife_emit_scope.d.ts +4 -0
  10. package/linker/src/file_linker/emit_scopes/iife_emit_scope.js +9 -8
  11. package/linker/src/file_linker/file_linker.d.ts +2 -3
  12. package/linker/src/file_linker/file_linker.js +6 -7
  13. package/linker/src/file_linker/get_source_file.d.ts +19 -0
  14. package/linker/src/file_linker/get_source_file.js +42 -0
  15. package/linker/src/file_linker/linker_environment.d.ts +8 -2
  16. package/linker/src/file_linker/linker_environment.js +11 -6
  17. package/linker/src/file_linker/linker_options.d.ts +5 -0
  18. package/linker/src/file_linker/linker_options.js +2 -1
  19. package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +24 -10
  20. package/linker/src/file_linker/partial_linkers/partial_component_linker_1.js +138 -97
  21. package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +6 -2
  22. package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.js +7 -4
  23. package/linker/src/file_linker/partial_linkers/partial_linker.d.ts +1 -1
  24. package/linker/src/file_linker/partial_linkers/partial_linker.js +1 -1
  25. package/linker/src/file_linker/partial_linkers/partial_linker_selector.d.ts +21 -18
  26. package/linker/src/file_linker/partial_linkers/partial_linker_selector.js +37 -31
  27. package/ngcc/src/analysis/decoration_analyzer.d.ts +3 -3
  28. package/ngcc/src/analysis/decoration_analyzer.js +3 -3
  29. package/ngcc/src/command_line_options.js +4 -3
  30. package/ngcc/src/dependencies/dependency_host.d.ts +3 -3
  31. package/ngcc/src/dependencies/dependency_host.js +1 -1
  32. package/ngcc/src/dependencies/dependency_resolver.d.ts +2 -2
  33. package/ngcc/src/dependencies/dependency_resolver.js +3 -4
  34. package/ngcc/src/dependencies/dts_dependency_host.d.ts +2 -2
  35. package/ngcc/src/dependencies/dts_dependency_host.js +1 -1
  36. package/ngcc/src/dependencies/esm_dependency_host.d.ts +2 -2
  37. package/ngcc/src/dependencies/esm_dependency_host.js +1 -1
  38. package/ngcc/src/dependencies/module_resolver.d.ts +2 -2
  39. package/ngcc/src/dependencies/module_resolver.js +15 -24
  40. package/ngcc/src/entry_point_finder/entry_point_collector.d.ts +2 -2
  41. package/ngcc/src/entry_point_finder/entry_point_collector.js +1 -1
  42. package/ngcc/src/entry_point_finder/program_based_entry_point_finder.d.ts +2 -2
  43. package/ngcc/src/entry_point_finder/program_based_entry_point_finder.js +2 -2
  44. package/ngcc/src/entry_point_finder/targeted_entry_point_finder.d.ts +11 -2
  45. package/ngcc/src/entry_point_finder/targeted_entry_point_finder.js +24 -20
  46. package/ngcc/src/entry_point_finder/tracing_entry_point_finder.d.ts +3 -3
  47. package/ngcc/src/entry_point_finder/tracing_entry_point_finder.js +1 -1
  48. package/ngcc/src/entry_point_finder/utils.d.ts +0 -9
  49. package/ngcc/src/entry_point_finder/utils.js +8 -9
  50. package/ngcc/src/execution/cluster/executor.d.ts +2 -2
  51. package/ngcc/src/execution/cluster/executor.js +1 -1
  52. package/ngcc/src/execution/cluster/master.d.ts +2 -2
  53. package/ngcc/src/execution/cluster/master.js +1 -1
  54. package/ngcc/src/execution/tasks/completion.d.ts +4 -4
  55. package/ngcc/src/execution/tasks/completion.js +4 -12
  56. package/ngcc/src/host/umd_host.js +2 -2
  57. package/ngcc/src/locking/lock_file.d.ts +2 -2
  58. package/ngcc/src/locking/lock_file.js +1 -1
  59. package/ngcc/src/main.js +6 -6
  60. package/ngcc/src/ngcc_options.js +2 -2
  61. package/ngcc/src/packages/build_marker.d.ts +1 -1
  62. package/ngcc/src/packages/build_marker.js +1 -1
  63. package/ngcc/src/packages/bundle_program.d.ts +3 -3
  64. package/ngcc/src/packages/bundle_program.js +6 -7
  65. package/ngcc/src/packages/configuration.d.ts +3 -3
  66. package/ngcc/src/packages/configuration.js +8 -9
  67. package/ngcc/src/packages/entry_point.d.ts +3 -3
  68. package/ngcc/src/packages/entry_point.js +13 -16
  69. package/ngcc/src/packages/entry_point_bundle.js +1 -1
  70. package/ngcc/src/packages/source_file_cache.d.ts +6 -6
  71. package/ngcc/src/packages/source_file_cache.js +1 -1
  72. package/ngcc/src/packages/transformer.d.ts +2 -2
  73. package/ngcc/src/packages/transformer.js +6 -6
  74. package/ngcc/src/path_mappings.d.ts +2 -2
  75. package/ngcc/src/path_mappings.js +4 -12
  76. package/ngcc/src/rendering/commonjs_rendering_formatter.d.ts +9 -1
  77. package/ngcc/src/rendering/commonjs_rendering_formatter.js +6 -13
  78. package/ngcc/src/rendering/dts_renderer.d.ts +2 -2
  79. package/ngcc/src/rendering/dts_renderer.js +1 -1
  80. package/ngcc/src/rendering/esm_rendering_formatter.d.ts +4 -3
  81. package/ngcc/src/rendering/esm_rendering_formatter.js +7 -5
  82. package/ngcc/src/rendering/renderer.d.ts +2 -2
  83. package/ngcc/src/rendering/renderer.js +1 -1
  84. package/ngcc/src/rendering/source_maps.d.ts +2 -2
  85. package/ngcc/src/rendering/source_maps.js +18 -19
  86. package/ngcc/src/rendering/umd_rendering_formatter.d.ts +9 -1
  87. package/ngcc/src/rendering/umd_rendering_formatter.js +6 -13
  88. package/ngcc/src/utils.d.ts +2 -2
  89. package/ngcc/src/utils.js +1 -1
  90. package/ngcc/src/writing/cleaning/package_cleaner.d.ts +2 -2
  91. package/ngcc/src/writing/cleaning/package_cleaner.js +1 -1
  92. package/ngcc/src/writing/cleaning/utils.d.ts +2 -2
  93. package/ngcc/src/writing/cleaning/utils.js +1 -1
  94. package/ngcc/src/writing/new_entry_point_file_writer.d.ts +14 -1
  95. package/ngcc/src/writing/new_entry_point_file_writer.js +54 -18
  96. package/package.json +2 -2
  97. package/src/ngtsc/annotations/src/component.d.ts +48 -10
  98. package/src/ngtsc/annotations/src/component.js +197 -116
  99. package/src/ngtsc/annotations/src/directive.js +18 -3
  100. package/src/ngtsc/core/api/src/public_options.d.ts +2 -2
  101. package/src/ngtsc/core/api/src/public_options.js +1 -1
  102. package/src/ngtsc/core/index.d.ts +1 -1
  103. package/src/ngtsc/core/index.js +5 -5
  104. package/src/ngtsc/core/src/compiler.d.ts +95 -12
  105. package/src/ngtsc/core/src/compiler.js +240 -81
  106. package/src/ngtsc/diagnostics/index.d.ts +1 -1
  107. package/src/ngtsc/diagnostics/index.js +4 -2
  108. package/src/ngtsc/diagnostics/src/error_code.d.ts +6 -1
  109. package/src/ngtsc/diagnostics/src/error_code.js +29 -2
  110. package/src/ngtsc/file_system/index.d.ts +1 -1
  111. package/src/ngtsc/file_system/index.js +1 -1
  112. package/src/ngtsc/file_system/src/node_js_file_system.d.ts +29 -19
  113. package/src/ngtsc/file_system/src/node_js_file_system.js +102 -80
  114. package/src/ngtsc/file_system/src/types.d.ts +34 -23
  115. package/src/ngtsc/file_system/src/types.js +1 -1
  116. package/src/ngtsc/incremental/src/strategy.d.ts +7 -0
  117. package/src/ngtsc/incremental/src/strategy.js +7 -1
  118. package/src/ngtsc/program.js +51 -20
  119. package/src/ngtsc/resource/src/loader.d.ts +4 -0
  120. package/src/ngtsc/resource/src/loader.js +7 -1
  121. package/src/ngtsc/sourcemaps/index.d.ts +3 -2
  122. package/src/ngtsc/sourcemaps/index.js +12 -3
  123. package/src/ngtsc/sourcemaps/src/content_origin.d.ts +34 -0
  124. package/src/ngtsc/sourcemaps/src/content_origin.js +48 -0
  125. package/src/ngtsc/sourcemaps/src/raw_source_map.d.ts +19 -1
  126. package/src/ngtsc/sourcemaps/src/raw_source_map.js +1 -8
  127. package/src/ngtsc/sourcemaps/src/segment_marker.d.ts +1 -1
  128. package/src/ngtsc/sourcemaps/src/segment_marker.js +1 -1
  129. package/src/ngtsc/sourcemaps/src/source_file.d.ts +7 -11
  130. package/src/ngtsc/sourcemaps/src/source_file.js +108 -32
  131. package/src/ngtsc/sourcemaps/src/source_file_loader.d.ts +36 -16
  132. package/src/ngtsc/sourcemaps/src/source_file_loader.js +72 -19
  133. package/src/ngtsc/transform/src/api.d.ts +5 -0
  134. package/src/ngtsc/transform/src/api.js +1 -1
  135. package/src/ngtsc/transform/src/compilation.d.ts +1 -0
  136. package/src/ngtsc/transform/src/compilation.js +40 -17
  137. package/src/ngtsc/tsc_plugin.js +26 -5
  138. package/src/ngtsc/typecheck/api/checker.d.ts +5 -0
  139. package/src/ngtsc/typecheck/api/checker.js +1 -1
  140. package/src/ngtsc/typecheck/src/checker.d.ts +1 -0
  141. package/src/ngtsc/typecheck/src/checker.js +17 -1
  142. package/src/ngtsc/typecheck/src/template_symbol_builder.js +104 -55
  143. package/src/perform_compile.d.ts +2 -2
  144. package/src/perform_compile.js +1 -1
  145. package/src/transformers/downlevel_decorators_transform.js +7 -8
  146. package/src/transformers/patch_alias_reference_resolution.js +25 -13
  147. package/src/version.js +1 -1
@@ -12,8 +12,70 @@ import { IndexedComponent } from '../../indexer';
12
12
  import { ComponentResources } from '../../metadata';
13
13
  import { PerfRecorder } from '../../perf';
14
14
  import { DeclarationNode } from '../../reflection';
15
- import { TemplateTypeChecker, TypeCheckingProgramStrategy } from '../../typecheck/api';
15
+ import { OptimizeFor, TemplateTypeChecker, TypeCheckingProgramStrategy } from '../../typecheck/api';
16
16
  import { LazyRoute, NgCompilerAdapter, NgCompilerOptions } from '../api';
17
+ /**
18
+ * Discriminant type for a `CompilationTicket`.
19
+ */
20
+ export declare enum CompilationTicketKind {
21
+ Fresh = 0,
22
+ IncrementalTypeScript = 1,
23
+ IncrementalResource = 2
24
+ }
25
+ /**
26
+ * Begin an Angular compilation operation from scratch.
27
+ */
28
+ export interface FreshCompilationTicket {
29
+ kind: CompilationTicketKind.Fresh;
30
+ options: NgCompilerOptions;
31
+ incrementalBuildStrategy: IncrementalBuildStrategy;
32
+ typeCheckingProgramStrategy: TypeCheckingProgramStrategy;
33
+ enableTemplateTypeChecker: boolean;
34
+ usePoisonedData: boolean;
35
+ tsProgram: ts.Program;
36
+ }
37
+ /**
38
+ * Begin an Angular compilation operation that incorporates changes to TypeScript code.
39
+ */
40
+ export interface IncrementalTypeScriptCompilationTicket {
41
+ kind: CompilationTicketKind.IncrementalTypeScript;
42
+ options: NgCompilerOptions;
43
+ oldProgram: ts.Program;
44
+ newProgram: ts.Program;
45
+ incrementalBuildStrategy: IncrementalBuildStrategy;
46
+ typeCheckingProgramStrategy: TypeCheckingProgramStrategy;
47
+ newDriver: IncrementalDriver;
48
+ enableTemplateTypeChecker: boolean;
49
+ usePoisonedData: boolean;
50
+ }
51
+ export interface IncrementalResourceCompilationTicket {
52
+ kind: CompilationTicketKind.IncrementalResource;
53
+ compiler: NgCompiler;
54
+ modifiedResourceFiles: Set<string>;
55
+ }
56
+ /**
57
+ * A request to begin Angular compilation, either starting from scratch or from a known prior state.
58
+ *
59
+ * `CompilationTicket`s are used to initialize (or update) an `NgCompiler` instance, the core of the
60
+ * Angular compiler. They abstract the starting state of compilation and allow `NgCompiler` to be
61
+ * managed independently of any incremental compilation lifecycle.
62
+ */
63
+ export declare type CompilationTicket = FreshCompilationTicket | IncrementalTypeScriptCompilationTicket | IncrementalResourceCompilationTicket;
64
+ /**
65
+ * Create a `CompilationTicket` for a brand new compilation, using no prior state.
66
+ */
67
+ export declare function freshCompilationTicket(tsProgram: ts.Program, options: NgCompilerOptions, incrementalBuildStrategy: IncrementalBuildStrategy, typeCheckingProgramStrategy: TypeCheckingProgramStrategy, enableTemplateTypeChecker: boolean, usePoisonedData: boolean): CompilationTicket;
68
+ /**
69
+ * Create a `CompilationTicket` as efficiently as possible, based on a previous `NgCompiler`
70
+ * instance and a new `ts.Program`.
71
+ */
72
+ export declare function incrementalFromCompilerTicket(oldCompiler: NgCompiler, newProgram: ts.Program, incrementalBuildStrategy: IncrementalBuildStrategy, typeCheckingProgramStrategy: TypeCheckingProgramStrategy, modifiedResourceFiles: Set<string>): CompilationTicket;
73
+ /**
74
+ * Create a `CompilationTicket` directly from an old `ts.Program` and associated Angular compilation
75
+ * state, along with a new `ts.Program`.
76
+ */
77
+ export declare function incrementalFromDriverTicket(oldProgram: ts.Program, oldDriver: IncrementalDriver, newProgram: ts.Program, options: NgCompilerOptions, incrementalBuildStrategy: IncrementalBuildStrategy, typeCheckingProgramStrategy: TypeCheckingProgramStrategy, modifiedResourceFiles: Set<string>, enableTemplateTypeChecker: boolean, usePoisonedData: boolean): CompilationTicket;
78
+ export declare function resourceChangeTicket(compiler: NgCompiler, modifiedResourceFiles: Set<string>): IncrementalResourceCompilationTicket;
17
79
  /**
18
80
  * The heart of the Angular Ivy compiler.
19
81
  *
@@ -28,12 +90,13 @@ import { LazyRoute, NgCompilerAdapter, NgCompilerOptions } from '../api';
28
90
  */
29
91
  export declare class NgCompiler {
30
92
  private adapter;
31
- private options;
93
+ readonly options: NgCompilerOptions;
32
94
  private tsProgram;
33
- private typeCheckingProgramStrategy;
34
- private incrementalStrategy;
35
- private enableTemplateTypeChecker;
36
- private usePoisonedData;
95
+ readonly typeCheckingProgramStrategy: TypeCheckingProgramStrategy;
96
+ readonly incrementalStrategy: IncrementalBuildStrategy;
97
+ readonly incrementalDriver: IncrementalDriver;
98
+ readonly enableTemplateTypeChecker: boolean;
99
+ readonly usePoisonedData: boolean;
37
100
  private perfRecorder;
38
101
  /**
39
102
  * Lazily evaluated state of the compilation.
@@ -48,33 +111,51 @@ export declare class NgCompiler {
48
111
  */
49
112
  private constructionDiagnostics;
50
113
  /**
51
- * Semantic diagnostics related to the program itself.
114
+ * Non-template diagnostics related to the program itself. Does not include template
115
+ * diagnostics because the template type checker memoizes them itself.
52
116
  *
53
- * This is set by (and memoizes) `getDiagnostics`.
117
+ * This is set by (and memoizes) `getNonTemplateDiagnostics`.
54
118
  */
55
- private diagnostics;
119
+ private nonTemplateDiagnostics;
56
120
  private closureCompilerEnabled;
57
121
  private nextProgram;
58
122
  private entryPoint;
59
123
  private moduleResolver;
60
124
  private resourceManager;
61
125
  private cycleAnalyzer;
62
- readonly incrementalDriver: IncrementalDriver;
63
126
  readonly ignoreForDiagnostics: Set<ts.SourceFile>;
64
127
  readonly ignoreForEmit: Set<ts.SourceFile>;
65
- constructor(adapter: NgCompilerAdapter, options: NgCompilerOptions, tsProgram: ts.Program, typeCheckingProgramStrategy: TypeCheckingProgramStrategy, incrementalStrategy: IncrementalBuildStrategy, enableTemplateTypeChecker: boolean, usePoisonedData: boolean, oldProgram?: ts.Program | null, perfRecorder?: PerfRecorder);
128
+ /**
129
+ * Convert a `CompilationTicket` into an `NgCompiler` instance for the requested compilation.
130
+ *
131
+ * Depending on the nature of the compilation request, the `NgCompiler` instance may be reused
132
+ * from a previous compilation and updated with any changes, it may be a new instance which
133
+ * incrementally reuses state from a previous compilation, or it may represent a fresh compilation
134
+ * entirely.
135
+ */
136
+ static fromTicket(ticket: CompilationTicket, adapter: NgCompilerAdapter, perfRecorder?: PerfRecorder): NgCompiler;
137
+ private constructor();
138
+ private updateWithChangedResources;
66
139
  /**
67
140
  * Get the resource dependencies of a file.
68
141
  *
69
142
  * If the file is not part of the compilation, an empty array will be returned.
70
143
  */
71
144
  getResourceDependencies(file: ts.SourceFile): string[];
145
+ /**
146
+ * Get all Angular-related diagnostics for this compilation.
147
+ */
148
+ getDiagnostics(): ts.Diagnostic[];
72
149
  /**
73
150
  * Get all Angular-related diagnostics for this compilation.
74
151
  *
75
152
  * If a `ts.SourceFile` is passed, only diagnostics related to that file are returned.
76
153
  */
77
- getDiagnostics(file?: ts.SourceFile): ts.Diagnostic[];
154
+ getDiagnosticsForFile(file: ts.SourceFile, optimizeFor: OptimizeFor): ts.Diagnostic[];
155
+ /**
156
+ * Add Angular.io error guide links to diagnostics for this compilation.
157
+ */
158
+ private addMessageTextDetails;
78
159
  /**
79
160
  * Get all setup-related diagnostics for this compilation.
80
161
  */
@@ -137,6 +218,8 @@ export declare class NgCompiler {
137
218
  private get fullTemplateTypeCheck();
138
219
  private getTypeCheckingConfig;
139
220
  private getTemplateDiagnostics;
221
+ private getTemplateDiagnosticsForFile;
222
+ private getNonTemplateDiagnostics;
140
223
  /**
141
224
  * Reifies the inter-dependencies of NgModules and the components within their compilation scopes
142
225
  * into the `IncrementalDriver`'s dependency graph.