hermes-transform 0.15.0 → 0.16.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.
@@ -179,6 +179,7 @@ import type {
179
179
  TypeAnnotation,
180
180
  TypeCastExpression,
181
181
  TypeofTypeAnnotation,
182
+ TypeOperator,
182
183
  TypeParameter,
183
184
  TypeParameterDeclaration,
184
185
  TypeParameterInstantiation,
@@ -352,6 +353,7 @@ import type {
352
353
  TypeAnnotationProps,
353
354
  TypeCastExpressionProps,
354
355
  TypeofTypeAnnotationProps,
356
+ TypeOperatorProps,
355
357
  TypeParameterProps,
356
358
  TypeParameterDeclarationProps,
357
359
  TypeParameterInstantiationProps,
@@ -1622,6 +1624,14 @@ type TypeofTypeAnnotationCloneSignature = ((
1622
1624
  node: ?TypeofTypeAnnotation,
1623
1625
  newProps: Partial<TypeofTypeAnnotationProps>,
1624
1626
  ) => DetachedNode<TypeofTypeAnnotation> | null);
1627
+ type TypeOperatorCloneSignature = ((
1628
+ node: TypeOperator,
1629
+ newProps: Partial<TypeOperatorProps>,
1630
+ ) => DetachedNode<TypeOperator>) &
1631
+ ((
1632
+ node: ?TypeOperator,
1633
+ newProps: Partial<TypeOperatorProps>,
1634
+ ) => DetachedNode<TypeOperator> | null);
1625
1635
  type TypeParameterCloneSignature = ((
1626
1636
  node: TypeParameter,
1627
1637
  newProps: Partial<TypeParameterProps>,
@@ -1891,6 +1901,7 @@ export type TransformCloneSignatures = AnyTypeAnnotationCloneSignature &
1891
1901
  TypeAnnotationCloneSignature &
1892
1902
  TypeCastExpressionCloneSignature &
1893
1903
  TypeofTypeAnnotationCloneSignature &
1904
+ TypeOperatorCloneSignature &
1894
1905
  TypeParameterCloneSignature &
1895
1906
  TypeParameterDeclarationCloneSignature &
1896
1907
  TypeParameterInstantiationCloneSignature &
@@ -179,6 +179,7 @@ import type {
179
179
  TypeAnnotation,
180
180
  TypeCastExpression,
181
181
  TypeofTypeAnnotation,
182
+ TypeOperator,
182
183
  TypeParameter,
183
184
  TypeParameterDeclaration,
184
185
  TypeParameterInstantiation,
@@ -352,6 +353,7 @@ import type {
352
353
  TypeAnnotationProps,
353
354
  TypeCastExpressionProps,
354
355
  TypeofTypeAnnotationProps,
356
+ TypeOperatorProps,
355
357
  TypeParameterProps,
356
358
  TypeParameterDeclarationProps,
357
359
  TypeParameterInstantiationProps,
@@ -996,6 +998,10 @@ type TypeofTypeAnnotationModifySignature = (
996
998
  node: ?TypeofTypeAnnotation,
997
999
  newProps: Partial<TypeofTypeAnnotationProps>,
998
1000
  ) => void;
1001
+ type TypeOperatorModifySignature = (
1002
+ node: ?TypeOperator,
1003
+ newProps: Partial<TypeOperatorProps>,
1004
+ ) => void;
999
1005
  type TypeParameterModifySignature = (
1000
1006
  node: ?TypeParameter,
1001
1007
  newProps: Partial<TypeParameterProps>,
@@ -1209,6 +1215,7 @@ export type TransformModifySignatures = AnyTypeAnnotationModifySignature &
1209
1215
  TypeAnnotationModifySignature &
1210
1216
  TypeCastExpressionModifySignature &
1211
1217
  TypeofTypeAnnotationModifySignature &
1218
+ TypeOperatorModifySignature &
1212
1219
  TypeParameterModifySignature &
1213
1220
  TypeParameterDeclarationModifySignature &
1214
1221
  TypeParameterInstantiationModifySignature &
@@ -174,6 +174,7 @@ import type {
174
174
  TypeAnnotation,
175
175
  TypeCastExpression,
176
176
  TypeofTypeAnnotation,
177
+ TypeOperator,
177
178
  TypeParameter,
178
179
  TypeParameterDeclaration,
179
180
  TypeParameterInstantiation,
@@ -952,6 +953,11 @@ type TypeofTypeAnnotationReplaceSignature = (
952
953
  nodeToReplaceWith: DetachedNode<TypeofTypeAnnotation>,
953
954
  options?: $ReadOnly<{keepComments?: boolean}>,
954
955
  ) => void;
956
+ type TypeOperatorReplaceSignature = (
957
+ target: TypeOperator,
958
+ nodeToReplaceWith: DetachedNode<TypeOperator>,
959
+ options?: $ReadOnly<{keepComments?: boolean}>,
960
+ ) => void;
955
961
  type TypeParameterReplaceSignature = (
956
962
  target: TypeParameter,
957
963
  nodeToReplaceWith: DetachedNode<TypeParameter>,
@@ -1179,6 +1185,7 @@ export type TransformReplaceSignatures = AnyTypeAnnotationReplaceSignature &
1179
1185
  TypeAnnotationReplaceSignature &
1180
1186
  TypeCastExpressionReplaceSignature &
1181
1187
  TypeofTypeAnnotationReplaceSignature &
1188
+ TypeOperatorReplaceSignature &
1182
1189
  TypeParameterReplaceSignature &
1183
1190
  TypeParameterDeclarationReplaceSignature &
1184
1191
  TypeParameterInstantiationReplaceSignature &
@@ -167,6 +167,7 @@ var _exportNames = {
167
167
  TypeAnnotation: true,
168
168
  TypeCastExpression: true,
169
169
  TypeofTypeAnnotation: true,
170
+ TypeOperator: true,
170
171
  TypeParameter: true,
171
172
  TypeParameterDeclaration: true,
172
173
  TypeParameterInstantiation: true,
@@ -323,6 +324,7 @@ exports.TupleTypeSpreadElement = TupleTypeSpreadElement;
323
324
  exports.TypeAlias = TypeAlias;
324
325
  exports.TypeAnnotation = TypeAnnotation;
325
326
  exports.TypeCastExpression = TypeCastExpression;
327
+ exports.TypeOperator = TypeOperator;
326
328
  exports.TypeParameter = TypeParameter;
327
329
  exports.TypeParameterDeclaration = TypeParameterDeclaration;
328
330
  exports.TypeParameterInstantiation = TypeParameterInstantiation;
@@ -1781,6 +1783,16 @@ function TypeofTypeAnnotation(props) {
1781
1783
  return node;
1782
1784
  }
1783
1785
 
1786
+ function TypeOperator(props) {
1787
+ const node = (0, _detachedNode.detachedProps)(props.parent, {
1788
+ type: 'TypeOperator',
1789
+ operator: props.operator,
1790
+ typeAnnotation: (0, _detachedNode.asDetachedNodeForCodeGen)(props.typeAnnotation)
1791
+ });
1792
+ (0, _detachedNode.setParentPointersInDirectChildren)(node);
1793
+ return node;
1794
+ }
1795
+
1784
1796
  function TypeParameter(props) {
1785
1797
  const node = (0, _detachedNode.detachedProps)(props.parent, {
1786
1798
  type: 'TypeParameter',
@@ -165,6 +165,7 @@ import type {
165
165
  TypeAnnotation as TypeAnnotationType,
166
166
  TypeCastExpression as TypeCastExpressionType,
167
167
  TypeofTypeAnnotation as TypeofTypeAnnotationType,
168
+ TypeOperator as TypeOperatorType,
168
169
  TypeParameter as TypeParameterType,
169
170
  TypeParameterDeclaration as TypeParameterDeclarationType,
170
171
  TypeParameterInstantiation as TypeParameterInstantiationType,
@@ -1019,6 +1020,11 @@ export type TypeofTypeAnnotationProps = {
1019
1020
  +argument: MaybeDetachedNode<TypeofTypeAnnotationType['argument']>,
1020
1021
  };
1021
1022
 
1023
+ export type TypeOperatorProps = {
1024
+ +operator: TypeOperatorType['operator'],
1025
+ +typeAnnotation: MaybeDetachedNode<TypeOperatorType['typeAnnotation']>,
1026
+ };
1027
+
1022
1028
  export type TypeParameterProps = {
1023
1029
  +name: TypeParameterType['name'],
1024
1030
  +bound?: ?MaybeDetachedNode<TypeParameterType['bound']>,
@@ -2951,6 +2957,19 @@ export function TypeofTypeAnnotation(props: {
2951
2957
  return node;
2952
2958
  }
2953
2959
 
2960
+ export function TypeOperator(props: {
2961
+ ...$ReadOnly<TypeOperatorProps>,
2962
+ +parent?: ESNode,
2963
+ }): DetachedNode<TypeOperatorType> {
2964
+ const node = detachedProps<TypeOperatorType>(props.parent, {
2965
+ type: 'TypeOperator',
2966
+ operator: props.operator,
2967
+ typeAnnotation: asDetachedNodeForCodeGen(props.typeAnnotation),
2968
+ });
2969
+ setParentPointersInDirectChildren(node);
2970
+ return node;
2971
+ }
2972
+
2954
2973
  export function TypeParameter(props: {
2955
2974
  ...$ReadOnly<TypeParameterProps>,
2956
2975
  +parent?: ESNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-transform",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Tools built on top of Hermes-ESTree to enable codebase transformation",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -12,13 +12,13 @@
12
12
  "@babel/code-frame": "^7.16.0",
13
13
  "esquery": "^1.4.0",
14
14
  "flow-enums-runtime": "^0.0.6",
15
- "hermes-eslint": "0.15.0",
16
- "hermes-estree": "0.15.0",
17
- "hermes-parser": "0.15.0"
15
+ "hermes-eslint": "0.16.0",
16
+ "hermes-estree": "0.16.0",
17
+ "hermes-parser": "0.16.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "prettier": "^3.0.0 || ^2.7.1",
21
- "prettier-plugin-hermes-parser": "^0.14.0"
21
+ "prettier-plugin-hermes-parser": "0.16.0"
22
22
  },
23
23
  "files": [
24
24
  "dist",