@idlizer/arktscgen 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/build/libarkts-copy/generator/options.json5 +155 -0
  2. package/build/libarkts-copy/native/meson.build +62 -0
  3. package/build/libarkts-copy/native/meson_options.txt +24 -0
  4. package/build/libarkts-copy/native/src/bridges.cc +265 -0
  5. package/build/libarkts-copy/native/src/common.cc +231 -0
  6. package/build/libarkts-copy/native/src/common.h +39 -0
  7. package/build/libarkts-copy/native/src/generated/bridges.cc +11979 -0
  8. package/build/libarkts-copy/package.json +51 -0
  9. package/build/libarkts-copy/src/Es2pandaEnums.ts +183 -0
  10. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +123 -0
  11. package/build/libarkts-copy/src/InteropNativeModule.ts +50 -0
  12. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +31 -0
  13. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +147 -0
  14. package/build/libarkts-copy/src/arkts-api/index.ts +28 -0
  15. package/build/libarkts-copy/src/arkts-api/node-utilities/createCallExpression.ts +40 -0
  16. package/build/libarkts-copy/src/arkts-api/node-utilities/createNumberLiteral.ts +28 -0
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/createScriptFunction.ts +55 -0
  18. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +45 -0
  19. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +121 -0
  20. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +52 -0
  21. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +46 -0
  22. package/build/libarkts-copy/src/arkts-api/peers/Program.ts +55 -0
  23. package/build/libarkts-copy/src/arkts-api/static/global.ts +67 -0
  24. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +69 -0
  25. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +156 -0
  26. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +135 -0
  27. package/build/libarkts-copy/src/arkts-api/visitor.ts +297 -0
  28. package/build/libarkts-copy/src/es2panda.ts +277 -0
  29. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +1266 -0
  30. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +3745 -0
  31. package/build/libarkts-copy/src/generated/factory.ts +1299 -0
  32. package/build/libarkts-copy/src/generated/index.ts +191 -0
  33. package/build/libarkts-copy/src/generated/node-map.ts +182 -0
  34. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +39 -0
  35. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +49 -0
  36. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +40 -0
  37. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +110 -0
  38. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +74 -0
  39. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +98 -0
  40. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +70 -0
  41. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +57 -0
  42. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +95 -0
  43. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +42 -0
  44. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +53 -0
  45. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +53 -0
  46. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +95 -0
  47. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +64 -0
  48. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +63 -0
  49. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +53 -0
  50. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +65 -0
  51. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +97 -0
  52. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +64 -0
  53. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +53 -0
  54. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +50 -0
  55. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +58 -0
  56. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +233 -0
  57. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +80 -0
  58. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +54 -0
  59. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +70 -0
  60. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +58 -0
  61. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +74 -0
  62. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +65 -0
  63. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +50 -0
  64. package/build/libarkts-copy/src/generated/peers/Decorator.ts +54 -0
  65. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +52 -0
  66. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +58 -0
  67. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +54 -0
  68. package/build/libarkts-copy/src/generated/peers/ETSDynamicFunctionType.ts +40 -0
  69. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +84 -0
  70. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +68 -0
  71. package/build/libarkts-copy/src/generated/peers/ETSLaunchExpression.ts +57 -0
  72. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +71 -0
  73. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +62 -0
  74. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +69 -0
  75. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +60 -0
  76. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +50 -0
  77. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +51 -0
  78. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +126 -0
  79. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +54 -0
  80. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +51 -0
  81. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +51 -0
  82. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +73 -0
  83. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +58 -0
  84. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +68 -0
  85. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +50 -0
  86. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +53 -0
  87. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +55 -0
  88. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +50 -0
  89. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +58 -0
  90. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +56 -0
  91. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +73 -0
  92. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +57 -0
  93. package/build/libarkts-copy/src/generated/peers/Expression.ts +75 -0
  94. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +59 -0
  95. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +61 -0
  96. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +64 -0
  97. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +61 -0
  98. package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +40 -0
  99. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +69 -0
  100. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +64 -0
  101. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +62 -0
  102. package/build/libarkts-copy/src/generated/peers/Identifier.ts +154 -0
  103. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +65 -0
  104. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +61 -0
  105. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +54 -0
  106. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +53 -0
  107. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +54 -0
  108. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +49 -0
  109. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +57 -0
  110. package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +40 -0
  111. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +60 -0
  112. package/build/libarkts-copy/src/generated/peers/Literal.ts +40 -0
  113. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +40 -0
  114. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +48 -0
  115. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +95 -0
  116. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +54 -0
  117. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +105 -0
  118. package/build/libarkts-copy/src/generated/peers/NamedType.ts +76 -0
  119. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +56 -0
  120. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +50 -0
  121. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +47 -0
  122. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +90 -0
  123. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +50 -0
  124. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +50 -0
  125. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +57 -0
  126. package/build/libarkts-copy/src/generated/peers/Property.ts +82 -0
  127. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +57 -0
  128. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +62 -0
  129. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +201 -0
  130. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +53 -0
  131. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +79 -0
  132. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +82 -0
  133. package/build/libarkts-copy/src/generated/peers/Statement.ts +39 -0
  134. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +56 -0
  135. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +50 -0
  136. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +62 -0
  137. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +63 -0
  138. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +50 -0
  139. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +53 -0
  140. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +76 -0
  141. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +50 -0
  142. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +50 -0
  143. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +60 -0
  144. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +63 -0
  145. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +65 -0
  146. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +81 -0
  147. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +66 -0
  148. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +53 -0
  149. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +67 -0
  150. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +61 -0
  151. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +64 -0
  152. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +65 -0
  153. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +56 -0
  154. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +54 -0
  155. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +53 -0
  156. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +102 -0
  157. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +54 -0
  158. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +54 -0
  159. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +54 -0
  160. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +64 -0
  161. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +71 -0
  162. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +53 -0
  163. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +63 -0
  164. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +60 -0
  165. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +50 -0
  166. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +58 -0
  167. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +50 -0
  168. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +50 -0
  169. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +50 -0
  170. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +66 -0
  171. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +54 -0
  172. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +72 -0
  173. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +63 -0
  174. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +67 -0
  175. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +50 -0
  176. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +50 -0
  177. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +53 -0
  178. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +88 -0
  179. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +63 -0
  180. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +53 -0
  181. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +63 -0
  182. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +84 -0
  183. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +62 -0
  184. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +54 -0
  185. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +60 -0
  186. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +54 -0
  187. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +62 -0
  188. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +50 -0
  189. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +53 -0
  190. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +50 -0
  191. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +50 -0
  192. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +61 -0
  193. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +59 -0
  194. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +60 -0
  195. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +50 -0
  196. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +54 -0
  197. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +75 -0
  198. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +49 -0
  199. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +39 -0
  200. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +40 -0
  201. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +53 -0
  202. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +57 -0
  203. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +50 -0
  204. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +60 -0
  205. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +42 -0
  206. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +71 -0
  207. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +69 -0
  208. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +58 -0
  209. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +56 -0
  210. package/build/libarkts-copy/src/reexport-for-generated.ts +33 -0
  211. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +1375 -0
  212. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +110 -0
  213. package/build/libarkts-copy/src/ts-api/index.ts +35 -0
  214. package/build/libarkts-copy/src/ts-api/static/enums.ts +18 -0
  215. package/build/libarkts-copy/src/ts-api/types.ts +920 -0
  216. package/build/libarkts-copy/src/ts-api/utilities/private.ts +289 -0
  217. package/build/libarkts-copy/src/ts-api/utilities/public.ts +55 -0
  218. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +155 -0
  219. package/build/libarkts-copy/src/utils.ts +89 -0
  220. package/build/libarkts-copy/tsconfig.json +15 -0
  221. package/lib/index.js +11858 -0
  222. package/package.json +54 -0
  223. package/templates/Es2pandaEnums.ts +16 -0
  224. package/templates/Es2pandaNativeModule.ts +32 -0
  225. package/templates/bridges.cc +18 -0
  226. package/templates/factory.ts +34 -0
  227. package/templates/index.ts +16 -0
  228. package/templates/node-map.ts +31 -0
  229. package/templates/peer.ts +32 -0
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import { global } from "../static/global"
17
+ import { isNumber, throwError } from "../../utils"
18
+ import { nullptr, withStringResult } from "@koalaui/interop"
19
+ import { passNode, passNodeArray, unpackNodeArray, unpackNonNullableNode } from "./private"
20
+ import { Es2pandaContextState, Es2pandaModifierFlags } from "../../generated/Es2pandaEnums"
21
+ import type { AstNode } from "../peers/AstNode"
22
+ import {
23
+ type AnnotationUsage,
24
+ ClassDefinition,
25
+ ETSModule,
26
+ isClassDefinition,
27
+ isMemberExpression,
28
+ isScriptFunction,
29
+ isFunctionDeclaration
30
+ } from "../../generated"
31
+ import { Config } from "../peers/Config"
32
+ import { Context } from "../peers/Context"
33
+
34
+ export function createETSModulefromContext(): ETSModule {
35
+ return new ETSModule(global.es2panda._ProgramAst(global.context, global.es2panda._ContextProgram(global.context)))
36
+ }
37
+
38
+ export function createETSModuleFromSource(
39
+ source: string,
40
+ state: Es2pandaContextState = Es2pandaContextState.ES2PANDA_STATE_PARSED,
41
+ ): ETSModule {
42
+ if (!global.configIsInitialized()) {
43
+ global.config = Config.createDefault().peer
44
+ }
45
+ global.compilerContext = Context.createFromString(source)
46
+ proceedToState(state)
47
+ return new ETSModule(global.es2panda._ProgramAst(global.context, global.es2panda._ContextProgram(global.context)))
48
+ }
49
+
50
+ export function updateETSModuleByStatements(
51
+ node: ETSModule,
52
+ statements: readonly AstNode[],
53
+ ): ETSModule {
54
+ global.generatedEs2panda._BlockStatementSetStatements(global.context, node.peer, passNodeArray(statements), statements.length)
55
+ return node
56
+ }
57
+
58
+ export function proceedToState(state: Es2pandaContextState): void {
59
+ if (state <= global.es2panda._ContextState(global.context)) {
60
+ return
61
+ }
62
+ global.es2panda._ProceedToState(global.context, state)
63
+ if (global.es2panda._ContextState(global.context) === Es2pandaContextState.ES2PANDA_STATE_ERROR) {
64
+ console.log()
65
+ global.es2panda._DestroyConfig(global.config)
66
+ console.log()
67
+ process.exit(1)
68
+ }
69
+ }
70
+
71
+ export function startChecker(): boolean {
72
+ return global.es2panda._CheckerStartChecker(global.context)
73
+ }
74
+
75
+ export function recheckSubtree(node: AstNode): void {
76
+ global.es2panda._AstNodeRecheck(global.context, node.peer)
77
+ }
78
+
79
+ export function rebindSubtree(node: AstNode): void {
80
+ global.es2panda._AstNodeRebind(global.context, node.peer)
81
+ }
82
+
83
+ export function getDecl(node: AstNode): AstNode | undefined {
84
+ if (isMemberExpression(node)) {
85
+ return getDecl(node.property)
86
+ }
87
+ const decl = global.es2panda._DeclarationFromIdentifier(global.context, passNode(node))
88
+ if (decl === nullptr) {
89
+ return undefined
90
+ }
91
+ return unpackNonNullableNode(decl)
92
+ }
93
+
94
+ export function getAnnotations(node: AstNode): readonly AnnotationUsage[] {
95
+ if (!isFunctionDeclaration(node) && !isScriptFunction(node) && !isClassDefinition(node)) {
96
+ throwError('for now annotations allowed only for: functionDeclaration, scriptFunction, classDefinition')
97
+ }
98
+ return unpackNodeArray(global.es2panda._AnnotationAllowedAnnotations(global.context, node.peer, nullptr))
99
+ }
100
+
101
+ export function getOriginalNode(node: AstNode): AstNode {
102
+ if (node === undefined) {
103
+ // TODO: fix this
104
+ throwError('there is no arkts pair of ts node (unable to getOriginalNode)')
105
+ }
106
+ if (node.originalPeer === nullptr) {
107
+ return node
108
+ }
109
+ return unpackNonNullableNode(node.originalPeer)
110
+ }
111
+
112
+ export function getFileName(): string {
113
+ return global.filePath
114
+ }
115
+
116
+ export function getFilePathFromPackageRoot(): string {
117
+ return global.filePathFromPackageRoot
118
+ }
119
+
120
+ // TODO: It seems like Definition overrides AstNode modifiers
121
+ // with it's own modifiers which is completely unrelated set of flags.
122
+ // Use this function if you need
123
+ // the language level modifiers: public, declare, export, etc.
124
+ export function classDefinitionFlags(node: ClassDefinition): Es2pandaModifierFlags {
125
+ return global.generatedEs2panda._AstNodeModifiers(global.context, node.peer)
126
+ }
127
+
128
+ export function modifiersToString(modifiers: Es2pandaModifierFlags): string {
129
+ return Object.values(Es2pandaModifierFlags)
130
+ .filter(isNumber)
131
+ .map(it => {
132
+ console.log(it.valueOf(), Es2pandaModifierFlags[it], modifiers.valueOf() & it)
133
+ return ((modifiers.valueOf() & it) === it) ? Es2pandaModifierFlags[it] : ""
134
+ }).join(" ")
135
+ }
@@ -0,0 +1,297 @@
1
+ /*
2
+ * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import { factory } from "./factory/nodeFactory"
17
+ import { Es2pandaVariableDeclaratorFlag } from "../generated/Es2pandaEnums"
18
+ import { AstNode } from "./peers/AstNode"
19
+ import {
20
+ isArrowFunctionExpression,
21
+ isBlockStatement,
22
+ isCallExpression,
23
+ isClassDeclaration,
24
+ isClassDefinition,
25
+ isConditionalExpression,
26
+ isETSImportDeclaration,
27
+ isETSStructDeclaration,
28
+ isExpressionStatement,
29
+ isFunctionDeclaration,
30
+ isIfStatement,
31
+ isMemberExpression,
32
+ isReturnStatement,
33
+ isScriptFunction,
34
+ isTSAsExpression,
35
+ isTSInterfaceBody,
36
+ isTSInterfaceDeclaration,
37
+ isVariableDeclaration,
38
+ isVariableDeclarator,
39
+ isETSModule,
40
+ isMethodDefinition,
41
+ } from "../generated"
42
+ import { classDefinitionFlags, updateETSModuleByStatements } from "./utilities/public"
43
+
44
+ type Visitor = (node: AstNode) => AstNode
45
+
46
+ export interface DoubleNode {
47
+ originNode: AstNode;
48
+ translatedNode: AstNode;
49
+ }
50
+
51
+ export class StructInfo {
52
+ stateVariables: Set<DoubleNode> = new Set();
53
+ }
54
+
55
+ export class GlobalInfo {
56
+ private _structCollection: Set<string>;
57
+ private static instance: GlobalInfo;
58
+ private _structMap: Map<string, StructInfo>;
59
+
60
+ private constructor() {
61
+ this._structCollection = new Set();
62
+ this._structMap = new Map();
63
+ }
64
+
65
+ public static getInfoInstance(): GlobalInfo {
66
+ if (!this.instance) {
67
+ this.instance = new GlobalInfo();
68
+ }
69
+ return this.instance;
70
+ }
71
+
72
+ public add(str: string): void {
73
+ this._structCollection.add(str);
74
+ }
75
+
76
+ public getStructCollection(): Set<string> {
77
+ return this._structCollection;
78
+ }
79
+
80
+ public getStructInfo(structName: string): StructInfo {
81
+ const structInfo = this._structMap.get(structName);
82
+ if (!structInfo) {
83
+ return new StructInfo();
84
+ }
85
+ return structInfo;
86
+ }
87
+
88
+ public setStructInfo(structName: string, info: StructInfo): void {
89
+ this._structMap.set(structName, info);
90
+ }
91
+ }
92
+
93
+ // TODO: rethink (remove as)
94
+ function nodeVisitor<T extends AstNode | undefined>(node: T, visitor: Visitor): T {
95
+ if (node === undefined) {
96
+ return node
97
+ }
98
+ return visitor(node) as T
99
+ }
100
+
101
+ // TODO: rethink (remove as)
102
+ function nodesVisitor<T extends AstNode, TIn extends readonly T[] | undefined>(nodes: TIn, visitor: Visitor): T[] | TIn {
103
+ if (nodes === undefined) {
104
+ return nodes
105
+ }
106
+ return nodes.map(node => visitor(node) as T)
107
+ }
108
+
109
+ export function visitEachChild(
110
+ node: AstNode,
111
+ visitor: Visitor
112
+ ): AstNode {
113
+ if (isETSModule(node)) {
114
+ return updateETSModuleByStatements(
115
+ node,
116
+ nodesVisitor(node.statements, visitor)
117
+ )
118
+ }
119
+ if (isCallExpression(node)) {
120
+ return factory.updateCallExpression(
121
+ node,
122
+ nodeVisitor(node.callee, visitor),
123
+ nodesVisitor(node.arguments, visitor),
124
+ nodeVisitor(node.typeParams, visitor),
125
+ node.isOptional,
126
+ node.hasTrailingComma,
127
+ nodeVisitor(node.trailingBlock, visitor)
128
+ )
129
+ }
130
+ if (isFunctionDeclaration(node)) {
131
+ return factory.updateFunctionDeclaration(
132
+ node,
133
+ nodeVisitor(node.function, visitor),
134
+ node.annotations,
135
+ node.isAnonymous,
136
+ )
137
+ }
138
+ if (isBlockStatement(node)) {
139
+ return factory.updateBlockStatement(
140
+ node,
141
+ nodesVisitor(node.statements, visitor),
142
+ )
143
+ }
144
+ if (isExpressionStatement(node)) {
145
+ return factory.updateExpressionStatement(
146
+ node,
147
+ nodeVisitor(node.expression, visitor)
148
+ )
149
+ }
150
+ if (isETSStructDeclaration(node)) {
151
+ return factory.updateETSStructDeclaration(
152
+ node,
153
+ nodeVisitor(node.definition, visitor)
154
+ )
155
+ }
156
+ if (isClassDeclaration(node)) {
157
+ return factory.updateClassDeclaration(
158
+ node,
159
+ nodeVisitor(node.definition, visitor)
160
+ )
161
+ }
162
+ if (isClassDefinition(node)) {
163
+ // TODO: fix
164
+ return factory.updateClassDefinition(
165
+ node,
166
+ node.ident,
167
+ node.typeParams,
168
+ node.superTypeParams,
169
+ node.implements,
170
+ undefined,
171
+ node.super,
172
+ nodesVisitor(node.body, visitor),
173
+ node.modifiers,
174
+ classDefinitionFlags(node)
175
+ )
176
+ }
177
+ if (isMethodDefinition(node)) {
178
+ return factory.updateMethodDefinition(
179
+ node,
180
+ node.kind,
181
+ node.id,
182
+ factory.createFunctionExpression(
183
+ node.id,
184
+ nodeVisitor(node.function, visitor)
185
+ ),
186
+ node.modifiers,
187
+ node.isComputed
188
+ )
189
+ }
190
+ if (isScriptFunction(node)) {
191
+ return factory.updateScriptFunction(
192
+ node,
193
+ nodeVisitor(node.body, visitor),
194
+ node.typeParams,
195
+ node.params,
196
+ node.returnTypeAnnotation,
197
+ node.hasReceiver,
198
+ node.flags,
199
+ node.modifiers,
200
+ node.id,
201
+ node.annotations,
202
+ )
203
+ }
204
+ if (isETSImportDeclaration(node)) {
205
+ return factory.updateETSImportDeclaration(
206
+ node,
207
+ factory.createImportSource(
208
+ node.source,
209
+ node.resolvedSource,
210
+ node.hasDecl
211
+ ),
212
+ nodesVisitor(node.specifiers, visitor),
213
+ +node.isTypeKind,
214
+ )
215
+ }
216
+ if (isMemberExpression(node)) {
217
+ return factory.updateMemberExpression(
218
+ node,
219
+ nodeVisitor(node.object, visitor),
220
+ nodeVisitor(node.property, visitor),
221
+ node.kind,
222
+ node.isComputed,
223
+ node.isOptional
224
+ )
225
+ }
226
+ if (isTSInterfaceDeclaration(node)) {
227
+ return factory.updateInterfaceDeclaration(
228
+ node,
229
+ nodesVisitor(node.extends, visitor),
230
+ nodeVisitor(node.id, visitor),
231
+ nodeVisitor(node.typeParams, visitor),
232
+ nodeVisitor(node.body, visitor),
233
+ node.isStatic,
234
+ // TODO: how do I get it?
235
+ true
236
+ )
237
+ }
238
+ if (isTSInterfaceBody(node)) {
239
+ return factory.updateTSInterfaceBody(
240
+ node,
241
+ nodesVisitor(node.body, visitor)
242
+ )
243
+ }
244
+ if (isIfStatement(node)) {
245
+ return factory.updateIfStatement(
246
+ node,
247
+ nodeVisitor(node.test, visitor),
248
+ nodeVisitor(node.consequent, visitor),
249
+ nodeVisitor(node.alternate, visitor),
250
+ )
251
+ }
252
+ if (isConditionalExpression(node)) {
253
+ return factory.updateConditionalExpression(
254
+ node,
255
+ nodeVisitor(node.test, visitor),
256
+ nodeVisitor(node.consequent, visitor),
257
+ nodeVisitor(node.alternate, visitor),
258
+ )
259
+ }
260
+ if (isVariableDeclaration(node)) {
261
+ return factory.updateVariableDeclaration(
262
+ node,
263
+ node.kind,
264
+ nodesVisitor(node.declarators, visitor),
265
+ )
266
+ }
267
+ if (isVariableDeclarator(node)) {
268
+ return factory.updateVariableDeclarator(
269
+ node,
270
+ Es2pandaVariableDeclaratorFlag.VARIABLE_DECLARATOR_FLAG_UNKNOWN,
271
+ nodeVisitor(node.id, visitor),
272
+ nodeVisitor(node.init, visitor),
273
+ )
274
+ }
275
+ if (isArrowFunctionExpression(node)) {
276
+ return factory.updateArrowFunctionExpression(
277
+ node,
278
+ nodeVisitor(node.function, visitor),
279
+ )
280
+ }
281
+ if (isReturnStatement(node)) {
282
+ return factory.updateReturnStatement(
283
+ node,
284
+ nodeVisitor(node.argument, visitor)
285
+ )
286
+ }
287
+ if (isTSAsExpression(node)) {
288
+ return factory.updateTSAsExpression(
289
+ node,
290
+ nodeVisitor(node.expr, visitor),
291
+ nodeVisitor(node.typeAnnotation, visitor),
292
+ node.isConst
293
+ )
294
+ }
295
+ // TODO
296
+ return node
297
+ }
@@ -0,0 +1,277 @@
1
+ /*
2
+ * Copyright (c) 2022-2025 Huawei Device Co., Ltd.
3
+ * Licensed under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License.
5
+ * You may obtain a copy of the License at
6
+ *
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software
10
+ * distributed under the License is distributed on an "AS IS" BASIS,
11
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ * See the License for the specific language governing permissions and
13
+ * limitations under the License.
14
+ */
15
+
16
+ import * as fs from "node:fs"
17
+ import * as path from "node:path"
18
+ import { global } from "./arkts-api/static/global"
19
+ import { Command } from "commander"
20
+ import { isNumber, throwError, withWarning, filterSource } from "./utils"
21
+ import { Es2pandaContextState } from "./generated/Es2pandaEnums"
22
+ import { AstNode, Config, Context, createETSModulefromContext, ETSModule, proceedToState } from "./arkts-api"
23
+
24
+ function parseCommandLineArgs() {
25
+ const commander = new Command()
26
+ .option('--file, <char>', 'Path to file to be compiled')
27
+ .option('--arktsconfig, <char>', 'Path to arkts configuration file')
28
+ .option('--ets-module', 'Do nothing, legacy compatibility')
29
+ .option('--output, <char>', 'The name of result file')
30
+ .option('--dump-plugin-ast', 'Dump ast before and after each plugin')
31
+ .option('--restart-stages', 'Restart the compiler to proceed to next stage')
32
+ .option('--generate-decl', 'Generate declaration files')
33
+ .option('--decl-arktsconfig, <char>', 'Path to arkts configutation file for the binary compilation')
34
+ .parse(process.argv)
35
+ .opts()
36
+
37
+ const restOptions = commander.args
38
+
39
+ const filePath = path.resolve(commander.file)
40
+ const configPath = path.resolve(commander.arktsconfig)
41
+ const outputPath = path.resolve(commander.output)
42
+ if (!fs.existsSync(filePath)) {
43
+ throw new Error(`File path doesn't exist: ${filePath}`)
44
+ }
45
+ if (!fs.existsSync(configPath)) {
46
+ throw new Error(`Arktsconfig path doesn't exist: ${configPath}`)
47
+ }
48
+
49
+ const dumpAst = commander.dumpPluginAst ?? false
50
+ const restartStages = commander.restartStages ?? false
51
+ const generateDecl = commander.generateDecl ?? false
52
+ const dConfigPath = path.resolve(commander.declArktsconfig ?? commander.arktsconfig)
53
+
54
+ return { filePath, configPath, outputPath, dumpAst, restartStages, generateDecl, dConfigPath }
55
+ }
56
+
57
+ function insertPlugin(plugin: (ast: AstNode) => void, state: Es2pandaContextState, dumpAst: boolean): AstNode {
58
+ proceedToState(state)
59
+ const script = createETSModulefromContext()
60
+ if (script === undefined) {
61
+ throwError(`Failed to receive ast from es2panda`)
62
+ }
63
+
64
+ if (dumpAst) {
65
+ console.log(`BEFORE ${stateName(state)}:`)
66
+ console.log(filterSource(script.dumpSrc()))
67
+ }
68
+
69
+ const transform = plugin
70
+ transform?.(script)
71
+
72
+ if (dumpAst) {
73
+ console.log(`AFTER ${stateName(state)}:`)
74
+ console.log(filterSource(script.dumpSrc()))
75
+ }
76
+
77
+ setAllParents(script)
78
+ return script
79
+ }
80
+
81
+ function restartCompiler() {
82
+ console.log("restarting")
83
+ const ast = createETSModulefromContext()
84
+ const srcText = filterSource(ast.dumpSrc())
85
+ global.es2panda._DestroyContext(global.context)
86
+ global.compilerContext = Context.createFromString(srcText)
87
+ }
88
+
89
+ function restartCompilerWithConfig(configPath: string, filePath: string, stdlib: string, outputPath: string) {
90
+ console.log("restarting with another config")
91
+ const srcText = filterSource(createETSModulefromContext().dumpSrc())
92
+ global.es2panda._DestroyContext(global.context)
93
+ global.es2panda._DestroyConfig(global.config)
94
+ global.config = Config.create([
95
+ '_',
96
+ '--arktsconfig',
97
+ configPath,
98
+ filePath,
99
+ '--extension',
100
+ 'ets',
101
+ '--stdlib',
102
+ stdlib,
103
+ '--output',
104
+ outputPath
105
+ ]).peer
106
+ global.compilerContext = Context.createFromString(srcText)
107
+ }
108
+
109
+ const defaultPandaSdk = "../../../incremental/tools/panda/node_modules/@panda/sdk"
110
+ function invokeWithPlugins(
111
+ configPath: string,
112
+ baseUrl: string,
113
+ filePath: string,
114
+ outputPath: string,
115
+ pluginsByState: Map<Es2pandaContextState, ((ast: AstNode) => void)[]>,
116
+ dumpAst: boolean,
117
+ restart: boolean,
118
+ generateDecl: boolean,
119
+ dConfigPath: string,
120
+ ): void {
121
+ const source = fs.readFileSync(filePath).toString()
122
+ const sdk = process.env.PANDA_SDK_PATH ?? withWarning(
123
+ defaultPandaSdk,
124
+ `PANDA_SDK_PATH not set, assuming ${defaultPandaSdk}`
125
+ )
126
+ const stdlib = `${sdk}/ets/stdlib`
127
+
128
+ global.filePath = filePath
129
+ global.filePathFromPackageRoot = path.relative(path.join(path.dirname(configPath), baseUrl), filePath)
130
+ global.config = Config.create([
131
+ '_',
132
+ '--arktsconfig',
133
+ configPath,
134
+ filePath,
135
+ '--extension',
136
+ 'ets',
137
+ '--stdlib',
138
+ stdlib,
139
+ '--output',
140
+ outputPath
141
+ ]).peer
142
+ fs.mkdirSync(path.dirname(outputPath), {recursive: true})
143
+ global.compilerContext = Context.createFromString(source)
144
+
145
+ console.log("PLUGINS: ", pluginsByState.size, pluginsByState)
146
+
147
+ if (pluginsByState.size == 0) {
148
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_BIN_GENERATED)
149
+ return
150
+ }
151
+
152
+ pluginsByState.get(Es2pandaContextState.ES2PANDA_STATE_PARSED)?.forEach(plugin => {
153
+ insertPlugin(plugin, Es2pandaContextState.ES2PANDA_STATE_PARSED, dumpAst)
154
+ if (restart) {
155
+ restartCompiler()
156
+ }
157
+ })
158
+
159
+ pluginsByState.get(Es2pandaContextState.ES2PANDA_STATE_CHECKED)?.forEach(plugin => {
160
+ insertPlugin(plugin, Es2pandaContextState.ES2PANDA_STATE_CHECKED, dumpAst)
161
+ // TODO: Normally we need just to proceed to a given state,
162
+ // but the compiler crashes now, so we restart
163
+ if (restart) {
164
+ restartCompiler()
165
+ }
166
+ })
167
+
168
+ if (configPath !== dConfigPath) {
169
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_PARSED)
170
+ restartCompilerWithConfig(dConfigPath, filePath, stdlib, outputPath)
171
+ }
172
+
173
+ if (generateDecl) {
174
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_PARSED)
175
+ generateDeclFromCurrentContext(filePath)
176
+ }
177
+
178
+ proceedToState(Es2pandaContextState.ES2PANDA_STATE_BIN_GENERATED)
179
+ }
180
+
181
+ function generateDeclFromCurrentContext(filePath: string) {
182
+ const ext = path.extname(filePath)
183
+ const dirs = path.dirname(filePath).split(path.sep)
184
+ const last = dirs.lastIndexOf("ets")
185
+ if (last == -1) {
186
+ throw `Do not apply --generate-decl for files not matching "**/ets/**" file path: ${filePath}`
187
+ }
188
+
189
+ let declFile = ""
190
+ if (last !== -1) { // temporary workaround (ets dir -> dets dir)
191
+ const declDir = path.join('/', ...dirs.map((it, index) => index == last ? "dets" : it))
192
+ fs.mkdirSync(declDir, { recursive: true })
193
+ declFile = path.join(declDir, path.basename(filePath))
194
+ } else { // extension change (.ets -> .d.ets)
195
+ declFile = path.join(path.dirname(filePath), `${path.basename(filePath, ext)}.d${ext}`)
196
+ }
197
+ console.log(`Emiting declaration file to`, declFile)
198
+
199
+ const exports = [...fs.readFileSync(filePath).toString().matchAll(/export .* from .*(\n|$)/g)]
200
+
201
+ let out = [
202
+ filterSource(global.compilerContext.program.astNode.dumpSrc()),
203
+ ...exports.map((it) => it[0])
204
+ ].join('\n')
205
+
206
+ // TODO: exports are lost on visiting
207
+ const exportAstNodes = ["class", "abstract class", "interface", "@interface", "type", "enum", "final class"]
208
+ exportAstNodes.forEach((astNodeText) => {
209
+ out = out.replaceAll(`\n${astNodeText}`, `\nexport ${astNodeText}`)
210
+ }
211
+ )
212
+
213
+ // TODO: global functions are not exported
214
+ fs.writeFileSync(declFile,
215
+ out
216
+ .replaceAll("\nexport abstract class ETSGLOBAL", "\nabstract class ETSGLOBAL")
217
+ )
218
+ }
219
+
220
+ function setAllParents(ast: AstNode) {
221
+ global.es2panda._AstNodeUpdateAll(global.context, ast.peer)
222
+ }
223
+
224
+ function loadPlugin(configDir: string, jsonPlugin: any) {
225
+ const pluginPath = jsonPlugin.transform ?? throwError(`arktsconfig plugins objects should specify transform`)
226
+ /** TODO: read and pass plugin options */
227
+ const plugin = (pluginPath.startsWith(".") || pluginPath.startsWith("/")) ?
228
+ path.resolve(configDir, pluginPath) : pluginPath
229
+
230
+ const pluginFunction: (config?: any) => any = require(plugin).default(jsonPlugin)
231
+ return pluginFunction
232
+ }
233
+
234
+ function selectPlugins(configDir: string, plugins: any[], stage: string): ((arg: AstNode) => AstNode)[] | undefined {
235
+ const selected = plugins
236
+ .filter(it => (it.stage == stage))
237
+ .map(it => loadPlugin(configDir, it))
238
+ if (selected.length == 0) {
239
+ return undefined
240
+ }
241
+ return selected
242
+ }
243
+
244
+ function stateName(value: Es2pandaContextState): string {
245
+ return Es2pandaContextState[value].substring("ES2PANDA_STATE_".length)
246
+ }
247
+
248
+ function readAndSortPlugins(configDir: string, plugins: any[]) {
249
+ const pluginsByState = new Map<Es2pandaContextState, ((ast: AstNode) => void)[]>()
250
+
251
+ Object.values(Es2pandaContextState)
252
+ .filter(isNumber)
253
+ .forEach(it => {
254
+ const selected = selectPlugins(configDir, plugins, stateName(it).toLowerCase())
255
+ if (selected) pluginsByState.set(
256
+ it,
257
+ selected
258
+ )
259
+ })
260
+
261
+ return pluginsByState
262
+ }
263
+
264
+ export function main() {
265
+ const { filePath, configPath, outputPath, dumpAst, restartStages, generateDecl, dConfigPath } = parseCommandLineArgs()
266
+ const arktsconfig = JSON.parse(fs.readFileSync(configPath).toString())
267
+ const configDir = path.dirname(configPath)
268
+ const compilerOptions = arktsconfig.compilerOptions ?? throwError(`arktsconfig should specify compilerOptions`)
269
+ const baseUrl = compilerOptions.baseUrl
270
+ const plugins = compilerOptions.plugins ?? []
271
+
272
+ const pluginsByState = readAndSortPlugins(configDir, plugins)
273
+
274
+ invokeWithPlugins(configPath, baseUrl, filePath, outputPath, pluginsByState, dumpAst, restartStages, generateDecl, dConfigPath)
275
+ }
276
+
277
+ main()