@swagger-api/apidom-ast 0.99.0 → 0.99.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 +10 -0
- package/cjs/traversal/visitor.cjs +25 -0
- package/dist/apidom-ast.browser.js +3083 -3551
- package/dist/apidom-ast.browser.min.js +1 -1
- package/es/traversal/visitor.mjs +25 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
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
|
+
## [0.99.2](https://github.com/swagger-api/apidom/compare/v0.99.1...v0.99.2) (2024-04-30)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @swagger-api/apidom-ast
|
9
|
+
|
10
|
+
## [0.99.1](https://github.com/swagger-api/apidom/compare/v0.99.0...v0.99.1) (2024-04-05)
|
11
|
+
|
12
|
+
### Bug Fixes
|
13
|
+
|
14
|
+
- **ast:** throw while visiting async visitor in sync mode ([#4009](https://github.com/swagger-api/apidom/issues/4009)) ([bd94545](https://github.com/swagger-api/apidom/commit/bd945456a202c57f25fc71c1d0148376635146ed)), closes [#4007](https://github.com/swagger-api/apidom/issues/4007)
|
15
|
+
|
6
16
|
# [0.99.0](https://github.com/swagger-api/apidom/compare/v0.98.3...v0.99.0) (2024-04-03)
|
7
17
|
|
8
18
|
### Features
|
@@ -79,6 +79,14 @@ const mergeAll = (visitors, {
|
|
79
79
|
const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
|
80
80
|
if (typeof visitFn === 'function') {
|
81
81
|
const result = visitFn.call(visitors[i], currentNode, ...rest);
|
82
|
+
|
83
|
+
// check if the visitor is async
|
84
|
+
if (typeof (result == null ? void 0 : result.then) === 'function') {
|
85
|
+
throw new _apidomError.ApiDOMStructuredError('Async visitor not supported in sync mode', {
|
86
|
+
visitor: visitors[i],
|
87
|
+
visitFn
|
88
|
+
});
|
89
|
+
}
|
82
90
|
if (result === skipVisitingNodeSymbol) {
|
83
91
|
skipping[i] = node;
|
84
92
|
} else if (result === breakSymbol) {
|
@@ -104,6 +112,14 @@ const mergeAll = (visitors, {
|
|
104
112
|
const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
|
105
113
|
if (typeof visitFn === 'function') {
|
106
114
|
const result = visitFn.call(visitors[i], node, ...rest);
|
115
|
+
|
116
|
+
// check if the visitor is async
|
117
|
+
if (typeof (result == null ? void 0 : result.then) === 'function') {
|
118
|
+
throw new _apidomError.ApiDOMStructuredError('Async visitor not supported in sync mode', {
|
119
|
+
visitor: visitors[i],
|
120
|
+
visitFn
|
121
|
+
});
|
122
|
+
}
|
107
123
|
if (result === breakSymbol) {
|
108
124
|
skipping[i] = breakSymbol;
|
109
125
|
} else if (result !== undefined && result !== skipVisitingNodeSymbol) {
|
@@ -348,6 +364,7 @@ visitor, {
|
|
348
364
|
}
|
349
365
|
let result;
|
350
366
|
if (!Array.isArray(node)) {
|
367
|
+
var _result;
|
351
368
|
if (!nodePredicate(node)) {
|
352
369
|
throw new _apidomError.ApiDOMStructuredError(`Invalid AST Node: ${String(node)}`, {
|
353
370
|
node
|
@@ -369,6 +386,14 @@ visitor, {
|
|
369
386
|
// retrieve result
|
370
387
|
result = visitFn.call(visitor, node, key, parent, path, ancestors);
|
371
388
|
}
|
389
|
+
|
390
|
+
// check if the visitor is async
|
391
|
+
if (typeof ((_result = result) == null ? void 0 : _result.then) === 'function') {
|
392
|
+
throw new _apidomError.ApiDOMStructuredError('Async visitor not supported in sync mode', {
|
393
|
+
visitor,
|
394
|
+
visitFn
|
395
|
+
});
|
396
|
+
}
|
372
397
|
if (result === breakSymbol) {
|
373
398
|
break;
|
374
399
|
}
|