@angular/compiler 13.3.0 → 14.0.0-next.10

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 (47) hide show
  1. package/esm2020/src/compiler.mjs +2 -2
  2. package/esm2020/src/compiler_facade_interface.mjs +1 -1
  3. package/esm2020/src/compiler_util/expression_converter.mjs +1 -11
  4. package/esm2020/src/expression_parser/ast.mjs +1 -35
  5. package/esm2020/src/expression_parser/parser.mjs +3 -22
  6. package/esm2020/src/jit_compiler_facade.mjs +6 -3
  7. package/esm2020/src/ml_parser/lexer.mjs +2 -2
  8. package/esm2020/src/parse_util.mjs +2 -2
  9. package/esm2020/src/render3/partial/api.mjs +1 -1
  10. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  11. package/esm2020/src/render3/partial/directive.mjs +1 -1
  12. package/esm2020/src/render3/partial/factory.mjs +1 -1
  13. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  14. package/esm2020/src/render3/partial/injector.mjs +1 -1
  15. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  16. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  17. package/esm2020/src/render3/r3_identifiers.mjs +3 -1
  18. package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
  19. package/esm2020/src/render3/r3_pipe_compiler.mjs +4 -1
  20. package/esm2020/src/render3/view/api.mjs +1 -1
  21. package/esm2020/src/render3/view/compiler.mjs +4 -1
  22. package/esm2020/src/render3/view/style_parser.mjs +2 -2
  23. package/esm2020/src/render3/view/styling_builder.mjs +3 -3
  24. package/esm2020/src/render3/view/template.mjs +21 -8
  25. package/esm2020/src/selector.mjs +3 -3
  26. package/esm2020/src/shadow_css.mjs +2 -2
  27. package/esm2020/src/template_parser/binding_parser.mjs +2 -2
  28. package/esm2020/src/version.mjs +1 -1
  29. package/fesm2015/compiler.mjs +97 -99
  30. package/fesm2015/compiler.mjs.map +1 -1
  31. package/fesm2015/testing.mjs +1 -1
  32. package/fesm2015/testing.mjs.map +1 -1
  33. package/fesm2020/compiler.mjs +95 -97
  34. package/fesm2020/compiler.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +1 -1
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/package.json +10 -2
  38. package/src/compiler.d.ts +1 -1
  39. package/src/compiler_facade_interface.d.ts +4 -0
  40. package/src/expression_parser/ast.d.ts +0 -25
  41. package/src/expression_parser/parser.d.ts +0 -1
  42. package/src/render3/partial/api.d.ts +10 -0
  43. package/src/render3/r3_identifiers.d.ts +2 -0
  44. package/src/render3/r3_module_compiler.d.ts +30 -4
  45. package/src/render3/r3_pipe_compiler.d.ts +4 -0
  46. package/src/render3/view/api.d.ts +4 -0
  47. package/src/render3/view/template.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.3.0
2
+ * @license Angular v14.0.0-next.10
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;AAQA;;;;;;;;;;;;;;;AAgBA;AACA;AACA;AACA;AACA;MACa,YAAY,GAAG;;AC7B5B;;;;;;;AAiBA;;ACjBA;;;;;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/compiler/testing/src/testing.ts","../../../../../../packages/compiler/testing/public_api.ts","../../../../../../packages/compiler/testing/index.ts","../../../../../../packages/compiler/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all APIs of the compiler package.\n *\n * <div class=\"callout is-critical\">\n * <header>Unstable APIs</header>\n * <p>\n * All compiler apis are currently considered experimental and private!\n * </p>\n * <p>\n * We expect the APIs in this package to keep on changing. Do not rely on them.\n * </p>\n * </div>\n */\n\n// TODO(alxhub): @angular/compiler/testing is unused in Ivy. A placeholder\n// is left here because the components repo still depends on this package\n// directly. It will be cleaned up at a later date.\n//\n// This export ensures this package is not empty.\nexport const unusedExport = true;\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/// <reference types=\"node\" />\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;AAMG;AAEH;;;;;;;;;;;;;;AAcG;AAEH;AACA;AACA;AACA;AACA;AACO,MAAM,YAAY,GAAG;;AC7B5B;;;;;;AAMG;AAWH;;ACjBA;;;;;;AAMG;;ACNH;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@angular/compiler",
3
- "version": "13.3.0",
3
+ "version": "14.0.0-next.10",
4
4
  "description": "Angular - the compiler library",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^12.20.0 || ^14.15.0 || >=16.10.0"
