@swagger-api/apidom-parser-adapter-api-design-systems-yaml 1.0.0-alpha.1 → 1.0.0-alpha.3

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.3](https://github.com/swagger-api/apidom/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2024-05-21)
7
+
8
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-api-design-systems-yaml
9
+
10
+ # [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)
11
+
12
+ **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-api-design-systems-yaml
13
+
6
14
  # [1.0.0-alpha.1](https://github.com/swagger-api/apidom/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2024-05-15)
7
15
 
8
16
  **Note:** Version bump only for package @swagger-api/apidom-parser-adapter-api-design-systems-yaml
@@ -15960,7 +15960,7 @@ const cloneNode = node => Object.create(Object.getPrototypeOf(node), Object.getO
15960
15960
  * parallel. Each visitor will be visited for each node before moving on.
15961
15961
  *
15962
15962
  * If a prior visitor edits a node, no following visitors will see that node.
15963
- * `exposeEdits=true` can be used to exoise the edited node from the previous visitors.
15963
+ * `exposeEdits=true` can be used to expose the edited node from the previous visitors.
15964
15964
  */
15965
15965
 
15966
15966
  const mergeAll = (visitors, {
@@ -15974,14 +15974,21 @@ const mergeAll = (visitors, {
15974
15974
  const skipSymbol = Symbol('skip');
15975
15975
  const skipping = new Array(visitors.length).fill(skipSymbol);
15976
15976
  return {
15977
- enter(node, ...rest) {
15977
+ enter(node, key, parent, path, ancestors, link) {
15978
15978
  let currentNode = node;
15979
15979
  let hasChanged = false;
15980
+ const linkProxy = {
15981
+ ...link,
15982
+ replaceWith(newNode, replacer) {
15983
+ link.replaceWith(newNode, replacer);
15984
+ currentNode = newNode;
15985
+ }
15986
+ };
15980
15987
  for (let i = 0; i < visitors.length; i += 1) {
15981
15988
  if (skipping[i] === skipSymbol) {
15982
15989
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
15983
15990
  if (typeof visitFn === 'function') {
15984
- const result = visitFn.call(visitors[i], currentNode, ...rest);
15991
+ const result = visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
15985
15992
 
15986
15993
  // check if the visitor is async
15987
15994
  if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
@@ -15991,7 +15998,7 @@ const mergeAll = (visitors, {
15991
15998
  });
15992
15999
  }
15993
16000
  if (result === skipVisitingNodeSymbol) {
15994
- skipping[i] = node;
16001
+ skipping[i] = currentNode;
15995
16002
  } else if (result === breakSymbol) {
15996
16003
  skipping[i] = breakSymbol;
15997
16004
  } else if (result === deleteNodeSymbol) {
@@ -16009,12 +16016,20 @@ const mergeAll = (visitors, {
16009
16016
  }
16010
16017
  return hasChanged ? currentNode : undefined;
16011
16018
  },
16012
- leave(node, ...rest) {
16019
+ leave(node, key, parent, path, ancestors, link) {
16020
+ let currentNode = node;
16021
+ const linkProxy = {
16022
+ ...link,
16023
+ replaceWith(newNode, replacer) {
16024
+ link.replaceWith(newNode, replacer);
16025
+ currentNode = newNode;
16026
+ }
16027
+ };
16013
16028
  for (let i = 0; i < visitors.length; i += 1) {
16014
16029
  if (skipping[i] === skipSymbol) {
16015
- const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
16030
+ const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), true);
16016
16031
  if (typeof visitFn === 'function') {
16017
- const result = visitFn.call(visitors[i], node, ...rest);
16032
+ const result = visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
16018
16033
 
16019
16034
  // check if the visitor is async
16020
16035
  if (typeof (result === null || result === void 0 ? void 0 : result.then) === 'function') {
@@ -16029,7 +16044,7 @@ const mergeAll = (visitors, {
16029
16044
  return result;
16030
16045
  }
16031
16046
  }
16032
- } else if (skipping[i] === node) {
16047
+ } else if (skipping[i] === currentNode) {
16033
16048
  skipping[i] = skipSymbol;
16034
16049
  }
16035
16050
  }
@@ -16048,17 +16063,24 @@ const mergeAllAsync = (visitors, {
16048
16063
  const skipSymbol = Symbol('skip');
16049
16064
  const skipping = new Array(visitors.length).fill(skipSymbol);
16050
16065
  return {
16051
- async enter(node, ...rest) {
16066
+ async enter(node, key, parent, path, ancestors, link) {
16052
16067
  let currentNode = node;
16053
16068
  let hasChanged = false;
16069
+ const linkProxy = {
16070
+ ...link,
16071
+ replaceWith(newNode, replacer) {
16072
+ link.replaceWith(newNode, replacer);
16073
+ currentNode = newNode;
16074
+ }
16075
+ };
16054
16076
  for (let i = 0; i < visitors.length; i += 1) {
16055
16077
  if (skipping[i] === skipSymbol) {
16056
16078
  const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), false);
16057
16079
  if (typeof visitFn === 'function') {
16058
16080
  // eslint-disable-next-line no-await-in-loop
16059
- const result = await visitFn.call(visitors[i], currentNode, ...rest);
16081
+ const result = await visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
16060
16082
  if (result === skipVisitingNodeSymbol) {
16061
- skipping[i] = node;
16083
+ skipping[i] = currentNode;
16062
16084
  } else if (result === breakSymbol) {
16063
16085
  skipping[i] = breakSymbol;
16064
16086
  } else if (result === deleteNodeSymbol) {
@@ -16076,20 +16098,28 @@ const mergeAllAsync = (visitors, {
16076
16098
  }
16077
16099
  return hasChanged ? currentNode : undefined;
16078
16100
  },
16079
- async leave(node, ...rest) {
16101
+ async leave(node, key, parent, path, ancestors, link) {
16102
+ let currentNode = node;
16103
+ const linkProxy = {
16104
+ ...link,
16105
+ replaceWith(newNode, replacer) {
16106
+ link.replaceWith(newNode, replacer);
16107
+ currentNode = newNode;
16108
+ }
16109
+ };
16080
16110
  for (let i = 0; i < visitors.length; i += 1) {
16081
16111
  if (skipping[i] === skipSymbol) {
16082
- const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(node), true);
16112
+ const visitFn = visitFnGetter(visitors[i], nodeTypeGetter(currentNode), true);
16083
16113
  if (typeof visitFn === 'function') {
16084
16114
  // eslint-disable-next-line no-await-in-loop
16085
- const result = await visitFn.call(visitors[i], node, ...rest);
16115
+ const result = await visitFn.call(visitors[i], currentNode, key, parent, path, ancestors, linkProxy);
16086
16116
  if (result === breakSymbol) {
16087
16117
  skipping[i] = breakSymbol;
16088
16118
  } else if (result !== undefined && result !== skipVisitingNodeSymbol) {
16089
16119
  return result;
16090
16120
  }
16091
16121
  }
16092
- } else if (skipping[i] === node) {
16122
+ } else if (skipping[i] === currentNode) {
16093
16123
  skipping[i] = skipSymbol;
16094
16124
  }
16095
16125
  }
@@ -16285,8 +16315,22 @@ visitor, {
16285
16315
  for (const [stateKey, stateValue] of Object.entries(state)) {
16286
16316
  visitor[stateKey] = stateValue;
16287
16317
  }
16318
+ const link = {
16319
+ // eslint-disable-next-line @typescript-eslint/no-loop-func
16320
+ replaceWith(newNode, replacer) {
16321
+ if (typeof replacer === 'function') {
16322
+ replacer(newNode, node, key, parent, path, ancestors);
16323
+ } else if (parent) {
16324
+ parent[key] = newNode;
16325
+ }
16326
+ if (!isLeaving) {
16327
+ node = newNode;
16328
+ }
16329
+ }
16330
+ };
16331
+
16288
16332
  // retrieve result
16289
- result = visitFn.call(visitor, node, key, parent, path, ancestors);
16333
+ result = visitFn.call(visitor, node, key, parent, path, ancestors, link);
16290
16334
  }
16291
16335
 
16292
16336
  // check if the visitor is async
@@ -16443,9 +16487,22 @@ visitor, {
16443
16487
  for (const [stateKey, stateValue] of Object.entries(state)) {
16444
16488
  visitor[stateKey] = stateValue;
16445
16489
  }
16490
+ const link = {
16491
+ // eslint-disable-next-line @typescript-eslint/no-loop-func
16492
+ replaceWith(newNode, replacer) {
16493
+ if (typeof replacer === 'function') {
16494
+ replacer(newNode, node, key, parent, path, ancestors);
16495
+ } else if (parent) {
16496
+ parent[key] = newNode;
16497
+ }
16498
+ if (!isLeaving) {
16499
+ node = newNode;
16500
+ }
16501
+ }
16502
+ };
16446
16503
 
16447
16504
  // retrieve result
16448
- result = await visitFn.call(visitor, node, key, parent, path, ancestors); // eslint-disable-line no-await-in-loop
16505
+ result = await visitFn.call(visitor, node, key, parent, path, ancestors, link); // eslint-disable-line no-await-in-loop
16449
16506
  }
16450
16507
  if (result === breakSymbol) {
16451
16508
  break;