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.
- package/ESLINT_LICENCE +19 -0
- package/PRETTIER_LICENCE +7 -0
- package/dist/detachedNode.js +96 -20
- package/dist/detachedNode.js.flow +105 -17
- package/dist/generated/TransformCloneSignatures.js.flow +33 -66
- package/dist/generated/TransformModifySignatures.js.flow +1113 -0
- package/dist/generated/TransformReplaceSignatures.js.flow +19 -40
- package/dist/generated/node-types.js +638 -905
- package/dist/generated/node-types.js.flow +998 -1256
- package/dist/generated/special-case-node-types.js +71 -77
- package/dist/generated/special-case-node-types.js.flow +104 -88
- package/dist/index.js.flow +2 -1
- package/dist/transform/MutationContext.js +2 -2
- package/dist/transform/MutationContext.js.flow +3 -2
- package/dist/transform/TransformContext.js +56 -43
- package/dist/transform/TransformContext.js.flow +154 -95
- package/dist/transform/comments/comments.js +133 -28
- package/dist/transform/comments/comments.js.flow +125 -28
- package/dist/transform/getTransformedAST.js +20 -12
- package/dist/transform/getTransformedAST.js.flow +32 -14
- package/dist/transform/mutations/{AddLeadingComments.js → AddComments.js} +11 -8
- package/dist/transform/mutations/AddComments.js.flow +50 -0
- package/dist/transform/mutations/CloneCommentsTo.js +1 -2
- package/dist/transform/mutations/CloneCommentsTo.js.flow +1 -2
- package/dist/transform/mutations/InsertStatement.js +3 -1
- package/dist/transform/mutations/InsertStatement.js.flow +7 -1
- package/dist/transform/mutations/RemoveNode.js +10 -3
- package/dist/transform/mutations/RemoveNode.js.flow +14 -3
- package/dist/transform/mutations/ReplaceNode.js +7 -2
- package/dist/transform/mutations/ReplaceNode.js.flow +5 -2
- package/dist/transform/mutations/ReplaceStatementWithMany.js.flow +5 -2
- package/dist/transform/mutations/utils/arrayUtils.js +14 -0
- package/dist/transform/mutations/utils/arrayUtils.js.flow +15 -0
- package/dist/transform/transform.js +38 -6
- package/dist/transform/transform.js.flow +40 -6
- package/dist/traverse/NodeEventGenerator.js.flow +1 -1
- package/dist/traverse/traverse.js +27 -3
- package/dist/traverse/traverse.js.flow +63 -10
- package/package.json +9 -4
- package/dist/transform/mutations/AddLeadingComments.js.flow +0 -49
- package/dist/transform/mutations/AddTrailingComments.js +0 -40
- package/dist/transform/mutations/AddTrailingComments.js.flow +0 -49
|
@@ -31,12 +31,11 @@ import type {
|
|
|
31
31
|
BreakStatement,
|
|
32
32
|
CallExpression,
|
|
33
33
|
CatchClause,
|
|
34
|
+
ChainExpression,
|
|
34
35
|
ClassBody,
|
|
35
36
|
ClassDeclaration,
|
|
36
37
|
ClassExpression,
|
|
37
38
|
ClassImplements,
|
|
38
|
-
ClassPrivateProperty,
|
|
39
|
-
ClassProperty,
|
|
40
39
|
ConditionalExpression,
|
|
41
40
|
ContinueStatement,
|
|
42
41
|
DebuggerStatement,
|
|
@@ -67,7 +66,6 @@ import type {
|
|
|
67
66
|
ExportAllDeclaration,
|
|
68
67
|
ExportDefaultDeclaration,
|
|
69
68
|
ExportNamedDeclaration,
|
|
70
|
-
ExportNamespaceSpecifier,
|
|
71
69
|
ExportSpecifier,
|
|
72
70
|
ExpressionStatement,
|
|
73
71
|
ForInStatement,
|
|
@@ -127,12 +125,11 @@ import type {
|
|
|
127
125
|
ObjectTypeProperty,
|
|
128
126
|
ObjectTypeSpreadProperty,
|
|
129
127
|
OpaqueType,
|
|
130
|
-
OptionalCallExpression,
|
|
131
128
|
OptionalIndexedAccessType,
|
|
132
|
-
|
|
133
|
-
PrivateName,
|
|
129
|
+
PrivateIdentifier,
|
|
134
130
|
Program,
|
|
135
131
|
Property,
|
|
132
|
+
PropertyDefinition,
|
|
136
133
|
QualifiedTypeIdentifier,
|
|
137
134
|
RestElement,
|
|
138
135
|
ReturnStatement,
|
|
@@ -253,6 +250,11 @@ type CatchClauseReplaceSignature = (
|
|
|
253
250
|
nodeToReplaceWith: DetachedNode<CatchClause>,
|
|
254
251
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
255
252
|
) => void;
|
|
253
|
+
type ChainExpressionReplaceSignature = (
|
|
254
|
+
target: ChainExpression,
|
|
255
|
+
nodeToReplaceWith: DetachedNode<ChainExpression>,
|
|
256
|
+
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
257
|
+
) => void;
|
|
256
258
|
type ClassBodyReplaceSignature = (
|
|
257
259
|
target: ClassBody,
|
|
258
260
|
nodeToReplaceWith: DetachedNode<ClassBody>,
|
|
@@ -273,16 +275,6 @@ type ClassImplementsReplaceSignature = (
|
|
|
273
275
|
nodeToReplaceWith: DetachedNode<ClassImplements>,
|
|
274
276
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
275
277
|
) => void;
|
|
276
|
-
type ClassPrivatePropertyReplaceSignature = (
|
|
277
|
-
target: ClassPrivateProperty,
|
|
278
|
-
nodeToReplaceWith: DetachedNode<ClassPrivateProperty>,
|
|
279
|
-
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
280
|
-
) => void;
|
|
281
|
-
type ClassPropertyReplaceSignature = (
|
|
282
|
-
target: ClassProperty,
|
|
283
|
-
nodeToReplaceWith: DetachedNode<ClassProperty>,
|
|
284
|
-
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
285
|
-
) => void;
|
|
286
278
|
type ConditionalExpressionReplaceSignature = (
|
|
287
279
|
target: ConditionalExpression,
|
|
288
280
|
nodeToReplaceWith: DetachedNode<ConditionalExpression>,
|
|
@@ -433,11 +425,6 @@ type ExportNamedDeclarationReplaceSignature = (
|
|
|
433
425
|
nodeToReplaceWith: DetachedNode<ExportNamedDeclaration>,
|
|
434
426
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
435
427
|
) => void;
|
|
436
|
-
type ExportNamespaceSpecifierReplaceSignature = (
|
|
437
|
-
target: ExportNamespaceSpecifier,
|
|
438
|
-
nodeToReplaceWith: DetachedNode<ExportNamespaceSpecifier>,
|
|
439
|
-
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
440
|
-
) => void;
|
|
441
428
|
type ExportSpecifierReplaceSignature = (
|
|
442
429
|
target: ExportSpecifier,
|
|
443
430
|
nodeToReplaceWith: DetachedNode<ExportSpecifier>,
|
|
@@ -733,24 +720,14 @@ type OpaqueTypeReplaceSignature = (
|
|
|
733
720
|
nodeToReplaceWith: DetachedNode<OpaqueType>,
|
|
734
721
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
735
722
|
) => void;
|
|
736
|
-
type OptionalCallExpressionReplaceSignature = (
|
|
737
|
-
target: OptionalCallExpression,
|
|
738
|
-
nodeToReplaceWith: DetachedNode<OptionalCallExpression>,
|
|
739
|
-
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
740
|
-
) => void;
|
|
741
723
|
type OptionalIndexedAccessTypeReplaceSignature = (
|
|
742
724
|
target: OptionalIndexedAccessType,
|
|
743
725
|
nodeToReplaceWith: DetachedNode<OptionalIndexedAccessType>,
|
|
744
726
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
745
727
|
) => void;
|
|
746
|
-
type
|
|
747
|
-
target:
|
|
748
|
-
nodeToReplaceWith: DetachedNode<
|
|
749
|
-
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
750
|
-
) => void;
|
|
751
|
-
type PrivateNameReplaceSignature = (
|
|
752
|
-
target: PrivateName,
|
|
753
|
-
nodeToReplaceWith: DetachedNode<PrivateName>,
|
|
728
|
+
type PrivateIdentifierReplaceSignature = (
|
|
729
|
+
target: PrivateIdentifier,
|
|
730
|
+
nodeToReplaceWith: DetachedNode<PrivateIdentifier>,
|
|
754
731
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
755
732
|
) => void;
|
|
756
733
|
type ProgramReplaceSignature = (
|
|
@@ -763,6 +740,11 @@ type PropertyReplaceSignature = (
|
|
|
763
740
|
nodeToReplaceWith: DetachedNode<Property>,
|
|
764
741
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
765
742
|
) => void;
|
|
743
|
+
type PropertyDefinitionReplaceSignature = (
|
|
744
|
+
target: PropertyDefinition,
|
|
745
|
+
nodeToReplaceWith: DetachedNode<PropertyDefinition>,
|
|
746
|
+
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
747
|
+
) => void;
|
|
766
748
|
type QualifiedTypeIdentifierReplaceSignature = (
|
|
767
749
|
target: QualifiedTypeIdentifier,
|
|
768
750
|
nodeToReplaceWith: DetachedNode<QualifiedTypeIdentifier>,
|
|
@@ -964,12 +946,11 @@ export type TransformReplaceSignatures = AnyTypeAnnotationReplaceSignature &
|
|
|
964
946
|
BreakStatementReplaceSignature &
|
|
965
947
|
CallExpressionReplaceSignature &
|
|
966
948
|
CatchClauseReplaceSignature &
|
|
949
|
+
ChainExpressionReplaceSignature &
|
|
967
950
|
ClassBodyReplaceSignature &
|
|
968
951
|
ClassDeclarationReplaceSignature &
|
|
969
952
|
ClassExpressionReplaceSignature &
|
|
970
953
|
ClassImplementsReplaceSignature &
|
|
971
|
-
ClassPrivatePropertyReplaceSignature &
|
|
972
|
-
ClassPropertyReplaceSignature &
|
|
973
954
|
ConditionalExpressionReplaceSignature &
|
|
974
955
|
ContinueStatementReplaceSignature &
|
|
975
956
|
DebuggerStatementReplaceSignature &
|
|
@@ -1000,7 +981,6 @@ export type TransformReplaceSignatures = AnyTypeAnnotationReplaceSignature &
|
|
|
1000
981
|
ExportAllDeclarationReplaceSignature &
|
|
1001
982
|
ExportDefaultDeclarationReplaceSignature &
|
|
1002
983
|
ExportNamedDeclarationReplaceSignature &
|
|
1003
|
-
ExportNamespaceSpecifierReplaceSignature &
|
|
1004
984
|
ExportSpecifierReplaceSignature &
|
|
1005
985
|
ExpressionStatementReplaceSignature &
|
|
1006
986
|
ForInStatementReplaceSignature &
|
|
@@ -1060,12 +1040,11 @@ export type TransformReplaceSignatures = AnyTypeAnnotationReplaceSignature &
|
|
|
1060
1040
|
ObjectTypePropertyReplaceSignature &
|
|
1061
1041
|
ObjectTypeSpreadPropertyReplaceSignature &
|
|
1062
1042
|
OpaqueTypeReplaceSignature &
|
|
1063
|
-
OptionalCallExpressionReplaceSignature &
|
|
1064
1043
|
OptionalIndexedAccessTypeReplaceSignature &
|
|
1065
|
-
|
|
1066
|
-
PrivateNameReplaceSignature &
|
|
1044
|
+
PrivateIdentifierReplaceSignature &
|
|
1067
1045
|
ProgramReplaceSignature &
|
|
1068
1046
|
PropertyReplaceSignature &
|
|
1047
|
+
PropertyDefinitionReplaceSignature &
|
|
1069
1048
|
QualifiedTypeIdentifierReplaceSignature &
|
|
1070
1049
|
RestElementReplaceSignature &
|
|
1071
1050
|
ReturnStatementReplaceSignature &
|