flow-parser 0.320.0 → 0.322.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/README.md +14 -26
- package/{oxidized/oxidized-src → dist}/FlowParser.js +3 -53
- package/{oxidized/oxidized-src → dist}/FlowParserDeserializer.js +3 -41
- package/{oxidized → dist}/FlowParserNodeDeserializers.js +0 -7
- package/{oxidized → dist}/FlowParserWASM.js +1 -1
- package/{oxidized/oxidized-src → dist}/HermesParserDecodeUTF8String.js +0 -9
- package/dist/ParserOptions.js +7 -0
- package/{oxidized → dist}/babel/TransformESTreeToBabel.js +9 -157
- package/{oxidized → dist}/estree/StripFlowTypes.js +0 -26
- package/{oxidized/oxidized-src → dist}/estree/StripFlowTypesForBabel.js +0 -24
- package/{oxidized/oxidized-src → dist}/estree/TransformComponentSyntax.js +0 -87
- package/{oxidized/oxidized-src → dist}/estree/TransformEnumSyntax.js +0 -12
- package/{oxidized/oxidized-src → dist}/estree/TransformMatchSyntax.js +3 -99
- package/{oxidized → dist}/estree/TransformRecordSyntax.js +3 -31
- package/{oxidized → dist}/getModuleDocblock.js +0 -21
- package/{oxidized → dist}/index.js +25 -99
- package/{oxidized → dist}/transform/SimpleTransform.js +0 -21
- package/{oxidized → dist}/transform/astArrayMutationHelpers.js +0 -9
- package/{oxidized/oxidized-src → dist}/transform/astNodeMutationHelpers.js +4 -26
- package/{oxidized/oxidized-src → dist}/transform/print/comments/comments.js +2 -51
- package/{oxidized → dist}/transform/print/comments/prettier/common/util.js +0 -49
- package/{oxidized → dist}/transform/print/comments/prettier/language-js/comments.js +0 -111
- package/{oxidized/oxidized-src → dist}/transform/print/comments/prettier/language-js/loc.js +0 -6
- package/{oxidized/oxidized-src → dist}/transform/print/comments/prettier/language-js/printer-estree.js +0 -3
- package/{oxidized/oxidized-src → dist}/transform/print/comments/prettier/language-js/utils.js +0 -20
- package/{oxidized/oxidized-src → dist}/transform/print/comments/prettier/main/comments.js +2 -63
- package/{oxidized/oxidized-src → dist}/transform/print/comments/prettier/utils/get-last.js +0 -1
- package/{oxidized → dist}/transform/print/print.js +6 -22
- package/{oxidized/oxidized-src → dist}/traverse/SimpleTraverser.js +2 -22
- package/{oxidized/oxidized-src → dist}/traverse/getVisitorKeys.js +3 -9
- package/{oxidized/oxidized-src → dist}/utils/Builders.js +1 -17
- package/{oxidized → dist}/utils/GenID.js +0 -7
- package/{oxidized/oxidized-src → dist}/utils/createSyntaxError.js +0 -1
- package/{oxidized → dist}/utils/isReservedWord.js +0 -2
- package/{oxidized → dist}/utils/mutateESTreeASTForPrettier.js +6 -21
- package/package.json +6 -7
- package/flow_parser.js +0 -14585
- package/oxidized/FlowParser.js +0 -249
- package/oxidized/FlowParserDeserializer.js +0 -209
- package/oxidized/HermesParserDecodeUTF8String.js +0 -45
- package/oxidized/ParserOptions.js +0 -8
- package/oxidized/estree/StripFlowTypesForBabel.js +0 -191
- package/oxidized/estree/TransformComponentSyntax.js +0 -764
- package/oxidized/estree/TransformEnumSyntax.js +0 -92
- package/oxidized/estree/TransformMatchSyntax.js +0 -990
- package/oxidized/oxidized-src/FlowParserNodeDeserializers.js +0 -1781
- package/oxidized/oxidized-src/ParserOptions.js +0 -8
- package/oxidized/oxidized-src/babel/TransformESTreeToBabel.js +0 -1063
- package/oxidized/oxidized-src/estree/StripFlowTypes.js +0 -158
- package/oxidized/oxidized-src/estree/TransformRecordSyntax.js +0 -283
- package/oxidized/oxidized-src/generated/ESTreeVisitorKeys.js +0 -234
- package/oxidized/oxidized-src/getModuleDocblock.js +0 -87
- package/oxidized/oxidized-src/index.js +0 -220
- package/oxidized/oxidized-src/transform/SimpleTransform.js +0 -95
- package/oxidized/oxidized-src/transform/astArrayMutationHelpers.js +0 -52
- package/oxidized/oxidized-src/transform/print/comments/prettier/common/util.js +0 -235
- package/oxidized/oxidized-src/transform/print/comments/prettier/language-js/comments.js +0 -663
- package/oxidized/oxidized-src/transform/print/print.js +0 -68
- package/oxidized/oxidized-src/utils/GenID.js +0 -37
- package/oxidized/oxidized-src/utils/isReservedWord.js +0 -53
- package/oxidized/oxidized-src/utils/mutateESTreeASTForPrettier.js +0 -85
- package/oxidized/transform/astNodeMutationHelpers.js +0 -142
- package/oxidized/transform/print/comments/comments.js +0 -245
- package/oxidized/transform/print/comments/prettier/language-js/loc.js +0 -30
- package/oxidized/transform/print/comments/prettier/language-js/printer-estree.js +0 -23
- package/oxidized/transform/print/comments/prettier/language-js/utils.js +0 -89
- package/oxidized/transform/print/comments/prettier/main/comments.js +0 -374
- package/oxidized/transform/print/comments/prettier/utils/get-last.js +0 -5
- package/oxidized/transform/print/detachedNodeTypes.js +0 -1
- package/oxidized/traverse/SimpleTraverser.js +0 -90
- package/oxidized/traverse/getVisitorKeys.js +0 -29
- package/oxidized/utils/Builders.js +0 -181
- package/oxidized/utils/createSyntaxError.js +0 -15
- /package/{oxidized → dist}/FlowParser.js.flow +0 -0
- /package/{oxidized → dist}/FlowParserDeserializer.js.flow +0 -0
- /package/{oxidized → dist}/FlowParserNodeDeserializers.js.flow +0 -0
- /package/{oxidized → dist}/FlowParserWASM.js.flow +0 -0
- /package/{oxidized → dist}/HermesAST.js.flow +0 -0
- /package/{oxidized → dist}/HermesParserDecodeUTF8String.js.flow +0 -0
- /package/{oxidized → dist}/ParserOptions.js.flow +0 -0
- /package/{oxidized → dist}/babel/TransformESTreeToBabel.js.flow +0 -0
- /package/{oxidized → dist}/estree/StripFlowTypes.js.flow +0 -0
- /package/{oxidized → dist}/estree/StripFlowTypesForBabel.js.flow +0 -0
- /package/{oxidized → dist}/estree/TransformComponentSyntax.js.flow +0 -0
- /package/{oxidized → dist}/estree/TransformEnumSyntax.js.flow +0 -0
- /package/{oxidized → dist}/estree/TransformMatchSyntax.js.flow +0 -0
- /package/{oxidized → dist}/estree/TransformRecordSyntax.js.flow +0 -0
- /package/{oxidized → dist}/generated/ESTreeVisitorKeys.js +0 -0
- /package/{oxidized → dist}/generated/ESTreeVisitorKeys.js.flow +0 -0
- /package/{oxidized → dist}/getModuleDocblock.js.flow +0 -0
- /package/{oxidized → dist}/index.js.flow +0 -0
- /package/{oxidized → dist}/transform/SimpleTransform.js.flow +0 -0
- /package/{oxidized → dist}/transform/astArrayMutationHelpers.js.flow +0 -0
- /package/{oxidized → dist}/transform/astNodeMutationHelpers.js.flow +0 -0
- /package/{oxidized → dist}/transform/print/comments/comments.js.flow +0 -0
- /package/{oxidized/oxidized-src → dist}/transform/print/detachedNodeTypes.js +0 -0
- /package/{oxidized → dist}/transform/print/detachedNodeTypes.js.flow +0 -0
- /package/{oxidized → dist}/transform/print/print.js.flow +0 -0
- /package/{oxidized → dist}/traverse/SimpleTraverser.js.flow +0 -0
- /package/{oxidized → dist}/traverse/getVisitorKeys.js.flow +0 -0
- /package/{oxidized → dist}/utils/Builders.js.flow +0 -0
- /package/{oxidized → dist}/utils/GenID.js.flow +0 -0
- /package/{oxidized → dist}/utils/createSyntaxError.js.flow +0 -0
- /package/{oxidized → dist}/utils/isReservedWord.js.flow +0 -0
- /package/{oxidized → dist}/utils/mutateESTreeASTForPrettier.js.flow +0 -0
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.EMPTY_PARENT = void 0;
|
|
7
|
-
exports.callExpression = callExpression;
|
|
8
|
-
exports.conjunction = conjunction;
|
|
9
|
-
exports.createDefaultPosition = createDefaultPosition;
|
|
10
|
-
exports.disjunction = disjunction;
|
|
11
|
-
exports.etc = etc;
|
|
12
|
-
exports.ident = ident;
|
|
13
|
-
exports.iife = iife;
|
|
14
|
-
exports.nullLiteral = nullLiteral;
|
|
15
|
-
exports.numberLiteral = numberLiteral;
|
|
16
|
-
exports.stringLiteral = stringLiteral;
|
|
17
|
-
exports.throwStatement = throwStatement;
|
|
18
|
-
exports.typeofExpression = typeofExpression;
|
|
19
|
-
exports.variableDeclaration = variableDeclaration;
|
|
20
|
-
const EMPTY_PARENT = null;
|
|
21
|
-
exports.EMPTY_PARENT = EMPTY_PARENT;
|
|
22
|
-
|
|
23
|
-
function createDefaultPosition() {
|
|
24
|
-
return {
|
|
25
|
-
line: 1,
|
|
26
|
-
column: 0
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function etc({
|
|
31
|
-
loc,
|
|
32
|
-
range,
|
|
33
|
-
parent
|
|
34
|
-
} = {}) {
|
|
35
|
-
return {
|
|
36
|
-
loc: {
|
|
37
|
-
start: (loc == null ? void 0 : loc.start) != null ? loc.start : createDefaultPosition(),
|
|
38
|
-
end: (loc == null ? void 0 : loc.end) != null ? loc.end : createDefaultPosition()
|
|
39
|
-
},
|
|
40
|
-
range: range != null ? range : [0, 0],
|
|
41
|
-
parent: parent != null ? parent : EMPTY_PARENT
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function ident(name, info) {
|
|
46
|
-
return {
|
|
47
|
-
type: 'Identifier',
|
|
48
|
-
name,
|
|
49
|
-
optional: false,
|
|
50
|
-
typeAnnotation: null,
|
|
51
|
-
...etc(info)
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function stringLiteral(value, info) {
|
|
56
|
-
return {
|
|
57
|
-
type: 'Literal',
|
|
58
|
-
value,
|
|
59
|
-
raw: `"${value}"`,
|
|
60
|
-
literalType: 'string',
|
|
61
|
-
...etc(info)
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function numberLiteral(value, info) {
|
|
66
|
-
return {
|
|
67
|
-
type: 'Literal',
|
|
68
|
-
value,
|
|
69
|
-
raw: String(value),
|
|
70
|
-
literalType: 'numeric',
|
|
71
|
-
...etc(info)
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function nullLiteral(info) {
|
|
76
|
-
return {
|
|
77
|
-
type: 'Literal',
|
|
78
|
-
value: null,
|
|
79
|
-
raw: 'null',
|
|
80
|
-
literalType: 'null',
|
|
81
|
-
...etc(info)
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function conjunction(tests) {
|
|
86
|
-
if (tests.length === 0) {
|
|
87
|
-
throw new Error('Must have at least one test.');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return tests.reduce((acc, test) => ({
|
|
91
|
-
type: 'LogicalExpression',
|
|
92
|
-
left: acc,
|
|
93
|
-
right: test,
|
|
94
|
-
operator: '&&',
|
|
95
|
-
...etc()
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function disjunction(tests) {
|
|
100
|
-
if (tests.length === 0) {
|
|
101
|
-
throw new Error('Must have at least one test.');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return tests.reduce((acc, test) => ({
|
|
105
|
-
type: 'LogicalExpression',
|
|
106
|
-
left: acc,
|
|
107
|
-
right: test,
|
|
108
|
-
operator: '||',
|
|
109
|
-
...etc()
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function variableDeclaration(kind, id, init, info) {
|
|
114
|
-
return {
|
|
115
|
-
type: 'VariableDeclaration',
|
|
116
|
-
kind,
|
|
117
|
-
declarations: [{
|
|
118
|
-
type: 'VariableDeclarator',
|
|
119
|
-
init,
|
|
120
|
-
id,
|
|
121
|
-
...etc(),
|
|
122
|
-
parent: EMPTY_PARENT
|
|
123
|
-
}],
|
|
124
|
-
...etc(info)
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function callExpression(callee, args, info) {
|
|
129
|
-
return {
|
|
130
|
-
type: 'CallExpression',
|
|
131
|
-
callee,
|
|
132
|
-
arguments: args,
|
|
133
|
-
typeArguments: null,
|
|
134
|
-
optional: false,
|
|
135
|
-
...etc(info)
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function throwStatement(arg, info) {
|
|
140
|
-
return {
|
|
141
|
-
type: 'ThrowStatement',
|
|
142
|
-
argument: callExpression(ident('Error'), [arg]),
|
|
143
|
-
...etc(info)
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function iife(statements, params = [], args = []) {
|
|
148
|
-
const callee = {
|
|
149
|
-
type: 'ArrowFunctionExpression',
|
|
150
|
-
params,
|
|
151
|
-
expression: false,
|
|
152
|
-
async: false,
|
|
153
|
-
predicate: null,
|
|
154
|
-
returnType: null,
|
|
155
|
-
typeParameters: null,
|
|
156
|
-
id: null,
|
|
157
|
-
body: {
|
|
158
|
-
type: 'BlockStatement',
|
|
159
|
-
body: statements,
|
|
160
|
-
...etc()
|
|
161
|
-
},
|
|
162
|
-
...etc()
|
|
163
|
-
};
|
|
164
|
-
return callExpression(callee, args);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function typeofExpression(arg, kind) {
|
|
168
|
-
return {
|
|
169
|
-
type: 'BinaryExpression',
|
|
170
|
-
left: {
|
|
171
|
-
type: 'UnaryExpression',
|
|
172
|
-
operator: 'typeof',
|
|
173
|
-
argument: arg,
|
|
174
|
-
prefix: true,
|
|
175
|
-
...etc()
|
|
176
|
-
},
|
|
177
|
-
right: stringLiteral(kind),
|
|
178
|
-
operator: '===',
|
|
179
|
-
...etc()
|
|
180
|
-
};
|
|
181
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createSyntaxError = createSyntaxError;
|
|
7
|
-
|
|
8
|
-
function createSyntaxError(node, err) {
|
|
9
|
-
const syntaxError = new SyntaxError(err);
|
|
10
|
-
syntaxError.loc = {
|
|
11
|
-
line: node.loc.start.line,
|
|
12
|
-
column: node.loc.start.column
|
|
13
|
-
};
|
|
14
|
-
return syntaxError;
|
|
15
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|