@idlizer/arktscgen 2.1.10-arktscgen-3a → 2.1.10-arktscgen-5

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 (284) hide show
  1. package/build/libarkts-copy/native/meson.build +1 -1
  2. package/build/libarkts-copy/native/src/bridges.cc +72 -115
  3. package/build/libarkts-copy/native/src/common.cc +225 -84
  4. package/build/libarkts-copy/native/src/common.h +22 -22
  5. package/build/libarkts-copy/native/src/memoryTracker.cc +30 -37
  6. package/build/libarkts-copy/native/src/memoryTracker.h +5 -5
  7. package/build/libarkts-copy/package.json +23 -19
  8. package/build/libarkts-copy/src/Es2pandaNativeModule.ts +176 -100
  9. package/build/libarkts-copy/src/InteropNativeModule.ts +18 -15
  10. package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +17 -18
  11. package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +31 -30
  12. package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +20 -17
  13. package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +12 -12
  14. package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +44 -29
  15. package/build/libarkts-copy/src/arkts-api/index.ts +24 -24
  16. package/build/libarkts-copy/src/arkts-api/node-cache.ts +12 -12
  17. package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +8 -8
  18. package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +9 -21
  19. package/build/libarkts-copy/src/arkts-api/node-utilities/AssignmentExpression.ts +12 -14
  20. package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +5 -5
  21. package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +47 -13
  22. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +62 -32
  23. package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +14 -13
  24. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +24 -21
  25. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +10 -12
  26. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSModule.ts +14 -18
  27. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +15 -16
  28. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +5 -8
  29. package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +6 -12
  30. package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +12 -11
  31. package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +14 -33
  32. package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +12 -23
  33. package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +17 -21
  34. package/build/libarkts-copy/src/arkts-api/node-utilities/OpaqueTypeNode.ts +9 -8
  35. package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +21 -16
  36. package/build/libarkts-copy/src/arkts-api/node-utilities/ScriptFunction.ts +80 -35
  37. package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +22 -32
  38. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +12 -14
  39. package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +10 -12
  40. package/build/libarkts-copy/src/arkts-api/node-utilities/TryStatement.ts +10 -9
  41. package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +10 -12
  42. package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +8 -8
  43. package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +53 -49
  44. package/build/libarkts-copy/src/arkts-api/peers/Config.ts +17 -24
  45. package/build/libarkts-copy/src/arkts-api/peers/Context.ts +29 -37
  46. package/build/libarkts-copy/src/arkts-api/peers/DiagnosticKind.ts +5 -6
  47. package/build/libarkts-copy/src/arkts-api/peers/ExternalSource.ts +9 -9
  48. package/build/libarkts-copy/src/arkts-api/peers/ImportPathManager.ts +6 -8
  49. package/build/libarkts-copy/src/arkts-api/peers/Options.ts +8 -8
  50. package/build/libarkts-copy/src/arkts-api/plugins.ts +98 -30
  51. package/build/libarkts-copy/src/arkts-api/static/global.ts +35 -36
  52. package/build/libarkts-copy/src/arkts-api/static/globalUtils.ts +5 -5
  53. package/build/libarkts-copy/src/arkts-api/static/profiler.ts +107 -91
  54. package/build/libarkts-copy/src/arkts-api/utilities/extensions.ts +54 -37
  55. package/build/libarkts-copy/src/arkts-api/utilities/nativePtrDecoder.ts +86 -69
  56. package/build/libarkts-copy/src/arkts-api/utilities/performance.ts +39 -23
  57. package/build/libarkts-copy/src/arkts-api/utilities/private.ts +73 -61
  58. package/build/libarkts-copy/src/arkts-api/utilities/public.ts +220 -173
  59. package/build/libarkts-copy/src/arkts-api/visitor.ts +606 -742
  60. package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +8 -8
  61. package/build/libarkts-copy/src/checkSdk.ts +15 -18
  62. package/build/libarkts-copy/src/index.ts +29 -29
  63. package/build/libarkts-copy/src/plugin-utils.ts +52 -40
  64. package/build/libarkts-copy/src/reexport-for-generated.ts +11 -10
  65. package/build/libarkts-copy/src/tracer.ts +75 -69
  66. package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +134 -274
  67. package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +23 -23
  68. package/build/libarkts-copy/src/ts-api/index.ts +27 -35
  69. package/build/libarkts-copy/src/ts-api/static/enums.ts +3 -3
  70. package/build/libarkts-copy/src/ts-api/types.ts +535 -395
  71. package/build/libarkts-copy/src/ts-api/utilities/private.ts +115 -112
  72. package/build/libarkts-copy/src/ts-api/utilities/public.ts +18 -18
  73. package/build/libarkts-copy/src/ts-api/visitor/visitor.ts +33 -49
  74. package/build/libarkts-copy/src/utils.ts +97 -70
  75. package/build/libarkts-copy/tsconfig.json +3 -2
  76. package/lib/index.js +428 -159
  77. package/package.json +51 -53
  78. package/templates/Es2pandaNativeModule.ts +1 -0
  79. package/templates/factory.ts +1 -1
  80. package/templates/peer.ts +2 -1
  81. package/build/libarkts-copy/native/src/generated/bridges.cc +0 -16382
  82. package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +0 -1350
  83. package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +0 -5195
  84. package/build/libarkts-copy/src/generated/factory.ts +0 -1286
  85. package/build/libarkts-copy/src/generated/index.ts +0 -222
  86. package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +0 -44
  87. package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +0 -54
  88. package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +0 -45
  89. package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +0 -165
  90. package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +0 -84
  91. package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +0 -73
  92. package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +0 -109
  93. package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +0 -119
  94. package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +0 -65
  95. package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +0 -111
  96. package/build/libarkts-copy/src/generated/peers/AstDumper.ts +0 -49
  97. package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +0 -40
  98. package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +0 -40
  99. package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +0 -61
  100. package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +0 -61
  101. package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +0 -110
  102. package/build/libarkts-copy/src/generated/peers/BindingProps.ts +0 -40
  103. package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +0 -72
  104. package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +0 -94
  105. package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +0 -61
  106. package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +0 -78
  107. package/build/libarkts-copy/src/generated/peers/CallExpression.ts +0 -129
  108. package/build/libarkts-copy/src/generated/peers/CatchClause.ts +0 -74
  109. package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +0 -68
  110. package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +0 -58
  111. package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +0 -76
  112. package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +0 -365
  113. package/build/libarkts-copy/src/generated/peers/ClassElement.ts +0 -76
  114. package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +0 -62
  115. package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +0 -137
  116. package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +0 -66
  117. package/build/libarkts-copy/src/generated/peers/CodeGen.ts +0 -40
  118. package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +0 -82
  119. package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +0 -78
  120. package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +0 -58
  121. package/build/libarkts-copy/src/generated/peers/Declaration.ts +0 -40
  122. package/build/libarkts-copy/src/generated/peers/Decorator.ts +0 -62
  123. package/build/libarkts-copy/src/generated/peers/DiagnosticInfo.ts +0 -40
  124. package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +0 -60
  125. package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +0 -66
  126. package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +0 -40
  127. package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +0 -62
  128. package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +0 -102
  129. package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +0 -90
  130. package/build/libarkts-copy/src/generated/peers/ETSIntrinsicNode.ts +0 -75
  131. package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +0 -61
  132. package/build/libarkts-copy/src/generated/peers/ETSModule.ts +0 -129
  133. package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +0 -75
  134. package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +0 -79
  135. package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +0 -75
  136. package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +0 -58
  137. package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +0 -59
  138. package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +0 -189
  139. package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +0 -62
  140. package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +0 -55
  141. package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +0 -58
  142. package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +0 -59
  143. package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +0 -89
  144. package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +0 -66
  145. package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +0 -78
  146. package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +0 -58
  147. package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +0 -75
  148. package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +0 -63
  149. package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +0 -66
  150. package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +0 -40
  151. package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +0 -66
  152. package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +0 -64
  153. package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +0 -94
  154. package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +0 -82
  155. package/build/libarkts-copy/src/generated/peers/Expression.ts +0 -84
  156. package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +0 -67
  157. package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +0 -69
  158. package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +0 -72
  159. package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +0 -67
  160. package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +0 -106
  161. package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +0 -74
  162. package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +0 -70
  163. package/build/libarkts-copy/src/generated/peers/IRNode.ts +0 -40
  164. package/build/libarkts-copy/src/generated/peers/Identifier.ts +0 -162
  165. package/build/libarkts-copy/src/generated/peers/IfStatement.ts +0 -78
  166. package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +0 -87
  167. package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +0 -62
  168. package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +0 -61
  169. package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +0 -62
  170. package/build/libarkts-copy/src/generated/peers/ImportSource.ts +0 -40
  171. package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +0 -73
  172. package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +0 -40
  173. package/build/libarkts-copy/src/generated/peers/LabelPair.ts +0 -40
  174. package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +0 -68
  175. package/build/libarkts-copy/src/generated/peers/Literal.ts +0 -53
  176. package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +0 -45
  177. package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +0 -53
  178. package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +0 -115
  179. package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +0 -62
  180. package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +0 -152
  181. package/build/libarkts-copy/src/generated/peers/NamedType.ts +0 -84
  182. package/build/libarkts-copy/src/generated/peers/NewExpression.ts +0 -64
  183. package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +0 -58
  184. package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +0 -78
  185. package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +0 -40
  186. package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +0 -94
  187. package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +0 -58
  188. package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +0 -58
  189. package/build/libarkts-copy/src/generated/peers/OverloadDeclaration.ts +0 -101
  190. package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +0 -65
  191. package/build/libarkts-copy/src/generated/peers/Program.ts +0 -206
  192. package/build/libarkts-copy/src/generated/peers/Property.ts +0 -92
  193. package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +0 -65
  194. package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +0 -75
  195. package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +0 -40
  196. package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +0 -310
  197. package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +0 -40
  198. package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +0 -61
  199. package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +0 -40
  200. package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +0 -48
  201. package/build/libarkts-copy/src/generated/peers/SourceRange.ts +0 -40
  202. package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +0 -83
  203. package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +0 -120
  204. package/build/libarkts-copy/src/generated/peers/Statement.ts +0 -44
  205. package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +0 -66
  206. package/build/libarkts-copy/src/generated/peers/SuggestionInfo.ts +0 -40
  207. package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +0 -58
  208. package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +0 -70
  209. package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +0 -71
  210. package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +0 -58
  211. package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +0 -61
  212. package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +0 -84
  213. package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +0 -58
  214. package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +0 -58
  215. package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +0 -70
  216. package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +0 -71
  217. package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +0 -73
  218. package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +0 -112
  219. package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +0 -76
  220. package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +0 -61
  221. package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +0 -75
  222. package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +0 -69
  223. package/build/libarkts-copy/src/generated/peers/TSImportType.ts +0 -72
  224. package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +0 -73
  225. package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +0 -64
  226. package/build/libarkts-copy/src/generated/peers/TSInferType.ts +0 -62
  227. package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +0 -61
  228. package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +0 -160
  229. package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +0 -62
  230. package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +0 -62
  231. package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +0 -62
  232. package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +0 -72
  233. package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +0 -79
  234. package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +0 -61
  235. package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +0 -71
  236. package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +0 -68
  237. package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +0 -58
  238. package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +0 -66
  239. package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +0 -58
  240. package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +0 -58
  241. package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +0 -58
  242. package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +0 -74
  243. package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +0 -62
  244. package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +0 -80
  245. package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +0 -71
  246. package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +0 -75
  247. package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +0 -58
  248. package/build/libarkts-copy/src/generated/peers/TSThisType.ts +0 -58
  249. package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +0 -61
  250. package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +0 -151
  251. package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +0 -71
  252. package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +0 -61
  253. package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +0 -71
  254. package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +0 -121
  255. package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +0 -75
  256. package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +0 -62
  257. package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +0 -68
  258. package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +0 -62
  259. package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +0 -70
  260. package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +0 -58
  261. package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +0 -61
  262. package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +0 -58
  263. package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +0 -58
  264. package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +0 -69
  265. package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +0 -69
  266. package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +0 -68
  267. package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +0 -58
  268. package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +0 -62
  269. package/build/libarkts-copy/src/generated/peers/TryStatement.ts +0 -89
  270. package/build/libarkts-copy/src/generated/peers/TypeNode.ts +0 -81
  271. package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +0 -44
  272. package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +0 -45
  273. package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +0 -61
  274. package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +0 -70
  275. package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +0 -58
  276. package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +0 -68
  277. package/build/libarkts-copy/src/generated/peers/VReg.ts +0 -40
  278. package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +0 -50
  279. package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +0 -113
  280. package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +0 -79
  281. package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +0 -40
  282. package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +0 -40
  283. package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +0 -71
  284. package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +0 -64
