hermes-transform 0.8.0 → 0.10.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 +100 -42
- package/dist/detachedNode.js.flow +116 -41
- package/dist/generated/TransformCloneSignatures.js.flow +18 -0
- package/dist/generated/TransformModifySignatures.js.flow +1127 -0
- package/dist/generated/TransformReplaceSignatures.js.flow +15 -1
- package/dist/generated/node-types.js +852 -883
- package/dist/generated/node-types.js.flow +1187 -1217
- package/dist/generated/special-case-node-types/Comment.js +36 -0
- package/dist/generated/special-case-node-types/Comment.js.flow +36 -0
- package/dist/generated/special-case-node-types/DeclareExportDeclaration.js +55 -0
- package/dist/generated/special-case-node-types/DeclareExportDeclaration.js.flow +97 -0
- package/dist/generated/special-case-node-types/ExportNamedDeclaration.js +42 -0
- package/dist/generated/special-case-node-types/ExportNamedDeclaration.js.flow +75 -0
- package/dist/generated/special-case-node-types/Literal.js +97 -0
- package/dist/generated/special-case-node-types/Literal.js.flow +139 -0
- package/dist/generated/special-case-node-types/ObjectTypeProperty.js +73 -0
- package/dist/generated/special-case-node-types/ObjectTypeProperty.js.flow +107 -0
- package/dist/generated/special-case-node-types/Property.js +136 -0
- package/dist/generated/special-case-node-types/Property.js.flow +237 -0
- package/dist/generated/special-case-node-types/misc.js +119 -0
- package/dist/generated/special-case-node-types/misc.js.flow +205 -0
- package/dist/generated/special-case-node-types.js +42 -180
- package/dist/generated/special-case-node-types.js.flow +7 -258
- package/dist/index.js +19 -3
- package/dist/index.js.flow +6 -2
- package/dist/transform/TransformContext.js +34 -11
- package/dist/transform/TransformContext.js.flow +90 -33
- package/dist/transform/comments/comments.js +34 -5
- package/dist/transform/comments/comments.js.flow +39 -4
- package/dist/transform/comments/prettier/main/comments.js +1 -1
- package/dist/transform/comments/prettier/main/comments.js.flow +2 -1
- package/dist/transform/mutations/InsertStatement.js +4 -3
- package/dist/transform/mutations/InsertStatement.js.flow +4 -3
- package/dist/transform/mutations/RemoveComment.js +3 -3
- package/dist/transform/mutations/RemoveComment.js.flow +3 -5
- package/dist/transform/mutations/RemoveNode.js +2 -2
- package/dist/transform/mutations/RemoveNode.js.flow +2 -2
- package/dist/transform/mutations/RemoveStatement.js +2 -2
- package/dist/transform/mutations/RemoveStatement.js.flow +2 -2
- package/dist/transform/mutations/ReplaceNode.js +10 -7
- package/dist/transform/mutations/ReplaceNode.js.flow +7 -5
- package/dist/transform/mutations/ReplaceStatementWithMany.js +2 -2
- package/dist/transform/mutations/ReplaceStatementWithMany.js.flow +7 -4
- package/dist/transform/mutations/utils/getStatementParent.js +3 -2
- package/dist/transform/mutations/utils/getStatementParent.js.flow +5 -2
- package/dist/transform/parse.js +55 -0
- package/dist/transform/parse.js.flow +55 -0
- package/dist/transform/print.js +160 -0
- package/dist/transform/print.js.flow +176 -0
- package/dist/transform/transform.js +6 -67
- package/dist/transform/transform.js.flow +6 -69
- package/dist/transform/{getTransformedAST.js → transformAST.js} +7 -16
- package/dist/transform/{getTransformedAST.js.flow → transformAST.js.flow} +7 -14
- package/dist/traverse/NodeEventGenerator.js.flow +1 -1
- package/dist/traverse/traverse.js +36 -35
- package/dist/traverse/traverse.js.flow +46 -27
- package/package.json +10 -5
- package/dist/getVisitorKeys.js +0 -33
- package/dist/getVisitorKeys.js.flow +0 -31
- package/dist/transform/mutations/utils/arrayUtils.js +0 -43
- package/dist/transform/mutations/utils/arrayUtils.js.flow +0 -50
- package/dist/traverse/SimpleTraverser.js +0 -118
- package/dist/traverse/SimpleTraverser.js.flow +0 -112
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
ArrowFunctionExpression as ArrowFunctionExpressionType,
|
|
13
|
+
ClassDeclaration as ClassDeclarationType,
|
|
14
|
+
DeclareFunction as DeclareFunctionType,
|
|
15
|
+
ESNode,
|
|
16
|
+
FunctionTypeAnnotation as FunctionTypeAnnotationType,
|
|
17
|
+
Identifier as IdentifierType,
|
|
18
|
+
InterpreterDirective as InterpreterDirectiveType,
|
|
19
|
+
Token as TokenType,
|
|
20
|
+
Comment as CommentType,
|
|
21
|
+
TemplateElement as TemplateElementType,
|
|
22
|
+
Program as ProgramType,
|
|
23
|
+
DocblockMetadata as DocblockMetadataType,
|
|
24
|
+
} from 'hermes-estree';
|
|
25
|
+
import type {DetachedNode, MaybeDetachedNode} from '../../detachedNode';
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
asDetachedNode,
|
|
29
|
+
detachedProps,
|
|
30
|
+
setParentPointersInDirectChildren,
|
|
31
|
+
} from '../../detachedNode';
|
|
32
|
+
|
|
33
|
+
/*********************************************************************
|
|
34
|
+
* this file should only contain one-off variant node type functions *
|
|
35
|
+
* if you are creating multiple variants for the same "type", then *
|
|
36
|
+
* put them in their own file to help keep things organised *
|
|
37
|
+
*********************************************************************/
|
|
38
|
+
|
|
39
|
+
// hermes adds an `id` prop which is always null, and it adds an `expression`
|
|
40
|
+
// boolean which is true when the body isn't a BlockStatement.
|
|
41
|
+
// No need to make consumers set these
|
|
42
|
+
export type ArrowFunctionExpressionProps = {
|
|
43
|
+
+params: $ReadOnlyArray<
|
|
44
|
+
MaybeDetachedNode<ArrowFunctionExpressionType['params'][number]>,
|
|
45
|
+
>,
|
|
46
|
+
+body: MaybeDetachedNode<ArrowFunctionExpressionType['body']>,
|
|
47
|
+
+typeParameters?: ?MaybeDetachedNode<
|
|
48
|
+
ArrowFunctionExpressionType['typeParameters'],
|
|
49
|
+
>,
|
|
50
|
+
+returnType?: ?MaybeDetachedNode<ArrowFunctionExpressionType['returnType']>,
|
|
51
|
+
+predicate?: ?MaybeDetachedNode<ArrowFunctionExpressionType['predicate']>,
|
|
52
|
+
+async: ArrowFunctionExpressionType['async'],
|
|
53
|
+
};
|
|
54
|
+
export function ArrowFunctionExpression(props: {
|
|
55
|
+
...$ReadOnly<ArrowFunctionExpressionProps>,
|
|
56
|
+
+parent?: ESNode,
|
|
57
|
+
}): DetachedNode<ArrowFunctionExpressionType> {
|
|
58
|
+
const node = detachedProps<ArrowFunctionExpressionType>(props.parent, {
|
|
59
|
+
type: 'ArrowFunctionExpression',
|
|
60
|
+
id: null,
|
|
61
|
+
// $FlowExpectedError[incompatible-use]
|
|
62
|
+
expression: props.body.type !== 'BlockStatement',
|
|
63
|
+
params: props.params.map(n => asDetachedNode(n)),
|
|
64
|
+
body: asDetachedNode(props.body),
|
|
65
|
+
typeParameters: asDetachedNode(props.typeParameters),
|
|
66
|
+
returnType: asDetachedNode(props.returnType),
|
|
67
|
+
predicate: asDetachedNode(props.predicate),
|
|
68
|
+
async: props.async,
|
|
69
|
+
});
|
|
70
|
+
setParentPointersInDirectChildren(node);
|
|
71
|
+
return node;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export type ClassDeclarationProps = {
|
|
75
|
+
+id?: ?MaybeDetachedNode<ClassDeclarationType['id']>,
|
|
76
|
+
+typeParameters?: ?MaybeDetachedNode<ClassDeclarationType['typeParameters']>,
|
|
77
|
+
+superClass?: ?MaybeDetachedNode<ClassDeclarationType['superClass']>,
|
|
78
|
+
+superTypeParameters?: ?MaybeDetachedNode<
|
|
79
|
+
ClassDeclarationType['superTypeParameters'],
|
|
80
|
+
>,
|
|
81
|
+
// make this optional as it's rarer that people would want to include them
|
|
82
|
+
+implements?: $ReadOnlyArray<
|
|
83
|
+
MaybeDetachedNode<ClassDeclarationType['implements'][number]>,
|
|
84
|
+
>,
|
|
85
|
+
// make this optional as it's rarer that people would want to include them
|
|
86
|
+
+decorators?: $ReadOnlyArray<
|
|
87
|
+
MaybeDetachedNode<ClassDeclarationType['decorators'][number]>,
|
|
88
|
+
>,
|
|
89
|
+
+body: MaybeDetachedNode<ClassDeclarationType['body']>,
|
|
90
|
+
};
|
|
91
|
+
export function ClassDeclaration(props: {
|
|
92
|
+
...$ReadOnly<ClassDeclarationProps>,
|
|
93
|
+
+parent?: ESNode,
|
|
94
|
+
}): DetachedNode<ClassDeclarationType> {
|
|
95
|
+
const node = detachedProps<ClassDeclarationType>(props.parent, {
|
|
96
|
+
type: 'ClassDeclaration',
|
|
97
|
+
id: asDetachedNode(props.id),
|
|
98
|
+
typeParameters: asDetachedNode(props.typeParameters),
|
|
99
|
+
superClass: asDetachedNode(props.superClass),
|
|
100
|
+
superTypeParameters: asDetachedNode(props.superTypeParameters),
|
|
101
|
+
decorators: (props.decorators ?? []).map(n => asDetachedNode(n)),
|
|
102
|
+
implements: (props.implements ?? []).map(n => asDetachedNode(n)),
|
|
103
|
+
body: asDetachedNode(props.body),
|
|
104
|
+
});
|
|
105
|
+
setParentPointersInDirectChildren(node);
|
|
106
|
+
return node;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// raw/cooked are on a subobject in the estree spec, but are flat on the hermes types
|
|
110
|
+
export type TemplateElementProps = {
|
|
111
|
+
+tail: TemplateElementType['tail'],
|
|
112
|
+
+cooked: TemplateElementType['value']['cooked'],
|
|
113
|
+
+raw: TemplateElementType['value']['raw'],
|
|
114
|
+
};
|
|
115
|
+
export function TemplateElement(props: {
|
|
116
|
+
...$ReadOnly<TemplateElementProps>,
|
|
117
|
+
+parent?: ESNode,
|
|
118
|
+
}): DetachedNode<TemplateElementType> {
|
|
119
|
+
return detachedProps<TemplateElementType>(props.parent, {
|
|
120
|
+
type: 'TemplateElement',
|
|
121
|
+
tail: props.tail,
|
|
122
|
+
value: {
|
|
123
|
+
cooked: props.cooked,
|
|
124
|
+
raw: props.raw,
|
|
125
|
+
},
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Identifier has a bunch of stuff that usually you don't want to provide - so we have
|
|
130
|
+
// this manual def to allow us to default some values
|
|
131
|
+
export type IdentifierProps = {
|
|
132
|
+
+name: IdentifierType['name'],
|
|
133
|
+
+typeAnnotation?: ?MaybeDetachedNode<IdentifierType['typeAnnotation']>,
|
|
134
|
+
+optional?: IdentifierType['optional'],
|
|
135
|
+
};
|
|
136
|
+
export function Identifier(props: {
|
|
137
|
+
...$ReadOnly<IdentifierProps>,
|
|
138
|
+
+parent?: ESNode,
|
|
139
|
+
}): DetachedNode<IdentifierType> {
|
|
140
|
+
const node = detachedProps<IdentifierType>(props.parent, {
|
|
141
|
+
type: 'Identifier',
|
|
142
|
+
name: props.name,
|
|
143
|
+
optional: props.optional ?? false,
|
|
144
|
+
typeAnnotation: asDetachedNode(props.typeAnnotation),
|
|
145
|
+
});
|
|
146
|
+
setParentPointersInDirectChildren(node);
|
|
147
|
+
return node;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type ProgramProps = {
|
|
151
|
+
+sourceType: ProgramType['sourceType'],
|
|
152
|
+
+body: $ReadOnlyArray<MaybeDetachedNode<ProgramType['body'][number]>>,
|
|
153
|
+
+tokens: $ReadOnlyArray<MaybeDetachedNode<TokenType>>,
|
|
154
|
+
+comments: $ReadOnlyArray<MaybeDetachedNode<CommentType>>,
|
|
155
|
+
+interpreter: null | string,
|
|
156
|
+
+docblock: null | DocblockMetadataType,
|
|
157
|
+
};
|
|
158
|
+
export function Program(props: {
|
|
159
|
+
...$ReadOnly<ProgramProps>,
|
|
160
|
+
}): DetachedNode<ProgramType> {
|
|
161
|
+
return detachedProps<ProgramType>(null, {
|
|
162
|
+
type: 'Program',
|
|
163
|
+
sourceType: props.sourceType,
|
|
164
|
+
body: props.body.map(n => asDetachedNode(n)),
|
|
165
|
+
tokens: props.tokens,
|
|
166
|
+
comments: props.comments,
|
|
167
|
+
interpreter:
|
|
168
|
+
props.interpreter != null
|
|
169
|
+
? // $FlowFixMe[incompatible-call]
|
|
170
|
+
asDetachedNode<InterpreterDirectiveType>({
|
|
171
|
+
type: 'InterpreterDirective',
|
|
172
|
+
value: props.interpreter,
|
|
173
|
+
})
|
|
174
|
+
: null,
|
|
175
|
+
docblock: props.docblock,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// the type annotation is stored on the Identifier's typeAnnotation
|
|
180
|
+
// which is super awkward to work with and type - so we flatten the input
|
|
181
|
+
// and put it in the right spot after
|
|
182
|
+
export type DeclareFunctionProps = {
|
|
183
|
+
+name: string,
|
|
184
|
+
+functionType: MaybeDetachedNode<FunctionTypeAnnotationType>,
|
|
185
|
+
+predicate?: ?MaybeDetachedNode<DeclareFunctionType['predicate']>,
|
|
186
|
+
};
|
|
187
|
+
export function DeclareFunction(props: {
|
|
188
|
+
...$ReadOnly<DeclareFunctionProps>,
|
|
189
|
+
+parent?: ESNode,
|
|
190
|
+
}): DetachedNode<DeclareFunctionType> {
|
|
191
|
+
const node = detachedProps<DeclareFunctionType>(props.parent, {
|
|
192
|
+
type: 'DeclareFunction',
|
|
193
|
+
id: detachedProps(null, {
|
|
194
|
+
type: 'Identifier',
|
|
195
|
+
name: props.name,
|
|
196
|
+
typeAnnotation: detachedProps(null, {
|
|
197
|
+
type: 'TypeAnnotation',
|
|
198
|
+
typeAnnotation: asDetachedNode(props.functionType),
|
|
199
|
+
}),
|
|
200
|
+
}),
|
|
201
|
+
predicate: asDetachedNode(props.predicate),
|
|
202
|
+
});
|
|
203
|
+
setParentPointersInDirectChildren(node);
|
|
204
|
+
return node;
|
|
205
|
+
}
|
|
@@ -3,197 +3,59 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
|
7
|
-
exports.BigIntLiteral = BigIntLiteral;
|
|
8
|
-
exports.BlockComment = BlockComment;
|
|
9
|
-
exports.BooleanLiteral = BooleanLiteral;
|
|
10
|
-
exports.Identifier = Identifier;
|
|
11
|
-
exports.LineComment = LineComment;
|
|
12
|
-
exports.NullLiteral = NullLiteral;
|
|
13
|
-
exports.NumericLiteral = NumericLiteral;
|
|
14
|
-
exports.RegExpLiteral = RegExpLiteral;
|
|
15
|
-
exports.StringLiteral = StringLiteral;
|
|
16
|
-
exports.TemplateElement = TemplateElement;
|
|
17
6
|
|
|
18
|
-
var
|
|
7
|
+
var _Comment = require("./special-case-node-types/Comment");
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @format
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/*
|
|
31
|
-
These are a number of special-case node creation functions that we can't auto-generate.
|
|
32
|
-
The list of exported functions here must be kept in sync with the `NODES_WITH_SPECIAL_HANDLING`
|
|
33
|
-
list in `scripts/genTransformNodeTypes` to ensure there's no duplicates
|
|
34
|
-
*/
|
|
35
|
-
function ArrowFunctionExpression({
|
|
36
|
-
parent,
|
|
37
|
-
...props
|
|
38
|
-
}) {
|
|
39
|
-
const node = (0, _detachedNode.detachedProps)(parent, {
|
|
40
|
-
type: 'ArrowFunctionExpression',
|
|
41
|
-
id: null,
|
|
42
|
-
// $FlowExpectedError[incompatible-use]
|
|
43
|
-
expression: props.body.type !== 'BlockStatement',
|
|
44
|
-
...props
|
|
45
|
-
});
|
|
46
|
-
(0, _detachedNode.setParentPointersInDirectChildren)(node);
|
|
47
|
-
return node;
|
|
48
|
-
} // pattern/flags are on a subobject in the estree spec, but are flat on the hermes types
|
|
49
|
-
// also the value is supposed to be a RegExp instance
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
function RegExpLiteral({
|
|
53
|
-
pattern,
|
|
54
|
-
flags,
|
|
55
|
-
parent
|
|
56
|
-
}) {
|
|
57
|
-
const value = new RegExp(pattern, flags);
|
|
58
|
-
return (0, _detachedNode.detachedProps)(parent, {
|
|
59
|
-
type: 'Literal',
|
|
60
|
-
value,
|
|
61
|
-
raw: value.toString(),
|
|
62
|
-
regex: {
|
|
63
|
-
pattern,
|
|
64
|
-
flags
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
} // raw/cooked are on a subobject in the estree spec, but are flat on the hermes types
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
function TemplateElement({
|
|
71
|
-
tail,
|
|
72
|
-
parent,
|
|
73
|
-
...value
|
|
74
|
-
}) {
|
|
75
|
-
return (0, _detachedNode.detachedProps)(parent, {
|
|
76
|
-
type: 'TemplateElement',
|
|
77
|
-
tail,
|
|
78
|
-
value
|
|
79
|
-
});
|
|
80
|
-
} // Identifier has a bunch of stuff that usually you don't want to provide - so we have
|
|
81
|
-
// this manual def to allow us to default some values
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
function Identifier({
|
|
85
|
-
parent,
|
|
86
|
-
optional = false,
|
|
87
|
-
typeAnnotation = null,
|
|
88
|
-
...props
|
|
89
|
-
}) {
|
|
90
|
-
const node = (0, _detachedNode.detachedProps)(parent, {
|
|
91
|
-
type: 'Identifier',
|
|
92
|
-
optional,
|
|
93
|
-
typeAnnotation,
|
|
94
|
-
...props
|
|
95
|
-
});
|
|
96
|
-
(0, _detachedNode.setParentPointersInDirectChildren)(node);
|
|
97
|
-
return node;
|
|
98
|
-
} //
|
|
99
|
-
// Literals require a "raw" which is added by the estree transform, not hermes.
|
|
100
|
-
//
|
|
9
|
+
Object.keys(_Comment).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _Comment[key]) return;
|
|
12
|
+
exports[key] = _Comment[key];
|
|
13
|
+
});
|
|
101
14
|
|
|
15
|
+
var _DeclareExportDeclaration = require("./special-case-node-types/DeclareExportDeclaration");
|
|
102
16
|
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
17
|
+
Object.keys(_DeclareExportDeclaration).forEach(function (key) {
|
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
|
19
|
+
if (key in exports && exports[key] === _DeclareExportDeclaration[key]) return;
|
|
20
|
+
exports[key] = _DeclareExportDeclaration[key];
|
|
21
|
+
});
|
|
108
22
|
|
|
109
|
-
|
|
110
|
-
type: 'Literal',
|
|
111
|
-
...props,
|
|
112
|
-
raw: (_props$raw = props.raw) != null ? _props$raw : `${props.value}n`,
|
|
113
|
-
bigint: `${props.value}`
|
|
114
|
-
});
|
|
115
|
-
(0, _detachedNode.setParentPointersInDirectChildren)(node);
|
|
116
|
-
return node;
|
|
117
|
-
}
|
|
23
|
+
var _ExportNamedDeclaration = require("./special-case-node-types/ExportNamedDeclaration");
|
|
118
24
|
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
type: 'Literal',
|
|
125
|
-
raw: value ? 'true' : 'false',
|
|
126
|
-
value
|
|
127
|
-
});
|
|
128
|
-
}
|
|
25
|
+
Object.keys(_ExportNamedDeclaration).forEach(function (key) {
|
|
26
|
+
if (key === "default" || key === "__esModule") return;
|
|
27
|
+
if (key in exports && exports[key] === _ExportNamedDeclaration[key]) return;
|
|
28
|
+
exports[key] = _ExportNamedDeclaration[key];
|
|
29
|
+
});
|
|
129
30
|
|
|
130
|
-
|
|
131
|
-
parent,
|
|
132
|
-
...props
|
|
133
|
-
}) {
|
|
134
|
-
var _props$raw2;
|
|
31
|
+
var _Literal = require("./special-case-node-types/Literal");
|
|
135
32
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
33
|
+
Object.keys(_Literal).forEach(function (key) {
|
|
34
|
+
if (key === "default" || key === "__esModule") return;
|
|
35
|
+
if (key in exports && exports[key] === _Literal[key]) return;
|
|
36
|
+
exports[key] = _Literal[key];
|
|
37
|
+
});
|
|
142
38
|
|
|
143
|
-
|
|
144
|
-
parent
|
|
145
|
-
} = {}) {
|
|
146
|
-
return (0, _detachedNode.detachedProps)(parent, {
|
|
147
|
-
type: 'Literal',
|
|
148
|
-
value: null,
|
|
149
|
-
raw: 'null'
|
|
150
|
-
});
|
|
151
|
-
}
|
|
39
|
+
var _ObjectTypeProperty = require("./special-case-node-types/ObjectTypeProperty");
|
|
152
40
|
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
})
|
|
158
|
-
const hasSingleQuote = value.includes('"');
|
|
159
|
-
const hasDoubleQuote = value.includes("'");
|
|
160
|
-
let raw = rawIn;
|
|
41
|
+
Object.keys(_ObjectTypeProperty).forEach(function (key) {
|
|
42
|
+
if (key === "default" || key === "__esModule") return;
|
|
43
|
+
if (key in exports && exports[key] === _ObjectTypeProperty[key]) return;
|
|
44
|
+
exports[key] = _ObjectTypeProperty[key];
|
|
45
|
+
});
|
|
161
46
|
|
|
162
|
-
|
|
163
|
-
if (hasSingleQuote && hasDoubleQuote) {
|
|
164
|
-
raw = `'${value.replace(/'/g, "\\'")}'`;
|
|
165
|
-
} else if (hasSingleQuote) {
|
|
166
|
-
raw = `"${value}"`;
|
|
167
|
-
} else {
|
|
168
|
-
raw = `'${value}'`;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
47
|
+
var _misc = require("./special-case-node-types/misc");
|
|
171
48
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
49
|
+
Object.keys(_misc).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (key in exports && exports[key] === _misc[key]) return;
|
|
52
|
+
exports[key] = _misc[key];
|
|
53
|
+
});
|
|
178
54
|
|
|
179
|
-
|
|
180
|
-
value
|
|
181
|
-
}) {
|
|
182
|
-
// $FlowExpectedError[prop-missing]
|
|
183
|
-
// $FlowExpectedError[incompatible-return]
|
|
184
|
-
return (0, _detachedNode.detachedProps)(undefined, {
|
|
185
|
-
type: 'Line',
|
|
186
|
-
value
|
|
187
|
-
});
|
|
188
|
-
}
|
|
55
|
+
var _Property = require("./special-case-node-types/Property");
|
|
189
56
|
|
|
190
|
-
function
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return (0, _detachedNode.detachedProps)(undefined, {
|
|
196
|
-
type: 'Block',
|
|
197
|
-
value
|
|
198
|
-
});
|
|
199
|
-
}
|
|
57
|
+
Object.keys(_Property).forEach(function (key) {
|
|
58
|
+
if (key === "default" || key === "__esModule") return;
|
|
59
|
+
if (key in exports && exports[key] === _Property[key]) return;
|
|
60
|
+
exports[key] = _Property[key];
|
|
61
|
+
});
|