arkanalyzer 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/lib/core/base/Expr.d.ts.map +1 -1
  2. package/lib/core/base/Expr.js +5 -3
  3. package/lib/core/common/Const.d.ts +2 -0
  4. package/lib/core/common/Const.d.ts.map +1 -1
  5. package/lib/core/common/Const.js +4 -2
  6. package/lib/core/common/EtsConst.d.ts +1 -0
  7. package/lib/core/common/EtsConst.d.ts.map +1 -1
  8. package/lib/core/common/EtsConst.js +3 -2
  9. package/lib/core/common/IRInference.d.ts +0 -7
  10. package/lib/core/common/IRInference.d.ts.map +1 -1
  11. package/lib/core/common/IRInference.js +14 -30
  12. package/lib/core/common/ModelUtils.d.ts.map +1 -1
  13. package/lib/core/common/ModelUtils.js +8 -15
  14. package/lib/core/common/TSConst.d.ts +1 -0
  15. package/lib/core/common/TSConst.d.ts.map +1 -1
  16. package/lib/core/common/TSConst.js +3 -2
  17. package/lib/core/inference/ModelInference.d.ts.map +1 -1
  18. package/lib/core/inference/ModelInference.js +25 -5
  19. package/lib/core/inference/ValueInference.d.ts +1 -36
  20. package/lib/core/inference/ValueInference.d.ts.map +1 -1
  21. package/lib/core/inference/ValueInference.js +26 -177
  22. package/lib/core/inference/abc/AbcInference.d.ts +7 -0
  23. package/lib/core/inference/abc/AbcInference.d.ts.map +1 -1
  24. package/lib/core/inference/abc/AbcInference.js +28 -2
  25. package/lib/core/inference/arkts/ArkTsInference.d.ts +43 -1
  26. package/lib/core/inference/arkts/ArkTsInference.d.ts.map +1 -1
  27. package/lib/core/inference/arkts/ArkTsInference.js +189 -2
  28. package/lib/core/model/builder/ArkClassBuilder.d.ts.map +1 -1
  29. package/lib/core/model/builder/ArkClassBuilder.js +2 -5
  30. package/lib/core/model/builder/ArkMethodBuilder.d.ts.map +1 -1
  31. package/lib/core/model/builder/ArkMethodBuilder.js +3 -3
  32. package/lib/index.d.ts +3 -0
  33. package/lib/index.d.ts.map +1 -1
  34. package/lib/index.js +7 -1
  35. package/lib/save/base/BasePrinter.d.ts.map +1 -1
  36. package/lib/save/base/BasePrinter.js +6 -5
  37. package/lib/utils/IntMap.d.ts +48 -0
  38. package/lib/utils/IntMap.d.ts.map +1 -0
  39. package/lib/utils/IntMap.js +134 -0
  40. package/lib/utils/IntWorkList.d.ts +35 -0
  41. package/lib/utils/IntWorkList.d.ts.map +1 -0
  42. package/lib/utils/IntWorkList.js +97 -0
  43. package/lib/utils/PackedSparseMap.d.ts +26 -0
  44. package/lib/utils/PackedSparseMap.d.ts.map +1 -0
  45. package/lib/utils/PackedSparseMap.js +140 -0
  46. package/lib/utils/logger.d.ts +1 -0
  47. package/lib/utils/logger.d.ts.map +1 -1
  48. package/lib/utils/logger.js +1 -0
  49. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3
+ * Copyright (c) 2024-2026 Huawei Device Co., Ltd.
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
6
6
  * You may obtain a copy of the License at
@@ -167,10 +167,10 @@ function buildMethodName(node, declaringClass, sourceFile, declaringMethod) {
167
167
  name = Const_1.CALL_SIGNATURE_NAME;
168
168
  }
169
169
  else if (ohos_typescript_1.default.isGetAccessor(node) && ohos_typescript_1.default.isIdentifier(node.name)) {
170
- name = 'Get-' + node.name.text;
170
+ name = Const_1.GETTER_PREFIX + node.name.text;
171
171
  }
