@angular/compiler 18.0.0-next.1 → 18.0.0-next.2

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/esm2022/src/compiler.mjs +3 -3
  2. package/esm2022/src/compiler_facade_interface.mjs +1 -1
  3. package/esm2022/src/constant_pool.mjs +6 -3
  4. package/esm2022/src/jit_compiler_facade.mjs +9 -10
  5. package/esm2022/src/render3/partial/api.mjs +1 -1
  6. package/esm2022/src/render3/partial/class_metadata.mjs +24 -2
  7. package/esm2022/src/render3/partial/component.mjs +24 -1
  8. package/esm2022/src/render3/partial/directive.mjs +1 -1
  9. package/esm2022/src/render3/partial/factory.mjs +1 -1
  10. package/esm2022/src/render3/partial/injectable.mjs +1 -1
  11. package/esm2022/src/render3/partial/injector.mjs +1 -1
  12. package/esm2022/src/render3/partial/ng_module.mjs +1 -1
  13. package/esm2022/src/render3/partial/pipe.mjs +1 -1
  14. package/esm2022/src/render3/r3_ast.mjs +7 -4
  15. package/esm2022/src/render3/r3_class_metadata_compiler.mjs +46 -33
  16. package/esm2022/src/render3/r3_control_flow.mjs +18 -16
  17. package/esm2022/src/render3/r3_identifiers.mjs +2 -1
  18. package/esm2022/src/render3/r3_template_transform.mjs +2 -13
  19. package/esm2022/src/render3/view/api.mjs +1 -1
  20. package/esm2022/src/render3/view/compiler.mjs +2 -2
  21. package/esm2022/src/render3/view/t2_api.mjs +1 -1
  22. package/esm2022/src/render3/view/t2_binder.mjs +30 -20
  23. package/esm2022/src/shadow_css.mjs +2 -2
  24. package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +4 -2
  25. package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +1 -1
  26. package/esm2022/src/template/pipeline/src/ingest.mjs +65 -50
  27. package/esm2022/src/template/pipeline/src/instruction.mjs +9 -3
  28. package/esm2022/src/template/pipeline/src/phases/generate_variables.mjs +6 -1
  29. package/esm2022/src/template/pipeline/src/phases/naming.mjs +14 -2
  30. package/esm2022/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs +2 -2
  31. package/esm2022/src/template/pipeline/src/phases/reify.mjs +21 -2
  32. package/esm2022/src/template/pipeline/src/phases/track_fn_optimization.mjs +4 -1
  33. package/esm2022/src/template/pipeline/src/phases/track_variables.mjs +2 -2
  34. package/esm2022/src/template/pipeline/src/phases/wrap_icus.mjs +2 -2
  35. package/esm2022/src/version.mjs +1 -1
  36. package/fesm2022/compiler.mjs +286 -160
  37. package/fesm2022/compiler.mjs.map +1 -1
  38. package/index.d.ts +50 -16
  39. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.0.0-next.1
