static-injector 1.0.10 → 2.1.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 (111) hide show
  1. package/import/commonjs/index.js +337 -124
  2. package/import/es2015/di/create_injector.js +30 -0
  3. package/import/es2015/di/initializer_token.js +15 -0
  4. package/import/es2015/di/inject_switch.js +27 -6
  5. package/import/es2015/di/injection_token.js +6 -0
  6. package/import/es2015/di/injector.js +6 -8
  7. package/import/es2015/di/injector_compatibility.js +90 -34
  8. package/import/es2015/di/injector_token.js +1 -1
  9. package/import/es2015/di/interface/defs.js +39 -0
  10. package/import/es2015/di/interface/injector.js +1 -0
  11. package/import/es2015/di/internal_tokens.js +9 -0
  12. package/import/es2015/di/metadata.js +4 -4
  13. package/import/es2015/di/provider_collection.js +49 -0
  14. package/import/es2015/di/r3_injector.js +102 -72
  15. package/import/es2015/di/scope.js +2 -2
  16. package/import/es2015/index.js +1 -1
  17. package/import/es2015/render3/errors_di.js +1 -1
  18. package/import/fesm2015/index.js +328 -114
  19. package/import/typings/di/create_injector.d.ts +23 -0
  20. package/import/typings/di/initializer_token.d.ts +15 -0
  21. package/import/typings/di/inject_switch.d.ts +7 -2
  22. package/import/typings/{decorator → di}/injectable.d.ts +2 -2
  23. package/import/typings/di/injection_token.d.ts +4 -0
  24. package/import/typings/di/injector.d.ts +20 -7
  25. package/import/typings/di/injector_compatibility.d.ts +42 -21
  26. package/import/typings/di/interface/defs.d.ts +10 -0
  27. package/import/typings/di/interface/injector.d.ts +26 -0
  28. package/import/typings/di/interface/provider.d.ts +3 -8
  29. package/import/typings/di/internal_tokens.d.ts +10 -0
  30. package/import/typings/di/provider_collection.d.ts +30 -0
  31. package/import/typings/di/provider_token.d.ts +1 -1
  32. package/import/typings/di/r3_injector.d.ts +68 -37
  33. package/import/typings/di/scope.d.ts +3 -2
  34. package/import/typings/index.d.ts +1 -1
  35. package/import/typings/render3/definition_factory.d.ts +1 -1
  36. package/package.json +5 -3
  37. package/{import/es2015/decorator/interface/provider.js → transform/compiler/compiler.d.ts} +1 -1
  38. package/transform/compiler/compiler.js +28 -0
  39. package/transform/compiler/index.d.ts +8 -5
  40. package/transform/compiler/index.js +17 -6
  41. package/transform/compiler/public_api.d.ts +13 -0
  42. package/transform/compiler/public_api.js +30 -0
  43. package/transform/compiler/src/compiler.d.ts +27 -0
  44. package/transform/compiler/src/compiler.js +47 -0
  45. package/transform/compiler/src/injectable_compiler_2.d.ts +7 -36
  46. package/transform/compiler/src/injectable_compiler_2.js +20 -23
  47. package/transform/compiler/src/output/output_ast.d.ts +30 -109
  48. package/transform/compiler/src/output/output_ast.js +66 -188
  49. package/transform/compiler/src/render3/partial/api.d.ts +1 -1
  50. package/transform/compiler/src/render3/partial/api.js +7 -0
  51. package/transform/compiler/src/render3/r3_factory.d.ts +8 -15
  52. package/transform/compiler/src/render3/r3_factory.js +46 -61
  53. package/transform/compiler/src/render3/util.d.ts +64 -0
  54. package/transform/compiler/src/render3/util.js +52 -9
  55. package/transform/compiler/src/render3/view/util.d.ts +0 -8
  56. package/transform/compiler/src/render3/view/util.js +5 -9
  57. package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +10 -0
  58. package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +26 -0
  59. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.d.ts +37 -0
  60. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.js +197 -0
  61. package/transform/compiler-cli/src/ngtsc/annotations/{src → common/src}/factory.d.ts +3 -3
  62. package/transform/compiler-cli/src/ngtsc/annotations/{src → common/src}/factory.js +3 -3
  63. package/transform/compiler-cli/src/ngtsc/annotations/{src → common/src}/util.d.ts +4 -34
  64. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +181 -0
  65. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +3 -4
  66. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +46 -53
  67. package/transform/compiler-cli/src/ngtsc/diagnostics/error.js +6 -2
  68. package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +9 -2
  69. package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +12 -1
  70. package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +7 -0
  71. package/transform/compiler-cli/src/ngtsc/imports/index.js +12 -1
  72. package/transform/compiler-cli/src/ngtsc/imports/src/default.d.ts +19 -0
  73. package/transform/compiler-cli/src/ngtsc/imports/src/default.js +28 -0
  74. package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +10 -3
  75. package/transform/compiler-cli/src/ngtsc/reflection/index.js +12 -1
  76. package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +13 -14
  77. package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +8 -25
  78. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +2 -2
  79. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +44 -55
  80. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +1 -1
  81. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +55 -69
  82. package/transform/compiler-cli/src/ngtsc/reflection/src/util.d.ts +2 -2
  83. package/transform/compiler-cli/src/ngtsc/reflection/src/util.js +7 -23
  84. package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +9 -2
  85. package/transform/compiler-cli/src/ngtsc/transform/index.js +12 -1
  86. package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +4 -4
  87. package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +2 -2
  88. package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +16 -31
  89. package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +12 -5
  90. package/transform/compiler-cli/src/ngtsc/translator/index.js +12 -1
  91. package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +5 -5
  92. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +4 -4
  93. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +5 -21
  94. package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +2 -6
  95. package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +6 -18
  96. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +3 -6
  97. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +83 -90
  98. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.d.ts +4 -4
  99. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.d.ts +8 -0
  100. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.js +24 -0
  101. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +45 -0
  102. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.js +86 -0
  103. package/transform/compiler-cli/src/ngtsc/util/src/typescript.d.ts +1 -8
  104. package/transform/compiler-cli/src/ngtsc/util/src/typescript.js +4 -27
  105. package/transform/index.js +5 -1
  106. package/transform/injectable-transform.js +59 -38
  107. package/import/typings/decorator/interface/provider.d.ts +0 -312
  108. package/transform/compiler/src/render3/partial/util.d.ts +0 -16
  109. package/transform/compiler/src/render3/partial/util.js +0 -44
  110. package/transform/compiler-cli/src/ngtsc/annotations/src/util.js +0 -370
  111. /package/import/es2015/{decorator → di}/injectable.js +0 -0
