@angular/compiler-cli 15.2.0-rc.0 → 16.0.0-next.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 (165) hide show
  1. package/bundles/{chunk-JYL7IHZC.js → chunk-2DMH5JXJ.js} +16 -23
  2. package/bundles/chunk-2DMH5JXJ.js.map +6 -0
  3. package/bundles/{chunk-ZB4CDKOH.js → chunk-4TCRZYAK.js} +2 -2
  4. package/bundles/{chunk-NJMZRTB6.js → chunk-54RHUHYB.js} +1 -2
  5. package/bundles/{chunk-64X67E3N.js → chunk-6CARGXRJ.js} +5 -5
  6. package/bundles/{chunk-O4JLZZWJ.js → chunk-EDWIBG7R.js} +1 -10
  7. package/bundles/chunk-EDWIBG7R.js.map +6 -0
  8. package/bundles/{chunk-6ZJFIQBG.js → chunk-GYHDNUIK.js} +1 -2
  9. package/bundles/{chunk-HYFCMILZ.js → chunk-IS6KZYEA.js} +384 -614
  10. package/bundles/chunk-IS6KZYEA.js.map +6 -0
  11. package/bundles/{chunk-Q6W3UCXI.js → chunk-JHMH3CX2.js} +92 -125
  12. package/bundles/chunk-JHMH3CX2.js.map +6 -0
  13. package/bundles/chunk-K2A5WD7L.js +872 -0
  14. package/bundles/chunk-K2A5WD7L.js.map +6 -0
  15. package/bundles/chunk-PSGRCFPQ.js +714 -0
  16. package/bundles/chunk-PSGRCFPQ.js.map +6 -0
  17. package/bundles/index.js +13 -12
  18. package/bundles/index.js.map +1 -1
  19. package/bundles/linker/babel/index.js +8 -7
  20. package/bundles/linker/babel/index.js.map +1 -1
  21. package/bundles/linker/index.js +4 -3
  22. package/bundles/private/bazel.js +1 -1
  23. package/bundles/private/localize.js +1 -1
  24. package/bundles/private/migrations.js +5 -4
  25. package/bundles/private/tooling.js +4 -2
  26. package/bundles/src/bin/ng_xi18n.js +7 -6
  27. package/bundles/src/bin/ng_xi18n.js.map +1 -1
  28. package/bundles/src/bin/ngc.js +7 -6
  29. package/bundles/src/bin/ngc.js.map +1 -1
  30. package/bundles_metadata.json +1 -1
  31. package/package.json +2 -15
  32. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +1 -3
  33. package/src/ngtsc/core/api/src/adapter.d.ts +0 -7
  34. package/src/ngtsc/core/api/src/options.d.ts +2 -2
  35. package/src/ngtsc/core/api/src/public_options.d.ts +0 -25
  36. package/src/ngtsc/core/src/host.d.ts +3 -5
  37. package/src/ngtsc/imports/index.d.ts +1 -0
  38. package/src/ngtsc/imports/src/default.d.ts +6 -10
  39. package/src/ngtsc/imports/src/patch_alias_reference_resolution.d.ts +61 -0
  40. package/src/ngtsc/shims/api.d.ts +0 -19
  41. package/src/ngtsc/shims/index.d.ts +0 -2
  42. package/src/transformers/api.d.ts +0 -5
  43. package/bundles/chunk-7DUI3BSX.js +0 -29
  44. package/bundles/chunk-7DUI3BSX.js.map +0 -6
  45. package/bundles/chunk-BEXFRTBC.js +0 -2187
  46. package/bundles/chunk-BEXFRTBC.js.map +0 -6
  47. package/bundles/chunk-HYFCMILZ.js.map +0 -6
  48. package/bundles/chunk-JYL7IHZC.js.map +0 -6
  49. package/bundles/chunk-O4JLZZWJ.js.map +0 -6
  50. package/bundles/chunk-OAZD7RII.js +0 -5263
  51. package/bundles/chunk-OAZD7RII.js.map +0 -6
  52. package/bundles/chunk-Q6W3UCXI.js.map +0 -6
  53. package/bundles/chunk-YRDMG3GM.js +0 -115
  54. package/bundles/chunk-YRDMG3GM.js.map +0 -6
  55. package/bundles/chunk-Z534TW2O.js +0 -1540
  56. package/bundles/chunk-Z534TW2O.js.map +0 -6
  57. package/bundles/ngcc/index.js +0 -51
  58. package/bundles/ngcc/index.js.map +0 -6
  59. package/bundles/ngcc/main-ngcc.js +0 -48
  60. package/bundles/ngcc/main-ngcc.js.map +0 -6
  61. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +0 -113
  62. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +0 -6
  63. package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +0 -34
  64. package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js.map +0 -6
  65. package/ngcc/index.d.ts +0 -19
  66. package/ngcc/main-ngcc.d.ts +0 -2
  67. package/ngcc/src/analysis/decoration_analyzer.d.ts +0 -80
  68. package/ngcc/src/analysis/migration_host.d.ts +0 -22
  69. package/ngcc/src/analysis/module_with_providers_analyzer.d.ts +0 -61
  70. package/ngcc/src/analysis/ngcc_references_registry.d.ts +0 -34
  71. package/ngcc/src/analysis/ngcc_trait_compiler.d.ts +0 -42
  72. package/ngcc/src/analysis/private_declarations_analyzer.d.ts +0 -29
  73. package/ngcc/src/analysis/types.d.ts +0 -29
  74. package/ngcc/src/analysis/util.d.ts +0 -11
  75. package/ngcc/src/command_line_options.d.ts +0 -3
  76. package/ngcc/src/constants.d.ts +0 -9
  77. package/ngcc/src/dependencies/commonjs_dependency_host.d.ts +0 -20
  78. package/ngcc/src/dependencies/dependency_host.d.ts +0 -77
  79. package/ngcc/src/dependencies/dependency_resolver.d.ts +0 -102
  80. package/ngcc/src/dependencies/dts_dependency_host.d.ts +0 -20
  81. package/ngcc/src/dependencies/esm_dependency_host.d.ts +0 -93
  82. package/ngcc/src/dependencies/module_resolver.d.ts +0 -134
  83. package/ngcc/src/dependencies/umd_dependency_host.d.ts +0 -9
  84. package/ngcc/src/entry_point_finder/directory_walker_entry_point_finder.d.ts +0 -41
  85. package/ngcc/src/entry_point_finder/entry_point_collector.d.ts +0 -41
  86. package/ngcc/src/entry_point_finder/interface.d.ts +0 -14
  87. package/ngcc/src/entry_point_finder/program_based_entry_point_finder.d.ts +0 -61
  88. package/ngcc/src/entry_point_finder/targeted_entry_point_finder.d.ts +0 -95
  89. package/ngcc/src/entry_point_finder/tracing_entry_point_finder.d.ts +0 -67
  90. package/ngcc/src/entry_point_finder/utils.d.ts +0 -38
  91. package/ngcc/src/execution/analyze_entry_points.d.ts +0 -9
  92. package/ngcc/src/execution/api.d.ts +0 -27
  93. package/ngcc/src/execution/cluster/api.d.ts +0 -51
  94. package/ngcc/src/execution/cluster/executor.d.ts +0 -29
  95. package/ngcc/src/execution/cluster/master.d.ts +0 -57
  96. package/ngcc/src/execution/cluster/ngcc_cluster_worker.d.ts +0 -8
  97. package/ngcc/src/execution/cluster/package_json_updater.d.ts +0 -22
  98. package/ngcc/src/execution/cluster/utils.d.ts +0 -44
  99. package/ngcc/src/execution/cluster/worker.d.ts +0 -10
  100. package/ngcc/src/execution/create_compile_function.d.ts +0 -10
  101. package/ngcc/src/execution/single_process_executor.d.ts +0 -34
  102. package/ngcc/src/execution/tasks/api.d.ts +0 -141
  103. package/ngcc/src/execution/tasks/completion.d.ts +0 -41
  104. package/ngcc/src/execution/tasks/queues/base_task_queue.d.ts +0 -38
  105. package/ngcc/src/execution/tasks/queues/parallel_task_queue.d.ts +0 -27
  106. package/ngcc/src/execution/tasks/queues/serial_task_queue.d.ts +0 -16
  107. package/ngcc/src/execution/tasks/utils.d.ts +0 -57
  108. package/ngcc/src/host/commonjs_host.d.ts +0 -69
  109. package/ngcc/src/host/commonjs_umd_utils.d.ts +0 -146
  110. package/ngcc/src/host/delegating_host.d.ts +0 -43
  111. package/ngcc/src/host/esm2015_host.d.ts +0 -935
  112. package/ngcc/src/host/esm5_host.d.ts +0 -299
  113. package/ngcc/src/host/ngcc_host.d.ts +0 -87
  114. package/ngcc/src/host/umd_host.d.ts +0 -85
  115. package/ngcc/src/host/utils.d.ts +0 -9
  116. package/ngcc/src/locking/async_locker.d.ts +0 -34
  117. package/ngcc/src/locking/lock_file.d.ts +0 -31
  118. package/ngcc/src/locking/lock_file_with_child_process/index.d.ts +0 -44
  119. package/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.d.ts +0 -1
  120. package/ngcc/src/locking/lock_file_with_child_process/util.d.ts +0 -16
  121. package/ngcc/src/locking/sync_locker.d.ts +0 -35
  122. package/ngcc/src/main.d.ts +0 -17
  123. package/ngcc/src/migrations/migration.d.ts +0 -59
  124. package/ngcc/src/migrations/missing_injectable_migration.d.ts +0 -35
  125. package/ngcc/src/migrations/undecorated_child_migration.d.ts +0 -15
  126. package/ngcc/src/migrations/undecorated_parent_migration.d.ts +0 -51
  127. package/ngcc/src/migrations/utils.d.ts +0 -41
  128. package/ngcc/src/ngcc_options.d.ts +0 -155
  129. package/ngcc/src/packages/adjust_cjs_umd_exports.d.ts +0 -16
  130. package/ngcc/src/packages/build_marker.d.ts +0 -44
  131. package/ngcc/src/packages/bundle_program.d.ts +0 -35
  132. package/ngcc/src/packages/configuration.d.ts +0 -222
  133. package/ngcc/src/packages/entry_point.d.ts +0 -109
  134. package/ngcc/src/packages/entry_point_bundle.d.ts +0 -46
  135. package/ngcc/src/packages/entry_point_manifest.d.ts +0 -79
  136. package/ngcc/src/packages/ngcc_compiler_host.d.ts +0 -36
  137. package/ngcc/src/packages/patch_ts_expando_initializer.d.ts +0 -41
  138. package/ngcc/src/packages/source_file_cache.d.ts +0 -97
  139. package/ngcc/src/packages/transformer.d.ts +0 -70
  140. package/ngcc/src/path_mappings.d.ts +0 -19
  141. package/ngcc/src/rendering/commonjs_rendering_formatter.d.ts +0 -34
  142. package/ngcc/src/rendering/dts_renderer.d.ts +0 -51
  143. package/ngcc/src/rendering/esm5_rendering_formatter.d.ts +0 -35
  144. package/ngcc/src/rendering/esm_rendering_formatter.d.ts +0 -84
  145. package/ngcc/src/rendering/ngcc_import_rewriter.d.ts +0 -13
  146. package/ngcc/src/rendering/renderer.d.ts +0 -72
  147. package/ngcc/src/rendering/rendering_formatter.d.ts +0 -37
  148. package/ngcc/src/rendering/source_maps.d.ts +0 -23
  149. package/ngcc/src/rendering/umd_rendering_formatter.d.ts +0 -54
  150. package/ngcc/src/rendering/utils.d.ts +0 -24
  151. package/ngcc/src/utils.d.ts +0 -112
  152. package/ngcc/src/writing/cleaning/cleaning_strategies.d.ts +0 -44
  153. package/ngcc/src/writing/cleaning/package_cleaner.d.ts +0 -38
  154. package/ngcc/src/writing/cleaning/utils.d.ts +0 -15
  155. package/ngcc/src/writing/file_writer.d.ts +0 -28
  156. package/ngcc/src/writing/in_place_file_writer.d.ts +0 -28
  157. package/ngcc/src/writing/new_entry_point_file_writer.d.ts +0 -48
  158. package/ngcc/src/writing/package_json_updater.d.ts +0 -98
  159. package/src/ngtsc/shims/src/factory_generator.d.ts +0 -24
  160. package/src/ngtsc/shims/src/summary_generator.d.ts +0 -15
  161. package/src/transformers/downlevel_decorators_transform/patch_alias_reference_resolution.d.ts +0 -14
  162. /package/bundles/{chunk-ZB4CDKOH.js.map → chunk-4TCRZYAK.js.map} +0 -0
  163. /package/bundles/{chunk-NJMZRTB6.js.map → chunk-54RHUHYB.js.map} +0 -0
  164. /package/bundles/{chunk-64X67E3N.js.map → chunk-6CARGXRJ.js.map} +0 -0
  165. /package/bundles/{chunk-6ZJFIQBG.js.map → chunk-GYHDNUIK.js.map} +0 -0
