@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
@@ -1 +1 @@
1
- {"version":3,"names":["valueToNode","objectToString","Function","call","bind","Object","prototype","toString","isRegExp","value","isPlainObject","proto","getPrototypeOf","undefined","identifier","booleanLiteral","nullLiteral","stringLiteral","result","Number","isFinite","numericLiteral","Math","abs","numerator","isNaN","binaryExpression","is","unaryExpression","pattern","source","flags","match","regExpLiteral","Array","isArray","arrayExpression","map","props","key","keys","nodeKey","isValidIdentifier","push","objectProperty","objectExpression","Error"],"sources":["../../src/converters/valueToNode.ts"],"sourcesContent":["import isValidIdentifier from \"../validators/isValidIdentifier\";\nimport {\n identifier,\n booleanLiteral,\n nullLiteral,\n stringLiteral,\n numericLiteral,\n regExpLiteral,\n arrayExpression,\n objectProperty,\n objectExpression,\n unaryExpression,\n binaryExpression,\n} from \"../builders/generated\";\nimport type * as t from \"..\";\n\nexport default valueToNode as {\n (value: undefined): t.Identifier; // TODO: This should return \"void 0\"\n (value: boolean): t.BooleanLiteral;\n (value: null): t.NullLiteral;\n (value: string): t.StringLiteral;\n // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression\n (value: number): t.NumericLiteral | t.BinaryExpression | t.UnaryExpression;\n (value: RegExp): t.RegExpLiteral;\n (value: ReadonlyArray<unknown>): t.ArrayExpression;\n\n // this throws with objects that are not plain objects,\n // or if there are non-valueToNode-able values\n (value: object): t.ObjectExpression;\n\n (value: unknown): t.Expression;\n};\n\n// @ts-expect-error: Object.prototype.toString must return a string\nconst objectToString: (value: unknown) => string = Function.call.bind(\n Object.prototype.toString,\n);\n\nfunction isRegExp(value: unknown): value is RegExp {\n return objectToString(value) === \"[object RegExp]\";\n}\n\nfunction isPlainObject(value: unknown): value is object {\n if (\n typeof value !== \"object\" ||\n value === null ||\n Object.prototype.toString.call(value) !== \"[object Object]\"\n ) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n // Object.prototype's __proto__ is null. Every other class's __proto__.__proto__ is\n // not null by default. We cannot check if proto === Object.prototype because it\n // could come from another realm.\n return proto === null || Object.getPrototypeOf(proto) === null;\n}\n\nfunction valueToNode(value: unknown): t.Expression {\n // undefined\n if (value === undefined) {\n return identifier(\"undefined\");\n }\n\n // boolean\n if (value === true || value === false) {\n return booleanLiteral(value);\n }\n\n // null\n if (value === null) {\n return nullLiteral();\n }\n\n // strings\n if (typeof value === \"string\") {\n return stringLiteral(value);\n }\n\n // numbers\n if (typeof value === \"number\") {\n let result;\n if (Number.isFinite(value)) {\n result = numericLiteral(Math.abs(value));\n } else {\n let numerator;\n if (Number.isNaN(value)) {\n // NaN\n numerator = numericLiteral(0);\n } else {\n // Infinity / -Infinity\n numerator = numericLiteral(1);\n }\n\n result = binaryExpression(\"/\", numerator, numericLiteral(0));\n }\n\n if (value < 0 || Object.is(value, -0)) {\n result = unaryExpression(\"-\", result);\n }\n\n return result;\n }\n\n // regexes\n if (isRegExp(value)) {\n const pattern = value.source;\n const flags = value.toString().match(/\\/([a-z]+|)$/)[1];\n return regExpLiteral(pattern, flags);\n }\n\n // array\n if (Array.isArray(value)) {\n return arrayExpression(value.map(valueToNode));\n }\n\n // object\n if (isPlainObject(value)) {\n const props = [];\n for (const key of Object.keys(value)) {\n let nodeKey;\n if (isValidIdentifier(key)) {\n nodeKey = identifier(key);\n } else {\n nodeKey = stringLiteral(key);\n }\n props.push(\n objectProperty(\n nodeKey,\n valueToNode(\n // @ts-expect-error key must present in value\n value[key],\n ),\n ),\n );\n }\n return objectExpression(props);\n }\n\n throw new Error(\"don't know how to turn this value into a node\");\n}\n"],"mappings":"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"}
1
+ {"version":3,"names":["valueToNode","objectToString","Function","call","bind","Object","prototype","toString","isRegExp","value","isPlainObject","proto","getPrototypeOf","undefined","identifier","booleanLiteral","nullLiteral","stringLiteral","result","Number","isFinite","numericLiteral","Math","abs","numerator","isNaN","binaryExpression","is","unaryExpression","pattern","source","flags","match","regExpLiteral","Array","isArray","arrayExpression","map","props","key","keys","nodeKey","isValidIdentifier","push","objectProperty","objectExpression","Error"],"sources":["../../src/converters/valueToNode.ts"],"sourcesContent":["import isValidIdentifier from \"../validators/isValidIdentifier\";\nimport {\n identifier,\n booleanLiteral,\n nullLiteral,\n stringLiteral,\n numericLiteral,\n regExpLiteral,\n arrayExpression,\n objectProperty,\n objectExpression,\n unaryExpression,\n binaryExpression,\n} from \"../builders/generated\";\nimport type * as t from \"..\";\n\nexport default valueToNode as {\n (value: undefined): t.Identifier; // TODO: This should return \"void 0\"\n (value: boolean): t.BooleanLiteral;\n (value: null): t.NullLiteral;\n (value: string): t.StringLiteral;\n // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression\n (value: number): t.NumericLiteral | t.BinaryExpression | t.UnaryExpression;\n (value: RegExp): t.RegExpLiteral;\n (value: ReadonlyArray<unknown>): t.ArrayExpression;\n\n // this throws with objects that are not plain objects,\n // or if there are non-valueToNode-able values\n (value: object): t.ObjectExpression;\n\n (value: unknown): t.Expression;\n};\n\n// @ts-expect-error: Object.prototype.toString must return a string\nconst objectToString: (value: unknown) => string = Function.call.bind(\n Object.prototype.toString,\n);\n\nfunction isRegExp(value: unknown): value is RegExp {\n return objectToString(value) === \"[object RegExp]\";\n}\n\nfunction isPlainObject(value: unknown): value is object {\n if (\n typeof value !== \"object\" ||\n value === null ||\n Object.prototype.toString.call(value) !== \"[object Object]\"\n ) {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n // Object.prototype's __proto__ is null. Every other class's __proto__.__proto__ is\n // not null by default. We cannot check if proto === Object.prototype because it\n // could come from another realm.\n return proto === null || Object.getPrototypeOf(proto) === null;\n}\n\nfunction valueToNode(value: unknown): t.Expression {\n // undefined\n if (value === undefined) {\n return identifier(\"undefined\");\n }\n\n // boolean\n if (value === true || value === false) {\n return booleanLiteral(value);\n }\n\n // null\n if (value === null) {\n return nullLiteral();\n }\n\n // strings\n if (typeof value === \"string\") {\n return stringLiteral(value);\n }\n\n // numbers\n if (typeof value === \"number\") {\n let result;\n if (Number.isFinite(value)) {\n result = numericLiteral(Math.abs(value));\n } else {\n let numerator;\n if (Number.isNaN(value)) {\n // NaN\n numerator = numericLiteral(0);\n } else {\n // Infinity / -Infinity\n numerator = numericLiteral(1);\n }\n\n result = binaryExpression(\"/\", numerator, numericLiteral(0));\n }\n\n if (value < 0 || Object.is(value, -0)) {\n result = unaryExpression(\"-\", result);\n }\n\n return result;\n }\n\n // regexes\n if (isRegExp(value)) {\n const pattern = value.source;\n const flags = value.toString().match(/\\/([a-z]+|)$/)[1];\n return regExpLiteral(pattern, flags);\n }\n\n // array\n if (Array.isArray(value)) {\n return arrayExpression(value.map(valueToNode));\n }\n\n // object\n if (isPlainObject(value)) {\n const props = [];\n for (const key of Object.keys(value)) {\n let nodeKey;\n if (isValidIdentifier(key)) {\n nodeKey = identifier(key);\n } else {\n nodeKey = stringLiteral(key);\n }\n props.push(\n objectProperty(\n nodeKey,\n valueToNode(\n // @ts-expect-error key must present in value\n value[key],\n ),\n ),\n );\n }\n return objectExpression(props);\n }\n\n throw new Error(\"don't know how to turn this value into a node\");\n}\n"],"mappings":"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"}
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.patternLikeCommon = exports.functionTypeAnnotationCommon = exports.functionDeclarationCommon = exports.functionCommon = exports.classMethodOrPropertyCommon = exports.classMethodOrDeclareMethodCommon = void 0;
7
-
8
7
  var _is = require("../validators/is");
