arkanalyzer 1.0.93 → 2.0.0-beta1
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/lib/Config.d.ts +7 -0
- package/lib/Config.d.ts.map +1 -1
- package/lib/Scene.d.ts +134 -170
- package/lib/Scene.d.ts.map +1 -1
- package/lib/Scene.js +412 -976
- package/lib/callgraph/algorithm/AbstractAnalysis.js +3 -2
- package/lib/callgraph/algorithm/RapidTypeAnalysis.d.ts.map +1 -1
- package/lib/callgraph/algorithm/RapidTypeAnalysis.js +2 -3
- package/lib/callgraph/model/CallGraph.js +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts +1 -3
- package/lib/callgraph/pointerAnalysis/PTAUtils.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PTAUtils.js +17 -7
- package/lib/callgraph/pointerAnalysis/Pag.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/Pag.js +4 -14
- package/lib/callgraph/pointerAnalysis/PagBuilder.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PagBuilder.js +2 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/PointerAnalysis.js +1 -2
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.d.ts.map +1 -1
- package/lib/callgraph/pointerAnalysis/plugins/WorkerPlugin.js +0 -1
- package/lib/cli/commands/cg.d.ts +1 -0
- package/lib/cli/commands/cg.d.ts.map +1 -1
- package/lib/cli/commands/cg.js +22 -18
- package/lib/cli/commands/ir.d.ts +1 -0
- package/lib/cli/commands/ir.d.ts.map +1 -1
- package/lib/cli/commands/ir.js +5 -2
- package/lib/core/base/Constant.d.ts +5 -5
- package/lib/core/base/Constant.d.ts.map +1 -1
- package/lib/core/base/Constant.js +12 -9
- package/lib/core/base/Expr.d.ts +36 -20
- package/lib/core/base/Expr.d.ts.map +1 -1
- package/lib/core/base/Expr.js +206 -94
- package/lib/core/base/Local.d.ts +10 -20
- package/lib/core/base/Local.d.ts.map +1 -1
- package/lib/core/base/Local.js +25 -28
- package/lib/core/base/Position.d.ts +6 -0
- package/lib/core/base/Position.d.ts.map +1 -1
- package/lib/core/base/Position.js +37 -11
- package/lib/core/base/Ref.d.ts +45 -33
- package/lib/core/base/Ref.d.ts.map +1 -1
- package/lib/core/base/Ref.js +225 -51
- package/lib/core/base/Stmt.d.ts +19 -9
- package/lib/core/base/Stmt.d.ts.map +1 -1
- package/lib/core/base/Stmt.js +135 -52
- package/lib/core/base/Type.d.ts +67 -4
- package/lib/core/base/Type.d.ts.map +1 -1
- package/lib/core/base/Type.js +391 -20
- package/lib/core/base/TypeExpr.d.ts +6 -4
- package/lib/core/base/TypeExpr.d.ts.map +1 -1
- package/lib/core/base/TypeExpr.js +34 -10
- package/lib/core/base/Value.d.ts +20 -2
- package/lib/core/base/Value.d.ts.map +1 -1
- package/lib/core/base/Value.js +12 -0
- package/lib/core/common/ArkIRTransformer.d.ts +18 -0
- package/lib/core/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkIRTransformer.js +94 -75
- package/lib/core/common/ArkValueTransformer.d.ts +21 -3
- package/lib/core/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/core/common/ArkValueTransformer.js +458 -266
- package/lib/core/common/Builtin.d.ts +48 -24
- package/lib/core/common/Builtin.d.ts.map +1 -1
- package/lib/core/common/Builtin.js +90 -52
- package/lib/core/common/CanonicalizerValidator.d.ts +308 -0
- package/lib/core/common/CanonicalizerValidator.d.ts.map +1 -0
- package/lib/core/common/CanonicalizerValidator.js +888 -0
- package/lib/core/common/Const.d.ts +3 -3
- package/lib/core/common/Const.d.ts.map +1 -1
- package/lib/core/common/Const.js +3 -3
- package/lib/core/common/DummyMainCreater.d.ts +2 -21
- package/lib/core/common/DummyMainCreater.d.ts.map +1 -1
- package/lib/core/common/DummyMainCreater.js +8 -105
- package/lib/core/common/IRInference.d.ts +55 -3
- package/lib/core/common/IRInference.d.ts.map +1 -1
- package/lib/core/common/IRInference.js +407 -126
- package/lib/core/common/IRUtils.d.ts +1 -0
- package/lib/core/common/IRUtils.d.ts.map +1 -1
- package/lib/core/common/IRUtils.js +44 -13
- package/lib/core/common/ModelUtils.d.ts +44 -20
- package/lib/core/common/ModelUtils.d.ts.map +1 -1
- package/lib/core/common/ModelUtils.js +378 -208
- package/lib/core/common/SdkUtils.d.ts +35 -5
- package/lib/core/common/SdkUtils.d.ts.map +1 -1
- package/lib/core/common/SdkUtils.js +203 -59
- package/lib/core/common/SignatureCanonicalizer.d.ts +95 -0
- package/lib/core/common/SignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizer.js +116 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts +176 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.d.ts.map +1 -0
- package/lib/core/common/SignatureCanonicalizerRegistry.js +343 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts +69 -0
- package/lib/core/common/SignatureModelCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/SignatureModelCanonicalizer.js +109 -0
- package/lib/core/common/StmtUseReplacer.d.ts +1 -0
- package/lib/core/common/StmtUseReplacer.d.ts.map +1 -1
- package/lib/core/common/StmtUseReplacer.js +9 -0
- package/lib/core/common/StringUtils.d.ts +12 -1
- package/lib/core/common/StringUtils.d.ts.map +1 -1
- package/lib/core/common/StringUtils.js +36 -17
- package/lib/core/common/TempSignatureCanonicalizer.d.ts +82 -0
- package/lib/core/common/TempSignatureCanonicalizer.d.ts.map +1 -0
- package/lib/core/common/TempSignatureCanonicalizer.js +177 -0
- package/lib/core/common/TypeInference.d.ts +24 -6
- package/lib/core/common/TypeInference.d.ts.map +1 -1
- package/lib/core/common/TypeInference.js +243 -117
- package/lib/core/common/ValueUtil.d.ts +2 -1
- package/lib/core/common/ValueUtil.d.ts.map +1 -1
- package/lib/core/common/ValueUtil.js +4 -1
- package/lib/core/graph/Cfg.d.ts.map +1 -1
- package/lib/core/graph/Cfg.js +21 -6
- package/lib/core/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/CfgBuilder.js +46 -33
- package/lib/core/graph/builder/IfBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/IfBuilder.js +6 -2
- package/lib/core/graph/builder/ViewTreeBuilder.d.ts.map +1 -1
- package/lib/core/graph/builder/ViewTreeBuilder.js +6 -2
- package/lib/core/inference/ModelInference.d.ts +24 -4
- package/lib/core/inference/ModelInference.d.ts.map +1 -1
- package/lib/core/inference/ModelInference.js +273 -79
- package/lib/core/inference/ValueInference.d.ts +3 -2
- package/lib/core/inference/ValueInference.d.ts.map +1 -1
- package/lib/core/inference/ValueInference.js +90 -40
- package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
- package/lib/core/inference/abc/AbcInference.js +28 -15
- package/lib/core/inference/arkts/ArkTsInference.d.ts +9 -3
- package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
- package/lib/core/inference/arkts/ArkTsInference.js +54 -16
- package/lib/core/model/ArkClass.d.ts +192 -18
- package/lib/core/model/ArkClass.d.ts.map +1 -1
- package/lib/core/model/ArkClass.js +852 -122
- package/lib/core/model/ArkExport.d.ts.map +1 -1
- package/lib/core/model/ArkExport.js +1 -2
- package/lib/core/model/ArkField.d.ts +34 -2
- package/lib/core/model/ArkField.d.ts.map +1 -1
- package/lib/core/model/ArkField.js +89 -14
- package/lib/core/model/ArkFile.d.ts +72 -12
- package/lib/core/model/ArkFile.d.ts.map +1 -1
- package/lib/core/model/ArkFile.js +275 -65
- package/lib/core/model/ArkImport.d.ts.map +1 -1
- package/lib/core/model/ArkImport.js +1 -2
- package/lib/core/model/ArkMethod.d.ts +101 -15
- package/lib/core/model/ArkMethod.d.ts.map +1 -1
- package/lib/core/model/ArkMethod.js +252 -39
- package/lib/core/model/ArkModule.d.ts +1 -1
- package/lib/core/model/ArkModule.js +1 -1
- package/lib/core/model/ArkNamespace.d.ts +80 -10
- package/lib/core/model/ArkNamespace.d.ts.map +1 -1
- package/lib/core/model/ArkNamespace.js +309 -76
- package/lib/core/model/ArkSignature.d.ts +242 -18
- package/lib/core/model/ArkSignature.d.ts.map +1 -1
- package/lib/core/model/ArkSignature.js +725 -95
- package/lib/core/model/builder/ArkClassBuilder.d.ts +6 -3
- package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkClassBuilder.js +119 -73
- package/lib/core/model/builder/ArkExportBuilder.d.ts +1 -1
- package/lib/core/model/builder/ArkExportBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkExportBuilder.js +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.d.ts +0 -2
- package/lib/core/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFieldBuilder.js +9 -43
- package/lib/core/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkFileBuilder.js +32 -33
- package/lib/core/model/builder/ArkMethodBuilder.d.ts +10 -3
- package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkMethodBuilder.js +40 -26
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts +3 -2
- package/lib/core/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkNamespaceBuilder.js +45 -77
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts +9 -0
- package/lib/core/model/builder/ArkSignatureBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/ArkSignatureBuilder.js +26 -3
- package/lib/core/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/core/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/core/model/builder/BodyBuilder.js +37 -11
- package/lib/core/model/builder/builderUtils.d.ts +11 -1
- package/lib/core/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/core/model/builder/builderUtils.js +124 -90
- package/lib/frontend/FrontendBuilder.d.ts +10 -6
- package/lib/frontend/FrontendBuilder.d.ts.map +1 -1
- package/lib/frontend/FrontendBuilder.js +19 -45
- package/lib/frontend/ModuleScene.d.ts +43 -0
- package/lib/frontend/ModuleScene.d.ts.map +1 -0
- package/lib/frontend/ModuleScene.js +143 -0
- package/lib/frontend/SceneBuildStage.d.ts +15 -0
- package/lib/frontend/SceneBuildStage.d.ts.map +1 -0
- package/lib/frontend/SceneBuildStage.js +32 -0
- package/lib/frontend/SceneBuilder.d.ts +153 -0
- package/lib/frontend/SceneBuilder.d.ts.map +1 -0
- package/lib/frontend/SceneBuilder.js +859 -0
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts +0 -2
- package/lib/frontend/arktsFrontend/ArktsFrontend.d.ts.map +1 -1
- package/lib/frontend/arktsFrontend/ArktsFrontend.js +0 -18
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts +17 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.d.ts.map +1 -0
- package/lib/frontend/arktsFrontend/FileBodyRemount.js +187 -0
- package/lib/frontend/common/ModuleBuilder.d.ts +4 -2
- package/lib/frontend/common/ModuleBuilder.d.ts.map +1 -1
- package/lib/frontend/common/ModuleBuilder.js +19 -9
- package/lib/frontend/cppFrontend/CppFrontend.d.ts +0 -6
- package/lib/frontend/cppFrontend/CppFrontend.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/CppFrontend.js +0 -56
- package/lib/frontend/cppFrontend/base/Type.d.ts +7 -0
- package/lib/frontend/cppFrontend/base/Type.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/base/Type.js +29 -0
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkIRTransformer.js +56 -56
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ArkValueTransformer.js +124 -113
- package/lib/frontend/cppFrontend/common/Builtin.d.ts +29 -19
- package/lib/frontend/cppFrontend/common/Builtin.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/Builtin.js +56 -35
- package/lib/frontend/cppFrontend/common/IRInference.d.ts +7 -2
- package/lib/frontend/cppFrontend/common/IRInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRInference.js +61 -28
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts +1 -0
- package/lib/frontend/cppFrontend/common/IRUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/IRUtils.js +22 -10
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts +19 -0
- package/lib/frontend/cppFrontend/common/ModelUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/ModelUtils.js +84 -3
- package/lib/frontend/cppFrontend/common/TypeInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/common/TypeInference.js +44 -54
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/graph/builder/CfgBuilder.js +2 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts +1 -1
- package/lib/frontend/cppFrontend/inference/CxxModelInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/inference/CxxValueInference.js +41 -5
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkClassBuilder.js +18 -28
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFieldBuilder.js +2 -3
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts +2 -2
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkFileBuilder.js +31 -24
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkMethodBuilder.js +10 -16
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts +0 -2
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/ArkNamespaceBuilder.js +19 -37
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts +1 -0
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/BodyBuilder.js +30 -3
- package/lib/frontend/cppFrontend/model/builder/builderUtils.d.ts.map +1 -1
- package/lib/frontend/cppFrontend/model/builder/builderUtils.js +8 -4
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -2
- package/lib/save/json/JsonSerialization.js +2 -2
- package/lib/save/source/SourceStmt.js +1 -1
- package/lib/save/source/SourceTransformer.d.ts.map +1 -1
- package/lib/save/source/SourceTransformer.js +0 -9
- package/lib/statistics/StageStatistics.d.ts +195 -0
- package/lib/statistics/StageStatistics.d.ts.map +1 -0
- package/lib/statistics/StageStatistics.js +346 -0
- package/lib/statistics/StageStatisticsReporter.d.ts +58 -0
- package/lib/statistics/StageStatisticsReporter.d.ts.map +1 -0
- package/lib/statistics/StageStatisticsReporter.js +255 -0
- package/lib/utils/Canonicalizer.d.ts +9 -2
- package/lib/utils/Canonicalizer.d.ts.map +1 -1
- package/lib/utils/Canonicalizer.js +19 -2
- package/lib/utils/CxxSceneUtils.d.ts +7 -0
- package/lib/utils/CxxSceneUtils.d.ts.map +1 -1
- package/lib/utils/CxxSceneUtils.js +10 -1
- package/lib/utils/FileUtils.d.ts +0 -1
- package/lib/utils/FileUtils.d.ts.map +1 -1
- package/lib/utils/FileUtils.js +1 -9
- package/lib/utils/HashUtils.d.ts +9 -0
- package/lib/utils/HashUtils.d.ts.map +1 -0
- package/lib/utils/HashUtils.js +65 -0
- package/lib/utils/ModuleUtils.d.ts.map +1 -1
- package/lib/utils/ModuleUtils.js +24 -5
- package/lib/utils/VisitedSegment.d.ts +23 -0
- package/lib/utils/VisitedSegment.d.ts.map +1 -0
- package/lib/utils/VisitedSegment.js +64 -0
- package/lib/utils/callGraphUtils.d.ts.map +1 -1
- package/lib/utils/callGraphUtils.js +7 -7
- package/lib/utils/getAllFiles.d.ts.map +1 -1
- package/lib/utils/getAllFiles.js +11 -8
- package/lib/utils/logger.d.ts +4 -0
- package/lib/utils/logger.d.ts.map +1 -1
- package/lib/utils/logger.js +16 -0
- package/lib/utils/parseArkSourceFile.d.ts +33 -0
- package/lib/utils/parseArkSourceFile.d.ts.map +1 -0
- package/lib/utils/parseArkSourceFile.js +131 -0
- package/package.json +1 -1
- package/lib/node_modules/ohos-typescript/README.OpenSource +0 -11
- package/lib/node_modules/ohos-typescript/README.md +0 -81
- package/lib/node_modules/ohos-typescript/SECURITY.md +0 -41
- package/lib/node_modules/ohos-typescript/ThirdPartyNoticeText.txt +0 -193
- package/lib/node_modules/ohos-typescript/bin/tsc +0 -2
- package/lib/node_modules/ohos-typescript/bin/tsserver +0 -2
- package/lib/node_modules/ohos-typescript/lib/README.md +0 -5
- package/lib/node_modules/ohos-typescript/lib/cancellationToken.js +0 -86
- package/lib/node_modules/ohos-typescript/lib/cs/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/de/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/es/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/fr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/it/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ja/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ko/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/lib.dom.d.ts +0 -18505
- package/lib/node_modules/ohos-typescript/lib/lib.dom.iterable.d.ts +0 -341
- package/lib/node_modules/ohos-typescript/lib/lib.scripthost.d.ts +0 -327
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.d.ts +0 -6192
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.importscripts.d.ts +0 -26
- package/lib/node_modules/ohos-typescript/lib/lib.webworker.iterable.d.ts +0 -175
- package/lib/node_modules/ohos-typescript/lib/pl/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/pt-br/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/ru/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tr/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/tsc.js +0 -114551
- package/lib/node_modules/ohos-typescript/lib/tsserver.js +0 -179691
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.d.ts +0 -13648
- package/lib/node_modules/ohos-typescript/lib/tsserverlibrary.js +0 -178688
- package/lib/node_modules/ohos-typescript/lib/typesMap.json +0 -497
- package/lib/node_modules/ohos-typescript/lib/typingsInstaller.js +0 -39871
- package/lib/node_modules/ohos-typescript/lib/watchGuard.js +0 -49
- package/lib/node_modules/ohos-typescript/lib/zh-cn/diagnosticMessages.generated.json +0 -1880
- package/lib/node_modules/ohos-typescript/lib/zh-tw/diagnosticMessages.generated.json +0 -1880
- package/lib/utils/DependenciesSort.d.ts +0 -3
- package/lib/utils/DependenciesSort.d.ts.map +0 -1
- package/lib/utils/DependenciesSort.js +0 -72
- package/lib/utils/crypto_utils.d.ts +0 -6
- package/lib/utils/crypto_utils.d.ts.map +0 -1
- package/lib/utils/crypto_utils.js +0 -57
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Canonicalizer.d.ts","sourceRoot":"","sources":["../../src/utils/Canonicalizer.ts"],"names":[],"mappings":"AAmBA,KAAK,qBAAqB,GAAG,eAAe,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,gBAAgB,CAAC;AAE1G,
|
|
1
|
+
{"version":3,"file":"Canonicalizer.d.ts","sourceRoot":"","sources":["../../src/utils/Canonicalizer.ts"],"names":[],"mappings":"AAmBA,KAAK,qBAAqB,GAAG,eAAe,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,gBAAgB,CAAC;AAE1G,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,EAAE,qBAAqB,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAClC;AA+BD;;;;;GAKG;AACH,qBAAa,aAAa,CAAC,CAAC;IAExB,OAAO,CAAC,IAAI,CAAyB;IAErC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAAC,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAU;IAElD,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,cAAc,CAA6C;IAEnE,OAAO,CAAC,UAAU,CAAiC;IACnD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,YAAY,CAAiC;IACrD,OAAO,CAAC,WAAW,CAAiC;IACpD,OAAO,CAAC,cAAc,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAiC;IAEjD,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,sBAAsB,CAAa;IAE3C,OAAO,CAAC,kBAAkB,CAA4B;IAEtD;;;OAGG;gBACU,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,EACnC,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO;IAMvD;;;;OAIG;IACI,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM;IAiB7B,OAAO,CAAC,uBAAuB;IAS/B,OAAO,CAAC,yBAAyB;IAMjC;;;OAGG;IACI,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM;IAiBrC;;OAEG;IACI,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIrC;;;;;OAKG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMjC;;OAEG;IACI,IAAI,IAAI,MAAM;IAId,QAAQ,IAAI,kBAAkB;IAWrC;;OAEG;IACI,KAAK,IAAI,IAAI;IA2BpB,OAAO,CAAC,cAAc;IAyBtB,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,cAAc;IA2BtB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,oBAAoB;IAoB5B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,6BAA6B;IAYrC,OAAO,CAAC,kBAAkB;IAa1B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,iBAAiB;IAkBzB,OAAO,CAAC,iBAAiB;IAmBzB,OAAO,CAAC,iCAAiC;IAazC,OAAO,CAAC,iCAAiC;IAazC,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,kBAAkB;IAM1B;;;;;OAKG;IACI,qBAAqB,IAAI,CAAC,GAAG,SAAS;CAGhD"}
|
|
@@ -56,7 +56,7 @@ class Canonicalizer {
|
|
|
56
56
|
* Defaults to identity (using the item itself as key).
|
|
57
57
|
*/
|
|
58
58
|
constructor(keyExtractor, equalityComparer) {
|
|
59
|
-
// Array from integer ID to Item
|
|
59
|
+
// Array from integer ID to Item; undefined = removed via removeAt (ID is not recycled).
|
|
60
60
|
this.list = [];
|
|
61
61
|
this.strategy = 'uninitialized';
|
|
62
62
|
this.objectIdSymbol = Symbol('HomeFlowCanonicalizerId');
|
|
@@ -133,7 +133,18 @@ class Canonicalizer {
|
|
|
133
133
|
return this.list[id];
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* Remove the item at the given ID by setting the slot to undefined.
|
|
137
|
+
* The ID is NOT recycled — subsequent registrations still get fresh dense IDs.
|
|
138
|
+
* Note: does NOT remove the Symbol property from the object (if objectIdentity strategy);
|
|
139
|
+
* the Symbol remains for audit traceability.
|
|
140
|
+
*/
|
|
141
|
+
removeAt(id) {
|
|
142
|
+
if (id >= 0 && id < this.list.length) {
|
|
143
|
+
this.list[id] = undefined;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the total number of unique items seen so far (includes removed slots).
|
|
137
148
|
*/
|
|
138
149
|
size() {
|
|
139
150
|
return this.list.length;
|
|
@@ -444,6 +455,9 @@ class Canonicalizer {
|
|
|
444
455
|
const items = this.list;
|
|
445
456
|
this.list = [];
|
|
446
457
|
for (const item of items) {
|
|
458
|
+
if (item === undefined) {
|
|
459
|
+
continue; // Skip removed slots (IDs not recycled, holes preserved by nextById).
|
|
460
|
+
}
|
|
447
461
|
const key = this.keyExtractor(item);
|
|
448
462
|
const slot = this.findNumberSlot(key);
|
|
449
463
|
if (this.numberOccupied[slot] === 0) {
|
|
@@ -459,6 +473,9 @@ class Canonicalizer {
|
|
|
459
473
|
const items = this.list;
|
|
460
474
|
this.list = [];
|
|
461
475
|
for (const item of items) {
|
|
476
|
+
if (item === undefined) {
|
|
477
|
+
continue; // Skip removed slots.
|
|
478
|
+
}
|
|
462
479
|
const key = this.keyExtractor(item);
|
|
463
480
|
const hash = hashString(key);
|
|
464
481
|
const slot = this.findStringSlot(hash, key);
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ArkFile } from '../core/model/ArkFile';
|
|
2
|
+
/**
|
|
3
|
+
* C++ NAPI 打桩工具。当前整条调用链(`puncture` → `processApiDefine` → ...)在仓库内
|
|
4
|
+
* 零引用,处于死代码状态,保留待确认无外部依赖后再决定删除。
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Dead code: no callers anywhere in the repository. Do not add new
|
|
7
|
+
* usages; slated for removal.
|
|
8
|
+
*/
|
|
2
9
|
export declare class CxxSceneUtils {
|
|
3
10
|
static puncture(cxxModulePath: string, tsFile: ArkFile): void;
|
|
4
11
|
private static processApiDefine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CxxSceneUtils.d.ts","sourceRoot":"","sources":["../../src/utils/CxxSceneUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CxxSceneUtils.d.ts","sourceRoot":"","sources":["../../src/utils/CxxSceneUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAmBhD;;;;;;GAMG;AACH,qBAAa,aAAa;WACR,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAqBpE,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAsB/B,OAAO,CAAC,MAAM,CAAC,YAAY;IAU3B,OAAO,CAAC,MAAM,CAAC,eAAe;IAmC9B,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAUpC,OAAO,CAAC,MAAM,CAAC,YAAY;IAO3B,OAAO,CAAC,MAAM,CAAC,WAAW;CAa7B"}
|
|
@@ -53,7 +53,15 @@ const ArkField_1 = require("../core/model/ArkField");
|
|
|
53
53
|
const Type_1 = require("../core/base/Type");
|
|
54
54
|
const TSConst_1 = require("../core/common/TSConst");
|
|
55
55
|
const logger_1 = __importStar(require("./logger"));
|
|
56
|
+
const SignatureCanonicalizerRegistry_1 = require("../core/common/SignatureCanonicalizerRegistry");
|
|
56
57
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'ArkValueTransformer');
|
|
58
|
+
/**
|
|
59
|
+
* C++ NAPI 打桩工具。当前整条调用链(`puncture` → `processApiDefine` → ...)在仓库内
|
|
60
|
+
* 零引用,处于死代码状态,保留待确认无外部依赖后再决定删除。
|
|
61
|
+
*
|
|
62
|
+
* @deprecated Dead code: no callers anywhere in the repository. Do not add new
|
|
63
|
+
* usages; slated for removal.
|
|
64
|
+
*/
|
|
57
65
|
class CxxSceneUtils {
|
|
58
66
|
static puncture(cxxModulePath, tsFile) {
|
|
59
67
|
var _a;
|
|
@@ -162,11 +170,12 @@ class CxxSceneUtils {
|
|
|
162
170
|
return undefined;
|
|
163
171
|
}
|
|
164
172
|
static mergeMethod(tsMtdName, tsClass, cppMtd) {
|
|
173
|
+
var _a;
|
|
165
174
|
let tsMtd = ModelUtils_1.ModelUtils.findArkModel(tsMtdName, tsClass);
|
|
166
175
|
if (tsMtd instanceof Local_1.Local || tsMtd instanceof ArkField_1.ArkField) {
|
|
167
176
|
const type = tsMtd.getType();
|
|
168
177
|
if (type instanceof Type_1.FunctionType) {
|
|
169
|
-
tsMtd =
|
|
178
|
+
tsMtd = (_a = SignatureCanonicalizerRegistry_1.SignatureCanonicalizerRegistry.getInstance().getMethodBySig(type.getMethodSignature())) !== null && _a !== void 0 ? _a : null;
|
|
170
179
|
}
|
|
171
180
|
}
|
|
172
181
|
if (tsMtd instanceof ArkMethod_1.ArkMethod && cppMtd.getBody()) {
|
package/lib/utils/FileUtils.d.ts
CHANGED
|
@@ -17,5 +17,4 @@ export declare function getFileRecursively(srcDir: string, fileName: string, vis
|
|
|
17
17
|
* @returns The first concatenated absolute path that exists; otherwise returns an empty string
|
|
18
18
|
*/
|
|
19
19
|
export declare function getFileAbsPath(srcPathList: string[], relativePath: string): string;
|
|
20
|
-
export declare function getFileSignatureMapKey(projectName: string, fileName: string): string;
|
|
21
20
|
//# sourceMappingURL=FileUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FileUtils.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/FileUtils.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAOjD,qBAAa,SAAS;IAClB,gBAAuB,WAAW;;;MAGhC;WAEY,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;WASzC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;WAUrC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;WAIrC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,QAAQ;CAmB1F;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,GAAG,CAAC,MAAM,CAAqB,GAAG,MAAM,CA2BrH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAclF"}
|
package/lib/utils/FileUtils.js
CHANGED
|
@@ -40,14 +40,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.
|
|
43
|
+
exports.getFileAbsPath = exports.getFileRecursively = exports.FileUtils = void 0;
|
|
44
44
|
const fs_1 = __importDefault(require("fs"));
|
|
45
45
|
const path_1 = __importDefault(require("path"));
|
|
46
46
|
const logger_1 = __importStar(require("./logger"));
|
|
47
47
|
const ArkFile_1 = require("../core/model/ArkFile");
|
|
48
48
|
const cppUtils_1 = require("../frontend/cppFrontend/utils/cppUtils");
|
|
49
|
-
const crypto_utils_1 = require("./crypto_utils");
|
|
50
|
-
const pathTransfer_1 = require("./pathTransfer");
|
|
51
49
|
const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER, 'FileUtils');
|
|
52
50
|
const CXX_EXTENSION_SET = (0, cppUtils_1.getCxxSourceFileExtensionSet)();
|
|
53
51
|
class FileUtils {
|
|
@@ -144,9 +142,3 @@ function getFileAbsPath(srcPathList, relativePath) {
|
|
|
144
142
|
return '';
|
|
145
143
|
}
|
|
146
144
|
exports.getFileAbsPath = getFileAbsPath;
|
|
147
|
-
function getFileSignatureMapKey(projectName, fileName) {
|
|
148
|
-
const normalizedFileName = (0, pathTransfer_1.transfer2UnixPath)(fileName);
|
|
149
|
-
const hashcode = crypto_utils_1.CryptoUtils.hashcode(`@${projectName}/${normalizedFileName}: `);
|
|
150
|
-
return `${hashcode}${path_1.default.basename(normalizedFileName)}`;
|
|
151
|
-
}
|
|
152
|
-
exports.getFileSignatureMapKey = getFileSignatureMapKey;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** MurmurHash3-style string hash with full finalization mixing. */
|
|
2
|
+
export declare function hashString32(raw: string): number;
|
|
3
|
+
/** boost-style hash combine: mix a 32-bit value into an accumulated hash. */
|
|
4
|
+
export declare function hashCombineU32(seed: number, value: number): number;
|
|
5
|
+
/** Combine an optional number: undefined mixes 0, defined mixes (1, value). */
|
|
6
|
+
export declare function hashCombineOptionalU32(seed: number, value: number | undefined): number;
|
|
7
|
+
/** Combine an optional string: undefined/empty mixes 0, defined mixes (1, hash). */
|
|
8
|
+
export declare function hashCombineOptionalString(seed: number, value: string | undefined): number;
|
|
9
|
+
//# sourceMappingURL=HashUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashUtils.d.ts","sourceRoot":"","sources":["../../src/utils/HashUtils.ts"],"names":[],"mappings":"AAeA,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoBhD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKtF;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAKzF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.hashCombineOptionalString = exports.hashCombineOptionalU32 = exports.hashCombineU32 = exports.hashString32 = void 0;
|
|
18
|
+
/** MurmurHash3-style string hash with full finalization mixing. */
|
|
19
|
+
function hashString32(raw) {
|
|
20
|
+
let h1 = 0xdeadbeef;
|
|
21
|
+
for (let i = 0; i < raw.length; i++) {
|
|
22
|
+
const c = raw.charCodeAt(i);
|
|
23
|
+
if (c >= 0xd800 && c <= 0xdbff && i + 1 < raw.length) {
|
|
24
|
+
const next = raw.charCodeAt(i + 1);
|
|
25
|
+
if (next >= 0xdc00 && next <= 0xdfff) {
|
|
26
|
+
h1 = Math.imul(h1 ^ ((0x1f << 19) | ((c - 0xd800) << 10) | (next - 0xdc00)), 0x85ebca6b);
|
|
27
|
+
i++;
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
h1 = Math.imul(h1 ^ c, 0x85ebca6b);
|
|
32
|
+
}
|
|
33
|
+
h1 ^= h1 >>> 16;
|
|
34
|
+
h1 = Math.imul(h1, 0x85ebca6b);
|
|
35
|
+
h1 ^= h1 >>> 13;
|
|
36
|
+
h1 = Math.imul(h1, 0x85ebca6b);
|
|
37
|
+
h1 ^= h1 >>> 16;
|
|
38
|
+
return h1 >>> 0;
|
|
39
|
+
}
|
|
40
|
+
exports.hashString32 = hashString32;
|
|
41
|
+
/** boost-style hash combine: mix a 32-bit value into an accumulated hash. */
|
|
42
|
+
function hashCombineU32(seed, value) {
|
|
43
|
+
let h = seed >>> 0;
|
|
44
|
+
h ^= Math.imul(value >>> 0, 0x9e3779b9);
|
|
45
|
+
h = Math.imul(h ^ (h >>> 16), 0x85ebca6b);
|
|
46
|
+
h ^= h >>> 13;
|
|
47
|
+
return h >>> 0;
|
|
48
|
+
}
|
|
49
|
+
exports.hashCombineU32 = hashCombineU32;
|
|
50
|
+
/** Combine an optional number: undefined mixes 0, defined mixes (1, value). */
|
|
51
|
+
function hashCombineOptionalU32(seed, value) {
|
|
52
|
+
if (value === undefined) {
|
|
53
|
+
return hashCombineU32(seed, 0);
|
|
54
|
+
}
|
|
55
|
+
return hashCombineU32(hashCombineU32(seed, 1), value);
|
|
56
|
+
}
|
|
57
|
+
exports.hashCombineOptionalU32 = hashCombineOptionalU32;
|
|
58
|
+
/** Combine an optional string: undefined/empty mixes 0, defined mixes (1, hash). */
|
|
59
|
+
function hashCombineOptionalString(seed, value) {
|
|
60
|
+
if (!value) {
|
|
61
|
+
return hashCombineU32(seed, 0);
|
|
62
|
+
}
|
|
63
|
+
return hashCombineU32(hashCombineU32(seed, 1), hashString32(value));
|
|
64
|
+
}
|
|
65
|
+
exports.hashCombineOptionalString = hashCombineOptionalString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ModuleUtils.ts"],"names":[],"mappings":"AA2BA,qBAAa,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIzC;
|
|
1
|
+
{"version":3,"file":"ModuleUtils.d.ts","sourceRoot":"","sources":["../../src/utils/ModuleUtils.ts"],"names":[],"mappings":"AA2BA,qBAAa,UAAU;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;gBACS,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAIzC;AAuBD,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAA+F;IAC/H,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAA8D;IAChH,OAAc,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;WAM7C,OAAO,IAAI,IAAI;IAM7B;;;;;OAKG;WAEW,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IA4CtD;;;;OAIG;WACW,iBAAiB,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;IA2BhH,OAAO,CAAC,MAAM,CAAC,eAAe;IA8B9B,OAAO,CAAC,MAAM,CAAC,iBAAiB;IA8BhC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAaxC,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAyBtC"}
|
package/lib/utils/ModuleUtils.js
CHANGED
|
@@ -69,6 +69,25 @@ class ModulePath {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
exports.ModulePath = ModulePath;
|
|
72
|
+
/**
|
|
73
|
+
* Directory entry names, memoized per directory: extension resolution scans the parent directory of
|
|
74
|
+
* every candidate path, and the same directory is scanned for many distinct specifiers. The listing
|
|
75
|
+
* is read-only within a build (the file table is fixed before signature loading), so a bounded cache
|
|
76
|
+
* is safe; {@link ModuleUtils.dispose} clears it.
|
|
77
|
+
*/
|
|
78
|
+
const DIR_ENTRY_NAMES = new Map();
|
|
79
|
+
const MAX_CACHED_DIRS = 8192;
|
|
80
|
+
function readDirEntryNames(dir) {
|
|
81
|
+
const cached = DIR_ENTRY_NAMES.get(dir);
|
|
82
|
+
if (cached !== undefined) {
|
|
83
|
+
return cached;
|
|
84
|
+
}
|
|
85
|
+
const names = fs_1.default.readdirSync(dir);
|
|
86
|
+
if (DIR_ENTRY_NAMES.size < MAX_CACHED_DIRS) {
|
|
87
|
+
DIR_ENTRY_NAMES.set(dir, names);
|
|
88
|
+
}
|
|
89
|
+
return names;
|
|
90
|
+
}
|
|
72
91
|
class ModuleUtils {
|
|
73
92
|
/*
|
|
74
93
|
* Set static field to be null, then all related objects could be freed by GC.
|
|
@@ -77,6 +96,7 @@ class ModuleUtils {
|
|
|
77
96
|
static dispose() {
|
|
78
97
|
(0, LRUCacheDecorator_1.clearLRUCache)(ModuleUtils, 'getFileRealPath');
|
|
79
98
|
this.MODULES.clear();
|
|
99
|
+
DIR_ENTRY_NAMES.clear();
|
|
80
100
|
}
|
|
81
101
|
/**
|
|
82
102
|
* Get the real file path for a given source path, resolving file extensions and checking existence.
|
|
@@ -93,14 +113,13 @@ class ModuleUtils {
|
|
|
93
113
|
const stats = fs_1.default.statSync(srcPath, { throwIfNoEntry: false });
|
|
94
114
|
const dir = (stats === null || stats === void 0 ? void 0 : stats.isDirectory()) ? srcPath : path_1.default.dirname(srcPath);
|
|
95
115
|
const baseName = (stats === null || stats === void 0 ? void 0 : stats.isDirectory()) ? 'index' : path_1.default.basename(srcPath);
|
|
96
|
-
const files =
|
|
116
|
+
const files = readDirEntryNames(dir);
|
|
97
117
|
let bestOrder = Number.POSITIVE_INFINITY;
|
|
98
118
|
let bestName = '';
|
|
99
119
|
const length = baseName.length;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (!regex.test(name)) {
|
|
120
|
+
const prefixPattern = new RegExp(`^${baseName}`, 'i');
|
|
121
|
+
for (const name of files) {
|
|
122
|
+
if (!prefixPattern.test(name)) {
|
|
104
123
|
continue;
|
|
105
124
|
}
|
|
106
125
|
const suffix = name.slice(length);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reusable, allocation-free visited tracker for hot recursive resolutions that formerly
|
|
3
|
+
* paid a `new Set()` (often as a default argument) per top-level call.
|
|
4
|
+
*
|
|
5
|
+
* Each logical traversal owns a segment: enter() marks a new base on the shared items array
|
|
6
|
+
* and returns the previous base; has()/add() operate on [base, top); leave(prevBase) nulls
|
|
7
|
+
* the segment out and restores the previous base, so nested top-level traversals stack safely
|
|
8
|
+
* on one instance. Resets are cursor-based - truncating a V8 array with length=0 would drop
|
|
9
|
+
* its backing store and reallocate on every refill. Membership is a linear pointer scan,
|
|
10
|
+
* which beats Set hashing (~50ns/op) for the shallow depths these traversals reach.
|
|
11
|
+
*/
|
|
12
|
+
export declare class VisitedSegment<T> {
|
|
13
|
+
private readonly items;
|
|
14
|
+
private base;
|
|
15
|
+
private top;
|
|
16
|
+
enter(): number;
|
|
17
|
+
/** Identity scan over the active segment; `null`/`undefined` never match, so a maybe-absent item can be passed directly. */
|
|
18
|
+
has(item: T | null | undefined): boolean;
|
|
19
|
+
add(item: T): void;
|
|
20
|
+
isEmpty(): boolean;
|
|
21
|
+
leave(prevBase: number): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=VisitedSegment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisitedSegment.d.ts","sourceRoot":"","sources":["../../src/utils/VisitedSegment.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;GAUG;AACH,qBAAa,cAAc,CAAC,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,GAAG,CAAK;IAET,KAAK,IAAI,MAAM;IAMtB,4HAA4H;IACrH,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IASxC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAIlB,OAAO,IAAI,OAAO;IAIlB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQvC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2024-2026 Huawei Device Co., Ltd.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.VisitedSegment = void 0;
|
|
18
|
+
/**
|
|
19
|
+
* A reusable, allocation-free visited tracker for hot recursive resolutions that formerly
|
|
20
|
+
* paid a `new Set()` (often as a default argument) per top-level call.
|
|
21
|
+
*
|
|
22
|
+
* Each logical traversal owns a segment: enter() marks a new base on the shared items array
|
|
23
|
+
* and returns the previous base; has()/add() operate on [base, top); leave(prevBase) nulls
|
|
24
|
+
* the segment out and restores the previous base, so nested top-level traversals stack safely
|
|
25
|
+
* on one instance. Resets are cursor-based - truncating a V8 array with length=0 would drop
|
|
26
|
+
* its backing store and reallocate on every refill. Membership is a linear pointer scan,
|
|
27
|
+
* which beats Set hashing (~50ns/op) for the shallow depths these traversals reach.
|
|
28
|
+
*/
|
|
29
|
+
class VisitedSegment {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.items = [];
|
|
32
|
+
this.base = 0;
|
|
33
|
+
this.top = 0;
|
|
34
|
+
}
|
|
35
|
+
enter() {
|
|
36
|
+
const prev = this.base;
|
|
37
|
+
this.base = this.top;
|
|
38
|
+
return prev;
|
|
39
|
+
}
|
|
40
|
+
/** Identity scan over the active segment; `null`/`undefined` never match, so a maybe-absent item can be passed directly. */
|
|
41
|
+
has(item) {
|
|
42
|
+
for (let i = this.base; i < this.top; i++) {
|
|
43
|
+
if (this.items[i] === item) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
add(item) {
|
|
50
|
+
this.items[this.top++] = item;
|
|
51
|
+
}
|
|
52
|
+
isEmpty() {
|
|
53
|
+
return this.top === this.base;
|
|
54
|
+
}
|
|
55
|
+
leave(prevBase) {
|
|
56
|
+
const nullItem = null;
|
|
57
|
+
for (let i = this.base; i < this.top; i++) {
|
|
58
|
+
this.items[i] = nullItem;
|
|
59
|
+
}
|
|
60
|
+
this.top = this.base;
|
|
61
|
+
this.base = prevBase;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.VisitedSegment = VisitedSegment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callGraphUtils.d.ts","sourceRoot":"","sources":["../../src/utils/callGraphUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7E,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAyB;IAE/C,IAAI,QAAQ,IAAI,eAAe,EAAE,CAEhC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,EAEnC;IAED,IAAI,aAAa,IAAI,eAAe,EAAE,CAErC;IAED,IAAI,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,EAExC;IAEM,cAAc,CAAC,SAAS,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAIvE,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO;IAKxD,aAAa,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAM/C,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAMpD,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAIpD,uBAAuB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;CAGnE;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAS;IAEvB,IAAI,KAAK,IAAI,KAAK,CAEjB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,EAErB;IAEM,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI;IAkBpD,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,GAAG,IAAI;IAoBnD,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"callGraphUtils.d.ts","sourceRoot":"","sources":["../../src/utils/callGraphUtils.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAM7E,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,cAAc,CAAyB;IAE/C,IAAI,QAAQ,IAAI,eAAe,EAAE,CAEhC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,eAAe,EAAE,EAEnC;IAED,IAAI,aAAa,IAAI,eAAe,EAAE,CAErC;IAED,IAAI,aAAa,CAAC,IAAI,EAAE,eAAe,EAAE,EAExC;IAEM,cAAc,CAAC,SAAS,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS;IAIvE,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,OAAO;IAKxD,aAAa,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAM/C,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAMpD,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;IAIpD,uBAAuB,CAAC,SAAS,EAAE,eAAe,GAAG,IAAI;CAGnE;AAED,qBAAa,YAAY;IACrB,OAAO,CAAC,MAAM,CAAS;IAEvB,IAAI,KAAK,IAAI,KAAK,CAEjB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,EAErB;IAEM,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI;IAkBpD,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,GAAG,IAAI;IAoBnD,kBAAkB,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,EAAE;CA4BlE;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,OAAO,CAOtG;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAY5D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,GAAG,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAsB1I;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/D"}
|
|
@@ -96,7 +96,7 @@ class SceneManager {
|
|
|
96
96
|
return targetMethod;
|
|
97
97
|
}
|
|
98
98
|
// 支持SDK调用解析
|
|
99
|
-
let file = this._scene.getFile(method.getDeclaringClassSignature().
|
|
99
|
+
let file = this._scene.getFile(method.getDeclaringClassSignature().getDeclaringFileSigID());
|
|
100
100
|
if (file) {
|
|
101
101
|
const methods = ModelUtils_1.ModelUtils.getAllMethodsInFile(file);
|
|
102
102
|
for (let methodUnderFile of methods) {
|
|
@@ -115,7 +115,7 @@ class SceneManager {
|
|
|
115
115
|
if (classInstance != null) {
|
|
116
116
|
return classInstance;
|
|
117
117
|
}
|
|
118
|
-
let sdkOrTargetProjectFile = this._scene.getFile(arkClass.
|
|
118
|
+
let sdkOrTargetProjectFile = this._scene.getFile(arkClass.getDeclaringFileSigID());
|
|
119
119
|
// TODO: support get sdk class, targetProject class waiting to be supported
|
|
120
120
|
if (sdkOrTargetProjectFile != null) {
|
|
121
121
|
for (let classUnderFile of ModelUtils_1.ModelUtils.getAllClassesInFile(sdkOrTargetProjectFile)) {
|
|
@@ -135,7 +135,11 @@ class SceneManager {
|
|
|
135
135
|
if (tempClass == null) {
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
// 当前类处理完毕,标记为已处理
|
|
139
|
+
if (!isItemRegistered(tempClass, extendedClasses, (a, b) => a.getSignature().toString() === b.getSignature().toString())) {
|
|
140
|
+
extendedClasses.push(tempClass);
|
|
141
|
+
}
|
|
142
|
+
let firstLevelSubclasses = tempClass.getExtendedClassList();
|
|
139
143
|
if (!firstLevelSubclasses) {
|
|
140
144
|
continue;
|
|
141
145
|
}
|
|
@@ -145,10 +149,6 @@ class SceneManager {
|
|
|
145
149
|
classList.push(subclass);
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
|
-
// 当前类处理完毕,标记为已处理
|
|
149
|
-
if (!isItemRegistered(tempClass, extendedClasses, (a, b) => a.getSignature().toString() === b.getSignature().toString())) {
|
|
150
|
-
extendedClasses.push(tempClass);
|
|
151
|
-
}
|
|
152
152
|
}
|
|
153
153
|
return extendedClasses;
|
|
154
154
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAllFiles.d.ts","sourceRoot":"","sources":["../../src/utils/getAllFiles.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,GAAE,MAAM,EAAO,EACrB,WAAW,GAAE,MAAM,EAAO,EAC1B,OAAO,GAAE,GAAG,CAAC,MAAM,CAAqB,GACzC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"getAllFiles.d.ts","sourceRoot":"","sources":["../../src/utils/getAllFiles.ts"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,GAAE,MAAM,EAAO,EACrB,WAAW,GAAE,MAAM,EAAO,EAC1B,OAAO,GAAE,GAAG,CAAC,MAAM,CAAqB,GACzC,MAAM,EAAE,CAEV"}
|
package/lib/utils/getAllFiles.js
CHANGED
|
@@ -55,7 +55,10 @@ const logger = logger_1.default.getLogger(logger_1.LOG_MODULE_TYPE.ARKANALYZER,
|
|
|
55
55
|
* @return string[] 提取出的文件的原始路径数组
|
|
56
56
|
*/
|
|
57
57
|
function getAllFiles(srcPath, exts, ignore = [], filenameArr = [], visited = new Set()) {
|
|
58
|
-
|
|
58
|
+
return collectFiles(srcPath, exts, new Set(ignore), filenameArr, visited);
|
|
59
|
+
}
|
|
60
|
+
exports.getAllFiles = getAllFiles;
|
|
61
|
+
function collectFiles(srcPath, exts, ignoreFiles, filenameArr, visited) {
|
|
59
62
|
// 如果源目录不存在,直接结束程序
|
|
60
63
|
if (!fs_1.default.existsSync(srcPath)) {
|
|
61
64
|
logger.error(`Input directory ${srcPath} is not exist, please check!`);
|
|
@@ -68,16 +71,17 @@ function getAllFiles(srcPath, exts, ignore = [], filenameArr = [], visited = new
|
|
|
68
71
|
}
|
|
69
72
|
visited.add(realSrc);
|
|
70
73
|
// 遍历src,判断文件类型
|
|
71
|
-
fs_1.default.readdirSync(realSrc)
|
|
74
|
+
for (const entry of fs_1.default.readdirSync(realSrc, { withFileTypes: true })) {
|
|
75
|
+
const filename = entry.name;
|
|
72
76
|
if (ignoreFiles.has(filename)) {
|
|
73
|
-
|
|
77
|
+
continue;
|
|
74
78
|
}
|
|
75
79
|
// 拼接文件的绝对路径
|
|
76
80
|
const realFile = path_1.default.resolve(realSrc, filename);
|
|
77
81
|
//TODO: 增加排除文件后缀和目录
|
|
78
|
-
//
|
|
79
|
-
if (FileUtils_1.FileUtils.isDirectory(realFile)) {
|
|
80
|
-
|
|
82
|
+
// 如果是目录,递归提取(符号链接仍需 stat,保持跟随链接的语义)
|
|
83
|
+
if (entry.isDirectory() || (entry.isSymbolicLink() && FileUtils_1.FileUtils.isDirectory(realFile))) {
|
|
84
|
+
collectFiles(realFile, exts, ignoreFiles, filenameArr, visited);
|
|
81
85
|
}
|
|
82
86
|
else {
|
|
83
87
|
// 如果是文件,则判断其扩展名是否在给定的扩展名数组中
|
|
@@ -85,7 +89,6 @@ function getAllFiles(srcPath, exts, ignore = [], filenameArr = [], visited = new
|
|
|
85
89
|
filenameArr.push(realFile);
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
}
|
|
92
|
+
}
|
|
89
93
|
return filenameArr;
|
|
90
94
|
}
|
|
91
|
-
exports.getAllFiles = getAllFiles;
|
package/lib/utils/logger.d.ts
CHANGED
|
@@ -14,7 +14,11 @@ export declare enum LOG_MODULE_TYPE {
|
|
|
14
14
|
TOOL = "Tool"
|
|
15
15
|
}
|
|
16
16
|
export default class ConsoleLogger {
|
|
17
|
+
private static readonly levelGate;
|
|
17
18
|
static configure(logFilePath: string, arkanalyzer_level?: LOG_LEVEL, tool_level?: LOG_LEVEL, use_console?: boolean): void;
|
|
18
19
|
static getLogger(log_type: LOG_MODULE_TYPE, tag?: string): Logger;
|
|
20
|
+
static isDebugEnabled(logger: Logger): boolean;
|
|
21
|
+
static isWarnEnabled(logger: Logger): boolean;
|
|
22
|
+
private static gate;
|
|
19
23
|
}
|
|
20
24
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,oBAAY,SAAS;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAClB;AAED,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,IAAI,SAAS;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC,oBAAY,SAAS;IACjB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,KAAK,UAAU;IACf,KAAK,UAAU;CAClB;AAED,oBAAY,eAAe;IACvB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,IAAI,SAAS;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAwD;WAE3E,SAAS,CACnB,WAAW,EAAE,MAAM,EACnB,iBAAiB,GAAE,SAA2B,EAC9C,UAAU,GAAE,SAA0B,EACtC,WAAW,GAAE,OAAe,GAC7B,IAAI;WAmDO,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAE,MAAY,GAAG,MAAM;WAY/D,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;WAIvC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAIpD,OAAO,CAAC,MAAM,CAAC,IAAI;CAQtB"}
|
package/lib/utils/logger.js
CHANGED
|
@@ -34,6 +34,7 @@ var LOG_MODULE_TYPE;
|
|
|
34
34
|
})(LOG_MODULE_TYPE = exports.LOG_MODULE_TYPE || (exports.LOG_MODULE_TYPE = {}));
|
|
35
35
|
class ConsoleLogger {
|
|
36
36
|
static configure(logFilePath, arkanalyzer_level = LOG_LEVEL.ERROR, tool_level = LOG_LEVEL.INFO, use_console = false) {
|
|
37
|
+
ConsoleLogger.levelGate.clear();
|
|
37
38
|
let appendersTypes = [];
|
|
38
39
|
if (logFilePath) {
|
|
39
40
|
appendersTypes.push('file');
|
|
@@ -94,5 +95,20 @@ class ConsoleLogger {
|
|
|
94
95
|
logger.addContext('tag', tag);
|
|
95
96
|
return logger;
|
|
96
97
|
}
|
|
98
|
+
static isDebugEnabled(logger) {
|
|
99
|
+
return ConsoleLogger.gate(logger).debug;
|
|
100
|
+
}
|
|
101
|
+
static isWarnEnabled(logger) {
|
|
102
|
+
return ConsoleLogger.gate(logger).warn;
|
|
103
|
+
}
|
|
104
|
+
static gate(logger) {
|
|
105
|
+
let gate = ConsoleLogger.levelGate.get(logger.category);
|
|
106
|
+
if (gate === undefined) {
|
|
107
|
+
gate = { debug: logger.isDebugEnabled(), warn: logger.isWarnEnabled() };
|
|
108
|
+
ConsoleLogger.levelGate.set(logger.category, gate);
|
|
109
|
+
}
|
|
110
|
+
return gate;
|
|
111
|
+
}
|
|
97
112
|
}
|
|
98
113
|
exports.default = ConsoleLogger;
|
|
114
|
+
ConsoleLogger.levelGate = new Map();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ts from 'ohos-typescript';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a source file, keeping the parser from building JSDoc nodes for declaration files.
|
|
4
|
+
*
|
|
5
|
+
* Documentation is read out of the raw text - `getLeadingCommentRanges` plus `substring` in
|
|
6
|
+
* ArkMetadataBuilder, and the scanner in every comment query - never out of `node.jsDoc`, so the JSDoc
|
|
7
|
+
* nodes the parser materialises are pure cost. They are 88% of the parse time of an SDK `.d.ts` file,
|
|
8
|
+
* which is where most of the build's declaration volume sits; project sources carry almost no JSDoc,
|
|
9
|
+
* so they are parsed unchanged.
|
|
10
|
+
*
|
|
11
|
+
* The parser decides from the comment opener alone, so the opener is blanked for the parse
|
|
12
|
+
* (`/**` becomes `/* `). That is one character per comment and it leaves the comment's extent and every
|
|
13
|
+
* offset in the file exactly where they were, so the only difference in the tree is the absent `jsDoc`
|
|
14
|
+
* array. The original text is put back on the SourceFile before anything reads it, which keeps
|
|
15
|
+
* text-derived comments, JSDoc metadata and line maps identical.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseArkSourceFile(fileName: string, sourceText: string, setParentNodes: boolean, options?: ts.CompilerOptions): ts.SourceFile;
|
|
18
|
+
/**
|
|
19
|
+
* Zero-allocation replacement for the parser's built-in parent fixup. The bundled walk
|
|
20
|
+
* (`setParentRecursive` -> `forEachChildRecursively` -> `gatherPossibleChildren`) allocates a
|
|
21
|
+
* children array plus a collector closure per node and grows two parallel work stacks with
|
|
22
|
+
* `unshift`/`push` - gigabytes of churn on a full build where every project file is parsed
|
|
23
|
+
* twice (signature round plus body remount). This explicit-stack walk reuses two module-level
|
|
24
|
+
* scratch arrays and one shared collector closure, and reproduces the same parent links,
|
|
25
|
+
* including the JSDoc nodes the bundled walk binds via `bindJSDoc`.
|
|
26
|
+
*
|
|
27
|
+
* The scratches are reset by cursor, never by `length = 0`: truncating a V8 array to zero
|
|
28
|
+
* drops its backing store, so every refill would reallocate from scratch (measured 12x the
|
|
29
|
+
* scavenge count of the cursor pattern). Spent slots are nulled to the high-water mark so
|
|
30
|
+
* the parsed tree stays collectable; null keeps the arrays in PACKED_ELEMENTS.
|
|
31
|
+
*/
|
|
32
|
+
export declare function fixupParentReferences(rootNode: ts.Node): void;
|
|
33
|
+
//# sourceMappingURL=parseArkSourceFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseArkSourceFile.d.ts","sourceRoot":"","sources":["../../src/utils/parseArkSourceFile.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAIjC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,eAAe,GAAG,EAAE,CAAC,UAAU,CAW7I;AAUD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,GAAG,IAAI,CAmC7D"}
|