@angular/compiler 14.0.0-next.1 → 14.0.0-next.4

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 (39) hide show
  1. package/esm2020/src/compiler_facade_interface.mjs +1 -1
  2. package/esm2020/src/expression_parser/parser.mjs +34 -15
  3. package/esm2020/src/jit_compiler_facade.mjs +4 -1
  4. package/esm2020/src/output/output_ast.mjs +1 -1
  5. package/esm2020/src/render3/partial/api.mjs +1 -1
  6. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  7. package/esm2020/src/render3/partial/directive.mjs +1 -1
  8. package/esm2020/src/render3/partial/factory.mjs +1 -1
  9. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2020/src/render3/partial/injector.mjs +1 -1
  11. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  13. package/esm2020/src/render3/r3_pipe_compiler.mjs +1 -1
  14. package/esm2020/src/render3/r3_template_transform.mjs +4 -4
  15. package/esm2020/src/render3/view/api.mjs +1 -1
  16. package/esm2020/src/render3/view/compiler.mjs +40 -40
  17. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +2 -5
  18. package/esm2020/src/render3/view/i18n/meta.mjs +11 -6
  19. package/esm2020/src/render3/view/template.mjs +78 -122
  20. package/esm2020/src/render3/view/util.mjs +94 -15
  21. package/esm2020/src/template_parser/binding_parser.mjs +11 -11
  22. package/esm2020/src/version.mjs +1 -1
  23. package/fesm2015/compiler.mjs +278 -219
  24. package/fesm2015/compiler.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +1 -1
  26. package/fesm2020/compiler.mjs +276 -217
  27. package/fesm2020/compiler.mjs.map +1 -1
  28. package/fesm2020/testing.mjs +1 -1
  29. package/package.json +1 -1
  30. package/src/compiler_facade_interface.d.ts +4 -0
  31. package/src/expression_parser/parser.d.ts +19 -3
  32. package/src/output/output_ast.d.ts +2 -1
  33. package/src/render3/partial/api.d.ts +10 -0
  34. package/src/render3/r3_pipe_compiler.d.ts +4 -0
  35. package/src/render3/view/api.d.ts +4 -0
  36. package/src/render3/view/i18n/meta.d.ts +1 -1
  37. package/src/render3/view/template.d.ts +0 -3
  38. package/src/render3/view/util.d.ts +19 -2
  39. package/src/template_parser/binding_parser.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.1
2
+ * @license Angular v14.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler",
3
- "version": "14.0.0-next.1",
3
+ "version": "14.0.0-next.4",
4
4
  "description": "Angular - the compiler library",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -86,6 +86,7 @@ export interface R3PipeMetadataFacade {
86
86
  type: Type;
87
87
  pipeName: string;
88
88
  pure: boolean;
89
+ isStandalone: boolean;
89
90
  }