8
+ "node": "^14.15.0 || >=16.10.0"
9
9
  },
10
10
  "dependencies": {
11
11
  "tslib": "^2.3.0"
12
12
  },
13
+ "peerDependencies": {
14
+ "@angular/core": "14.0.0-next.10"
15
+ },
16
+ "peerDependenciesMeta": {
17
+ "@angular/core": {
18
+ "optional": true
19
+ }
20
+ },
13
21
  "repository": {
14
22
  "type": "git",
15
23
  "url": "https://github.com/angular/angular.git",
package/src/compiler.d.ts CHANGED
@@ -58,7 +58,7 @@ export * from './render3/view/t2_binder';
58
58
  export { Identifiers as R3Identifiers } from './render3/r3_identifiers';
59
59
  export { R3ClassMetadata, CompileClassMetadataFn, compileClassMetadata } from './render3/r3_class_metadata_compiler';
60
60
  export { compileFactoryFunction, R3DependencyMetadata, R3FactoryMetadata, FactoryTarget } from './render3/r3_factory';
61
- export { compileNgModule, R3NgModuleMetadata } from './render3/r3_module_compiler';
61
+ export { compileNgModule, R3NgModuleMetadata, R3SelectorScopeMode } from './render3/r3_module_compiler';
62
62
  export { compileInjector, R3InjectorMetadata } from './render3/r3_injector_compiler';
63
63
  export { compilePipeFromMetadata, R3PipeMetadata } from './render3/r3_pipe_compiler';
64
64
  export { makeBindingParser, ParsedTemplate, parseTemplate, ParseTemplateOptions } from './render3/view/template';
@@ -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;
@@ -38,27 +38,6 @@ export declare abstract class ASTWithName extends AST {
38
38
  nameSpan: AbsoluteSourceSpan;
39
39
  constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, nameSpan: AbsoluteSourceSpan);
40
40
  }
41
- /**
42
- * Represents a quoted expression of the form:
43
- *
44
- * quote = prefix `:` uninterpretedExpression
45
- * prefix = identifier
46
- * uninterpretedExpression = arbitrary string
47
- *
48
- * A quoted expression is meant to be pre-processed by an AST transformer that
49
- * converts it into another AST that no longer contains quoted expressions.
50
- * It is meant to allow third-party developers to extend Angular template
51
- * expression language. The `uninterpretedExpression` part of the quote is
52
- * therefore not interpreted by the Angular's own expression parser.
53
- */
54
- export declare class Quote extends AST {
55
- prefix: string;
56
- uninterpretedExpression: string;
57
- location: any;
58
- constructor(span: ParseSpan, sourceSpan: AbsoluteSourceSpan, prefix: string, uninterpretedExpression: string, location: any);
59
- visit(visitor: AstVisitor, context?: any): any;
60
- toString(): string;
61
- }
62
41
  export declare class EmptyExpr extends AST {
63
42
  visit(visitor: AstVisitor, context?: any): void;
64
43
  }