2
+ * @license Angular v18.0.0-next.2
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -668,7 +668,7 @@ declare class Comment_3 implements TmplAstNode {
668
668
  */
669
669
  export declare function compileClassDebugInfo(debugInfo: R3ClassDebugInfo): outputAst.Expression;
670
670
 
671
- export declare function compileClassMetadata(metadata: R3ClassMetadata): outputAst.Expression;
671
+ export declare function compileClassMetadata(metadata: R3ClassMetadata): outputAst.InvokeFunctionExpr;
672
672
 
673
673
  export declare type CompileClassMetadataFn = (metadata: R3ClassMetadata) => outputAst.Expression;
674
674
 
@@ -689,7 +689,9 @@ export declare type CompileClassMetadataFn = (metadata: R3ClassMetadata) => outp
689
689
  * Similar to the `setClassMetadata` call, it's wrapped into the `ngDevMode`
690
690
  * check to tree-shake away this code in production mode.
691
691
  */
692
- export declare function compileComponentClassMetadata(metadata: R3ClassMetadata, deferrableTypes: R3DeferPerComponentDependency[] | null): outputAst.Expression;
692
+ export declare function compileComponentClassMetadata(metadata: R3ClassMetadata, dependencies: R3DeferPerComponentDependency[] | null): outputAst.Expression;
693
+
694
+ export declare function compileComponentDeclareClassMetadata(metadata: R3ClassMetadata, dependencies: R3DeferPerComponentDependency[] | null): outputAst.Expression;
693
695
 
694
696
  /**
695
697
  * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
@@ -752,6 +754,16 @@ export declare function compileInjector(meta: R3InjectorMetadata): R3CompiledExp
752
754
  */
753
755
  export declare function compileNgModule(meta: R3NgModuleMetadata): R3CompiledExpression;
754
756
 
757
+ /**
758
+ * Identical to `compileComponentClassMetadata`. Used for the cases where we're unable to
759
+ * analyze the deferred block dependencies, but we have a reference to the compiled
760
+ * dependency resolver function that we can use as is.
761
+ * @param metadata Class metadata for the internal `setClassMetadata` call.
762
+ * @param deferResolver Expression representing the deferred dependency loading function.
763
+ * @param deferredDependencyNames Names of the dependencies that are being loaded asynchronously.
764
+ */
765
+ export declare function compileOpaqueAsyncClassMetadata(metadata: R3ClassMetadata, deferResolver: outputAst.Expression, deferredDependencyNames: string[]): outputAst.Expression;
766
+
755
767
  export declare function compilePipeFromMetadata(metadata: R3PipeMetadata): R3CompiledExpression;
756
768
 
757
769
  export declare class CompilerConfig {
@@ -817,7 +829,7 @@ export declare class ConstantPool {
817
829
  literalFactory: outputAst.Expression;
818
830
  literalFactoryArguments: outputAst.Expression[];
819
831
  };
820
- getSharedFunctionReference(fn: outputAst.FunctionExpr | outputAst.ArrowFunctionExpr, prefix: string, useUniqueName?: boolean): outputAst.Expression;
832
+ getSharedFunctionReference(fn: outputAst.Expression, prefix: string, useUniqueName?: boolean): outputAst.Expression;
821
833
  private _getLiteralFactory;
822
834
  /**
823
835
  * Produce a unique name in the context of this pool.
@@ -1405,9 +1417,6 @@ declare class FnParam {
1405
1417
  clone(): FnParam;
1406
1418
  }
1407
1419
 
1408
- /** Context variables that can be used inside a `ForLoopBlock`. */
1409
- declare type ForLoopBlockContext = Record<'$index' | '$first' | '$last' | '$even' | '$odd' | '$count', TmplAstVariable>;
1410
-
1411
1420
  /**
1412
1421
  * Specifies how a forward ref has been handled in a MaybeForwardRefExpression
1413
1422
  */
@@ -2699,11 +2708,14 @@ export declare class R3BoundTarget<DirectiveT extends DirectiveMeta> implements
2699
2708
  private scopedNodeEntities;
2700
2709
  private usedPipes;
2701
2710
  private eagerPipes;
2702
- private deferBlocks;
2711
+ /** Deferred blocks, ordered as they appear in the template. */
2712
+ private deferredBlocks;
2713
+ /** Map of deferred blocks to their scope. */
2714
+ private deferredScopes;
2703
2715
  constructor(target: Target, directives: Map<TmplAstElement | TmplAstTemplate, DirectiveT[]>, eagerDirectives: DirectiveT[], bindings: Map<TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstTextAttribute, DirectiveT | TmplAstElement | TmplAstTemplate>, references: Map<TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstReference | TmplAstTextAttribute, {
2704
2716
  directive: DirectiveT;
2705
2717
  node: TmplAstElement | TmplAstTemplate;
2706
- } | TmplAstElement | TmplAstTemplate>, exprTargets: Map<AST, TmplAstReference | TmplAstVariable>, symbols: Map<TmplAstReference | TmplAstVariable, TmplAstTemplate>, nestingLevel: Map<ScopedNode, number>, scopedNodeEntities: Map<ScopedNode | null, ReadonlySet<TmplAstReference | TmplAstVariable>>, usedPipes: Set<string>, eagerPipes: Set<string>, deferBlocks: Map<TmplAstDeferredBlock, Scope>);
2718
+ } | TmplAstElement | TmplAstTemplate>, exprTargets: Map<AST, TmplAstReference | TmplAstVariable>, symbols: Map<TmplAstReference | TmplAstVariable, TmplAstTemplate>, nestingLevel: Map<ScopedNode, number>, scopedNodeEntities: Map<ScopedNode | null, ReadonlySet<TmplAstReference | TmplAstVariable>>, usedPipes: Set<string>, eagerPipes: Set<string>, rawDeferred: [TmplAstDeferredBlock, Scope][]);
2707
2719
  getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TmplAstReference | TmplAstVariable>;