172
172
  else if (ohos_typescript_1.default.isSetAccessor(node) && ohos_typescript_1.default.isIdentifier(node.name)) {
173
- name = 'Set-' + node.name.text;
173
+ name = Const_1.SETTER_PREFIX + node.name.text;
174
174
  }
175
175
  else if (ohos_typescript_1.default.isArrowFunction(node)) {
176
176
  name = buildAnonymousMethodName(node, declaringClass);
package/lib/index.d.ts CHANGED
@@ -79,6 +79,9 @@ export * from './utils/pathTransfer';
79
79
  export * from './utils/AstTreeUtils';
80
80
  export { LOG_LEVEL, LOG_MODULE_TYPE } from './utils/logger';
81
81
  export { default as Logger } from './utils/logger';
82
+ export { IntMap } from './utils/IntMap';
83
+ export { IntWorkList } from './utils/IntWorkList';
84
+ export { PackedSparseMap } from './utils/PackedSparseMap';
82
85
  import ts from 'ohos-typescript';
83
86
  export { ts };
84
87
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAG5E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAGzE,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD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,iBAAiB,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,CAAC"}
package/lib/index.js CHANGED
@@ -32,7 +32,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.ArkNamespace = exports.ArkFile = exports.SCCDetection = exports.BaseExplicitGraph = exports.BaseNode = exports.BaseEdge = exports.DominanceTree = exports.DominanceFinder = exports.Cfg = exports.BasicBlock = exports.UndefinedVariableSolver = exports.UndefinedVariableChecker = exports.Fact = exports.PathEdge = exports.PathEdgePoint = exports.DataflowSolver = exports.DataflowResult = exports.DataflowProblem = exports.Scope = exports.VisibleValue = exports.ValueUtil = exports.TypeInference = exports.StmtUseReplacer = exports.RefUseReplacer = exports.IRUtils = exports.ExprUseReplacer = exports.DummyMainCreater = exports.ModelUtils = exports.FullPosition = exports.LineColPosition = exports.Local = exports.DefUseChain = exports.Decorator = exports.Constant = exports.DVFGBuilder = exports.DVFG = exports.DiffPTData = exports.PtsSet = exports.PointerAnalysisConfig = exports.PointerAnalysis = exports.PagBuilder = exports.CSFuncID = exports.DummyCallCreator = exports.CallGraphBuilder = exports.CGStat = exports.PAGStat = exports.PTAStat = exports.RapidTypeAnalysis = exports.ClassHierarchyAnalysis = exports.AbstractAnalysis = void 0;
35
- exports.ts = exports.Logger = exports.LOG_MODULE_TYPE = exports.LOG_LEVEL = exports.ViewTreePrinter = exports.GraphPrinter = exports.JsonPrinter = exports.SourceFilePrinter = exports.SourceNamespacePrinter = exports.SourceClassPrinter = exports.SourceMethodPrinter = exports.DotFilePrinter = exports.DotNamespacePrinter = exports.DotClassPrinter = exports.DotMethodPrinter = exports.PrinterBuilder = exports.Printer = exports.Scene = exports.SceneConfig = exports.ArkBody = exports.ImportInfo = exports.ExportInfo = exports.ArkField = exports.ArkMethod = exports.ArkClass = void 0;
35
+ exports.ts = exports.PackedSparseMap = exports.IntWorkList = exports.IntMap = exports.Logger = exports.LOG_MODULE_TYPE = exports.LOG_LEVEL = exports.ViewTreePrinter = exports.GraphPrinter = exports.JsonPrinter = exports.SourceFilePrinter = exports.SourceNamespacePrinter = exports.SourceClassPrinter = exports.SourceMethodPrinter = exports.DotFilePrinter = exports.DotNamespacePrinter = exports.DotClassPrinter = exports.DotMethodPrinter = exports.PrinterBuilder = exports.Printer = exports.Scene = exports.SceneConfig = exports.ArkBody = exports.ImportInfo = exports.ExportInfo = exports.ArkField = exports.ArkMethod = exports.ArkClass = void 0;
36
36
  // callgraph/algorithm
37
37
  var AbstractAnalysis_1 = require("./callgraph/algorithm/AbstractAnalysis");
38
38
  Object.defineProperty(exports, "AbstractAnalysis", { enumerable: true, get: function () { return AbstractAnalysis_1.AbstractAnalysis; } });
@@ -198,6 +198,12 @@ Object.defineProperty(exports, "LOG_LEVEL", { enumerable: true, get: function ()
198
198
  Object.defineProperty(exports, "LOG_MODULE_TYPE", { enumerable: true, get: function () { return logger_1.LOG_MODULE_TYPE; } });
199
199
  var logger_2 = require("./utils/logger");
200
200
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return __importDefault(logger_2).default; } });
201
+ var IntMap_1 = require("./utils/IntMap");
202
+ Object.defineProperty(exports, "IntMap", { enumerable: true, get: function () { return IntMap_1.IntMap; } });
203
+ var IntWorkList_1 = require("./utils/IntWorkList");
204
+ Object.defineProperty(exports, "IntWorkList", { enumerable: true, get: function () { return IntWorkList_1.IntWorkList; } });
205
+ var PackedSparseMap_1 = require("./utils/PackedSparseMap");
206
+ Object.defineProperty(exports, "PackedSparseMap", { enumerable: true, get: function () { return PackedSparseMap_1.PackedSparseMap; } });
201
207
  //ohos-typescript
