@tinacms/app 0.0.28 → 1.0.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.
Files changed (181) hide show
  1. package/appFiles/node_modules/.package-lock.json +10 -10
  2. package/appFiles/node_modules/@babel/generator/lib/generators/base.js.map +1 -1
  3. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +1 -1
  4. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  5. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +9 -15
  6. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
  7. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +9 -24
  8. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  9. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +6 -14
  10. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
  11. package/appFiles/node_modules/@babel/generator/lib/generators/statements.js +1 -16
  12. package/appFiles/node_modules/@babel/generator/lib/generators/statements.js.map +1 -1
  13. package/appFiles/node_modules/@babel/generator/lib/printer.js +89 -80
  14. package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
  15. package/appFiles/node_modules/@babel/generator/package.json +3 -3
  16. package/appFiles/node_modules/@babel/parser/lib/index.js +1 -1
  17. package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
  18. package/appFiles/node_modules/@babel/parser/package.json +1 -1
  19. package/appFiles/node_modules/@babel/parser/typings/babel-parser.d.ts +92 -80
  20. package/appFiles/node_modules/@babel/parser/typings/babel-parser.source.d.ts +151 -0
  21. package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js +0 -3
  22. package/appFiles/node_modules/@babel/types/lib/asserts/assertNode.js.map +1 -1
  23. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js +0 -303
  24. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
  25. package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js +0 -4
  26. package/appFiles/node_modules/@babel/types/lib/builders/flow/createFlowUnionType.js.map +1 -1
  27. package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js +0 -11
  28. package/appFiles/node_modules/@babel/types/lib/builders/flow/createTypeAnnotationBasedOnTypeof.js.map +1 -1
  29. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js +0 -253
  30. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
  31. package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js +0 -1
  32. package/appFiles/node_modules/@babel/types/lib/builders/generated/uppercase.js.map +1 -1
  33. package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js +0 -7
  34. package/appFiles/node_modules/@babel/types/lib/builders/react/buildChildren.js.map +1 -1
  35. package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js +0 -5
  36. package/appFiles/node_modules/@babel/types/lib/builders/typescript/createTSUnionType.js.map +1 -1
  37. package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js +0 -5
  38. package/appFiles/node_modules/@babel/types/lib/builders/validateNode.js.map +1 -1
  39. package/appFiles/node_modules/@babel/types/lib/clone/clone.js +0 -2
  40. package/appFiles/node_modules/@babel/types/lib/clone/clone.js.map +1 -1
  41. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js +0 -2
  42. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeep.js.map +1 -1
  43. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js +0 -2
  44. package/appFiles/node_modules/@babel/types/lib/clone/cloneDeepWithoutLoc.js.map +1 -1
  45. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js +4 -22
  46. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  47. package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js +0 -2
  48. package/appFiles/node_modules/@babel/types/lib/clone/cloneWithoutLoc.js.map +1 -1
  49. package/appFiles/node_modules/@babel/types/lib/comments/addComment.js +0 -2
  50. package/appFiles/node_modules/@babel/types/lib/comments/addComment.js.map +1 -1
  51. package/appFiles/node_modules/@babel/types/lib/comments/addComments.js +0 -3
  52. package/appFiles/node_modules/@babel/types/lib/comments/addComments.js.map +1 -1
  53. package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js +0 -2
  54. package/appFiles/node_modules/@babel/types/lib/comments/inheritInnerComments.js.map +1 -1
  55. package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js +0 -2
  56. package/appFiles/node_modules/@babel/types/lib/comments/inheritLeadingComments.js.map +1 -1
  57. package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js +0 -2
  58. package/appFiles/node_modules/@babel/types/lib/comments/inheritTrailingComments.js.map +1 -1
  59. package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js +0 -4
  60. package/appFiles/node_modules/@babel/types/lib/comments/inheritsComments.js.map +1 -1
  61. package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js +0 -3
  62. package/appFiles/node_modules/@babel/types/lib/comments/removeComments.js.map +1 -1
  63. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js +0 -1
  64. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
  65. package/appFiles/node_modules/@babel/types/lib/constants/index.js.map +1 -1
  66. package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js +0 -2
  67. package/appFiles/node_modules/@babel/types/lib/converters/ensureBlock.js.map +1 -1
  68. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +2 -12
  69. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
  70. package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js +0 -2
  71. package/appFiles/node_modules/@babel/types/lib/converters/toBindingIdentifierName.js.map +1 -1
  72. package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js +0 -7
  73. package/appFiles/node_modules/@babel/types/lib/converters/toBlock.js.map +1 -1
  74. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js +2 -4
  75. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
  76. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js +0 -4
  77. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
  78. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js +2 -6
  79. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
  80. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js +0 -7
  81. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
  82. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js +0 -3
  83. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
  84. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js +1 -7
  85. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  86. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js +2 -18
  87. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
  88. package/appFiles/node_modules/@babel/types/lib/definitions/core.js +33 -61
  89. package/appFiles/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  90. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js +3 -1
  91. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
  92. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js +1 -3
  93. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
  94. package/appFiles/node_modules/@babel/types/lib/definitions/index.js +0 -18
  95. package/appFiles/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
  96. package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js +0 -1
  97. package/appFiles/node_modules/@babel/types/lib/definitions/jsx.js.map +1 -1
  98. package/appFiles/node_modules/@babel/types/lib/definitions/misc.js +0 -2
  99. package/appFiles/node_modules/@babel/types/lib/definitions/misc.js.map +1 -1
  100. package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js +0 -5
  101. package/appFiles/node_modules/@babel/types/lib/definitions/placeholders.js.map +1 -1
  102. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js +4 -15
  103. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  104. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js +1 -65
  105. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
  106. package/appFiles/node_modules/@babel/types/lib/index.d.ts +0 -1
  107. package/appFiles/node_modules/@babel/types/lib/index.js +1 -75
  108. package/appFiles/node_modules/@babel/types/lib/index.js.map +1 -1
  109. package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js +0 -2
  110. package/appFiles/node_modules/@babel/types/lib/modifications/appendToMemberExpression.js.map +1 -1
  111. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +3 -12
  112. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
  113. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js +0 -4
  114. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
  115. package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js +0 -4
  116. package/appFiles/node_modules/@babel/types/lib/modifications/prependToMemberExpression.js.map +1 -1
  117. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js +3 -8
  118. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
  119. package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js +0 -3
  120. package/appFiles/node_modules/@babel/types/lib/modifications/removePropertiesDeep.js.map +1 -1
  121. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +1 -10
  122. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
  123. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +4 -14
  124. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
  125. package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js +0 -3
  126. package/appFiles/node_modules/@babel/types/lib/retrievers/getOuterBindingIdentifiers.js.map +1 -1
  127. package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js +0 -7
  128. package/appFiles/node_modules/@babel/types/lib/traverse/traverse.js.map +1 -1
  129. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js +2 -5
  130. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
  131. package/appFiles/node_modules/@babel/types/lib/utils/inherit.js +0 -1
  132. package/appFiles/node_modules/@babel/types/lib/utils/inherit.js.map +1 -1
  133. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +1 -8
  134. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
  135. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js +2 -4
  136. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -1
  137. package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js +0 -2
  138. package/appFiles/node_modules/@babel/types/lib/validators/buildMatchMemberExpression.js.map +1 -1
  139. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js +0 -906
  140. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  141. package/appFiles/node_modules/@babel/types/lib/validators/is.js +0 -8
  142. package/appFiles/node_modules/@babel/types/lib/validators/is.js.map +1 -1
  143. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js +4 -8
  144. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
  145. package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js +0 -3
  146. package/appFiles/node_modules/@babel/types/lib/validators/isBlockScoped.js.map +1 -1
  147. package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js +0 -5
  148. package/appFiles/node_modules/@babel/types/lib/validators/isImmutable.js.map +1 -1
  149. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js +2 -4
  150. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
  151. package/appFiles/node_modules/@babel/types/lib/validators/isNode.js +0 -2
  152. package/appFiles/node_modules/@babel/types/lib/validators/isNode.js.map +1 -1
  153. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +2 -16
  154. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
  155. package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js +0 -4
  156. package/appFiles/node_modules/@babel/types/lib/validators/isPlaceholderType.js.map +1 -1
  157. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js +0 -13
  158. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
  159. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js +0 -3
  160. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
  161. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +2 -3
  162. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  163. package/appFiles/node_modules/@babel/types/lib/validators/isType.js +1 -5
  164. package/appFiles/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  165. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +0 -2
  166. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
  167. package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js +0 -4
  168. package/appFiles/node_modules/@babel/types/lib/validators/isValidIdentifier.js.map +1 -1
  169. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js +2 -4
  170. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
  171. package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js +0 -8
  172. package/appFiles/node_modules/@babel/types/lib/validators/matchesPattern.js.map +1 -1
  173. package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js +0 -1
  174. package/appFiles/node_modules/@babel/types/lib/validators/react/isCompatTag.js.map +1 -1
  175. package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js +0 -2
  176. package/appFiles/node_modules/@babel/types/lib/validators/react/isReactComponent.js.map +1 -1
  177. package/appFiles/node_modules/@babel/types/lib/validators/validate.js +0 -4
  178. package/appFiles/node_modules/@babel/types/lib/validators/validate.js.map +1 -1
  179. package/appFiles/node_modules/@babel/types/package.json +3 -3
  180. package/package.json +4 -4
  181. package/appFiles/node_modules/@babel/types/lib/index.d.ts.map +0 -1
@@ -4,27 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = is;
7
-
8
7
  var _shallowEqual = require("../utils/shallowEqual");
9
-
10
8
  var _isType = require("./isType");
11
-
12
9
  var _isPlaceholderType = require("./isPlaceholderType");
13
-
14
10
  var _definitions = require("../definitions");