@@ -1,299 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import ts from 'typescript';
9
- import { ClassDeclaration, ClassMember, Declaration, Decorator, FunctionDefinition } from '../../../src/ngtsc/reflection';
10
- import { Esm2015ReflectionHost, ParamInfo } from './esm2015_host';
11
- import { NgccClassSymbol } from './ngcc_host';
12
- /**
13
- * ESM5 packages contain ECMAScript IIFE functions that act like classes. For example:
14
- *
15
- * ```
16
- * var CommonModule = (function () {
17
- * function CommonModule() {
18
- * }
19
- * CommonModule.decorators = [ ... ];
20
- * return CommonModule;
21
- * ```
22
- *
23
- * * "Classes" are decorated if they have a static property called `decorators`.
24
- * * Members are decorated if there is a matching key on a static property
25
- * called `propDecorators`.
26
- * * Constructor parameters decorators are found on an object returned from
27
- * a static method called `ctorParameters`.
28
- *
29
- */
30
- export declare class Esm5ReflectionHost extends Esm2015ReflectionHost {
31
- getBaseClassExpression(clazz: ClassDeclaration): ts.Expression | null;
32
- /**
33
- * Trace an identifier to its declaration, if possible.
34
- *
35
- * This method attempts to resolve the declaration of the given identifier, tracing back through
36
- * imports and re-exports until the original declaration statement is found. A `Declaration`
37
- * object is returned if the original declaration is found, or `null` is returned otherwise.
38
- *
39
- * In ES5, the implementation of a class is a function expression that is hidden inside an IIFE.
40
- * If we are looking for the declaration of the identifier of the inner function expression, we
41
- * will get hold of the outer "class" variable declaration and return its identifier instead. See
42
- * `getClassDeclarationFromInnerFunctionDeclaration()` for more info.
43
- *
44
- * @param id a TypeScript `ts.Identifier` to trace back to a declaration.
45
- *
46
- * @returns metadata about the `Declaration` if the original declaration is found, or `null`
47
- * otherwise.
48
- */
49
- getDeclarationOfIdentifier(id: ts.Identifier): Declaration | null;
50
- /**
51
- * Parse a function declaration to find the relevant metadata about it.
52
- *
53
- * In ESM5 we need to do special work with optional arguments to the function, since they get
54
- * their own initializer statement that needs to be parsed and then not included in the "body"
55
- * statements of the function.
56
- *
57
- * @param node the function declaration to parse.
58
- * @returns an object containing the node, statements and parameters of the function.
59
- */
60
- getDefinitionOfFunction(node: ts.Node): FunctionDefinition | null;
61
- /**
62
- * Check whether a `Declaration` corresponds with a known declaration, such as a TypeScript helper
63
- * function, and set its `known` property to the appropriate `KnownDeclaration`.
64
- *
65
- * @param decl The `Declaration` to check.
66
- * @return The passed in `Declaration` (potentially enhanced with a `KnownDeclaration`).
67
- */
68
- detectKnownDeclaration<T extends Declaration>(decl: T): T;
69
- /**
70
- * In ES5, the implementation of a class is a function expression that is hidden inside an IIFE,
71
- * whose value is assigned to a variable (which represents the class to the rest of the program).
72
- * So we might need to dig around to get hold of the "class" declaration.
73
- *
74
- * This method extracts a `NgccClassSymbol` if `declaration` is the function declaration inside
75
- * the IIFE. Otherwise, undefined is returned.
76
- *
77
- * @param declaration the declaration whose symbol we are finding.
78
- * @returns the symbol for the node or `undefined` if it is not a "class" or has no symbol.
79
- */
80
- protected getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol | undefined;
81
- /**
82
- * Find the declarations of the constructor parameters of a class identified by its symbol.
83
- *
84
- * In ESM5, there is no "class" so the constructor that we want is actually the inner function
85
- * declaration inside the IIFE, whose return value is assigned to the outer variable declaration
86
- * (that represents the class to the rest of the program).
87
- *
88
- * @param classSymbol the symbol of the class (i.e. the outer variable declaration) whose
89
- * parameters we want to find.
90
- * @returns an array of `ts.ParameterDeclaration` objects representing each of the parameters in
91
- * the class's constructor or `null` if there is no constructor.
92
- */
93
- protected getConstructorParameterDeclarations(classSymbol: NgccClassSymbol): ts.ParameterDeclaration[] | null;
94
- /**
95
- * Get the parameter type and decorators for the constructor of a class,
96
- * where the information is stored on a static method of the class.
97
- *
98
- * In this case the decorators are stored in the body of a method
99
- * (`ctorParameters`) attached to the constructor function.
100
- *
101
- * Note that unlike ESM2015 this is a function expression rather than an arrow
102
- * function:
103
- *
104
- * ```
105
- * SomeDirective.ctorParameters = function() { return [
106
- * { type: ViewContainerRef, },
107
- * { type: TemplateRef, },
108
- * { type: IterableDiffers, },
109
- * { type: undefined, decorators: [{ type: Inject, args: [INJECTED_TOKEN,] },] },
110
- * ]; };
111
- * ```
112
- *
113
- * @param paramDecoratorsProperty the property that holds the parameter info we want to get.
114
- * @returns an array of objects containing the type and decorators for each parameter.
115
- */
116
- protected getParamInfoFromStaticProperty(paramDecoratorsProperty: ts.Symbol): ParamInfo[] | null;
117
- /**
118
- * Reflect over a symbol and extract the member information, combining it with the
119
- * provided decorator information, and whether it is a static member.
120
- *
121
- * If a class member uses accessors (e.g getters and/or setters) then it gets downleveled
122
- * in ES5 to a single `Object.defineProperty()` call. In that case we must parse this
123
- * call to extract the one or two ClassMember objects that represent the accessors.
124
- *
125
- * @param symbol the symbol for the member to reflect over.
126
- * @param decorators an array of decorators associated with the member.
127
- * @param isStatic true if this member is static, false if it is an instance property.
128
- * @returns the reflected member information, or null if the symbol is not a member.
129
- */
130
- protected reflectMembers(symbol: ts.Symbol, decorators?: Decorator[], isStatic?: boolean): ClassMember[] | null;
131
- /**
132
- * Find statements related to the given class that may contain calls to a helper.
133
- *
134
- * In ESM5 code the helper calls are hidden inside the class's IIFE.
135
- *
136
- * @param classSymbol the class whose helper calls we are interested in. We expect this symbol
137
- * to reference the inner identifier inside the IIFE.
138
- * @returns an array of statements that may contain helper calls.
139
- */
140
- protected getStatementsForClass(classSymbol: NgccClassSymbol): ts.Statement[];
141
- /**
142
- * A constructor function may have been "synthesized" by TypeScript during JavaScript emit,
143
- * in the case no user-defined constructor exists and e.g. property initializers are used.
144
- * Those initializers need to be emitted into a constructor in JavaScript, so the TypeScript
145
- * compiler generates a synthetic constructor.
146
- *
147
- * We need to identify such constructors as ngcc needs to be able to tell if a class did
148
- * originally have a constructor in the TypeScript source. For ES5, we can not tell an
149
- * empty constructor apart from a synthesized constructor, but fortunately that does not
150
- * matter for the code generated by ngtsc.
151
- *
152
- * When a class has a superclass however, a synthesized constructor must not be considered
153
- * as a user-defined constructor as that prevents a base factory call from being created by
154
- * ngtsc, resulting in a factory function that does not inject the dependencies of the
155
- * superclass. Hence, we identify a default synthesized super call in the constructor body,
156
- * according to the structure that TypeScript's ES2015 to ES5 transformer generates in
157
- * https://github.com/Microsoft/TypeScript/blob/v3.2.2/src/compiler/transformers/es2015.ts#L1082-L1098
158
- *
159
- * Additionally, we handle synthetic delegate constructors that are emitted when TypeScript
160
- * downlevel's ES2015 synthetically generated to ES5. These vary slightly from the default
161
- * structure mentioned above because the ES2015 output uses a spread operator, for delegating
162
- * to the parent constructor, that is preserved through a TypeScript helper in ES5. e.g.
163
- *
164
- * ```
165
- * return _super.apply(this, tslib.__spread(arguments)) || this;
166
- * ```
167
- *
168
- * or, since TypeScript 4.2 it would be
169
- *
170
- * ```
171
- * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this;
172
- * ```
173
- *
174
- * Such constructs can be still considered as synthetic delegate constructors as they are
175
- * the product of a common TypeScript to ES5 synthetic constructor, just being downleveled
176
- * to ES5 using `tsc`. See: https://github.com/angular/angular/issues/38453.
177
- *
178
- *
179
- * @param constructor a constructor function to test
180
- * @returns true if the constructor appears to have been synthesized
181
- */
182
- private isSynthesizedConstructor;
183
- /**
184
- * Identifies synthesized super calls which pass-through function arguments directly and are
185
- * being assigned to a common `_this` variable. The following patterns we intend to match:
186
- *
187
- * 1. Delegate call emitted by TypeScript when it emits ES5 directly.
188
- * ```
189
- * var _this = _super !== null && _super.apply(this, arguments) || this;
190
- * ```
191
- *
192
- * 2. Delegate call emitted by TypeScript when it downlevel's ES2015 to ES5.
193
- * ```
194
- * var _this = _super.apply(this, tslib.__spread(arguments)) || this;
195
- * ```
196
- * or using the syntax emitted since TypeScript 4.2:
197
- * ```
198
- * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this;
199
- * ```
200
- *
201
- * @param statement a statement that may be a synthesized super call
202
- * @returns true if the statement looks like a synthesized super call
203
- */
204
- private isSynthesizedSuperThisAssignment;
205
- /**
206
- * Identifies synthesized super calls which pass-through function arguments directly and
207
- * are being returned. The following patterns correspond to synthetic super return calls:
208
- *
209
- * 1. Delegate call emitted by TypeScript when it emits ES5 directly.
210
- * ```
211
- * return _super !== null && _super.apply(this, arguments) || this;
212
- * ```
213
- *
214
- * 2. Delegate call emitted by TypeScript when it downlevel's ES2015 to ES5.
215
- * ```
216
- * return _super.apply(this, tslib.__spread(arguments)) || this;
217
- * ```
218
- * or using the syntax emitted since TypeScript 4.2:
219
- * ```
220
- * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this;
221
- * ```
222
- *
223
- * @param statement a statement that may be a synthesized super call
224
- * @returns true if the statement looks like a synthesized super call
225
- */
226
- private isSynthesizedSuperReturnStatement;
227
- /**
228
- * Identifies synthesized super calls which pass-through function arguments directly. The
229
- * synthetic delegate super call match the following patterns we intend to match:
230
- *
231
- * 1. Delegate call emitted by TypeScript when it emits ES5 directly.
232
- * ```
233
- * _super !== null && _super.apply(this, arguments) || this;
234
- * ```
235
- *
236
- * 2. Delegate call emitted by TypeScript when it downlevel's ES2015 to ES5.
237
- * ```
238
- * _super.apply(this, tslib.__spread(arguments)) || this;
239
- * ```
240
- * or using the syntax emitted since TypeScript 4.2:
241
- * ```
242
- * return _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this;
243
- * ```
244
- *
245
- * @param expression an expression that may represent a default super call
246
- * @returns true if the expression corresponds with the above form
247
- */
248
- private isSynthesizedDefaultSuperCall;
249
- /**
250
- * Tests whether the expression corresponds to a `super` call passing through
251
- * function arguments without any modification. e.g.
252
- *
253
- * ```
254
- * _super !== null && _super.apply(this, arguments) || this;
255
- * ```
256
- *
257
- * This structure is generated by TypeScript when transforming ES2015 to ES5, see
258
- * https://github.com/Microsoft/TypeScript/blob/v3.2.2/src/compiler/transformers/es2015.ts#L1148-L1163
259
- *
260
- * Additionally, we also handle cases where `arguments` are wrapped by a TypeScript spread
261
- * helper.
262
- * This can happen if ES2015 class output contain auto-generated constructors due to class
263
- * members. The ES2015 output will be using `super(...arguments)` to delegate to the superclass,
264
- * but once downleveled to ES5, the spread operator will be persisted through a TypeScript spread
265
- * helper. For example:
266
- *
267
- * ```
268
- * _super.apply(this, __spread(arguments)) || this;
269
- * ```
270
- *
271
- * or, since TypeScript 4.2 it would be
272
- *
273
- * ```
274
- * _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments))) || this;
275
- * ```
276
- *
277
- * More details can be found in: https://github.com/angular/angular/issues/38453.
278
- *
279
- * @param expression an expression that may represent a default super call
280
- * @returns true if the expression corresponds with the above form
281
- */
282
- private isSuperApplyCall;
283
- /**
284
- * Determines if the provided expression is one of the following call expressions:
285
- *
286
- * 1. `__spread(arguments)`
287
- * 2. `__spreadArray([], __read(arguments))`
288
- * 3. `__spreadArray([], __read(arguments), false)`
289
- *
290
- * The tslib helpers may have been emitted inline as in the above example, or they may be read
291
- * from a namespace import.
292
- */
293
- private isSpreadArgumentsExpression;
294
- /**
295
- * Inspects the provided expression and determines if it corresponds with a known helper function
296
- * as receiver expression.
297
- */
298
- private extractKnownHelperCall;
299
- }
@@ -1,87 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import ts from 'typescript';
9
- import { ClassDeclaration, Declaration, Decorator, ReflectionHost } from '../../../src/ngtsc/reflection';
10
- import { SymbolWithValueDeclaration } from '../../../src/ngtsc/util/src/typescript';
11
- /**
12
- * The symbol corresponding to a "class" declaration. I.e. a `ts.Symbol` whose `valueDeclaration` is
13
- * a `ClassDeclaration`.
14
- */
15
- export type ClassSymbol = ts.Symbol & {
16
- valueDeclaration: ClassDeclaration;
17
- };
18
- /**
19
- * A representation of a class that accounts for the potential existence of two `ClassSymbol`s for a
20
- * given class, as the compiled JavaScript bundles that ngcc reflects on can have two declarations.
21
- */
22
- export interface NgccClassSymbol {
23
- /**
24
- * The name of the class.
25
- */
26
- name: string;
27
- /**
28
- * Represents the symbol corresponding with the outer declaration of the class. This should be
29
- * considered the public class symbol, i.e. its declaration is visible to the rest of the program.
30
- */
31
- declaration: ClassSymbol;
32
- /**
33
- * Represents the symbol corresponding with the inner declaration of the class, referred to as its
34
- * "implementation". This is not necessarily a `ClassSymbol` but rather just a `ts.Symbol`, as the
35
- * inner declaration does not need to satisfy the requirements imposed on a publicly visible class
36
- * declaration.
37
- */
38
- implementation: SymbolWithValueDeclaration;
39
- /**
40
- * Represents the symbol corresponding to a variable within a class IIFE that may be used to
41
- * attach static properties or decorated.
42
- */
43
- adjacent?: SymbolWithValueDeclaration;
44
- }
45
- /**
46
- * A reflection host that has extra methods for looking at non-Typescript package formats
47
- */
48
- export interface NgccReflectionHost extends ReflectionHost {
49
- /**
50
- * Find a symbol for a declaration that we think is a class.
51
- * @param declaration The declaration whose symbol we are finding
52
- * @returns the symbol for the declaration or `undefined` if it is not
53
- * a "class" or has no symbol.
54
- */
55
- getClassSymbol(declaration: ts.Node): NgccClassSymbol | undefined;
56
- /**
57
- * Retrieves all decorators of a given class symbol.
58
- * @param symbol Class symbol that can refer to a declaration which can hold decorators.
59
- * @returns An array of decorators or null if none are declared.
60
- */
61
- getDecoratorsOfSymbol(symbol: NgccClassSymbol): Decorator[] | null;
62
- /**
63
- * Retrieves all class symbols of a given source file.
64
- * @param sourceFile The source file to search for classes.
65
- * @returns An array of found class symbols.
66
- */
67
- findClassSymbols(sourceFile: ts.SourceFile): NgccClassSymbol[];
68
- /**
69
- * Find the last node that is relevant to the specified class.
70
- *
71
- * As well as the main declaration, classes can have additional statements such as static
72
- * properties (`SomeClass.staticProp = ...;`) and decorators (`__decorate(SomeClass, ...);`).
73
- * It is useful to know exactly where the class "ends" so that we can inject additional
74
- * statements after that point.
75
- *
76
- * @param classSymbol The class whose statements we want.
77
- */
78
- getEndOfClass(classSymbol: NgccClassSymbol): ts.Node;
79
- /**
80
- * Check whether a `Declaration` corresponds with a known declaration and set its `known` property
81
- * to the appropriate `KnownDeclaration`.
82
- *
83
- * @param decl The `Declaration` to check.
84
- * @return The passed in `Declaration` (potentially enhanced with a `KnownDeclaration`).
85
- */
86
- detectKnownDeclaration<T extends Declaration>(decl: T): T;
87
- }
@@ -1,85 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import ts from 'typescript';
9
- import { Logger } from '../../../src/ngtsc/logging';
10
- import { Declaration, Import } from '../../../src/ngtsc/reflection';
11
- import { BundleProgram } from '../packages/bundle_program';
12
- import { FactoryMap } from '../utils';
13
- import { Esm5ReflectionHost } from './esm5_host';
14
- import { NgccClassSymbol } from './ngcc_host';
15
- export declare class UmdReflectionHost extends Esm5ReflectionHost {
16
- protected umdModules: FactoryMap<ts.SourceFile, UmdModule | null>;
17
- protected umdExports: FactoryMap<ts.SourceFile, Map<string, Declaration<ts.Declaration>> | null>;
18
- protected umdImportPaths: FactoryMap<ts.ParameterDeclaration, string | null>;
19
- protected program: ts.Program;
20
- protected compilerHost: ts.CompilerHost;
21
- constructor(logger: Logger, isCore: boolean, src: BundleProgram, dts?: BundleProgram | null);
22
- getImportOfIdentifier(id: ts.Identifier): Import | null;
23
- getDeclarationOfIdentifier(id: ts.Identifier): Declaration | null;
24
- getExportsOfModule(module: ts.Node): Map<string, Declaration> | null;
25
- getUmdModule(sourceFile: ts.SourceFile): UmdModule | null;
26
- getUmdImportPath(importParameter: ts.ParameterDeclaration): string | null;
27
- /**
28
- * Get the top level statements for a module.
29
- *
30
- * In UMD modules these are the body of the UMD factory function.
31
- *
32
- * @param sourceFile The module whose statements we want.
33
- * @returns An array of top level statements for the given module.
34
- */
35
- protected getModuleStatements(sourceFile: ts.SourceFile): ts.Statement[];
36
- protected getClassSymbolFromOuterDeclaration(declaration: ts.Node): NgccClassSymbol | undefined;
37
- protected getClassSymbolFromInnerDeclaration(declaration: ts.Node): NgccClassSymbol | undefined;
38
- /**
39
- * Extract all "classes" from the `statement` and add them to the `classes` map.
40
- */
41
- protected addClassSymbolsFromStatement(classes: Map<ts.Symbol, NgccClassSymbol>, statement: ts.Statement): void;
42
- /**
43
- * Analyze the given statement to see if it corresponds with an exports declaration like
44
- * `exports.MyClass = MyClass_1 = <class def>;`. If so, the declaration of `MyClass_1`
45
- * is associated with the `MyClass` identifier.
46
- *
47
- * @param statement The statement that needs to be preprocessed.
48
- */
49
- protected preprocessStatement(statement: ts.Statement): void;
50
- private computeUmdModule;
51
- private computeExportsOfUmdModule;
52
- private computeImportPath;
53
- private extractBasicUmdExportDeclaration;
54
- private extractUmdWildcardReexports;
55
- private extractUmdDefinePropertyExportDeclaration;
56
- /**
57
- * Is the identifier a parameter on a UMD factory function, e.g. `function factory(this, core)`?
58
- * If so then return its declaration.
59
- */
60
- private findUmdImportParameter;
61
- private getUmdDeclaration;
62
- private getExportsDeclaration;
63
- private getUmdModuleDeclaration;
64
- private getImportPathFromParameter;
65
- private getImportPathFromRequireCall;
66
- /**
67
- * If this is an IIFE then try to grab the outer and inner classes otherwise fallback on the super
68
- * class.
69
- */
70
- protected getDeclarationOfExpression(expression: ts.Expression): Declaration | null;
71
- private resolveModuleName;
72
- }
73
- export declare function parseStatementForUmdModule(statement: ts.Statement): UmdModule | null;
74
- export declare function getImportsOfUmdModule(umdModule: UmdModule): {
75
- parameter: ts.ParameterDeclaration;
76
- path: string;
77
- }[];
78
- interface UmdModule {
79
- wrapperFn: ts.FunctionExpression;
80
- factoryFn: ts.FunctionExpression;
81
- factoryCalls: Record<'amdDefine' | 'commonJs' | 'commonJs2' | 'global', ts.CallExpression | null> & {
82
- cjsCallForImports: ts.CallExpression;
83
- };
84
- }
85
- export {};
@@ -1,9 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import ts from 'typescript';
9
- export declare function stripParentheses(node: ts.Node): ts.Node;
@@ -1,34 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { Logger } from '../../../src/ngtsc/logging';
9
- import { LockFile } from './lock_file';
10
- /**
11
- * AsyncLocker is used to prevent more than one instance of ngcc executing at the same time,
12
- * when being called in an asynchronous context.
13
- *
14
- * * When ngcc starts executing, it creates a file in the `compiler-cli/ngcc` folder.
15
- * * If it finds one is already there then it pauses and waits for the file to be removed by the
16
- * other process. If the file is not removed within a set timeout period given by
17
- * `retryDelay*retryAttempts` an error is thrown with a suitable error message.
18
- * * If the process locking the file changes, then we restart the timeout.
19
- * * When ngcc completes executing, it removes the file so that future ngcc executions can start.
20
- */
21
- export declare class AsyncLocker {
22
- private lockFile;
23
- protected logger: Logger;
24
- private retryDelay;
25
- private retryAttempts;
26
- constructor(lockFile: LockFile, logger: Logger, retryDelay: number, retryAttempts: number);
27
- /**
28
- * Run a function guarded by the lock file.
29
- *
30
- * @param fn The function to run.
31
- */
32
- lock<T>(fn: () => Promise<T>): Promise<T>;
33
- protected create(): Promise<void>;
34
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { AbsoluteFsPath, PathManipulation } from '../../../src/ngtsc/file_system';
9
- /** Wrapper for resolving the lcok file path. Useful for test patching. */
10
- export declare class LockFilePathResolver {
11
- static resolve(fs: PathManipulation): AbsoluteFsPath;
12
- }
13
- export interface LockFile {
14
- path: AbsoluteFsPath;
15
- /**
16
- * Write a lock file to disk containing the PID of the current process.
17
- */
18
- write(): void;
19
- /**
20
- * Read the PID, of the process holding the lock, from the lock-file.
21
- *
22
- * It is feasible that the lock-file was removed between the call to `write()` that effectively
23
- * checks for existence and this attempt to read the file. If so then this method should just
24
- * gracefully return `"{unknown}"`.
25
- */
26
- read(): string;
27
- /**
28
- * Remove the lock file from disk, whether or not it exists.
29
- */
30
- remove(): void;
31
- }
@@ -1,44 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * @license
4
- * Copyright Google LLC All Rights Reserved.
5
- *
6
- * Use of this source code is governed by an MIT-style license that can be
7
- * found in the LICENSE file at https://angular.io/license
8
- */
9
- import { ChildProcess } from 'child_process';
10
- import { AbsoluteFsPath, FileSystem } from '../../../../src/ngtsc/file_system';
11
- import { Logger } from '../../../../src/ngtsc/logging';
12
- import { LockFile } from '../lock_file';
13
- /**
14
- * This `LockFile` implementation uses a child-process to remove the lock file when the main process
15
- * exits (for whatever reason).
16
- *
17
- * There are a few milliseconds between the child-process being forked and it registering its
18
- * `disconnect` event, which is responsible for tidying up the lock-file in the event that the main
19
- * process exits unexpectedly.
20
- *
21
- * We eagerly create the unlocker child-process so that it maximizes the time before the lock-file
22
- * is actually written, which makes it very unlikely that the unlocker would not be ready in the
23
- * case that the developer hits Ctrl-C or closes the terminal within a fraction of a second of the
24
- * lock-file being created.
25
- *
26
- * The worst case scenario is that ngcc is killed too quickly and leaves behind an orphaned
27
- * lock-file. In which case the next ngcc run will display a helpful error message about deleting
28
- * the lock-file.
29
- */
30
- export declare class LockFileWithChildProcess implements LockFile {
31
- protected fs: FileSystem;
32
- protected logger: Logger;
33
- path: AbsoluteFsPath;
34
- private unlocker;
35
- constructor(fs: FileSystem, logger: Logger);
36
- write(): void;
37
- read(): string;
38
- remove(): void;
39
- protected createUnlocker(path: AbsoluteFsPath): ChildProcess;
40
- }
41
- /** Wrapper for resolving the lock file unlocker script. Useful for test patching. */
42
- export declare class LockFileUnlockerScriptResolver {
43
- static resolve(fs: FileSystem): AbsoluteFsPath;
44
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { AbsoluteFsPath, FileSystem } from '../../../../src/ngtsc/file_system';
9
- import { Logger } from '../../../../src/ngtsc/logging';
10
- /**
11
- * Remove the lock-file at the provided `lockFilePath` from the given file-system.
12
- *
13
- * It only removes the file if the pid stored in the file matches the provided `pid`.
14
- * The provided `pid` is of the process that is exiting and so no longer needs to hold the lock.
15
- */
16
- export declare function removeLockFile(fs: FileSystem, logger: Logger, lockFilePath: AbsoluteFsPath, pid: string): void;
@@ -1,35 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { LockFile } from './lock_file';
9
- /**
10
- * SyncLocker is used to prevent more than one instance of ngcc executing at the same time,
11
- * when being called in a synchronous context.
12
- *
13
- * * When ngcc starts executing, it creates a file in the `compiler-cli/ngcc` folder.
14
- * * If it finds one is already there then it fails with a suitable error message.
15
- * * When ngcc completes executing, it removes the file so that future ngcc executions can start.
16
- */
17
- export declare class SyncLocker {
18
- private lockFile;
19
- constructor(lockFile: LockFile);
20
- /**
21
- * Run the given function guarded by the lock file.
22
- *
23
- * @param fn the function to run.
24
- * @returns the value returned from the `fn` call.
25
- */
26
- lock<T>(fn: () => T): T;
27
- /**
28
- * Write a lock file to disk, or error if there is already one there.
29
- */
30
- protected create(): void;
31
- /**
32
- * The lock-file already exists so raise a helpful error.
33
- */
34
- protected handleExistingLockFile(): void;
35
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright Google LLC All Rights Reserved.
4
- *
5
- * Use of this source code is governed by an MIT-style license that can be
6
- * found in the LICENSE file at https://angular.io/license
7
- */
8
- import { AsyncNgccOptions, SyncNgccOptions } from './ngcc_options';
9
- /**
10
- * This is the main entry-point into ngcc (aNGular Compatibility Compiler).
11
- *
12
- * You can call this function to process one or more npm packages, to ensure
13
- * that they are compatible with the ivy compiler (ngtsc).
14
- *
15
- * @param options The options telling ngcc what to compile and how.
16
- */
17
- export declare function mainNgcc<T extends AsyncNgccOptions | SyncNgccOptions>(options: T): T extends AsyncNgccOptions ? Promise<void> : void;