@idlizer/arktscgen 2.1.5 → 2.1.9-arktscgen-4
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.
- package/build/libarkts-copy/generator/options.json5 +34 -0
- package/build/libarkts-copy/native/meson.build +128 -62
- package/build/libarkts-copy/native/meson_options.txt +19 -0
- package/build/libarkts-copy/native/src/bridges.cc +278 -15
- package/build/libarkts-copy/native/src/common.cc +212 -43
- package/build/libarkts-copy/native/src/common.h +95 -2
- package/build/libarkts-copy/native/src/generated/bridges.cc +2801 -466
- package/build/libarkts-copy/package.json +82 -62
- package/build/libarkts-copy/src/Es2pandaNativeModule.ts +97 -3
- package/build/libarkts-copy/src/InteropNativeModule.ts +3 -1
- package/build/libarkts-copy/src/arkts-api/AbstractVisitor.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/ChainExpressionFilter.ts +78 -0
- package/build/libarkts-copy/src/arkts-api/CheckedBackFilter.ts +131 -0
- package/build/libarkts-copy/src/arkts-api/CompileWithCache.ts +193 -0
- package/build/libarkts-copy/src/arkts-api/ImportStorage.ts +78 -0
- package/build/libarkts-copy/src/arkts-api/InferVoidReturnType.ts +89 -0
- package/build/libarkts-copy/src/arkts-api/ProgramProvider.ts +50 -0
- package/build/libarkts-copy/src/arkts-api/SetBaseOverloads.ts +44 -0
- package/build/libarkts-copy/src/arkts-api/class-by-peer.ts +2 -3
- package/build/libarkts-copy/src/arkts-api/factory/nodeFactory.ts +93 -10
- package/build/libarkts-copy/src/arkts-api/index.ts +13 -1
- package/build/libarkts-copy/src/arkts-api/node-cache.ts +8 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationDeclaration.ts +32 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/AnnotationUsage.ts +37 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArkTsConfig.ts +26 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ArrayExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/BinaryExpression.ts +37 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/BlockStatement.ts +29 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/CallExpression.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ChainExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDeclaration.ts +54 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassDefinition.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ClassProperty.ts +27 -4
- package/build/libarkts-copy/src/arkts-api/node-utilities/ConditionalExpression.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSFunctionType.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSImportDeclaration.ts +3 -27
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSNewClassInstanceExpression.ts +34 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSParameterExpression.ts +3 -9
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSPrimitiveType.ts +28 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSStructDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTuple.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReference.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSTypeReferencePart.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUndefinedType.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ETSUnionType.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/Identifier.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ImportSpecifier.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/MemberExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/MethodDefinition.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/NullLiteral.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/NumberLiteral.ts +2 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/ObjectExpression.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/Program.ts +40 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ReturnStatement.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/StringLiteral.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/SuperExpression.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSAsExpression.ts +36 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSClassImplements.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceBody.ts +28 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSInterfaceDeclaration.ts +30 -10
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSNonNullExpression.ts +27 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +10 -2
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameter.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterDeclaration.ts +31 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeParameterInstantiation.ts +30 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/TSTypeReferencePart.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/TemplateLiteral.ts +35 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/ThisExpression.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/UndefinedLiteral.ts +24 -0
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclaration.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/node-utilities/VariableDeclarator.ts +1 -1
- package/build/libarkts-copy/src/arkts-api/peers/ArktsObject.ts +3 -1
- package/build/libarkts-copy/src/arkts-api/peers/AstNode.ts +78 -15
- package/build/libarkts-copy/src/arkts-api/peers/Config.ts +8 -1
- package/build/libarkts-copy/src/arkts-api/peers/Context.ts +72 -6
- package/build/libarkts-copy/src/arkts-api/peers/{Program.ts → ExternalSource.ts} +3 -21
- package/build/libarkts-copy/src/arkts-api/peers/Options.ts +34 -0
- package/build/libarkts-copy/src/arkts-api/plugins.ts +62 -0
- package/build/libarkts-copy/src/arkts-api/static/global.ts +9 -5
- package/build/libarkts-copy/src/arkts-api/static/profiler.ts +195 -23
- package/build/libarkts-copy/src/arkts-api/utilities/private.ts +36 -10
- package/build/libarkts-copy/src/arkts-api/utilities/public.ts +68 -20
- package/build/libarkts-copy/src/arkts-api/visitor.ts +162 -18
- package/build/libarkts-copy/src/arkts-api/wrapper-compat.ts +32 -0
- package/build/libarkts-copy/src/checkSdk.ts +25 -0
- package/build/libarkts-copy/src/generated/Es2pandaEnums.ts +448 -436
- package/build/libarkts-copy/src/generated/Es2pandaNativeModule.ts +775 -60
- package/build/libarkts-copy/src/generated/factory.ts +12 -15
- package/build/libarkts-copy/src/generated/index.ts +10 -3
- package/build/libarkts-copy/src/generated/peers/AnnotatedAstNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedExpression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotatedStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AnnotationDeclaration.ts +58 -6
- package/build/libarkts-copy/src/generated/peers/AnnotationUsage.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ArkTsConfig.ts +75 -0
- package/build/libarkts-copy/src/generated/peers/ArrayExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ArrowFunctionExpression.ts +40 -6
- package/build/libarkts-copy/src/generated/peers/AssertStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/AssignmentExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/AstDumper.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AstVerifier.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AstVisitor.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/AwaitExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BigIntLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BinaryExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BindingProps.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/BlockExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/BlockStatement.ts +26 -7
- package/build/libarkts-copy/src/generated/peers/BooleanLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/BreakStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/CallExpression.ts +20 -3
- package/build/libarkts-copy/src/generated/peers/CatchClause.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ChainExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/CharLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ClassDeclaration.ts +33 -4
- package/build/libarkts-copy/src/generated/peers/ClassDefinition.ts +128 -42
- package/build/libarkts-copy/src/generated/peers/ClassElement.ts +28 -4
- package/build/libarkts-copy/src/generated/peers/ClassExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ClassProperty.ts +39 -5
- package/build/libarkts-copy/src/generated/peers/ClassStaticBlock.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/CodeGen.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ConditionalExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ContinueStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/DebuggerStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Declaration.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/Decorator.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/{OverloadInfo.ts → DiagnosticInfo.ts} +8 -2
- package/build/libarkts-copy/src/generated/peers/DirectEvalExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/DoWhileStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/DynamicImportData.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ETSClassLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSFunctionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSImportDeclaration.ts +16 -5
- package/build/libarkts-copy/src/generated/peers/ETSKeyofType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSModule.ts +59 -4
- package/build/libarkts-copy/src/generated/peers/ETSNewArrayInstanceExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSNewClassInstanceExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSNewMultiDimArrayInstanceExpression.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSNullType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSPackageDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSParameterExpression.ts +46 -12
- package/build/libarkts-copy/src/generated/peers/ETSPrimitiveType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSReExportDeclaration.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ETSStringLiteralType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSStructDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSTuple.ts +14 -8
- package/build/libarkts-copy/src/generated/peers/ETSTypeReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSTypeReferencePart.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/ETSUndefinedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ETSUnionType.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/ETSWildcardType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/EmptyStatement.ts +16 -4
- package/build/libarkts-copy/src/generated/peers/ErrorLogger.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ExportAllDeclaration.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ExportDefaultDeclaration.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ExportNamedDeclaration.ts +18 -7
- package/build/libarkts-copy/src/generated/peers/ExportSpecifier.ts +26 -3
- package/build/libarkts-copy/src/generated/peers/Expression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ExpressionStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForInStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForOfStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ForUpdateStatement.ts +8 -2
- package/build/libarkts-copy/src/generated/peers/FunctionDecl.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/FunctionDeclaration.ts +44 -6
- package/build/libarkts-copy/src/generated/peers/FunctionExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/FunctionSignature.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/IRNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/Identifier.ts +16 -5
- package/build/libarkts-copy/src/generated/peers/IfStatement.ts +14 -3
- package/build/libarkts-copy/src/generated/peers/ImportDeclaration.ts +28 -4
- package/build/libarkts-copy/src/generated/peers/ImportDefaultSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportNamespaceSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ImportSource.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ImportSpecifier.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/IndexInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/InterfaceDecl.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/LabelPair.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/LabelledStatement.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Literal.ts +15 -1
- package/build/libarkts-copy/src/generated/peers/LoopStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/MaybeOptionalExpression.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/MemberExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/MetaProperty.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/MethodDefinition.ts +26 -10
- package/build/libarkts-copy/src/generated/peers/NamedType.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NewExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NullLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/NumberLiteral.ts +12 -6
- package/build/libarkts-copy/src/generated/peers/ObjectDescriptor.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ObjectExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/OmittedExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/OpaqueTypeNode.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/PrefixAssertionExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/Program.ts +194 -0
- package/build/libarkts-copy/src/generated/peers/Property.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/RegExpLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/ReturnStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ScopeFindResult.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ScriptFunction.ts +77 -10
- package/build/libarkts-copy/src/generated/peers/ScriptFunctionData.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SequenceExpression.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/SignatureInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SourcePosition.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SourceRange.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/SpreadElement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SrcDumper.ts +46 -9
- package/build/libarkts-copy/src/generated/peers/Statement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/StringLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/{ETSDynamicFunctionType.ts → SuggestionInfo.ts} +7 -5
- package/build/libarkts-copy/src/generated/peers/SuperExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SwitchCaseStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/SwitchStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSAnyKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSArrayType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSAsExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSBigintKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSBooleanKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSClassImplements.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TSConditionalType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSConstructorType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSEnumDeclaration.ts +48 -6
- package/build/libarkts-copy/src/generated/peers/TSEnumMember.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TSExternalModuleReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSFunctionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSImportEqualsDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSImportType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIndexSignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIndexedAccessType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInferType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInterfaceBody.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSInterfaceDeclaration.ts +78 -8
- package/build/libarkts-copy/src/generated/peers/TSInterfaceHeritage.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSIntersectionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSLiteralType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSMappedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSMethodSignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSModuleBlock.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSModuleDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNamedTupleMember.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNeverKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNonNullExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNullKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSNumberKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSObjectKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSParameterProperty.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSParenthesizedType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSPropertySignature.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSQualifiedName.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSSignatureDeclaration.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSStringKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSThisType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTupleType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeAliasDeclaration.ts +53 -6
- package/build/libarkts-copy/src/generated/peers/TSTypeAssertion.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeOperator.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeParameter.ts +41 -7
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterDeclaration.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeParameterInstantiation.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypePredicate.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeQuery.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSTypeReference.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUndefinedKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUnionType.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSUnknownKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TSVoidKeyword.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TaggedTemplateExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TemplateElement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TemplateLiteral.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ThisExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/ThrowStatement.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/TryStatement.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/TypeNode.ts +37 -3
- package/build/libarkts-copy/src/generated/peers/TypedAstNode.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/TypedStatement.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/TypeofExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/UnaryExpression.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/UndefinedLiteral.ts +9 -3
- package/build/libarkts-copy/src/generated/peers/UpdateExpression.ts +10 -4
- package/build/libarkts-copy/src/generated/peers/VReg.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/ValidationInfo.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/VariableDeclaration.ts +48 -8
- package/build/libarkts-copy/src/generated/peers/VariableDeclarator.ts +11 -5
- package/build/libarkts-copy/src/generated/peers/VerificationContext.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/VerifierMessage.ts +7 -1
- package/build/libarkts-copy/src/generated/peers/WhileStatement.ts +15 -4
- package/build/libarkts-copy/src/generated/peers/YieldExpression.ts +10 -4
- package/build/libarkts-copy/src/index.ts +31 -1
- package/build/libarkts-copy/src/plugin-utils.ts +117 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeFactory.ts +15 -0
- package/build/libarkts-copy/src/ts-api/factory/nodeTests.ts +15 -0
- package/build/libarkts-copy/src/ts-api/types.ts +15 -0
- package/build/libarkts-copy/src/utils.ts +24 -41
- package/build/libarkts-copy/src/wrapper-compat/README.md +16 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/class-by-peer.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeFactory.ts +454 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/factory/nodeTests.ts +99 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/index.ts +88 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrayExpression.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ArrowFunctionExpression.ts +35 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/AssignmentExpression.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/BlockStatement.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/CallExpression.ts +45 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDeclaration.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassDefinition.ts +73 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ClassProperty.ts +51 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSFunctionType.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSImportDeclaration.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ETSParameterExpression.ts +43 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ExpressionStatement.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionDeclaration.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/FunctionExpression.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/IfStatement.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MemberExpression.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/MethodDefinition.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/NumberLiteral.ts +30 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ObjectExpression.ts +37 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/Property.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/ScriptFunction.ts +46 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/StructDeclaration.ts +28 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSInterfaceDeclaration.ts +47 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeAliasDeclaration.ts +40 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TSTypeParameter.ts +36 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/TryStatement.ts +41 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclaration.ts +42 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/node-utilities/VariableDeclarator.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ArktsObject.ts +45 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/AstNode.ts +26 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Config.ts +53 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Context.ts +60 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +39 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/DiagnosticKind.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/ImportPathManager.ts +34 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/Program.ts +105 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourcePosition.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SourceRange.ts +38 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +33 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/global.ts +16 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/static/globalUtils.ts +27 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/to-be-generated/MemberExpression.ts +108 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/types.ts +907 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/nativePtrDecoder.ts +69 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/performance.ts +190 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/private.ts +198 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/utilities/public.ts +325 -0
- package/build/libarkts-copy/src/wrapper-compat/arkts-api/visitor.ts +421 -0
- package/build/libarkts-copy/src/wrapper-compat/index.ts +20 -0
- package/build/libarkts-copy/tsconfig.json +2 -1
- package/lib/index.js +1704 -273
- package/package.json +2 -2
- package/templates/Es2pandaEnums.ts +4 -0
- package/templates/Es2pandaNativeModule.ts +5 -1
- package/templates/factory.ts +5 -1
- package/templates/index.ts +5 -1
- package/templates/node-map.ts +5 -1
- package/templates/peer.ts +5 -1
- package/build/libarkts-copy/README.md +0 -36
|
@@ -13,49 +13,65 @@
|
|
|
13
13
|
* limitations under the License.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { factory } from "./factory/nodeFactory"
|
|
17
|
-
import { AstNode } from "./peers/AstNode"
|
|
18
16
|
import {
|
|
19
17
|
isArrayExpression,
|
|
20
18
|
isArrowFunctionExpression,
|
|
21
19
|
isAssignmentExpression,
|
|
20
|
+
isBinaryExpression,
|
|
22
21
|
isBlockExpression,
|
|
23
22
|
isBlockStatement,
|
|
24
23
|
isCallExpression,
|
|
25
24
|
isChainExpression,
|
|
26
25
|
isClassDeclaration,
|
|
27
26
|
isClassDefinition,
|
|
27
|
+
isClassProperty,
|
|
28
28
|
isConditionalExpression,
|
|
29
|
+
isDoWhileStatement,
|
|
30
|
+
isETSFunctionType,
|
|
31
|
+
isETSImportDeclaration,
|
|
29
32
|
isETSModule,
|
|
33
|
+
isETSNewClassInstanceExpression,
|
|
34
|
+
isETSParameterExpression,
|
|
30
35
|
isETSStructDeclaration,
|
|
31
36
|
isETSTuple,
|
|
37
|
+
isETSTypeReference,
|
|
38
|
+
isETSTypeReferencePart,
|
|
39
|
+
isETSUnionType,
|
|
32
40
|
isExpressionStatement,
|
|
41
|
+
isForInStatement,
|
|
42
|
+
isForOfStatement,
|
|
43
|
+
isForUpdateStatement,
|
|
33
44
|
isFunctionDeclaration,
|
|
34
45
|
isFunctionExpression,
|
|
46
|
+
isIdentifier,
|
|
35
47
|
isIfStatement,
|
|
36
48
|
isMemberExpression,
|
|
37
49
|
isMethodDefinition,
|
|
38
50
|
isObjectExpression,
|
|
51
|
+
isProperty,
|
|
39
52
|
isReturnStatement,
|
|
40
53
|
isScriptFunction,
|
|
54
|
+
isSwitchCaseStatement,
|
|
55
|
+
isSwitchStatement,
|
|
41
56
|
isTemplateLiteral,
|
|
42
57
|
isTryStatement,
|
|
43
58
|
isTSAsExpression,
|
|
44
59
|
isTSInterfaceBody,
|
|
45
60
|
isTSInterfaceDeclaration,
|
|
61
|
+
isTSNonNullExpression,
|
|
46
62
|
isTSTypeAliasDeclaration,
|
|
63
|
+
isTSTypeParameterDeclaration,
|
|
64
|
+
isTSTypeParameterInstantiation,
|
|
65
|
+
isUpdateExpression,
|
|
47
66
|
isVariableDeclaration,
|
|
48
67
|
isVariableDeclarator,
|
|
49
|
-
|
|
50
|
-
isIdentifier,
|
|
51
|
-
isETSParameterExpression,
|
|
52
|
-
isETSUnionType,
|
|
53
|
-
isETSFunctionType,
|
|
54
|
-
isWhileStatement,
|
|
68
|
+
isWhileStatement
|
|
55
69
|
} from "../generated"
|
|
56
|
-
import {
|
|
70
|
+
import { Es2pandaImportKinds } from "../generated/Es2pandaEnums"
|
|
71
|
+
import { factory } from "./factory/nodeFactory"
|
|
72
|
+
import { AstNode } from "./peers/AstNode"
|
|
57
73
|
import { global } from "./static/global"
|
|
58
|
-
import {
|
|
74
|
+
import { updateETSModuleByStatements } from "./utilities/public"
|
|
59
75
|
|
|
60
76
|
type Visitor = (node: AstNode, options?: object) => AstNode
|
|
61
77
|
|
|
@@ -128,7 +144,7 @@ export function visitEachChild(
|
|
|
128
144
|
node: AstNode,
|
|
129
145
|
visitor: Visitor
|
|
130
146
|
): AstNode {
|
|
131
|
-
global.profiler.
|
|
147
|
+
global.profiler.nodeVisited()
|
|
132
148
|
if (isETSModule(node)) {
|
|
133
149
|
return updateETSModuleByStatements(
|
|
134
150
|
node,
|
|
@@ -185,12 +201,11 @@ export function visitEachChild(
|
|
|
185
201
|
)
|
|
186
202
|
}
|
|
187
203
|
if (isClassDeclaration(node)) {
|
|
188
|
-
|
|
204
|
+
return factory.updateClassDeclaration(
|
|
189
205
|
node,
|
|
190
|
-
nodeVisitor(node.definition, visitor)
|
|
206
|
+
nodeVisitor(node.definition, visitor),
|
|
207
|
+
node.modifierFlags,
|
|
191
208
|
)
|
|
192
|
-
_node.modifierFlags = node.modifierFlags
|
|
193
|
-
return _node
|
|
194
209
|
}
|
|
195
210
|
if (isClassDefinition(node)) {
|
|
196
211
|
return factory.updateClassDefinition(
|
|
@@ -241,7 +256,6 @@ export function visitEachChild(
|
|
|
241
256
|
nodeVisitor(node.ident, visitor),
|
|
242
257
|
node.isOptional,
|
|
243
258
|
nodeVisitor(node.initializer, visitor),
|
|
244
|
-
nodeVisitor(node.typeAnnotation, visitor),
|
|
245
259
|
nodesVisitor(node.annotations, visitor),
|
|
246
260
|
)
|
|
247
261
|
}
|
|
@@ -255,6 +269,20 @@ export function visitEachChild(
|
|
|
255
269
|
node.isOptional
|
|
256
270
|
)
|
|
257
271
|
}
|
|
272
|
+
if (isSwitchStatement(node)) {
|
|
273
|
+
return factory.updateSwitchStatement(
|
|
274
|
+
node,
|
|
275
|
+
nodeVisitor(node.discriminant, visitor),
|
|
276
|
+
nodesVisitor(node.cases, visitor)
|
|
277
|
+
)
|
|
278
|
+
}
|
|
279
|
+
if (isSwitchCaseStatement(node)) {
|
|
280
|
+
return factory.updateSwitchCaseStatement(
|
|
281
|
+
node,
|
|
282
|
+
nodeVisitor(node.test, visitor),
|
|
283
|
+
nodesVisitor(node.consequent, visitor)
|
|
284
|
+
)
|
|
285
|
+
}
|
|
258
286
|
if (isTSInterfaceDeclaration(node)) {
|
|
259
287
|
return factory.updateInterfaceDeclaration(
|
|
260
288
|
node,
|
|
@@ -263,7 +291,8 @@ export function visitEachChild(
|
|
|
263
291
|
nodeVisitor(node.typeParams, visitor),
|
|
264
292
|
nodeVisitor(node.body, visitor),
|
|
265
293
|
node.isStatic,
|
|
266
|
-
node.isFromExternal
|
|
294
|
+
node.isFromExternal,
|
|
295
|
+
node.modifierFlags,
|
|
267
296
|
)
|
|
268
297
|
}
|
|
269
298
|
if (isTSInterfaceBody(node)) {
|
|
@@ -340,6 +369,7 @@ export function visitEachChild(
|
|
|
340
369
|
nodeVisitor(node.typeParams, visitor),
|
|
341
370
|
nodeVisitor(node.typeAnnotation, visitor),
|
|
342
371
|
nodesVisitor(node.annotations, visitor),
|
|
372
|
+
node.modifierFlags,
|
|
343
373
|
)
|
|
344
374
|
}
|
|
345
375
|
if (isTryStatement(node)) {
|
|
@@ -398,7 +428,7 @@ export function visitEachChild(
|
|
|
398
428
|
nodesVisitor(node.params, visitor),
|
|
399
429
|
nodeVisitor(node.returnType, visitor),
|
|
400
430
|
false, // TODO: how to get it?
|
|
401
|
-
|
|
431
|
+
node.flags,
|
|
402
432
|
nodesVisitor(node.annotations, visitor),
|
|
403
433
|
)
|
|
404
434
|
}
|
|
@@ -409,9 +439,27 @@ export function visitEachChild(
|
|
|
409
439
|
nodeVisitor(node.value, visitor),
|
|
410
440
|
nodeVisitor(node.typeAnnotation, visitor),
|
|
411
441
|
node.modifierFlags,
|
|
442
|
+
node.isComputed,
|
|
443
|
+
node.annotations,
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
if (isProperty(node)) {
|
|
447
|
+
return factory.updateProperty(
|
|
448
|
+
node,
|
|
449
|
+
node.kind,
|
|
450
|
+
nodeVisitor(node.key, visitor),
|
|
451
|
+
nodeVisitor(node.value, visitor),
|
|
452
|
+
node.isMethod,
|
|
412
453
|
node.isComputed
|
|
413
454
|
)
|
|
414
455
|
}
|
|
456
|
+
if (isBinaryExpression(node)) {
|
|
457
|
+
return factory.updateBinaryExpression(
|
|
458
|
+
node,
|
|
459
|
+
nodeVisitor(node.left, visitor),
|
|
460
|
+
nodeVisitor(node.right, visitor),
|
|
461
|
+
node.operatorType)
|
|
462
|
+
}
|
|
415
463
|
if (isIdentifier(node)) {
|
|
416
464
|
return factory.updateIdentifier(
|
|
417
465
|
node,
|
|
@@ -419,6 +467,13 @@ export function visitEachChild(
|
|
|
419
467
|
nodeVisitor(node.typeAnnotation, visitor)
|
|
420
468
|
)
|
|
421
469
|
}
|
|
470
|
+
if (isETSNewClassInstanceExpression(node)) {
|
|
471
|
+
return factory.updateETSNewClassInstanceExpression(
|
|
472
|
+
node,
|
|
473
|
+
nodeVisitor(node.typeRef, visitor),
|
|
474
|
+
nodesVisitor(node.arguments, visitor)
|
|
475
|
+
)
|
|
476
|
+
}
|
|
422
477
|
if (isWhileStatement(node)) {
|
|
423
478
|
return factory.updateWhileStatement(
|
|
424
479
|
node,
|
|
@@ -426,5 +481,94 @@ export function visitEachChild(
|
|
|
426
481
|
nodeVisitor(node.body, visitor),
|
|
427
482
|
)
|
|
428
483
|
}
|
|
484
|
+
if (isDoWhileStatement(node)) {
|
|
485
|
+
return factory.updateDoWhileStatement(
|
|
486
|
+
node,
|
|
487
|
+
nodeVisitor(node.body, visitor),
|
|
488
|
+
nodeVisitor(node.test, visitor),
|
|
489
|
+
)
|
|
490
|
+
}
|
|
491
|
+
if (isForUpdateStatement(node)) {
|
|
492
|
+
return factory.updateForUpdateStatement(
|
|
493
|
+
node,
|
|
494
|
+
nodeVisitor(node.init, visitor),
|
|
495
|
+
nodeVisitor(node.test, visitor),
|
|
496
|
+
nodeVisitor(node.update, visitor),
|
|
497
|
+
nodeVisitor(node.body, visitor),
|
|
498
|
+
)
|
|
499
|
+
}
|
|
500
|
+
if (isForInStatement(node)) {
|
|
501
|
+
return factory.updateForInStatement(
|
|
502
|
+
node,
|
|
503
|
+
nodeVisitor(node.left, visitor),
|
|
504
|
+
nodeVisitor(node.right, visitor),
|
|
505
|
+
nodeVisitor(node.body, visitor),
|
|
506
|
+
)
|
|
507
|
+
}
|
|
508
|
+
if (isForOfStatement(node)) {
|
|
509
|
+
return factory.updateForOfStatement(
|
|
510
|
+
node,
|
|
511
|
+
nodeVisitor(node.left, visitor),
|
|
512
|
+
nodeVisitor(node.right, visitor),
|
|
513
|
+
nodeVisitor(node.body, visitor),
|
|
514
|
+
node.isAwait
|
|
515
|
+
)
|
|
516
|
+
}
|
|
517
|
+
if (isETSImportDeclaration(node)) {
|
|
518
|
+
return factory.updateETSImportDeclaration(
|
|
519
|
+
node,
|
|
520
|
+
nodeVisitor(node.source, visitor),
|
|
521
|
+
nodesVisitor(node.specifiers, visitor),
|
|
522
|
+
Es2pandaImportKinds.IMPORT_KINDS_ALL
|
|
523
|
+
)
|
|
524
|
+
}
|
|
525
|
+
if (isTSNonNullExpression(node)) {
|
|
526
|
+
return factory.updateTSNonNullExpression(
|
|
527
|
+
node,
|
|
528
|
+
nodeVisitor(node.expr, visitor)
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
if (isUpdateExpression(node)) {
|
|
532
|
+
return factory.updateUpdateExpression(
|
|
533
|
+
node,
|
|
534
|
+
nodeVisitor(node.argument, visitor),
|
|
535
|
+
node.operatorType,
|
|
536
|
+
node.isPrefix
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
if (isETSTypeReference(node)) {
|
|
540
|
+
return factory.updateETSTypeReference(
|
|
541
|
+
node,
|
|
542
|
+
nodeVisitor(node.part, visitor),
|
|
543
|
+
)
|
|
544
|
+
}
|
|
545
|
+
if (isETSTypeReferencePart(node)) {
|
|
546
|
+
return factory.updateETSTypeReferencePart(
|
|
547
|
+
node,
|
|
548
|
+
nodeVisitor(node.name, visitor),
|
|
549
|
+
nodeVisitor(node.typeParams, visitor),
|
|
550
|
+
nodeVisitor(node.previous, visitor),
|
|
551
|
+
)
|
|
552
|
+
}
|
|
553
|
+
if (isTSTypeParameterInstantiation(node)) {
|
|
554
|
+
return factory.updateTSTypeParameterInstantiation(
|
|
555
|
+
node,
|
|
556
|
+
nodesVisitor(node.params, visitor),
|
|
557
|
+
)
|
|
558
|
+
}
|
|
559
|
+
if (isTSTypeParameterDeclaration(node)) {
|
|
560
|
+
return factory.updateTSTypeParameterDeclaration(
|
|
561
|
+
node,
|
|
562
|
+
nodesVisitor(node.params, visitor),
|
|
563
|
+
node.requiredParams,
|
|
564
|
+
)
|
|
565
|
+
}
|
|
566
|
+
/** TODO: fix this case!
|
|
567
|
+
if (isClassStaticBlock(node)) {
|
|
568
|
+
return factory.updateClassStaticBlock(
|
|
569
|
+
|
|
570
|
+
)
|
|
571
|
+
nodeVisitor(node.function, visitor)
|
|
572
|
+
} */
|
|
429
573
|
return node
|
|
430
574
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
// koala-wrapper compatibility helpers
|
|
17
|
+
|
|
18
|
+
import { KNativePointer } from "@koalaui/interop"
|
|
19
|
+
import { ETSModule } from "../generated"
|
|
20
|
+
import { createETSModuleFromContext } from "./utilities/public"
|
|
21
|
+
import { global } from "./static/global"
|
|
22
|
+
|
|
23
|
+
export class EtsScript {
|
|
24
|
+
public static fromContext(): ETSModule {
|
|
25
|
+
return createETSModuleFromContext()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function destroyConfig(config: KNativePointer): void {
|
|
30
|
+
global.es2panda._DestroyConfig(config)
|
|
31
|
+
global.resetConfig()
|
|
32
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as fs from "fs"
|
|
2
|
+
import * as path from "path"
|
|
3
|
+
|
|
4
|
+
function reportErrorAndExit(message: string): never {
|
|
5
|
+
console.error(message)
|
|
6
|
+
process.exit(1)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function checkSDK() {
|
|
10
|
+
const panda = process.env.PANDA_SDK_PATH
|
|
11
|
+
if (!panda)
|
|
12
|
+
reportErrorAndExit(`Variable PANDA_SDK_PATH is not set, please fix`)
|
|
13
|
+
if (!fs.existsSync(path.join(panda, 'package.json')))
|
|
14
|
+
reportErrorAndExit(`Variable PANDA_SDK_PATH not points to SDK`)
|
|
15
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(panda, 'package.json')).toString())
|
|
16
|
+
const version = packageJson.version as string
|
|
17
|
+
if (!version)
|
|
18
|
+
reportErrorAndExit(`version is unknown`)
|
|
19
|
+
const packageJsonOur = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json')).toString())
|
|
20
|
+
const expectedVersion = packageJsonOur.config.panda_sdk_version
|
|
21
|
+
if (expectedVersion && expectedVersion != "next" && version != expectedVersion)
|
|
22
|
+
console.log(`WARNING: Panda SDK version "${version}" doesn't match expected "${expectedVersion}"`)
|
|
23
|
+
else
|
|
24
|
+
console.log(`Using Panda ${version}`)
|
|
25
|
+
}
|