@@ -5,9 +5,9 @@
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 { Expression, Statement, Type } from "../../../../../compiler";
9
- import * as ts from "typescript";
10
- import { ClassDeclaration, Decorator } from "../../reflection";
8
+ import { Expression, Statement, Type } from 'static-injector/transform/compiler';
9
+ import ts from 'typescript';
10
+ import { ClassDeclaration, Decorator } from '../../reflection';
11
11
  /**
12
12
  * A set of options which can be passed to a `DecoratorHandler` by a consumer, to tailor the output
13
13
  * of compilation beyond the decorators themselves.
@@ -39,7 +39,7 @@ export declare enum HandlerFlags {
39
39
  * @param `A` The type of analysis metadata produced by `analyze`.
40
40
  * @param `R` The type of resolution metadata produced by `resolve`.
41
41
  */
42
- export interface DecoratorHandler<D, A, S extends null, R> {
42
+ export interface DecoratorHandler<D, A, R> {
43
43
  /**
44
44
  * Scan a set of reflected decorators and determine if this handler is responsible for compilation
45
45
  * of one of them.
@@ -5,8 +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 * as ts from "typescript";
9
- import { ImportManager } from "../../translator";
8
+ import ts from 'typescript';
9
+ import { ImportManager } from '../../translator';
10
10
  /**
11
11
  * Adds extra imports in the import manage for this source file, after the existing imports
12
12
  * and before the module body.
@@ -1,22 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
4
  };
21
5
  Object.defineProperty(exports, "__esModule", { value: true });
22
6
  exports.addImports = void 0;
@@ -27,7 +11,8 @@ exports.addImports = void 0;
27
11
  * Use of this source code is governed by an MIT-style license that can be
28
12
  * found in the LICENSE file at https://angular.io/license
29
13
  */
30
- const ts = __importStar(require("typescript"));
14
+ const typescript_1 = __importDefault(require("typescript"));
15
+ const ts_compatibility_1 = require("../../ts_compatibility");
31
16
  /**
32
17
  * Adds extra imports in the import manage for this source file, after the existing imports
33
18
  * and before the module body.
@@ -36,15 +21,15 @@ const ts = __importStar(require("typescript"));
36
21
  function addImports(importManager, sf, extraStatements = []) {
37
22
  // Generate the import statements to prepend.
38
23
  const addedImports = importManager.getAllImports(sf.fileName).map((i) => {
39
- const qualifier = ts.createIdentifier(i.qualifier.text);
40
- const importClause = ts.createImportClause(
24
+ const qualifier = typescript_1.default.factory.createIdentifier(i.qualifier.text);
25
+ const importClause = typescript_1.default.factory.createImportClause(
26
+ /* isTypeOnly */ false,
41
27
  /* name */ undefined,
42
- /* namedBindings */ ts.createNamespaceImport(qualifier));
43
- const decl = ts.createImportDeclaration(
44
- /* decorators */ undefined,
28
+ /* namedBindings */ typescript_1.default.factory.createNamespaceImport(qualifier));
29
+ const decl = (0, ts_compatibility_1.createImportDeclaration)(
45
30
  /* modifiers */ undefined,
46
31
  /* importClause */ importClause,
47
- /* moduleSpecifier */ ts.createLiteral(i.specifier));
32
+ /* moduleSpecifier */ typescript_1.default.factory.createStringLiteral(i.specifier));
48
33
  // Set the qualifier's original TS node to the `ts.ImportDeclaration`. This allows downstream