@@ -314,7 +293,6 @@ export interface AstVisitor {
314
293
  visitNonNullAssert(ast: NonNullAssert, context: any): any;
315
294
  visitPropertyRead(ast: PropertyRead, context: any): any;
316
295
  visitPropertyWrite(ast: PropertyWrite, context: any): any;
317
- visitQuote(ast: Quote, context: any): any;
318
296
  visitSafePropertyRead(ast: SafePropertyRead, context: any): any;
319
297
  visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any;
320
298
  visitCall(ast: Call, context: any): any;
@@ -351,7 +329,6 @@ export declare class RecursiveAstVisitor implements AstVisitor {
351
329
  visitSafeKeyedRead(ast: SafeKeyedRead, context: any): any;
352
330
  visitCall(ast: Call, context: any): any;
353
331
  visitSafeCall(ast: SafeCall, context: any): any;
354
- visitQuote(ast: Quote, context: any): any;
355
332
  visitAll(asts: AST[], context: any): any;
356
333
  }
357
334
  export declare class AstTransformer implements AstVisitor {
@@ -376,7 +353,6 @@ export declare class AstTransformer implements AstVisitor {
376
353
  visitSafeCall(ast: SafeCall, context: any): AST;
377
354
  visitAll(asts: any[]): any[];
378
355
  visitChain(ast: Chain, context: any): AST;
379
- visitQuote(ast: Quote, context: any): AST;
380
356
  visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
381
357
  }
382
358
  export declare class AstMemoryEfficientTransformer implements AstVisitor {
@@ -401,7 +377,6 @@ export declare class AstMemoryEfficientTransformer implements AstVisitor {
401
377
  visitChain(ast: Chain, context: any): AST;
402
378
  visitCall(ast: Call, context: any): AST;
403
379
  visitSafeCall(ast: SafeCall, context: any): AST;
404
- visitQuote(ast: Quote, context: any): AST;
405
380
  visitSafeKeyedRead(ast: SafeKeyedRead, context: any): AST;
406
381
  }
407
382
  export declare class ParsedProperty {
@@ -51,7 +51,6 @@ export declare class Parser {
51
51
  parseSimpleBinding(input: string, location: string, absoluteOffset: number, interpolationConfig?: InterpolationConfig): ASTWithSource;
52
52
  private _reportError;
53
53
  private _parseBindingAst;
54
- private _parseQuote;
55
54
  /**
56
55
  * Parse microsyntax template expression and return a list of bindings or
57
56
  * parsing errors in case the given expression is invalid.
@@ -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.
@@ -65,6 +65,7 @@ export declare class Identifiers {
65
65
  static stylePropInterpolate8: o.ExternalReference;
66
66
  static stylePropInterpolateV: o.ExternalReference;
67
67
  static nextContext: o.ExternalReference;
68
+ static resetView: o.ExternalReference;
68
69
  static templateCreate: o.ExternalReference;
69
70
  static text: o.ExternalReference;
70
71
  static enableBindings: o.ExternalReference;
@@ -154,6 +155,7 @@ export declare class Identifiers {
154
155
  static defineNgModule: o.ExternalReference;
155
156
  static declareNgModule: o.ExternalReference;
156
157
  static setNgModuleScope: o.ExternalReference;
158
+ static registerNgModuleType: o.ExternalReference;
157
159
  static PipeDeclaration: o.ExternalReference;
158
160
  static definePipe: o.ExternalReference;
159
161
  static declarePipe: o.ExternalReference;
@@ -8,6 +8,34 @@
8
8
  import { R3DeclareNgModuleFacade } from '../compiler_facade_interface';
9
9
  import * as o from '../output/output_ast';
10
10
  import { R3CompiledExpression, R3Reference } from './util';
11
+ /**
12
+ * How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
13
+ * as a part of the NgModule definition.
14
+ */
15
+ export declare enum R3SelectorScopeMode {
16
+ /**
17
+ * Emit the declarations inline into the module definition.
18
+ *
19
+ * This option is useful in certain contexts where it's known that JIT support is required. The
20
+ * tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
21
+ * they are unused, but the NgModule is used.
22
+ */
23
+ Inline = 0,
24
+ /**
25
+ * Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
26
+ * guarded with the `ngJitMode` flag.
27
+ *
28
+ * This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
29
+ * false, which allows unused directives and pipes to be tree-shaken.
30
+ */
31
+ SideEffect = 1,
32
+ /**
33
+ * Don't generate selector scopes at all.
34
+ *
35
+ * This is useful for contexts where JIT support is known to be unnecessary.
36
+ */
37
+ Omit = 2
38
+ }
11
39
  /**
12
40
  * Metadata required by the module compiler to generate a module def (`ɵmod`) for a type.
13
41
  */
@@ -49,11 +77,9 @@ export interface R3NgModuleMetadata {
49
77
  */
50
78
  exports: R3Reference[];
51
79
  /**
52
- * Whether to emit the selector scope values (declarations, imports, exports) inline into the
53
- * module definition, or to generate additional statements which patch them on. Inline emission
54
- * does not allow components to be tree-shaken, but is useful for JIT mode.
80
+ * How to emit the selector scope values (declarations, imports, exports).
55
81
  */
56
- emitInline: boolean;
82
+ selectorScopeMode: R3SelectorScopeMode;
57
83
  /**
58
84
  * Whether to generate closure wrappers for bootstrap, declarations, imports, and exports.
59
85
  */
@@ -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.
@@ -254,7 +254,7 @@ export declare class BindingScope implements LocalResolver {
254
254
  generateSharedContextVar(retrievalLevel: number): void;
255
255
  getComponentProperty(name: string): o.Expression;
256
256
  maybeRestoreView(): void;
257
- restoreViewStatement(): o.Statement[];
257
+ restoreViewStatement(): o.Statement | null;
258
258
  viewSnapshotStatements(): o.Statement[];
259
259
  isListenerScope(): boolean | null;
260
260
  variableDeclarations(): o.Statement[];