oxc-parser 0.64.0 → 0.66.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 +17 -20
- package/deserialize-ts.js +66 -25
- package/index.d.ts +14 -0
- package/package.json +14 -14
package/deserialize-js.js
CHANGED
|
@@ -788,9 +788,7 @@ function deserializeFormalParameters(pos) {
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
function deserializeFormalParameter(pos) {
|
|
791
|
-
return
|
|
792
|
-
...deserializeBindingPatternKind(pos + 40),
|
|
793
|
-
};
|
|
791
|
+
return deserializeBindingPatternKind(pos + 40);
|
|
794
792
|
}
|
|
795
793
|
|
|
796
794
|
function deserializeFunctionBody(pos) {
|
|
@@ -1634,14 +1632,13 @@ function deserializeTSClassImplements(pos) {
|
|
|
1634
1632
|
}
|
|
1635
1633
|
|
|
1636
1634
|
function deserializeTSInterfaceDeclaration(pos) {
|
|
1637
|
-
const extendsArr = deserializeOptionVecTSInterfaceHeritage(pos + 40);
|
|
1638
1635
|
return {
|
|
1639
1636
|
type: 'TSInterfaceDeclaration',
|
|
1640
1637
|
start: deserializeU32(pos),
|
|
1641
1638
|
end: deserializeU32(pos + 4),
|
|
1642
1639
|
id: deserializeBindingIdentifier(pos + 8),
|
|
1643
|
-
|
|
1644
|
-
|
|
1640
|
+
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40),
|
|
1641
|
+
extends: deserializeVecTSInterfaceHeritage(pos + 48),
|
|
1645
1642
|
body: deserializeBoxTSInterfaceBody(pos + 80),
|
|
1646
1643
|
declare: deserializeBool(pos + 88),
|
|
1647
1644
|
};
|
|
@@ -1685,17 +1682,23 @@ function deserializeTSIndexSignature(pos) {
|
|
|
1685
1682
|
}
|
|
1686
1683
|
|
|
1687
1684
|
function deserializeTSCallSignatureDeclaration(pos) {
|
|
1685
|
+
const params = deserializeBoxFormalParameters(pos + 24);
|
|
1686
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
|
|
1687
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1688
1688
|
return {
|
|
1689
1689
|
type: 'TSCallSignatureDeclaration',
|
|
1690
1690
|
start: deserializeU32(pos),
|
|
1691
1691
|
end: deserializeU32(pos + 4),
|
|
1692
1692
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1693
|
-
params
|
|
1694
|
-
returnType: deserializeOptionBoxTSTypeAnnotation(pos +
|
|
1693
|
+
params,
|
|
1694
|
+
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32),
|
|
1695
1695
|
};
|
|
1696
1696
|
}
|
|
1697
1697
|
|
|
1698
1698
|
function deserializeTSMethodSignature(pos) {
|
|
1699
|
+
const params = deserializeBoxFormalParameters(pos + 48);
|
|
1700
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 40);
|
|
1701
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1699
1702
|
return {
|
|
1700
1703
|
type: 'TSMethodSignature',
|
|
1701
1704
|
start: deserializeU32(pos),
|
|
@@ -1705,7 +1708,7 @@ function deserializeTSMethodSignature(pos) {
|
|
|
1705
1708
|
optional: deserializeBool(pos + 25),
|
|
1706
1709
|
kind: deserializeTSMethodSignatureKind(pos + 26),
|
|
1707
1710
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 32),
|
|
1708
|
-
params
|
|
1711
|
+
params,
|
|
1709
1712
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
1710
1713
|
accessibility: null,
|
|
1711
1714
|
readonly: false,
|
|
@@ -1823,12 +1826,15 @@ function deserializeTSImportType(pos) {
|
|
|
1823
1826
|
}
|
|
1824
1827
|
|
|
1825
1828
|
function deserializeTSFunctionType(pos) {
|
|
1829
|
+
const params = deserializeBoxFormalParameters(pos + 24);
|
|
1830
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
|
|
1831
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1826
1832
|
return {
|
|
1827
1833
|
type: 'TSFunctionType',
|
|
1828
1834
|
start: deserializeU32(pos),
|
|
1829
1835
|
end: deserializeU32(pos + 4),
|
|
1830
1836
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1831
|
-
params
|
|
1837
|
+
params,
|
|
1832
1838
|
returnType: deserializeBoxTSTypeAnnotation(pos + 32),
|
|
1833
1839
|
};
|
|
1834
1840
|
}
|
|
@@ -2031,6 +2037,7 @@ function deserializeExportEntry(pos) {
|
|
|
2031
2037
|
importName: deserializeExportImportName(pos + 40),
|
|
2032
2038
|
exportName: deserializeExportExportName(pos + 72),
|
|
2033
2039
|
localName: deserializeExportLocalName(pos + 104),
|
|
2040
|
+
isType: deserializeBool(pos + 136),
|
|
2034
2041
|
};
|
|
2035
2042
|
}
|
|
2036
2043
|
|
|
@@ -5441,11 +5448,6 @@ function deserializeVecTSInterfaceHeritage(pos) {
|
|
|
5441
5448
|
return arr;
|
|
5442
5449
|
}
|
|
5443
5450
|
|
|
5444
|
-
function deserializeOptionVecTSInterfaceHeritage(pos) {
|
|
5445
|
-
if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
|
|
5446
|
-
return deserializeVecTSInterfaceHeritage(pos);
|
|
5447
|
-
}
|
|
5448
|
-
|
|
5449
5451
|
function deserializeBoxTSInterfaceBody(pos) {
|
|
5450
5452
|
return deserializeTSInterfaceBody(uint32[pos >> 2]);
|
|
5451
5453
|
}
|
|
@@ -5490,11 +5492,6 @@ function deserializeVecTSIndexSignatureName(pos) {
|
|
|
5490
5492
|
return arr;
|
|
5491
5493
|
}
|
|
5492
5494
|
|
|
5493
|
-
function deserializeOptionTSThisParameter(pos) {
|
|
5494
|
-
if (uint8[pos] === 0) return null;
|
|
5495
|
-
return deserializeTSThisParameter(pos + 8);
|
|
5496
|
-
}
|
|
5497
|
-
|
|
5498
5495
|
function deserializeOptionTSModuleDeclarationBody(pos) {
|
|
5499
5496
|
if (uint8[pos] === 2) return null;
|
|
5500
5497
|
return deserializeTSModuleDeclarationBody(pos);
|
package/deserialize-ts.js
CHANGED
|
@@ -406,6 +406,9 @@ function deserializeAssignmentTargetWithDefault(pos) {
|
|
|
406
406
|
end: deserializeU32(pos + 4),
|
|
407
407
|
left: deserializeAssignmentTarget(pos + 8),
|
|
408
408
|
right: deserializeExpression(pos + 24),
|
|
409
|
+
decorators: [],
|
|
410
|
+
optional: false,
|
|
411
|
+
typeAnnotation: null,
|
|
409
412
|
};
|
|
410
413
|
}
|
|
411
414
|
|
|
@@ -423,6 +426,9 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
|
423
426
|
end: end,
|
|
424
427
|
left: keyCopy,
|
|
425
428
|
right: init,
|
|
429
|
+
typeAnnotation: null,
|
|
430
|
+
optional: false,
|
|
431
|
+
decorators: [],
|
|
426
432
|
};
|
|
427
433
|
return {
|
|
428
434
|
type: 'Property',
|
|
@@ -760,6 +766,8 @@ function deserializeAssignmentPattern(pos) {
|
|
|
760
766
|
left: deserializeBindingPattern(pos + 8),
|
|
761
767
|
right: deserializeExpression(pos + 40),
|
|
762
768
|
decorators: [],
|
|
769
|
+
optional: false,
|
|
770
|
+
typeAnnotation: null,
|
|
763
771
|
};
|
|
764
772
|
}
|
|
765
773
|
|
|
@@ -852,18 +860,39 @@ function deserializeFormalParameters(pos) {
|
|
|
852
860
|
pos + 24,
|
|
853
861
|
),
|
|
854
862
|
optional: deserializeBool(pos + 32),
|
|
863
|
+
decorators: [],
|
|
864
|
+
value: null,
|
|
855
865
|
});
|
|
856
866
|
}
|
|
857
867
|
return params;
|
|
858
868
|
}
|
|
859
869
|
|
|
860
870
|
function deserializeFormalParameter(pos) {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
871
|
+
const accessibility = deserializeOptionTSAccessibility(pos + 72),
|
|
872
|
+
readonly = deserializeBool(pos + 73),
|
|
873
|
+
override = deserializeBool(pos + 74);
|
|
874
|
+
let param;
|
|
875
|
+
if (accessibility === null && !readonly && !override) {
|
|
876
|
+
param = {
|
|
877
|
+
...deserializeBindingPatternKind(pos + 40),
|
|
878
|
+
typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
879
|
+
optional: deserializeBool(pos + 64),
|
|
880
|
+
decorators: deserializeVecDecorator(pos + 8),
|
|
881
|
+
};
|
|
882
|
+
} else {
|
|
883
|
+
param = {
|
|
884
|
+
type: 'TSParameterProperty',
|
|
885
|
+
start: deserializeU32(pos),
|
|
886
|
+
end: deserializeU32(pos + 4),
|
|
887
|
+
accessibility,
|
|
888
|
+
decorators: deserializeVecDecorator(pos + 8),
|
|
889
|
+
override,
|
|
890
|
+
parameter: deserializeBindingPattern(pos + 40),
|
|
891
|
+
readonly,
|
|
892
|
+
static: false,
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
return param;
|
|
867
896
|
}
|
|
868
897
|
|
|
869
898
|
function deserializeFunctionBody(pos) {
|
|
@@ -932,14 +961,27 @@ function deserializeClassBody(pos) {
|
|
|
932
961
|
}
|
|
933
962
|
|
|
934
963
|
function deserializeMethodDefinition(pos) {
|
|
964
|
+
const kind = deserializeMethodDefinitionKind(pos + 72);
|
|
965
|
+
let key = deserializePropertyKey(pos + 48);
|
|
966
|
+
if (kind === 'constructor') {
|
|
967
|
+
key = {
|
|
968
|
+
type: 'Identifier',
|
|
969
|
+
start: key.start,
|
|
970
|
+
end: key.end,
|
|
971
|
+
name: 'constructor',
|
|
972
|
+
decorators: [],
|
|
973
|
+
optional: false,
|
|
974
|
+
typeAnnotation: null,
|
|
975
|
+
};
|
|
976
|
+
}
|
|
935
977
|
return {
|
|
936
978
|
type: deserializeMethodDefinitionType(pos + 8),
|
|
937
979
|
start: deserializeU32(pos),
|
|
938
980
|
end: deserializeU32(pos + 4),
|
|
939
981
|
static: deserializeBool(pos + 74),
|
|
940
982
|
computed: deserializeBool(pos + 73),
|
|
941
|
-
key
|
|
942
|
-
kind
|
|
983
|
+
key,
|
|
984
|
+
kind,
|
|
943
985
|
value: deserializeBoxFunction(pos + 64),
|
|
944
986
|
decorators: deserializeVecDecorator(pos + 16),
|
|
945
987
|
override: deserializeBool(pos + 75),
|
|
@@ -1740,14 +1782,13 @@ function deserializeTSClassImplements(pos) {
|
|
|
1740
1782
|
}
|
|
1741
1783
|
|
|
1742
1784
|
function deserializeTSInterfaceDeclaration(pos) {
|
|
1743
|
-
const extendsArr = deserializeOptionVecTSInterfaceHeritage(pos + 40);
|
|
1744
1785
|
return {
|
|
1745
1786
|
type: 'TSInterfaceDeclaration',
|
|
1746
1787
|
start: deserializeU32(pos),
|
|
1747
1788
|
end: deserializeU32(pos + 4),
|
|
1748
1789
|
id: deserializeBindingIdentifier(pos + 8),
|
|
1749
|
-
|
|
1750
|
-
|
|
1790
|
+
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40),
|
|
1791
|
+
extends: deserializeVecTSInterfaceHeritage(pos + 48),
|
|
1751
1792
|
body: deserializeBoxTSInterfaceBody(pos + 80),
|
|
1752
1793
|
declare: deserializeBool(pos + 88),
|
|
1753
1794
|
};
|
|
@@ -1791,17 +1832,23 @@ function deserializeTSIndexSignature(pos) {
|
|
|
1791
1832
|
}
|
|
1792
1833
|
|
|
1793
1834
|
function deserializeTSCallSignatureDeclaration(pos) {
|
|
1835
|
+
const params = deserializeBoxFormalParameters(pos + 24);
|
|
1836
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
|
|
1837
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1794
1838
|
return {
|
|
1795
1839
|
type: 'TSCallSignatureDeclaration',
|
|
1796
1840
|
start: deserializeU32(pos),
|
|
1797
1841
|
end: deserializeU32(pos + 4),
|
|
1798
1842
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1799
|
-
params
|
|
1800
|
-
returnType: deserializeOptionBoxTSTypeAnnotation(pos +
|
|
1843
|
+
params,
|
|
1844
|
+
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32),
|
|
1801
1845
|
};
|
|
1802
1846
|
}
|
|
1803
1847
|
|
|
1804
1848
|
function deserializeTSMethodSignature(pos) {
|
|
1849
|
+
const params = deserializeBoxFormalParameters(pos + 48);
|
|
1850
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 40);
|
|
1851
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1805
1852
|
return {
|
|
1806
1853
|
type: 'TSMethodSignature',
|
|
1807
1854
|
start: deserializeU32(pos),
|
|
@@ -1811,7 +1858,7 @@ function deserializeTSMethodSignature(pos) {
|
|
|
1811
1858
|
optional: deserializeBool(pos + 25),
|
|
1812
1859
|
kind: deserializeTSMethodSignatureKind(pos + 26),
|
|
1813
1860
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 32),
|
|
1814
|
-
params
|
|
1861
|
+
params,
|
|
1815
1862
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
1816
1863
|
accessibility: null,
|
|
1817
1864
|
readonly: false,
|
|
@@ -1929,12 +1976,15 @@ function deserializeTSImportType(pos) {
|
|
|
1929
1976
|
}
|
|
1930
1977
|
|
|
1931
1978
|
function deserializeTSFunctionType(pos) {
|
|
1979
|
+
const params = deserializeBoxFormalParameters(pos + 24);
|
|
1980
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
|
|
1981
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
1932
1982
|
return {
|
|
1933
1983
|
type: 'TSFunctionType',
|
|
1934
1984
|
start: deserializeU32(pos),
|
|
1935
1985
|
end: deserializeU32(pos + 4),
|
|
1936
1986
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1937
|
-
params
|
|
1987
|
+
params,
|
|
1938
1988
|
returnType: deserializeBoxTSTypeAnnotation(pos + 32),
|
|
1939
1989
|
};
|
|
1940
1990
|
}
|
|
@@ -2137,6 +2187,7 @@ function deserializeExportEntry(pos) {
|
|
|
2137
2187
|
importName: deserializeExportImportName(pos + 40),
|
|
2138
2188
|
exportName: deserializeExportExportName(pos + 72),
|
|
2139
2189
|
localName: deserializeExportLocalName(pos + 104),
|
|
2190
|
+
isType: deserializeBool(pos + 136),
|
|
2140
2191
|
};
|
|
2141
2192
|
}
|
|
2142
2193
|
|
|
@@ -5547,11 +5598,6 @@ function deserializeVecTSInterfaceHeritage(pos) {
|
|
|
5547
5598
|
return arr;
|
|
5548
5599
|
}
|
|
5549
5600
|
|
|
5550
|
-
function deserializeOptionVecTSInterfaceHeritage(pos) {
|
|
5551
|
-
if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
|
|
5552
|
-
return deserializeVecTSInterfaceHeritage(pos);
|
|
5553
|
-
}
|
|
5554
|
-
|
|
5555
5601
|
function deserializeBoxTSInterfaceBody(pos) {
|
|
5556
5602
|
return deserializeTSInterfaceBody(uint32[pos >> 2]);
|
|
5557
5603
|
}
|
|
@@ -5596,11 +5642,6 @@ function deserializeVecTSIndexSignatureName(pos) {
|
|
|
5596
5642
|
return arr;
|
|
5597
5643
|
}
|
|
5598
5644
|
|
|
5599
|
-
function deserializeOptionTSThisParameter(pos) {
|
|
5600
|
-
if (uint8[pos] === 0) return null;
|
|
5601
|
-
return deserializeTSThisParameter(pos + 8);
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
5645
|
function deserializeOptionTSModuleDeclarationBody(pos) {
|
|
5605
5646
|
if (uint8[pos] === 2) return null;
|
|
5606
5647
|
return deserializeTSModuleDeclarationBody(pos);
|
package/index.d.ts
CHANGED
|
@@ -232,6 +232,20 @@ export interface StaticExportEntry {
|
|
|
232
232
|
exportName: ExportExportName
|
|
233
233
|
/** The name that is used to locally access the exported value from within the importing module. */
|
|
234
234
|
localName: ExportLocalName
|
|
235
|
+
/**
|
|
236
|
+
* Whether the export is a TypeScript `export type`.
|
|
237
|
+
*
|
|
238
|
+
* Examples:
|
|
239
|
+
*
|
|
240
|
+
* ```ts
|
|
241
|
+
* export type * from 'mod';
|
|
242
|
+
* export type * as ns from 'mod';
|
|
243
|
+
* export type { foo };
|
|
244
|
+
* export { type foo }:
|
|
245
|
+
* export type { foo } from 'mod';
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
isType: boolean
|
|
235
249
|
}
|
|
236
250
|
|
|
237
251
|
export interface StaticImport {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"browser": "wasm.mjs",
|
|
6
6
|
"engines": {
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@oxc-project/types": "^0.
|
|
42
|
+
"@oxc-project/types": "^0.66.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@codspeed/vitest-plugin": "^4.0.0",
|
|
46
46
|
"@napi-rs/wasm-runtime": "^0.2.7",
|
|
47
|
-
"@vitest/browser": "3.1.
|
|
47
|
+
"@vitest/browser": "3.1.2",
|
|
48
48
|
"esbuild": "^0.25.0",
|
|
49
49
|
"playwright": "^1.51.0",
|
|
50
|
-
"vitest": "3.1.
|
|
50
|
+
"vitest": "3.1.2"
|
|
51
51
|
},
|
|
52
52
|
"napi": {
|
|
53
53
|
"binaryName": "parser",
|
|
@@ -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.66.0",
|
|
76
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.66.0",
|
|
77
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.66.0",
|
|
78
|
+
"@oxc-parser/binding-linux-x64-musl": "0.66.0",
|
|
79
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.66.0",
|
|
80
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.66.0",
|
|
81
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.66.0",
|
|
82
|
+
"@oxc-parser/binding-darwin-x64": "0.66.0",
|
|
83
|
+
"@oxc-parser/binding-darwin-arm64": "0.66.0",
|
|
84
|
+
"@oxc-parser/binding-wasm32-wasi": "0.66.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"build-dev": "napi build --no-dts-cache --platform --js bindings.js",
|