@angular/compiler-cli 17.0.5 → 17.0.7

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 (46) hide show
  1. package/bundles/{chunk-3ZDTTLEA.js → chunk-B5URQIVL.js} +19 -12
  2. package/bundles/chunk-B5URQIVL.js.map +6 -0
  3. package/bundles/{chunk-CLTYCPJK.js → chunk-G64XB6AU.js} +35 -7
  4. package/bundles/chunk-G64XB6AU.js.map +6 -0
  5. package/bundles/{chunk-QFTMYSLL.js → chunk-GT7FGHLZ.js} +3 -3
  6. package/bundles/{chunk-3GCK5JND.js → chunk-KDLK7PF4.js} +131 -30
  7. package/bundles/chunk-KDLK7PF4.js.map +6 -0
  8. package/bundles/{chunk-QDHJ26RK.js → chunk-O55FKOOW.js} +6 -5
  9. package/bundles/chunk-O55FKOOW.js.map +6 -0
  10. package/bundles/{chunk-BNWUZHCZ.js → chunk-T6CN22EQ.js} +2 -2
  11. package/bundles/{chunk-VNJI35KB.js → chunk-XXICUNOF.js} +2 -2
  12. package/bundles/index.js +6 -7
  13. package/bundles/index.js.map +1 -1
  14. package/bundles/linker/babel/index.js +3 -3
  15. package/bundles/linker/index.js +3 -3
  16. package/bundles/private/migrations.js +3 -4
  17. package/bundles/private/tooling.js +2 -3
  18. package/bundles/src/bin/ng_xi18n.js +5 -6
  19. package/bundles/src/bin/ng_xi18n.js.map +1 -1
  20. package/bundles/src/bin/ngc.js +5 -6
  21. package/bundles/src/bin/ngc.js.map +1 -1
  22. package/bundles_metadata.json +1 -1
  23. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  24. package/package.json +2 -2
  25. package/src/ngtsc/diagnostics/src/error_code.d.ts +14 -0
  26. package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +2 -1
  27. package/src/ngtsc/imports/src/emitter.d.ts +5 -1
  28. package/src/ngtsc/imports/src/references.d.ts +3 -1
  29. package/src/ngtsc/reflection/src/host.d.ts +6 -1
  30. package/src/ngtsc/reflection/src/typescript.d.ts +1 -0
  31. package/src/ngtsc/typecheck/api/api.d.ts +8 -0
  32. package/src/ngtsc/typecheck/api/context.d.ts +3 -1
  33. package/src/ngtsc/typecheck/extended/index.d.ts +1 -0
  34. package/src/ngtsc/typecheck/src/context.d.ts +1 -1
  35. package/src/ngtsc/typecheck/src/environment.d.ts +3 -3
  36. package/src/ngtsc/typecheck/src/oob.d.ts +7 -1
  37. package/src/ngtsc/typecheck/src/type_check_block.d.ts +5 -2
  38. package/bundles/chunk-3GCK5JND.js.map +0 -6
  39. package/bundles/chunk-3ZDTTLEA.js.map +0 -6
  40. package/bundles/chunk-CLTYCPJK.js.map +0 -6
  41. package/bundles/chunk-QDHJ26RK.js.map +0 -6
  42. package/bundles/chunk-UHYH6BYB.js +0 -12
  43. package/bundles/chunk-UHYH6BYB.js.map +0 -6
  44. /package/bundles/{chunk-QFTMYSLL.js.map → chunk-GT7FGHLZ.js.map} +0 -0
  45. /package/bundles/{chunk-BNWUZHCZ.js.map → chunk-T6CN22EQ.js.map} +0 -0
  46. /package/bundles/{chunk-VNJI35KB.js.map → chunk-XXICUNOF.js.map} +0 -0
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "17.0.5";
10
+ export declare const PLACEHOLDER_VERSION = "17.0.7";
11
11
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
12
12
  /**
13
13
  * Parses the value of an enum from the AST value's symbol name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "17.0.5",
3
+ "version": "17.0.7",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -53,7 +53,7 @@
53
53
  "yargs": "^17.2.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@angular/compiler": "17.0.5",
56
+ "@angular/compiler": "17.0.7",
57
57
  "typescript": ">=5.2 <5.3"
58
58
  },
59
59
  "repository": {
@@ -238,6 +238,20 @@ export declare enum ErrorCode {
238
238
  * ```
239
239
  */