49
34
  // transforms such as tsickle to properly process references to this import.
50
35
  //
@@ -53,7 +38,7 @@ function addImports(importManager, sf, extraStatements = []) {
53
38
  //
54
39
  // TODO(alxhub): add a test for this when tsickle is updated externally to depend on this
55
40
  // behavior.
56
- ts.setOriginalNode(i.qualifier, decl);
41
+ typescript_1.default.setOriginalNode(i.qualifier, decl);
57
42
  return decl;
58
43
  });
59
44
  // Filter out the existing imports and the source file body. All new statements
@@ -65,8 +50,8 @@ function addImports(importManager, sf, extraStatements = []) {
65
50
  // If we prepend imports, we also prepend NotEmittedStatement to use it as an anchor
66
51
  // for @fileoverview Closure annotation. If there is no @fileoverview annotations, this
67
52
  // statement would be a noop.
68
- const fileoverviewAnchorStmt = ts.createNotEmittedStatement(sf);
69
- return ts.updateSourceFileNode(sf, ts.createNodeArray([
53
+ const fileoverviewAnchorStmt = typescript_1.default.factory.createNotEmittedStatement(sf);
54
+ return typescript_1.default.factory.updateSourceFile(sf, typescript_1.default.factory.createNodeArray([
70
55
  fileoverviewAnchorStmt,
71
56
  ...existingImports,
72
57
  ...addedImports,
@@ -78,7 +63,7 @@ function addImports(importManager, sf, extraStatements = []) {
78
63
  }
79
64
  exports.addImports = addImports;
80
65
  function isImportStatement(stmt) {
81
- return (ts.isImportDeclaration(stmt) ||
82
- ts.isImportEqualsDeclaration(stmt) ||
83
- ts.isNamespaceImport(stmt));
66
+ return (typescript_1.default.isImportDeclaration(stmt) ||
67
+ typescript_1.default.isImportEqualsDeclaration(stmt) ||
68
+ typescript_1.default.isNamespaceImport(stmt));
84
69
  }
@@ -1,5 +1,12 @@
1
- export * from "./src/context";
2
- export * from "./src/translator";
3
- export * from "./src/typescript_ast_factory";
4
- export * from "./src/typescript_translator";
5
- export * from "./src/import_manager";
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
+ export * from './src/context';
9
+ export * from './src/translator';
10
+ export * from './src/typescript_ast_factory';
11
+ export * from './src/typescript_translator';
12
+ export * from './src/import_manager';
@@ -1,7 +1,18 @@
1
1
  "use strict";
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
+ */
2
9
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
10
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
5
16
  }) : (function(o, m, k, k2) {
6
17
  if (k2 === undefined) k2 = k;
7
18
  o[k2] = m[k];
@@ -21,7 +21,7 @@ export interface AstFactory<TStatement, TExpression> {
21
21
  */
22
22
  attachComments(statement: TStatement, leadingComments: LeadingComment[]): void;
23
23
  /**
24
- * Create a literal array expresion (e.g. `[expr1, expr2]`).
24
+ * Create a literal array expression (e.g. `[expr1, expr2]`).
25
25
  *
26
26
  * @param elements a collection of the expressions to appear in each array slot.
27
27
  */
@@ -51,7 +51,7 @@ export interface AstFactory<TStatement, TExpression> {
51
51
  * Create an expression that is calling the `callee` with the given `args`.
52
52
  *
53
53
  * @param callee an expression that evaluates to a function to be called.
54
- * @param args the arugments to be passed to the call.
54
+ * @param args the arguments to be passed to the call.
55
55
  * @param pure whether to mark the call as pure (having no side-effects).
56
56
  */
57
57
  createCallExpression(callee: TExpression, args: TExpression[], pure: boolean): TExpression;
@@ -198,15 +198,15 @@ export interface AstFactory<TStatement, TExpression> {
198
198
  /**
199
199
  * The type of a variable declaration.
200
200
  */
201
- export declare type VariableDeclarationType = "const" | "let" | "var";
201
+ export type VariableDeclarationType = 'const' | 'let' | 'var';
202
202
  /**
203
203
  * The unary operators supported by the `AstFactory`.
204
204
  */
205
- export declare type UnaryOperator = "+" | "-" | "!";
205
+ export type UnaryOperator = '+' | '-' | '!';
206
206
  /**
207
207
  * The binary operators supported by the `AstFactory`.
208
208
  */
209
- export declare type BinaryOperator = "&&" | ">" | ">=" | "&" | "/" | "==" | "===" | "<" | "<=" | "-" | "%" | "*" | "!=" | "!==" | "||" | "+" | "??";
209
+ export type BinaryOperator = '&&' | '>' | '>=' | '&' | '/' | '==' | '===' | '<' | '<=' | '-' | '%' | '*' | '!=' | '!==' | '||' | '+' | '??';
210
210
  /**
211
211
  * The original location of the start or end of a node created by the `AstFactory`.
212
212
  */
@@ -5,16 +5,16 @@
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 * as ts from "typescript";
9
- import { ImportRewriter } from "../../imports";
10
- import { ImportGenerator, NamedImport } from "./api/import_generator";
8
+ import ts from 'typescript';
9
+ import { ImportRewriter } from '../../imports';
10
+ import { ImportGenerator, NamedImport } from './api/import_generator';
11
11
  /**
12
12
  * Information about an import that has been added to a module.
13
13
  */
14
14
  export interface Import {
15
15
  /** The name of the module that has been imported. */
16
16
  specifier: string;
17
- /** The `ts.Identifer` by which the imported module is known. */
17
+ /** The `ts.Identifier` by which the imported module is known. */
18
18
  qualifier: ts.Identifier;
19
19
  }
20
20
  export declare class ImportManager implements ImportGenerator<ts.Identifier> {
@@ -1,22 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
4
  };
21
5
  Object.defineProperty(exports, "__esModule", { value: true });
22
6
  exports.ImportManager = void 0;
@@ -27,10 +11,10 @@ exports.ImportManager = void 0;
27
11
  * Use of this source code is governed by an MIT-style license that can be
28
12
  * found in the LICENSE file at https://angular.io/license
29
13
  */
30
- const ts = __importStar(require("typescript"));
14
+ const typescript_1 = __importDefault(require("typescript"));
31
15
  const imports_1 = require("../../imports");
32
16
  class ImportManager {
33
- constructor(rewriter = new imports_1.NoopImportRewriter(), prefix = "i") {
17
+ constructor(rewriter = new imports_1.NoopImportRewriter(), prefix = 'i') {
34
18
  this.rewriter = rewriter;
35
19
  this.prefix = prefix;
36
20
  this.specifierToIdentifier = new Map();
@@ -38,7 +22,7 @@ class ImportManager {
38
22
  }
39
23
  generateNamespaceImport(moduleName) {
40
24
  if (!this.specifierToIdentifier.has(moduleName)) {
41
- this.specifierToIdentifier.set(moduleName, ts.createIdentifier(`${this.prefix}${this.nextIndex++}`));
25
+ this.specifierToIdentifier.set(moduleName, typescript_1.default.factory.createIdentifier(`${this.prefix}${this.nextIndex++}`));
42
26
  }
43
27
  return this.specifierToIdentifier.get(moduleName);
44
28
  }
@@ -5,11 +5,11 @@
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 * as o from '../../../../../compiler';
8
+ import * as o from 'static-injector/transform/compiler';
9
9
  import { AstFactory } from './api/ast_factory';
10
10
  import { ImportGenerator } from './api/import_generator';
11
11
  import { Context } from './context';
12
- export declare type RecordWrappedNodeFn<TExpression> = (node: o.WrappedNodeExpr<TExpression>) => void;
12
+ export type RecordWrappedNodeFn<TExpression> = (node: o.WrappedNodeExpr<TExpression>) => void;
13
13
  export interface TranslatorOptions<TExpression> {
14
14
  downlevelTaggedTemplates?: boolean;
15
15
  downlevelVariableDeclarations?: boolean;
@@ -27,21 +27,17 @@ export declare class ExpressionTranslatorVisitor<TStatement, TExpression> implem
27
27
  visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, context: Context): TStatement;
28
28
  visitExpressionStmt(stmt: o.ExpressionStatement, context: Context): TStatement;
29
29
  visitReturnStmt(stmt: o.ReturnStatement, context: Context): TStatement;
30
- visitDeclareClassStmt(_stmt: o.ClassStmt, _context: Context): never;
31
30
  visitIfStmt(stmt: o.IfStmt, context: Context): TStatement;
32
31
  visitReadVarExpr(ast: o.ReadVarExpr, _context: Context): TExpression;
33
32
  visitWriteVarExpr(expr: o.WriteVarExpr, context: Context): TExpression;
34
33
  visitWriteKeyExpr(expr: o.WriteKeyExpr, context: Context): TExpression;
35
34
  visitWritePropExpr(expr: o.WritePropExpr, context: Context): TExpression;
36
- visitInvokeMethodExpr(ast: o.InvokeMethodExpr, context: Context): TExpression;
37
35
  visitInvokeFunctionExpr(ast: o.InvokeFunctionExpr, context: Context): TExpression;
38
36
  visitInstantiateExpr(ast: o.InstantiateExpr, context: Context): TExpression;
39
37
  visitLiteralExpr(ast: o.LiteralExpr, _context: Context): TExpression;
40
38
  visitExternalExpr(ast: o.ExternalExpr, _context: Context): TExpression;
41
39
  visitConditionalExpr(ast: o.ConditionalExpr, context: Context): TExpression;
42
40
  visitNotExpr(ast: o.NotExpr, context: Context): TExpression;
43
- visitAssertNotNullExpr(ast: o.AssertNotNull, context: Context): TExpression;
44
- visitCastExpr(ast: o.CastExpr, context: Context): TExpression;
45
41
  visitFunctionExpr(ast: o.FunctionExpr, context: Context): TExpression;
46
42
  visitBinaryOperatorExpr(ast: o.BinaryOperatorExpr, context: Context): TExpression;
47
43
  visitReadPropExpr(ast: o.ReadPropExpr, context: Context): TExpression;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -27,7 +31,7 @@ exports.ExpressionTranslatorVisitor = void 0;
27
31
  * Use of this source code is governed by an MIT-style license that can be
28
32
  * found in the LICENSE file at https://angular.io/license
29
33
  */
30
- const o = __importStar(require("../../../../../compiler"));
34
+ const o = __importStar(require("static-injector/transform/compiler"));
31
35
  const UNARY_OPERATORS = new Map([
32
36
  [o.UnaryOperator.Minus, '-'],
33
37
  [o.UnaryOperator.Plus, '+'],
@@ -78,9 +82,6 @@ class ExpressionTranslatorVisitor {
78
82
  visitReturnStmt(stmt, context) {
79
83
  return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
80
84
  }
81
- visitDeclareClassStmt(_stmt, _context) {
82
- throw new Error('Method not implemented.');
83
- }
84
85
  visitIfStmt(stmt, context) {
85
86
  return this.attachComments(this.factory.createIfStatement(stmt.condition.visitExpression(this, context), this.factory.createBlock(this.visitStatements(stmt.trueCase, context.withStatementMode)), stmt.falseCase.length > 0
86
87
  ? this.factory.createBlock(this.visitStatements(stmt.falseCase, context.withStatementMode))
@@ -109,13 +110,6 @@ class ExpressionTranslatorVisitor {
109
110
  const target = this.factory.createPropertyAccess(expr.receiver.visitExpression(this, context), expr.name);
110
111
  return this.factory.createAssignment(target, expr.value.visitExpression(this, context));
111
112
  }
112
- visitInvokeMethodExpr(ast, context) {
113
- const target = ast.receiver.visitExpression(this, context);
114
- return this.setSourceMapRange(this.factory.createCallExpression(ast.name !== null
115
- ? this.factory.createPropertyAccess(target, ast.name)
116
- : target, ast.args.map((arg) => arg.visitExpression(this, context)),
117
- /* pure */ false), ast.sourceSpan);
118
- }
119
113
  visitInvokeFunctionExpr(ast, context) {
120
114
  return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
121
115
  }
@@ -182,12 +176,6 @@ class ExpressionTranslatorVisitor {
182
176
  visitNotExpr(ast, context) {
183
177
  return this.factory.createUnaryExpression('!', ast.condition.visitExpression(this, context));
184
178
  }
185
- visitAssertNotNullExpr(ast, context) {
186
- return ast.condition.visitExpression(this, context);
187
- }
188
- visitCastExpr(ast, context) {
189
- return ast.value.visitExpression(this, context);
190
- }
191
179
  visitFunctionExpr(ast, context) {
192
180
  var _a;
193
181
  return this.factory.createFunctionExpression((_a = ast.name) !== null && _a !== void 0 ? _a : null, ast.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(ast.statements, context)));
@@ -5,8 +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 * as ts from "typescript";
9
- import { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from "./api/ast_factory";
8
+ import ts from 'typescript';
9
+ import { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './api/ast_factory';
10
10
  /**
11
11
  * A TypeScript flavoured implementation of the AstFactory.
12
12
  */
@@ -20,10 +20,7 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
20
20
  createBinaryExpression(leftOperand: ts.Expression, operator: BinaryOperator, rightOperand: ts.Expression): ts.Expression;
21
21
  createBlock(body: ts.Statement[]): ts.Statement;
22
22
  createCallExpression(callee: ts.Expression, args: ts.Expression[], pure: boolean): ts.Expression;
23
- createConditional: {
24
- (condition: ts.Expression, whenTrue: ts.Expression, whenFalse: ts.Expression): ts.ConditionalExpression;
25
- (condition: ts.Expression, questionToken: ts.QuestionToken, whenTrue: ts.Expression, colonToken: ts.ColonToken, whenFalse: ts.Expression): ts.ConditionalExpression;
26
- };
23
+ createConditional(condition: ts.Expression, whenTrue: ts.Expression, whenFalse: ts.Expression): ts.Expression;
27
24
  createElementAccess: (expression: ts.Expression, index: number | ts.Expression) => ts.ElementAccessExpression;
28
25
  createExpressionStatement: (expression: ts.Expression) => ts.ExpressionStatement;
29
26
  createFunctionDeclaration(functionName: string, parameters: string[], body: ts.Statement): ts.Statement;