hermes-transform 0.6.0 → 0.9.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 (42) hide show
  1. package/ESLINT_LICENCE +19 -0
  2. package/PRETTIER_LICENCE +7 -0
  3. package/dist/detachedNode.js +96 -20
  4. package/dist/detachedNode.js.flow +105 -17
  5. package/dist/generated/TransformCloneSignatures.js.flow +33 -66
  6. package/dist/generated/TransformModifySignatures.js.flow +1113 -0
  7. package/dist/generated/TransformReplaceSignatures.js.flow +19 -40
  8. package/dist/generated/node-types.js +638 -905
  9. package/dist/generated/node-types.js.flow +998 -1256
  10. package/dist/generated/special-case-node-types.js +71 -77
  11. package/dist/generated/special-case-node-types.js.flow +104 -88
  12. package/dist/index.js.flow +2 -1
  13. package/dist/transform/MutationContext.js +2 -2
  14. package/dist/transform/MutationContext.js.flow +3 -2
  15. package/dist/transform/TransformContext.js +56 -43
  16. package/dist/transform/TransformContext.js.flow +154 -95
  17. package/dist/transform/comments/comments.js +133 -28
  18. package/dist/transform/comments/comments.js.flow +125 -28
  19. package/dist/transform/getTransformedAST.js +20 -12
  20. package/dist/transform/getTransformedAST.js.flow +32 -14
  21. package/dist/transform/mutations/{AddLeadingComments.js → AddComments.js} +11 -8
  22. package/dist/transform/mutations/AddComments.js.flow +50 -0
  23. package/dist/transform/mutations/CloneCommentsTo.js +1 -2
  24. package/dist/transform/mutations/CloneCommentsTo.js.flow +1 -2
  25. package/dist/transform/mutations/InsertStatement.js +3 -1
  26. package/dist/transform/mutations/InsertStatement.js.flow +7 -1
  27. package/dist/transform/mutations/RemoveNode.js +10 -3
  28. package/dist/transform/mutations/RemoveNode.js.flow +14 -3
  29. package/dist/transform/mutations/ReplaceNode.js +7 -2
  30. package/dist/transform/mutations/ReplaceNode.js.flow +5 -2
  31. package/dist/transform/mutations/ReplaceStatementWithMany.js.flow +5 -2
  32. package/dist/transform/mutations/utils/arrayUtils.js +14 -0
  33. package/dist/transform/mutations/utils/arrayUtils.js.flow +15 -0
  34. package/dist/transform/transform.js +38 -6
  35. package/dist/transform/transform.js.flow +40 -6
  36. package/dist/traverse/NodeEventGenerator.js.flow +1 -1
  37. package/dist/traverse/traverse.js +27 -3
  38. package/dist/traverse/traverse.js.flow +63 -10
  39. package/package.json +9 -4
  40. package/dist/transform/mutations/AddLeadingComments.js.flow +0 -49
  41. package/dist/transform/mutations/AddTrailingComments.js +0 -40
  42. package/dist/transform/mutations/AddTrailingComments.js.flow +0 -49
package/ESLINT_LICENCE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright OpenJS Foundation and other contributors, <www.openjsf.org>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
@@ -0,0 +1,7 @@
1
+ Copyright © James Long and contributors
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -3,8 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.asDetachedNode = void 0;
6
7
  exports.deepCloneNode = deepCloneNode;
7
8
  exports.detachedProps = detachedProps;
9
+ exports.getOriginalNode = getOriginalNode;
10
+ exports.isDetachedNode = isDetachedNode;
8
11
  exports.setParentPointersInDirectChildren = setParentPointersInDirectChildren;
9
12
  exports.shallowCloneNode = shallowCloneNode;
10
13
  exports.updateAllParentPointers = updateAllParentPointers;
@@ -22,41 +25,114 @@ var _SimpleTraverser = require("./traverse/SimpleTraverser");
22
25
  *
23
26
  * @format