240
240
  INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT = 8010,
241
+ /**
242
+ * A control flow node is projected at the root of a component and is preventing its direct
243
+ * descendants from being projected, because it has more than one root node.
244
+ *
245
+ * ```
246
+ * <comp>
247
+ * @if (expr) {
248
+ * <div projectsIntoSlot></div>
249
+ * Text preventing the div from being projected
250
+ * }
251
+ * </comp>
252
+ * ```
253
+ */
254
+ CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = 8011,
241
255
  /**
242
256
  * A two way binding in a template has an incorrect syntax,
243
257
  * parentheses outside brackets. For example:
@@ -23,5 +23,6 @@ export declare enum ExtendedTemplateDiagnosticName {
23
23
  MISSING_NGFOROF_LET = "missingNgForOfLet",
24
24
  SUFFIX_NOT_SUPPORTED = "suffixNotSupported",
25
25
  SKIP_HYDRATION_NOT_STATIC = "skipHydrationNotStatic",
26
- INTERPOLATED_SIGNAL_NOT_INVOKED = "interpolatedSignalNotInvoked"
26
+ INTERPOLATED_SIGNAL_NOT_INVOKED = "interpolatedSignalNotInvoked",
27
+ CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION = "controlFlowPreventingContentProjection"
27
28
  }
@@ -51,7 +51,11 @@ export declare enum ImportFlags {
51
51
  * paths may not be possible for those, hence this flag only applies when importing from a
52
52
  * declaration file.
53
53
  */
54
- AllowRelativeDtsImports = 8
54
+ AllowRelativeDtsImports = 8,
55
+ /**
56
+ * Indicates that references coming from ambient imports are allowed.
57
+ */
58
+ AllowAmbientReferences = 16
55
59
  }
56
60
  /**
57
61
  * An emitter strategy has the ability to indicate which `ts.SourceFile` is being imported by the
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { Expression } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
+ import { AmbientImport } from '../../reflection';
10
11
  export interface OwningModule {
11
12
  specifier: string;
12
13
  resolutionContext: string;
@@ -46,7 +47,8 @@ export declare class Reference<T extends ts.Node = ts.Node> {
46
47
  */
47
48
  synthetic: boolean;
48
49
  private _alias;
49
- constructor(node: T, bestGuessOwningModule?: OwningModule | null);
50
+ readonly isAmbient: boolean;
51
+ constructor(node: T, bestGuessOwningModule?: OwningModule | AmbientImport | null);
50
52
  /**
51
53
  * The best guess at which module specifier owns this particular reference, or `null` if there
52
54
  * isn't one.
@@ -410,6 +410,11 @@ export interface Import {
410
410
  * A type that is used to identify a declaration.
411
411
  */
412
412
  export type DeclarationNode = ts.Declaration;
413
+ export type AmbientImport = {
414
+ __brand: 'AmbientImport';
415
+ };
416
+ /** Indicates that a declaration is referenced through an ambient type. */
417
+ export declare const AmbientImport: AmbientImport;
413
418
  /**
414
419
  * The declaration of a symbol, along with information about how it was imported into the
415
420
  * application.
@@ -420,7 +425,7 @@ export interface Declaration<T extends ts.Declaration = ts.Declaration> {
420
425
  * was imported via an absolute module (even through a chain of re-exports). If the symbol is part
421
426
  * of the application and was not imported from an absolute path, this will be `null`.
422
427
  */
423
- viaModule: string | null;
428
+ viaModule: string | AmbientImport | null;
424
429
  /**
425
430
  * TypeScript reference to the declaration itself, if one exists.
426
431
  */
