@swagger-api/apidom-parser-adapter-api-design-systems-yaml 1.9.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,10 @@
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-api-design-systems-yaml
9
+
6
10
  # [1.9.0](https://github.com/swagger-api/apidom/compare/v1.8.0...v1.9.0) (2026-03-30)
7
11
 
8
12
  **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-api-design-systems-yaml
@@ -18583,7 +18583,8 @@
18583
18583
 
18584
18584
  let parser = null;
18585
18585
  let parserInitLock = null;
18586
- let currentTree = null;
18586
+ const activeTrees = new Set();
18587
+ const MAX_ACTIVE_TREES = 5;
18587
18588
  const createAnalyze = treeSitterYaml => async source => {
18588
18589
  if (parser === null && parserInitLock === null) {
18589
18590
  // acquire lock
@@ -18603,12 +18604,28 @@
18603
18604
  if (parser === null) {
18604
18605
  throw new ApiDOMError('Error while initializing web-tree-sitter and loading tree-sitter-yaml grammar.');
18605
18606
  }
18606
- if (currentTree !== null) {
18607
- currentTree.delete();
18607
+
18608
+ // prevent WASM OOM during concurrency spikes by evicting oldest trees
18609
+ // when the pool exceeds threshold; tree.delete() is idempotent so
18610
+ // callers that still hold a reference can safely call delete() again
18611
+ if (activeTrees.size >= MAX_ACTIVE_TREES) {
18612
+ const treesToEvict = [...activeTrees];
18613
+ activeTrees.clear();
18614
+ for (const oldTree of treesToEvict) {
18615
+ oldTree.delete();
18616
+ }
18608
18617
  }
18609
- currentTree = parser.parse(source);
18618
+ const tree = parser.parse(source);
18619
+ activeTrees.add(tree);
18620
+
18621
+ // remove from tracking when caller deletes
18622
+ const originalDelete = tree.delete;
18623
+ tree.delete = function deleteAndUntrack() {
18624
+ activeTrees.delete(this);
18625
+ originalDelete.call(this);
18626
+ };
18610
18627
  parser.reset();
18611
- return currentTree;
18628
+ return tree;
18612
18629
  };
18613
18630
 
18614
18631
  /**
@@ -19469,13 +19486,16 @@
19469
19486
  * @public
19470
19487
  */
19471
19488
  const detect$1 = async source => {
19489
+ let cst = null;
19472
19490
  try {
19473
- const cst = await analyze$1(source);
19474
- const isError = !cst.rootNode.isError;
19475
- cst.delete();
19476
- return isError;
19491
+ cst = await analyze$1(source);
19492
+ return !cst.rootNode.isError;
19477
19493
  } catch {
19478
19494
  return false;
19495
+ } finally {
19496
+ if (cst !== null) {
19497
+ cst.delete();
19498
+ }
19479
19499
  }
19480
19500
  };
19481
19501
 
@@ -19493,12 +19513,17 @@
19493
19513
  const parse$1 = async (source, {
19494
19514
  sourceMap = false
19495
19515
  } = {}) => {
19496
- const cst = await analyze$1(source);
19497
- const syntacticAnalysisResult = analyze(cst, {
19498
- sourceMap
19499
- });
19500
- cst.delete();
19501
- return syntacticAnalysisResult;
19516
+ let cst = null;
19517
+ try {
19518
+ cst = await analyze$1(source);
19519
+ return analyze(cst, {
19520
+ sourceMap
19521
+ });
19522
+ } finally {
19523
+ if (cst !== null) {
19524
+ cst.delete();
19525
+ }
19526
+ }
19502
19527
  };
19503
19528
 
19504
19529
  /**