static-injector 4.0.2 → 5.0.0-alpha.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 (179) hide show
  1. package/{import/commonjs → commonjs}/index.js +29 -197
  2. package/{import/es2022 → es2022}/di/interface/defs.js +5 -1
  3. package/{import/es2022 → es2022}/index.js +0 -1
  4. package/{transform/compiler/index.d.ts → es2022/interface/lifecycle_hooks.js} +1 -1
  5. package/{transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.js → es2022/render3/definition_factory.js} +3 -2
  6. package/es2022/util/decorators.js +31 -0
  7. package/{import/fesm2022 → fesm2022}/index.js +30 -196
  8. package/package.json +17 -14
  9. package/readme.md +32 -12
  10. package/{import/typings → typings}/di/injectable.d.ts +0 -7
  11. package/{import/typings → typings}/index.d.ts +0 -1
  12. package/import/es2022/di/injectable.js +0 -14
  13. package/import/es2022/error_details_base_url.js +0 -19
  14. package/import/es2022/render3/definition_factory.js +0 -14
  15. package/import/es2022/render3/di.js +0 -49
  16. package/import/es2022/render3/error_code.js +0 -30
  17. package/import/es2022/util/array_utils.js +0 -17
  18. package/import/es2022/util/decorators.js +0 -53
  19. package/import/typings/error_details_base_url.d.ts +0 -19
  20. package/import/typings/render3/di.d.ts +0 -12
  21. package/import/typings/render3/error_code.d.ts +0 -24
  22. package/import/typings/util/array_utils.d.ts +0 -25
  23. package/transform/compiler/compiler.d.ts +0 -8
  24. package/transform/compiler/compiler.js +0 -28
  25. package/transform/compiler/index.js +0 -28
  26. package/transform/compiler/public_api.d.ts +0 -13
  27. package/transform/compiler/public_api.js +0 -30
  28. package/transform/compiler/src/compiler.d.ts +0 -5
  29. package/transform/compiler/src/compiler.js +0 -21
  30. package/transform/compiler/src/core.d.ts +0 -25
  31. package/transform/compiler/src/core.js +0 -22
  32. package/transform/compiler/src/injectable_compiler_2.d.ts +0 -23
  33. package/transform/compiler/src/injectable_compiler_2.js +0 -171
  34. package/transform/compiler/src/output/output_ast.d.ts +0 -512
  35. package/transform/compiler/src/output/output_ast.js +0 -1109
  36. package/transform/compiler/src/parse_util.d.ts +0 -50
  37. package/transform/compiler/src/parse_util.js +0 -71
  38. package/transform/compiler/src/render3/partial/api.d.ts +0 -171
  39. package/transform/compiler/src/render3/partial/api.js +0 -18
  40. package/transform/compiler/src/render3/r3_factory.d.ts +0 -82
  41. package/transform/compiler/src/render3/r3_factory.js +0 -225
  42. package/transform/compiler/src/render3/r3_identifiers.d.ts +0 -20
  43. package/transform/compiler/src/render3/r3_identifiers.js +0 -55
  44. package/transform/compiler/src/render3/util.d.ts +0 -85
  45. package/transform/compiler/src/render3/util.js +0 -82
  46. package/transform/compiler/src/render3/view/util.d.ts +0 -24
  47. package/transform/compiler/src/render3/view/util.js +0 -59
  48. package/transform/compiler-cli/src/ngtsc/annotations/common/index.d.ts +0 -3
  49. package/transform/compiler-cli/src/ngtsc/annotations/common/index.js +0 -19
  50. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.d.ts +0 -37
  51. package/transform/compiler-cli/src/ngtsc/annotations/common/src/di.js +0 -195
  52. package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.d.ts +0 -11
  53. package/transform/compiler-cli/src/ngtsc/annotations/common/src/factory.js +0 -22
  54. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.d.ts +0 -64
  55. package/transform/compiler-cli/src/ngtsc/annotations/common/src/util.js +0 -189
  56. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.d.ts +0 -43
  57. package/transform/compiler-cli/src/ngtsc/annotations/src/injectable.js +0 -277
  58. package/transform/compiler-cli/src/ngtsc/diagnostics/error.d.ts +0 -24
  59. package/transform/compiler-cli/src/ngtsc/diagnostics/error.js +0 -84
  60. package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.d.ts +0 -188
  61. package/transform/compiler-cli/src/ngtsc/diagnostics/error_code.js +0 -206
  62. package/transform/compiler-cli/src/ngtsc/diagnostics/index.d.ts +0 -2
  63. package/transform/compiler-cli/src/ngtsc/diagnostics/index.js +0 -18
  64. package/transform/compiler-cli/src/ngtsc/imports/index.d.ts +0 -1
  65. package/transform/compiler-cli/src/ngtsc/imports/index.js +0 -17
  66. package/transform/compiler-cli/src/ngtsc/imports/src/core.d.ts +0 -36
  67. package/transform/compiler-cli/src/ngtsc/imports/src/core.js +0 -25
  68. package/transform/compiler-cli/src/ngtsc/imports/src/default.d.ts +0 -19
  69. package/transform/compiler-cli/src/ngtsc/imports/src/default.js +0 -27
  70. package/transform/compiler-cli/src/ngtsc/reflection/index.d.ts +0 -3
  71. package/transform/compiler-cli/src/ngtsc/reflection/index.js +0 -19
  72. package/transform/compiler-cli/src/ngtsc/reflection/src/host.d.ts +0 -522
  73. package/transform/compiler-cli/src/ngtsc/reflection/src/host.js +0 -34
  74. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.d.ts +0 -25
  75. package/transform/compiler-cli/src/ngtsc/reflection/src/type_to_value.js +0 -271
  76. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.d.ts +0 -53
  77. package/transform/compiler-cli/src/ngtsc/reflection/src/typescript.js +0 -393
  78. package/transform/compiler-cli/src/ngtsc/reflection/src/util.d.ts +0 -12
  79. package/transform/compiler-cli/src/ngtsc/reflection/src/util.js +0 -29
  80. package/transform/compiler-cli/src/ngtsc/transform/index.d.ts +0 -2
  81. package/transform/compiler-cli/src/ngtsc/transform/index.js +0 -18
  82. package/transform/compiler-cli/src/ngtsc/transform/src/api.d.ts +0 -115
  83. package/transform/compiler-cli/src/ngtsc/transform/src/api.js +0 -29
  84. package/transform/compiler-cli/src/ngtsc/transform/src/utils.d.ts +0 -15
  85. package/transform/compiler-cli/src/ngtsc/transform/src/utils.js +0 -79
  86. package/transform/compiler-cli/src/ngtsc/translator/index.d.ts +0 -5
  87. package/transform/compiler-cli/src/ngtsc/translator/index.js +0 -21
  88. package/transform/compiler-cli/src/ngtsc/translator/src/api/ast_factory.d.ts +0 -289
  89. package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.d.ts +0 -27
  90. package/transform/compiler-cli/src/ngtsc/translator/src/api/import_generator.js +0 -9
  91. package/transform/compiler-cli/src/ngtsc/translator/src/context.d.ts +0 -18
  92. package/transform/compiler-cli/src/ngtsc/translator/src/context.js +0 -28
  93. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.d.ts +0 -47
  94. package/transform/compiler-cli/src/ngtsc/translator/src/import_manager.js +0 -66
  95. package/transform/compiler-cli/src/ngtsc/translator/src/translator.d.ts +0 -56
  96. package/transform/compiler-cli/src/ngtsc/translator/src/translator.js +0 -270
  97. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.d.ts +0 -12
  98. package/transform/compiler-cli/src/ngtsc/translator/src/ts_util.js +0 -27
  99. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.d.ts +0 -53
  100. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_ast_factory.js +0 -250
  101. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.d.ts +0 -13
  102. package/transform/compiler-cli/src/ngtsc/translator/src/typescript_translator.js +0 -21
  103. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.d.ts +0 -8
  104. package/transform/compiler-cli/src/ngtsc/ts_compatibility/index.js +0 -24
  105. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.d.ts +0 -45
  106. package/transform/compiler-cli/src/ngtsc/ts_compatibility/src/ts_cross_version_utils.js +0 -86
  107. package/transform/compiler-cli/src/ngtsc/util/src/typescript.d.ts +0 -4
  108. package/transform/compiler-cli/src/ngtsc/util/src/typescript.js +0 -16
  109. package/transform/index.d.ts +0 -1
  110. package/transform/index.js +0 -17
  111. package/transform/injectable-transform.d.ts +0 -41
  112. package/transform/injectable-transform.js +0 -245
  113. package/transform/node-Iteration.d.ts +0 -2
  114. package/transform/node-Iteration.js +0 -12
  115. /package/{import/es2022 → es2022}/di/create_injector.js +0 -0
  116. /package/{import/es2022 → es2022}/di/forward_ref.js +0 -0
  117. /package/{import/es2022 → es2022}/di/index.js +0 -0
  118. /package/{import/es2022 → es2022}/di/initializer_token.js +0 -0
  119. /package/{import/es2022 → es2022}/di/inject_switch.js +0 -0
  120. /package/{import/es2022/di/injector_marker.js → es2022/di/injectable.js} +0 -0
  121. /package/{import/es2022 → es2022}/di/injection_token.js +0 -0
  122. /package/{import/es2022 → es2022}/di/injector.js +0 -0
  123. /package/{import/es2022 → es2022}/di/injector_compatibility.js +0 -0
  124. /package/{import/es2022/di/provider_token.js → es2022/di/injector_marker.js} +0 -0
  125. /package/{import/es2022 → es2022}/di/injector_token.js +0 -0
  126. /package/{import/es2022 → es2022}/di/interface/injector.js +0 -0
  127. /package/{import/es2022 → es2022}/di/interface/provider.js +0 -0
  128. /package/{import/es2022 → es2022}/di/internal_tokens.js +0 -0
  129. /package/{import/es2022 → es2022}/di/metadata.js +0 -0
  130. /package/{import/es2022 → es2022}/di/null_injector.js +0 -0
  131. /package/{import/es2022 → es2022}/di/provider_collection.js +0 -0
  132. /package/{import/es2022/interface/lifecycle_hooks.js → es2022/di/provider_token.js} +0 -0
  133. /package/{import/es2022 → es2022}/di/r3_injector.js +0 -0
  134. /package/{import/es2022 → es2022}/di/scope.js +0 -0
  135. /package/{import/es2022 → es2022}/di.js +0 -0
  136. /package/{import/es2022 → es2022}/errors.js +0 -0
  137. /package/{import/es2022 → es2022}/interface/type.js +0 -0
  138. /package/{import/es2022 → es2022}/render3/errors_di.js +0 -0
  139. /package/{import/es2022 → es2022}/render3/fields.js +0 -0
  140. /package/{import/es2022 → es2022}/render3/instructions/di.js +0 -0
  141. /package/{import/es2022 → es2022}/render3/util/stringify_utils.js +0 -0
  142. /package/{import/es2022 → es2022}/util/closure.js +0 -0
  143. /package/{import/es2022 → es2022}/util/empty.js +0 -0
  144. /package/{import/es2022 → es2022}/util/property.js +0 -0
  145. /package/{import/es2022 → es2022}/util/stringify.js +0 -0
  146. /package/{import/typings → typings}/di/create_injector.d.ts +0 -0
  147. /package/{import/typings → typings}/di/forward_ref.d.ts +0 -0
  148. /package/{import/typings → typings}/di/index.d.ts +0 -0
  149. /package/{import/typings → typings}/di/initializer_token.d.ts +0 -0
  150. /package/{import/typings → typings}/di/inject_switch.d.ts +0 -0
  151. /package/{import/typings → typings}/di/injection_token.d.ts +0 -0
  152. /package/{import/typings → typings}/di/injector.d.ts +0 -0
  153. /package/{import/typings → typings}/di/injector_compatibility.d.ts +0 -0
  154. /package/{import/typings → typings}/di/injector_marker.d.ts +0 -0
  155. /package/{import/typings → typings}/di/injector_token.d.ts +0 -0
  156. /package/{import/typings → typings}/di/interface/defs.d.ts +0 -0
  157. /package/{import/typings → typings}/di/interface/injector.d.ts +0 -0
  158. /package/{import/typings → typings}/di/interface/provider.d.ts +0 -0
  159. /package/{import/typings → typings}/di/internal_tokens.d.ts +0 -0
  160. /package/{import/typings → typings}/di/metadata.d.ts +0 -0
  161. /package/{import/typings → typings}/di/null_injector.d.ts +0 -0
  162. /package/{import/typings → typings}/di/provider_collection.d.ts +0 -0
  163. /package/{import/typings → typings}/di/provider_token.d.ts +0 -0
  164. /package/{import/typings → typings}/di/r3_injector.d.ts +0 -0
  165. /package/{import/typings → typings}/di/scope.d.ts +0 -0
  166. /package/{import/typings → typings}/di.d.ts +0 -0
  167. /package/{import/typings → typings}/errors.d.ts +0 -0
  168. /package/{import/typings → typings}/interface/lifecycle_hooks.d.ts +0 -0
  169. /package/{import/typings → typings}/interface/type.d.ts +0 -0
  170. /package/{import/typings → typings}/render3/definition_factory.d.ts +0 -0
  171. /package/{import/typings → typings}/render3/errors_di.d.ts +0 -0
  172. /package/{import/typings → typings}/render3/fields.d.ts +0 -0
  173. /package/{import/typings → typings}/render3/instructions/di.d.ts +0 -0
  174. /package/{import/typings → typings}/render3/util/stringify_utils.d.ts +0 -0
  175. /package/{import/typings → typings}/util/closure.d.ts +0 -0
  176. /package/{import/typings → typings}/util/decorators.d.ts +0 -0
  177. /package/{import/typings → typings}/util/empty.d.ts +0 -0
  178. /package/{import/typings → typings}/util/property.d.ts +0 -0
  179. /package/{import/typings → typings}/util/stringify.d.ts +0 -0