202
208
  const ohos_typescript_1 = __importDefault(require("ohos-typescript"));
203
209
  exports.ts = ohos_typescript_1.default;
@@ -1 +1 @@
1
- {"version":3,"file":"BasePrinter.d.ts","sourceRoot":"","sources":["../../../src/save/base/BasePrinter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAA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IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,OAAO,CAAC;CACzB;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAE/D;AAED,8BAAsB,WAAY,SAAQ,OAAQ,YAAW,IAAI;gBAC1C,MAAM,EAAE,MAAM;IAGjC,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B,SAAS,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI;IAMtD,SAAS,CAAC,aAAa,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI;IAOjE,SAAS,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAKtD,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAajD,SAAS,CAAC,uBAAuB,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM;WAUvD,iBAAiB,IAAI,cAAc;CAGpD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- * Copyright (c) 2025 Huawei Device Co., Ltd.
3
+ * Copyright (c) 2024-2026 Huawei Device Co., Ltd.
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
6
6
  * You may obtain a copy of the License at
@@ -19,6 +19,7 @@ const ArkBaseModel_1 = require("../../core/model/ArkBaseModel");
19
19
  const ArkClass_1 = require("../../core/model/ArkClass");
20
20
  const Printer_1 = require("../Printer");
21
21
  const PrinterUtils_1 = require("./PrinterUtils");
22
+ const Const_1 = require("../../core/common/Const");
22
23
  let printerOptions = { pureTs: false, noMethodBody: false };
23
24
  function setPrinterOptions(options) {
24
25
  printerOptions = Object.assign(Object.assign({}, printerOptions), options);
@@ -47,11 +48,11 @@ class BasePrinter extends Printer_1.Printer {
47
48
  if (name === '_Constructor') {
48
49
  return 'constructor';
49
50
  }
50
- if (name.startsWith('Get-')) {
51
- return name.replace('Get-', 'get ');
51
+ if (name.startsWith(Const_1.GETTER_PREFIX)) {
52
+ return name.replace(Const_1.GETTER_PREFIX, 'get ');
52
53
  }
53
- if (name.startsWith('Set-')) {
54
- return name.replace('Set-', 'set ');
54
+ if (name.startsWith(Const_1.SETTER_PREFIX)) {
55
+ return name.replace(Const_1.SETTER_PREFIX, 'set ');
55
56
  }
56
57
  return name;
57
58
  }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A memory-efficient Map-like structure where keys are integers and values are lists of integers.
3
+ * Uses a static linked list approach based on TypedArrays (SoA) to avoid JS object overhead.
4
+ *
5
+ * Memory per entry: 8 bytes (value + next pointer).
6
+ * Memory per key: 4 bytes (head pointer).
7
+ */
8
+ export declare class IntMap {
9
+ private heads;
10
+ private values;
11
+ private nexts;
12
+ private count;
13
+ private capacity;
14
+ private keyRange;
15
+ /**
16
+ * @param keyRange - The maximum value of keys (nodeCapacity).
17
+ * @param initialCapacity - The initial total number of values across all keys.
18
+ */
19
+ constructor(keyRange: number, initialCapacity?: number);
20
+ /**
21
+ * Add a value to the list associated with the key.
22
+ */
23
+ add(key: number, value: number): void;
24
+ /**
25
+ * Check if the list for a key contains a value.
26
+ */
27
+ contains(key: number, value: number): boolean;
28
+ /**
29
+ * Add a value only if it doesn't already exist in the key's list.
30
+ */
31
+ addUnique(key: number, value: number): boolean;
32
+ /**
33
+ * Get an iterator for the values associated with a key.
34
+ * Efficient for loops: for (const v of map.getValues(key)) { ... }
35
+ */
36
+ getValues(key: number): IterableIterator<number>;
37
+ /**
38
+ * Get all values as an array (less efficient due to allocation).
39
+ */
40
+ getAsArray(key: number): number[];
41
+ /**
42
+ * Check if a key has any values.
43
+ */
44
+ has(key: number): boolean;
45
+ private resizeHeads;
46
+ private resizeCapacity;
47
+ }
48
+ //# sourceMappingURL=IntMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntMap.d.ts","sourceRoot":"","sources":["../../src/utils/IntMap.ts"],"names":[],"mappings":"AAeA;;;;;;GAMG;AACH,qBAAa,MAAM;IACf,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;OAGG;gBACS,QAAQ,EAAE,MAAM,EAAE,eAAe,GAAE,MAAa;IAQ5D;;OAEG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAe5C;;OAEG;IACI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAcpD;;OAEG;IACI,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO;IAQrD;;;OAGG;IACK,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC;IAWxD;;OAEG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE;IAaxC;;OAEG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAOhC,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,cAAc;CAUzB"}
@@ -0,0 +1,134 @@
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.IntMap = void 0;
18
+ /**
19
+ * A memory-efficient Map-like structure where keys are integers and values are lists of integers.
20
+ * Uses a static linked list approach based on TypedArrays (SoA) to avoid JS object overhead.
21
+ *
22
+ * Memory per entry: 8 bytes (value + next pointer).
23
+ * Memory per key: 4 bytes (head pointer).
24
+ */
25
+ class IntMap {
26
+ /**
27
+ * @param keyRange - The maximum value of keys (nodeCapacity).
28
+ * @param initialCapacity - The initial total number of values across all keys.
29
+ */
30
+ constructor(keyRange, initialCapacity = 1024) {
31
+ this.count = 0;
32
+ this.keyRange = keyRange;
33
+ this.capacity = initialCapacity;
34
+ this.heads = new Int32Array(keyRange).fill(-1);
35
+ this.values = new Int32Array(initialCapacity);
36
+ this.nexts = new Int32Array(initialCapacity);
37
+ }
38
+ /**
39
+ * Add a value to the list associated with the key.
40
+ */
41
+ add(key, value) {
42
+ if (key >= this.keyRange) {
43
+ this.resizeHeads(key + 1);
44
+ }
45
+ if (this.count >= this.capacity) {
46
+ this.resizeCapacity();
47
+ }
48
+ const idx = this.count++;
49
+ this.values[idx] = value;
50
+ this.nexts[idx] = this.heads[key];
51
+ this.heads[key] = idx;
52
+ }
53
+ /**
54
+ * Check if the list for a key contains a value.
55
+ */
56
+ contains(key, value) {
57
+ if (key >= this.keyRange) {
58
+ return false;
59
+ }
60
+ let curr = this.heads[key];
61
+ while (curr !== -1) {
62
+ if (this.values[curr] === value) {
63
+ return true;
64
+ }
65
+ curr = this.nexts[curr];
66
+ }
67
+ return false;
68
+ }
69
+ /**
70
+ * Add a value only if it doesn't already exist in the key's list.
71
+ */
72
+ addUnique(key, value) {
73
+ if (this.contains(key, value)) {
74
+ return false;
75
+ }
76
+ this.add(key, value);
77
+ return true;
78
+ }
79
+ /**
80
+ * Get an iterator for the values associated with a key.
81
+ * Efficient for loops: for (const v of map.getValues(key)) { ... }
82
+ */
83
+ *getValues(key) {
84
+ if (key >= this.keyRange) {
85
+ return;
86
+ }
87
+ let curr = this.heads[key];
88
+ while (curr !== -1) {
89
+ yield this.values[curr];
90
+ curr = this.nexts[curr];
91
+ }
92
+ }
93
+ /**
94
+ * Get all values as an array (less efficient due to allocation).
95
+ */
96
+ getAsArray(key) {
97
+ const result = [];
98
+ if (key >= this.keyRange) {
99
+ return result;
100
+ }
101
+ let curr = this.heads[key];
102
+ while (curr !== -1) {
103
+ result.push(this.values[curr]);
104
+ curr = this.nexts[curr];
105
+ }
106
+ return result;
107
+ }
108
+ /**
109
+ * Check if a key has any values.
110
+ */
111
+ has(key) {
112
+ if (key >= this.keyRange) {
113
+ return false;
114
+ }
115
+ return this.heads[key] !== -1;
116
+ }
117
+ resizeHeads(newRange) {
118
+ const newHeads = new Int32Array(newRange * 2).fill(-1);
119
+ newHeads.set(this.heads);
120
+ this.heads = newHeads;
121
+ this.keyRange = newHeads.length;
122
+ }
123
+ resizeCapacity() {
124
+ const newCapacity = this.capacity * 2;
125
+ const newValues = new Int32Array(newCapacity);
126
+ const newNexts = new Int32Array(newCapacity);
127
+ newValues.set(this.values);
128
+ newNexts.set(this.nexts);
129
+ this.values = newValues;
130
+ this.nexts = newNexts;
131
+ this.capacity = newCapacity;
132
+ }
133
+ }
134
+ exports.IntMap = IntMap;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * High-performance circular buffer worklist for integer IDs.
3
+ * Uses Int32Array to avoid object allocation and GC overhead.
4
+ */
5
+ export declare class IntWorkList {
6
+ private buffer;
7
+ private head;
8
+ private tail;
9
+ private count;
10
+ private capacity;
11
+ private mask;
12
+ constructor(initialCapacity?: number);
13
+ /**
14
+ * Add a value to the end of the worklist.
15
+ */
16
+ push(value: number): void;
17
+ /**
18
+ * Remove and return the value from the front of the worklist.
19
+ * Returns undefined if empty.
20
+ */
21
+ pop(): number | undefined;
22
+ /**
23
+ * Check if the worklist is empty.
24
+ */
25
+ isEmpty(): boolean;
26
+ /**
27
+ * Get the number of elements in the worklist.
28
+ */
29
+ size(): number;
30
+ /**
31
+ * Double the capacity of the buffer.
32
+ */
33
+ private resize;
34
+ }
35
+ //# sourceMappingURL=IntWorkList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntWorkList.d.ts","sourceRoot":"","sources":["../../src/utils/IntWorkList.ts"],"names":[],"mappings":"AAeA;;;GAGG;AACH,qBAAa,WAAW;IACpB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,IAAI,CAAS;gBAGT,eAAe,GAAE,MAAa;IAU1C;;OAEG;IACI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAShC;;;OAGG;IACI,GAAG,IAAI,MAAM,GAAG,SAAS;IAUhC;;OAEG;IACI,OAAO,IAAI,OAAO;IAIzB;;OAEG;IACI,IAAI,IAAI,MAAM;IAIrB;;OAEG;IACH,OAAO,CAAC,MAAM;CAsBjB"}
@@ -0,0 +1,97 @@
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.IntWorkList = void 0;
18
+ /**
19
+ * High-performance circular buffer worklist for integer IDs.
20
+ * Uses Int32Array to avoid object allocation and GC overhead.
21
+ */
22
+ class IntWorkList {
23
+ // Default start with 1K capacity
24
+ constructor(initialCapacity = 1024) {
25
+ this.head = 0;
26
+ this.tail = 0;
27
+ this.count = 0;
28
+ // Ensure power of 2 capacity for efficient masking
29
+ this.capacity = 1;
30
+ while (this.capacity < initialCapacity) {
31
+ this.capacity <<= 1;
32
+ }
33
+ this.mask = this.capacity - 1;
34
+ this.buffer = new Int32Array(this.capacity);
35
+ }
36
+ /**
37
+ * Add a value to the end of the worklist.
38
+ */
39
+ push(value) {
40
+ if (this.count === this.capacity) {
41
+ this.resize();
42
+ }
43
+ this.buffer[this.tail] = value;
44
+ this.tail = (this.tail + 1) & this.mask;
45
+ this.count++;
46
+ }
47
+ /**
48
+ * Remove and return the value from the front of the worklist.
49
+ * Returns undefined if empty.
50
+ */
51
+ pop() {
52
+ if (this.count === 0) {
53
+ return undefined;
54
+ }
55
+ const value = this.buffer[this.head];
56
+ this.head = (this.head + 1) & this.mask;
57
+ this.count--;
58
+ return value;
59
+ }
60
+ /**
61
+ * Check if the worklist is empty.
62
+ */
63
+ isEmpty() {
64
+ return this.count === 0;
65
+ }
66
+ /**
67
+ * Get the number of elements in the worklist.
68
+ */
69
+ size() {
70
+ return this.count;
71
+ }
72
+ /**
73
+ * Double the capacity of the buffer.
74
+ */
75
+ resize() {
76
+ const oldCapacity = this.capacity;
77
+ const newCapacity = oldCapacity << 1;
78
+ const newBuffer = new Int32Array(newCapacity);
79
+ // Copy data to the beginning of the new buffer to linearize it
80
+ if (this.count > 0) {
81
+ if (this.head < this.tail) {
82
+ newBuffer.set(this.buffer.subarray(this.head, this.tail), 0);
83
+ }
84
+ else {
85
+ const firstPartLen = oldCapacity - this.head;
86
+ newBuffer.set(this.buffer.subarray(this.head, oldCapacity), 0);
87
+ newBuffer.set(this.buffer.subarray(0, this.tail), firstPartLen);
88
+ }
89
+ }
90
+ this.buffer = newBuffer;
91
+ this.capacity = newCapacity;
92
+ this.mask = newCapacity - 1;
93
+ this.head = 0;
94
+ this.tail = this.count;
95
+ }
96
+ }
97
+ exports.IntWorkList = IntWorkList;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * PackedSparseMap - A memory-efficient sparse index with packed storage.
3
+ *
4
+ * Implements a two-level indexing structure:
5
+ * - First level: Owner-based segmentation (sparse)
6
+ * - Second level: Sorted key-value pairs within each owner (packed)
7
+ *
8
+ */
9
+ export declare class PackedSparseMap {
10
+ private offsets;
11
+ private lengths;
12
+ private capacities;
13
+ private keys;
14
+ private values;
15
+ private poolSize;
16
+ private poolCapacity;
17
+ constructor(initialOwnerCapacity: number, initialPoolCapacity: number);
18
+ getOrInsert(owner: number, key: number, createValue: () => number): number;
19
+ private binarySearch;
20
+ private binarySearchInsertPosition;
21
+ private ensureOwnerCapacity;
22
+ private ensureOwnerListCapacity;
23
+ private ensurePoolCapacity;
24
+ private resizeOwners;
25
+ }
26
+ //# sourceMappingURL=PackedSparseMap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PackedSparseMap.d.ts","sourceRoot":"","sources":["../../src/utils/PackedSparseMap.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,YAAY,CAAS;gBAEjB,oBAAoB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM;IAU9D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,MAAM,GAAG,MAAM;IA4BjF,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,0BAA0B;IAIlC,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,uBAAuB;IAuB/B,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,YAAY;CAWvB"}
@@ -0,0 +1,140 @@
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.PackedSparseMap = void 0;
18
+ /**
19
+ * PackedSparseMap - A memory-efficient sparse index with packed storage.
20
+ *
21
+ * Implements a two-level indexing structure:
22
+ * - First level: Owner-based segmentation (sparse)
23
+ * - Second level: Sorted key-value pairs within each owner (packed)
24
+ *
25
+ */
26
+ class PackedSparseMap {
27
+ constructor(initialOwnerCapacity, initialPoolCapacity) {
28
+ this.poolSize = 0;
29
+ const ownerSize = Math.max(1, initialOwnerCapacity);
30
+ this.offsets = new Int32Array(ownerSize).fill(0);
31
+ this.lengths = new Int32Array(ownerSize).fill(0);
32
+ this.capacities = new Int32Array(ownerSize).fill(0);
33
+ this.poolCapacity = Math.max(1024, initialPoolCapacity);
34
+ this.keys = new Int32Array(this.poolCapacity);
35
+ this.values = new Int32Array(this.poolCapacity);
36
+ }
37
+ getOrInsert(owner, key, createValue) {
38
+ this.ensureOwnerCapacity(owner);
39
+ const offset = this.offsets[owner];
40
+ const length = this.lengths[owner];
41
+ const searchResult = this.binarySearch(offset, length, key);
42
+ if (searchResult.found) {
43
+ return this.values[offset + searchResult.index];
44
+ }
45
+ this.ensureOwnerListCapacity(owner, length + 1);
46
+ const updatedOffset = this.offsets[owner];
47
+ const updatedLength = this.lengths[owner];
48
+ const insertPos = this.binarySearchInsertPosition(updatedOffset, updatedLength, key);
49
+ for (let i = updatedLength; i > insertPos; i--) {
50
+ this.keys[updatedOffset + i] = this.keys[updatedOffset + i - 1];
51
+ this.values[updatedOffset + i] = this.values[updatedOffset + i - 1];
52
+ }
53
+ const value = createValue();
54
+ this.keys[updatedOffset + insertPos] = key;
55
+ this.values[updatedOffset + insertPos] = value;
56
+ this.lengths[owner] = updatedLength + 1;
57
+ return value;
58
+ }
59
+ binarySearch(offset, length, key) {
60
+ let low = 0;
61
+ let high = length - 1;
62
+ while (low <= high) {
63
+ const mid = (low + high) >>> 1;
64
+ const current = this.keys[offset + mid];
65
+ if (current === key) {
66
+ return { found: true, index: mid };
67
+ }
68
+ if (current < key) {
69
+ low = mid + 1;
70
+ }
71
+ else {
72
+ high = mid - 1;
73
+ }
74
+ }
75
+ return { found: false, index: low };
76
+ }
77
+ binarySearchInsertPosition(offset, length, key) {
78
+ return this.binarySearch(offset, length, key).index;
79
+ }
80
+ ensureOwnerCapacity(owner) {
81
+ if (owner < this.offsets.length) {
82
+ return;
83
+ }
84
+ let newSize = this.offsets.length;
85
+ if (newSize === 0) {
86
+ newSize = 1;
87
+ }
88
+ while (newSize <= owner) {
89
+ newSize <<= 1;
90
+ }
91
+ this.resizeOwners(newSize);
92
+ }
93
+ ensureOwnerListCapacity(owner, required) {
94
+ const cap = this.capacities[owner];
95
+ if (cap >= required) {
96
+ return;
97
+ }
98
+ const newCap = cap === 0 ? Math.max(4, required) : Math.max(cap << 1, required);
99
+ this.ensurePoolCapacity(newCap);
100
+ const oldOffset = this.offsets[owner];
101
+ const len = this.lengths[owner];
102
+ const newOffset = this.poolSize;
103
+ for (let i = 0; i < len; i++) {
104
+ this.keys[newOffset + i] = this.keys[oldOffset + i];
105
+ this.values[newOffset + i] = this.values[oldOffset + i];
106
+ }
107
+ this.offsets[owner] = newOffset;
108
+ this.capacities[owner] = newCap;
109
+ this.poolSize += newCap;
110
+ }
111
+ ensurePoolCapacity(additional) {
112
+ const required = this.poolSize + additional;
113
+ if (required <= this.poolCapacity) {
114
+ return;
115
+ }
116
+ let newCapacity = Math.max(this.poolCapacity << 1, 1024);
117
+ while (newCapacity < required) {
118
+ newCapacity <<= 1;
119
+ }
120
+ const newKeys = new Int32Array(newCapacity);
121
+ const newValues = new Int32Array(newCapacity);
122
+ newKeys.set(this.keys);
123
+ newValues.set(this.values);
124
+ this.keys = newKeys;
125
+ this.values = newValues;
126
+ this.poolCapacity = newCapacity;
127
+ }
128
+ resizeOwners(newSize) {
129
+ const newOffsets = new Int32Array(newSize);
130
+ const newLengths = new Int32Array(newSize);
131
+ const newCaps = new Int32Array(newSize);
132
+ newOffsets.set(this.offsets);
133
+ newLengths.set(this.lengths);
134
+ newCaps.set(this.capacities);
135
+ this.offsets = newOffsets;
136
+ this.lengths = newLengths;
137
+ this.capacities = newCaps;
138
+ }
139
+ }
140
+ exports.PackedSparseMap = PackedSparseMap;
@@ -10,6 +10,7 @@ export declare enum LOG_MODULE_TYPE {
10
10
  DEFAULT = "default",
11
11
  ARKANALYZER = "ArkAnalyzer",
12
12
  HOMECHECK = "HomeCheck",
13
+ HOMEFLOW = "HomeFlow",
13
14
  TOOL = "Tool"
14
15
  }
15
16
  export default class ConsoleLogger {
@@ -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,IAAI,SAAS;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;WAChB,SAAS,CACnB,WAAW,EAAE,MAAM,EACnB,iBAAiB,GAAE,SAA2B,EAC9C,UAAU,GAAE,SAA0B,EACtC,WAAW,GAAE,OAAe,GAC7B,IAAI;WAkDO,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAE,MAAY,GAAG,MAAM;CAWhF"}
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;WAChB,SAAS,CACnB,WAAW,EAAE,MAAM,EACnB,iBAAiB,GAAE,SAA2B,EAC9C,UAAU,GAAE,SAA0B,EACtC,WAAW,GAAE,OAAe,GAC7B,IAAI;WAkDO,SAAS,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,GAAE,MAAY,GAAG,MAAM;CAWhF"}
@@ -29,6 +29,7 @@ var LOG_MODULE_TYPE;
29
29
  LOG_MODULE_TYPE["DEFAULT"] = "default";
30
30
  LOG_MODULE_TYPE["ARKANALYZER"] = "ArkAnalyzer";
31
31
  LOG_MODULE_TYPE["HOMECHECK"] = "HomeCheck";
32
+ LOG_MODULE_TYPE["HOMEFLOW"] = "HomeFlow";
32
33
  LOG_MODULE_TYPE["TOOL"] = "Tool";
33
34
  })(LOG_MODULE_TYPE = exports.LOG_MODULE_TYPE || (exports.LOG_MODULE_TYPE = {}));
34
35
  class ConsoleLogger {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arkanalyzer",
3
- "version": "1.0.80",
4
- "commit_id": "0f01eb89",
3
+ "version": "1.0.82",
4
+ "commit_id": "7e0c11d4",
5
5
  "files": [
6
6
  "docs",
7
7
  "lib",