@swagger-api/apidom-parser-adapter-yaml-1-2 1.2.1 → 1.2.2

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,12 @@
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.2.2](https://github.com/swagger-api/apidom/compare/v1.2.1...v1.2.2) (2026-01-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **parser:** fix tree being deleted before analysis completion ([#5099](https://github.com/swagger-api/apidom/issues/5099)) ([5bf6eaf](https://github.com/swagger-api/apidom/commit/5bf6eaf99d04eccef8a4c563afe03e206a3c0df7))
11
+
6
12
  ## [1.2.1](https://github.com/swagger-api/apidom/compare/v1.2.0...v1.2.1) (2026-01-16)
7
13
 
8
14
  ### Bug Fixes
@@ -4075,12 +4075,6 @@ let parser = null;
4075
4075
  let parserInitLock = null;
4076
4076
  let currentTree = null;
4077
4077
 
4078
- // clear the old Wasm-allocated tree & reset the parser state
4079
- const releaseResources = () => {
4080
- currentTree?.delete();
4081
- parser?.reset();
4082
- };
4083
-
4084
4078
  /**
4085
4079
  * Lexical Analysis of source string using WebTreeSitter.
4086
4080
  * This is WebAssembly version of TreeSitters Lexical Analysis.
@@ -4090,7 +4084,6 @@ const releaseResources = () => {
4090
4084
  * @public
4091
4085
  */
4092
4086
  const analyze = async source => {
4093
- releaseResources();
4094
4087
  if (parser === null && parserInitLock === null) {
4095
4088
  // acquire lock
4096
4089
  parserInitLock = web_tree_sitter__WEBPACK_IMPORTED_MODULE_0___default().init().then(() => web_tree_sitter__WEBPACK_IMPORTED_MODULE_0___default().Language.load(_wasm_tree_sitter_yaml_wasm__WEBPACK_IMPORTED_MODULE_1__["default"])).then(jsonLanguage => {
@@ -4109,6 +4102,7 @@ const analyze = async source => {
4109
4102
  throw new _swagger_api_apidom_error__WEBPACK_IMPORTED_MODULE_2__["default"]('Error while initializing web-tree-sitter and loading tree-sitter-yaml grammar.');
4110
4103
  }
4111
4104
  currentTree = parser.parse(source);
4105
+ parser.reset();
4112
4106
  return currentTree;
4113
4107
  };
4114
4108
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (analyze);
@@ -22913,7 +22907,9 @@ __webpack_require__.r(__webpack_exports__);
22913
22907
  const detect = async source => {
22914
22908
  try {
22915
22909
  const cst = await (0,_lexical_analysis_browser_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(source);
22916
- return !cst.rootNode.isError;
22910
+ const isError = !cst.rootNode.isError;
22911
+ cst.delete();
22912
+ return isError;
22917
22913
  } catch {
22918
22914
  return false;
22919
22915
  }
@@ -22934,9 +22930,11 @@ const parse = async (source, {
22934
22930
  sourceMap = false
22935
22931
  } = {}) => {
22936
22932
  const cst = await (0,_lexical_analysis_browser_ts__WEBPACK_IMPORTED_MODULE_2__["default"])(source);
22937
- return (0,_syntactic_analysis_indirect_index_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(cst, {
22933
+ const syntacticAnalysisResult = (0,_syntactic_analysis_indirect_index_ts__WEBPACK_IMPORTED_MODULE_3__["default"])(cst, {
22938
22934
  sourceMap
22939
22935
  });
22936
+ cst.delete();
22937
+ return syntacticAnalysisResult;
22940
22938
  };
22941
22939
  })();
22942
22940