@@ -56,6 +56,7 @@ export declare class TypeScriptReflectionHost implements ReflectionHost {
56
56
  * Get the set of declarations declared in `file` which are exported.
57
57
  */
58
58
  private getLocalExportedDeclarationsOfSourceFile;
59
+ private _viaModule;
59
60
  }
60
61
  export declare function reflectNameOfDeclaration(decl: ts.Declaration): string | null;
61
62
  export declare function reflectIdentifierOfDeclaration(decl: ts.Declaration): ts.Identifier | null;
@@ -69,6 +69,10 @@ export interface TypeCheckBlockMetadata {
69
69
  */
70
70
  schemas: SchemaMetadata[];
71
71
  isStandalone: boolean;
72
+ /**
73
+ * A boolean indicating whether the component preserves whitespaces in its template.
74
+ */
75
+ preserveWhitespaces: boolean;
72
76
  }
73
77
  export interface TypeCtorMetadata {
74
78
  /**
@@ -238,6 +242,10 @@ export interface TypeCheckingConfig {
238
242
  * This is currently an unsupported feature.
239
243
  */
240
244
  checkQueries: false;
245
+ /**
246
+ * Whether to check if control flow syntax will prevent a node from being projected.
247
+ */
248
+ controlFlowPreventingContentProjection: 'error' | 'warning' | 'suppress';
241
249
  /**
242
250
  * Whether to use any generic types of the context component.
243
251
  *
@@ -33,8 +33,10 @@ export interface TypeCheckContext {
33
33
  * @param file the `ParseSourceFile` associated with the template.
34
34
  * @param parseErrors the `ParseError`'s associated with the template.
35
35
  * @param isStandalone a boolean indicating whether the component is standalone.
36
+ * @param preserveWhitespaces a boolean indicating whether the component's template preserves
37
+ * whitespaces.
36
38
  */
37
- addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean): void;
39
+ addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean, preserveWhitespaces: boolean): void;
38
40
  }
39
41
  /**
40
42
  * Interface to trigger generation of type-checking code for a program given a new
@@ -9,3 +9,4 @@ import { ErrorCode, ExtendedTemplateDiagnosticName } from '../../diagnostics';
9
9
  import { TemplateCheckFactory } from './api';
10
10
  export { ExtendedTemplateCheckerImpl } from './src/extended_template_checker';
11
11
  export declare const ALL_DIAGNOSTIC_FACTORIES: readonly TemplateCheckFactory<ErrorCode, ExtendedTemplateDiagnosticName>[];
12
+ export declare const SUPPORTED_DIAGNOSTIC_NAMES: Set<string>;
@@ -166,7 +166,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
166
166
  *
167
167
  * Implements `TypeCheckContext.addTemplate`.
168
168
  */
169
- addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean): void;
169
+ addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean, preserveWhitespaces: boolean): void;
170
170
  /**
171
171
  * Record a type constructor for the given `node` with the given `ctorMetadata`.
172
172
  */
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { TransplantedType, Type } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
- import { Reference, ReferenceEmitter } from '../../imports';
10
+ import { ImportFlags, Reference, ReferenceEmitter } from '../../imports';
11
11
  import { ClassDeclaration, ReflectionHost } from '../../reflection';
12
12
  import { ImportManager } from '../../translator';
