oxc-parser 0.63.0 → 0.64.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/deserialize-js.js +41 -49
- package/deserialize-ts.js +76 -56
- package/package.json +12 -12
package/deserialize-js.js
CHANGED
|
@@ -37,11 +37,14 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) {
|
|
|
37
37
|
function deserializeProgram(pos) {
|
|
38
38
|
const body = deserializeVecDirective(pos + 88);
|
|
39
39
|
body.push(...deserializeVecStatement(pos + 120));
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
const start = deserializeU32(pos);
|
|
42
|
+
const end = deserializeU32(pos + 4);
|
|
43
|
+
|
|
41
44
|
const program = {
|
|
42
45
|
type: 'Program',
|
|
43
46
|
start,
|
|
44
|
-
end
|
|
47
|
+
end,
|
|
45
48
|
body,
|
|
46
49
|
sourceType: deserializeModuleKind(pos + 9),
|
|
47
50
|
hashbang: deserializeOptionHashbang(pos + 64),
|
|
@@ -150,18 +153,15 @@ function deserializeTaggedTemplateExpression(pos) {
|
|
|
150
153
|
}
|
|
151
154
|
|
|
152
155
|
function deserializeTemplateElement(pos) {
|
|
153
|
-
|
|
156
|
+
const tail = deserializeBool(pos + 40),
|
|
157
|
+
start = deserializeU32(pos),
|
|
158
|
+
end = deserializeU32(pos + 4),
|
|
159
|
+
value = deserializeTemplateElementValue(pos + 8);
|
|
154
160
|
if (value.cooked !== null && deserializeBool(pos + 41)) {
|
|
155
161
|
value.cooked = value.cooked
|
|
156
162
|
.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
|
|
157
163
|
}
|
|
158
|
-
return {
|
|
159
|
-
type: 'TemplateElement',
|
|
160
|
-
start: deserializeU32(pos),
|
|
161
|
-
end: deserializeU32(pos + 4),
|
|
162
|
-
value,
|
|
163
|
-
tail: deserializeBool(pos + 40),
|
|
164
|
-
};
|
|
164
|
+
return { type: 'TemplateElement', start, end, value, tail };
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
function deserializeTemplateElementValue(pos) {
|
|
@@ -906,13 +906,12 @@ function deserializeAccessorProperty(pos) {
|
|
|
906
906
|
}
|
|
907
907
|
|
|
908
908
|
function deserializeImportExpression(pos) {
|
|
909
|
-
const options = deserializeVecExpression(pos + 24);
|
|
910
909
|
return {
|
|
911
910
|
type: 'ImportExpression',
|
|
912
911
|
start: deserializeU32(pos),
|
|
913
912
|
end: deserializeU32(pos + 4),
|
|
914
913
|
source: deserializeExpression(pos + 8),
|
|
915
|
-
options:
|
|
914
|
+
options: deserializeOptionExpression(pos + 24),
|
|
916
915
|
};
|
|
917
916
|
}
|
|
918
917
|
|
|
@@ -1178,13 +1177,14 @@ function deserializeJSXFragment(pos) {
|
|
|
1178
1177
|
}
|
|
1179
1178
|
|
|
1180
1179
|
function deserializeJSXOpeningFragment(pos) {
|
|
1181
|
-
|
|
1180
|
+
const node = {
|
|
1182
1181
|
type: 'JSXOpeningFragment',
|
|
1183
1182
|
start: deserializeU32(pos),
|
|
1184
1183
|
end: deserializeU32(pos + 4),
|
|
1185
1184
|
attributes: [],
|
|
1186
1185
|
selfClosing: false,
|
|
1187
1186
|
};
|
|
1187
|
+
return node;
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
1190
|
function deserializeJSXClosingFragment(pos) {
|
|
@@ -1292,18 +1292,23 @@ function deserializeTSThisParameter(pos) {
|
|
|
1292
1292
|
}
|
|
1293
1293
|
|
|
1294
1294
|
function deserializeTSEnumDeclaration(pos) {
|
|
1295
|
-
const end = deserializeU32(pos + 4),
|
|
1296
|
-
id = deserializeBindingIdentifier(pos + 8);
|
|
1297
|
-
const tsEnumDeclMembers = deserializeVecTSEnumMember(pos + 40);
|
|
1298
|
-
const bodyStart = id.end + 1;
|
|
1299
1295
|
return {
|
|
1300
1296
|
type: 'TSEnumDeclaration',
|
|
1301
1297
|
start: deserializeU32(pos),
|
|
1302
|
-
end,
|
|
1303
|
-
id,
|
|
1304
|
-
body:
|
|
1305
|
-
const: deserializeBool(pos +
|
|
1306
|
-
declare: deserializeBool(pos +
|
|
1298
|
+
end: deserializeU32(pos + 4),
|
|
1299
|
+
id: deserializeBindingIdentifier(pos + 8),
|
|
1300
|
+
body: deserializeTSEnumBody(pos + 40),
|
|
1301
|
+
const: deserializeBool(pos + 80),
|
|
1302
|
+
declare: deserializeBool(pos + 81),
|
|
1303
|
+
};
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
function deserializeTSEnumBody(pos) {
|
|
1307
|
+
return {
|
|
1308
|
+
type: 'TSEnumBody',
|
|
1309
|
+
start: deserializeU32(pos),
|
|
1310
|
+
end: deserializeU32(pos + 4),
|
|
1311
|
+
members: deserializeVecTSEnumMember(pos + 8),
|
|
1307
1312
|
};
|
|
1308
1313
|
}
|
|
1309
1314
|
|
|
@@ -1313,6 +1318,7 @@ function deserializeTSEnumMember(pos) {
|
|
|
1313
1318
|
start: deserializeU32(pos),
|
|
1314
1319
|
end: deserializeU32(pos + 4),
|
|
1315
1320
|
id: deserializeTSEnumMemberName(pos + 8),
|
|
1321
|
+
computed: deserializeU8(pos + 8) > 1,
|
|
1316
1322
|
initializer: deserializeOptionExpression(pos + 24),
|
|
1317
1323
|
};
|
|
1318
1324
|
}
|
|
@@ -1840,15 +1846,17 @@ function deserializeTSConstructorType(pos) {
|
|
|
1840
1846
|
}
|
|
1841
1847
|
|
|
1842
1848
|
function deserializeTSMappedType(pos) {
|
|
1849
|
+
const typeParameter = deserializeBoxTSTypeParameter(pos + 8);
|
|
1843
1850
|
return {
|
|
1844
1851
|
type: 'TSMappedType',
|
|
1845
1852
|
start: deserializeU32(pos),
|
|
1846
1853
|
end: deserializeU32(pos + 4),
|
|
1847
|
-
typeParameter: deserializeBoxTSTypeParameter(pos + 8),
|
|
1848
1854
|
nameType: deserializeOptionTSType(pos + 16),
|
|
1849
1855
|
typeAnnotation: deserializeOptionTSType(pos + 32),
|
|
1850
1856
|
optional: deserializeTSMappedTypeModifierOperator(pos + 48),
|
|
1851
1857
|
readonly: deserializeTSMappedTypeModifierOperator(pos + 49),
|
|
1858
|
+
key: typeParameter.name,
|
|
1859
|
+
constraint: typeParameter.constraint,
|
|
1852
1860
|
};
|
|
1853
1861
|
}
|
|
1854
1862
|
|
|
@@ -1954,13 +1962,13 @@ function deserializeTSInstantiationExpression(pos) {
|
|
|
1954
1962
|
start: deserializeU32(pos),
|
|
1955
1963
|
end: deserializeU32(pos + 4),
|
|
1956
1964
|
expression: deserializeExpression(pos + 8),
|
|
1957
|
-
|
|
1965
|
+
typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24),
|
|
1958
1966
|
};
|
|
1959
1967
|
}
|
|
1960
1968
|
|
|
1961
1969
|
function deserializeJSDocNullableType(pos) {
|
|
1962
1970
|
return {
|
|
1963
|
-
type: '
|
|
1971
|
+
type: 'TSJSDocNullableType',
|
|
1964
1972
|
start: deserializeU32(pos),
|
|
1965
1973
|
end: deserializeU32(pos + 4),
|
|
1966
1974
|
typeAnnotation: deserializeTSType(pos + 8),
|
|
@@ -1970,7 +1978,7 @@ function deserializeJSDocNullableType(pos) {
|
|
|
1970
1978
|
|
|
1971
1979
|
function deserializeJSDocNonNullableType(pos) {
|
|
1972
1980
|
return {
|
|
1973
|
-
type: '
|
|
1981
|
+
type: 'TSJSDocNonNullableType',
|
|
1974
1982
|
start: deserializeU32(pos),
|
|
1975
1983
|
end: deserializeU32(pos + 4),
|
|
1976
1984
|
typeAnnotation: deserializeTSType(pos + 8),
|
|
@@ -1980,7 +1988,7 @@ function deserializeJSDocNonNullableType(pos) {
|
|
|
1980
1988
|
|
|
1981
1989
|
function deserializeJSDocUnknownType(pos) {
|
|
1982
1990
|
return {
|
|
1983
|
-
type: '
|
|
1991
|
+
type: 'TSJSDocUnknownType',
|
|
1984
1992
|
start: deserializeU32(pos),
|
|
1985
1993
|
end: deserializeU32(pos + 4),
|
|
1986
1994
|
};
|
|
@@ -3557,6 +3565,10 @@ function deserializeTSEnumMemberName(pos) {
|
|
|
3557
3565
|
return deserializeBoxIdentifierName(pos + 8);
|
|
3558
3566
|
case 1:
|
|
3559
3567
|
return deserializeBoxStringLiteral(pos + 8);
|
|
3568
|
+
case 2:
|
|
3569
|
+
return deserializeBoxStringLiteral(pos + 8);
|
|
3570
|
+
case 3:
|
|
3571
|
+
return deserializeBoxTemplateLiteral(pos + 8);
|
|
3560
3572
|
default:
|
|
3561
3573
|
throw new Error(`Unexpected discriminant ${uint8[pos]} for TSEnumMemberName`);
|
|
3562
3574
|
}
|
|
@@ -3874,18 +3886,8 @@ function deserializeTSTypeQueryExprName(pos) {
|
|
|
3874
3886
|
}
|
|
3875
3887
|
|
|
3876
3888
|
function deserializeTSMappedTypeModifierOperator(pos) {
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
return 'true';
|
|
3880
|
-
case 1:
|
|
3881
|
-
return '+';
|
|
3882
|
-
case 2:
|
|
3883
|
-
return '-';
|
|
3884
|
-
case 3:
|
|
3885
|
-
return 'none';
|
|
3886
|
-
default:
|
|
3887
|
-
throw new Error(`Unexpected discriminant ${uint8[pos]} for TSMappedTypeModifierOperator`);
|
|
3888
|
-
}
|
|
3889
|
+
const operator = deserializeU8(pos);
|
|
3890
|
+
return [true, '+', '-', null][operator];
|
|
3889
3891
|
}
|
|
3890
3892
|
|
|
3891
3893
|
function deserializeTSModuleReference(pos) {
|
|
@@ -4539,11 +4541,6 @@ function deserializeVecArrayExpressionElement(pos) {
|
|
|
4539
4541
|
return arr;
|
|
4540
4542
|
}
|
|
4541
4543
|
|
|
4542
|
-
function deserializeOptionSpan(pos) {
|
|
4543
|
-
if (uint8[pos] === 0) return null;
|
|
4544
|
-
return deserializeSpan(pos + 8);
|
|
4545
|
-
}
|
|
4546
|
-
|
|
4547
4544
|
function deserializeBoxSpreadElement(pos) {
|
|
4548
4545
|
return deserializeSpreadElement(uint32[pos >> 2]);
|
|
4549
4546
|
}
|
|
@@ -4991,11 +4988,6 @@ function deserializeVecTSClassImplements(pos) {
|
|
|
4991
4988
|
return arr;
|
|
4992
4989
|
}
|
|
4993
4990
|
|
|
4994
|
-
function deserializeOptionVecTSClassImplements(pos) {
|
|
4995
|
-
if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
|
|
4996
|
-
return deserializeVecTSClassImplements(pos);
|
|
4997
|
-
}
|
|
4998
|
-
|
|
4999
4991
|
function deserializeBoxClassBody(pos) {
|
|
5000
4992
|
return deserializeClassBody(uint32[pos >> 2]);
|
|
5001
4993
|
}
|
package/deserialize-ts.js
CHANGED
|
@@ -37,12 +37,30 @@ function deserialize(buffer, sourceTextInput, sourceLenInput) {
|
|
|
37
37
|
function deserializeProgram(pos) {
|
|
38
38
|
const body = deserializeVecDirective(pos + 88);
|
|
39
39
|
body.push(...deserializeVecStatement(pos + 120));
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
|
|
41
|
+
const end = deserializeU32(pos + 4);
|
|
42
|
+
|
|
43
|
+
let start;
|
|
44
|
+
if (body.length > 0) {
|
|
45
|
+
const first = body[0];
|
|
46
|
+
start = first.start;
|
|
47
|
+
if (first.type === 'ExportNamedDeclaration' || first.type === 'ExportDefaultDeclaration') {
|
|
48
|
+
const { declaration } = first;
|
|
49
|
+
if (
|
|
50
|
+
declaration !== null && declaration.type === 'ClassDeclaration' &&
|
|
51
|
+
declaration.decorators.length > 0
|
|
52
|
+
) {
|
|
53
|
+
const decoratorStart = declaration.decorators[0].start;
|
|
54
|
+
if (decoratorStart < start) start = decoratorStart;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
start = end;
|
|
59
|
+
}
|
|
42
60
|
const program = {
|
|
43
61
|
type: 'Program',
|
|
44
62
|
start,
|
|
45
|
-
end
|
|
63
|
+
end,
|
|
46
64
|
body,
|
|
47
65
|
sourceType: deserializeModuleKind(pos + 9),
|
|
48
66
|
hashbang: deserializeOptionHashbang(pos + 64),
|
|
@@ -165,18 +183,15 @@ function deserializeTaggedTemplateExpression(pos) {
|
|
|
165
183
|
}
|
|
166
184
|
|
|
167
185
|
function deserializeTemplateElement(pos) {
|
|
168
|
-
|
|
186
|
+
const tail = deserializeBool(pos + 40),
|
|
187
|
+
start = deserializeU32(pos) - 1,
|
|
188
|
+
end = deserializeU32(pos + 4) + 2 - tail,
|
|
189
|
+
value = deserializeTemplateElementValue(pos + 8);
|
|
169
190
|
if (value.cooked !== null && deserializeBool(pos + 41)) {
|
|
170
191
|
value.cooked = value.cooked
|
|
171
192
|
.replace(/\uFFFD(.{4})/g, (_, hex) => String.fromCodePoint(parseInt(hex, 16)));
|
|
172
193
|
}
|
|
173
|
-
return {
|
|
174
|
-
type: 'TemplateElement',
|
|
175
|
-
start: deserializeU32(pos),
|
|
176
|
-
end: deserializeU32(pos + 4),
|
|
177
|
-
value,
|
|
178
|
-
tail: deserializeBool(pos + 40),
|
|
179
|
-
};
|
|
194
|
+
return { type: 'TemplateElement', start, end, value, tail };
|
|
180
195
|
}
|
|
181
196
|
|
|
182
197
|
function deserializeTemplateElementValue(pos) {
|
|
@@ -350,6 +365,9 @@ function deserializeArrayAssignmentTarget(pos) {
|
|
|
350
365
|
start: deserializeU32(pos),
|
|
351
366
|
end: deserializeU32(pos + 4),
|
|
352
367
|
elements,
|
|
368
|
+
decorators: [],
|
|
369
|
+
optional: false,
|
|
370
|
+
typeAnnotation: null,
|
|
353
371
|
};
|
|
354
372
|
}
|
|
355
373
|
|
|
@@ -362,6 +380,9 @@ function deserializeObjectAssignmentTarget(pos) {
|
|
|
362
380
|
start: deserializeU32(pos),
|
|
363
381
|
end: deserializeU32(pos + 4),
|
|
364
382
|
properties,
|
|
383
|
+
decorators: [],
|
|
384
|
+
optional: false,
|
|
385
|
+
typeAnnotation: null,
|
|
365
386
|
};
|
|
366
387
|
}
|
|
367
388
|
|
|
@@ -371,6 +392,10 @@ function deserializeAssignmentTargetRest(pos) {
|
|
|
371
392
|
start: deserializeU32(pos),
|
|
372
393
|
end: deserializeU32(pos + 4),
|
|
373
394
|
argument: deserializeAssignmentTarget(pos + 8),
|
|
395
|
+
decorators: [],
|
|
396
|
+
optional: false,
|
|
397
|
+
typeAnnotation: null,
|
|
398
|
+
value: null,
|
|
374
399
|
};
|
|
375
400
|
}
|
|
376
401
|
|
|
@@ -409,6 +434,7 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
|
409
434
|
key,
|
|
410
435
|
value,
|
|
411
436
|
kind: 'init',
|
|
437
|
+
optional: false,
|
|
412
438
|
};
|
|
413
439
|
}
|
|
414
440
|
|
|
@@ -423,6 +449,7 @@ function deserializeAssignmentTargetPropertyProperty(pos) {
|
|
|
423
449
|
key: deserializePropertyKey(pos + 8),
|
|
424
450
|
value: deserializeAssignmentTargetMaybeDefault(pos + 24),
|
|
425
451
|
kind: 'init',
|
|
452
|
+
optional: false,
|
|
426
453
|
};
|
|
427
454
|
}
|
|
428
455
|
|
|
@@ -785,6 +812,10 @@ function deserializeBindingRestElement(pos) {
|
|
|
785
812
|
start: deserializeU32(pos),
|
|
786
813
|
end: deserializeU32(pos + 4),
|
|
787
814
|
argument: deserializeBindingPattern(pos + 8),
|
|
815
|
+
decorators: [],
|
|
816
|
+
optional: false,
|
|
817
|
+
typeAnnotation: null,
|
|
818
|
+
value: null,
|
|
788
819
|
};
|
|
789
820
|
}
|
|
790
821
|
|
|
@@ -875,7 +906,6 @@ function deserializeYieldExpression(pos) {
|
|
|
875
906
|
}
|
|
876
907
|
|
|
877
908
|
function deserializeClass(pos) {
|
|
878
|
-
const classImplements = deserializeOptionVecTSClassImplements(pos + 112);
|
|
879
909
|
return {
|
|
880
910
|
type: deserializeClassType(pos + 8),
|
|
881
911
|
start: deserializeU32(pos),
|
|
@@ -886,7 +916,7 @@ function deserializeClass(pos) {
|
|
|
886
916
|
decorators: deserializeVecDecorator(pos + 16),
|
|
887
917
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 80),
|
|
888
918
|
superTypeArguments: deserializeOptionBoxTSTypeParameterInstantiation(pos + 104),
|
|
889
|
-
implements:
|
|
919
|
+
implements: deserializeVecTSClassImplements(pos + 112),
|
|
890
920
|
abstract: deserializeBool(pos + 152),
|
|
891
921
|
declare: deserializeBool(pos + 153),
|
|
892
922
|
};
|
|
@@ -966,24 +996,23 @@ function deserializeAccessorProperty(pos) {
|
|
|
966
996
|
computed: deserializeBool(pos + 80),
|
|
967
997
|
static: deserializeBool(pos + 81),
|
|
968
998
|
decorators: deserializeVecDecorator(pos + 16),
|
|
969
|
-
definite: deserializeBool(pos +
|
|
999
|
+
definite: deserializeBool(pos + 83),
|
|
970
1000
|
typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 88),
|
|
971
1001
|
accessibility: deserializeOptionTSAccessibility(pos + 96),
|
|
972
1002
|
optional: false,
|
|
973
|
-
override:
|
|
1003
|
+
override: deserializeBool(pos + 82),
|
|
974
1004
|
readonly: false,
|
|
975
1005
|
declare: false,
|
|
976
1006
|
};
|
|
977
1007
|
}
|
|
978
1008
|
|
|
979
1009
|
function deserializeImportExpression(pos) {
|
|
980
|
-
const options = deserializeVecExpression(pos + 24);
|
|
981
1010
|
return {
|
|
982
1011
|
type: 'ImportExpression',
|
|
983
1012
|
start: deserializeU32(pos),
|
|
984
1013
|
end: deserializeU32(pos + 4),
|
|
985
1014
|
source: deserializeExpression(pos + 8),
|
|
986
|
-
options:
|
|
1015
|
+
options: deserializeOptionExpression(pos + 24),
|
|
987
1016
|
};
|
|
988
1017
|
}
|
|
989
1018
|
|
|
@@ -1256,13 +1285,12 @@ function deserializeJSXFragment(pos) {
|
|
|
1256
1285
|
}
|
|
1257
1286
|
|
|
1258
1287
|
function deserializeJSXOpeningFragment(pos) {
|
|
1259
|
-
|
|
1288
|
+
const node = {
|
|
1260
1289
|
type: 'JSXOpeningFragment',
|
|
1261
1290
|
start: deserializeU32(pos),
|
|
1262
1291
|
end: deserializeU32(pos + 4),
|
|
1263
|
-
attributes: [],
|
|
1264
|
-
selfClosing: false,
|
|
1265
1292
|
};
|
|
1293
|
+
return node;
|
|
1266
1294
|
}
|
|
1267
1295
|
|
|
1268
1296
|
function deserializeJSXClosingFragment(pos) {
|
|
@@ -1370,18 +1398,23 @@ function deserializeTSThisParameter(pos) {
|
|
|
1370
1398
|
}
|
|
1371
1399
|
|
|
1372
1400
|
function deserializeTSEnumDeclaration(pos) {
|
|
1373
|
-
const end = deserializeU32(pos + 4),
|
|
1374
|
-
id = deserializeBindingIdentifier(pos + 8);
|
|
1375
|
-
const tsEnumDeclMembers = deserializeVecTSEnumMember(pos + 40);
|
|
1376
|
-
const bodyStart = id.end + 1;
|
|
1377
1401
|
return {
|
|
1378
1402
|
type: 'TSEnumDeclaration',
|
|
1379
1403
|
start: deserializeU32(pos),
|
|
1380
|
-
end,
|
|
1381
|
-
id,
|
|
1382
|
-
body:
|
|
1383
|
-
const: deserializeBool(pos +
|
|
1384
|
-
declare: deserializeBool(pos +
|
|
1404
|
+
end: deserializeU32(pos + 4),
|
|
1405
|
+
id: deserializeBindingIdentifier(pos + 8),
|
|
1406
|
+
body: deserializeTSEnumBody(pos + 40),
|
|
1407
|
+
const: deserializeBool(pos + 80),
|
|
1408
|
+
declare: deserializeBool(pos + 81),
|
|
1409
|
+
};
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
function deserializeTSEnumBody(pos) {
|
|
1413
|
+
return {
|
|
1414
|
+
type: 'TSEnumBody',
|
|
1415
|
+
start: deserializeU32(pos),
|
|
1416
|
+
end: deserializeU32(pos + 4),
|
|
1417
|
+
members: deserializeVecTSEnumMember(pos + 8),
|
|
1385
1418
|
};
|
|
1386
1419
|
}
|
|
1387
1420
|
|
|
@@ -1391,6 +1424,7 @@ function deserializeTSEnumMember(pos) {
|
|
|
1391
1424
|
start: deserializeU32(pos),
|
|
1392
1425
|
end: deserializeU32(pos + 4),
|
|
1393
1426
|
id: deserializeTSEnumMemberName(pos + 8),
|
|
1427
|
+
computed: deserializeU8(pos + 8) > 1,
|
|
1394
1428
|
initializer: deserializeOptionExpression(pos + 24),
|
|
1395
1429
|
};
|
|
1396
1430
|
}
|
|
@@ -1918,15 +1952,17 @@ function deserializeTSConstructorType(pos) {
|
|
|
1918
1952
|
}
|
|
1919
1953
|
|
|
1920
1954
|
function deserializeTSMappedType(pos) {
|
|
1955
|
+
const typeParameter = deserializeBoxTSTypeParameter(pos + 8);
|
|
1921
1956
|
return {
|
|
1922
1957
|
type: 'TSMappedType',
|
|
1923
1958
|
start: deserializeU32(pos),
|
|
1924
1959
|
end: deserializeU32(pos + 4),
|
|
1925
|
-
typeParameter: deserializeBoxTSTypeParameter(pos + 8),
|
|
1926
1960
|
nameType: deserializeOptionTSType(pos + 16),
|
|
1927
1961
|
typeAnnotation: deserializeOptionTSType(pos + 32),
|
|
1928
1962
|
optional: deserializeTSMappedTypeModifierOperator(pos + 48),
|
|
1929
1963
|
readonly: deserializeTSMappedTypeModifierOperator(pos + 49),
|
|
1964
|
+
key: typeParameter.name,
|
|
1965
|
+
constraint: typeParameter.constraint,
|
|
1930
1966
|
};
|
|
1931
1967
|
}
|
|
1932
1968
|
|
|
@@ -2032,13 +2068,13 @@ function deserializeTSInstantiationExpression(pos) {
|
|
|
2032
2068
|
start: deserializeU32(pos),
|
|
2033
2069
|
end: deserializeU32(pos + 4),
|
|
2034
2070
|
expression: deserializeExpression(pos + 8),
|
|
2035
|
-
|
|
2071
|
+
typeArguments: deserializeBoxTSTypeParameterInstantiation(pos + 24),
|
|
2036
2072
|
};
|
|
2037
2073
|
}
|
|
2038
2074
|
|
|
2039
2075
|
function deserializeJSDocNullableType(pos) {
|
|
2040
2076
|
return {
|
|
2041
|
-
type: '
|
|
2077
|
+
type: 'TSJSDocNullableType',
|
|
2042
2078
|
start: deserializeU32(pos),
|
|
2043
2079
|
end: deserializeU32(pos + 4),
|
|
2044
2080
|
typeAnnotation: deserializeTSType(pos + 8),
|
|
@@ -2048,7 +2084,7 @@ function deserializeJSDocNullableType(pos) {
|
|
|
2048
2084
|
|
|
2049
2085
|
function deserializeJSDocNonNullableType(pos) {
|
|
2050
2086
|
return {
|
|
2051
|
-
type: '
|
|
2087
|
+
type: 'TSJSDocNonNullableType',
|
|
2052
2088
|
start: deserializeU32(pos),
|
|
2053
2089
|
end: deserializeU32(pos + 4),
|
|
2054
2090
|
typeAnnotation: deserializeTSType(pos + 8),
|
|
@@ -2058,7 +2094,7 @@ function deserializeJSDocNonNullableType(pos) {
|
|
|
2058
2094
|
|
|
2059
2095
|
function deserializeJSDocUnknownType(pos) {
|
|
2060
2096
|
return {
|
|
2061
|
-
type: '
|
|
2097
|
+
type: 'TSJSDocUnknownType',
|
|
2062
2098
|
start: deserializeU32(pos),
|
|
2063
2099
|
end: deserializeU32(pos + 4),
|
|
2064
2100
|
};
|
|
@@ -3635,6 +3671,10 @@ function deserializeTSEnumMemberName(pos) {
|
|
|
3635
3671
|
return deserializeBoxIdentifierName(pos + 8);
|
|
3636
3672
|
case 1:
|
|
3637
3673
|
return deserializeBoxStringLiteral(pos + 8);
|
|
3674
|
+
case 2:
|
|
3675
|
+
return deserializeBoxStringLiteral(pos + 8);
|
|
3676
|
+
case 3:
|
|
3677
|
+
return deserializeBoxTemplateLiteral(pos + 8);
|
|
3638
3678
|
default:
|
|
3639
3679
|
throw new Error(`Unexpected discriminant ${uint8[pos]} for TSEnumMemberName`);
|
|
3640
3680
|
}
|
|
@@ -3952,18 +3992,8 @@ function deserializeTSTypeQueryExprName(pos) {
|
|
|
3952
3992
|
}
|
|
3953
3993
|
|
|
3954
3994
|
function deserializeTSMappedTypeModifierOperator(pos) {
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
return 'true';
|
|
3958
|
-
case 1:
|
|
3959
|
-
return '+';
|
|
3960
|
-
case 2:
|
|
3961
|
-
return '-';
|
|
3962
|
-
case 3:
|
|
3963
|
-
return 'none';
|
|
3964
|
-
default:
|
|
3965
|
-
throw new Error(`Unexpected discriminant ${uint8[pos]} for TSMappedTypeModifierOperator`);
|
|
3966
|
-
}
|
|
3995
|
+
const operator = deserializeU8(pos);
|
|
3996
|
+
return [true, '+', '-', null][operator];
|
|
3967
3997
|
}
|
|
3968
3998
|
|
|
3969
3999
|
function deserializeTSModuleReference(pos) {
|
|
@@ -4617,11 +4647,6 @@ function deserializeVecArrayExpressionElement(pos) {
|
|
|
4617
4647
|
return arr;
|
|
4618
4648
|
}
|
|
4619
4649
|
|
|
4620
|
-
function deserializeOptionSpan(pos) {
|
|
4621
|
-
if (uint8[pos] === 0) return null;
|
|
4622
|
-
return deserializeSpan(pos + 8);
|
|
4623
|
-
}
|
|
4624
|
-
|
|
4625
4650
|
function deserializeBoxSpreadElement(pos) {
|
|
4626
4651
|
return deserializeSpreadElement(uint32[pos >> 2]);
|
|
4627
4652
|
}
|
|
@@ -5069,11 +5094,6 @@ function deserializeVecTSClassImplements(pos) {
|
|
|
5069
5094
|
return arr;
|
|
5070
5095
|
}
|
|
5071
5096
|
|
|
5072
|
-
function deserializeOptionVecTSClassImplements(pos) {
|
|
5073
|
-
if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
|
|
5074
|
-
return deserializeVecTSClassImplements(pos);
|
|
5075
|
-
}
|
|
5076
|
-
|
|
5077
5097
|
function deserializeBoxClassBody(pos) {
|
|
5078
5098
|
return deserializeClassBody(uint32[pos >> 2]);
|
|
5079
5099
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"browser": "wasm.mjs",
|
|
6
6
|
"engines": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@oxc-project/types": "^0.
|
|
42
|
+
"@oxc-project/types": "^0.64.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@codspeed/vitest-plugin": "^4.0.0",
|
|
@@ -72,16 +72,16 @@
|
|
|
72
72
|
"dtsHeaderFile": "header.js"
|
|
73
73
|
},
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.
|
|
76
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.
|
|
77
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.
|
|
78
|
-
"@oxc-parser/binding-linux-x64-musl": "0.
|
|
79
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.
|
|
80
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.
|
|
81
|
-
"@oxc-parser/binding-linux-arm-gnueabihf": "0.
|
|
82
|
-
"@oxc-parser/binding-darwin-x64": "0.
|
|
83
|
-
"@oxc-parser/binding-darwin-arm64": "0.
|
|
84
|
-
"@oxc-parser/binding-wasm32-wasi": "0.
|
|
75
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.64.0",
|
|
76
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.64.0",
|
|
77
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.64.0",
|
|
78
|
+
"@oxc-parser/binding-linux-x64-musl": "0.64.0",
|
|
79
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.64.0",
|
|
80
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.64.0",
|
|
81
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.64.0",
|
|
82
|
+
"@oxc-parser/binding-darwin-x64": "0.64.0",
|
|
83
|
+
"@oxc-parser/binding-darwin-arm64": "0.64.0",
|
|
84
|
+
"@oxc-parser/binding-wasm32-wasi": "0.64.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build-dev": "napi build --no-dts-cache --platform --js bindings.js",
|