90
91
  export interface R3InjectableMetadataFacade {
91
92
  name: string;
@@ -136,6 +137,7 @@ export interface R3DirectiveMetadataFacade {
136
137
  exportAs: string[] | null;
137
138
  providers: Provider[] | null;
138
139
  viewQueries: R3QueryMetadataFacade[];
140
+ isStandalone: boolean;
139
141
  }
140
142
  export interface R3ComponentMetadataFacade extends R3DirectiveMetadataFacade {
141
143
  template: string;
@@ -177,6 +179,7 @@ export interface R3DeclareDirectiveFacade {
177
179
  exportAs?: string[];
178
180
  usesInheritance?: boolean;
179
181
  usesOnChanges?: boolean;
182
+ isStandalone?: boolean;
180
183
  }
181
184
  export interface R3DeclareComponentFacade extends R3DeclareDirectiveFacade {
182
185
  template: string;
@@ -271,6 +274,7 @@ export interface R3DeclarePipeFacade {
271
274
  type: Type;
272
275
  name: string;
273
276
  pure?: boolean;
277
+ isStandalone?: boolean;
274
278
  }
275
279
  export interface ParseSourceSpan {
276
280
  start: any;
@@ -25,11 +25,26 @@ export declare class TemplateBindingParseResult {
25
25
  errors: ParserError[];
26
26
  constructor(templateBindings: TemplateBinding[], warnings: string[], errors: ParserError[]);
27
27
  }
28
+ /**
29
+ * Represents the possible parse modes to be used as a bitmask.
30
+ */
31
+ export declare const enum ParseFlags {
32
+ None = 0,
33
+ /**
34
+ * Whether an output binding is being parsed.
35
+ */
36
+ Action = 1,
37
+ /**
38
+ * Whether an assignment event is being parsed, i.e. an expression originating from
39
+ * two-way-binding aka banana-in-a-box syntax.
40
+ */
41
+ AssignmentEvent = 2
42
+ }
28
43
  export declare class Parser {
29
44
  private _lexer;
30
45
  private errors;
31
46
  constructor(_lexer: Lexer);
32
- parseAction(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
47
+ parseAction(input: string, isAssignmentEvent: boolean, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
33
48
  parseBinding(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
34
49
  private checkSimpleExpression;
35
50
  parseSimpleBinding(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
@@ -99,7 +114,7 @@ export declare class _ParseAST {
99
114
  location: string;
100
115
  absoluteOffset: number;
101
116
  tokens: Token[];
102
- parseAction: boolean;
117
+ parseFlags: ParseFlags;
103
118
  private errors;
104
119
  private offset;
105
120
  private rparensExpected;
@@ -108,7 +123,7 @@ export declare class _ParseAST {
108
123
  private context;
109
124
  private sourceSpanCache;
110
125
  index: number;
111
- constructor(input: string, location: string, absoluteOffset: number, tokens: Token[], parseAction: boolean, errors: ParserError[], offset: number);
126
+ constructor(input: string, location: string, absoluteOffset: number, tokens: Token[], parseFlags: ParseFlags, errors: ParserError[], offset: number);
112
127
  peek(offset: number): Token;
113
128
  get next(): Token;
114
129
  /** Whether all the parser input has been processed. */
@@ -175,6 +190,7 @@ export declare class _ParseAST {
175
190
  parseLiteralMap(): LiteralMap;
176
191
  parseAccessMember(readReceiver: AST, start: number, isSafe: boolean): AST;
177
192
  parseCall(receiver: AST, start: number, isSafe: boolean): AST;
193
+ private consumeOptionalAssignment;
178
194
  parseCallArguments(): BindingPipe[];
179
195
  /**
180
196
  * Parses an identifier, a keyword, a string with an optional `-` in between,
@@ -563,7 +563,8 @@ export declare function isNull(exp: Expression): boolean;
563
563
  export declare const enum JSDocTagName {
564
564
  Desc = "desc",
565
565
  Id = "id",
566
- Meaning = "meaning"
566
+ Meaning = "meaning",
567
+ Suppress = "suppress"
567
568
  }
568
569
  export declare type JSDocTag = {
569
570
  tagName: JSDocTagName | string;
@@ -105,6 +105,10 @@ export interface R3DeclareDirectiveMetadata extends R3PartialDeclaration {
105
105
  * Whether the directive implements the `ngOnChanges` hook. Defaults to false.
106
106
  */
107
107
  usesOnChanges?: boolean;
108
+ /**
109
+ * Whether the directive is standalone. Defaults to false.
110
+ */
111
+ isStandalone?: boolean;
108
112
  }
109
113
  /**
110
114
  * Describes the shape of the object that the `ɵɵngDeclareComponent()` function accepts.
@@ -298,6 +302,12 @@ export interface R3DeclarePipeMetadata extends R3PartialDeclaration {
298
302
  * Default: true.
299
303
  */
300
304
  pure?: boolean;
305
+ /**
306
+ * Whether the pipe is standalone.
307
+ *
308
+ * Default: false.
309
+ */
310
+ isStandalone?: boolean;
301
311
  }
302
312
  /**
303
313
  * Describes the shape of the object that the `ɵɵngDeclareFactory()` function accepts.
@@ -41,6 +41,10 @@ export interface R3PipeMetadata {
41
41
  * Whether the pipe is marked as pure.
42
42
  */
43
43
  pure: boolean;
44
+ /**
45
+ * Whether the pipe is standalone.
46
+ */
47
+ isStandalone: boolean;
44
48
  }
45
49
  export declare function compilePipeFromMetadata(metadata: R3PipeMetadata): R3CompiledExpression;
46
50
  export declare function createPipeType(metadata: R3PipeMetadata): o.Type;
@@ -102,6 +102,10 @@ export interface R3DirectiveMetadata {
102
102
  * The list of providers defined in the directive.
103
103
  */
104
104
  providers: o.Expression | null;
105
+ /**
106
+ * Whether or not the component or directive is standalone.
107
+ */
108
+ isStandalone: boolean;
105
109
  }
106
110
  /**
107
111
  * Specifies how a list of declaration type references should be emitted into the generated code.
@@ -75,4 +75,4 @@ export declare class I18nMetaVisitor implements html.Visitor {
75
75
  * @returns Object with id, meaning and description fields
76
76
  */
77
77
  export declare function parseI18nMeta(meta?: string): I18nMeta;
78
- export declare function i18nMetaToJSDoc(meta: I18nMeta): o.JSDocComment | null;
78
+ export declare function i18nMetaToJSDoc(meta: I18nMeta): o.JSDocComment;
@@ -130,11 +130,8 @@ export declare class TemplateDefinitionBuilder implements t.Visitor<void>, Local
130
130
  private instructionFn;
131
131
  private processStylingUpdateInstruction;
132
132
  private creationInstruction;
133
- private creationInstructionChain;
134
133
  private updateInstructionWithAdvance;
135
134
  private updateInstruction;
136
- private updateInstructionChain;
137
- private updateInstructionChainWithAdvance;
138
135
  private addAdvanceInstructionIfNecessary;
139
136
  private allocatePureFunctionSlots;
140
137
  private allocateBindingSlots;
@@ -25,6 +25,20 @@ export declare const IMPLICIT_REFERENCE = "$implicit";
25
25
  export declare const NON_BINDABLE_ATTR = "ngNonBindable";
26
26
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
27
27
  export declare const RESTORED_VIEW_CONTEXT_NAME = "restoredCtx";
28
+ /**
29
+ * Possible types that can be used to generate the parameters of an instruction call.
30
+ * If the parameters are a function, the function will be invoked at the time the instruction
31
+ * is generated.
32
+ */
33
+ export declare type InstructionParams = (o.Expression | o.Expression[]) | (() => (o.Expression | o.Expression[]));
34
+ /** Necessary information to generate a call to an instruction function. */
35
+ export interface Instruction {
36
+ span: ParseSourceSpan | null;
37
+ reference: o.ExternalReference;
38
+ paramsOrFn?: InstructionParams;
39
+ }
40
+ /** Generates a call to a single instruction. */
41
+ export declare function invokeInstruction(span: ParseSourceSpan | null, reference: o.ExternalReference, params: o.Expression[]): o.Expression;
28
42
  /**
29
43
  * Creates an allocator for a temporary variable.
30
44
  *
@@ -67,11 +81,14 @@ export declare class DefinitionMap<T = any> {
67
81
  export declare function getAttrsForDirectiveMatching(elOrTpl: t.Element | t.Template): {
68
82
  [name: string]: string;
69
83
  };
70
- /** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */
71
- export declare function chainedInstruction(reference: o.ExternalReference, calls: o.Expression[][], span?: ParseSourceSpan | null): o.Expression;
72
84
  /**
73
85
  * Gets the number of arguments expected to be passed to a generated instruction in the case of
74
86
  * interpolation instructions.
75
87
  * @param interpolation An interpolation ast
76
88
  */
77
89
  export declare function getInterpolationArgsLength(interpolation: Interpolation): number;
90
+ /**
91
+ * Generates the final instruction call statements based on the passed in configuration.
92
+ * Will try to chain instructions as much as possible, if chaining is supported.
93
+ */
94
+ export declare function getInstructionStatements(instructions: Instruction[]): o.Statement[];
@@ -69,7 +69,7 @@ export declare class BindingParser {
69
69
  private _parseAnimation;
70
70
  private _parseBinding;
71
71
  createBoundElementProperty(elementSelector: string, boundProp: ParsedProperty, skipValidation?: boolean, mapPropertyName?: boolean): BoundElementProperty;
72
- parseEvent(name: string, expression: string, sourceSpan: ParseSourceSpan, handlerSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetEvents: ParsedEvent[], keySpan: ParseSourceSpan): void;
72
+ parseEvent(name: string, expression: string, isAssignmentEvent: boolean, sourceSpan: ParseSourceSpan, handlerSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetEvents: ParsedEvent[], keySpan: ParseSourceSpan): void;
73
73
  calcPossibleSecurityContexts(selector: string, propName: string, isAttribute: boolean): SecurityContext[];
74
74
  private _parseAnimationEvent;
75
75
  private _parseRegularEvent;