9
-
10
8
  var _isValidIdentifier = require("../validators/isValidIdentifier");
11
-
12
9
  var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
13
-
14
10
  var _helperStringParser = require("@babel/helper-string-parser");
15
-
16
11
  var _constants = require("../constants");
17
-
18
12
  var _utils = require("./utils");
19
-
20
13
  const defineType = (0, _utils.defineAliasedType)("Standardized");
21
14
  defineType("ArrayExpression", {
22
15
  fields: {
@@ -35,7 +28,6 @@ defineType("AssignmentExpression", {
35
28
  if (!process.env.BABEL_TYPES_8_BREAKING) {
36
29
  return (0, _utils.assertValueType)("string");
37
30
  }
38
-
39
31
  const identifier = (0, _utils.assertOneOf)(..._constants.ASSIGNMENT_OPERATORS);
40
32
  const pattern = (0, _utils.assertOneOf)("=");
41
33
  return function (node, key, val) {
@@ -68,7 +60,8 @@ defineType("BinaryExpression", {
68
60
  const validator = Object.assign(function (node, key, val) {
69
61
  const validator = node.operator === "in" ? inOp : expression;
70
62
  validator(node, key, val);
71
- }, {
63
+ },
64
+ {
72
65
  oneOfNodeTypes: ["Expression", "PrivateName"]
73
66
  });
74
67
  return validator;
@@ -280,7 +273,6 @@ defineType("ForStatement", {
280
273
  }
281
274
  }
282
275
  });
283
-
284
276
  const functionCommon = () => ({
285
277
  params: {
286
278
  validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement")))
@@ -292,22 +284,20 @@ const functionCommon = () => ({
292
284
  default: false
293
285
  }
294
286
  });
295
-
296
287
  exports.functionCommon = functionCommon;
297
-
298
288
  const functionTypeAnnotationCommon = () => ({
299
289
  returnType: {
300
- validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
290
+ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
291
+ "Noop"),
301
292
  optional: true
302
293
  },
303
294
  typeParameters: {
304
- validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
295
+ validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
296
+ "Noop"),
305
297
  optional: true
306
298
  }
307
299
  });
308
-
309
300
  exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon;
310
-
311
301
  const functionDeclarationCommon = () => Object.assign({}, functionCommon(), {
312
302
  declare: {
313
303
  validate: (0, _utils.assertValueType)("boolean"),
@@ -318,7 +308,6 @@ const functionDeclarationCommon = () => Object.assign({}, functionCommon(), {
318
308
  optional: true
319
309
  }
320
310
  });
321
-
322
311
  exports.functionDeclarationCommon = functionDeclarationCommon;
323
312
  defineType("FunctionDeclaration", {
324
313
  builder: ["id", "params", "body", "generator", "async"],
@@ -360,10 +349,10 @@ defineType("FunctionExpression", {
360
349
  }
361
350
  })
362
351
  });
363
-
364
352
  const patternLikeCommon = () => ({
365
353
  typeAnnotation: {
366
- validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
354
+ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
355
+ "Noop"),
367
356
  optional: true
368
357
  },
369
358
  decorators: {
@@ -371,7 +360,6 @@ const patternLikeCommon = () => ({
371
360
  optional: true
372
361
  }
373
362
  });
374
-
375
363
  exports.patternLikeCommon = patternLikeCommon;
376
364
  defineType("Identifier", {
377
365
  builder: ["name"],
@@ -381,7 +369,6 @@ defineType("Identifier", {
381
369
  name: {
382
370
  validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
383
371
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
384
-
385
372
  if (!(0, _isValidIdentifier.default)(val, false)) {
386
373
  throw new TypeError(`"${val}" is not a valid identifier name`);
387
374
  }
@@ -394,7 +381,6 @@ defineType("Identifier", {
394
381
  optional: true
395
382
  }
396
383
  }),
397
-
398
384
  validate(parent, key, node) {
399
385
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
400
386
  const match = /\.(\w+)$/.exec(key);
@@ -421,12 +407,12 @@ defineType("Identifier", {
421
407
  meta: node
422
408
  })) return;
423
409
  }
424
-
425
- if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && node.name !== "this") {
410
+ if (
411
+ ((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) &&
412
+ node.name !== "this") {
426
413
  throw new TypeError(`"${node.name}" is not a valid identifier`);
427
414
  }
428
415
  }
429
-
430
416
  });
431
417
  defineType("IfStatement", {
432
418
  visitor: ["test", "consequent", "alternate"],
@@ -499,7 +485,6 @@ defineType("RegExpLiteral", {
499
485
  validate: (0, _utils.chain)((0, _utils.assertValueType)("string"), Object.assign(function (node, key, val) {
500
486
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
501
487
  const invalid = /[^gimsuy]/.exec(val);
502
-
503
488
  if (invalid) {
504
489
  throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`);
505
490
  }
@@ -538,12 +523,10 @@ defineType("MemberExpression", {
538
523
  validate: function () {
539
524
  const normal = (0, _utils.assertNodeType)("Identifier", "PrivateName");
540
525
  const computed = (0, _utils.assertNodeType)("Expression");
541
-
542
526
  const validator = function (node, key, val) {
543
527
  const validator = node.computed ? computed : normal;
544
528
  validator(node, key, val);
545
529
  };
546
-
547
530
  validator.oneOfNodeTypes = ["Expression", "Identifier", "PrivateName"];
548
531
  return validator;
549
532
  }()
@@ -611,12 +594,10 @@ defineType("ObjectMethod", {
611
594
  validate: function () {
612
595
  const normal = (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral");
613
596
  const computed = (0, _utils.assertNodeType)("Expression");
614
-
615
597
  const validator = function (node, key, val) {
616
598
  const validator = node.computed ? computed : normal;
617
599
  validator(node, key, val);
618
600
  };
619
-
620
601
  validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"];
621
602
  return validator;
622
603
  }()
@@ -657,7 +638,6 @@ defineType("ObjectProperty", {
657
638
  shorthand: {
658
639
  validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) {
659
640
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
660
-
661
641
  if (val && node.computed) {
662
642
  throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true");
663
643
  }
@@ -665,7 +645,6 @@ defineType("ObjectProperty", {
665
645
  type: "boolean"
666
646
  }), function (node, key, val) {
667
647
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
668
-
669
648
  if (val && !(0, _is.default)("Identifier", node.key)) {
670
649
  throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier");
671
650
  }
@@ -703,18 +682,15 @@ defineType("RestElement", {
703
682
  optional: true
704
683
  }
705
684
  }),
706
-
707
685
  validate(parent, key) {
708
686
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
709
687
  const match = /(\w+)\[(\d+)\]/.exec(key);
710
688
  if (!match) throw new Error("Internal Babel error: malformed key.");
711
689
  const [, listKey, index] = match;
712
-
713
690
  if (parent[listKey].length > +index + 1) {
714
691
  throw new TypeError(`RestElement must be last element of ${listKey}`);
715
692
  }
716
693
  }
717
-
718
694
  });
719
695
  defineType("ReturnStatement", {
720
696
  visitor: ["argument"],
@@ -847,24 +823,22 @@ defineType("VariableDeclaration", {
847
823
  optional: true
848
824
  },
849
825
  kind: {
850
- validate: (0, _utils.assertOneOf)("var", "let", "const", "using")
826
+ validate: (0, _utils.assertOneOf)("var", "let", "const",
827
+ "using")
851
828
  },
852
829
  declarations: {
853
830
  validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("VariableDeclarator")))
854
831
  }
855
832
  },
856
-
857
833
  validate(parent, key, node) {
858
834
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
859
835
  if (!(0, _is.default)("ForXStatement", parent, {
860
836
  left: node
861
837
  })) return;
862
-
863
838
  if (node.declarations.length !== 1) {
864
839
  throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`);
865
840
  }
866
841
  }
867
-
868
842
  });
869
843
  defineType("VariableDeclarator", {
870
844
  visitor: ["id", "init"],
@@ -874,7 +848,6 @@ defineType("VariableDeclarator", {
874
848
  if (!process.env.BABEL_TYPES_8_BREAKING) {
875
849
  return (0, _utils.assertNodeType)("LVal");
876
850
  }
877
-
878
851
  const normal = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern");
879
852
  const without = (0, _utils.assertNodeType)("Identifier");
880
853
  return function (node, key, val) {
@@ -917,6 +890,7 @@ defineType("WithStatement", {
917
890
  }
918
891
  }
919
892
  });
893
+
920
894
  defineType("AssignmentPattern", {
921
895
  visitor: ["left", "right", "decorators"],
922
896
  builder: ["left", "right"],
@@ -987,7 +961,8 @@ defineType("ClassExpression", {
987
961
  optional: true
988
962
  },
989
963
  typeParameters: {
990
- validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
964
+ validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
965
+ "Noop"),
991
966
  optional: true
992
967
  },
993
968
  body: {
@@ -1023,7 +998,8 @@ defineType("ClassDeclaration", {
1023
998
  validate: (0, _utils.assertNodeType)("Identifier")
1024
999
  },
1025
1000
  typeParameters: {
1026
- validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"),
1001
+ validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration",
1002
+ "Noop"),
1027
1003
  optional: true
1028
1004
  },
1029
1005
  body: {
@@ -1062,7 +1038,6 @@ defineType("ClassDeclaration", {
1062
1038
  const identifier = (0, _utils.assertNodeType)("Identifier");
1063
1039
  return function (parent, key, node) {
1064
1040
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
1065
-
1066
1041
  if (!(0, _is.default)("ExportDefaultDeclaration", parent)) {
1067
1042
  identifier(node, "id", node.id);
1068
1043
  }
@@ -1164,7 +1139,6 @@ defineType("ForOfStatement", {
1164
1139
  if (!process.env.BABEL_TYPES_8_BREAKING) {
1165
1140
  return (0, _utils.assertNodeType)("VariableDeclaration", "LVal");
1166
1141
  }
1167
-
1168
1142
  const declaration = (0, _utils.assertNodeType)("VariableDeclaration");
1169
1143
  const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression");
1170
1144
  return function (node, key, val) {
@@ -1253,21 +1227,17 @@ defineType("MetaProperty", {
1253
1227
  validate: (0, _utils.chain)((0, _utils.assertNodeType)("Identifier"), Object.assign(function (node, key, val) {
1254
1228
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
1255
1229
  let property;
1256
-
1257
1230
  switch (val.name) {
1258
1231
  case "function":
1259
1232
  property = "sent";
1260
1233
  break;
1261
-
1262
1234
  case "new":
1263
1235
  property = "target";
1264
1236
  break;
1265
-
1266
1237
  case "import":
1267
1238
  property = "meta";
1268
1239
  break;
1269
1240
  }
1270
-
1271
1241
  if (!(0, _is.default)("Identifier", node.property, {
1272
1242
  name: property
1273
1243
  })) {
@@ -1282,7 +1252,6 @@ defineType("MetaProperty", {
1282
1252
  }
1283
1253
  }
1284
1254
  });
1285
-
1286
1255
  const classMethodOrPropertyCommon = () => ({
1287
1256
  abstract: {
1288
1257
  validate: (0, _utils.assertValueType)("boolean"),
@@ -1316,9 +1285,7 @@ const classMethodOrPropertyCommon = () => ({
1316
1285
  }(), (0, _utils.assertNodeType)("Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral", "Expression"))
1317
1286
  }
1318
1287
  });
1319
-
1320
1288
  exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon;
1321
-
1322
1289
  const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), {
1323
1290
  params: {
1324
1291
  validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Identifier", "Pattern", "RestElement", "TSParameterProperty")))
@@ -1336,7 +1303,6 @@ const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(
1336
1303
  optional: true
1337
1304
  }
1338
1305
  });
1339
-
1340
1306
  exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon;
1341
1307
  defineType("ClassMethod", {
1342
1308
  aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
@@ -1350,6 +1316,7 @@ defineType("ClassMethod", {
1350
1316
  });
1351
1317
  defineType("ObjectPattern", {
1352
1318
  visitor: ["properties", "typeAnnotation", "decorators"],
1319
+
1353
1320
  builder: ["properties"],
1354
1321
  aliases: ["Pattern", "PatternLike", "LVal"],
1355
1322
  fields: Object.assign({}, patternLikeCommon(), {
@@ -1403,11 +1370,9 @@ defineType("TemplateElement", {
1403
1370
  }), function templateElementCookedValidator(node) {
1404
1371
  const raw = node.value.raw;
1405
1372
  let unterminatedCalled = false;
1406
-
1407
1373
  const error = () => {
1408
1374
  throw new Error("Internal @babel/types error.");
1409
1375
  };
1410
-
1411
1376
  const {
1412
1377
  str,
1413
1378
  firstInvalidLoc
@@ -1415,7 +1380,6 @@ defineType("TemplateElement", {
1415
1380
  unterminated() {
1416
1381
  unterminatedCalled = true;
1417
1382
  },
1418
-
1419
1383
  strictNumericEscape: error,
1420
1384
  invalidEscapeSequence: error,
1421
1385
  numericSeparatorInEscapeSequence: error,
@@ -1440,7 +1404,8 @@ defineType("TemplateLiteral", {
1440
1404
  validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("TemplateElement")))
1441
1405
  },
1442
1406
  expressions: {
1443
- validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "TSType")), function (node, key, val) {
1407
+ validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression",
1408
+ "TSType")), function (node, key, val) {
1444
1409
  if (node.quasis.length !== val.length + 1) {
1445
1410
  throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`);
1446
1411
  }
@@ -1456,7 +1421,6 @@ defineType("YieldExpression", {
1456
1421
  delegate: {
1457
1422
  validate: (0, _utils.chain)((0, _utils.assertValueType)("boolean"), Object.assign(function (node, key, val) {
1458
1423
  if (!process.env.BABEL_TYPES_8_BREAKING) return;
1459
-
1460
1424
  if (val && !node.argument) {
1461
1425
  throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument");
1462
1426
  }
@@ -1471,6 +1435,7 @@ defineType("YieldExpression", {
1471
1435
  }
1472
1436
  }
1473
1437
  });
1438
+
1474
1439
  defineType("AwaitExpression", {
1475
1440
  builder: ["argument"],
1476
1441
  visitor: ["argument"],
@@ -1481,9 +1446,11 @@ defineType("AwaitExpression", {
1481
1446
  }
1482
1447
  }
1483
1448
  });
1449
+
1484
1450
  defineType("Import", {
1485
1451
  aliases: ["Expression"]
1486
1452
  });
1453
+
1487
1454
  defineType("BigIntLiteral", {
1488
1455
  builder: ["value"],
1489
1456
  fields: {
@@ -1517,7 +1484,8 @@ defineType("OptionalMemberExpression", {
1517
1484
  const validator = Object.assign(function (node, key, val) {
1518
1485
  const validator = node.computed ? computed : normal;
1519
1486
  validator(node, key, val);
1520
- }, {
1487
+ },
1488
+ {
1521
1489
  oneOfNodeTypes: ["Expression", "Identifier"]
1522
1490
  });
1523
1491
  return validator;
@@ -1555,6 +1523,7 @@ defineType("OptionalCallExpression", {
1555
1523
  }
1556
1524
  }
1557
1525
  });
1526
+
1558
1527
  defineType("ClassProperty", {
1559
1528
  visitor: ["key", "value", "typeAnnotation", "decorators"],
1560
1529
  builder: ["key", "value", "typeAnnotation", "decorators", "computed", "static"],
@@ -1569,7 +1538,8 @@ defineType("ClassProperty", {
1569
1538
  optional: true
1570
1539
  },
1571
1540
  typeAnnotation: {
1572
- validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
1541
+ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
1542
+ "Noop"),
1573
1543
  optional: true
1574
1544
  },
1575
1545
  decorators: {
@@ -1614,7 +1584,8 @@ defineType("ClassAccessorProperty", {
1614
1584
  optional: true
1615
1585
  },
1616
1586
  typeAnnotation: {
1617
- validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
1587
+ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
1588
+ "Noop"),
1618
1589
  optional: true
1619
1590
  },
1620
1591
  decorators: {
@@ -1648,7 +1619,8 @@ defineType("ClassPrivateProperty", {
1648
1619
  optional: true
1649
1620
  },
1650
1621
  typeAnnotation: {
1651
- validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"),
1622
+ validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation",
1623
+ "Noop"),
1652
1624
  optional: true
1653
1625
  },
1654
1626
  decorators: {