24
27
  */
25
- // used by the node type function codegen
26
- function detachedProps(parent, props) {
27
- // $FlowExpectedError[incompatible-return]
28
- return { ...props,
28
+ const DETACHED_MARKER = Symbol.for('hermes-transform - Detached AST Node');
29
+ const ORIGINAL_NODE = Symbol.for('hermes-transform - Original Node');
30
+
31
+ function isDetachedNode(node) {
32
+ // $FlowExpectedError[invalid-in-lhs] flow doesn't support symbols as keys
33
+ return DETACHED_MARKER in node;
34
+ }
35
+
36
+ function getOriginalNode(node) {
37
+ // $FlowExpectedError[prop-missing]
38
+ return node[ORIGINAL_NODE];
39
+ }
40
+
41
+ const asDetachedNode = (node, {
42
+ useDeepClone
43
+ } = {
44
+ useDeepClone: false
45
+ }) => {
46
+ if (node == null) {
47
+ return null;
48
+ }
49
+
50
+ if (isDetachedNode(node)) {
51
+ return node;
52
+ }
53
+
54
+ return useDeepClone ? deepCloneNode(node, {}) : shallowCloneNode(node, {});
55
+ }; // used by the node type function codegen
56
+
57
+
58
+ exports.asDetachedNode = asDetachedNode;
59
+
60
+ function detachedProps(parent, props, config = { ...null
61
+ }) {
62
+ // $FlowExpectedError[incompatible-type]
63
+ const detachedNode = { ...props,
64
+ ...((config == null ? void 0 : config.preserveLocation) !== true ? {
65
+ // if this is [0,0] AND the file has a docblock then prettier will insert newlines between
66
+ // certain detached nodes. Because of "intended" formatting behaviour (https://github.com/prettier/prettier/issues/12078)
67
+ // this can cause us to output weirdly formatted code that should have been collapsed.
68
+ //
69
+ // prettier works backwards from the position you give it to find newlines or non whitespace
70
+ // tokens and uses this to determine if newlines should be inserted between nodes.
71
+ // By placing the range at [1, 1] we can ensure a token is always found before a newline
72
+ // and therefore no newlines will be placed between nodes.
73
+ //
74
+ // NOTE: we will still run into the bug if there is weird code like a docblock with whitespace
75
+ // characters before it. However we assume this isn't going to happen because any file
76
+ // already formatted by prettier will have that whitespace removed.
77
+ // We considered a more complex solution involving traversing the AST and manually updating
78
+ // detached node ranges after mutations are applied - however this is a lot heavier and will
79
+ // probably never be needed.
80
+ range: [1, 1],
81
+ loc: {
82
+ start: {
83
+ line: 1,
84
+ column: 0
85
+ },
86
+ end: {
87
+ line: 1,
88
+ column: 0
89
+ }
90
+ }
91
+ } : {}),
29
92
  // if not provided, then we purposely don't set this here
30
93
  // and will rely on the tooling to update it as appropriate.
31
94
  // nothing should be reading from this before it's set anyway.
32
- parent: parent,
33
- range: [0, 0],
34
- loc: {
35
- start: {
36
- line: 1,
37
- column: 0
38
- },
39
- end: {
40
- line: 1,
41
- column: 0
42
- }
43
- }
44
- };
95
+ parent: parent
96
+ }; // mark the node as detached
97
+
98
+ Object.defineProperty(detachedNode, DETACHED_MARKER, {
99
+ configurable: false,
100
+ enumerable: false,
101
+ value: true,
102
+ writable: false
103
+ });
104
+
105
+ if (config.originalNode) {
106
+ Object.defineProperty(detachedNode, ORIGINAL_NODE, {
107
+ configurable: false,
108
+ enumerable: false,
109
+ value: config.originalNode,
110
+ writable: false
111
+ });
112
+ }
113
+
114
+ return detachedNode;
45
115
  }
46
116
  /**
47
117
  * Shallowly clones the node, but not its children.
48
118
  */
49
119
 
50
120
 
51
- function shallowCloneNode(node, newProps = {}) {
52
- return detachedProps(null, Object.assign({}, node, newProps));
121
+ function shallowCloneNode(node, newProps, config = { ...null
122
+ }) {
123
+ var _config$preserveLocat, _config$originalNode;
124
+
125
+ return detachedProps(null, Object.assign({}, node, newProps), {
126
+ preserveLocation: (_config$preserveLocat = config.preserveLocation) != null ? _config$preserveLocat : true,
127
+ originalNode: (_config$originalNode = config.originalNode) != null ? _config$originalNode : node
128
+ });
53
129
  }
54
130
  /**
55
131
  * Deeply clones node and its entire tree.
56
132
  */
57
133
 
58
134
 
59
- function deepCloneNode(node, newProps = {}) {
135
+ function deepCloneNode(node, newProps) {
60
136
  const clone = Object.assign(JSON.parse(JSON.stringify(node, (key, value) => {
61
137
  // null out parent pointers
62
138
  if (key === 'parent') {
@@ -14,31 +14,115 @@ import {getVisitorKeys, isNode} from './getVisitorKeys';
14
14
  import {SimpleTraverser} from './traverse/SimpleTraverser';
15
15
 
16
16
  export opaque type DetachedNode<+T> = T;
17
+ export type MaybeDetachedNode<+T> = T | DetachedNode<T>;
18
+
19
+ type DetachConfig = $ReadOnly<{
20
+ preserveLocation?: boolean,
21
+ originalNode?: ESNode,
22
+ }>;
23
+
24
+ const DETACHED_MARKER = Symbol.for('hermes-transform - Detached AST Node');
25
+ const ORIGINAL_NODE = Symbol.for('hermes-transform - Original Node');
26
+
27
+ export function isDetachedNode(node: MaybeDetachedNode<ESNode>): boolean {
28
+ // $FlowExpectedError[invalid-in-lhs] flow doesn't support symbols as keys
29
+ return DETACHED_MARKER in node;
30
+ }
31
+ export function getOriginalNode(node: MaybeDetachedNode<ESNode>): ?ESNode {
32
+ // $FlowExpectedError[prop-missing]
33
+ return node[ORIGINAL_NODE];
34
+ }
35
+
36
+ export const asDetachedNode: {
37
+ <T: ESNode>(
38
+ node: MaybeDetachedNode<T>,
39
+ config?: {useDeepClone: boolean},
40
+ ): DetachedNode<T>,
41
+ <T: ESNode>(
42
+ node: ?MaybeDetachedNode<T>,
43
+ config?: {useDeepClone: boolean},
44
+ ): ?DetachedNode<T>,
45
+ } = <T: ESNode>(
46
+ node: ?MaybeDetachedNode<T>,
47
+ {useDeepClone}: {useDeepClone: boolean} = {useDeepClone: false},
48
+ ): // $FlowExpectedError[incompatible-type]
49
+ ?DetachedNode<T> => {
50
+ if (node == null) {
51
+ return null;
52
+ }
53
+
54
+ if (isDetachedNode(node)) {
55
+ return node;
56
+ }
57
+
58
+ return useDeepClone
59
+ ? deepCloneNode<T>(node, {})
60
+ : shallowCloneNode<T>(node, {});
61
+ };
17
62
 
18
63
  // used by the node type function codegen
19
64
  export function detachedProps<T: BaseNode>(
20
65
  parent: ?ESNode,
21
- props: {...},
66
+ props: $ReadOnly<$Partial<{...}>>,
67
+ config: DetachConfig = {...null},
22
68
  ): DetachedNode<T> {
23
- // $FlowExpectedError[incompatible-return]
24
- return {
69
+ // $FlowExpectedError[incompatible-type]
70
+ const detachedNode: DetachedNode<T> = {
25
71
  ...props,
72
+ ...(config?.preserveLocation !== true
73
+ ? {
74
+ // if this is [0,0] AND the file has a docblock then prettier will insert newlines between
75
+ // certain detached nodes. Because of "intended" formatting behaviour (https://github.com/prettier/prettier/issues/12078)
76
+ // this can cause us to output weirdly formatted code that should have been collapsed.
77
+ //
78
+ // prettier works backwards from the position you give it to find newlines or non whitespace
79
+ // tokens and uses this to determine if newlines should be inserted between nodes.
80
+ // By placing the range at [1, 1] we can ensure a token is always found before a newline
81
+ // and therefore no newlines will be placed between nodes.
82
+ //
83
+ // NOTE: we will still run into the bug if there is weird code like a docblock with whitespace
84
+ // characters before it. However we assume this isn't going to happen because any file
85
+ // already formatted by prettier will have that whitespace removed.
86
+ // We considered a more complex solution involving traversing the AST and manually updating
87
+ // detached node ranges after mutations are applied - however this is a lot heavier and will
88
+ // probably never be needed.
89
+ range: [1, 1],
90
+ loc: {
91
+ start: {
92
+ line: 1,
93
+ column: 0,
94
+ },
95
+ end: {
96
+ line: 1,
97
+ column: 0,
98
+ },
99
+ },
100
+ }
101
+ : {}),
26
102
  // if not provided, then we purposely don't set this here
27
103
  // and will rely on the tooling to update it as appropriate.
28
104
  // nothing should be reading from this before it's set anyway.
29
105
  parent: (parent: $FlowFixMe),
30
- range: [0, 0],
31
- loc: {
32
- start: {
33
- line: 1,
34
- column: 0,
35
- },
36
- end: {
37
- line: 1,
38
- column: 0,
39
- },
40
- },
41
106
  };
107
+
108
+ // mark the node as detached
109
+ Object.defineProperty(detachedNode, DETACHED_MARKER, {
110
+ configurable: false,
111
+ enumerable: false,
112
+ value: true,
113
+ writable: false,
114
+ });
115
+
116
+ if (config.originalNode) {
117
+ Object.defineProperty(detachedNode, ORIGINAL_NODE, {
118
+ configurable: false,
119
+ enumerable: false,
120
+ value: config.originalNode,
121
+ writable: false,
122
+ });
123
+ }
124
+
125
+ return detachedNode;
42
126
  }
43
127
 
44
128
  /**
@@ -46,9 +130,13 @@ export function detachedProps<T: BaseNode>(
46
130
  */
47
131
  export function shallowCloneNode<T: ESNode>(
48
132
  node: T,
49
- newProps: $Partial<{...}> = {},
133
+ newProps: $ReadOnly<$Partial<{...}>>,
134
+ config?: DetachConfig = {...null},
50
135
  ): DetachedNode<T> {
51
- return detachedProps(null, (Object.assign({}, node, newProps): $FlowFixMe));
136
+ return detachedProps(null, (Object.assign({}, node, newProps): $FlowFixMe), {
137
+ preserveLocation: config.preserveLocation ?? true,
138
+ originalNode: config.originalNode ?? node,
139
+ });
52
140
  }
53
141
 
54
142
  /**
@@ -56,7 +144,7 @@ export function shallowCloneNode<T: ESNode>(
56
144
  */
57
145
  export function deepCloneNode<T: ESNode>(
58
146
  node: T,
59
- newProps: $Partial<{...}> = {},
147
+ newProps: $ReadOnly<$Partial<{...}>>,
60
148
  ): DetachedNode<T> {
61
149
  const clone: DetachedNode<T> = Object.assign(
62
150
  JSON.parse(
@@ -33,12 +33,11 @@ import type {
33
33
  BreakStatement,
34
34
  CallExpression,
35
35
  CatchClause,
36
+ ChainExpression,
36
37
  ClassBody,
37
38
  ClassDeclaration,
38
39
  ClassExpression,
39
40
  ClassImplements,
40
- ClassPrivateProperty,
41
- ClassProperty,
42
41
  ConditionalExpression,
43
42
  ContinueStatement,
44
43
  DebuggerStatement,
@@ -69,7 +68,6 @@ import type {
69
68
  ExportAllDeclaration,
70
69
  ExportDefaultDeclaration,
71
70
  ExportNamedDeclaration,
72
- ExportNamespaceSpecifier,
73
71
  ExportSpecifier,
74
72
  ExpressionStatement,
75
73
  ForInStatement,
@@ -131,11 +129,10 @@ import type {
131
129
  ObjectTypeProperty,
132
130
  ObjectTypeSpreadProperty,
133
131
  OpaqueType,
134
- OptionalCallExpression,
135
132
  OptionalIndexedAccessType,
136
- OptionalMemberExpression,
137
- PrivateName,
133
+ PrivateIdentifier,
138
134
  Property,
135
+ PropertyDefinition,
139
136
  QualifiedTypeIdentifier,
140
137
  RegExpLiteral,
141
138
  RestElement,
@@ -194,12 +191,11 @@ import type {
194
191
  BreakStatementProps,
195
192
  CallExpressionProps,
196
193
  CatchClauseProps,
194
+ ChainExpressionProps,
197
195
  ClassBodyProps,
198
196
  ClassDeclarationProps,
199
197
  ClassExpressionProps,
200
198
  ClassImplementsProps,
201
- ClassPrivatePropertyProps,
202
- ClassPropertyProps,
203
199
  ConditionalExpressionProps,
204
200
  ContinueStatementProps,
205
201
  DebuggerStatementProps,
@@ -230,7 +226,6 @@ import type {
230
226
  ExportAllDeclarationProps,
231
227
  ExportDefaultDeclarationProps,
232
228
  ExportNamedDeclarationProps,
233
- ExportNamespaceSpecifierProps,
234
229
  ExportSpecifierProps,
235
230
  ExpressionStatementProps,
236
231
  ForInStatementProps,
@@ -292,11 +287,10 @@ import type {
292
287
  ObjectTypePropertyProps,
293
288
  ObjectTypeSpreadPropertyProps,
294
289
  OpaqueTypeProps,
295
- OptionalCallExpressionProps,
296
290
  OptionalIndexedAccessTypeProps,
297
- OptionalMemberExpressionProps,
298
- PrivateNameProps,
291
+ PrivateIdentifierProps,
299
292
  PropertyProps,
293
+ PropertyDefinitionProps,
300
294
  QualifiedTypeIdentifierProps,
301
295
  RegExpLiteralProps,
302
296
  RestElementProps,
@@ -482,6 +476,14 @@ type CatchClauseCloneSignature = ((
482
476
  node: ?CatchClause,
483
477
  newProps: $Partial<CatchClauseProps>,
484
478
  ) => DetachedNode<CatchClause> | null);
479
+ type ChainExpressionCloneSignature = ((
480
+ node: ChainExpression,
481
+ newProps: $Partial<ChainExpressionProps>,
482
+ ) => DetachedNode<ChainExpression>) &
483
+ ((
484
+ node: ?ChainExpression,
485
+ newProps: $Partial<ChainExpressionProps>,
486
+ ) => DetachedNode<ChainExpression> | null);
485
487
  type ClassBodyCloneSignature = ((
486
488
  node: ClassBody,
487
489
  newProps: $Partial<ClassBodyProps>,
@@ -514,22 +516,6 @@ type ClassImplementsCloneSignature = ((
514
516
  node: ?ClassImplements,
515
517
  newProps: $Partial<ClassImplementsProps>,
516
518
  ) => DetachedNode<ClassImplements> | null);
517
- type ClassPrivatePropertyCloneSignature = ((
518
- node: ClassPrivateProperty,
519
- newProps: $Partial<ClassPrivatePropertyProps>,
520
- ) => DetachedNode<ClassPrivateProperty>) &
521
- ((
522
- node: ?ClassPrivateProperty,
523
- newProps: $Partial<ClassPrivatePropertyProps>,
524
- ) => DetachedNode<ClassPrivateProperty> | null);
525
- type ClassPropertyCloneSignature = ((
526
- node: ClassProperty,
527
- newProps: $Partial<ClassPropertyProps>,
528
- ) => DetachedNode<ClassProperty>) &
529
- ((
530
- node: ?ClassProperty,
531
- newProps: $Partial<ClassPropertyProps>,
532
- ) => DetachedNode<ClassProperty> | null);
533
519
  type ConditionalExpressionCloneSignature = ((
534
520
  node: ConditionalExpression,
535
521
  newProps: $Partial<ConditionalExpressionProps>,
@@ -770,14 +756,6 @@ type ExportNamedDeclarationCloneSignature = ((
770
756
  node: ?ExportNamedDeclaration,
771
757
  newProps: $Partial<ExportNamedDeclarationProps>,
772
758
  ) => DetachedNode<ExportNamedDeclaration> | null);
773
- type ExportNamespaceSpecifierCloneSignature = ((
774
- node: ExportNamespaceSpecifier,
775
- newProps: $Partial<ExportNamespaceSpecifierProps>,
776
- ) => DetachedNode<ExportNamespaceSpecifier>) &
777
- ((
778
- node: ?ExportNamespaceSpecifier,
779
- newProps: $Partial<ExportNamespaceSpecifierProps>,
780
- ) => DetachedNode<ExportNamespaceSpecifier> | null);
781
759
  type ExportSpecifierCloneSignature = ((
782
760
  node: ExportSpecifier,
783
761
  newProps: $Partial<ExportSpecifierProps>,
@@ -1266,14 +1244,6 @@ type OpaqueTypeCloneSignature = ((
1266
1244
  node: ?OpaqueType,
1267
1245
  newProps: $Partial<OpaqueTypeProps>,
1268
1246
  ) => DetachedNode<OpaqueType> | null);
1269
- type OptionalCallExpressionCloneSignature = ((
1270
- node: OptionalCallExpression,
1271
- newProps: $Partial<OptionalCallExpressionProps>,
1272
- ) => DetachedNode<OptionalCallExpression>) &
1273
- ((
1274
- node: ?OptionalCallExpression,
1275
- newProps: $Partial<OptionalCallExpressionProps>,
1276
- ) => DetachedNode<OptionalCallExpression> | null);
1277
1247
  type OptionalIndexedAccessTypeCloneSignature = ((
1278
1248
  node: OptionalIndexedAccessType,
1279
1249
  newProps: $Partial<OptionalIndexedAccessTypeProps>,
@@ -1282,22 +1252,14 @@ type OptionalIndexedAccessTypeCloneSignature = ((
1282
1252
  node: ?OptionalIndexedAccessType,
1283
1253
  newProps: $Partial<OptionalIndexedAccessTypeProps>,
1284
1254
  ) => DetachedNode<OptionalIndexedAccessType> | null);
1285
- type OptionalMemberExpressionCloneSignature = ((
1286
- node: OptionalMemberExpression,
1287
- newProps: $Partial<OptionalMemberExpressionProps>,
1288
- ) => DetachedNode<OptionalMemberExpression>) &
1289
- ((
1290
- node: ?OptionalMemberExpression,
1291
- newProps: $Partial<OptionalMemberExpressionProps>,
1292
- ) => DetachedNode<OptionalMemberExpression> | null);
1293
- type PrivateNameCloneSignature = ((
1294
- node: PrivateName,
1295
- newProps: $Partial<PrivateNameProps>,
1296
- ) => DetachedNode<PrivateName>) &
1297
- ((
1298
- node: ?PrivateName,
1299
- newProps: $Partial<PrivateNameProps>,
1300
- ) => DetachedNode<PrivateName> | null);
1255
+ type PrivateIdentifierCloneSignature = ((
1256
+ node: PrivateIdentifier,
1257
+ newProps: $Partial<PrivateIdentifierProps>,
1258
+ ) => DetachedNode<PrivateIdentifier>) &
1259
+ ((
1260
+ node: ?PrivateIdentifier,
1261
+ newProps: $Partial<PrivateIdentifierProps>,
1262
+ ) => DetachedNode<PrivateIdentifier> | null);
1301
1263
  type PropertyCloneSignature = ((
1302
1264
  node: Property,
1303
1265
  newProps: $Partial<PropertyProps>,
@@ -1306,6 +1268,14 @@ type PropertyCloneSignature = ((
1306
1268
  node: ?Property,
1307
1269
  newProps: $Partial<PropertyProps>,
1308
1270
  ) => DetachedNode<Property> | null);
1271
+ type PropertyDefinitionCloneSignature = ((
1272
+ node: PropertyDefinition,
1273
+ newProps: $Partial<PropertyDefinitionProps>,
1274
+ ) => DetachedNode<PropertyDefinition>) &
1275
+ ((
1276
+ node: ?PropertyDefinition,
1277
+ newProps: $Partial<PropertyDefinitionProps>,
1278
+ ) => DetachedNode<PropertyDefinition> | null);
1309
1279
  type QualifiedTypeIdentifierCloneSignature = ((
1310
1280
  node: QualifiedTypeIdentifier,
1311
1281
  newProps: $Partial<QualifiedTypeIdentifierProps>,
@@ -1628,12 +1598,11 @@ export type TransformCloneSignatures = AnyTypeAnnotationCloneSignature &
1628
1598
  BreakStatementCloneSignature &
1629
1599
  CallExpressionCloneSignature &
1630
1600
  CatchClauseCloneSignature &
1601
+ ChainExpressionCloneSignature &
1631
1602
  ClassBodyCloneSignature &
1632
1603
  ClassDeclarationCloneSignature &
1633
1604
  ClassExpressionCloneSignature &
1634
1605
  ClassImplementsCloneSignature &
1635
- ClassPrivatePropertyCloneSignature &
1636
- ClassPropertyCloneSignature &
1637
1606
  ConditionalExpressionCloneSignature &
1638
1607
  ContinueStatementCloneSignature &
1639
1608
  DebuggerStatementCloneSignature &
@@ -1664,7 +1633,6 @@ export type TransformCloneSignatures = AnyTypeAnnotationCloneSignature &
1664
1633
  ExportAllDeclarationCloneSignature &
1665
1634
  ExportDefaultDeclarationCloneSignature &
1666
1635
  ExportNamedDeclarationCloneSignature &
1667
- ExportNamespaceSpecifierCloneSignature &
1668
1636
  ExportSpecifierCloneSignature &
1669
1637
  ExpressionStatementCloneSignature &
1670
1638
  ForInStatementCloneSignature &
@@ -1726,11 +1694,10 @@ export type TransformCloneSignatures = AnyTypeAnnotationCloneSignature &
1726
1694
  ObjectTypePropertyCloneSignature &
1727
1695
  ObjectTypeSpreadPropertyCloneSignature &
1728
1696
  OpaqueTypeCloneSignature &
1729
- OptionalCallExpressionCloneSignature &
1730
1697
  OptionalIndexedAccessTypeCloneSignature &
1731
- OptionalMemberExpressionCloneSignature &
1732
- PrivateNameCloneSignature &
1698
+ PrivateIdentifierCloneSignature &
1733
1699
  PropertyCloneSignature &
1700
+ PropertyDefinitionCloneSignature &
1734
1701
  QualifiedTypeIdentifierCloneSignature &
1735
1702
  RegExpLiteralCloneSignature &
1736
1703
  RestElementCloneSignature &