oxc-parser 0.64.0 → 0.65.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 CHANGED
@@ -1634,14 +1634,13 @@ function deserializeTSClassImplements(pos) {
1634
1634
  }
1635
1635
 
1636
1636
  function deserializeTSInterfaceDeclaration(pos) {
1637
- const extendsArr = deserializeOptionVecTSInterfaceHeritage(pos + 40);
1638
1637
  return {
1639
1638
  type: 'TSInterfaceDeclaration',
1640
1639
  start: deserializeU32(pos),
1641
1640
  end: deserializeU32(pos + 4),
1642
1641
  id: deserializeBindingIdentifier(pos + 8),
1643
- extends: extendsArr === null ? [] : extendsArr,
1644
- typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72),
1642
+ typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40),
1643
+ extends: deserializeVecTSInterfaceHeritage(pos + 48),
1645
1644
  body: deserializeBoxTSInterfaceBody(pos + 80),
1646
1645
  declare: deserializeBool(pos + 88),
1647
1646
  };
@@ -1685,17 +1684,23 @@ function deserializeTSIndexSignature(pos) {
1685
1684
  }
1686
1685
 
1687
1686
  function deserializeTSCallSignatureDeclaration(pos) {
1687
+ const params = deserializeBoxFormalParameters(pos + 48);
1688
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
1689
+ if (thisParam !== null) params.unshift(thisParam);
1688
1690
  return {
1689
1691
  type: 'TSCallSignatureDeclaration',
1690
1692
  start: deserializeU32(pos),
1691
1693
  end: deserializeU32(pos + 4),
1692
1694
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
1693
- params: deserializeBoxFormalParameters(pos + 48),
1695
+ params,
1694
1696
  returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
1695
1697
  };
1696
1698
  }
1697
1699
 
1698
1700
  function deserializeTSMethodSignature(pos) {
1701
+ const params = deserializeBoxFormalParameters(pos + 48);
1702
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 40);
1703
+ if (thisParam !== null) params.unshift(thisParam);
1699
1704
  return {
1700
1705
  type: 'TSMethodSignature',
1701
1706
  start: deserializeU32(pos),
@@ -1705,7 +1710,7 @@ function deserializeTSMethodSignature(pos) {
1705
1710
  optional: deserializeBool(pos + 25),
1706
1711
  kind: deserializeTSMethodSignatureKind(pos + 26),
1707
1712
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 32),
1708
- params: deserializeBoxFormalParameters(pos + 48),
1713
+ params,
1709
1714
  returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
1710
1715
  accessibility: null,
1711
1716
  readonly: false,
@@ -1823,12 +1828,15 @@ function deserializeTSImportType(pos) {
1823
1828
  }
1824
1829
 
1825
1830
  function deserializeTSFunctionType(pos) {
1831
+ const params = deserializeBoxFormalParameters(pos + 24);
1832
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
1833
+ if (thisParam !== null) params.unshift(thisParam);
1826
1834
  return {
1827
1835
  type: 'TSFunctionType',
1828
1836
  start: deserializeU32(pos),
1829
1837
  end: deserializeU32(pos + 4),
1830
1838
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
1831
- params: deserializeBoxFormalParameters(pos + 24),
1839
+ params,
1832
1840
  returnType: deserializeBoxTSTypeAnnotation(pos + 32),
1833
1841
  };
1834
1842
  }
@@ -2031,6 +2039,7 @@ function deserializeExportEntry(pos) {
2031
2039
  importName: deserializeExportImportName(pos + 40),
2032
2040
  exportName: deserializeExportExportName(pos + 72),
2033
2041
  localName: deserializeExportLocalName(pos + 104),
2042
+ isType: deserializeBool(pos + 136),
2034
2043
  };
2035
2044
  }
2036
2045
 
@@ -5441,11 +5450,6 @@ function deserializeVecTSInterfaceHeritage(pos) {
5441
5450
  return arr;
5442
5451
  }
5443
5452
 
5444
- function deserializeOptionVecTSInterfaceHeritage(pos) {
5445
- if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
5446
- return deserializeVecTSInterfaceHeritage(pos);
5447
- }
5448
-
5449
5453
  function deserializeBoxTSInterfaceBody(pos) {
5450
5454
  return deserializeTSInterfaceBody(uint32[pos >> 2]);
5451
5455
  }
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
 
@@ -932,14 +940,27 @@ function deserializeClassBody(pos) {
932
940
  }
933
941
 
