@swagger-api/apidom-parser-adapter-asyncapi-json-2 1.0.0-alpha.2 → 1.0.0-alpha.5

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,14 @@
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.0.0-alpha.5](https://github.com/swagger-api/apidom/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2024-05-29)
7
+
8
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-asyncapi-json-2
9
+
10
+ # [1.0.0-alpha.3](https://github.com/swagger-api/apidom/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2024-05-21)
11
+
12
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-asyncapi-json-2
13
+
6
14
  # [1.0.0-alpha.2](https://github.com/swagger-api/apidom/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2024-05-20)
7
15
 
8
16
  **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-asyncapi-json-2
@@ -15869,7 +15869,7 @@ const cloneNode = node => Object.create(Object.getPrototypeOf(node), Object.getO
15869
15869
  * parallel. Each visitor will be visited for each node before moving on.
15870
15870
  *
15871
15871
  * If a prior visitor edits a node, no following visitors will see that node.
15872
- * `exposeEdits=true` can be used to exoise the edited node from the previous visitors.
15872
+ * `exposeEdits=true` can be used to expose the edited node from the previous visitors.
15873
15873
  */
15874
15874
 
15875
15875
  const mergeAll = (visitors, {
@@ -15883,14 +15883,21 @@ const mergeAll = (visitors, {
15883
15883
  const skipSymbol = Symbol('skip');
15884
15884
  const skipping = new Array(visitors.length).fill(skipSymbol);
15885
15885
  return {
15886
- enter(node, ...rest) {
15886
+ enter(node, key, parent, path, ancestors, link) {
15887
15887
  let currentNode = node;
15888
15888
  let hasChanged = false;
15889
+ const linkProxy = {
15890
+ ...link,
15891
+ replaceWith(newNode, replacer) {
15892
+ link.replaceWith(newNode, replacer);
15893
+ currentNode = newNode;
15894
+ }
15895
+ };
15889
15896
  for (let i = 0; i < visitors.length; i += 1) {
15890
15897
  if (skipping[i] === skipSymbol) {
15891
15898
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
15892
15899
  if (typeof visitFn === 'function') {
15893
- const result = visitFn.call(visitors[i], currentNode, ...rest);
15900
+ const result = visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
15894
15901
 
15895
15902
  // check if the visitor is async
15896
15903
  if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
@@ -15900,7 +15907,7 @@ const mergeAll = (visitors, {
15900
15907
  });
15901
15908
  }
15902
15909
  if (result === skipVisitingNodeSymbol) {
15903
- skipping[i] = node;
15910
+ skipping[i] = currentNode;
15904
15911
  } else if (result === breakSymbol) {
15905
15912
  skipping[i] = breakSymbol;
15906
15913
  } else if (result === deleteNodeSymbol) {
@@ -15918,12 +15925,20 @@ const mergeAll = (visitors, {
15918
15925
  }
15919
15926
  return hasChanged ? currentNode : undefined;
15920
15927
  },
15921
- leave(node, ...rest) {
15928
+ leave(node, key, parent, path, ancestors, link) {
15929
+ let currentNode = node;
15930
+ const linkProxy = {
15931
+ ...link,
15932
+ replaceWith(newNode, replacer) {
15933
+ link.replaceWith(newNode, replacer);
15934
+ currentNode = newNode;
15935
+ }
15936
+ };
15922
15937
  for (let i = 0; i < visitors.length; i += 1) {
15923
15938
  if (skipping[i] === skipSymbol) {
15924
- const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
15939
+ const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), true);
15925
15940
  if (typeof visitFn === 'function') {
15926
- const result = visitFn.call(visitors[i], node, ...rest);
15941
+ const result = visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
15927
15942
 
15928
15943
  // check if the visitor is async
15929
15944
  if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
@@ -15938,7 +15953,7 @@ const mergeAll = (visitors, {
15938
15953
  return result;
15939
15954
  }
15940
15955
  }
15941
- } else if (skipping[i] === node) {
15956
+ } else if (skipping[i] === currentNode) {
15942
15957
  skipping[i] = skipSymbol;
15943
15958
  }
15944
15959
  }
@@ -15957,17 +15972,24 @@ const mergeAllAsync = (visitors, {
15957
15972
  const skipSymbol = Symbol('skip');
15958
15973
  const skipping = new Array(visitors.length).fill(skipSymbol);
15959
15974
  return {
15960
- async enter(node, ...rest) {
15975
+ async enter(node, key, parent, path, ancestors, link) {
15961
15976
  let currentNode = node;
15962
15977
  let hasChanged = false;
15978
+ const linkProxy = {
15979
+ ...link,
15980
+ replaceWith(newNode, replacer) {
15981
+ link.replaceWith(newNode, replacer);
15982
+ currentNode = newNode;
15983
+ }
15984
+ };
15963
15985
  for (let i = 0; i < visitors.length; i += 1) {
15964
15986
  if (skipping[i] === skipSymbol) {
15965
15987
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
15966
15988
  if (typeof visitFn === 'function') {
15967
15989
  // eslint-disable-next-line no-await-in-loop
15968
- const result = await visitFn.call(visitors[i], currentNode, ...rest);
15990
+ const result = await visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
15969
15991
  if (result === skipVisitingNodeSymbol) {
15970
- skipping[i] = node;
15992
+ skipping[i] = currentNode;
15971
15993
  } else if (result === breakSymbol) {
15972
15994
  skipping[i] = breakSymbol;
15973
15995
  } else if (result === deleteNodeSymbol) {
@@ -15985,20 +16007,28 @@ const mergeAllAsync = (visitors, {
15985
16007
  }
15986
16008
  return hasChanged ? currentNode : undefined;
15987
16009
  },
15988
- async leave(node, ...rest) {
16010
+ async leave(node, key, parent, path, ancestors, link) {
16011
+ let currentNode = node;
16012
+ const linkProxy = {
16013
+ ...link,
16014
+ replaceWith(newNode, replacer) {
16015
+ link.replaceWith(newNode, replacer);
16016
+ currentNode = newNode;
16017
+ }
16018
+ };
15989
16019
  for (let i = 0; i < visitors.length; i += 1) {
15990
16020
  if (skipping[i] === skipSymbol) {
15991
- const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
16021
+ const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), true);
15992
16022
  if (typeof visitFn === 'function') {
15993
16023
  // eslint-disable-next-line no-await-in-loop
15994
- const result = await visitFn.call(visitors[i], node, ...rest);
16024
+ const result = await visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
15995
16025
  if (result === breakSymbol) {
15996
16026
  skipping[i] = breakSymbol;
15997
16027
  } else if (result !== undefined && result !== skipVisitingNodeSymbol) {
15998
16028
  return result;
15999
16029
  }
16000
16030
  }
16001
- } else if (skipping[i] === node) {
16031
+ } else if (skipping[i] === currentNode) {
16002
16032
  skipping[i] = skipSymbol;
16003
16033
  }
16004
16034
  }
@@ -16202,7 +16232,9 @@ visitor, {
16202
16232
  } else if (parent) {
16203
16233
  parent[key] = newNode;
16204
16234
  }
16205
- node = newNode;
16235
+ if (!isLeaving) {
16236
+ node = newNode;
16237
+ }
16206
16238
  }
16207
16239
  };
16208
16240
 
@@ -16372,7 +16404,9 @@ visitor, {
16372
16404
  } else if (parent) {
16373
16405
  parent[key] = newNode;
16374
16406
  }
16375
- node = newNode;
16407
+ if (!isLeaving) {
16408
+ node = newNode;
16409
+ }
16376
16410
  }
16377
16411
  };
16378
16412