@@ -1,270 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = 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);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.ExpressionTranslatorVisitor = void 0;
27
- /**
28
- * @license
29
- * Copyright Google LLC All Rights Reserved.
30
- *
31
- * Use of this source code is governed by an MIT-style license that can be
32
- * found in the LICENSE file at https://angular.io/license
33
- */
34
- const o = __importStar(require("static-injector/transform/compiler"));
35
- const UNARY_OPERATORS = new Map([
36
- [o.UnaryOperator.Minus, '-'],
37
- [o.UnaryOperator.Plus, '+'],
38
- ]);
39
- const BINARY_OPERATORS = new Map([
40
- [o.BinaryOperator.And, '&&'],
41
- [o.BinaryOperator.Bigger, '>'],
42
- [o.BinaryOperator.BiggerEquals, '>='],
43
- [o.BinaryOperator.BitwiseAnd, '&'],
44
- [o.BinaryOperator.BitwiseOr, '|'],
45
- [o.BinaryOperator.Divide, '/'],
46
- [o.BinaryOperator.Equals, '=='],
47
- [o.BinaryOperator.Identical, '==='],
48
- [o.BinaryOperator.Lower, '<'],
49
- [o.BinaryOperator.LowerEquals, '<='],
50
- [o.BinaryOperator.Minus, '-'],
51
- [o.BinaryOperator.Modulo, '%'],
52
- [o.BinaryOperator.Multiply, '*'],
53
- [o.BinaryOperator.NotEquals, '!='],
54
- [o.BinaryOperator.NotIdentical, '!=='],
55
- [o.BinaryOperator.Or, '||'],
56
- [o.BinaryOperator.Plus, '+'],
57
- [o.BinaryOperator.NullishCoalesce, '??'],
58
- ]);
59
- class ExpressionTranslatorVisitor {
60
- factory;
61
- imports;
62
- downlevelTaggedTemplates;
63
- downlevelVariableDeclarations;
64
- recordWrappedNode;
65
- constructor(factory, imports, options) {
66
- this.factory = factory;
67
- this.imports = imports;
68
- this.downlevelTaggedTemplates = options.downlevelTaggedTemplates === true;
69
- this.downlevelVariableDeclarations =
70
- options.downlevelVariableDeclarations === true;
71
- this.recordWrappedNode = options.recordWrappedNode || (() => { });
72
- }
73
- visitDeclareVarStmt(stmt, context) {
74
- const varType = this.downlevelVariableDeclarations
75
- ? 'var'
76
- : stmt.hasModifier(o.StmtModifier.Final)
77
- ? 'const'
78
- : 'let';
79
- return this.attachComments(this.factory.createVariableDeclaration(stmt.name, stmt.value?.visitExpression(this, context.withExpressionMode), varType), stmt.leadingComments);
80
- }
81
- visitDeclareFunctionStmt(stmt, context) {
82
- return this.attachComments(this.factory.createFunctionDeclaration(stmt.name, stmt.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(stmt.statements, context.withStatementMode))), stmt.leadingComments);
83
- }
84
- visitExpressionStmt(stmt, context) {
85
- return this.attachComments(this.factory.createExpressionStatement(stmt.expr.visitExpression(this, context.withStatementMode)), stmt.leadingComments);
86
- }
87
- visitReturnStmt(stmt, context) {
88
- return this.attachComments(this.factory.createReturnStatement(stmt.value.visitExpression(this, context.withExpressionMode)), stmt.leadingComments);
89
- }
90
- visitIfStmt(stmt, context) {
91
- return this.attachComments(this.factory.createIfStatement(stmt.condition.visitExpression(this, context), this.factory.createBlock(this.visitStatements(stmt.trueCase, context.withStatementMode)), stmt.falseCase.length > 0
92
- ? this.factory.createBlock(this.visitStatements(stmt.falseCase, context.withStatementMode))
93
- : null), stmt.leadingComments);
94
- }
95
- visitReadVarExpr(ast, _context) {
96
- const identifier = this.factory.createIdentifier(ast.name);
97
- this.setSourceMapRange(identifier, ast.sourceSpan);
98
- return identifier;
99
- }
100
- visitWriteVarExpr(expr, context) {
101
- const assignment = this.factory.createAssignment(this.setSourceMapRange(this.factory.createIdentifier(expr.name), expr.sourceSpan), expr.value.visitExpression(this, context));
102
- return context.isStatement
103
- ? assignment
104
- : this.factory.createParenthesizedExpression(assignment);
105
- }
106
- visitWriteKeyExpr(expr, context) {
107
- const exprContext = context.withExpressionMode;
108
- const target = this.factory.createElementAccess(expr.receiver.visitExpression(this, exprContext), expr.index.visitExpression(this, exprContext));
109
- const assignment = this.factory.createAssignment(target, expr.value.visitExpression(this, exprContext));
110
- return context.isStatement
111
- ? assignment
112
- : this.factory.createParenthesizedExpression(assignment);
113
- }
114
- visitWritePropExpr(expr, context) {
115
- const target = this.factory.createPropertyAccess(expr.receiver.visitExpression(this, context), expr.name);
116
- return this.factory.createAssignment(target, expr.value.visitExpression(this, context));
117
- }
118
- visitInvokeFunctionExpr(ast, context) {
119
- return this.setSourceMapRange(this.factory.createCallExpression(ast.fn.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)), ast.pure), ast.sourceSpan);
120
- }
121
- visitInstantiateExpr(ast, context) {
122
- return this.factory.createNewExpression(ast.classExpr.visitExpression(this, context), ast.args.map((arg) => arg.visitExpression(this, context)));
123
- }
124
- visitLiteralExpr(ast, _context) {
125
- return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
126
- }
127
- visitExternalExpr(ast, _context) {
128
- if (ast.value.name === null) {
129
- if (ast.value.moduleName === null) {
130
- throw new Error('Invalid import without name nor moduleName');
131
- }
132
- return this.imports.generateNamespaceImport(ast.value.moduleName);
133
- }
134
- // If a moduleName is specified, this is a normal import. If there's no module name, it's a
135
- // reference to a global/ambient symbol.
136
- if (ast.value.moduleName !== null) {
137
- // This is a normal import. Find the imported module.
138
- const { moduleImport, symbol } = this.imports.generateNamedImport(ast.value.moduleName, ast.value.name);
139
- if (moduleImport === null) {
140
- // The symbol was ambient after all.
141
- return this.factory.createIdentifier(symbol);
142
- }
143
- else {
144
- return this.factory.createPropertyAccess(moduleImport, symbol);
145
- }
146
- }
147
- else {
148
- // The symbol is ambient, so just reference it.
149
- return this.factory.createIdentifier(ast.value.name);
150
- }
151
- }
152
- visitConditionalExpr(ast, context) {
153
- let cond = ast.condition.visitExpression(this, context);
154
- // Ordinarily the ternary operator is right-associative. The following are equivalent:
155
- // `a ? b : c ? d : e` => `a ? b : (c ? d : e)`
156
- //
157
- // However, occasionally Angular needs to produce a left-associative conditional, such as in
158
- // the case of a null-safe navigation production: `{{a?.b ? c : d}}`. This template produces
159
- // a ternary of the form:
160
- // `a == null ? null : rest of expression`
161
- // If the rest of the expression is also a ternary though, this would produce the form:
162
- // `a == null ? null : a.b ? c : d`
163
- // which, if left as right-associative, would be incorrectly associated as:
164
- // `a == null ? null : (a.b ? c : d)`
165
- //
166
- // In such cases, the left-associativity needs to be enforced with parentheses:
167
- // `(a == null ? null : a.b) ? c : d`
168
- //
169
- // Such parentheses could always be included in the condition (guaranteeing correct behavior) in
170
- // all cases, but this has a code size cost. Instead, parentheses are added only when a
171
- // conditional expression is directly used as the condition of another.
172
- //
173
- // TODO(alxhub): investigate better logic for precendence of conditional operators
174
- if (ast.condition instanceof o.ConditionalExpr) {
175
- // The condition of this ternary needs to be wrapped in parentheses to maintain
176
- // left-associativity.
177
- cond = this.factory.createParenthesizedExpression(cond);
178
- }
179
- return this.factory.createConditional(cond, ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context));
180
- }
181
- visitDynamicImportExpr(ast, context) {
182
- return this.factory.createDynamicImport(ast.url);
183
- }
184
- visitNotExpr(ast, context) {
185
- return this.factory.createUnaryExpression('!', ast.condition.visitExpression(this, context));
186
- }
187
- visitFunctionExpr(ast, context) {
188
- return this.factory.createFunctionExpression(ast.name ?? null, ast.params.map((param) => param.name), this.factory.createBlock(this.visitStatements(ast.statements, context)));
189
- }
190
- visitArrowFunctionExpr(ast, context) {
191
- return this.factory.createArrowFunctionExpression(ast.params.map((param) => param.name), Array.isArray(ast.body)
192
- ? this.factory.createBlock(this.visitStatements(ast.body, context))
193
- : ast.body.visitExpression(this, context));
194
- }
195
- visitBinaryOperatorExpr(ast, context) {
196
- if (!BINARY_OPERATORS.has(ast.operator)) {
197
- throw new Error(`Unknown binary operator: ${o.BinaryOperator[ast.operator]}`);
198
- }
199
- return this.factory.createBinaryExpression(ast.lhs.visitExpression(this, context), BINARY_OPERATORS.get(ast.operator), ast.rhs.visitExpression(this, context));
200
- }
201
- visitReadPropExpr(ast, context) {
202
- return this.factory.createPropertyAccess(ast.receiver.visitExpression(this, context), ast.name);
203
- }
204
- visitReadKeyExpr(ast, context) {
205
- return this.factory.createElementAccess(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context));
206
- }
207
- visitLiteralArrayExpr(ast, context) {
208
- return this.factory.createArrayLiteral(ast.entries.map((expr) => this.setSourceMapRange(expr.visitExpression(this, context), ast.sourceSpan)));
209
- }
210
- visitLiteralMapExpr(ast, context) {
211
- const properties = ast.entries.map((entry) => {
212
- return {
213
- propertyName: entry.key,
214
- quoted: entry.quoted,
215
- value: entry.value.visitExpression(this, context),
216
- };
217
- });
218
- return this.setSourceMapRange(this.factory.createObjectLiteral(properties), ast.sourceSpan);
219
- }
220
- visitCommaExpr(ast, context) {
221
- throw new Error('Method not implemented.');
222
- }
223
- visitWrappedNodeExpr(ast, _context) {
224
- this.recordWrappedNode(ast);
225
- return ast.node;
226
- }
227
- visitTypeofExpr(ast, context) {
228
- return this.factory.createTypeOfExpression(ast.expr.visitExpression(this, context));
229
- }
230
- visitUnaryOperatorExpr(ast, context) {
231
- if (!UNARY_OPERATORS.has(ast.operator)) {
232
- throw new Error(`Unknown unary operator: ${o.UnaryOperator[ast.operator]}`);
233
- }
234
- return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
235
- }
236
- visitStatements(statements, context) {
237
- return statements
238
- .map((stmt) => stmt.visitStatement(this, context))
239
- .filter((stmt) => stmt !== undefined);
240
- }
241
- setSourceMapRange(ast, span) {
242
- return this.factory.setSourceMapRange(ast, createRange(span));
243
- }
244
- attachComments(statement, leadingComments) {
245
- if (leadingComments !== undefined) {
246
- this.factory.attachComments(statement, leadingComments);
247
- }
248
- return statement;
249
- }
250
- }
251
- exports.ExpressionTranslatorVisitor = ExpressionTranslatorVisitor;
252
- /**
253
- * Convert an OutputAST source-span into a range that can be used by the AST factories.
254
- */
255
- function createRange(span) {
256
- if (span === null) {
257
- return null;
258
- }
259
- const { start, end } = span;
260
- const { url, content } = start.file;
261
- if (!url) {
262
- return null;
263
- }
264
- return {
265
- url,
266
- content,
267
- start: { offset: start.offset, line: start.line, column: start.col },
268
- end: { offset: end.offset, line: end.line, column: end.col },
269
- };
270
- }
@@ -1,12 +0,0 @@
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
- import ts from 'typescript';
9
- /**
10
- * Creates a TypeScript node representing a numeric value.
11
- */
12
- export declare function tsNumericExpression(value: number): ts.NumericLiteral | ts.PrefixUnaryExpression;
@@ -1,27 +0,0 @@
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
- */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.tsNumericExpression = void 0;
14
- const typescript_1 = __importDefault(require("typescript"));
15
- /**
16
- * Creates a TypeScript node representing a numeric value.
17
- */
18
- function tsNumericExpression(value) {
19
- // As of TypeScript 5.3 negative numbers are represented as `prefixUnaryOperator` and passing a
20
- // negative number (even as a string) into `createNumericLiteral` will result in an error.
21
- if (value < 0) {
22
- const operand = typescript_1.default.factory.createNumericLiteral(Math.abs(value));
23
- return typescript_1.default.factory.createPrefixUnaryExpression(typescript_1.default.SyntaxKind.MinusToken, operand);
24
- }
25
- return typescript_1.default.factory.createNumericLiteral(value);
26
- }
27
- exports.tsNumericExpression = tsNumericExpression;
@@ -1,53 +0,0 @@
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
- import ts from 'typescript';
9
- import { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapRange, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './api/ast_factory';
10
- /**
11
- * A TypeScript flavoured implementation of the AstFactory.
12
- */
13
- export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts.Expression> {
14
- private annotateForClosureCompiler;
15
- private externalSourceFiles;
16
- constructor(annotateForClosureCompiler: boolean);
17
- attachComments: typeof attachComments;
18
- createArrayLiteral: (elements?: readonly ts.Expression[] | undefined, multiLine?: boolean | undefined) => ts.ArrayLiteralExpression;
19
- createAssignment(target: ts.Expression, value: ts.Expression): ts.Expression;
20
- createBinaryExpression(leftOperand: ts.Expression, operator: BinaryOperator, rightOperand: ts.Expression): ts.Expression;
21
- createBlock(body: ts.Statement[]): ts.Statement;
22
- createCallExpression(callee: ts.Expression, args: ts.Expression[], pure: boolean): ts.Expression;
23
- createConditional(condition: ts.Expression, whenTrue: ts.Expression, whenFalse: ts.Expression): ts.Expression;
24
- createElementAccess: (expression: ts.Expression, index: number | ts.Expression) => ts.ElementAccessExpression;
25
- createExpressionStatement: (expression: ts.Expression) => ts.ExpressionStatement;
26
- createDynamicImport(url: string): ts.CallExpression;
27
- createFunctionDeclaration(functionName: string, parameters: string[], body: ts.Statement): ts.Statement;
28
- createFunctionExpression(functionName: string | null, parameters: string[], body: ts.Statement): ts.Expression;
29
- createArrowFunctionExpression(parameters: string[], body: ts.Statement | ts.Expression): ts.Expression;
30
- createIdentifier: (text: string) => ts.Identifier;
31
- createIfStatement(condition: ts.Expression, thenStatement: ts.Statement, elseStatement: ts.Statement | null): ts.Statement;
32
- createLiteral(value: string | number | boolean | null | undefined): ts.Expression;
33
- createNewExpression(expression: ts.Expression, args: ts.Expression[]): ts.Expression;
34
- createObjectLiteral(properties: ObjectLiteralProperty<ts.Expression>[]): ts.Expression;
35
- createParenthesizedExpression: (expression: ts.Expression) => ts.ParenthesizedExpression;
36
- createPropertyAccess: (expression: ts.Expression, name: string | ts.MemberName) => ts.PropertyAccessExpression;
37
- createReturnStatement(expression: ts.Expression | null): ts.Statement;
38
- createTaggedTemplate(tag: ts.Expression, template: TemplateLiteral<ts.Expression>): ts.Expression;
39
- createThrowStatement: (expression: ts.Expression) => ts.ThrowStatement;
40
- createTypeOfExpression: (expression: ts.Expression) => ts.TypeOfExpression;
41
- createUnaryExpression(operator: UnaryOperator, operand: ts.Expression): ts.Expression;
42
- createVariableDeclaration(variableName: string, initializer: ts.Expression | null, type: VariableDeclarationType): ts.Statement;
43
- setSourceMapRange<T extends ts.Node>(node: T, sourceMapRange: SourceMapRange | null): T;
44
- }
45
- export declare function createTemplateMiddle(cooked: string, raw: string): ts.TemplateMiddle;
46
- export declare function createTemplateTail(cooked: string, raw: string): ts.TemplateTail;
47
- /**
48
- * Attach the given `leadingComments` to the `statement` node.
49
- *
50
- * @param statement The statement that will have comments attached.
51
- * @param leadingComments The comments to attach to the statement.
52
- */
53
- export declare function attachComments(statement: ts.Statement, leadingComments: LeadingComment[]): void;
@@ -1,250 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.attachComments = exports.createTemplateTail = exports.createTemplateMiddle = exports.TypeScriptAstFactory = void 0;
7
- /**
8
- * @license
9
- * Copyright Google LLC All Rights Reserved.
10
- *
11
- * Use of this source code is governed by an MIT-style license that can be
12
- * found in the LICENSE file at https://angular.io/license
13
- */
14
- const typescript_1 = __importDefault(require("typescript"));
15
- const ts_util_1 = require("./ts_util");
16
- /**
17
- * Different optimizers use different annotations on a function or method call to indicate its pure
18
- * status.
19
- */
20
- var PureAnnotation;
21
- (function (PureAnnotation) {
22
- /**
23
- * Closure's annotation for purity is `@pureOrBreakMyCode`, but this needs to be in a semantic
24
- * (jsdoc) enabled comment. Thus, the actual comment text for Closure must include the `*` that
25
- * turns a `/*` comment into a `/**` comment, as well as surrounding whitespace.
26
- */
27
- PureAnnotation["CLOSURE"] = "* @pureOrBreakMyCode ";
28
- PureAnnotation["TERSER"] = "@__PURE__";
29
- })(PureAnnotation || (PureAnnotation = {}));
30
- const UNARY_OPERATORS = {
31
- '+': typescript_1.default.SyntaxKind.PlusToken,
32
- '-': typescript_1.default.SyntaxKind.MinusToken,
33
- '!': typescript_1.default.SyntaxKind.ExclamationToken,
34
- };
35
- const BINARY_OPERATORS = {
36
- '&&': typescript_1.default.SyntaxKind.AmpersandAmpersandToken,
37
- '>': typescript_1.default.SyntaxKind.GreaterThanToken,
38
- '>=': typescript_1.default.SyntaxKind.GreaterThanEqualsToken,
39
- '&': typescript_1.default.SyntaxKind.AmpersandToken,
40
- '|': typescript_1.default.SyntaxKind.BarToken,
41
- '/': typescript_1.default.SyntaxKind.SlashToken,
42
- '==': typescript_1.default.SyntaxKind.EqualsEqualsToken,
43
- '===': typescript_1.default.SyntaxKind.EqualsEqualsEqualsToken,
44
- '<': typescript_1.default.SyntaxKind.LessThanToken,
45
- '<=': typescript_1.default.SyntaxKind.LessThanEqualsToken,
46
- '-': typescript_1.default.SyntaxKind.MinusToken,
47
- '%': typescript_1.default.SyntaxKind.PercentToken,
48
- '*': typescript_1.default.SyntaxKind.AsteriskToken,
49
- '!=': typescript_1.default.SyntaxKind.ExclamationEqualsToken,
50
- '!==': typescript_1.default.SyntaxKind.ExclamationEqualsEqualsToken,
51
- '||': typescript_1.default.SyntaxKind.BarBarToken,
52
- '+': typescript_1.default.SyntaxKind.PlusToken,
53
- '??': typescript_1.default.SyntaxKind.QuestionQuestionToken,
54
- };
55
- const VAR_TYPES = {
56
- const: typescript_1.default.NodeFlags.Const,
57
- let: typescript_1.default.NodeFlags.Let,
58
- var: typescript_1.default.NodeFlags.None,
59
- };
60
- /**
61
- * A TypeScript flavoured implementation of the AstFactory.
62
- */
63
- class TypeScriptAstFactory {
64
- annotateForClosureCompiler;
65
- externalSourceFiles = new Map();
66
- constructor(annotateForClosureCompiler) {
67
- this.annotateForClosureCompiler = annotateForClosureCompiler;
68
- }
69
- attachComments = attachComments;
70
- createArrayLiteral = typescript_1.default.factory.createArrayLiteralExpression;
71
- createAssignment(target, value) {
72
- return typescript_1.default.factory.createBinaryExpression(target, typescript_1.default.SyntaxKind.EqualsToken, value);
73
- }
74
- createBinaryExpression(leftOperand, operator, rightOperand) {
75
- return typescript_1.default.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS[operator], rightOperand);
76
- }
77
- createBlock(body) {
78
- return typescript_1.default.factory.createBlock(body);
79
- }
80
- createCallExpression(callee, args, pure) {
81
- const call = typescript_1.default.factory.createCallExpression(callee, undefined, args);
82
- if (pure) {
83
- typescript_1.default.addSyntheticLeadingComment(call, typescript_1.default.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler
84
- ? PureAnnotation.CLOSURE
85
- : PureAnnotation.TERSER,
86
- /* trailing newline */ false);
87
- }
88
- return call;
89
- }
90
- createConditional(condition, whenTrue, whenFalse) {
91
- return typescript_1.default.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
92
- }
93
- createElementAccess = typescript_1.default.factory.createElementAccessExpression;
94
- createExpressionStatement = typescript_1.default.factory.createExpressionStatement;
95
- createDynamicImport(url) {
96
- return typescript_1.default.factory.createCallExpression(typescript_1.default.factory.createToken(typescript_1.default.SyntaxKind.ImportKeyword),
97
- /* type */ undefined, [typescript_1.default.factory.createStringLiteral(url)]);
98
- }
99
- createFunctionDeclaration(functionName, parameters, body) {
100
- if (!typescript_1.default.isBlock(body)) {
101
- throw new Error(`Invalid syntax, expected a block, but got ${typescript_1.default.SyntaxKind[body.kind]}.`);
102
- }
103
- return typescript_1.default.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => typescript_1.default.factory.createParameterDeclaration(undefined, undefined, param)), undefined, body);
104
- }
105
- createFunctionExpression(functionName, parameters, body) {
106
- if (!typescript_1.default.isBlock(body)) {
107
- throw new Error(`Invalid syntax, expected a block, but got ${typescript_1.default.SyntaxKind[body.kind]}.`);
108
- }
109
- return typescript_1.default.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => typescript_1.default.factory.createParameterDeclaration(undefined, undefined, param)), undefined, body);
110
- }
111
- createArrowFunctionExpression(parameters, body) {
112
- if (typescript_1.default.isStatement(body) && !typescript_1.default.isBlock(body)) {
113
- throw new Error(`Invalid syntax, expected a block, but got ${typescript_1.default.SyntaxKind[body.kind]}.`);
114
- }
115
- return typescript_1.default.factory.createArrowFunction(undefined, undefined, parameters.map((param) => typescript_1.default.factory.createParameterDeclaration(undefined, undefined, param)), undefined, undefined, body);
116
- }
117
- createIdentifier = typescript_1.default.factory.createIdentifier;
118
- createIfStatement(condition, thenStatement, elseStatement) {
119
- return typescript_1.default.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
120
- }
121
- createLiteral(value) {
122
- if (value === undefined) {
123
- return typescript_1.default.factory.createIdentifier('undefined');
124
- }
125
- else if (value === null) {
126
- return typescript_1.default.factory.createNull();
127
- }
128
- else if (typeof value === 'boolean') {
129
- return value ? typescript_1.default.factory.createTrue() : typescript_1.default.factory.createFalse();
130
- }
131
- else if (typeof value === 'number') {
132
- return (0, ts_util_1.tsNumericExpression)(value);
133
- }
134
- else {
135
- return typescript_1.default.factory.createStringLiteral(value);
136
- }
137
- }
138
- createNewExpression(expression, args) {
139
- return typescript_1.default.factory.createNewExpression(expression, undefined, args);
140
- }
141
- createObjectLiteral(properties) {
142
- return typescript_1.default.factory.createObjectLiteralExpression(properties.map((prop) => typescript_1.default.factory.createPropertyAssignment(prop.quoted
143
- ? typescript_1.default.factory.createStringLiteral(prop.propertyName)
144
- : typescript_1.default.factory.createIdentifier(prop.propertyName), prop.value)));
145
- }
146
- createParenthesizedExpression = typescript_1.default.factory.createParenthesizedExpression;
147
- createPropertyAccess = typescript_1.default.factory.createPropertyAccessExpression;
148
- createReturnStatement(expression) {
149
- return typescript_1.default.factory.createReturnStatement(expression ?? undefined);
150
- }
151
- createTaggedTemplate(tag, template) {
152
- let templateLiteral;
153
- const length = template.elements.length;
154
- const head = template.elements[0];
155
- if (length === 1) {
156
- templateLiteral = typescript_1.default.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
157
- }
158
- else {
159
- const spans = [];
160
- // Create the middle parts
161
- for (let i = 1; i < length - 1; i++) {
162
- const { cooked, raw, range } = template.elements[i];
163
- const middle = createTemplateMiddle(cooked, raw);
164
- if (range !== null) {
165
- this.setSourceMapRange(middle, range);
166
- }
167
- spans.push(typescript_1.default.factory.createTemplateSpan(template.expressions[i - 1], middle));
168
- }
169
- // Create the tail part
170
- const resolvedExpression = template.expressions[length - 2];
171
- const templatePart = template.elements[length - 1];
172
- const templateTail = createTemplateTail(templatePart.cooked, templatePart.raw);
173
- if (templatePart.range !== null) {
174
- this.setSourceMapRange(templateTail, templatePart.range);
175
- }
176
- spans.push(typescript_1.default.factory.createTemplateSpan(resolvedExpression, templateTail));
177
- // Put it all together
178
- templateLiteral = typescript_1.default.factory.createTemplateExpression(typescript_1.default.factory.createTemplateHead(head.cooked, head.raw), spans);
179
- }
180
- if (head.range !== null) {
181
- this.setSourceMapRange(templateLiteral, head.range);
182
- }
183
- return typescript_1.default.factory.createTaggedTemplateExpression(tag, undefined, templateLiteral);
184
- }
185
- createThrowStatement = typescript_1.default.factory.createThrowStatement;
186
- createTypeOfExpression = typescript_1.default.factory.createTypeOfExpression;
187
- createUnaryExpression(operator, operand) {
188
- return typescript_1.default.factory.createPrefixUnaryExpression(UNARY_OPERATORS[operator], operand);
189
- }
190
- createVariableDeclaration(variableName, initializer, type) {
191
- return typescript_1.default.factory.createVariableStatement(undefined, typescript_1.default.factory.createVariableDeclarationList([
192
- typescript_1.default.factory.createVariableDeclaration(variableName, undefined, undefined, initializer ?? undefined),
193
- ], VAR_TYPES[type]));
194
- }
195
- setSourceMapRange(node, sourceMapRange) {
196
- if (sourceMapRange === null) {
197
- return node;
198
- }
199
- const url = sourceMapRange.url;
200
- if (!this.externalSourceFiles.has(url)) {
201
- this.externalSourceFiles.set(url, typescript_1.default.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
202
- }
203
- const source = this.externalSourceFiles.get(url);
204
- typescript_1.default.setSourceMapRange(node, {
205
- pos: sourceMapRange.start.offset,
206
- end: sourceMapRange.end.offset,
207
- source,
208
- });
209
- return node;
210
- }
211
- }
212
- exports.TypeScriptAstFactory = TypeScriptAstFactory;
213
- // HACK: Use this in place of `ts.createTemplateMiddle()`.
214
- // Revert once https://github.com/microsoft/TypeScript/issues/35374 is fixed.
215
- function createTemplateMiddle(cooked, raw) {
216
- const node = typescript_1.default.factory.createTemplateHead(cooked, raw);
217
- node.kind = typescript_1.default.SyntaxKind.TemplateMiddle;
218
- return node;
219
- }
220
- exports.createTemplateMiddle = createTemplateMiddle;
221
- // HACK: Use this in place of `ts.createTemplateTail()`.
222
- // Revert once https://github.com/microsoft/TypeScript/issues/35374 is fixed.
223
- function createTemplateTail(cooked, raw) {
224
- const node = typescript_1.default.factory.createTemplateHead(cooked, raw);
225
- node.kind = typescript_1.default.SyntaxKind.TemplateTail;
226
- return node;
227
- }
228
- exports.createTemplateTail = createTemplateTail;
229
- /**
230
- * Attach the given `leadingComments` to the `statement` node.
231
- *
232
- * @param statement The statement that will have comments attached.
233
- * @param leadingComments The comments to attach to the statement.
234
- */
235
- function attachComments(statement, leadingComments) {
236
- for (const comment of leadingComments) {
237
- const commentKind = comment.multiline
238
- ? typescript_1.default.SyntaxKind.MultiLineCommentTrivia
239
- : typescript_1.default.SyntaxKind.SingleLineCommentTrivia;
240
- if (comment.multiline) {
241
- typescript_1.default.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
242
- }
243
- else {
244
- for (const line of comment.toString().split('\n')) {
245
- typescript_1.default.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
246
- }
247
- }
248
- }
249
- }
250
- exports.attachComments = attachComments;
@@ -1,13 +0,0 @@
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
- import * as o from 'static-injector/transform/compiler';
9
- import ts from 'typescript';
10
- import { ImportGenerator } from './api/import_generator';
11
- import { TranslatorOptions } from './translator';
12
- export declare function translateExpression(expression: o.Expression, imports: ImportGenerator<ts.Expression>, options?: TranslatorOptions<ts.Expression>): ts.Expression;
13
- export declare function translateStatement(statement: o.Statement, imports: ImportGenerator<ts.Expression>, options?: TranslatorOptions<ts.Expression>): ts.Statement;
@@ -1,21 +0,0 @@
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
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.translateStatement = exports.translateExpression = void 0;
11
- const context_1 = require("./context");
12
- const translator_1 = require("./translator");
13
- const typescript_ast_factory_1 = require("./typescript_ast_factory");
14
- function translateExpression(expression, imports, options = {}) {
15
- return expression.visitExpression(new translator_1.ExpressionTranslatorVisitor(new typescript_ast_factory_1.TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new context_1.Context(false));
16
- }
17
- exports.translateExpression = translateExpression;
18
- function translateStatement(statement, imports, options = {}) {
19
- return statement.visitStatement(new translator_1.ExpressionTranslatorVisitor(new typescript_ast_factory_1.TypeScriptAstFactory(options.annotateForClosureCompiler === true), imports, options), new context_1.Context(true));
20
- }
21
- exports.translateStatement = translateStatement;
@@ -1,8 +0,0 @@
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/ts_cross_version_utils';