@swagger-api/apidom-parser-adapter-yaml-1-2 1.9.0 → 1.10.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.10.1](https://github.com/swagger-api/apidom/compare/v1.10.0...v1.10.1) (2026-04-07)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **parser-adapter:** increase active trees threshold ([#5157](https://github.com/swagger-api/apidom/issues/5157)) ([468d4d6](https://github.com/swagger-api/apidom/commit/468d4d6d7a9068badb1d2d3ce3e79fd310e8aa70))
11
+
12
+ # [1.10.0](https://github.com/swagger-api/apidom/compare/v1.9.0...v1.10.0) (2026-04-01)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **parser-adapter:** move tree lifecycle management to callers ([#5156](https://github.com/swagger-api/apidom/issues/5156)) ([30f173b](https://github.com/swagger-api/apidom/commit/30f173b6ac5a13c7f53e01440dde6ded222bd18a))
17
+
6
18
  # [1.9.0](https://github.com/swagger-api/apidom/compare/v1.8.0...v1.9.0) (2026-03-30)
7
19
 
8
20
  ### Bug Fixes
@@ -9895,7 +9895,8 @@
9895
9895
  };
9896
9896
  let parser = null;
9897
9897
  let parserInitLock = null;
9898
- let currentTree = null;
9898
+ const activeTrees = /* @__PURE__ */ new Set();
9899
+ const MAX_ACTIVE_TREES = 10;
9899
9900
  const createAnalyze = (treeSitterYaml) => (source) => __async$1(null, null, function* () {
9900
9901
  if (parser === null && parserInitLock === null) {
9901
9902
  parserInitLock = Parser.init().then(() => Parser.Language.load(treeSitterYaml)).then((yamlLanguage) => {
@@ -9914,12 +9915,22 @@
9914
9915
  "Error while initializing web-tree-sitter and loading tree-sitter-yaml grammar."
9915
9916
  );
9916
9917
  }
9917
- if (currentTree !== null) {
9918
- currentTree.delete();
9918
+ if (activeTrees.size >= MAX_ACTIVE_TREES) {
9919
+ const treesToEvict = [...activeTrees];
9920
+ activeTrees.clear();
9921
+ for (const oldTree of treesToEvict) {
9922
+ oldTree.delete();
9923
+ }
9919
9924
  }
9920
- currentTree = parser.parse(source);
9925
+ const tree = parser.parse(source);
9926
+ activeTrees.add(tree);
9927
+ const originalDelete = tree.delete;
9928
+ tree.delete = function deleteAndUntrack() {
9929
+ activeTrees.delete(this);
9930
+ originalDelete.call(this);
9931
+ };
9921
9932
  parser.reset();
9922
- return currentTree;
9933
+ return tree;
9923
9934
  });
9924
9935
 
9925
9936
  const analyze$1 = createAnalyze(treeSitterYaml);
@@ -13555,7 +13566,7 @@
13555
13566
  * @name has
13556
13567
  * @memberOf SetCache
13557
13568
  * @param {*} value The value to search for.
13558
- * @returns {number} Returns `true` if `value` is found, else `false`.
13569
+ * @returns {boolean} Returns `true` if `value` is found, else `false`.
13559
13570
  */
13560
13571
 
13561
13572
  var _setCacheHas;
@@ -19480,20 +19491,28 @@
19480
19491
  });
19481
19492
  };
19482
19493
  const detect = (source) => __async(null, null, function* () {
19494
+ let cst = null;
19483
19495
  try {
19484
- const cst = yield analyze$1(source);
19485
- const isError = !cst.rootNode.isError;
19486
- cst.delete();
19487
- return isError;
19496
+ cst = yield analyze$1(source);
19497
+ return !cst.rootNode.isError;
19488
19498
  } catch (e) {
19489
19499
  return false;
19500
+ } finally {
19501
+ if (cst !== null) {
19502
+ cst.delete();
19503
+ }
19490
19504
  }
19491
19505
  });
19492
19506
  const parse = (_0, ..._1) => __async(null, [_0, ..._1], function* (source, { sourceMap = false } = {}) {
19493
- const cst = yield analyze$1(source);
19494
- const syntacticAnalysisResult = analyze(cst, { sourceMap });
19495
- cst.delete();
19496
- return syntacticAnalysisResult;
19507
+ let cst = null;
19508
+ try {
19509
+ cst = yield analyze$1(source);
19510
+ return analyze(cst, { sourceMap });
19511
+ } finally {
19512
+ if (cst !== null) {
19513
+ cst.delete();
19514
+ }
19515
+ }
19497
19516
  });
19498
19517
 
19499
19518
  exports.detect = detect;