package/lib/index.js CHANGED
@@ -22,7 +22,6 @@
22
22
  var path$1 = require('node:path');
23
23
  var path = require('path');
24
24
  var fs = require('fs');
25
- var ts = require('typescript');
26
25
  require('console');
27
26
  require('node:os');
28
27
  var fs$1 = require('node:fs');
@@ -50,7 +49,6 @@ function _interopNamespaceDefault(e) {
50
49
  var path__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(path$1);
51
50
  var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
52
51
  var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
53
- var ts__namespace = /*#__PURE__*/_interopNamespaceDefault(ts);
54
52
  var fs__namespace$1 = /*#__PURE__*/_interopNamespaceDefault(fs$1);
55
53
  var ps__namespace = /*#__PURE__*/_interopNamespaceDefault(ps);
56
54
 
@@ -3657,7 +3655,6 @@ class Language {
3657
3655
  static fromString(name) {
3658
3656
  switch (name) {
3659
3657
  case "arkts": return Language.ARKTS;
3660
- case "java": return Language.JAVA;
3661
3658
  case "ts": return Language.TS;
3662
3659
  case "cangjie": return Language.CJ;
3663
3660
  case "cpp": return Language.CPP;
@@ -3668,7 +3665,6 @@ class Language {
3668
3665
  }
3669
3666
  Language.TS = new Language("TS", ".ts");
3670
3667
  Language.ARKTS = new Language("ArkTS", ".ts"); // using .ts for ArkTS until we get rit of tsc preprocessing
3671
- Language.JAVA = new Language("Java", ".java");
3672
3668
  Language.CPP = new Language("C++", ".cc");
3673
3669
  Language.CJ = new Language("CangJie", ".cj");
3674
3670
  Language.KOTLIN = new Language("Kotlin", ".kt");
@@ -3847,11 +3843,13 @@ var IDLExtendedAttributes;
3847
3843
  IDLExtendedAttributes["TypeAnnotations"] = "TypeAnnotations";
3848
3844
  IDLExtendedAttributes["TypeArguments"] = "TypeArguments";
3849
3845
  IDLExtendedAttributes["TypeParameters"] = "TypeParameters";
3846
+ IDLExtendedAttributes["TypeParametersDefaults"] = "TypeParametersDefaults";
3850
3847
  IDLExtendedAttributes["VerbatimDts"] = "VerbatimDts";
3851
3848
  IDLExtendedAttributes["HandWrittenImplementation"] = "HandWrittenImplementation";
3852
3849
  IDLExtendedAttributes["ExtraMethod"] = "ExtraMethod";
3853
3850
  IDLExtendedAttributes["OverloadAlias"] = "OverloadAlias";
3854
3851
  IDLExtendedAttributes["OverloadPriority"] = "OverloadPriority";
3852
+ IDLExtendedAttributes["TransformOnSerialize"] = "TransformOnSerialize";
3855
3853
  })(IDLExtendedAttributes || (IDLExtendedAttributes = {}));
3856
3854
  var IDLAccessorAttribute;
3857
3855
  (function (IDLAccessorAttribute) {
@@ -4138,6 +4136,10 @@ function isEntry(node) {
4138
4136
  function isNamespace(node) {
4139
4137
  return node.kind === IDLKind.Namespace;
4140
4138
  }
4139
+ function isSyntheticEntry(node) {
4140
+ var _a;
4141
+ return isDefined((_a = node.extendedAttributes) === null || _a === void 0 ? void 0 : _a.find(it => it.name === IDLExtendedAttributes.Synthetic));
4142
+ }
4141
4143
  function isOptionalType(type) {
4142
4144
  return type.kind === IDLKind.OptionalType;
4143
4145
  }
@@ -4190,6 +4192,7 @@ const IDLSerializerBuffer = createPrimitiveType('SerializerBuffer');
4190
4192
  const IDLFunctionType = createPrimitiveType('Function');
4191
4193
  const IDLCustomObjectType = createPrimitiveType('CustomObject');
4192
4194
  createPrimitiveType('InteropReturnBuffer');
4195
+ const IDLNullTypeName = "idlize.stdlib.Null";
4193
4196
  function createNamespace(name, members, nodeInitializer) {
4194
4197
  return Object.assign(Object.assign({ kind: IDLKind.Namespace, members: members !== null && members !== void 0 ? members : [], name: name }, nodeInitializer), { _idlNodeBrand: innerIdlSymbol, _idlEntryBrand: innerIdlSymbol, _idlNamedNodeBrand: innerIdlSymbol });
4195
4198
  }
@@ -4226,6 +4229,7 @@ function getNamespacesPathFor(node) {
4226
4229
  }
4227
4230
  return result;
4228
4231
  }
4232
+ const nodesWithoutIDLFiles = new Set();
4229
4233
  function getFileFor(node) {
4230
4234
  let iterator = node;
4231
4235
  while (iterator) {
@@ -4233,7 +4237,11 @@ function getFileFor(node) {
4233
4237
  return iterator;
4234
4238
  iterator = iterator.parent;
4235
4239
  }
4236
- console.warn(`Node ${getQualifiedName(node, "namespace.name")} does not have IDLFile in parents`);
4240
+ const name = getQualifiedName(node, "namespace.name");
4241
+ if (!nodesWithoutIDLFiles.has(name)) {
4242
+ console.warn(`Node ${name} does not have IDLFile in parents`);
4243
+ nodesWithoutIDLFiles.add(name);
4244
+ }
4237
4245
  return undefined;
4238
4246
  }
4239
4247
  function getPackageClause(node) {
@@ -4561,23 +4569,29 @@ function escapeIDLKeyword(name) {
4561
4569
  const printedIndentInc = "[[indent-inc]]";
4562
4570
  const printedIndentDec = "[[indent-dec]]";
4563
4571
  function printType(type, options) {
4572
+ var _a;
4564
4573
  if (!type)
4565
4574
  throw new Error("Missing type");
4566
4575
  if (isInterface$1(type))
4567
4576
  return type.name;
4568
- if (isOptionalType(type))
4569
- return `(${printType(type.type)} or ${IDLUndefinedType.name})`;
4577
+ if (isOptionalType(type)) {
4578
+ if (hasExtAttribute(type, IDLExtendedAttributes.UnionOnlyNull))
4579
+ return `(${printType(type.type)} or ${IDLNullTypeName})`;
4580
+ else if (hasExtAttribute(type, IDLExtendedAttributes.UnionWithNull))
4581
+ return `(${printType(type.type)} or ${IDLUndefinedType.name} or${IDLNullTypeName})`;
4582
+ else
4583
+ return `(${printType(type.type)} or ${IDLUndefinedType.name})`;
4584
+ }
4570
4585
  if (isPrimitiveType(type))
4571
4586
  return type.name;
4572
4587
  if (isContainerType(type))
4573
4588
  return `${type.containerKind}<${type.elementType.map(it => printType(it)).join(", ")}>`;
4574
4589
  if (isReferenceType(type)) {
4575
- const extAttrs = type.extendedAttributes ? Array.from(type.extendedAttributes) : [];
4576
4590
  if (type.typeArguments)
4577
- extAttrs.push({ name: IDLExtendedAttributes.TypeArguments, value: type.typeArguments.map(it => printType(it)).join(",") });
4578
- if (!extAttrs.length)
4591
+ updateExtAttribute(type, IDLExtendedAttributes.TypeArguments, type.typeArguments.map(it => printType(it)).join(","));
4592
+ if (!((_a = type.extendedAttributes) === null || _a === void 0 ? void 0 : _a.length))
4579
4593
  return type.name;
4580
- let res = `[${quoteAttributeValues(extAttrs)}] ${type.name}`;
4594
+ let res = `[${quoteAttributeValues(type.extendedAttributes)}] ${type.name}`;
4581
4595
  if (options === null || options === void 0 ? void 0 : options.bracketsAroundReferenceTypeWithExtAttrs)
4582
4596
  return `(${res})`;
4583
4597
  return res;
@@ -4647,18 +4661,31 @@ function printExtendedAttributes(idl, indentLevel) {
4647
4661
  break;
4648
4662
  }
4649
4663
  const attributes = Array.from(idl.extendedAttributes || []);
4650
- if (typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.length)
4664
+ if ((typeParameters === null || typeParameters === void 0 ? void 0 : typeParameters.length) && !attributes.find(x => x.name === IDLExtendedAttributes.TypeParameters))
4651
4665
  attributes.push({ name: IDLExtendedAttributes.TypeParameters, value: typeParameters.join(",") });
4652
- if (typeArguments === null || typeArguments === void 0 ? void 0 : typeArguments.length)
4666
+ if ((typeArguments === null || typeArguments === void 0 ? void 0 : typeArguments.length) && !attributes.find(x => x.name === IDLExtendedAttributes.TypeArguments))
4653
4667
  attributes.push({ name: IDLExtendedAttributes.TypeArguments, value: typeArguments.map(it => printType(it)).join(",") });
4654
4668
  if (idl.documentation) {
4655
4669
  let docs = {
4656
4670
  name: IDLExtendedAttributes.Documentation,
4657
4671
  value: idl.documentation
4658
4672
  };
4659
- attributes.push(docs);
4673
+ attributes.unshift(docs);
4674
+ }
4675
+ // Deduplicate
4676
+ const names = new Set();
4677
+ const actualAttributes = [];
4678
+ for (const attr of attributes) {
4679
+ if (names.has(attr.name)) {
4680
+ continue;
4681
+ }
4682
+ names.add(attr.name);
4683
+ actualAttributes.push(attr);
4660
4684
  }
4661
- const attrSpec = quoteAttributeValues(attributes);
4685
+ if (actualAttributes.length == 0) {
4686
+ return [];
4687
+ }
4688
+ const attrSpec = quoteAttributeValues(actualAttributes);
4662
4689
  return attrSpec ? [`[${attrSpec}]`] : [];
4663
4690
  }
4664
4691
  const attributesToQuote = new Set([
@@ -4670,6 +4697,7 @@ const attributesToQuote = new Set([
4670
4697
  IDLExtendedAttributes.TraceKey,
4671
4698
  IDLExtendedAttributes.TypeArguments,
4672
4699
  IDLExtendedAttributes.TypeParameters,
4700
+ IDLExtendedAttributes.TypeParametersDefaults,
4673
4701
  ]);
4674
4702
  function quoteAttributeValues(attributes) {
4675
4703
  return attributes === null || attributes === void 0 ? void 0 : attributes.map(it => {
@@ -4858,6 +4886,17 @@ function getExtAttribute(node, name) {
4858
4886
  var _a, _b;
4859
4887
  return (_b = (_a = node.extendedAttributes) === null || _a === void 0 ? void 0 : _a.find(it => it.name === name)) === null || _b === void 0 ? void 0 : _b.value;
4860
4888
  }
4889
+ function removeExtAttribute(node, name) {
4890
+ if (node.extendedAttributes) {
4891
+ node.extendedAttributes = node.extendedAttributes.filter(it => it.name !== name);
4892
+ }
4893
+ }
4894
+ function updateExtAttribute(node, name, value) {
4895
+ var _a;
4896
+ removeExtAttribute(node, name);
4897
+ (_a = node.extendedAttributes) !== null && _a !== void 0 ? _a : (node.extendedAttributes = []);
4898
+ node.extendedAttributes.push({ name, value });
4899
+ }
4861
4900
  const IDLContainerUtils = {
4862
4901
  isRecord: (x) => isContainerType(x) && x.containerKind === 'record',
4863
4902
  isSequence: (x) => isContainerType(x) && x.containerKind === 'sequence',
@@ -4906,6 +4945,13 @@ function linearizeNamespaceMembers(entries) {
4906
4945
  return linearized;
4907
4946
  }
4908
4947
 
4948
+ const stdlibModule = {
4949
+ name: "__stdlib",
4950
+ packages: [""],
4951
+ useFoldersLayout: false,
4952
+ external: true,
4953
+ tsLikePackage: "__stdlib"
4954
+ };
4909
4955
  const modulesCache = new Map();
4910
4956
  /**
4911
4957
  * Is source submodule of target.
@@ -4945,7 +4991,7 @@ function getApplicableModuleFor(packageName) {
4945
4991
  if (applicableModules.length === 0) {
4946
4992
  if (packageName === '') {
4947
4993
  console.error("WARNING: use current module for empty package");
4948
- return currentModule();
4994
+ return stdlibModule;
4949
4995
  }
4950
4996
  if (packageName.startsWith(`idlize.`)) {
4951
4997
  return currentModule();
@@ -5270,8 +5316,11 @@ class LambdaExpression {
5270
5316
  if (this.body) {
5271
5317
  writer.writeStatement(new BlockStatement(this.body, isScoped, false));
5272
5318
  }
5273
- writer.features.forEach(([feature, module]) => {
5274
- this.originalWriter.addFeature(feature, module);
5319
+ writer.features.forEach((feature) => {
5320
+ if (feature.type === "raw")
5321
+ this.originalWriter.addFeature(feature.feature, feature.module);
5322
+ else
5323
+ this.originalWriter.addFeature(feature.node);
5275
5324
  });
5276
5325
  return writer.getOutput()
5277
5326
  .map(line => (line.endsWith('{') || line.endsWith('}') || line.endsWith(';')) ? line : `${line};`)
@@ -5296,6 +5345,8 @@ var FieldModifier;
5296
5345
  FieldModifier[FieldModifier["VOLATILE"] = 6] = "VOLATILE";
5297
5346
  FieldModifier[FieldModifier["INTERNAL"] = 7] = "INTERNAL";
5298
5347
  FieldModifier[FieldModifier["OVERRIDE"] = 8] = "OVERRIDE";
5348
+ FieldModifier[FieldModifier["GET"] = 9] = "GET";
5349
+ FieldModifier[FieldModifier["SET"] = 10] = "SET";
5299
5350
  })(FieldModifier || (FieldModifier = {}));
5300
5351
  var MethodModifier;
5301
5352
  (function (MethodModifier) {
@@ -5406,8 +5457,11 @@ class LanguageWriter {
5406
5457
  return this.printer.indentDepth();
5407
5458
  }
5408
5459
  maybeSemicolon() { return ";"; }
5409
- addFeature(feature, module) {
5410
- this.features.push([feature, module]);
5460
+ addFeature(featureOrNode, module) {
5461
+ if (typeof featureOrNode === "string")
5462
+ this.features.push({ type: "raw", feature: featureOrNode, module: module });
5463
+ else
5464
+ this.features.push({ type: "idl", node: featureOrNode });
5411
5465
  }
5412
5466
  // version of makeCast which uses TypeCheck.typeCast<T>(value) call for ETS language writer
5413
5467
  // Use it only if TypeChecker class is added as import to the generated file
@@ -5893,6 +5947,70 @@ function convertDeclaration(convertor, decl) {
5893
5947
  throw new Error(`Unknown declaration type ${decl.kind ? IDLKind[decl.kind] : "(undefined kind)"}`);
5894
5948
  }
5895
5949
 
5950
+ const findTopLevelConflicts_cache = new Map();
5951
+ function findTopLevelConflicts(library, language) {
5952
+ if (!findTopLevelConflicts_cache.has(library))
5953
+ findTopLevelConflicts_cache.set(library, new Map);
5954
+ const libraryCache = findTopLevelConflicts_cache.get(library);
5955
+ if (!libraryCache.has(language))
5956
+ libraryCache.set(language, findTopLevelConflictsUncached(library, language));
5957
+ return libraryCache.get(language);
5958
+ }
5959
+ function findTopLevelConflictsUncached(library, language) {
5960
+ const foundNames = new Set();
5961
+ const conflictingNames = new Set();
5962
+ const ignoreTypedefs = language === Language.CPP;
5963
+ for (const file of library.files) {
5964
+ for (const entry of file.entries) {
5965
+ if (isSyntheticEntry(entry))
5966
+ continue;
5967
+ if (ignoreTypedefs && isTypedef$1(entry))
5968
+ // for redefinitions like `typedef _Resource Resource;` - in CPP than anyway will be expanded to Resource declaration
5969
+ continue;
5970
+ if (isCallback$1(entry) || isInterface$1(entry) || isTypedef$1(entry) || isEnum$1(entry)) {
5971
+ if (foundNames.has(entry.name)) {
5972
+ conflictingNames.add(entry.name);
5973
+ }
5974
+ else {
5975
+ foundNames.add(entry.name);
5976
+ }
5977
+ }
5978
+ }
5979
+ }
5980
+ return Array.from(conflictingNames);
5981
+ }
5982
+ function isTopLevelConflicted(library, language, node) {
5983
+ const topLevelConflicts = findTopLevelConflicts(library, language);
5984
+ while (node.parent && isNamespace(node.parent)) {
5985
+ node = node.parent;
5986
+ }
5987
+ return node.parent !== undefined
5988
+ && isFile(node.parent) && isEntry(node) && topLevelConflicts.includes(node.name);
5989
+ }
5990
+
5991
+ /*
5992
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
5993
+ * Licensed under the Apache License, Version 2.0 (the "License");
5994
+ * you may not use this file except in compliance with the License.
5995
+ * You may obtain a copy of the License at
5996
+ *
5997
+ * http://www.apache.org/licenses/LICENSE-2.0
5998
+ *
5999
+ * Unless required by applicable law or agreed to in writing, software
6000
+ * distributed under the License is distributed on an "AS IS" BASIS,
6001
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6002
+ * See the License for the specific language governing permissions and
6003
+ * limitations under the License.
6004
+ */
6005
+ var LayoutNodeRole;
6006
+ (function (LayoutNodeRole) {
6007
+ LayoutNodeRole[LayoutNodeRole["PEER"] = 0] = "PEER";
6008
+ LayoutNodeRole[LayoutNodeRole["INTERFACE"] = 1] = "INTERFACE";
6009
+ LayoutNodeRole[LayoutNodeRole["GLOBAL"] = 2] = "GLOBAL";
6010
+ LayoutNodeRole[LayoutNodeRole["COMPONENT"] = 3] = "COMPONENT";
6011
+ LayoutNodeRole[LayoutNodeRole["SERIALIZER"] = 4] = "SERIALIZER";
6012
+ })(LayoutNodeRole || (LayoutNodeRole = {}));
6013
+
5896
6014
  /*
5897
6015
  * Copyright (c) 2024 Huawei Device Co., Ltd.
5898
6016
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -6158,12 +6276,14 @@ const IncorrectLiteral = new DiagnosticMessageGroup("error", "IncorrectLiteral",
6158
6276
  const IncorrectIdentifier = new DiagnosticMessageGroup("error", "IncorrectIdentifier", "Incorrect identifier");
6159
6277
  const UnexpectedToken = new DiagnosticMessageGroup("error", "UnexpectedToken", "Unexpected token");
6160
6278
  const UnexpectedEndOfFile = new DiagnosticMessageGroup("fatal", "UnexpectedEndOfFile", "Unexpected end of file");
6279
+ const UnrecognizedSymbols = new DiagnosticMessageGroup("fatal", "UnrecognizedSymbols", "Unrecognized symbols");
6161
6280
  const UnsupportedSyntax = new DiagnosticMessageGroup("error", "UnsupportedSyntax", "Unsupported syntax");
6162
6281
  const WrongDeclarationPlacement = new DiagnosticMessageGroup("error", "WrongDeclarationPlacement", "Wrong declaration placement");
6163
6282
  const ExpectedPrimitiveType = new DiagnosticMessageGroup("error", "ExpectedPrimitiveType", "Expected primitive type");
6164
6283
  const ExpectedReferenceType = new DiagnosticMessageGroup("error", "ExpectedReferenceType", "Expected reference type");
6165
6284
  const ExpectedGenericArguments = new DiagnosticMessageGroup("error", "ExpectedGenericArguments", "Expected generic arguments");
6166
6285
  const UnexpectedGenericArguments = new DiagnosticMessageGroup("error", "UnexpectedGenericArguments", "Unexpected generic arguments");
6286
+ const InlineParsingDepthExceeded = new DiagnosticMessageGroup("fatal", "InlineParsingDepthExceeded", "Inline parsing depth exceeded");
6167
6287
  class FatalParserException extends Error {
6168
6288
  constructor(diagnosticMessages) {
6169
6289
  super();
@@ -6195,7 +6315,7 @@ class Parser {
6195
6315
  // TypeParameters support
6196
6316
  this._generics = [];
6197
6317
  // TypeArguments parsing support
6198
- this._enableInLiteralParsing = false;
6318
+ this._inLiteralParsingLevel = 0;
6199
6319
  // symTokens = ["(", ")", "[", "]", "{", "}", ",", "...", ":", ";", "<", "=", ">", "?"]
6200
6320
  this._reDecimal = /-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y;
6201
6321
  this._reInteger = /-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y;
@@ -6283,17 +6403,17 @@ class Parser {
6283
6403
  this._curToken = { kind: TokenKind.End, value: "", location: { documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } } };
6284
6404
  return;
6285
6405
  }
6286
- if (this._enableInLiteralParsing && this.content[this._curOffset] == "\"") {
6406
+ if (this._inLiteralParsingLevel && (this.content[this._curOffset] == "\"" || this.content[this._curOffset] == "'")) {
6287
6407
  // TypeArguments parsing support
6288
6408
  const pos = { line: this._curLine + 1, character: this._curOffset - this.offsets[this._curLine] + 1 };
6289
- this._curToken = { kind: TokenKind.Symbol, value: "\"", location: { documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } } };
6409
+ this._curToken = { kind: TokenKind.Symbol, value: this.content[this._curOffset], location: { documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } } };
6290
6410
  this._curOffset += 1;
6291
6411
  return;
6292
6412
  }
6293
6413
  const token = ((_d = (_c = (_b = (_a = this._match(this._reDecimal, TokenKind.Literal)) !== null && _a !== void 0 ? _a : this._match(this._reInteger, TokenKind.Literal)) !== null && _b !== void 0 ? _b : this._match(this._reString, TokenKind.Literal)) !== null && _c !== void 0 ? _c : this._match(this._reWords, TokenKind.Words)) !== null && _d !== void 0 ? _d : this._match(this._reSymbol, TokenKind.Symbol));
6294
6414
  if (!token) {
6295
6415
  const pos = { line: this._curLine + 1, character: this._curOffset - this.offsets[this._curLine] + 1 };
6296
- ParsingFatal.throwDiagnosticMessage([{ documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } }], "Unrecognized symbols");
6416
+ UnrecognizedSymbols.throwDiagnosticMessage([{ documentPath: this.fileName, lines: this.lines, range: { start: pos, end: pos } }]);
6297
6417
  }
6298
6418
  // Uncomment in case of parser debugging
6299
6419
  // if (token) {
@@ -6587,28 +6707,32 @@ class Parser {
6587
6707
  duplicates.add(name.value);
6588
6708
  }
6589
6709
  names.add(name.value);
6590
- if (name.value == IDLExtendedAttributes.TypeArguments) {
6710
+ if (name.value == IDLExtendedAttributes.TypeArguments || name.value == IDLExtendedAttributes.TypeParametersDefaults) {
6591
6711
  // TypeArguments parsing support
6592
6712
  try {
6593
- this._enableInLiteralParsing = true;
6713
+ this._inLiteralParsingLevel += 1;
6714
+ if (this._inLiteralParsingLevel > 2) {
6715
+ InlineParsingDepthExceeded.throwDiagnosticMessage([this.curLocation]);
6716
+ }
6594
6717
  this.skip("=");
6595
6718
  const vloc = this.trackLocation();
6596
6719
  const start = this._curOffset; // Already after first quote
6597
- this.skip("\"");
6720
+ this.skip(this._inLiteralParsingLevel == 2 ? "'" : "\"");
6598
6721
  const types = this.parseTypeList();
6599
6722
  const end = this._curOffset - 1; // Already after second quote
6600
- this._enableInLiteralParsing = false;
6601
- this.skip("\"");
6723
+ this._inLiteralParsingLevel -= 1;
6724
+ // Note that second this._inLiteralParsingLevel comparison happens after decrement
6725
+ this.skip(this._inLiteralParsingLevel == 1 ? "'" : "\"");
6602
6726
  const stringValue = this.content.slice(start, end);
6603
6727
  ext.push({ name: name.value, value: stringValue, typesValue: types, nameLocation: name.location, valueLocation: vloc() });
6604
6728
  }
6605
6729
  catch (e) {
6606
- this.skipToAfter("\"");
6730
+ if (e instanceof DiagnosticException && e.diagnosticMessage.severity != "fatal") {
6731
+ this.skipToAfter("\"");
6732
+ }
6733
+ this._inLiteralParsingLevel = 0;
6607
6734
  throw e;
6608
6735
  }
6609
- finally {
6610
- this._enableInLiteralParsing = false;
6611
- }
6612
6736
  }
6613
6737
  else {
6614
6738
  let value;
@@ -6780,9 +6904,9 @@ class Parser {
6780
6904
  const name = this.parseSingleIdentifier();
6781
6905
  this.skip("=");
6782
6906
  const value = this.parseLiteral();
6783
- const extracted = extractLiteral(value);
6784
6907
  this.skip(";");
6785
- return createConstant(name.value, type, extracted.extractedString, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value.location });
6908
+ // Note that raw value (with quoted strings) is used here, that provides compatibility with older code (while being different from `dictionary` processing)
6909
+ return createConstant(name.value, type, value.value, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value.location });
6786
6910
  }
6787
6911
  parseAttribute() {
6788
6912
  const sloc = this.trackLocation();
@@ -6866,11 +6990,14 @@ class Parser {
6866
6990
  const sloc = this.trackLocation();
6867
6991
  const type = this.parsePrimitiveType();
6868
6992
  const name = this.parseSingleIdentifier();
6869
- this.skip("=");
6870
- const value = this.parseLiteral();
6871
- const extracted = extractLiteral(value);
6993
+ let value;
6994
+ let extracted;
6995
+ if (this.seeAndSkip("=")) {
6996
+ value = this.parseLiteral();
6997
+ extracted = extractLiteral(value);
6998
+ }
6872
6999
  this.skip(";");
6873
- return createEnumMember(name.value, undefined, type, extracted.extractedValue, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value.location });
7000
+ return createEnumMember(name.value, undefined, type, extracted === null || extracted === void 0 ? void 0 : extracted.extractedValue, { extendedAttributes: ext, nodeLocation: sloc(), nameLocation: name.location, valueLocation: value === null || value === void 0 ? void 0 : value.location });
6874
7001
  }
6875
7002
  parsePackage() {
6876
7003
  const sloc = this.trackLocation();
@@ -7036,6 +7163,93 @@ const builtinTypesList = [IDLPointerType, IDLVoidType, IDLBooleanType,
7036
7163
  const builtinTypes = new Map(builtinTypesList.map(x => [x.name, x]));
7037
7164
  const builtinGenericTypeNames = new Set(["sequence", "record", "Promise"]);
7038
7165
 
7166
+ /*
7167
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
7168
+ * Licensed under the Apache License, Version 2.0 (the "License");
7169
+ * you may not use this file except in compliance with the License.
7170
+ * You may obtain a copy of the License at
7171
+ *
7172
+ * http://www.apache.org/licenses/LICENSE-2.0
7173
+ *
7174
+ * Unless required by applicable law or agreed to in writing, software
7175
+ * distributed under the License is distributed on an "AS IS" BASIS,
7176
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7177
+ * See the License for the specific language governing permissions and
7178
+ * limitations under the License.
7179
+ */
7180
+ function lineDigitCount(message) {
7181
+ let count = 0;
7182
+ for (let part of message.parts) {
7183
+ let range = part.location.range;
7184
+ if (range == null) {
7185
+ continue;
7186
+ }
7187
+ count = Math.max(count, range.start.line.toString().length, range.end.line.toString().length);
7188
+ }
7189
+ return count;
7190
+ }
7191
+ function paddedLineNo(digits, line) {
7192
+ let s = line.toString();
7193
+ if (s.length < digits) {
7194
+ return " ".repeat(digits - s.length) + s;
7195
+ }
7196
+ return s;
7197
+ }
7198
+ function formatLine(digits, lines, lineNo) {
7199
+ return `${paddedLineNo(digits, lineNo)} | ${lines[lineNo - 1]}`;
7200
+ }
7201
+ function formatUnderline(indent, lines, lineNo, range, edgeChar, midChar, message) {
7202
+ if (lineNo == range.start.line && lineNo == range.end.line) {
7203
+ let len = range.end.character - range.start.character + 1;
7204
+ return `${indent} | ${" ".repeat(range.start.character - 1)}${edgeChar}${len > 2 ? midChar.repeat(len - 2) : ""}${len > 1 ? edgeChar : ""} ${message}`;
7205
+ }
7206
+ if (lineNo == range.start.line) {
7207
+ let len = lines[lineNo - 1].length - range.start.character;
7208
+ return `${indent} | ${" ".repeat(range.start.character - 1)}${edgeChar}${len > 1 ? midChar.repeat(len - 1) : ""}`;
7209
+ }
7210
+ if (lineNo == range.end.line) {
7211
+ let len = range.end.character;
7212
+ return `${indent} | ${len > 1 ? midChar.repeat(len - 1) : ""}${edgeChar} ${message}`;
7213
+ }
7214
+ return `${indent} | ${midChar.repeat(lines[lineNo - 1].length)}`;
7215
+ }
7216
+ function outputDiagnosticMessageFormatted(message) {
7217
+ if (message.parts.length == 0) {
7218
+ return;
7219
+ }
7220
+ console.log(`${message.severity}[${message.code}]: ${message.codeDescription}`);
7221
+ let digits = lineDigitCount(message);
7222
+ let indent = " ".repeat(digits);
7223
+ let first = true;
7224
+ let lastPath = "";
7225
+ for (let part of message.parts) {
7226
+ const location = part.location;
7227
+ if (location.range != null && location.lines != null) {
7228
+ let range = location.range;
7229
+ let lines = location.lines;
7230
+ console.log(`${indent}${lastPath != part.location.documentPath ? "-->" : ":::"} ${part.location.documentPath}:${range.start.line}:${range.start.character}`);
7231
+ console.log(`${indent} |`);
7232
+ const last = Math.min(range.end.line + 1, lines.length - 1);
7233
+ for (let i = Math.max(range.start.line - 1, 1); i <= last; ++i) {
7234
+ console.log(formatLine(digits, lines, i));
7235
+ if (i >= range.start.line && i <= range.end.line) {
7236
+ console.log(formatUnderline(indent, lines, i, range, "^", first ? "-" : "~", part.message));
7237
+ }
7238
+ }
7239
+ }
7240
+ else {
7241
+ console.log(`${indent}--> ${part.location.documentPath}`);
7242
+ if (message.parts.length > 1) {
7243
+ console.log(`${indent} # ${part.message}`);
7244
+ }
7245
+ }
7246
+ first = false;
7247
+ lastPath = part.location.documentPath;
7248
+ }
7249
+ console.log(`${indent} = ${message.parts[0].message}`);
7250
+ console.log();
7251
+ }
7252
+
7039
7253
  /*
7040
7254
  * Copyright (c) 2024 Huawei Device Co., Ltd.
7041
7255
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -7053,6 +7267,10 @@ const builtinGenericTypeNames = new Set(["sequence", "record", "Promise"]);
7053
7267
  function getTokens(node) {
7054
7268
  return node.tokens;
7055
7269
  }
7270
+ const extendedAttributesWithTypesValue = [
7271
+ IDLExtendedAttributes.TypeArguments,
7272
+ IDLExtendedAttributes.TypeParametersDefaults,
7273
+ ];
7056
7274
  const syntheticTypes = new Map();
7057
7275
  function addSyntheticType(name, type) {
7058
7276
  if (syntheticTypes.has(name)) {
@@ -7064,9 +7282,8 @@ class IDLDeserializer {
7064
7282
  enterGenericScope(generics) {
7065
7283
  this.genericsScopes.push(new Set(generics !== null && generics !== void 0 ? generics : []));
7066
7284
  }
7067
- constructor(info, inheritanceMode = 'multiple') {
7285
+ constructor(info) {
7068
7286
  this.info = info;
7069
- this.inheritanceMode = inheritanceMode;
7070
7287
  this.namespacePathNames = [];
7071
7288
  this.currentPackage = [];
7072
7289
  this.genericsScopes = [];
@@ -7163,7 +7380,7 @@ class IDLDeserializer {
7163
7380
  node.inheritance.forEach(it => {
7164
7381
  const attributes = it.extAttrs;
7165
7382
  const parentTypeArgs = this.extractTypeArguments(file, attributes !== null && attributes !== void 0 ? attributes : [], IDLExtendedAttributes.TypeArguments);
7166
- const attrs = this.toExtendedAttributes(attributes !== null && attributes !== void 0 ? attributes : []); // ?.filter(it => it.name !== idl.IDLExtendedAttributes.TypeArguments)
7383
+ const attrs = this.toExtendedAttributes(file, attributes !== null && attributes !== void 0 ? attributes : []); // ?.filter(it => it.name !== idl.IDLExtendedAttributes.TypeArguments)
7167
7384
  const ref = createReferenceType(it.inheritance, parentTypeArgs, {
7168
7385
  extendedAttributes: attrs
7169
7386
  });
@@ -7183,7 +7400,7 @@ class IDLDeserializer {
7183
7400
  .map(it => this.toIDLCallable(file, it)), generics, {
7184
7401
  fileName: file,
7185
7402
  documentation: this.makeDocs(node),
7186
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7403
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7187
7404
  });
7188
7405
  this.genericsScopes.pop();
7189
7406
  this.info.set(result, getTokens(node));
@@ -7199,6 +7416,8 @@ class IDLDeserializer {
7199
7416
  // is it IDLStringType?
7200
7417
  const refType = createReferenceType(type);
7201
7418
  refType.fileName = file;
7419
+ // Here is a bug: type.extAttrs are ignored, so typeArguments on ([TypeArguments="T"] Something) are always lost
7420
+ // That must be fixed together with fixing non-generic placeholders on generic types in pipelines (like WrappedBuilder)
7202
7421
  refType.typeArguments = this.extractTypeArguments(file, extAttrs, IDLExtendedAttributes.TypeArguments);
7203
7422
  return refType;
7204
7423
  }
@@ -7256,7 +7475,7 @@ class IDLDeserializer {
7256
7475
  idlRefType = ref;
7257
7476
  }
7258
7477
  idlRefType.fileName = file;
7259
- idlRefType.extendedAttributes = this.toExtendedAttributes(combinedExtAttrs);
7478
+ idlRefType.extendedAttributes = this.toExtendedAttributes(file, combinedExtAttrs);
7260
7479
  return this.withInfo(type, idlRefType);
7261
7480
  }
7262
7481
  if (isSequenceTypeDescription(type) || isPromiseTypeDescription(type) || isRecordTypeDescription(type)) {
@@ -7284,7 +7503,7 @@ class IDLDeserializer {
7284
7503
  isAsync: node.async,
7285
7504
  }, {
7286
7505
  documentation: this.makeDocs(node),
7287
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7506
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7288
7507
  }, generics));
7289
7508
  this.genericsScopes.pop();
7290
7509
  return result;
@@ -7297,8 +7516,6 @@ class IDLDeserializer {
7297
7516
  const generics = this.extractGenerics(node.extAttrs);
7298
7517
  this.enterGenericScope(generics);
7299
7518
  const returnType = this.toIDLType(file, node.idlType, node.extAttrs);
7300
- if (isReferenceType(returnType))
7301
- returnType.typeArguments = this.extractTypeArguments(file, node.extAttrs, IDLExtendedAttributes.TypeArguments);
7302
7519
  const result = this.withInfo(node, createMethod((_a = node.name) !== null && _a !== void 0 ? _a : "", node.arguments.map(it => this.toIDLParameter(file, it !== null && it !== void 0 ? it : new Map())), returnType, {
7303
7520
  isStatic: node.special === "static",
7304
7521
  isAsync: node.async,
@@ -7306,7 +7523,7 @@ class IDLDeserializer {
7306
7523
  isFree
7307
7524
  }, {
7308
7525
  documentation: this.makeDocs(node),
7309
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7526
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7310
7527
  }, generics));
7311
7528
  this.genericsScopes.pop();
7312
7529
  return result;
@@ -7314,7 +7531,7 @@ class IDLDeserializer {
7314
7531
  toIDLConstructor(file, node) {
7315
7532
  return this.withInfo(node, createConstructor(node.arguments.map(it => this.toIDLParameter(file, it)), undefined, {
7316
7533
  documentation: this.makeDocs(node),
7317
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7534
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7318
7535
  }));
7319
7536
  }
7320
7537
  toIDLParameter(file, node) {
@@ -7327,7 +7544,7 @@ class IDLDeserializer {
7327
7544
  this.enterGenericScope(generics);
7328
7545
  const result = createCallback(node.name, node.arguments.map(it => this.toIDLParameter(file, it)), this.toIDLType(file, node.idlType, undefined), {
7329
7546
  fileName: file,
7330
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7547
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7331
7548
  documentation: this.makeDocs(node),
7332
7549
  }, generics);
7333
7550
  if (node.extAttrs.find(it => it.name === "Synthetic")) {
@@ -7341,7 +7558,7 @@ class IDLDeserializer {
7341
7558
  const generics = this.extractGenerics(node.extAttrs);
7342
7559
  this.enterGenericScope(generics);
7343
7560
  const result = this.withInfo(node, createTypedef(node.name, this.toIDLType(file, node.idlType, undefined, node.name), generics, {
7344
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7561
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7345
7562
  documentation: this.makeDocs(node),
7346
7563
  fileName: file,
7347
7564
  }));
@@ -7354,7 +7571,7 @@ class IDLDeserializer {
7354
7571
  toIDLDictionary(file, node) {
7355
7572
  const result = createEnum(node.name, [], {
7356
7573
  documentation: this.makeDocs(node),
7357
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7574
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7358
7575
  fileName: file,
7359
7576
  });
7360
7577
  result.elements = node.members.map(it => this.toIDLEnumMember(file, it, result));
@@ -7362,7 +7579,7 @@ class IDLDeserializer {
7362
7579
  }
7363
7580
  toIDLNamespace(file, node) {
7364
7581
  const namespace = createNamespace(node.name, [], {
7365
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7582
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7366
7583
  fileName: file
7367
7584
  });
7368
7585
  this.namespacePathNames.push(node.name);
@@ -7372,7 +7589,7 @@ class IDLDeserializer {
7372
7589
  }
7373
7590
  toIDLVersion(file, node) {
7374
7591
  return this.withInfo(node, createVersion(node.value, {
7375
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7592
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7376
7593
  fileName: file
7377
7594
  }));
7378
7595
  }
@@ -7380,7 +7597,7 @@ class IDLDeserializer {
7380
7597
  return this.withInfo(node, createProperty(node.name, this.toIDLType(file, node.idlType, undefined), node.readonly, node.special === "static", isOptional(node), {
7381
7598
  documentation: this.makeDocs(node),
7382
7599
  fileName: file,
7383
- extendedAttributes: this.toExtendedAttributes(node.extAttrs)
7600
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs)
7384
7601
  }));
7385
7602
  }
7386
7603
  toIDLEnumMember(file, node, parent) {
@@ -7399,12 +7616,18 @@ class IDLDeserializer {
7399
7616
  throw new Error(`Not representable enum initializer: ${JSON.stringify(node.default)}. Found in ${file}`);
7400
7617
  }
7401
7618
  return this.withInfo(node, createEnumMember(node.name, parent, this.toIDLType(file, node.idlType, undefined), initializer, {
7402
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7619
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7403
7620
  }));
7404
7621
  }
7405
- toExtendedAttributes(extAttrs) {
7622
+ toExtendedAttributes(file, extAttrs) {
7406
7623
  return extAttrs.map(it => {
7407
- return this.withInfo(it, { name: it.name, value: this.toExtendedAttributeValue(it) });
7624
+ return this.withInfo(it, {
7625
+ name: it.name,
7626
+ value: this.toExtendedAttributeValue(it),
7627
+ typesValue: extendedAttributesWithTypesValue.includes(it.name)
7628
+ ? this.extractTypeArguments(file, extAttrs, it.name)
7629
+ : undefined
7630
+ });
7408
7631
  });
7409
7632
  }
7410
7633
  toExtendedAttributeValue(attr) {
@@ -7420,7 +7643,7 @@ class IDLDeserializer {
7420
7643
  const result = createEnum(node.name, [], {
7421
7644
  fileName: file,
7422
7645
  documentation: this.makeDocs(node),
7423
- extendedAttributes: this.toExtendedAttributes(node.extAttrs),
7646
+ extendedAttributes: this.toExtendedAttributes(file, node.extAttrs),
7424
7647
  });
7425
7648
  result.elements = node.values.map((it) => createEnumMember(it.value, result, IDLNumberType, undefined));
7426
7649
  return this.withInfo(node, result);
@@ -7541,7 +7764,7 @@ class IDLDeserializer {
7541
7764
  }
7542
7765
  }
7543
7766
  const DifferenceFound = new DiagnosticMessageGroup("error", "DifferenceFound", "Difference found");
7544
- const noCompare = new Set(["parent", "fileName", "nodeLocation", "nameLocation", "valueLocation", "typesValue"]);
7767
+ const noCompare = new Set(["parent", "fileName", "nodeLocation", "nameLocation", "valueLocation", "typesValue", "text"]);
7545
7768
  const canContainMoreCompare = new Set(["extendedAttributes", "typeParameters", "typeArguments"]);
7546
7769
  function safeString(value) {
7547
7770
  if (typeof value == "symbol") {
@@ -7623,8 +7846,36 @@ function compareParsingResults(oldFile, newFile) {
7623
7846
  if (paths.size > 0) {
7624
7847
  DifferenceFound.reportDiagnosticMessage([newFile.nodeLocation], "Differences found in those paths:\n" + [...paths].join("\n"));
7625
7848
  }
7849
+ return paths.size == 0;
7626
7850
  }
7627
- function parseIdlNew(fileName, content, registerSynthetics) {
7851
+ function parseIDLFile(fileName, content, quiet) {
7852
+ const previousDiagnosticsCount = DiagnosticMessageGroup.allGroupsEntries.length;
7853
+ try {
7854
+ let newFile;
7855
+ // Temporarily is set to use old parser by default
7856
+ // Old parser has a bug, it ignores extended attributes on return types, but some pipelines depend on that behavior
7857
+ // So pipelines and old parser must be fixed before permanent switch to a new parser
7858
+ const mode = process.env.IDLPARSE;
7859
+ if (mode === "compare" || mode === "old") {
7860
+ newFile = parseIDLFileOld(fileName, content);
7861
+ if (mode === "old") {
7862
+ return newFile;
7863
+ }
7864
+ }
7865
+ const file = parseIDLFileNew(fileName, content, mode !== "compare");
7866
+ if (mode === "compare") {
7867
+ compareParsingResults(file, newFile);
7868
+ return newFile;
7869
+ }
7870
+ return file;
7871
+ }
7872
+ finally {
7873
+ if (DiagnosticMessageGroup.allGroupsEntries.length != previousDiagnosticsCount) {
7874
+ DiagnosticMessageGroup.allGroupsEntries.slice(previousDiagnosticsCount).map(it => outputDiagnosticMessageFormatted(it));
7875
+ }
7876
+ }
7877
+ }
7878
+ function parseIDLFileNew(fileName, content, registerSynthetics) {
7628
7879
  let file = new Parser(fileName, content).parseIDL();
7629
7880
  const ancestors = [];
7630
7881
  const namespaces = [];
@@ -7660,18 +7911,10 @@ function parseIdlNew(fileName, content, registerSynthetics) {
7660
7911
  });
7661
7912
  return file;
7662
7913
  }
7663
- function toIDLFile(fileName, { content, inheritanceMode = 'multiple' } = {}) {
7914
+ function parseIDLFileOld(fileName, content) {
7664
7915
  var _a, _b, _c;
7665
- let newFile;
7666
- const mode = process.env.IDLPARSE;
7667
- if (mode == "compare" || mode == "new") {
7668
- newFile = parseIdlNew(fileName, content, mode == "new");
7669
- if (mode == "new") {
7670
- return [newFile, new Map()];
7671
- }
7672
- }
7673
7916
  const lexicalInfo = new Map();
7674
- const deserializer = new IDLDeserializer(lexicalInfo, inheritanceMode);
7917
+ const deserializer = new IDLDeserializer(lexicalInfo);
7675
7918
  if (undefined === content) {
7676
7919
  try {
7677
7920
  content = fs__namespace.readFileSync(fileName).toString();
@@ -7720,11 +7963,7 @@ function toIDLFile(fileName, { content, inheritanceMode = 'multiple' } = {}) {
7720
7963
  node.nameLocation = nameLocation;
7721
7964
  }
7722
7965
  });
7723
- if (mode == "compare") {
7724
- compareParsingResults(file, newFile);
7725
- return [newFile, new Map()];
7726
- }
7727
- return [file, lexicalInfo];
7966
+ return file;
7728
7967
  }
7729
7968
  function prepareOffsets(lines) {
7730
7969
  let offsets = [];
@@ -8075,6 +8314,9 @@ class CppLanguageWriter extends CLikeLanguageWriter {
8075
8314
  var _a;
8076
8315
  return new CppLanguageWriter(new IndentedPrinter([], this.indentDepth()), (_a = options === null || options === void 0 ? void 0 : options.resolver) !== null && _a !== void 0 ? _a : this.resolver, this.typeConvertor, this.primitivesTypes);
8077
8316
  }
8317
+ get interopModule() {
8318
+ throw new Error(`Modules are not supported in C++`);
8319
+ }
8078
8320
  writeDeclaration(name, signature, modifiers, postfix) {
8079
8321
  const realName = this.classMode === 'normal' ? name : `${this.currentClass.at(0)}::${name}`;
8080
8322
  const newModifiers = this.classMode === 'normal'
@@ -8147,6 +8389,9 @@ class CppLanguageWriter extends CLikeLanguageWriter {
8147
8389
  writeConstant(constName, constType, constVal) {
8148
8390
  this.print(`${this.getNodeName(constType)} ${constName}${constVal ? ' = ' + constVal : ''};`);
8149
8391
  }
8392
+ writeImports(moduleName, importedFeatures, aliases) {
8393
+ throw new Error(`Imports are not supported in C++`);
8394
+ }
8150
8395
  /**
8151
8396
  * Writes multiline comments decorated with stars
8152
8397
  */
@@ -8501,6 +8746,9 @@ class TSLanguageWriter extends LanguageWriter {
8501
8746
  pushNamespace(namespace, options) {
8502
8747
  this.namespaceStack.push(namespace);
8503
8748
  const declaredPrefix = options.isDeclared ? "declare " : "";
8749
+ if (options.isDefault) {
8750
+ this.print(`export default ${namespace}`);
8751
+ }
8504
8752
  this.print(`export ${declaredPrefix}namespace ${namespace} {`);
8505
8753
  if (options.ident)
8506
8754
  this.pushIndent();
@@ -8519,6 +8767,9 @@ class TSLanguageWriter extends LanguageWriter {
8519
8767
  }
8520
8768
  return this.typeConvertor.convert(type);
8521
8769
  }
8770
+ get interopModule() {
8771
+ return "@koalaui/interop";
8772
+ }
8522
8773
  writeClass(name, op, superClass, interfaces, generics, isDeclared, isAbstract) {
8523
8774
  let extendsClause = superClass ? ` extends ${superClass}` : '';
8524
8775
  let implementsClause = interfaces ? ` implements ${interfaces.join(",")}` : '';
@@ -8578,11 +8829,22 @@ class TSLanguageWriter extends LanguageWriter {
8578
8829
  this.printer.print("}");
8579
8830
  }
8580
8831
  writeFieldDeclaration(name, type, modifiers, optional, initExpr) {
8581
- const init = initExpr != undefined ? ` = ${initExpr.asString()}` : ``;
8582
8832
  let prefix = this.makeFieldModifiersList(modifiers);
8583
8833
  if (prefix)
8584
8834
  prefix += " ";
8585
- this.printer.print(`${prefix}${name}${optional ? "?" : ""}: ${this.getNodeName(type)}${init}`);
8835
+ const typeName = this.getNodeName(type);
8836
+ const isGetter = modifiers === null || modifiers === void 0 ? void 0 : modifiers.includes(FieldModifier.GET);
8837
+ const isSetter = modifiers === null || modifiers === void 0 ? void 0 : modifiers.includes(FieldModifier.SET);
8838
+ if (isGetter) {
8839
+ this.printer.print(`${prefix}get ${name}(): ${typeName}`);
8840
+ }
8841
+ if (isSetter) {
8842
+ this.printer.print(`${prefix}set ${name}(value: ${typeName})`);
8843
+ }
8844
+ if (isGetter || isSetter)
8845
+ return;
8846
+ const init = initExpr != undefined ? ` = ${initExpr.asString()}` : ``;
8847
+ this.printer.print(`${prefix}${name}${optional ? "?" : ""}: ${typeName}${init}`);
8586
8848
  }
8587
8849
  writeNativeMethodDeclaration(method) {
8588
8850
  let name = method.name;
@@ -8619,7 +8881,6 @@ class TSLanguageWriter extends LanguageWriter {
8619
8881
  }
8620
8882
  writeProperty(propName, propType, modifiers, getter, setter, initExpr) {
8621
8883
  let isStatic = modifiers.includes(FieldModifier.STATIC);
8622
- let isMutable = !modifiers.includes(FieldModifier.READONLY);
8623
8884
  let containerName = propName.concat("_container");
8624
8885
  if (getter) {
8625
8886
  if (!getter.op) {
@@ -8629,17 +8890,17 @@ class TSLanguageWriter extends LanguageWriter {
8629
8890
  (writer) => {
8630
8891
  writer.print(`return ${containerName}`);
8631
8892
  });
8632
- if (isMutable) {
8633
- const setSignature = new NamedMethodSignature(IDLVoidType, [propType], [propName]);
8634
- this.writeSetterImplementation(new Method(propName, setSignature, isStatic ? [MethodModifier.STATIC] : []), setter ? setter.op :
8635
- (writer) => {
8636
- writer.print(`${containerName} = ${propName}`);
8637
- });
8638
- }
8639
8893
  }
8640
- else {
8641
- this.writeFieldDeclaration(propName, propType, modifiers, isOptionalType(propType), initExpr);
8894
+ if (setter) {
8895
+ const setSignature = new NamedMethodSignature(IDLVoidType, [propType], [propName]);
8896
+ this.writeSetterImplementation(new Method(propName, setSignature, isStatic ? [MethodModifier.STATIC] : []), setter ? setter.op :
8897
+ (writer) => {
8898
+ writer.print(`${containerName} = ${propName}`);
8899
+ });
8642
8900
  }
8901
+ if (getter || setter)
8902
+ return;
8903
+ this.writeFieldDeclaration(propName, propType, modifiers, isOptionalType(propType), initExpr);
8643
8904
  }
8644
8905
  writeTypeDeclaration(decl) {
8645
8906
  var _a;
@@ -8650,6 +8911,16 @@ class TSLanguageWriter extends LanguageWriter {
8650
8911
  writeConstant(constName, constType, constVal) {
8651
8912
  this.print(`export const ${constName}: ${this.getNodeName(constType)}${constVal ? ' = ' + constVal : ''}`);
8652
8913
  }
8914
+ writeImports(moduleName, importedFeatures, aliases) {
8915
+ if (importedFeatures.length !== aliases.length) {
8916
+ throw new Error(`Inconsistent imports from ${moduleName}`);
8917
+ }
8918
+ const importNodes = [];
8919
+ for (let i = 0; i < importedFeatures.length; i++) {
8920
+ importNodes.push(importedFeatures[i] + (aliases[i] ? ` as ${aliases[i]}` : ``));
8921
+ }
8922
+ this.writeExpressionStatement(this.makeString(`import { ${importNodes.join(', ')} } from "${moduleName}"`));
8923
+ }
8653
8924
  writeDeclaration(name, signature, needReturn, needBracket, modifiers, generics) {
8654
8925
  let prefix = !modifiers ? undefined : this.supportedModifiers
8655
8926
  .filter(it => modifiers.includes(it))
@@ -8871,6 +9142,15 @@ class CJDeclarationNameConvertor extends DeclarationNameConvertor {
8871
9142
  }
8872
9143
  }
8873
9144
  CJDeclarationNameConvertor.I = new CJDeclarationNameConvertor();
9145
+ class KotlinDeclarationNameConvertor extends DeclarationNameConvertor {
9146
+ convertInterface(decl) {
9147
+ return removePoints(getQualifiedName(decl, "namespace.name"));
9148
+ }
9149
+ convertEnum(decl) {
9150
+ return removePoints(getQualifiedName(decl, "namespace.name"));
9151
+ }
9152
+ }
9153
+ KotlinDeclarationNameConvertor.I = new KotlinDeclarationNameConvertor();
8874
9154
  class ETSFeatureNameConvertor extends DeclarationNameConvertor {
8875
9155
  convertEnum(decl) {
8876
9156
  const namespace = getNamespacesPathFor(decl).map(it => it.name);
@@ -8887,18 +9167,20 @@ class CJFeatureNameConvertor extends DeclarationNameConvertor {
8887
9167
  }
8888
9168
  CJFeatureNameConvertor.I = new CJFeatureNameConvertor();
8889
9169
  class KotlinFeatureNameConvertor extends DeclarationNameConvertor {
9170
+ convertInterface(decl) {
9171
+ return removePoints(getQualifiedName(decl, "namespace.name"));
9172
+ }
8890
9173
  convertEnum(decl) {
8891
- return decl.name;
9174
+ return removePoints(getQualifiedName(decl, "namespace.name"));
8892
9175
  }
8893
9176
  }
8894
9177
  KotlinFeatureNameConvertor.I = new KotlinFeatureNameConvertor();
8895
9178
  function createDeclarationNameConvertor(language) {
8896
9179
  switch (language) {
8897
9180
  case Language.ARKTS: return ETSDeclarationNameConvertor.I;
8898
- case Language.JAVA:
8899
9181
  case Language.CPP:
8900
9182
  case Language.TS: return DeclarationNameConvertor.I;
8901
- case Language.CJ: default: throw new Error(`Language ${language.toString()} is not supported`);
9183
+ case Language.CJ: case Language.KOTLIN: default: throw new Error(`Language ${language.toString()} is not supported`);
8902
9184
  }
8903
9185
  }
8904
9186
 
@@ -9066,12 +9348,6 @@ class ETSLanguageWriter extends TSLanguageWriter {
9066
9348
  super(printer, resolver, typeConvertor, Language.ARKTS);
9067
9349
  this.arrayConvertor = arrayConvertor;
9068
9350
  }
9069
- pushNamespace(namespace, options) {
9070
- if (options.isDefault) {
9071
- this.print(`export default ${namespace}`);
9072
- }
9073
- super.pushNamespace(namespace, options);
9074
- }
9075
9351
  fork(options) {
9076
9352
  var _a;
9077
9353
  return new ETSLanguageWriter(new IndentedPrinter([], this.indentDepth()), (_a = options === null || options === void 0 ? void 0 : options.resolver) !== null && _a !== void 0 ? _a : this.resolver, this.typeConvertor, this.arrayConvertor);
@@ -9232,31 +9508,10 @@ ETSLanguageWriter._isUseTypeChecker = true;
9232
9508
  * See the License for the specific language governing permissions and
9233
9509
  * limitations under the License.
9234
9510
  */
9235
- var LayoutNodeRole;
9236
- (function (LayoutNodeRole) {
9237
- LayoutNodeRole[LayoutNodeRole["PEER"] = 0] = "PEER";
9238
- LayoutNodeRole[LayoutNodeRole["INTERFACE"] = 1] = "INTERFACE";
9239
- LayoutNodeRole[LayoutNodeRole["GLOBAL"] = 2] = "GLOBAL";
9240
- LayoutNodeRole[LayoutNodeRole["COMPONENT"] = 3] = "COMPONENT";
9241
- LayoutNodeRole[LayoutNodeRole["SERIALIZER"] = 4] = "SERIALIZER";
9242
- })(LayoutNodeRole || (LayoutNodeRole = {}));
9243
-
9244
- /*
9245
- * Copyright (c) 2024 Huawei Device Co., Ltd.
9246
- * Licensed under the Apache License, Version 2.0 (the "License");
9247
- * you may not use this file except in compliance with the License.
9248
- * You may obtain a copy of the License at
9249
- *
9250
- * http://www.apache.org/licenses/LICENSE-2.0
9251
- *
9252
- * Unless required by applicable law or agreed to in writing, software
9253
- * distributed under the License is distributed on an "AS IS" BASIS,
9254
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9255
- * See the License for the specific language governing permissions and
9256
- * limitations under the License.
9257
- */
9258
- function getSerializerName(declaration) {
9259
- return `${getQualifiedName(declaration, "namespace.name").split('.').join('_')}_serializer`;
9511
+ function getSerializerName(library, language, declaration) {
9512
+ const qualifier = isTopLevelConflicted(library, language, declaration)
9513
+ ? "package.namespace.name" : "namespace.name";
9514
+ return `${getQualifiedName(declaration, qualifier).split('.').join('_')}_serializer`;
9260
9515
  }
9261
9516
  class BaseArgConvertor {
9262
9517
  constructor(idlType, runtimeTypes, isScoped, useArray, param) {
@@ -9404,12 +9659,12 @@ class InterfaceConvertor extends BaseArgConvertor {
9404
9659
  throw new Error("Must never be used");
9405
9660
  }
9406
9661
  convertorSerialize(param, value, writer) {
9407
- const accessor = getSerializerName(this.declaration);
9662
+ const accessor = getSerializerName(this.library, writer.language, this.declaration);
9408
9663
  writer.addFeature(accessor, this.library.layout.resolve({ node: this.declaration, role: LayoutNodeRole.SERIALIZER }));
9409
- return writer.makeStatement(writer.makeStaticMethodCall(accessor, 'write', [writer.makeString(`${param}Serializer`), writer.makeString(value)]));
9664
+ return writer.makeStatement(writer.makeStaticMethodCall(accessor, 'write', [writer.makeString(`${param}Serializer`), writer.makeString(writer.escapeKeyword(value))]));
9410
9665
  }
9411
9666
  convertorDeserialize(bufferName, deserializerName, assigneer, writer) {
9412
- const accessor = getSerializerName(this.declaration);
9667
+ const accessor = getSerializerName(this.library, writer.language, this.declaration);
9413
9668
  writer.addFeature(accessor, this.library.layout.resolve({ node: this.declaration, role: LayoutNodeRole.SERIALIZER }));
9414
9669
  return assigneer(writer.makeStaticMethodCall(accessor, 'read', [writer.makeString(deserializerName)]));
9415
9670
  }
@@ -9497,11 +9752,10 @@ class MaterializedClassConvertor extends BaseArgConvertor {
9497
9752
  this.declaration = declaration;
9498
9753
  }
9499
9754
  convertorArg(param, writer) {
9755
+ const nameConvertor = this.library.createTypeNameConvertor(Language.CPP);
9500
9756
  switch (writer.language) {
9501
9757
  case Language.CPP:
9502
- return `static_cast<${generatorTypePrefix()}${qualifiedName(this.declaration, "_", "namespace.name")}>(${param})`;
9503
- case Language.JAVA:
9504
- case Language.KOTLIN:
9758
+ return `static_cast<${nameConvertor.convert(this.declaration)}>(${param})`;
9505
9759
  case Language.CJ:
9506
9760
  return `MaterializedBase.toPeerPtr(${writer.escapeKeyword(param)})`;
9507
9761
  default:
@@ -9513,12 +9767,12 @@ class MaterializedClassConvertor extends BaseArgConvertor {
9513
9767
  }
9514
9768
  }
9515
9769
  convertorSerialize(param, value, printer) {
9516
- const accessorRoot = getSerializerName(this.declaration);
9770
+ const accessorRoot = getSerializerName(this.library, printer.language, this.declaration);
9517
9771
  printer.addFeature(accessorRoot, this.library.layout.resolve({ node: this.declaration, role: LayoutNodeRole.SERIALIZER }));
9518
9772
  return printer.makeStatement(printer.makeStaticMethodCall(accessorRoot, 'write', [printer.makeString(`${param}Serializer`), printer.makeString(value)]));
9519
9773
  }
9520
9774
  convertorDeserialize(bufferName, deserializerName, assigneer, writer) {
9521
- const accessorRoot = getSerializerName(this.declaration);
9775
+ const accessorRoot = getSerializerName(this.library, writer.language, this.declaration);
9522
9776
  writer.addFeature(accessorRoot, this.library.layout.resolve({ node: this.declaration, role: LayoutNodeRole.SERIALIZER }));
9523
9777
  const readStatement = writer.makeCast(writer.makeStaticMethodCall(accessorRoot, "read", [writer.makeString(deserializerName)]), this.declaration);
9524
9778
  return assigneer(readStatement);
@@ -9620,9 +9874,6 @@ function zip(left, right) {
9620
9874
  throw new Error("Arrays of different length");
9621
9875
  return left.map((_, i) => [left[i], right[i]]);
9622
9876
  }
9623
- ({
9624
- target: ts__namespace.ScriptTarget.ES5,
9625
- module: ts__namespace.ModuleKind.CommonJS});
9626
9877
  function throwException(message) {
9627
9878
  throw new Error(message);
9628
9879
  }
@@ -9671,6 +9922,9 @@ function getExtractor(target, lang, toPtr = true) {
9671
9922
  const method = toPtr ? `to${extractorClass}Ptr` : `from${extractorClass}Ptr`;
9672
9923
  return { receiver, method };
9673
9924
  }
9925
+ function removePoints(s) {
9926
+ return s.split(/[\.\-]/g).join('_');
9927
+ }
9674
9928
 
9675
9929
  /*
9676
9930
  * Copyright (c) 2025 Huawei Device Co., Ltd.
@@ -10067,16 +10321,22 @@ const ModuleConfigurationSchema = D.object({
10067
10321
  external: D.maybe(D.boolean()),
10068
10322
  packages: T.stringArray(),
10069
10323
  useFoldersLayout: D.maybe(D.boolean()),
10324
+ tsLikePackage: D.maybe(D.string()),
10070
10325
  });
10071
10326
  const HookMethodSchema = D.object({
10072
10327
  hookName: D.string(),
10073
10328
  replaceImplementation: D.boolean()
10074
10329
  });
10330
+ const TransformOnSerializeSchema = D.object({
10331
+ from: D.string(),
10332
+ to: D.string(),
10333
+ });
10075
10334
  D.object({
10076
10335
  ApiKind: D.number(),
10077
10336
  TypePrefix: D.string(),
10078
10337
  LibraryPrefix: D.string(),
10079
10338
  OptionalPrefix: D.string(),
10339
+ transformOnSerialize: D.array(TransformOnSerializeSchema),
10080
10340
  rootComponents: T.stringArray(),
10081
10341
  standaloneComponents: T.stringArray(),
10082
10342
  parameterized: T.stringArray(),
@@ -10098,6 +10358,7 @@ const defaultCoreConfiguration = {
10098
10358
  TypePrefix: "",
10099
10359
  LibraryPrefix: "",
10100
10360
  OptionalPrefix: "",
10361
+ transformOnSerialize: [],
10101
10362
  rootComponents: [],
10102
10363
  standaloneComponents: [],
10103
10364
  parameterized: [],
@@ -10118,10 +10379,6 @@ let currentConfig = defaultCoreConfiguration;
10118
10379
  function generatorConfiguration() {
10119
10380
  return currentConfig;
10120
10381
  }
10121
- function generatorTypePrefix() {
10122
- const conf = generatorConfiguration();
10123
- return `${conf.TypePrefix}${conf.LibraryPrefix}`;
10124
- }
10125
10382
 
10126
10383
  /*
10127
10384
  * Copyright (c) 2024 Huawei Device Co., Ltd.
@@ -11978,9 +12235,6 @@ class Config {
11978
12235
  return `ir`;
11979
12236
  }
11980
12237
  }
11981
- Config.DoNotPrintPeers = [
11982
- 'es2panda_Context', // useless
11983
- ];
11984
12238
 
11985
12239
  /*
11986
12240
  * Copyright (c) 2024 Huawei Device Co., Ltd.
@@ -12052,6 +12306,9 @@ class BridgesConstructions {
12052
12306
  static get stringCast() {
12053
12307
  return `getStringCopy`;
12054
12308
  }
12309
+ static get stringArrayCast() {
12310
+ return `getStringArray`;
12311
+ }
12055
12312
  static dropConstCast(value) {
12056
12313
  return `(void*)${value}`;
12057
12314
  }
@@ -12763,7 +13020,7 @@ class InteropTypeConvertor extends BaseTypeConvertor {
12763
13020
  class InteropMacroTypeConvertor extends InteropTypeConvertor {
12764
13021
  constructor(typechecker) {
12765
13022
  super(typechecker, {
12766
- sequence: (type) => `KNativePointerArray`,
13023
+ sequence: (type) => isString(type.elementType[0]) ? `KStringArray` : `KNativePointerArray`,
12767
13024
  string: (type) => `KStringPtr`,
12768
13025
  });
12769
13026
  }
@@ -12786,7 +13043,7 @@ class InteropMacroTypeConvertor extends InteropTypeConvertor {
12786
13043
  class NativeTypeConvertor extends InteropTypeConvertor {
12787
13044
  constructor(typechecker) {
12788
13045
  super(typechecker, {
12789
- sequence: (type) => `KNativePointerArray`,
13046
+ sequence: (type) => isString(type.elementType[0]) ? `KStringArray&` : `KNativePointerArray`,
12790
13047
  string: (type) => `KStringPtr&`,
12791
13048
  });
12792
13049
  }
@@ -12810,7 +13067,9 @@ class CastTypeConvertor extends BaseTypeConvertor {
12810
13067
  constructor(typechecker) {
12811
13068
  const primitive = (type) => BridgesConstructions.primitiveTypeCast(this.castToTypeConvertor.convertType(type));
12812
13069
  super(typechecker, {
12813
- sequence: (type) => BridgesConstructions.referenceTypeCast(this.castToTypeConvertor.convertType(type)),
13070
+ sequence: (type) => isString(type.elementType[0]) ?
13071
+ BridgesConstructions.stringArrayCast :
13072
+ BridgesConstructions.referenceTypeCast(this.castToTypeConvertor.convertType(type)),
12814
13073
  enum: (type) => BridgesConstructions.enumCast(this.castToTypeConvertor.convertType(type)),
12815
13074
  reference: (type) => BridgesConstructions.referenceTypeCast(this.castToTypeConvertor.convertType(type)),
12816
13075
  i8: primitive,
@@ -13042,12 +13301,13 @@ class EnumsPrinter extends SingleFilePrinter {
13042
13301
  * limitations under the License.
13043
13302
  */
13044
13303
  class IndexPrinter extends SingleFilePrinter {
13045
- constructor() {
13046
- super(...arguments);
13304
+ constructor(config, idl) {
13305
+ super(idl);
13306
+ this.config = config;
13047
13307
  this.writer = createDefaultTypescriptWriter();
13048
13308
  }
13049
13309
  filterInterface(node) {
13050
- return !this.typechecker.isPeer(node) || Config.DoNotPrintPeers.includes(fqName(node));
13310
+ return !this.typechecker.isPeer(node) || this.config.ignore.isIgnoredPeer(fqName(node));
13051
13311
  }
13052
13312
  printInterface(node) {
13053
13313
  this.writer.writeExpressionStatement(this.writer.makeString(`export * from "./peers/${dropPrefix(node.name, Config.dataClassPrefix)}"`));
@@ -13097,7 +13357,7 @@ class BindingsConstructions {
13097
13357
  class BindingsTypeConvertor extends InteropTypeConvertor {
13098
13358
  constructor(typechecker) {
13099
13359
  super(typechecker, {
13100
- sequence: (type) => `BigUint64Array`,
13360
+ sequence: (type) => isString(type.elementType[0]) ? `KStringArrayPtr` : `BigUint64Array`,
13101
13361
  string: (type) => `KStringPtr`,
13102
13362
  });
13103
13363
  }
@@ -13266,6 +13526,9 @@ class PeersConstructions {
13266
13526
  static passNode(name) {
13267
13527
  return `passNode(${name})`;
13268
13528
  }
13529
+ static passStringArray(name) {
13530
+ return `passStringArray(${name})`;
13531
+ }
13269
13532
  static passNodeArray(name) {
13270
13533
  return `passNodeArray(${name})`;
13271
13534
  }
@@ -13363,7 +13626,7 @@ class Importer {
13363
13626
  return it;
13364
13627
  }
13365
13628
  this.seen.add(it);
13366
- this.import(it, "../../reexport-for-generated");
13629
+ this.import(it, "../../src/reexport-for-generated");
13367
13630
  return it;
13368
13631
  }
13369
13632
  import(name, from) {
@@ -13491,7 +13754,8 @@ class BindingParameterTypeConvertor extends TopLevelTypeConvertor {
13491
13754
  constructor(typechecker) {
13492
13755
  super(typechecker, {
13493
13756
  sequence: (type) => (parameter) => [
13494
- PeersConstructions.passNodeArray(parameter),
13757
+ isString(type.elementType[0]) ?
13758
+ PeersConstructions.passStringArray(parameter) : PeersConstructions.passNodeArray(parameter),
13495
13759
  PeersConstructions.arrayLength(parameter)
13496
13760
  ],
13497
13761
  string: (type) => (parameter) => parameter,
@@ -13814,7 +14078,7 @@ class AllPeersPrinter extends MultiFilePrinter {
13814
14078
  this.config = config;
13815
14079
  }
13816
14080
  filterInterface(node) {
13817
- return !this.typechecker.isPeer(node) || Config.DoNotPrintPeers.includes(fqName(node));
14081
+ return !this.typechecker.isPeer(node) || this.config.ignore.isIgnoredPeer(fqName(node));
13818
14082
  }
13819
14083
  printInterface(node) {
13820
14084
  return {
@@ -14372,12 +14636,12 @@ class DynamicEmitter {
14372
14636
  this.generatorVersion = `Unknown`;
14373
14637
  this.logDir = `./out/log-idl`;
14374
14638
  this.logCount = 0;
14375
- this.bridgesPrinter = new SingleFileEmitter((idl) => new BridgesPrinter(this.config, idl).print(), `libarkts/native/src/generated/bridges.cc`, `bridges.cc`, true);
14376
- this.bindingsPrinter = new SingleFileEmitter((idl) => new BindingsPrinter(idl).print(), `libarkts/src/generated/Es2pandaNativeModule.ts`, `Es2pandaNativeModule.ts`, true);
14377
- this.enumsPrinter = new SingleFileEmitter((idl) => new EnumsPrinter(idl).print(), `libarkts/src/generated/Es2pandaEnums.ts`, `Es2pandaEnums.ts`, true);
14378
- this.indexPrinter = new SingleFileEmitter((idl) => new IndexPrinter(idl).print(), `libarkts/src/generated/index.ts`, `index.ts`, true);
14379
- this.peersPrinter = new MultiFileEmitter((idl) => new AllPeersPrinter(this.config, idl).print(), `libarkts/src/generated/peers`, `peer.ts`, true);
14380
- this.factoryPrinter = new SingleFileEmitter((idl) => new FactoryPrinter(this.config, idl).print(), `libarkts/src/generated/factory.ts`, `factory.ts`, true);
14639
+ this.bridgesPrinter = new SingleFileEmitter((idl) => new BridgesPrinter(this.config, idl).print(), `libarkts/generated/native/bridges.cc`, `bridges.cc`, true);
14640
+ this.bindingsPrinter = new SingleFileEmitter((idl) => new BindingsPrinter(idl).print(), `libarkts/generated/Es2pandaNativeModule.ts`, `Es2pandaNativeModule.ts`, true);
14641
+ this.enumsPrinter = new SingleFileEmitter((idl) => new EnumsPrinter(idl).print(), `libarkts/generated/Es2pandaEnums.ts`, `Es2pandaEnums.ts`, true);
14642
+ this.indexPrinter = new SingleFileEmitter((idl) => new IndexPrinter(this.config, idl).print(), `libarkts/generated/index.ts`, `index.ts`, true);
14643
+ this.peersPrinter = new MultiFileEmitter((idl) => new AllPeersPrinter(this.config, idl).print(), `libarkts/generated/peers`, `peer.ts`, true);
14644
+ this.factoryPrinter = new SingleFileEmitter((idl) => new FactoryPrinter(this.config, idl).print(), `libarkts/generated/factory.ts`, `factory.ts`, true);
14381
14645
  const myJson = path__namespace$1.resolve(__dirname, '..', 'package.json');
14382
14646
  if (fs__namespace$1.existsSync(myJson)) {
14383
14647
  this.generatorVersion = (_b = (_a = lib.parse(fs__namespace$1.readFileSync(myJson).toString())) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : `Unknown`;
@@ -14487,7 +14751,8 @@ class DynamicEmitter {
14487
14751
  */
14488
14752
  class IgnoreOptions {
14489
14753
  constructor(filePath) {
14490
- var _a, _b;
14754
+ var _a, _b, _c;
14755
+ this.peers = [];
14491
14756
  this.partial = [];
14492
14757
  this.ignored = new Map();
14493
14758
  if (filePath === undefined) {
@@ -14495,7 +14760,8 @@ class IgnoreOptions {
14495
14760
  }
14496
14761
  const ignore = lib.parse(fs__namespace$1.readFileSync(filePath).toString()).ignore;
14497
14762
  this.partial = (_a = ignore === null || ignore === void 0 ? void 0 : ignore.partial) !== null && _a !== void 0 ? _a : [];
14498
- const full = (_b = ignore === null || ignore === void 0 ? void 0 : ignore.full) !== null && _b !== void 0 ? _b : [];
14763
+ this.peers = (_b = ignore === null || ignore === void 0 ? void 0 : ignore.peers) !== null && _b !== void 0 ? _b : ['es2panda_Context'];
14764
+ const full = (_c = ignore === null || ignore === void 0 ? void 0 : ignore.full) !== null && _c !== void 0 ? _c : [];
14499
14765
  full.forEach((fqName) => {
14500
14766
  const parts = fqName.split('.');
14501
14767
  const [ns, name] = parts.length === 1 ? ['', parts.at(0)] : parts;
@@ -14507,6 +14773,9 @@ class IgnoreOptions {
14507
14773
  this.ignored.get(ns).set(key, last !== '!');
14508
14774
  });
14509
14775
  }
14776
+ isIgnoredPeer(name) {
14777
+ return this.peers.includes(name);
14778
+ }
14510
14779
  isIgnoredMethod(iface, method) {
14511
14780
  var _a;
14512
14781
  return (_a = this.partial) === null || _a === void 0 ? void 0 : _a.some(it => { var _a; return it.interface === iface && ((_a = it.methods) === null || _a === void 0 ? void 0 : _a.includes(method)); });
@@ -14771,7 +15040,7 @@ function main() {
14771
15040
  if (options.initialize) {
14772
15041
  new StaticEmitter(options.outputDir, options.pandaSdkPath).emit();
14773
15042
  }
14774
- new DynamicEmitter(options.outputDir, options.pandaSdkPath, toIDLFile(path__namespace$1.join(options.pandaSdkPath, pandaSdkIdlFilePath), { inheritanceMode: 'single' })[0], new Config(new IgnoreOptions(options.optionsFile), new NonNullableOptions(options.optionsFile), new IrHackOptions(options.optionsFile), new CodeFragmentOptions(options.optionsFile), new ExtraParameters(options.optionsFile)), options.debug).emit();
15043
+ new DynamicEmitter(options.outputDir, options.pandaSdkPath, parseIDLFile(path__namespace$1.join(options.pandaSdkPath, pandaSdkIdlFilePath)), new Config(new IgnoreOptions(options.optionsFile), new NonNullableOptions(options.optionsFile), new IrHackOptions(options.optionsFile), new CodeFragmentOptions(options.optionsFile), new ExtraParameters(options.optionsFile)), options.debug).emit();
14775
15044
  }
14776
15045
  main();
14777
15046
  //# sourceMappingURL=index.js.map