934
942
  function deserializeMethodDefinition(pos) {
943
+ const kind = deserializeMethodDefinitionKind(pos + 72);
944
+ let key = deserializePropertyKey(pos + 48);
945
+ if (kind === 'constructor') {
946
+ key = {
947
+ type: 'Identifier',
948
+ start: key.start,
949
+ end: key.end,
950
+ name: 'constructor',
951
+ decorators: [],
952
+ optional: false,
953
+ typeAnnotation: null,
954
+ };
955
+ }
935
956
  return {
936
957
  type: deserializeMethodDefinitionType(pos + 8),
937
958
  start: deserializeU32(pos),
938
959
  end: deserializeU32(pos + 4),
939
960
  static: deserializeBool(pos + 74),
940
961
  computed: deserializeBool(pos + 73),
941
- key: deserializePropertyKey(pos + 48),
942
- kind: deserializeMethodDefinitionKind(pos + 72),
962
+ key,
963
+ kind,
943
964
  value: deserializeBoxFunction(pos + 64),
944
965
  decorators: deserializeVecDecorator(pos + 16),
945
966
  override: deserializeBool(pos + 75),
@@ -1740,14 +1761,13 @@ function deserializeTSClassImplements(pos) {
1740
1761
  }
1741
1762
 
1742
1763
  function deserializeTSInterfaceDeclaration(pos) {
1743
- const extendsArr = deserializeOptionVecTSInterfaceHeritage(pos + 40);
1744
1764
  return {
1745
1765
  type: 'TSInterfaceDeclaration',
1746
1766
  start: deserializeU32(pos),
1747
1767
  end: deserializeU32(pos + 4),
1748
1768
  id: deserializeBindingIdentifier(pos + 8),
1749
- extends: extendsArr === null ? [] : extendsArr,
1750
- typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 72),
1769
+ typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 40),
1770
+ extends: deserializeVecTSInterfaceHeritage(pos + 48),
1751
1771
  body: deserializeBoxTSInterfaceBody(pos + 80),
1752
1772
  declare: deserializeBool(pos + 88),
1753
1773
  };
@@ -1791,17 +1811,23 @@ function deserializeTSIndexSignature(pos) {
1791
1811
  }
1792
1812
 
1793
1813
  function deserializeTSCallSignatureDeclaration(pos) {
1814
+ const params = deserializeBoxFormalParameters(pos + 48);
1815
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
1816
+ if (thisParam !== null) params.unshift(thisParam);
1794
1817
  return {
1795
1818
  type: 'TSCallSignatureDeclaration',
1796
1819
  start: deserializeU32(pos),
1797
1820
  end: deserializeU32(pos + 4),
1798
1821
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
1799
- params: deserializeBoxFormalParameters(pos + 48),
1822
+ params,
1800
1823
  returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
1801
1824
  };
1802
1825
  }
1803
1826
 
1804
1827
  function deserializeTSMethodSignature(pos) {
1828
+ const params = deserializeBoxFormalParameters(pos + 48);
1829
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 40);
1830
+ if (thisParam !== null) params.unshift(thisParam);
1805
1831
  return {
1806
1832
  type: 'TSMethodSignature',
1807
1833
  start: deserializeU32(pos),
@@ -1811,7 +1837,7 @@ function deserializeTSMethodSignature(pos) {
1811
1837
  optional: deserializeBool(pos + 25),
1812
1838
  kind: deserializeTSMethodSignatureKind(pos + 26),
1813
1839
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 32),
1814
- params: deserializeBoxFormalParameters(pos + 48),
1840
+ params,
1815
1841
  returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
1816
1842
  accessibility: null,
1817
1843
  readonly: false,
@@ -1929,12 +1955,15 @@ function deserializeTSImportType(pos) {
1929
1955
  }
1930
1956
 
1931
1957
  function deserializeTSFunctionType(pos) {
1958
+ const params = deserializeBoxFormalParameters(pos + 24);
1959
+ const thisParam = deserializeOptionBoxTSThisParameter(pos + 16);
1960
+ if (thisParam !== null) params.unshift(thisParam);
1932
1961
  return {
1933
1962
  type: 'TSFunctionType',
1934
1963
  start: deserializeU32(pos),
1935
1964
  end: deserializeU32(pos + 4),
1936
1965
  typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
1937
- params: deserializeBoxFormalParameters(pos + 24),
1966
+ params,
1938
1967
  returnType: deserializeBoxTSTypeAnnotation(pos + 32),
1939
1968
  };
1940
1969
  }
@@ -2137,6 +2166,7 @@ function deserializeExportEntry(pos) {
2137
2166
  importName: deserializeExportImportName(pos + 40),
2138
2167
  exportName: deserializeExportExportName(pos + 72),
2139
2168
  localName: deserializeExportLocalName(pos + 104),
2169
+ isType: deserializeBool(pos + 136),
2140
2170
  };
2141
2171
  }
2142
2172
 
@@ -5547,11 +5577,6 @@ function deserializeVecTSInterfaceHeritage(pos) {
5547
5577
  return arr;
5548
5578
  }
5549
5579
 
5550
- function deserializeOptionVecTSInterfaceHeritage(pos) {
5551
- if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
5552
- return deserializeVecTSInterfaceHeritage(pos);
5553
- }
5554
-
5555
5580
  function deserializeBoxTSInterfaceBody(pos) {
5556
5581
  return deserializeTSInterfaceBody(uint32[pos >> 2]);
5557
5582
  }
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.64.0",
3
+ "version": "0.65.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.64.0"
42
+ "@oxc-project/types": "^0.65.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.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"
75
+ "@oxc-parser/binding-win32-x64-msvc": "0.65.0",
76
+ "@oxc-parser/binding-win32-arm64-msvc": "0.65.0",
77
+ "@oxc-parser/binding-linux-x64-gnu": "0.65.0",
78
+ "@oxc-parser/binding-linux-x64-musl": "0.65.0",
79
+ "@oxc-parser/binding-linux-arm64-gnu": "0.65.0",
80
+ "@oxc-parser/binding-linux-arm64-musl": "0.65.0",
81
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.65.0",
82
+ "@oxc-parser/binding-darwin-x64": "0.65.0",
83
+ "@oxc-parser/binding-darwin-arm64": "0.65.0",
84
+ "@oxc-parser/binding-wasm32-wasi": "0.65.0"
85
85
  },
86
86
  "scripts": {
87
87
  "build-dev": "napi build --no-dts-cache --platform --js bindings.js",