15
-
16
11
  function is(type, node, opts) {
17
12
  if (!node) return false;
18
13
  const matches = (0, _isType.default)(node.type, type);
19
-
20
14
  if (!matches) {
21
15
  if (!opts && node.type === "Placeholder" && type in _definitions.FLIPPED_ALIAS_KEYS) {
22
16
  return (0, _isPlaceholderType.default)(node.expectedNode, type);
23
17
  }
24
-
25
18
  return false;
26
19
  }
27
-
28
20
  if (typeof opts === "undefined") {
29
21
  return true;
30
22
  } else {
@@ -1 +1 @@
1
- {"version":3,"names":["is","type","node","opts","matches","isType","FLIPPED_ALIAS_KEYS","isPlaceholderType","expectedNode","shallowEqual"],"sources":["../../src/validators/is.ts"],"sourcesContent":["import shallowEqual from \"../utils/shallowEqual\";\nimport isType from \"./isType\";\nimport isPlaceholderType from \"./isPlaceholderType\";\nimport { FLIPPED_ALIAS_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function is<T extends t.Node[\"type\"]>(\n type: T,\n node: t.Node | null | undefined,\n opts?: undefined,\n): node is Extract<t.Node, { type: T }>;\n\nexport default function is<\n T extends t.Node[\"type\"],\n P extends Extract<t.Node, { type: T }>,\n>(type: T, n: t.Node | null | undefined, required: Partial<P>): n is P;\n\nexport default function is<P extends t.Node>(\n type: string,\n node: t.Node | null | undefined,\n opts: Partial<P>,\n): node is P;\n\nexport default function is(\n type: string,\n node: t.Node | null | undefined,\n opts?: Partial<t.Node>,\n): node is t.Node;\n/**\n * Returns whether `node` is of given `type`.\n *\n * For better performance, use this instead of `is[Type]` when `type` is unknown.\n */\nexport default function is(\n type: string,\n node: t.Node | null | undefined,\n opts?: Partial<t.Node>,\n): node is t.Node {\n if (!node) return false;\n\n const matches = isType(node.type, type);\n if (!matches) {\n if (!opts && node.type === \"Placeholder\" && type in FLIPPED_ALIAS_KEYS) {\n // We can only return true if the placeholder doesn't replace a real node,\n // but it replaces a category of nodes (an alias).\n //\n // t.is(\"Identifier\", node) gives some guarantees about node's shape, so we\n // can't say that Placeholder(expectedNode: \"Identifier\") is an identifier\n // because it doesn't have the same properties.\n // On the other hand, t.is(\"Expression\", node) doesn't say anything about\n // the shape of node because Expression can be many different nodes: we can,\n // and should, safely report expression placeholders as Expressions.\n return isPlaceholderType(node.expectedNode, type);\n }\n return false;\n }\n\n if (typeof opts === \"undefined\") {\n return true;\n } else {\n return shallowEqual(node, opts);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AA8Be,SAASA,EAAT,CACbC,IADa,EAEbC,IAFa,EAGbC,IAHa,EAIG;EAChB,IAAI,CAACD,IAAL,EAAW,OAAO,KAAP;EAEX,MAAME,OAAO,GAAG,IAAAC,eAAA,EAAOH,IAAI,CAACD,IAAZ,EAAkBA,IAAlB,CAAhB;;EACA,IAAI,CAACG,OAAL,EAAc;IACZ,IAAI,CAACD,IAAD,IAASD,IAAI,CAACD,IAAL,KAAc,aAAvB,IAAwCA,IAAI,IAAIK,+BAApD,EAAwE;MAUtE,OAAO,IAAAC,0BAAA,EAAkBL,IAAI,CAACM,YAAvB,EAAqCP,IAArC,CAAP;IACD;;IACD,OAAO,KAAP;EACD;;EAED,IAAI,OAAOE,IAAP,KAAgB,WAApB,EAAiC;IAC/B,OAAO,IAAP;EACD,CAFD,MAEO;IACL,OAAO,IAAAM,qBAAA,EAAaP,IAAb,EAAmBC,IAAnB,CAAP;EACD;AACF"}
1
+ {"version":3,"names":["is","type","node","opts","matches","isType","FLIPPED_ALIAS_KEYS","isPlaceholderType","expectedNode","shallowEqual"],"sources":["../../src/validators/is.ts"],"sourcesContent":["import shallowEqual from \"../utils/shallowEqual\";\nimport isType from \"./isType\";\nimport isPlaceholderType from \"./isPlaceholderType\";\nimport { FLIPPED_ALIAS_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function is<T extends t.Node[\"type\"]>(\n type: T,\n node: t.Node | null | undefined,\n opts?: undefined,\n): node is Extract<t.Node, { type: T }>;\n\nexport default function is<\n T extends t.Node[\"type\"],\n P extends Extract<t.Node, { type: T }>,\n>(type: T, n: t.Node | null | undefined, required: Partial<P>): n is P;\n\nexport default function is<P extends t.Node>(\n type: string,\n node: t.Node | null | undefined,\n opts: Partial<P>,\n): node is P;\n\nexport default function is(\n type: string,\n node: t.Node | null | undefined,\n opts?: Partial<t.Node>,\n): node is t.Node;\n/**\n * Returns whether `node` is of given `type`.\n *\n * For better performance, use this instead of `is[Type]` when `type` is unknown.\n */\nexport default function is(\n type: string,\n node: t.Node | null | undefined,\n opts?: Partial<t.Node>,\n): node is t.Node {\n if (!node) return false;\n\n const matches = isType(node.type, type);\n if (!matches) {\n if (!opts && node.type === \"Placeholder\" && type in FLIPPED_ALIAS_KEYS) {\n // We can only return true if the placeholder doesn't replace a real node,\n // but it replaces a category of nodes (an alias).\n //\n // t.is(\"Identifier\", node) gives some guarantees about node's shape, so we\n // can't say that Placeholder(expectedNode: \"Identifier\") is an identifier\n // because it doesn't have the same properties.\n // On the other hand, t.is(\"Expression\", node) doesn't say anything about\n // the shape of node because Expression can be many different nodes: we can,\n // and should, safely report expression placeholders as Expressions.\n return isPlaceholderType(node.expectedNode, type);\n }\n return false;\n }\n\n if (typeof opts === \"undefined\") {\n return true;\n } else {\n return shallowEqual(node, opts);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AA8Be,SAASA,EAAE,CACxBC,IAAY,EACZC,IAA+B,EAC/BC,IAAsB,EACN;EAChB,IAAI,CAACD,IAAI,EAAE,OAAO,KAAK;EAEvB,MAAME,OAAO,GAAG,IAAAC,eAAM,EAACH,IAAI,CAACD,IAAI,EAAEA,IAAI,CAAC;EACvC,IAAI,CAACG,OAAO,EAAE;IACZ,IAAI,CAACD,IAAI,IAAID,IAAI,CAACD,IAAI,KAAK,aAAa,IAAIA,IAAI,IAAIK,+BAAkB,EAAE;MAUtE,OAAO,IAAAC,0BAAiB,EAACL,IAAI,CAACM,YAAY,EAAEP,IAAI,CAAC;IACnD;IACA,OAAO,KAAK;EACd;EAEA,IAAI,OAAOE,IAAI,KAAK,WAAW,EAAE;IAC/B,OAAO,IAAI;EACb,CAAC,MAAM;IACL,OAAO,IAAAM,qBAAY,EAACP,IAAI,EAAEC,IAAI,CAAC;EACjC;AACF"}
@@ -4,21 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isBinding;
7
-
8
7
  var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers");
9
-
10
8
  function isBinding(node, parent, grandparent) {
11
9
  if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") {
12
10
  return false;
13
11
  }
14
-
15
- const keys = _getBindingIdentifiers.default.keys[parent.type];
16
-
12
+ const keys =
13
+ _getBindingIdentifiers.default.keys[parent.type];
17
14
  if (keys) {
18
15
  for (let i = 0; i < keys.length; i++) {
19
16
  const key = keys[i];
20
- const val = parent[key];
21
-
17
+ const val =
18
+ parent[key];
22
19
  if (Array.isArray(val)) {
23
20
  if (val.indexOf(node) >= 0) return true;
24
21
  } else {
@@ -26,7 +23,6 @@ function isBinding(node, parent, grandparent) {
26
23
  }
27
24
  }
28
25
  }
29
-
30
26
  return false;
31
27
  }
32
28
 
@@ -1 +1 @@
1
- {"version":3,"names":["isBinding","node","parent","grandparent","type","keys","getBindingIdentifiers","i","length","key","val","Array","isArray","indexOf"],"sources":["../../src/validators/isBinding.ts"],"sourcesContent":["import getBindingIdentifiers from \"../retrievers/getBindingIdentifiers\";\nimport type * as t from \"..\";\n/**\n * Check if the input `node` is a binding identifier.\n */\nexport default function isBinding(\n node: t.Node,\n parent: t.Node,\n grandparent?: t.Node,\n): boolean {\n if (\n grandparent &&\n node.type === \"Identifier\" &&\n parent.type === \"ObjectProperty\" &&\n grandparent.type === \"ObjectExpression\"\n ) {\n // We need to special-case this, because getBindingIdentifiers\n // has an ObjectProperty->value entry for destructuring patterns.\n return false;\n }\n\n const keys =\n // @ts-expect-error getBindingIdentifiers.keys does not cover all AST types\n getBindingIdentifiers.keys[parent.type];\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const val =\n // @ts-expect-error key must present in parent\n parent[key];\n if (Array.isArray(val)) {\n if (val.indexOf(node) >= 0) return true;\n } else {\n if (val === node) return true;\n }\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAAA;;AAKe,SAASA,SAAT,CACbC,IADa,EAEbC,MAFa,EAGbC,WAHa,EAIJ;EACT,IACEA,WAAW,IACXF,IAAI,CAACG,IAAL,KAAc,YADd,IAEAF,MAAM,CAACE,IAAP,KAAgB,gBAFhB,IAGAD,WAAW,CAACC,IAAZ,KAAqB,kBAJvB,EAKE;IAGA,OAAO,KAAP;EACD;;EAED,MAAMC,IAAI,GAERC,8BAAA,CAAsBD,IAAtB,CAA2BH,MAAM,CAACE,IAAlC,CAFF;;EAGA,IAAIC,IAAJ,EAAU;IACR,KAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;MACpC,MAAME,GAAG,GAAGJ,IAAI,CAACE,CAAD,CAAhB;MACA,MAAMG,GAAG,GAEPR,MAAM,CAACO,GAAD,CAFR;;MAGA,IAAIE,KAAK,CAACC,OAAN,CAAcF,GAAd,CAAJ,EAAwB;QACtB,IAAIA,GAAG,CAACG,OAAJ,CAAYZ,IAAZ,KAAqB,CAAzB,EAA4B,OAAO,IAAP;MAC7B,CAFD,MAEO;QACL,IAAIS,GAAG,KAAKT,IAAZ,EAAkB,OAAO,IAAP;MACnB;IACF;EACF;;EAED,OAAO,KAAP;AACD"}
1
+ {"version":3,"names":["isBinding","node","parent","grandparent","type","keys","getBindingIdentifiers","i","length","key","val","Array","isArray","indexOf"],"sources":["../../src/validators/isBinding.ts"],"sourcesContent":["import getBindingIdentifiers from \"../retrievers/getBindingIdentifiers\";\nimport type * as t from \"..\";\n/**\n * Check if the input `node` is a binding identifier.\n */\nexport default function isBinding(\n node: t.Node,\n parent: t.Node,\n grandparent?: t.Node,\n): boolean {\n if (\n grandparent &&\n node.type === \"Identifier\" &&\n parent.type === \"ObjectProperty\" &&\n grandparent.type === \"ObjectExpression\"\n ) {\n // We need to special-case this, because getBindingIdentifiers\n // has an ObjectProperty->value entry for destructuring patterns.\n return false;\n }\n\n const keys =\n // @ts-expect-error getBindingIdentifiers.keys does not cover all AST types\n getBindingIdentifiers.keys[parent.type];\n if (keys) {\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n const val =\n // @ts-expect-error key must present in parent\n parent[key];\n if (Array.isArray(val)) {\n if (val.indexOf(node) >= 0) return true;\n } else {\n if (val === node) return true;\n }\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA;AAKe,SAASA,SAAS,CAC/BC,IAAY,EACZC,MAAc,EACdC,WAAoB,EACX;EACT,IACEA,WAAW,IACXF,IAAI,CAACG,IAAI,KAAK,YAAY,IAC1BF,MAAM,CAACE,IAAI,KAAK,gBAAgB,IAChCD,WAAW,CAACC,IAAI,KAAK,kBAAkB,EACvC;IAGA,OAAO,KAAK;EACd;EAEA,MAAMC,IAAI;EAERC,8BAAqB,CAACD,IAAI,CAACH,MAAM,CAACE,IAAI,CAAC;EACzC,IAAIC,IAAI,EAAE;IACR,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACpC,MAAME,GAAG,GAAGJ,IAAI,CAACE,CAAC,CAAC;MACnB,MAAMG,GAAG;MAEPR,MAAM,CAACO,GAAG,CAAC;MACb,IAAIE,KAAK,CAACC,OAAO,CAACF,GAAG,CAAC,EAAE;QACtB,IAAIA,GAAG,CAACG,OAAO,CAACZ,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,IAAI;MACzC,CAAC,MAAM;QACL,IAAIS,GAAG,KAAKT,IAAI,EAAE,OAAO,IAAI;MAC/B;IACF;EACF;EAEA,OAAO,KAAK;AACd"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isBlockScoped;
7
-
8
7
  var _generated = require("./generated");
9
-
10
8
  var _isLet = require("./isLet");
11
-
12
9
  function isBlockScoped(node) {
13
10
  return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node);
14
11
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isBlockScoped","node","isFunctionDeclaration","isClassDeclaration","isLet"],"sources":["../../src/validators/isBlockScoped.ts"],"sourcesContent":["import { isClassDeclaration, isFunctionDeclaration } from \"./generated\";\nimport isLet from \"./isLet\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is block scoped.\n */\nexport default function isBlockScoped(node: t.Node): boolean {\n return isFunctionDeclaration(node) || isClassDeclaration(node) || isLet(node);\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMe,SAASA,aAAT,CAAuBC,IAAvB,EAA8C;EAC3D,OAAO,IAAAC,gCAAA,EAAsBD,IAAtB,KAA+B,IAAAE,6BAAA,EAAmBF,IAAnB,CAA/B,IAA2D,IAAAG,cAAA,EAAMH,IAAN,CAAlE;AACD"}
1
+ {"version":3,"names":["isBlockScoped","node","isFunctionDeclaration","isClassDeclaration","isLet"],"sources":["../../src/validators/isBlockScoped.ts"],"sourcesContent":["import { isClassDeclaration, isFunctionDeclaration } from \"./generated\";\nimport isLet from \"./isLet\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is block scoped.\n */\nexport default function isBlockScoped(node: t.Node): boolean {\n return isFunctionDeclaration(node) || isClassDeclaration(node) || isLet(node);\n}\n"],"mappings":";;;;;;AAAA;AACA;AAMe,SAASA,aAAa,CAACC,IAAY,EAAW;EAC3D,OAAO,IAAAC,gCAAqB,EAACD,IAAI,CAAC,IAAI,IAAAE,6BAAkB,EAACF,IAAI,CAAC,IAAI,IAAAG,cAAK,EAACH,IAAI,CAAC;AAC/E"}
@@ -4,14 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isImmutable;
7
-
8
7
  var _isType = require("./isType");
9
-
10
8
  var _generated = require("./generated");
11
-
12
9
  function isImmutable(node) {
13
10
  if ((0, _isType.default)(node.type, "Immutable")) return true;
14
-
15
11
  if ((0, _generated.isIdentifier)(node)) {
16
12
  if (node.name === "undefined") {
17
13
  return true;
@@ -19,7 +15,6 @@ function isImmutable(node) {
19
15
  return false;
20
16
  }
21
17
  }
22
-
23
18
  return false;
24
19
  }
25
20
 
@@ -1 +1 @@
1
- {"version":3,"names":["isImmutable","node","isType","type","isIdentifier","name"],"sources":["../../src/validators/isImmutable.ts"],"sourcesContent":["import isType from \"./isType\";\nimport { isIdentifier } from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is definitely immutable.\n */\nexport default function isImmutable(node: t.Node): boolean {\n if (isType(node.type, \"Immutable\")) return true;\n\n if (isIdentifier(node)) {\n if (node.name === \"undefined\") {\n // immutable!\n return true;\n } else {\n // no idea...\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMe,SAASA,WAAT,CAAqBC,IAArB,EAA4C;EACzD,IAAI,IAAAC,eAAA,EAAOD,IAAI,CAACE,IAAZ,EAAkB,WAAlB,CAAJ,EAAoC,OAAO,IAAP;;EAEpC,IAAI,IAAAC,uBAAA,EAAaH,IAAb,CAAJ,EAAwB;IACtB,IAAIA,IAAI,CAACI,IAAL,KAAc,WAAlB,EAA+B;MAE7B,OAAO,IAAP;IACD,CAHD,MAGO;MAEL,OAAO,KAAP;IACD;EACF;;EAED,OAAO,KAAP;AACD"}
1
+ {"version":3,"names":["isImmutable","node","isType","type","isIdentifier","name"],"sources":["../../src/validators/isImmutable.ts"],"sourcesContent":["import isType from \"./isType\";\nimport { isIdentifier } from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is definitely immutable.\n */\nexport default function isImmutable(node: t.Node): boolean {\n if (isType(node.type, \"Immutable\")) return true;\n\n if (isIdentifier(node)) {\n if (node.name === \"undefined\") {\n // immutable!\n return true;\n } else {\n // no idea...\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAMe,SAASA,WAAW,CAACC,IAAY,EAAW;EACzD,IAAI,IAAAC,eAAM,EAACD,IAAI,CAACE,IAAI,EAAE,WAAW,CAAC,EAAE,OAAO,IAAI;EAE/C,IAAI,IAAAC,uBAAY,EAACH,IAAI,CAAC,EAAE;IACtB,IAAIA,IAAI,CAACI,IAAI,KAAK,WAAW,EAAE;MAE7B,OAAO,IAAI;IACb,CAAC,MAAM;MAEL,OAAO,KAAK;IACd;EACF;EAEA,OAAO,KAAK;AACd"}
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isLet;
7
-
8
7
  var _generated = require("./generated");
9
-
10
8
  var _constants = require("../constants");
11
-
12
9
  function isLet(node) {
13
- return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
10
+ return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" ||
11
+ node[_constants.BLOCK_SCOPED_SYMBOL]);
14
12
  }
15
13
 
16
14
  //# sourceMappingURL=isLet.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isLet","node","isVariableDeclaration","kind","BLOCK_SCOPED_SYMBOL"],"sources":["../../src/validators/isLet.ts"],"sourcesContent":["import { isVariableDeclaration } from \"./generated\";\nimport { BLOCK_SCOPED_SYMBOL } from \"../constants\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is a `let` variable declaration.\n */\nexport default function isLet(node: t.Node): boolean {\n return (\n isVariableDeclaration(node) &&\n (node.kind !== \"var\" ||\n // @ts-expect-error Fixme: document private properties\n node[BLOCK_SCOPED_SYMBOL])\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMe,SAASA,KAAT,CAAeC,IAAf,EAAsC;EACnD,OACE,IAAAC,gCAAA,EAAsBD,IAAtB,MACCA,IAAI,CAACE,IAAL,KAAc,KAAd,IAECF,IAAI,CAACG,8BAAD,CAHN,CADF;AAMD"}
1
+ {"version":3,"names":["isLet","node","isVariableDeclaration","kind","BLOCK_SCOPED_SYMBOL"],"sources":["../../src/validators/isLet.ts"],"sourcesContent":["import { isVariableDeclaration } from \"./generated\";\nimport { BLOCK_SCOPED_SYMBOL } from \"../constants\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is a `let` variable declaration.\n */\nexport default function isLet(node: t.Node): boolean {\n return (\n isVariableDeclaration(node) &&\n (node.kind !== \"var\" ||\n // @ts-expect-error Fixme: document private properties\n node[BLOCK_SCOPED_SYMBOL])\n );\n}\n"],"mappings":";;;;;;AAAA;AACA;AAMe,SAASA,KAAK,CAACC,IAAY,EAAW;EACnD,OACE,IAAAC,gCAAqB,EAACD,IAAI,CAAC,KAC1BA,IAAI,CAACE,IAAI,KAAK,KAAK;EAElBF,IAAI,CAACG,8BAAmB,CAAC,CAAC;AAEhC"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isNode;
7
-
8
7
  var _definitions = require("../definitions");
9
-
10
8
  function isNode(node) {
11
9
  return !!(node && _definitions.VISITOR_KEYS[node.type]);
12
10
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isNode","node","VISITOR_KEYS","type"],"sources":["../../src/validators/isNode.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function isNode(node: any): node is t.Node {\n return !!(node && VISITOR_KEYS[node.type]);\n}\n"],"mappings":";;;;;;;AAAA;;AAGe,SAASA,MAAT,CAAgBC,IAAhB,EAA2C;EACxD,OAAO,CAAC,EAAEA,IAAI,IAAIC,yBAAA,CAAaD,IAAI,CAACE,IAAlB,CAAV,CAAR;AACD"}
1
+ {"version":3,"names":["isNode","node","VISITOR_KEYS","type"],"sources":["../../src/validators/isNode.ts"],"sourcesContent":["import { VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function isNode(node: any): node is t.Node {\n return !!(node && VISITOR_KEYS[node.type]);\n}\n"],"mappings":";;;;;;AAAA;AAGe,SAASA,MAAM,CAACC,IAAS,EAAkB;EACxD,OAAO,CAAC,EAAEA,IAAI,IAAIC,yBAAY,CAACD,IAAI,CAACE,IAAI,CAAC,CAAC;AAC5C"}
@@ -4,68 +4,54 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isNodesEquivalent;
7
-
8
7
  var _definitions = require("../definitions");
9
-
10
8
  function isNodesEquivalent(a, b) {
11
9
  if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) {
12
10
  return a === b;
13
11
  }
14
-
15
12
  if (a.type !== b.type) {
16
13
  return false;
17
14
  }
18
-
19
15
  const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type);
20
16
  const visitorKeys = _definitions.VISITOR_KEYS[a.type];
21
-
22
17
  for (const field of fields) {
23
- const val_a = a[field];
18
+ const val_a =
19
+ a[field];
24
20
  const val_b = b[field];
25
-
26
21
  if (typeof val_a !== typeof val_b) {
27
22
  return false;
28
23
  }
29
-
30
24
  if (val_a == null && val_b == null) {
31
25
  continue;
32
26
  } else if (val_a == null || val_b == null) {
33
27
  return false;
34
28
  }
35
-
36
29
  if (Array.isArray(val_a)) {
37
30
  if (!Array.isArray(val_b)) {
38
31
  return false;
39
32
  }
40
-
41
33
  if (val_a.length !== val_b.length) {
42
34
  return false;
43
35
  }
44
-
45
36
  for (let i = 0; i < val_a.length; i++) {
46
37
  if (!isNodesEquivalent(val_a[i], val_b[i])) {
47
38
  return false;
48
39
  }
49
40
  }
50
-
51
41
  continue;
52
42
  }
53
-
54
43
  if (typeof val_a === "object" && !(visitorKeys != null && visitorKeys.includes(field))) {
55
44
  for (const key of Object.keys(val_a)) {
56
45
  if (val_a[key] !== val_b[key]) {
57
46
  return false;
58
47
  }
59
48
  }
60
-
61
49
  continue;
62
50
  }
63
-
64
51
  if (!isNodesEquivalent(val_a, val_b)) {
65
52
  return false;
66
53
  }
67
54
  }
68
-
69
55
  return true;
70
56
  }
71
57
 
@@ -1 +1 @@
1
- {"version":3,"names":["isNodesEquivalent","a","b","type","fields","Object","keys","NODE_FIELDS","visitorKeys","VISITOR_KEYS","field","val_a","val_b","Array","isArray","length","i","includes","key"],"sources":["../../src/validators/isNodesEquivalent.ts"],"sourcesContent":["import { NODE_FIELDS, VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\n/**\n * Check if two nodes are equivalent\n */\nexport default function isNodesEquivalent<T extends Partial<t.Node>>(\n a: T,\n b: any,\n): b is T {\n if (\n typeof a !== \"object\" ||\n typeof b !== \"object\" ||\n a == null ||\n b == null\n ) {\n return a === b;\n }\n\n if (a.type !== b.type) {\n return false;\n }\n\n const fields = Object.keys(NODE_FIELDS[a.type] || a.type);\n const visitorKeys = VISITOR_KEYS[a.type];\n\n for (const field of fields) {\n const val_a =\n // @ts-expect-error field must present in a\n a[field];\n const val_b = b[field];\n if (typeof val_a !== typeof val_b) {\n return false;\n }\n if (val_a == null && val_b == null) {\n continue;\n } else if (val_a == null || val_b == null) {\n return false;\n }\n\n if (Array.isArray(val_a)) {\n if (!Array.isArray(val_b)) {\n return false;\n }\n if (val_a.length !== val_b.length) {\n return false;\n }\n\n for (let i = 0; i < val_a.length; i++) {\n if (!isNodesEquivalent(val_a[i], val_b[i])) {\n return false;\n }\n }\n continue;\n }\n\n if (typeof val_a === \"object\" && !visitorKeys?.includes(field)) {\n for (const key of Object.keys(val_a)) {\n if (val_a[key] !== val_b[key]) {\n return false;\n }\n }\n continue;\n }\n\n if (!isNodesEquivalent(val_a, val_b)) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;;;AAAA;;AAMe,SAASA,iBAAT,CACbC,CADa,EAEbC,CAFa,EAGL;EACR,IACE,OAAOD,CAAP,KAAa,QAAb,IACA,OAAOC,CAAP,KAAa,QADb,IAEAD,CAAC,IAAI,IAFL,IAGAC,CAAC,IAAI,IAJP,EAKE;IACA,OAAOD,CAAC,KAAKC,CAAb;EACD;;EAED,IAAID,CAAC,CAACE,IAAF,KAAWD,CAAC,CAACC,IAAjB,EAAuB;IACrB,OAAO,KAAP;EACD;;EAED,MAAMC,MAAM,GAAGC,MAAM,CAACC,IAAP,CAAYC,wBAAA,CAAYN,CAAC,CAACE,IAAd,KAAuBF,CAAC,CAACE,IAArC,CAAf;EACA,MAAMK,WAAW,GAAGC,yBAAA,CAAaR,CAAC,CAACE,IAAf,CAApB;;EAEA,KAAK,MAAMO,KAAX,IAAoBN,MAApB,EAA4B;IAC1B,MAAMO,KAAK,GAETV,CAAC,CAACS,KAAD,CAFH;IAGA,MAAME,KAAK,GAAGV,CAAC,CAACQ,KAAD,CAAf;;IACA,IAAI,OAAOC,KAAP,KAAiB,OAAOC,KAA5B,EAAmC;MACjC,OAAO,KAAP;IACD;;IACD,IAAID,KAAK,IAAI,IAAT,IAAiBC,KAAK,IAAI,IAA9B,EAAoC;MAClC;IACD,CAFD,MAEO,IAAID,KAAK,IAAI,IAAT,IAAiBC,KAAK,IAAI,IAA9B,EAAoC;MACzC,OAAO,KAAP;IACD;;IAED,IAAIC,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAJ,EAA0B;MACxB,IAAI,CAACE,KAAK,CAACC,OAAN,CAAcF,KAAd,CAAL,EAA2B;QACzB,OAAO,KAAP;MACD;;MACD,IAAID,KAAK,CAACI,MAAN,KAAiBH,KAAK,CAACG,MAA3B,EAAmC;QACjC,OAAO,KAAP;MACD;;MAED,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,KAAK,CAACI,MAA1B,EAAkCC,CAAC,EAAnC,EAAuC;QACrC,IAAI,CAAChB,iBAAiB,CAACW,KAAK,CAACK,CAAD,CAAN,EAAWJ,KAAK,CAACI,CAAD,CAAhB,CAAtB,EAA4C;UAC1C,OAAO,KAAP;QACD;MACF;;MACD;IACD;;IAED,IAAI,OAAOL,KAAP,KAAiB,QAAjB,IAA6B,EAACH,WAAD,YAACA,WAAW,CAAES,QAAb,CAAsBP,KAAtB,CAAD,CAAjC,EAAgE;MAC9D,KAAK,MAAMQ,GAAX,IAAkBb,MAAM,CAACC,IAAP,CAAYK,KAAZ,CAAlB,EAAsC;QACpC,IAAIA,KAAK,CAACO,GAAD,CAAL,KAAeN,KAAK,CAACM,GAAD,CAAxB,EAA+B;UAC7B,OAAO,KAAP;QACD;MACF;;MACD;IACD;;IAED,IAAI,CAAClB,iBAAiB,CAACW,KAAD,EAAQC,KAAR,CAAtB,EAAsC;MACpC,OAAO,KAAP;IACD;EACF;;EAED,OAAO,IAAP;AACD"}
1
+ {"version":3,"names":["isNodesEquivalent","a","b","type","fields","Object","keys","NODE_FIELDS","visitorKeys","VISITOR_KEYS","field","val_a","val_b","Array","isArray","length","i","includes","key"],"sources":["../../src/validators/isNodesEquivalent.ts"],"sourcesContent":["import { NODE_FIELDS, VISITOR_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\n/**\n * Check if two nodes are equivalent\n */\nexport default function isNodesEquivalent<T extends Partial<t.Node>>(\n a: T,\n b: any,\n): b is T {\n if (\n typeof a !== \"object\" ||\n typeof b !== \"object\" ||\n a == null ||\n b == null\n ) {\n return a === b;\n }\n\n if (a.type !== b.type) {\n return false;\n }\n\n const fields = Object.keys(NODE_FIELDS[a.type] || a.type);\n const visitorKeys = VISITOR_KEYS[a.type];\n\n for (const field of fields) {\n const val_a =\n // @ts-expect-error field must present in a\n a[field];\n const val_b = b[field];\n if (typeof val_a !== typeof val_b) {\n return false;\n }\n if (val_a == null && val_b == null) {\n continue;\n } else if (val_a == null || val_b == null) {\n return false;\n }\n\n if (Array.isArray(val_a)) {\n if (!Array.isArray(val_b)) {\n return false;\n }\n if (val_a.length !== val_b.length) {\n return false;\n }\n\n for (let i = 0; i < val_a.length; i++) {\n if (!isNodesEquivalent(val_a[i], val_b[i])) {\n return false;\n }\n }\n continue;\n }\n\n if (typeof val_a === \"object\" && !visitorKeys?.includes(field)) {\n for (const key of Object.keys(val_a)) {\n if (val_a[key] !== val_b[key]) {\n return false;\n }\n }\n continue;\n }\n\n if (!isNodesEquivalent(val_a, val_b)) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAAA;AAMe,SAASA,iBAAiB,CACvCC,CAAI,EACJC,CAAM,EACE;EACR,IACE,OAAOD,CAAC,KAAK,QAAQ,IACrB,OAAOC,CAAC,KAAK,QAAQ,IACrBD,CAAC,IAAI,IAAI,IACTC,CAAC,IAAI,IAAI,EACT;IACA,OAAOD,CAAC,KAAKC,CAAC;EAChB;EAEA,IAAID,CAAC,CAACE,IAAI,KAAKD,CAAC,CAACC,IAAI,EAAE;IACrB,OAAO,KAAK;EACd;EAEA,MAAMC,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACC,wBAAW,CAACN,CAAC,CAACE,IAAI,CAAC,IAAIF,CAAC,CAACE,IAAI,CAAC;EACzD,MAAMK,WAAW,GAAGC,yBAAY,CAACR,CAAC,CAACE,IAAI,CAAC;EAExC,KAAK,MAAMO,KAAK,IAAIN,MAAM,EAAE;IAC1B,MAAMO,KAAK;IAETV,CAAC,CAACS,KAAK,CAAC;IACV,MAAME,KAAK,GAAGV,CAAC,CAACQ,KAAK,CAAC;IACtB,IAAI,OAAOC,KAAK,KAAK,OAAOC,KAAK,EAAE;MACjC,OAAO,KAAK;IACd;IACA,IAAID,KAAK,IAAI,IAAI,IAAIC,KAAK,IAAI,IAAI,EAAE;MAClC;IACF,CAAC,MAAM,IAAID,KAAK,IAAI,IAAI,IAAIC,KAAK,IAAI,IAAI,EAAE;MACzC,OAAO,KAAK;IACd;IAEA,IAAIC,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;MACxB,IAAI,CAACE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;QACzB,OAAO,KAAK;MACd;MACA,IAAID,KAAK,CAACI,MAAM,KAAKH,KAAK,CAACG,MAAM,EAAE;QACjC,OAAO,KAAK;MACd;MAEA,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;QACrC,IAAI,CAAChB,iBAAiB,CAACW,KAAK,CAACK,CAAC,CAAC,EAAEJ,KAAK,CAACI,CAAC,CAAC,CAAC,EAAE;UAC1C,OAAO,KAAK;QACd;MACF;MACA;IACF;IAEA,IAAI,OAAOL,KAAK,KAAK,QAAQ,IAAI,EAACH,WAAW,YAAXA,WAAW,CAAES,QAAQ,CAACP,KAAK,CAAC,GAAE;MAC9D,KAAK,MAAMQ,GAAG,IAAIb,MAAM,CAACC,IAAI,CAACK,KAAK,CAAC,EAAE;QACpC,IAAIA,KAAK,CAACO,GAAG,CAAC,KAAKN,KAAK,CAACM,GAAG,CAAC,EAAE;UAC7B,OAAO,KAAK;QACd;MACF;MACA;IACF;IAEA,IAAI,CAAClB,iBAAiB,CAACW,KAAK,EAAEC,KAAK,CAAC,EAAE;MACpC,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAI;AACb"}
@@ -4,19 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isPlaceholderType;
7
-
8
7
  var _definitions = require("../definitions");
9
-
10
8
  function isPlaceholderType(placeholderType, targetType) {
11
9
  if (placeholderType === targetType) return true;
12
10
  const aliases = _definitions.PLACEHOLDERS_ALIAS[placeholderType];
13
-
14
11
  if (aliases) {
15
12
  for (const alias of aliases) {
16
13
  if (targetType === alias) return true;
17
14
  }
18
15
  }
19
-
20
16
  return false;
21
17
  }
22
18
 
@@ -1 +1 @@
1
- {"version":3,"names":["isPlaceholderType","placeholderType","targetType","aliases","PLACEHOLDERS_ALIAS","alias"],"sources":["../../src/validators/isPlaceholderType.ts"],"sourcesContent":["import { PLACEHOLDERS_ALIAS } from \"../definitions\";\n\n/**\n * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.\n */\nexport default function isPlaceholderType(\n placeholderType: string,\n targetType: string,\n): boolean {\n if (placeholderType === targetType) return true;\n\n const aliases: Array<string> | undefined =\n PLACEHOLDERS_ALIAS[placeholderType];\n if (aliases) {\n for (const alias of aliases) {\n if (targetType === alias) return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAAA;;AAKe,SAASA,iBAAT,CACbC,eADa,EAEbC,UAFa,EAGJ;EACT,IAAID,eAAe,KAAKC,UAAxB,EAAoC,OAAO,IAAP;EAEpC,MAAMC,OAAkC,GACtCC,+BAAA,CAAmBH,eAAnB,CADF;;EAEA,IAAIE,OAAJ,EAAa;IACX,KAAK,MAAME,KAAX,IAAoBF,OAApB,EAA6B;MAC3B,IAAID,UAAU,KAAKG,KAAnB,EAA0B,OAAO,IAAP;IAC3B;EACF;;EAED,OAAO,KAAP;AACD"}
1
+ {"version":3,"names":["isPlaceholderType","placeholderType","targetType","aliases","PLACEHOLDERS_ALIAS","alias"],"sources":["../../src/validators/isPlaceholderType.ts"],"sourcesContent":["import { PLACEHOLDERS_ALIAS } from \"../definitions\";\n\n/**\n * Test if a `placeholderType` is a `targetType` or if `targetType` is an alias of `placeholderType`.\n */\nexport default function isPlaceholderType(\n placeholderType: string,\n targetType: string,\n): boolean {\n if (placeholderType === targetType) return true;\n\n const aliases: Array<string> | undefined =\n PLACEHOLDERS_ALIAS[placeholderType];\n if (aliases) {\n for (const alias of aliases) {\n if (targetType === alias) return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA;AAKe,SAASA,iBAAiB,CACvCC,eAAuB,EACvBC,UAAkB,EACT;EACT,IAAID,eAAe,KAAKC,UAAU,EAAE,OAAO,IAAI;EAE/C,MAAMC,OAAkC,GACtCC,+BAAkB,CAACH,eAAe,CAAC;EACrC,IAAIE,OAAO,EAAE;IACX,KAAK,MAAME,KAAK,IAAIF,OAAO,EAAE;MAC3B,IAAID,UAAU,KAAKG,KAAK,EAAE,OAAO,IAAI;IACvC;EACF;EAEA,OAAO,KAAK;AACd"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isReferenced;
7
-
8
7
  function isReferenced(node, parent, grandparent) {
9
8
  switch (parent.type) {
10
9
  case "MemberExpression":
@@ -12,12 +11,9 @@ function isReferenced(node, parent, grandparent) {
12
11
  if (parent.property === node) {
13
12
  return !!parent.computed;
14
13
  }
15
-
16
14
  return parent.object === node;
17
-
18
15
  case "JSXMemberExpression":
19
16
  return parent.object === node;
20
-
21
17
  case "VariableDeclarator":
22
18
  return parent.init === node;
23
19
 
@@ -33,24 +29,19 @@ function isReferenced(node, parent, grandparent) {
33
29
  if (parent.key === node) {
34
30
  return !!parent.computed;
35
31
  }
36
-
37
32
  return false;
38
33
 
39
34
  case "ObjectProperty":
40
35
  if (parent.key === node) {
41
36
  return !!parent.computed;
42
37
  }
43
-
44
38
  return !grandparent || grandparent.type !== "ObjectPattern";
45
-
46
39
  case "ClassProperty":
47
40
  case "ClassAccessorProperty":
48
41
  if (parent.key === node) {
49
42
  return !!parent.computed;
50
43
  }
51
-
52
44
  return true;
53
-
54
45
  case "ClassPrivateProperty":
55
46
  return parent.key !== node;
56
47
 
@@ -72,7 +63,6 @@ function isReferenced(node, parent, grandparent) {
72
63
 
73
64
  case "RestElement":
74
65
  return false;
75
-
76
66
  case "BreakStatement":
77
67
  case "ContinueStatement":
78
68
  return false;
@@ -89,7 +79,6 @@ function isReferenced(node, parent, grandparent) {
89
79
  if (grandparent != null && grandparent.source) {
90
80
  return false;
91
81
  }
92
-
93
82
  return parent.local === node;
94
83
 
95
84
  case "ImportDefaultSpecifier":
@@ -120,10 +109,8 @@ function isReferenced(node, parent, grandparent) {
120
109
  if (parent.key === node) {
121
110
  return !!parent.computed;
122
111
  }
123
-
124
112
  return true;
125
113
  }
126
-
127
114
  return true;
128
115
  }
129
116
 
@@ -1 +1 @@
1
- {"version":3,"names":["isReferenced","node","parent","grandparent","type","property","computed","object","init","body","key","superClass","right","source","local","id"],"sources":["../../src/validators/isReferenced.ts"],"sourcesContent":["import type * as t from \"..\";\n\n/**\n * Check if the input `node` is a reference to a bound variable.\n */\nexport default function isReferenced(\n node: t.Node,\n parent: t.Node,\n grandparent?: t.Node,\n): boolean {\n switch (parent.type) {\n // yes: PARENT[NODE]\n // yes: NODE.child\n // no: parent.NODE\n case \"MemberExpression\":\n case \"OptionalMemberExpression\":\n if (parent.property === node) {\n return !!parent.computed;\n }\n return parent.object === node;\n\n case \"JSXMemberExpression\":\n return parent.object === node;\n // no: let NODE = init;\n // yes: let id = NODE;\n case \"VariableDeclarator\":\n return parent.init === node;\n\n // yes: () => NODE\n // no: (NODE) => {}\n case \"ArrowFunctionExpression\":\n return parent.body === node;\n\n // no: class { #NODE; }\n // no: class { get #NODE() {} }\n // no: class { #NODE() {} }\n // no: class { fn() { return this.#NODE; } }\n case \"PrivateName\":\n return false;\n\n // no: class { NODE() {} }\n // yes: class { [NODE]() {} }\n // no: class { foo(NODE) {} }\n case \"ClassMethod\":\n case \"ClassPrivateMethod\":\n case \"ObjectMethod\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n return false;\n\n // yes: { [NODE]: \"\" }\n // no: { NODE: \"\" }\n // depends: { NODE }\n // depends: { key: NODE }\n case \"ObjectProperty\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n // parent.value === node\n return !grandparent || grandparent.type !== \"ObjectPattern\";\n // no: class { NODE = value; }\n // yes: class { [NODE] = value; }\n // yes: class { key = NODE; }\n case \"ClassProperty\":\n case \"ClassAccessorProperty\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n return true;\n case \"ClassPrivateProperty\":\n return parent.key !== node;\n\n // no: class NODE {}\n // yes: class Foo extends NODE {}\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return parent.superClass === node;\n\n // yes: left = NODE;\n // no: NODE = right;\n case \"AssignmentExpression\":\n return parent.right === node;\n\n // no: [NODE = foo] = [];\n // yes: [foo = NODE] = [];\n case \"AssignmentPattern\":\n return parent.right === node;\n\n // no: NODE: for (;;) {}\n case \"LabeledStatement\":\n return false;\n\n // no: try {} catch (NODE) {}\n case \"CatchClause\":\n return false;\n\n // no: function foo(...NODE) {}\n case \"RestElement\":\n return false;\n\n case \"BreakStatement\":\n case \"ContinueStatement\":\n return false;\n\n // no: function NODE() {}\n // no: function foo(NODE) {}\n case \"FunctionDeclaration\":\n case \"FunctionExpression\":\n return false;\n\n // no: export NODE from \"foo\";\n // no: export * as NODE from \"foo\";\n case \"ExportNamespaceSpecifier\":\n case \"ExportDefaultSpecifier\":\n return false;\n\n // no: export { foo as NODE };\n // yes: export { NODE as foo };\n // no: export { NODE as foo } from \"foo\";\n case \"ExportSpecifier\":\n // @ts-expect-error todo(flow->ts): Property 'source' does not exist on type 'AnyTypeAnnotation'.\n if (grandparent?.source) {\n return false;\n }\n return parent.local === node;\n\n // no: import NODE from \"foo\";\n // no: import * as NODE from \"foo\";\n // no: import { NODE as foo } from \"foo\";\n // no: import { foo as NODE } from \"foo\";\n // no: import NODE from \"bar\";\n case \"ImportDefaultSpecifier\":\n case \"ImportNamespaceSpecifier\":\n case \"ImportSpecifier\":\n return false;\n\n // no: import \"foo\" assert { NODE: \"json\" }\n case \"ImportAttribute\":\n return false;\n\n // no: <div NODE=\"foo\" />\n case \"JSXAttribute\":\n return false;\n\n // no: [NODE] = [];\n // no: ({ NODE }) = [];\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n return false;\n\n // no: new.NODE\n // no: NODE.target\n case \"MetaProperty\":\n return false;\n\n // yes: type X = { somePropert: NODE }\n // no: type X = { NODE: OtherType }\n case \"ObjectTypeProperty\":\n return parent.key !== node;\n\n // yes: enum X { Foo = NODE }\n // no: enum X { NODE }\n case \"TSEnumMember\":\n return parent.id !== node;\n\n // yes: { [NODE]: value }\n // no: { NODE: value }\n case \"TSPropertySignature\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n\n return true;\n }\n\n return true;\n}\n"],"mappings":";;;;;;;AAKe,SAASA,YAAT,CACbC,IADa,EAEbC,MAFa,EAGbC,WAHa,EAIJ;EACT,QAAQD,MAAM,CAACE,IAAf;IAIE,KAAK,kBAAL;IACA,KAAK,0BAAL;MACE,IAAIF,MAAM,CAACG,QAAP,KAAoBJ,IAAxB,EAA8B;QAC5B,OAAO,CAAC,CAACC,MAAM,CAACI,QAAhB;MACD;;MACD,OAAOJ,MAAM,CAACK,MAAP,KAAkBN,IAAzB;;IAEF,KAAK,qBAAL;MACE,OAAOC,MAAM,CAACK,MAAP,KAAkBN,IAAzB;;IAGF,KAAK,oBAAL;MACE,OAAOC,MAAM,CAACM,IAAP,KAAgBP,IAAvB;;IAIF,KAAK,yBAAL;MACE,OAAOC,MAAM,CAACO,IAAP,KAAgBR,IAAvB;;IAMF,KAAK,aAAL;MACE,OAAO,KAAP;;IAKF,KAAK,aAAL;IACA,KAAK,oBAAL;IACA,KAAK,cAAL;MACE,IAAIC,MAAM,CAACQ,GAAP,KAAeT,IAAnB,EAAyB;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAhB;MACD;;MACD,OAAO,KAAP;;IAMF,KAAK,gBAAL;MACE,IAAIJ,MAAM,CAACQ,GAAP,KAAeT,IAAnB,EAAyB;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAhB;MACD;;MAED,OAAO,CAACH,WAAD,IAAgBA,WAAW,CAACC,IAAZ,KAAqB,eAA5C;;IAIF,KAAK,eAAL;IACA,KAAK,uBAAL;MACE,IAAIF,MAAM,CAACQ,GAAP,KAAeT,IAAnB,EAAyB;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAhB;MACD;;MACD,OAAO,IAAP;;IACF,KAAK,sBAAL;MACE,OAAOJ,MAAM,CAACQ,GAAP,KAAeT,IAAtB;;IAIF,KAAK,kBAAL;IACA,KAAK,iBAAL;MACE,OAAOC,MAAM,CAACS,UAAP,KAAsBV,IAA7B;;IAIF,KAAK,sBAAL;MACE,OAAOC,MAAM,CAACU,KAAP,KAAiBX,IAAxB;;IAIF,KAAK,mBAAL;MACE,OAAOC,MAAM,CAACU,KAAP,KAAiBX,IAAxB;;IAGF,KAAK,kBAAL;MACE,OAAO,KAAP;;IAGF,KAAK,aAAL;MACE,OAAO,KAAP;;IAGF,KAAK,aAAL;MACE,OAAO,KAAP;;IAEF,KAAK,gBAAL;IACA,KAAK,mBAAL;MACE,OAAO,KAAP;;IAIF,KAAK,qBAAL;IACA,KAAK,oBAAL;MACE,OAAO,KAAP;;IAIF,KAAK,0BAAL;IACA,KAAK,wBAAL;MACE,OAAO,KAAP;;IAKF,KAAK,iBAAL;MAEE,IAAIE,WAAJ,YAAIA,WAAW,CAAEU,MAAjB,EAAyB;QACvB,OAAO,KAAP;MACD;;MACD,OAAOX,MAAM,CAACY,KAAP,KAAiBb,IAAxB;;IAOF,KAAK,wBAAL;IACA,KAAK,0BAAL;IACA,KAAK,iBAAL;MACE,OAAO,KAAP;;IAGF,KAAK,iBAAL;MACE,OAAO,KAAP;;IAGF,KAAK,cAAL;MACE,OAAO,KAAP;;IAIF,KAAK,eAAL;IACA,KAAK,cAAL;MACE,OAAO,KAAP;;IAIF,KAAK,cAAL;MACE,OAAO,KAAP;;IAIF,KAAK,oBAAL;MACE,OAAOC,MAAM,CAACQ,GAAP,KAAeT,IAAtB;;IAIF,KAAK,cAAL;MACE,OAAOC,MAAM,CAACa,EAAP,KAAcd,IAArB;;IAIF,KAAK,qBAAL;MACE,IAAIC,MAAM,CAACQ,GAAP,KAAeT,IAAnB,EAAyB;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAhB;MACD;;MAED,OAAO,IAAP;EAnKJ;;EAsKA,OAAO,IAAP;AACD"}
1
+ {"version":3,"names":["isReferenced","node","parent","grandparent","type","property","computed","object","init","body","key","superClass","right","source","local","id"],"sources":["../../src/validators/isReferenced.ts"],"sourcesContent":["import type * as t from \"..\";\n\n/**\n * Check if the input `node` is a reference to a bound variable.\n */\nexport default function isReferenced(\n node: t.Node,\n parent: t.Node,\n grandparent?: t.Node,\n): boolean {\n switch (parent.type) {\n // yes: PARENT[NODE]\n // yes: NODE.child\n // no: parent.NODE\n case \"MemberExpression\":\n case \"OptionalMemberExpression\":\n if (parent.property === node) {\n return !!parent.computed;\n }\n return parent.object === node;\n\n case \"JSXMemberExpression\":\n return parent.object === node;\n // no: let NODE = init;\n // yes: let id = NODE;\n case \"VariableDeclarator\":\n return parent.init === node;\n\n // yes: () => NODE\n // no: (NODE) => {}\n case \"ArrowFunctionExpression\":\n return parent.body === node;\n\n // no: class { #NODE; }\n // no: class { get #NODE() {} }\n // no: class { #NODE() {} }\n // no: class { fn() { return this.#NODE; } }\n case \"PrivateName\":\n return false;\n\n // no: class { NODE() {} }\n // yes: class { [NODE]() {} }\n // no: class { foo(NODE) {} }\n case \"ClassMethod\":\n case \"ClassPrivateMethod\":\n case \"ObjectMethod\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n return false;\n\n // yes: { [NODE]: \"\" }\n // no: { NODE: \"\" }\n // depends: { NODE }\n // depends: { key: NODE }\n case \"ObjectProperty\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n // parent.value === node\n return !grandparent || grandparent.type !== \"ObjectPattern\";\n // no: class { NODE = value; }\n // yes: class { [NODE] = value; }\n // yes: class { key = NODE; }\n case \"ClassProperty\":\n case \"ClassAccessorProperty\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n return true;\n case \"ClassPrivateProperty\":\n return parent.key !== node;\n\n // no: class NODE {}\n // yes: class Foo extends NODE {}\n case \"ClassDeclaration\":\n case \"ClassExpression\":\n return parent.superClass === node;\n\n // yes: left = NODE;\n // no: NODE = right;\n case \"AssignmentExpression\":\n return parent.right === node;\n\n // no: [NODE = foo] = [];\n // yes: [foo = NODE] = [];\n case \"AssignmentPattern\":\n return parent.right === node;\n\n // no: NODE: for (;;) {}\n case \"LabeledStatement\":\n return false;\n\n // no: try {} catch (NODE) {}\n case \"CatchClause\":\n return false;\n\n // no: function foo(...NODE) {}\n case \"RestElement\":\n return false;\n\n case \"BreakStatement\":\n case \"ContinueStatement\":\n return false;\n\n // no: function NODE() {}\n // no: function foo(NODE) {}\n case \"FunctionDeclaration\":\n case \"FunctionExpression\":\n return false;\n\n // no: export NODE from \"foo\";\n // no: export * as NODE from \"foo\";\n case \"ExportNamespaceSpecifier\":\n case \"ExportDefaultSpecifier\":\n return false;\n\n // no: export { foo as NODE };\n // yes: export { NODE as foo };\n // no: export { NODE as foo } from \"foo\";\n case \"ExportSpecifier\":\n // @ts-expect-error todo(flow->ts): Property 'source' does not exist on type 'AnyTypeAnnotation'.\n if (grandparent?.source) {\n return false;\n }\n return parent.local === node;\n\n // no: import NODE from \"foo\";\n // no: import * as NODE from \"foo\";\n // no: import { NODE as foo } from \"foo\";\n // no: import { foo as NODE } from \"foo\";\n // no: import NODE from \"bar\";\n case \"ImportDefaultSpecifier\":\n case \"ImportNamespaceSpecifier\":\n case \"ImportSpecifier\":\n return false;\n\n // no: import \"foo\" assert { NODE: \"json\" }\n case \"ImportAttribute\":\n return false;\n\n // no: <div NODE=\"foo\" />\n case \"JSXAttribute\":\n return false;\n\n // no: [NODE] = [];\n // no: ({ NODE }) = [];\n case \"ObjectPattern\":\n case \"ArrayPattern\":\n return false;\n\n // no: new.NODE\n // no: NODE.target\n case \"MetaProperty\":\n return false;\n\n // yes: type X = { somePropert: NODE }\n // no: type X = { NODE: OtherType }\n case \"ObjectTypeProperty\":\n return parent.key !== node;\n\n // yes: enum X { Foo = NODE }\n // no: enum X { NODE }\n case \"TSEnumMember\":\n return parent.id !== node;\n\n // yes: { [NODE]: value }\n // no: { NODE: value }\n case \"TSPropertySignature\":\n if (parent.key === node) {\n return !!parent.computed;\n }\n\n return true;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAKe,SAASA,YAAY,CAClCC,IAAY,EACZC,MAAc,EACdC,WAAoB,EACX;EACT,QAAQD,MAAM,CAACE,IAAI;IAIjB,KAAK,kBAAkB;IACvB,KAAK,0BAA0B;MAC7B,IAAIF,MAAM,CAACG,QAAQ,KAAKJ,IAAI,EAAE;QAC5B,OAAO,CAAC,CAACC,MAAM,CAACI,QAAQ;MAC1B;MACA,OAAOJ,MAAM,CAACK,MAAM,KAAKN,IAAI;IAE/B,KAAK,qBAAqB;MACxB,OAAOC,MAAM,CAACK,MAAM,KAAKN,IAAI;IAG/B,KAAK,oBAAoB;MACvB,OAAOC,MAAM,CAACM,IAAI,KAAKP,IAAI;;IAI7B,KAAK,yBAAyB;MAC5B,OAAOC,MAAM,CAACO,IAAI,KAAKR,IAAI;;IAM7B,KAAK,aAAa;MAChB,OAAO,KAAK;;IAKd,KAAK,aAAa;IAClB,KAAK,oBAAoB;IACzB,KAAK,cAAc;MACjB,IAAIC,MAAM,CAACQ,GAAG,KAAKT,IAAI,EAAE;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAQ;MAC1B;MACA,OAAO,KAAK;;IAMd,KAAK,gBAAgB;MACnB,IAAIJ,MAAM,CAACQ,GAAG,KAAKT,IAAI,EAAE;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAQ;MAC1B;MAEA,OAAO,CAACH,WAAW,IAAIA,WAAW,CAACC,IAAI,KAAK,eAAe;IAI7D,KAAK,eAAe;IACpB,KAAK,uBAAuB;MAC1B,IAAIF,MAAM,CAACQ,GAAG,KAAKT,IAAI,EAAE;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAQ;MAC1B;MACA,OAAO,IAAI;IACb,KAAK,sBAAsB;MACzB,OAAOJ,MAAM,CAACQ,GAAG,KAAKT,IAAI;;IAI5B,KAAK,kBAAkB;IACvB,KAAK,iBAAiB;MACpB,OAAOC,MAAM,CAACS,UAAU,KAAKV,IAAI;;IAInC,KAAK,sBAAsB;MACzB,OAAOC,MAAM,CAACU,KAAK,KAAKX,IAAI;;IAI9B,KAAK,mBAAmB;MACtB,OAAOC,MAAM,CAACU,KAAK,KAAKX,IAAI;;IAG9B,KAAK,kBAAkB;MACrB,OAAO,KAAK;;IAGd,KAAK,aAAa;MAChB,OAAO,KAAK;;IAGd,KAAK,aAAa;MAChB,OAAO,KAAK;IAEd,KAAK,gBAAgB;IACrB,KAAK,mBAAmB;MACtB,OAAO,KAAK;;IAId,KAAK,qBAAqB;IAC1B,KAAK,oBAAoB;MACvB,OAAO,KAAK;;IAId,KAAK,0BAA0B;IAC/B,KAAK,wBAAwB;MAC3B,OAAO,KAAK;;IAKd,KAAK,iBAAiB;MAEpB,IAAIE,WAAW,YAAXA,WAAW,CAAEU,MAAM,EAAE;QACvB,OAAO,KAAK;MACd;MACA,OAAOX,MAAM,CAACY,KAAK,KAAKb,IAAI;;IAO9B,KAAK,wBAAwB;IAC7B,KAAK,0BAA0B;IAC/B,KAAK,iBAAiB;MACpB,OAAO,KAAK;;IAGd,KAAK,iBAAiB;MACpB,OAAO,KAAK;;IAGd,KAAK,cAAc;MACjB,OAAO,KAAK;;IAId,KAAK,eAAe;IACpB,KAAK,cAAc;MACjB,OAAO,KAAK;;IAId,KAAK,cAAc;MACjB,OAAO,KAAK;;IAId,KAAK,oBAAoB;MACvB,OAAOC,MAAM,CAACQ,GAAG,KAAKT,IAAI;;IAI5B,KAAK,cAAc;MACjB,OAAOC,MAAM,CAACa,EAAE,KAAKd,IAAI;;IAI3B,KAAK,qBAAqB;MACxB,IAAIC,MAAM,CAACQ,GAAG,KAAKT,IAAI,EAAE;QACvB,OAAO,CAAC,CAACC,MAAM,CAACI,QAAQ;MAC1B;MAEA,OAAO,IAAI;EAAC;EAGhB,OAAO,IAAI;AACb"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isScope;
7
-
8
7
  var _generated = require("./generated");
9
-
10
8
  function isScope(node, parent) {
11
9
  if ((0, _generated.isBlockStatement)(node) && ((0, _generated.isFunction)(parent) || (0, _generated.isCatchClause)(parent))) {
12
10
  return false;
@@ -15,7 +13,6 @@ function isScope(node, parent) {
15
13
  if ((0, _generated.isPattern)(node) && ((0, _generated.isFunction)(parent) || (0, _generated.isCatchClause)(parent))) {
16
14
  return true;
17
15
  }
18
-
19
16
  return (0, _generated.isScopable)(node);
20
17
  }
21
18
 
@@ -1 +1 @@
1
- {"version":3,"names":["isScope","node","parent","isBlockStatement","isFunction","isCatchClause","isPattern","isScopable"],"sources":["../../src/validators/isScope.ts"],"sourcesContent":["import {\n isFunction,\n isCatchClause,\n isBlockStatement,\n isScopable,\n isPattern,\n} from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is a scope.\n */\nexport default function isScope(node: t.Node, parent: t.Node): boolean {\n // If a BlockStatement is an immediate descendent of a Function/CatchClause, it must be in the body.\n // Hence we skipped the parentKey === \"params\" check\n if (isBlockStatement(node) && (isFunction(parent) || isCatchClause(parent))) {\n return false;\n }\n\n // If a Pattern is an immediate descendent of a Function/CatchClause, it must be in the params.\n // Hence we skipped the parentKey === \"params\" check\n if (isPattern(node) && (isFunction(parent) || isCatchClause(parent))) {\n return true;\n }\n\n return isScopable(node);\n}\n"],"mappings":";;;;;;;AAAA;;AAYe,SAASA,OAAT,CAAiBC,IAAjB,EAA+BC,MAA/B,EAAwD;EAGrE,IAAI,IAAAC,2BAAA,EAAiBF,IAAjB,MAA2B,IAAAG,qBAAA,EAAWF,MAAX,KAAsB,IAAAG,wBAAA,EAAcH,MAAd,CAAjD,CAAJ,EAA6E;IAC3E,OAAO,KAAP;EACD;;EAID,IAAI,IAAAI,oBAAA,EAAUL,IAAV,MAAoB,IAAAG,qBAAA,EAAWF,MAAX,KAAsB,IAAAG,wBAAA,EAAcH,MAAd,CAA1C,CAAJ,EAAsE;IACpE,OAAO,IAAP;EACD;;EAED,OAAO,IAAAK,qBAAA,EAAWN,IAAX,CAAP;AACD"}
1
+ {"version":3,"names":["isScope","node","parent","isBlockStatement","isFunction","isCatchClause","isPattern","isScopable"],"sources":["../../src/validators/isScope.ts"],"sourcesContent":["import {\n isFunction,\n isCatchClause,\n isBlockStatement,\n isScopable,\n isPattern,\n} from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `node` is a scope.\n */\nexport default function isScope(node: t.Node, parent: t.Node): boolean {\n // If a BlockStatement is an immediate descendent of a Function/CatchClause, it must be in the body.\n // Hence we skipped the parentKey === \"params\" check\n if (isBlockStatement(node) && (isFunction(parent) || isCatchClause(parent))) {\n return false;\n }\n\n // If a Pattern is an immediate descendent of a Function/CatchClause, it must be in the params.\n // Hence we skipped the parentKey === \"params\" check\n if (isPattern(node) && (isFunction(parent) || isCatchClause(parent))) {\n return true;\n }\n\n return isScopable(node);\n}\n"],"mappings":";;;;;;AAAA;AAYe,SAASA,OAAO,CAACC,IAAY,EAAEC,MAAc,EAAW;EAGrE,IAAI,IAAAC,2BAAgB,EAACF,IAAI,CAAC,KAAK,IAAAG,qBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,wBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IAC3E,OAAO,KAAK;EACd;;EAIA,IAAI,IAAAI,oBAAS,EAACL,IAAI,CAAC,KAAK,IAAAG,qBAAU,EAACF,MAAM,CAAC,IAAI,IAAAG,wBAAa,EAACH,MAAM,CAAC,CAAC,EAAE;IACpE,OAAO,IAAI;EACb;EAEA,OAAO,IAAAK,qBAAU,EAACN,IAAI,CAAC;AACzB"}
@@ -4,11 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isSpecifierDefault;
7
-
8
7
  var _generated = require("./generated");
9
-
10
8
  function isSpecifierDefault(specifier) {
11
- return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
9
+ return (0, _generated.isImportDefaultSpecifier)(specifier) ||
10
+ (0, _generated.isIdentifier)(specifier.imported || specifier.exported, {
12
11
  name: "default"
13
12
  });
14
13
  }
@@ -1 +1 @@
1
- {"version":3,"names":["isSpecifierDefault","specifier","isImportDefaultSpecifier","isIdentifier","imported","exported","name"],"sources":["../../src/validators/isSpecifierDefault.ts"],"sourcesContent":["import { isIdentifier, isImportDefaultSpecifier } from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `specifier` is a `default` import or export.\n */\nexport default function isSpecifierDefault(\n specifier: t.ModuleSpecifier,\n): boolean {\n return (\n isImportDefaultSpecifier(specifier) ||\n // @ts-expect-error todo(flow->ts): stricter type for specifier\n isIdentifier(specifier.imported || specifier.exported, {\n name: \"default\",\n })\n );\n}\n"],"mappings":";;;;;;;AAAA;;AAMe,SAASA,kBAAT,CACbC,SADa,EAEJ;EACT,OACE,IAAAC,mCAAA,EAAyBD,SAAzB,KAEA,IAAAE,uBAAA,EAAaF,SAAS,CAACG,QAAV,IAAsBH,SAAS,CAACI,QAA7C,EAAuD;IACrDC,IAAI,EAAE;EAD+C,CAAvD,CAHF;AAOD"}
1
+ {"version":3,"names":["isSpecifierDefault","specifier","isImportDefaultSpecifier","isIdentifier","imported","exported","name"],"sources":["../../src/validators/isSpecifierDefault.ts"],"sourcesContent":["import { isIdentifier, isImportDefaultSpecifier } from \"./generated\";\nimport type * as t from \"..\";\n\n/**\n * Check if the input `specifier` is a `default` import or export.\n */\nexport default function isSpecifierDefault(\n specifier: t.ModuleSpecifier,\n): boolean {\n return (\n isImportDefaultSpecifier(specifier) ||\n // @ts-expect-error todo(flow->ts): stricter type for specifier\n isIdentifier(specifier.imported || specifier.exported, {\n name: \"default\",\n })\n );\n}\n"],"mappings":";;;;;;AAAA;AAMe,SAASA,kBAAkB,CACxCC,SAA4B,EACnB;EACT,OACE,IAAAC,mCAAwB,EAACD,SAAS,CAAC;EAEnC,IAAAE,uBAAY,EAACF,SAAS,CAACG,QAAQ,IAAIH,SAAS,CAACI,QAAQ,EAAE;IACrDC,IAAI,EAAE;EACR,CAAC,CAAC;AAEN"}
@@ -4,22 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isType;
7
-
8
7
  var _definitions = require("../definitions");
9
-
10
8
  function isType(nodeType, targetType) {
11
9
  if (nodeType === targetType) return true;
10
+
12
11
  if (_definitions.ALIAS_KEYS[targetType]) return false;
13
12
  const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType];
14
-
15
13
  if (aliases) {
16
14
  if (aliases[0] === nodeType) return true;
17
-
18
15
  for (const alias of aliases) {
19
16
  if (nodeType === alias) return true;
20
17
  }
21
18
  }
22
-
23
19
  return false;
24
20
  }
25
21
 
@@ -1 +1 @@
1
- {"version":3,"names":["isType","nodeType","targetType","ALIAS_KEYS","aliases","FLIPPED_ALIAS_KEYS","alias"],"sources":["../../src/validators/isType.ts"],"sourcesContent":["import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function isType<T extends t.Node[\"type\"]>(\n nodeType: string,\n targetType: T,\n): nodeType is T;\n\nexport default function isType(\n nodeType: string | null | undefined,\n targetType: string,\n): boolean;\n\n/**\n * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.\n */\nexport default function isType(nodeType: string, targetType: string): boolean {\n if (nodeType === targetType) return true;\n\n // This is a fast-path. If the test above failed, but an alias key is found, then the\n // targetType was a primary node type, so there's no need to check the aliases.\n // @ts-expect-error targetType may not index ALIAS_KEYS\n if (ALIAS_KEYS[targetType]) return false;\n\n const aliases: Array<string> | undefined = FLIPPED_ALIAS_KEYS[targetType];\n if (aliases) {\n if (aliases[0] === nodeType) return true;\n\n for (const alias of aliases) {\n if (nodeType === alias) return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;AAAA;;AAgBe,SAASA,MAAT,CAAgBC,QAAhB,EAAkCC,UAAlC,EAA+D;EAC5E,IAAID,QAAQ,KAAKC,UAAjB,EAA6B,OAAO,IAAP;EAK7B,IAAIC,uBAAA,CAAWD,UAAX,CAAJ,EAA4B,OAAO,KAAP;EAE5B,MAAME,OAAkC,GAAGC,+BAAA,CAAmBH,UAAnB,CAA3C;;EACA,IAAIE,OAAJ,EAAa;IACX,IAAIA,OAAO,CAAC,CAAD,CAAP,KAAeH,QAAnB,EAA6B,OAAO,IAAP;;IAE7B,KAAK,MAAMK,KAAX,IAAoBF,OAApB,EAA6B;MAC3B,IAAIH,QAAQ,KAAKK,KAAjB,EAAwB,OAAO,IAAP;IACzB;EACF;;EAED,OAAO,KAAP;AACD"}
1
+ {"version":3,"names":["isType","nodeType","targetType","ALIAS_KEYS","aliases","FLIPPED_ALIAS_KEYS","alias"],"sources":["../../src/validators/isType.ts"],"sourcesContent":["import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from \"../definitions\";\nimport type * as t from \"..\";\n\nexport default function isType<T extends t.Node[\"type\"]>(\n nodeType: string,\n targetType: T,\n): nodeType is T;\n\nexport default function isType(\n nodeType: string | null | undefined,\n targetType: string,\n): boolean;\n\n/**\n * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.\n */\nexport default function isType(nodeType: string, targetType: string): boolean {\n if (nodeType === targetType) return true;\n\n // This is a fast-path. If the test above failed, but an alias key is found, then the\n // targetType was a primary node type, so there's no need to check the aliases.\n // @ts-expect-error targetType may not index ALIAS_KEYS\n if (ALIAS_KEYS[targetType]) return false;\n\n const aliases: Array<string> | undefined = FLIPPED_ALIAS_KEYS[targetType];\n if (aliases) {\n if (aliases[0] === nodeType) return true;\n\n for (const alias of aliases) {\n if (nodeType === alias) return true;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;AAAA;AAgBe,SAASA,MAAM,CAACC,QAAgB,EAAEC,UAAkB,EAAW;EAC5E,IAAID,QAAQ,KAAKC,UAAU,EAAE,OAAO,IAAI;;EAKxC,IAAIC,uBAAU,CAACD,UAAU,CAAC,EAAE,OAAO,KAAK;EAExC,MAAME,OAAkC,GAAGC,+BAAkB,CAACH,UAAU,CAAC;EACzE,IAAIE,OAAO,EAAE;IACX,IAAIA,OAAO,CAAC,CAAC,CAAC,KAAKH,QAAQ,EAAE,OAAO,IAAI;IAExC,KAAK,MAAMK,KAAK,IAAIF,OAAO,EAAE;MAC3B,IAAIH,QAAQ,KAAKK,KAAK,EAAE,OAAO,IAAI;IACrC;EACF;EAEA,OAAO,KAAK;AACd"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isValidES3Identifier;
7
-
8
7
  var _isValidIdentifier = require("./isValidIdentifier");
9
-
10
8
  const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]);
11
9
 
12
10
  function isValidES3Identifier(name) {
@@ -1 +1 @@
1
- {"version":3,"names":["RESERVED_WORDS_ES3_ONLY","Set","isValidES3Identifier","name","isValidIdentifier","has"],"sources":["../../src/validators/isValidES3Identifier.ts"],"sourcesContent":["import isValidIdentifier from \"./isValidIdentifier\";\n\nconst RESERVED_WORDS_ES3_ONLY: Set<string> = new Set([\n \"abstract\",\n \"boolean\",\n \"byte\",\n \"char\",\n \"double\",\n \"enum\",\n \"final\",\n \"float\",\n \"goto\",\n \"implements\",\n \"int\",\n \"interface\",\n \"long\",\n \"native\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"short\",\n \"static\",\n \"synchronized\",\n \"throws\",\n \"transient\",\n \"volatile\",\n]);\n\n/**\n * Check if the input `name` is a valid identifier name according to the ES3 specification.\n *\n * Additional ES3 reserved words are\n */\nexport default function isValidES3Identifier(name: string): boolean {\n return isValidIdentifier(name) && !RESERVED_WORDS_ES3_ONLY.has(name);\n}\n"],"mappings":";;;;;;;AAAA;;AAEA,MAAMA,uBAAoC,GAAG,IAAIC,GAAJ,CAAQ,CACnD,UADmD,EAEnD,SAFmD,EAGnD,MAHmD,EAInD,MAJmD,EAKnD,QALmD,EAMnD,MANmD,EAOnD,OAPmD,EAQnD,OARmD,EASnD,MATmD,EAUnD,YAVmD,EAWnD,KAXmD,EAYnD,WAZmD,EAanD,MAbmD,EAcnD,QAdmD,EAenD,SAfmD,EAgBnD,SAhBmD,EAiBnD,WAjBmD,EAkBnD,QAlBmD,EAmBnD,OAnBmD,EAoBnD,QApBmD,EAqBnD,cArBmD,EAsBnD,QAtBmD,EAuBnD,WAvBmD,EAwBnD,UAxBmD,CAAR,CAA7C;;AAgCe,SAASC,oBAAT,CAA8BC,IAA9B,EAAqD;EAClE,OAAO,IAAAC,0BAAA,EAAkBD,IAAlB,KAA2B,CAACH,uBAAuB,CAACK,GAAxB,CAA4BF,IAA5B,CAAnC;AACD"}
1
+ {"version":3,"names":["RESERVED_WORDS_ES3_ONLY","Set","isValidES3Identifier","name","isValidIdentifier","has"],"sources":["../../src/validators/isValidES3Identifier.ts"],"sourcesContent":["import isValidIdentifier from \"./isValidIdentifier\";\n\nconst RESERVED_WORDS_ES3_ONLY: Set<string> = new Set([\n \"abstract\",\n \"boolean\",\n \"byte\",\n \"char\",\n \"double\",\n \"enum\",\n \"final\",\n \"float\",\n \"goto\",\n \"implements\",\n \"int\",\n \"interface\",\n \"long\",\n \"native\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"short\",\n \"static\",\n \"synchronized\",\n \"throws\",\n \"transient\",\n \"volatile\",\n]);\n\n/**\n * Check if the input `name` is a valid identifier name according to the ES3 specification.\n *\n * Additional ES3 reserved words are\n */\nexport default function isValidES3Identifier(name: string): boolean {\n return isValidIdentifier(name) && !RESERVED_WORDS_ES3_ONLY.has(name);\n}\n"],"mappings":";;;;;;AAAA;AAEA,MAAMA,uBAAoC,GAAG,IAAIC,GAAG,CAAC,CACnD,UAAU,EACV,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,WAAW,EACX,UAAU,CACX,CAAC;;AAOa,SAASC,oBAAoB,CAACC,IAAY,EAAW;EAClE,OAAO,IAAAC,0BAAiB,EAACD,IAAI,CAAC,IAAI,CAACH,uBAAuB,CAACK,GAAG,CAACF,IAAI,CAAC;AACtE"}
@@ -4,18 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isValidIdentifier;
7
-
8
7
  var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
9
-
10
8
  function isValidIdentifier(name, reserved = true) {
11
9
  if (typeof name !== "string") return false;
12
-
13
10
  if (reserved) {
14
11
  if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name, true)) {
15
12
  return false;
16
13
  }
17
14
  }
18
-
19
15
  return (0, _helperValidatorIdentifier.isIdentifierName)(name);
20
16
  }
21
17
 
@@ -1 +1 @@
1
- {"version":3,"names":["isValidIdentifier","name","reserved","isKeyword","isStrictReservedWord","isIdentifierName"],"sources":["../../src/validators/isValidIdentifier.ts"],"sourcesContent":["import {\n isIdentifierName,\n isStrictReservedWord,\n isKeyword,\n} from \"@babel/helper-validator-identifier\";\n\n/**\n * Check if the input `name` is a valid identifier name\n * and isn't a reserved word.\n */\nexport default function isValidIdentifier(\n name: string,\n reserved: boolean = true,\n): boolean {\n if (typeof name !== \"string\") return false;\n\n if (reserved) {\n // \"await\" is invalid in module, valid in script; better be safe (see #4952)\n if (isKeyword(name) || isStrictReservedWord(name, true)) {\n return false;\n }\n }\n\n return isIdentifierName(name);\n}\n"],"mappings":";;;;;;;AAAA;;AAUe,SAASA,iBAAT,CACbC,IADa,EAEbC,QAAiB,GAAG,IAFP,EAGJ;EACT,IAAI,OAAOD,IAAP,KAAgB,QAApB,EAA8B,OAAO,KAAP;;EAE9B,IAAIC,QAAJ,EAAc;IAEZ,IAAI,IAAAC,oCAAA,EAAUF,IAAV,KAAmB,IAAAG,+CAAA,EAAqBH,IAArB,EAA2B,IAA3B,CAAvB,EAAyD;MACvD,OAAO,KAAP;IACD;EACF;;EAED,OAAO,IAAAI,2CAAA,EAAiBJ,IAAjB,CAAP;AACD"}
1
+ {"version":3,"names":["isValidIdentifier","name","reserved","isKeyword","isStrictReservedWord","isIdentifierName"],"sources":["../../src/validators/isValidIdentifier.ts"],"sourcesContent":["import {\n isIdentifierName,\n isStrictReservedWord,\n isKeyword,\n} from \"@babel/helper-validator-identifier\";\n\n/**\n * Check if the input `name` is a valid identifier name\n * and isn't a reserved word.\n */\nexport default function isValidIdentifier(\n name: string,\n reserved: boolean = true,\n): boolean {\n if (typeof name !== \"string\") return false;\n\n if (reserved) {\n // \"await\" is invalid in module, valid in script; better be safe (see #4952)\n if (isKeyword(name) || isStrictReservedWord(name, true)) {\n return false;\n }\n }\n\n return isIdentifierName(name);\n}\n"],"mappings":";;;;;;AAAA;AAUe,SAASA,iBAAiB,CACvCC,IAAY,EACZC,QAAiB,GAAG,IAAI,EACf;EACT,IAAI,OAAOD,IAAI,KAAK,QAAQ,EAAE,OAAO,KAAK;EAE1C,IAAIC,QAAQ,EAAE;IAEZ,IAAI,IAAAC,oCAAS,EAACF,IAAI,CAAC,IAAI,IAAAG,+CAAoB,EAACH,IAAI,EAAE,IAAI,CAAC,EAAE;MACvD,OAAO,KAAK;IACd;EACF;EAEA,OAAO,IAAAI,2CAAgB,EAACJ,IAAI,CAAC;AAC/B"}
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = isVar;
7
-
8
7
  var _generated = require("./generated");
9
-
10
8
  var _constants = require("../constants");
11
-
12
9
  function isVar(node) {
13
10
  return (0, _generated.isVariableDeclaration)(node, {
14
11
  kind: "var"
15
- }) && !node[_constants.BLOCK_SCOPED_SYMBOL];
12
+ }) && !
13
+ node[_constants.BLOCK_SCOPED_SYMBOL];
16
14
  }
17
15
 
18
16
  //# sourceMappingURL=isVar.js.map