hermes-transform 0.19.0 → 0.19.2
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/dist/generated/TransformCloneSignatures.js.flow +11 -0
- package/dist/generated/TransformModifySignatures.js.flow +7 -0
- package/dist/generated/TransformReplaceSignatures.js.flow +7 -0
- package/dist/generated/node-types.js +13 -2
- package/dist/generated/node-types.js.flow +19 -2
- package/package.json +5 -5
|
@@ -66,6 +66,7 @@ import type {
|
|
|
66
66
|
DeclareInterface,
|
|
67
67
|
DeclareModule,
|
|
68
68
|
DeclareModuleExports,
|
|
69
|
+
DeclareNamespace,
|
|
69
70
|
DeclareOpaqueType,
|
|
70
71
|
DeclareTypeAlias,
|
|
71
72
|
DeclareVariable,
|
|
@@ -244,6 +245,7 @@ import type {
|
|
|
244
245
|
DeclareInterfaceProps,
|
|
245
246
|
DeclareModuleProps,
|
|
246
247
|
DeclareModuleExportsProps,
|
|
248
|
+
DeclareNamespaceProps,
|
|
247
249
|
DeclareOpaqueTypeProps,
|
|
248
250
|
DeclareTypeAliasProps,
|
|
249
251
|
DeclareVariableProps,
|
|
@@ -731,6 +733,14 @@ type DeclareModuleExportsCloneSignature = ((
|
|
|
731
733
|
node: ?DeclareModuleExports,
|
|
732
734
|
newProps: Partial<DeclareModuleExportsProps>,
|
|
733
735
|
) => DetachedNode<DeclareModuleExports> | null);
|
|
736
|
+
type DeclareNamespaceCloneSignature = ((
|
|
737
|
+
node: DeclareNamespace,
|
|
738
|
+
newProps: Partial<DeclareNamespaceProps>,
|
|
739
|
+
) => DetachedNode<DeclareNamespace>) &
|
|
740
|
+
((
|
|
741
|
+
node: ?DeclareNamespace,
|
|
742
|
+
newProps: Partial<DeclareNamespaceProps>,
|
|
743
|
+
) => DetachedNode<DeclareNamespace> | null);
|
|
734
744
|
type DeclareOpaqueTypeCloneSignature = ((
|
|
735
745
|
node: DeclareOpaqueType,
|
|
736
746
|
newProps: Partial<DeclareOpaqueTypeProps>,
|
|
@@ -1828,6 +1838,7 @@ export type TransformCloneSignatures = AnyTypeAnnotationCloneSignature &
|
|
|
1828
1838
|
DeclareInterfaceCloneSignature &
|
|
1829
1839
|
DeclareModuleCloneSignature &
|
|
1830
1840
|
DeclareModuleExportsCloneSignature &
|
|
1841
|
+
DeclareNamespaceCloneSignature &
|
|
1831
1842
|
DeclareOpaqueTypeCloneSignature &
|
|
1832
1843
|
DeclareTypeAliasCloneSignature &
|
|
1833
1844
|
DeclareVariableCloneSignature &
|
|
@@ -66,6 +66,7 @@ import type {
|
|
|
66
66
|
DeclareInterface,
|
|
67
67
|
DeclareModule,
|
|
68
68
|
DeclareModuleExports,
|
|
69
|
+
DeclareNamespace,
|
|
69
70
|
DeclareOpaqueType,
|
|
70
71
|
DeclareTypeAlias,
|
|
71
72
|
DeclareVariable,
|
|
@@ -244,6 +245,7 @@ import type {
|
|
|
244
245
|
DeclareInterfaceProps,
|
|
245
246
|
DeclareModuleProps,
|
|
246
247
|
DeclareModuleExportsProps,
|
|
248
|
+
DeclareNamespaceProps,
|
|
247
249
|
DeclareOpaqueTypeProps,
|
|
248
250
|
DeclareTypeAliasProps,
|
|
249
251
|
DeclareVariableProps,
|
|
@@ -554,6 +556,10 @@ type DeclareModuleExportsModifySignature = (
|
|
|
554
556
|
node: ?DeclareModuleExports,
|
|
555
557
|
newProps: Partial<DeclareModuleExportsProps>,
|
|
556
558
|
) => void;
|
|
559
|
+
type DeclareNamespaceModifySignature = (
|
|
560
|
+
node: ?DeclareNamespace,
|
|
561
|
+
newProps: Partial<DeclareNamespaceProps>,
|
|
562
|
+
) => void;
|
|
557
563
|
type DeclareOpaqueTypeModifySignature = (
|
|
558
564
|
node: ?DeclareOpaqueType,
|
|
559
565
|
newProps: Partial<DeclareOpaqueTypeProps>,
|
|
@@ -1126,6 +1132,7 @@ export type TransformModifySignatures = AnyTypeAnnotationModifySignature &
|
|
|
1126
1132
|
DeclareInterfaceModifySignature &
|
|
1127
1133
|
DeclareModuleModifySignature &
|
|
1128
1134
|
DeclareModuleExportsModifySignature &
|
|
1135
|
+
DeclareNamespaceModifySignature &
|
|
1129
1136
|
DeclareOpaqueTypeModifySignature &
|
|
1130
1137
|
DeclareTypeAliasModifySignature &
|
|
1131
1138
|
DeclareVariableModifySignature &
|
|
@@ -64,6 +64,7 @@ import type {
|
|
|
64
64
|
DeclareInterface,
|
|
65
65
|
DeclareModule,
|
|
66
66
|
DeclareModuleExports,
|
|
67
|
+
DeclareNamespace,
|
|
67
68
|
DeclareOpaqueType,
|
|
68
69
|
DeclareTypeAlias,
|
|
69
70
|
DeclareVariable,
|
|
@@ -407,6 +408,11 @@ type DeclareModuleExportsReplaceSignature = (
|
|
|
407
408
|
nodeToReplaceWith: DetachedNode<DeclareModuleExports>,
|
|
408
409
|
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
409
410
|
) => void;
|
|
411
|
+
type DeclareNamespaceReplaceSignature = (
|
|
412
|
+
target: DeclareNamespace,
|
|
413
|
+
nodeToReplaceWith: DetachedNode<DeclareNamespace>,
|
|
414
|
+
options?: $ReadOnly<{keepComments?: boolean}>,
|
|
415
|
+
) => void;
|
|
410
416
|
type DeclareOpaqueTypeReplaceSignature = (
|
|
411
417
|
target: DeclareOpaqueType,
|
|
412
418
|
nodeToReplaceWith: DetachedNode<DeclareOpaqueType>,
|
|
@@ -1099,6 +1105,7 @@ export type TransformReplaceSignatures = AnyTypeAnnotationReplaceSignature &
|
|
|
1099
1105
|
DeclareInterfaceReplaceSignature &
|
|
1100
1106
|
DeclareModuleReplaceSignature &
|
|
1101
1107
|
DeclareModuleExportsReplaceSignature &
|
|
1108
|
+
DeclareNamespaceReplaceSignature &
|
|
1102
1109
|
DeclareOpaqueTypeReplaceSignature &
|
|
1103
1110
|
DeclareTypeAliasReplaceSignature &
|
|
1104
1111
|
DeclareVariableReplaceSignature &
|
|
@@ -62,6 +62,7 @@ var _exportNames = {
|
|
|
62
62
|
DeclareInterface: true,
|
|
63
63
|
DeclareModule: true,
|
|
64
64
|
DeclareModuleExports: true,
|
|
65
|
+
DeclareNamespace: true,
|
|
65
66
|
DeclareOpaqueType: true,
|
|
66
67
|
DeclareTypeAlias: true,
|
|
67
68
|
DeclareVariable: true,
|
|
@@ -222,6 +223,7 @@ exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
|
|
|
222
223
|
exports.DeclareInterface = DeclareInterface;
|
|
223
224
|
exports.DeclareModule = DeclareModule;
|
|
224
225
|
exports.DeclareModuleExports = DeclareModuleExports;
|
|
226
|
+
exports.DeclareNamespace = DeclareNamespace;
|
|
225
227
|
exports.DeclareOpaqueType = DeclareOpaqueType;
|
|
226
228
|
exports.DeclareTypeAlias = DeclareTypeAlias;
|
|
227
229
|
exports.DeclareVariable = DeclareVariable;
|
|
@@ -717,8 +719,7 @@ function DeclareModule(props) {
|
|
|
717
719
|
const node = (0, _detachedNode.detachedProps)(props.parent, {
|
|
718
720
|
type: 'DeclareModule',
|
|
719
721
|
id: (0, _detachedNode.asDetachedNodeForCodeGen)(props.id),
|
|
720
|
-
body: (0, _detachedNode.asDetachedNodeForCodeGen)(props.body)
|
|
721
|
-
kind: props.kind
|
|
722
|
+
body: (0, _detachedNode.asDetachedNodeForCodeGen)(props.body)
|
|
722
723
|
});
|
|
723
724
|
(0, _detachedNode.setParentPointersInDirectChildren)(node);
|
|
724
725
|
return node;
|
|
@@ -733,6 +734,16 @@ function DeclareModuleExports(props) {
|
|
|
733
734
|
return node;
|
|
734
735
|
}
|
|
735
736
|
|
|
737
|
+
function DeclareNamespace(props) {
|
|
738
|
+
const node = (0, _detachedNode.detachedProps)(props.parent, {
|
|
739
|
+
type: 'DeclareNamespace',
|
|
740
|
+
id: (0, _detachedNode.asDetachedNodeForCodeGen)(props.id),
|
|
741
|
+
body: (0, _detachedNode.asDetachedNodeForCodeGen)(props.body)
|
|
742
|
+
});
|
|
743
|
+
(0, _detachedNode.setParentPointersInDirectChildren)(node);
|
|
744
|
+
return node;
|
|
745
|
+
}
|
|
746
|
+
|
|
736
747
|
function DeclareOpaqueType(props) {
|
|
737
748
|
const node = (0, _detachedNode.detachedProps)(props.parent, {
|
|
738
749
|
type: 'DeclareOpaqueType',
|
|
@@ -60,6 +60,7 @@ import type {
|
|
|
60
60
|
DeclareInterface as DeclareInterfaceType,
|
|
61
61
|
DeclareModule as DeclareModuleType,
|
|
62
62
|
DeclareModuleExports as DeclareModuleExportsType,
|
|
63
|
+
DeclareNamespace as DeclareNamespaceType,
|
|
63
64
|
DeclareOpaqueType as DeclareOpaqueTypeType,
|
|
64
65
|
DeclareTypeAlias as DeclareTypeAliasType,
|
|
65
66
|
DeclareVariable as DeclareVariableType,
|
|
@@ -407,7 +408,6 @@ export type DeclareInterfaceProps = {
|
|
|
407
408
|
export type DeclareModuleProps = {
|
|
408
409
|
+id: MaybeDetachedNode<DeclareModuleType['id']>,
|
|
409
410
|
+body: MaybeDetachedNode<DeclareModuleType['body']>,
|
|
410
|
-
+kind: DeclareModuleType['kind'],
|
|
411
411
|
};
|
|
412
412
|
|
|
413
413
|
export type DeclareModuleExportsProps = {
|
|
@@ -416,6 +416,11 @@ export type DeclareModuleExportsProps = {
|
|
|
416
416
|
>,
|
|
417
417
|
};
|
|
418
418
|
|
|
419
|
+
export type DeclareNamespaceProps = {
|
|
420
|
+
+id: MaybeDetachedNode<DeclareNamespaceType['id']>,
|
|
421
|
+
+body: MaybeDetachedNode<DeclareNamespaceType['body']>,
|
|
422
|
+
};
|
|
423
|
+
|
|
419
424
|
export type DeclareOpaqueTypeProps = {
|
|
420
425
|
+id: MaybeDetachedNode<DeclareOpaqueTypeType['id']>,
|
|
421
426
|
+typeParameters?: ?MaybeDetachedNode<DeclareOpaqueTypeType['typeParameters']>,
|
|
@@ -1602,7 +1607,6 @@ export function DeclareModule(props: {
|
|
|
1602
1607
|
type: 'DeclareModule',
|
|
1603
1608
|
id: asDetachedNodeForCodeGen(props.id),
|
|
1604
1609
|
body: asDetachedNodeForCodeGen(props.body),
|
|
1605
|
-
kind: props.kind,
|
|
1606
1610
|
});
|
|
1607
1611
|
setParentPointersInDirectChildren(node);
|
|
1608
1612
|
return node;
|
|
@@ -1620,6 +1624,19 @@ export function DeclareModuleExports(props: {
|
|
|
1620
1624
|
return node;
|
|
1621
1625
|
}
|
|
1622
1626
|
|
|
1627
|
+
export function DeclareNamespace(props: {
|
|
1628
|
+
...$ReadOnly<DeclareNamespaceProps>,
|
|
1629
|
+
+parent?: ESNode,
|
|
1630
|
+
}): DetachedNode<DeclareNamespaceType> {
|
|
1631
|
+
const node = detachedProps<DeclareNamespaceType>(props.parent, {
|
|
1632
|
+
type: 'DeclareNamespace',
|
|
1633
|
+
id: asDetachedNodeForCodeGen(props.id),
|
|
1634
|
+
body: asDetachedNodeForCodeGen(props.body),
|
|
1635
|
+
});
|
|
1636
|
+
setParentPointersInDirectChildren(node);
|
|
1637
|
+
return node;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1623
1640
|
export function DeclareOpaqueType(props: {
|
|
1624
1641
|
...$ReadOnly<DeclareOpaqueTypeProps>,
|
|
1625
1642
|
+parent?: ESNode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-transform",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
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.19.
|
|
16
|
-
"hermes-estree": "0.19.
|
|
17
|
-
"hermes-parser": "0.19.
|
|
15
|
+
"hermes-eslint": "0.19.2",
|
|
16
|
+
"hermes-estree": "0.19.2",
|
|
17
|
+
"hermes-parser": "0.19.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"prettier": "^3.0.0 || ^2.7.1",
|
|
21
|
-
"prettier-plugin-hermes-parser": "0.19.
|
|
21
|
+
"prettier-plugin-hermes-parser": "0.19.2"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|