@swagger-api/apidom-parser-adapter-yaml-1-2 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 +6 -0
- package/dist/apidom-parser-adapter-yaml-1-2.browser.js +32 -13
- package/dist/apidom-parser-adapter-yaml-1-2.browser.min.js +1 -1
- package/package.json +5 -5
- package/src/adapter-browser.cjs +18 -10
- package/src/adapter-browser.mjs +18 -10
- package/src/adapter-node.cjs +10 -4
- package/src/adapter-node.mjs +10 -4
- package/src/lexical-analysis/analyze.cjs +22 -5
- package/src/lexical-analysis/analyze.mjs +22 -5
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.10.0](https://github.com/swagger-api/apidom/compare/v1.9.0...v1.10.0) (2026-04-01)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **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))
|
|
11
|
+
|
|
6
12
|
# [1.9.0](https://github.com/swagger-api/apidom/compare/v1.8.0...v1.9.0) (2026-03-30)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -9895,7 +9895,8 @@
|
|
|
9895
9895
|
};
|
|
9896
9896
|
let parser = null;
|
|
9897
9897
|
let parserInitLock = null;
|
|
9898
|
-
|
|
9898
|
+
const activeTrees = /* @__PURE__ */ new Set();
|
|
9899
|
+
const MAX_ACTIVE_TREES = 5;
|
|
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 (
|
|
9918
|
-
|
|
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
|
-
|
|
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
|
|
9933
|
+
return tree;
|
|
9923
9934
|
});
|
|
9924
9935
|
|
|
9925
9936
|
const analyze$1 = createAnalyze(treeSitterYaml);
|
|
@@ -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
|
-
|
|
19485
|
-
|
|
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
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
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;
|