@swagger-api/apidom-parser-adapter-json 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 +12 -0
- package/dist/apidom-parser-adapter-json.browser.js +35 -14
- package/dist/apidom-parser-adapter-json.browser.min.js +1 -1
- package/package.json +5 -5
- package/src/adapter-browser.cjs +19 -12
- package/src/adapter-browser.mjs +19 -12
- package/src/lexical-analysis/browser.cjs +23 -6
- package/src/lexical-analysis/browser.mjs +23 -6
- package/types/apidom-parser-adapter-json.d.ts +0 -3
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
|
**Note:** Version bump only for package @swagger-api/apidom-parser-adapter-json
|
|
@@ -9005,7 +9005,8 @@
|
|
|
9005
9005
|
};
|
|
9006
9006
|
let parser = null;
|
|
9007
9007
|
let parserInitLock = null;
|
|
9008
|
-
|
|
9008
|
+
const activeTrees = /* @__PURE__ */ new Set();
|
|
9009
|
+
const MAX_ACTIVE_TREES = 10;
|
|
9009
9010
|
const analyze$2 = (source) => __async$1(null, null, function* () {
|
|
9010
9011
|
if (parser === null && parserInitLock === null) {
|
|
9011
9012
|
parserInitLock = Parser.init().then(() => Parser.Language.load(treeSitterJson)).then((jsonLanguage) => {
|
|
@@ -9023,9 +9024,22 @@
|
|
|
9023
9024
|
"Error while initializing web-tree-sitter and loading tree-sitter-json grammar."
|
|
9024
9025
|
);
|
|
9025
9026
|
}
|
|
9026
|
-
|
|
9027
|
+
if (activeTrees.size >= MAX_ACTIVE_TREES) {
|
|
9028
|
+
const treesToEvict = [...activeTrees];
|
|
9029
|
+
activeTrees.clear();
|
|
9030
|
+
for (const oldTree of treesToEvict) {
|
|
9031
|
+
oldTree.delete();
|
|
9032
|
+
}
|
|
9033
|
+
}
|
|
9034
|
+
const tree = parser.parse(source);
|
|
9035
|
+
activeTrees.add(tree);
|
|
9036
|
+
const originalDelete = tree.delete;
|
|
9037
|
+
tree.delete = function deleteAndUntrack() {
|
|
9038
|
+
activeTrees.delete(this);
|
|
9039
|
+
originalDelete.call(this);
|
|
9040
|
+
};
|
|
9027
9041
|
parser.reset();
|
|
9028
|
-
return
|
|
9042
|
+
return tree;
|
|
9029
9043
|
});
|
|
9030
9044
|
|
|
9031
9045
|
/**
|
|
@@ -11791,7 +11805,7 @@
|
|
|
11791
11805
|
* @name has
|
|
11792
11806
|
* @memberOf SetCache
|
|
11793
11807
|
* @param {*} value The value to search for.
|
|
11794
|
-
* @returns {
|
|
11808
|
+
* @returns {boolean} Returns `true` if `value` is found, else `false`.
|
|
11795
11809
|
*/
|
|
11796
11810
|
|
|
11797
11811
|
var _setCacheHas;
|
|
@@ -17396,25 +17410,32 @@
|
|
|
17396
17410
|
if (!detectionRegExp.test(source)) {
|
|
17397
17411
|
return false;
|
|
17398
17412
|
}
|
|
17413
|
+
let cst = null;
|
|
17399
17414
|
try {
|
|
17400
|
-
|
|
17415
|
+
cst = yield analyze$2(source);
|
|
17401
17416
|
const isError = cst.rootNode.type !== "ERROR";
|
|
17402
|
-
cst.delete();
|
|
17403
17417
|
return isError;
|
|
17404
17418
|
} catch (e) {
|
|
17405
17419
|
return false;
|
|
17420
|
+
} finally {
|
|
17421
|
+
if (cst !== null) {
|
|
17422
|
+
cst.delete();
|
|
17423
|
+
}
|
|
17406
17424
|
}
|
|
17407
17425
|
});
|
|
17408
17426
|
const parse = (_0, ..._1) => __async(null, [_0, ..._1], function* (source, { sourceMap = false, syntacticAnalysis = "direct" } = {}) {
|
|
17409
|
-
|
|
17410
|
-
|
|
17411
|
-
|
|
17412
|
-
|
|
17413
|
-
|
|
17414
|
-
|
|
17427
|
+
let cst = null;
|
|
17428
|
+
try {
|
|
17429
|
+
cst = yield analyze$2(source);
|
|
17430
|
+
if (syntacticAnalysis === "indirect") {
|
|
17431
|
+
return analyze(cst, { sourceMap });
|
|
17432
|
+
}
|
|
17433
|
+
return analyze$1(cst, { sourceMap });
|
|
17434
|
+
} finally {
|
|
17435
|
+
if (cst !== null) {
|
|
17436
|
+
cst.delete();
|
|
17437
|
+
}
|
|
17415
17438
|
}
|
|
17416
|
-
cst.delete();
|
|
17417
|
-
return apiDOM;
|
|
17418
17439
|
});
|
|
17419
17440
|
|
|
17420
17441
|
exports.detect = detect;
|