2708
2720
  getDirectivesOfNode(node: TmplAstElement | TmplAstTemplate): DirectiveT[] | null;
2709
2721
  getReferenceTarget(ref: TmplAstReference): ReferenceTarget<DirectiveT> | null;
@@ -2801,10 +2813,10 @@ export declare interface R3CompiledExpression {
2801
2813
  */
2802
2814
  export declare type R3ComponentDeferMetadata = {
2803
2815
  mode: DeferBlockDepsEmitMode.PerBlock;
2804
- blocks: Map<t.DeferredBlock, outputAst.ArrowFunctionExpr | null>;
2816
+ blocks: Map<t.DeferredBlock, outputAst.Expression | null>;
2805
2817
  } | {
2806
2818
  mode: DeferBlockDepsEmitMode.PerComponent;
2807
- dependenciesFn: outputAst.ArrowFunctionExpr | null;
2819
+ dependenciesFn: outputAst.Expression | null;
2808
2820
  };
2809
2821
 
2810
2822
  /**
@@ -2944,6 +2956,22 @@ export declare interface R3DeclareClassMetadata extends R3PartialDeclaration {
2944
2956
  propDecorators?: outputAst.Expression;
2945
2957
  }
2946
2958
 
2959
+ /**
2960
+ * Describes the shape of the object that the `ɵɵngDeclareClassMetadataAsync()` function accepts.
2961
+ *
2962
+ * This interface serves primarily as documentation, as conformance to this interface is not
2963
+ * enforced during linking.
2964
+ */
2965
+ export declare interface R3DeclareClassMetadataAsync extends R3PartialDeclaration {
2966
+ /** Function that loads the deferred dependencies associated with the component. */
2967
+ resolveDeferredDeps: outputAst.Expression;
2968
+ /**
2969
+ * Function that, when invoked with the resolved deferred
2970
+ * dependencies, will return the class metadata.
2971
+ */
2972
+ resolveMetadata: outputAst.Expression;
2973
+ }
2974
+
2947
2975
  /**
2948
2976
  * Describes the shape of the object that the `ɵɵngDeclareComponent()` function accepts.
2949
2977
  */
@@ -2985,6 +3013,11 @@ export declare interface R3DeclareComponentMetadata extends R3DeclareDirectiveMe
2985
3013
  * support this.
2986
3014
  */
2987
3015
  dependencies?: R3DeclareTemplateDependencyMetadata[];
3016
+ /**
3017
+ * List of defer block dependency functions, ordered by the appearance
3018
+ * of the corresponding deferred block in the template.
3019
+ */
3020
+ deferBlockDependencies?: outputAst.Expression[];
2988
3021
  /**
2989
3022
  * A map of pipe names to an expression referencing the pipe type (possibly a forward reference
2990
3023
  * wrapped in a `forwardRef` invocation) which are used in the template.
@@ -3838,6 +3871,7 @@ export declare class R3Identifiers {
3838
3871
  static definePipe: outputAst.ExternalReference;
3839
3872
  static declarePipe: outputAst.ExternalReference;
3840
3873
  static declareClassMetadata: outputAst.ExternalReference;
3874
+ static declareClassMetadataAsync: outputAst.ExternalReference;
3841
3875
  static setClassMetadata: outputAst.ExternalReference;
3842
3876
  static setClassMetadataAsync: outputAst.ExternalReference;
3843
3877
  static setClassDebugInfo: outputAst.ExternalReference;
@@ -4483,7 +4517,7 @@ declare class Scope implements TmplAstVisitor {
4483
4517
  }
4484
4518
 
4485
4519
  /** Node that has a `Scope` associated with it. */
4486
- export declare type ScopedNode = TmplAstTemplate | TmplAstSwitchBlockCase | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty | TmplAstDeferredBlock | TmplAstDeferredBlockError | TmplAstDeferredBlockLoading | TmplAstDeferredBlockPlaceholder;
4520
+ export declare type ScopedNode = TmplAstTemplate | TmplAstSwitchBlockCase | TmplAstIfBlockBranch | TmplAstForLoopBlock | TmplAstForLoopBlockEmpty | TmplAstDeferredBlock | TmplAstDeferredBlockError | TmplAstDeferredBlockLoading | TmplAstDeferredBlockPlaceholder | TmplAstContent;
4487
4521
 
4488
4522
  declare enum SecurityContext {
4489
4523
  NONE = 0,
@@ -4665,7 +4699,6 @@ declare namespace t {
4665
4699
  TmplAstDeferredBlock as DeferredBlock,
4666
4700
  TmplAstSwitchBlock as SwitchBlock,
4667
4701
  TmplAstSwitchBlockCase as SwitchBlockCase,
4668
- ForLoopBlockContext,
4669
4702
  TmplAstForLoopBlock as ForLoopBlock,
4670
4703
  TmplAstForLoopBlockEmpty as ForLoopBlockEmpty,
4671
4704
  TmplAstIfBlock as IfBlock,
@@ -4879,10 +4912,11 @@ export declare class TmplAstBoundText implements TmplAstNode {
4879
4912
  export declare class TmplAstContent implements TmplAstNode {
4880
4913
  selector: string;
4881
4914
  attributes: TmplAstTextAttribute[];
4915
+ children: TmplAstNode[];
4882
4916
  sourceSpan: ParseSourceSpan;
4883
4917
  i18n?: I18nMeta_2 | undefined;
4884
4918
  readonly name = "ng-content";
4885
- constructor(selector: string, attributes: TmplAstTextAttribute[], sourceSpan: ParseSourceSpan, i18n?: I18nMeta_2 | undefined);
4919
+ constructor(selector: string, attributes: TmplAstTextAttribute[], children: TmplAstNode[], sourceSpan: ParseSourceSpan, i18n?: I18nMeta_2 | undefined);
4886
4920
  visit<Result>(visitor: TmplAstVisitor<Result>): Result;
4887
4921
  }
4888
4922
 
@@ -4966,12 +5000,12 @@ export declare class TmplAstForLoopBlock extends TmplAstBlockNode implements Tmp
4966
5000
  expression: ASTWithSource;
4967
5001
  trackBy: ASTWithSource;
4968
5002
  trackKeywordSpan: ParseSourceSpan;
4969
- contextVariables: ForLoopBlockContext;
5003
+ contextVariables: TmplAstVariable[];
4970
5004
  children: TmplAstNode[];
4971
5005
  empty: TmplAstForLoopBlockEmpty | null;
4972
5006
  mainBlockSpan: ParseSourceSpan;
4973
5007
  i18n?: I18nMeta_2 | undefined;
4974
- constructor(item: TmplAstVariable, expression: ASTWithSource, trackBy: ASTWithSource, trackKeywordSpan: ParseSourceSpan, contextVariables: ForLoopBlockContext, children: TmplAstNode[], empty: TmplAstForLoopBlockEmpty | null, sourceSpan: ParseSourceSpan, mainBlockSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null, nameSpan: ParseSourceSpan, i18n?: I18nMeta_2 | undefined);
5008
+ constructor(item: TmplAstVariable, expression: ASTWithSource, trackBy: ASTWithSource, trackKeywordSpan: ParseSourceSpan, contextVariables: TmplAstVariable[], children: TmplAstNode[], empty: TmplAstForLoopBlockEmpty | null, sourceSpan: ParseSourceSpan, mainBlockSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan: ParseSourceSpan | null, nameSpan: ParseSourceSpan, i18n?: I18nMeta_2 | undefined);
4975
5009
  visit<Result>(visitor: TmplAstVisitor<Result>): Result;
4976
5010
  }
4977
5011
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler",
3
- "version": "18.0.0-next.1",
3
+ "version": "18.0.0-next.2",
4
4
  "description": "Angular - the compiler library",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -11,7 +11,7 @@
11
11
  "tslib": "^2.3.0"
12
12
  },
13
13
  "peerDependencies": {
14
- "@angular/core": "18.0.0-next.1"
14
+ "@angular/core": "18.0.0-next.2"
15
15
  },
16
16
  "peerDependenciesMeta": {
17
17
  "@angular/core": {