13
13
  import { TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
@@ -49,13 +49,13 @@ export declare class Environment implements ReferenceEmitEnvironment {
49
49
  * This may involve importing the node into the file if it's not declared there already.
50
50
  */
51
51
  reference(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>): ts.Expression;
52
- canReferenceType(ref: Reference): boolean;
52
+ canReferenceType(ref: Reference, flags?: ImportFlags): boolean;
53
53
  /**
54
54
  * Generate a `ts.TypeNode` that references the given node as a type.
55
55
  *
56
56
  * This may involve importing the node into the file if it's not declared there already.
57
57
  */
58
- referenceType(ref: Reference): ts.TypeNode;
58
+ referenceType(ref: Reference, flags?: ImportFlags): ts.TypeNode;
59
59
  private emitTypeParameters;
60
60
  /**
61
61
  * Generate a `ts.TypeNode` that references a given type from the provided module.
@@ -5,7 +5,8 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { BindingPipe, PropertyRead, PropertyWrite, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstForLoopBlock, TmplAstHoverDeferredTrigger, TmplAstInteractionDeferredTrigger, TmplAstReference, TmplAstTemplate, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
8
+ import { BindingPipe, PropertyRead, PropertyWrite, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstElement, TmplAstForLoopBlock, TmplAstHoverDeferredTrigger, TmplAstIfBlockBranch, TmplAstInteractionDeferredTrigger, TmplAstReference, TmplAstTemplate, TmplAstVariable, TmplAstViewportDeferredTrigger } from '@angular/compiler';
9
+ import ts from 'typescript';
9
10
  import { ClassDeclaration } from '../../reflection';
10
11
  import { TemplateDiagnostic, TemplateId } from '../api';
11
12
  import { TemplateSourceResolver } from './tcb_util';
@@ -69,6 +70,10 @@ export interface OutOfBandDiagnosticRecorder {
69
70
  * Reports deferred triggers that cannot access the element they're referring to.
70
71
  */
71
72
  inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
73
+ /**
74
+ * Reports cases where control flow nodes prevent content projection.
75
+ */
76
+ controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstForLoopBlock, preservesWhitespaces: boolean): void;
72
77
  }
73
78
  export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnosticRecorder {
74
79
  private resolver;
@@ -91,4 +96,5 @@ export declare class OutOfBandDiagnosticRecorderImpl implements OutOfBandDiagnos
91
96
  missingRequiredInputs(templateId: TemplateId, element: TmplAstElement | TmplAstTemplate, directiveName: string, isComponent: boolean, inputAliases: string[]): void;
92
97
  illegalForLoopTrackAccess(templateId: TemplateId, block: TmplAstForLoopBlock, access: PropertyRead): void;
93
98
  inaccessibleDeferredTriggerElement(templateId: TemplateId, trigger: TmplAstHoverDeferredTrigger | TmplAstInteractionDeferredTrigger | TmplAstViewportDeferredTrigger): void;
99
+ controlFlowPreventingContentProjection(templateId: TemplateId, category: ts.DiagnosticCategory, projectionNode: TmplAstElement | TmplAstTemplate, componentName: string, slotSelector: string, controlFlowNode: TmplAstIfBlockBranch | TmplAstForLoopBlock, preservesWhitespaces: boolean): void;
94
100
  }
@@ -129,8 +129,9 @@ export declare class Context {
129
129
  private pipes;
130
130
  readonly schemas: SchemaMetadata[];
131
131
  readonly hostIsStandalone: boolean;
132
+ readonly hostPreserveWhitespaces: boolean;
132
133
  private nextId;
133
- constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], hostIsStandalone: boolean);
134
+ constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], hostIsStandalone: boolean, hostPreserveWhitespaces: boolean);
134
135
  /**
135
136
  * Allocate a new variable name for use within the `Context`.
136
137
  *
@@ -191,7 +192,8 @@ declare class Scope {
191
192
  private templateCtxOpMap;
192
193
  /**
193
194
  * Map of variables declared on the template that created this `Scope` (represented by
194
- * `TmplAstVariable` nodes) to the index of their `TcbVariableOp`s in the `opQueue`.
195
+ * `TmplAstVariable` nodes) to the index of their `TcbVariableOp`s in the `opQueue`, or to
196
+ * pre-resolved variable identifiers.
195
197
  */
196
198
  private varMap;
197
199
  /**
@@ -271,6 +273,7 @@ declare class Scope {
271
273
  private appendOutputsOfNode;
272
274
  private appendDeepSchemaChecks;
273
275
  private appendIcuExpressions;
276
+ private appendContentProjectionCheckOp;
274
277
  private appendDeferredBlock;
275
278
  private appendDeferredTriggers;
276
279
  private appendReferenceBasedDeferredTrigger;