@swagger-api/apidom-parser-adapter-arazzo-json-1 1.8.0 → 1.10.0

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,14 @@
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.0](https://github.com/swagger-api/apidom/compare/v1.9.0...v1.10.0) (2026-04-01)
7
+
8
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-arazzo-json-1
9
+
10
+ # [1.9.0](https://github.com/swagger-api/apidom/compare/v1.8.0...v1.9.0) (2026-03-30)
11
+
12
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-arazzo-json-1
13
+
6
14
  # [1.8.0](https://github.com/swagger-api/apidom/compare/v1.7.0...v1.8.0) (2026-03-20)
7
15
 
8
16
  **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-arazzo-json-1
@@ -18150,14 +18150,12 @@
18150
18150
 
18151
18151
  let parser = null;
18152
18152
  let parserInitLock = null;
18153
- let currentTree = null;
18153
+ const activeTrees = new Set();
18154
+ const MAX_ACTIVE_TREES = 5;
18154
18155
 
18155
18156
  /**
18156
18157
  * Lexical Analysis of source string using WebTreeSitter.
18157
18158
  * This is WebAssembly version of TreeSitters Lexical Analysis.
18158
- *
18159
- * Given JavaScript doesn't support true parallelism, this
18160
- * code should be as lazy as possible and temporal safety should be fine.
18161
18159
  * @public
18162
18160
  */
18163
18161
  const analyze$2 = async source => {
@@ -18178,9 +18176,28 @@
18178
18176
  } else if (parser === null) {
18179
18177
  throw new ApiDOMError('Error while initializing web-tree-sitter and loading tree-sitter-json grammar.');
18180
18178
  }
18181
- currentTree = parser.parse(source);
18179
+
18180
+ // prevent WASM OOM during concurrency spikes by evicting oldest trees
18181
+ // when the pool exceeds threshold; tree.delete() is idempotent so
18182
+ // callers that still hold a reference can safely call delete() again
18183
+ if (activeTrees.size >= MAX_ACTIVE_TREES) {
18184
+ const treesToEvict = [...activeTrees];
18185
+ activeTrees.clear();
18186
+ for (const oldTree of treesToEvict) {
18187
+ oldTree.delete();
18188
+ }
18189
+ }
18190
+ const tree = parser.parse(source);
18191
+ activeTrees.add(tree);
18192
+
18193
+ // remove from tracking when caller deletes
18194
+ const originalDelete = tree.delete;
18195
+ tree.delete = function deleteAndUntrack() {
18196
+ activeTrees.delete(this);
18197
+ originalDelete.call(this);
18198
+ };
18182
18199
  parser.reset();
18183
- return currentTree;
18200
+ return tree;
18184
18201
  };
18185
18202
 
18186
18203
  class TreeCursorSyntaxNode {
@@ -18834,13 +18851,17 @@
18834
18851
  if (!detectionRegExp$1.test(source)) {
18835
18852
  return false;
18836
18853
  }
18854
+ let cst = null;
18837
18855
  try {
18838
- const cst = await analyze$2(source);
18856
+ cst = await analyze$2(source);
18839
18857
  const isError = cst.rootNode.type !== 'ERROR';
18840
- cst.delete();
18841
18858
  return isError;
18842
18859
  } catch {
18843
18860
  return false;
18861
+ } finally {
18862
+ if (cst !== null) {
18863
+ cst.delete();
18864
+ }
18844
18865
  }
18845
18866
  };
18846
18867
 
@@ -18859,19 +18880,22 @@
18859
18880
  sourceMap = false,
18860
18881
  syntacticAnalysis = 'direct'
18861
18882
  } = {}) => {
18862
- const cst = await analyze$2(source);
18863
- let apiDOM;
18864
- if (syntacticAnalysis === 'indirect') {
18865
- apiDOM = analyze(cst, {
18866
- sourceMap
18867
- });
18868
- } else {
18869
- apiDOM = analyze$1(cst, {
18883
+ let cst = null;
18884
+ try {
18885
+ cst = await analyze$2(source);
18886
+ if (syntacticAnalysis === 'indirect') {
18887
+ return analyze(cst, {
18888
+ sourceMap
18889
+ });
18890
+ }
18891
+ return analyze$1(cst, {
18870
18892
  sourceMap
18871
18893
  });
18894
+ } finally {
18895
+ if (cst !== null) {
18896
+ cst.delete();
18897
+ }
18872
18898
  }
18873
- cst.delete();
18874
- return apiDOM;
18875
18899
  };
18876
18900
 
18877
18901
  /**