oxc-parser 0.72.2 → 0.72.3

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/bindings.js CHANGED
@@ -383,6 +383,7 @@ if (!nativeBinding) {
383
383
  }
384
384
 
385
385
  module.exports = nativeBinding
386
+ module.exports.Severity = nativeBinding.Severity
386
387
  module.exports.ParseResult = nativeBinding.ParseResult
387
388
  module.exports.ExportExportNameKind = nativeBinding.ExportExportNameKind
388
389
  module.exports.ExportImportNameKind = nativeBinding.ExportImportNameKind
@@ -394,4 +395,3 @@ module.exports.parseAsyncRaw = nativeBinding.parseAsyncRaw
394
395
  module.exports.parseSync = nativeBinding.parseSync
395
396
  module.exports.parseSyncRaw = nativeBinding.parseSyncRaw
396
397
  module.exports.rawTransferSupported = nativeBinding.rawTransferSupported
397
- module.exports.Severity = nativeBinding.Severity
@@ -682,9 +682,7 @@ function deserializeCatchClause(pos) {
682
682
  }
683
683
 
684
684
  function deserializeCatchParameter(pos) {
685
- return {
686
- ...deserializeBindingPatternKind(pos + 8),
687
- };
685
+ return deserializeBindingPattern(pos + 8);
688
686
  }
689
687
 
690
688
  function deserializeDebuggerStatement(pos) {
@@ -696,9 +694,8 @@ function deserializeDebuggerStatement(pos) {
696
694
  }
697
695
 
698
696
  function deserializeBindingPattern(pos) {
699
- return {
700
- ...deserializeBindingPatternKind(pos),
701
- };
697
+ const pattern = deserializeBindingPatternKind(pos);
698
+ return pattern;
702
699
  }
703
700
 
704
701
  function deserializeAssignmentPattern(pos) {
@@ -1637,8 +1634,8 @@ function deserializeTSClassImplements(pos) {
1637
1634
  end: expression.end,
1638
1635
  object: expression.left,
1639
1636
  property: expression.right,
1640
- computed: false,
1641
1637
  optional: false,
1638
+ computed: false,
1642
1639
  };
1643
1640
 
1644
1641
  while (parent.object.type === 'TSQualifiedName') {
@@ -1649,8 +1646,8 @@ function deserializeTSClassImplements(pos) {
1649
1646
  end: object.end,
1650
1647
  object: object.left,
1651
1648
  property: object.right,
1652
- computed: false,
1653
1649
  optional: false,
1650
+ computed: false,
1654
1651
  };
1655
1652
  }
1656
1653
  }
@@ -2140,10 +2137,11 @@ function deserializeRawTransferData(pos) {
2140
2137
 
2141
2138
  function deserializeError(pos) {
2142
2139
  return {
2143
- severity: deserializeErrorSeverity(pos + 56),
2140
+ severity: deserializeErrorSeverity(pos + 72),
2144
2141
  message: deserializeStr(pos),
2145
2142
  labels: deserializeVecErrorLabel(pos + 16),
2146
2143
  helpMessage: deserializeOptionStr(pos + 40),
2144
+ codeframe: deserializeStr(pos + 56),
2147
2145
  };
2148
2146
  }
2149
2147
 
@@ -5405,7 +5403,7 @@ function deserializeVecError(pos) {
5405
5403
  pos = uint32[pos32];
5406
5404
  for (let i = 0; i < len; i++) {
5407
5405
  arr.push(deserializeError(pos));
5408
- pos += 64;
5406
+ pos += 80;
5409
5407
  }
5410
5408
  return arr;
5411
5409
  }
@@ -424,9 +424,9 @@ function deserializeAssignmentTargetPropertyIdentifier(pos) {
424
424
  type: 'AssignmentPattern',
425
425
  start: start,
426
426
  end: end,
427
+ decorators: [],
427
428
  left: keyCopy,
428
429
  right: init,
429
- decorators: [],
430
430
  optional: false,
431
431
  typeAnnotation: null,
432
432
  };
@@ -735,11 +735,7 @@ function deserializeCatchClause(pos) {
735
735
  }
736
736
 
737
737
  function deserializeCatchParameter(pos) {
738
- return {
739
- ...deserializeBindingPatternKind(pos + 8),
740
- typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 24),
741
- optional: deserializeBool(pos + 32),
742
- };
738
+ return deserializeBindingPattern(pos + 8);
743
739
  }
744
740
 
745
741
  function deserializeDebuggerStatement(pos) {
@@ -751,11 +747,10 @@ function deserializeDebuggerStatement(pos) {
751
747
  }
752
748
 
753
749
  function deserializeBindingPattern(pos) {
754
- return {
755
- ...deserializeBindingPatternKind(pos),
756
- typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16),
757
- optional: deserializeBool(pos + 24),
758
- };
750
+ const pattern = deserializeBindingPatternKind(pos);
751
+ pattern.optional = deserializeBool(pos + 24);
752
+ pattern.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 16);
753
+ return pattern;
759
754
  }
760
755
 
761
756
  function deserializeAssignmentPattern(pos) {
@@ -857,8 +852,8 @@ function deserializeFormalParameters(pos) {
857
852
  type: 'RestElement',
858
853
  start: deserializeU32(pos),
859
854
  end: deserializeU32(pos + 4),
860
- argument: deserializeBindingPatternKind(pos + 8),
861
855
  decorators: [],
856
+ argument: deserializeBindingPatternKind(pos + 8),
862
857
  optional: deserializeBool(pos + 32),
863
858
  typeAnnotation: deserializeOptionBoxTSTypeAnnotation(
864
859
  pos + 24,
@@ -875,12 +870,10 @@ function deserializeFormalParameter(pos) {
875
870
  override = deserializeBool(pos + 66);
876
871
  let param;
877
872
  if (accessibility === null && !readonly && !override) {
878
- param = {
879
- ...deserializeBindingPatternKind(pos + 32),
880
- decorators: deserializeVecDecorator(pos + 8),
881
- optional: deserializeBool(pos + 56),
882
- typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 48),
883
- };
873
+ param = deserializeBindingPatternKind(pos + 32);
874
+ param.decorators = deserializeVecDecorator(pos + 8);
875
+ param.optional = deserializeBool(pos + 56);
876
+ param.typeAnnotation = deserializeOptionBoxTSTypeAnnotation(pos + 48);
884
877
  } else {
885
878
  param = {
886
879
  type: 'TSParameterProperty',
@@ -970,8 +963,8 @@ function deserializeMethodDefinition(pos) {
970
963
  type: 'Identifier',
971
964
  start: key.start,
972
965
  end: key.end,
973
- name: 'constructor',
974
966
  decorators: [],
967
+ name: 'constructor',
975
968
  optional: false,
976
969
  typeAnnotation: null,
977
970
  };
@@ -1785,8 +1778,8 @@ function deserializeTSClassImplements(pos) {
1785
1778
  end: expression.end,
1786
1779
  object: expression.left,
1787
1780
  property: expression.right,
1788
- computed: false,
1789
1781
  optional: false,
1782
+ computed: false,
1790
1783
  };
1791
1784
 
1792
1785
  while (parent.object.type === 'TSQualifiedName') {
@@ -1797,8 +1790,8 @@ function deserializeTSClassImplements(pos) {
1797
1790
  end: object.end,
1798
1791
  object: object.left,
1799
1792
  property: object.right,
1800
- computed: false,
1801
1793
  optional: false,
1794
+ computed: false,
1802
1795
  };
1803
1796
  }
1804
1797
  }
@@ -2288,10 +2281,11 @@ function deserializeRawTransferData(pos) {
2288
2281
 
2289
2282
  function deserializeError(pos) {
2290
2283
  return {
2291
- severity: deserializeErrorSeverity(pos + 56),
2284
+ severity: deserializeErrorSeverity(pos + 72),
2292
2285
  message: deserializeStr(pos),
2293
2286
  labels: deserializeVecErrorLabel(pos + 16),
2294
2287
  helpMessage: deserializeOptionStr(pos + 40),
2288
+ codeframe: deserializeStr(pos + 56),
2295
2289
  };
2296
2290
  }
2297
2291
 
@@ -5553,7 +5547,7 @@ function deserializeVecError(pos) {
5553
5547
  pos = uint32[pos32];
5554
5548
  for (let i = 0; i < len; i++) {
5555
5549
  arr.push(deserializeError(pos));
5556
- pos += 64;
5550
+ pos += 80;
5557
5551
  }
5558
5552
  return arr;
5559
5553
  }
package/index.d.ts CHANGED
@@ -2,13 +2,6 @@
2
2
  /* eslint-disable */
3
3
 
4
4
  export * from '@oxc-project/types';
5
- export declare class ParseResult {
6
- get program(): import("@oxc-project/types").Program
7
- get module(): EcmaScriptModule
8
- get comments(): Array<Comment>
9
- get errors(): Array<OxcError>
10
- }
11
-
12
5
  export interface Comment {
13
6
  type: 'Line' | 'Block'
14
7
  value: string
@@ -16,6 +9,32 @@ export interface Comment {
16
9
  end: number
17
10
  }
18
11
 
12
+ export interface ErrorLabel {
13
+ message?: string
14
+ start: number
15
+ end: number
16
+ }
17
+
18
+ export interface OxcError {
19
+ severity: Severity
20
+ message: string
21
+ labels: Array<ErrorLabel>
22
+ helpMessage?: string
23
+ codeframe?: string
24
+ }
25
+
26
+ export declare const enum Severity {
27
+ Error = 'Error',
28
+ Warning = 'Warning',
29
+ Advice = 'Advice'
30
+ }
31
+ export declare class ParseResult {
32
+ get program(): import("@oxc-project/types").Program
33
+ get module(): EcmaScriptModule
34
+ get comments(): Array<Comment>
35
+ get errors(): Array<OxcError>
36
+ }
37
+
19
38
  export interface DynamicImport {
20
39
  start: number
21
40
  end: number
@@ -41,12 +60,6 @@ export interface EcmaScriptModule {
41
60
  importMetas: Array<Span>
42
61
  }
43
62
 
44
- export interface ErrorLabel {
45
- message?: string
46
- start: number
47
- end: number
48
- }
49
-
50
63
  export interface ExportExportName {
51
64
  kind: ExportExportNameKind
52
65
  name?: string
@@ -124,14 +137,6 @@ export declare const enum ImportNameKind {
124
137
  Default = 'Default'
125
138
  }
126
139
 
127
- export interface OxcError {
128
- severity: Severity
129
- message: string
130
- labels: Array<ErrorLabel>
131
- helpMessage?: string
132
- codeframe?: string
133
- }
134
-
135
140
  /**
136
141
  * Parse asynchronously.
137
142
  *
@@ -238,12 +243,6 @@ export declare function parseSyncRaw(filename: string, buffer: Uint8Array, sourc
238
243
  /** Returns `true` if raw transfer is supported on this platform. */
239
244
  export declare function rawTransferSupported(): boolean
240
245
 
241
- export declare const enum Severity {
242
- Error = 'Error',
243
- Warning = 'Warning',
244
- Advice = 'Advice'
245
- }
246
-
247
246
  export interface Span {
248
247
  start: number
249
248
  end: number
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oxc-parser",
3
- "version": "0.72.2",
3
+ "version": "0.72.3",
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.72.2"
42
+ "@oxc-project/types": "^0.72.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@codspeed/vitest-plugin": "^4.0.0",
@@ -77,20 +77,20 @@
77
77
  "dtsHeaderFile": "header.js"
78
78
  },
79
79
  "optionalDependencies": {
80
- "@oxc-parser/binding-win32-x64-msvc": "0.72.2",
81
- "@oxc-parser/binding-win32-arm64-msvc": "0.72.2",
82
- "@oxc-parser/binding-linux-x64-gnu": "0.72.2",
83
- "@oxc-parser/binding-linux-x64-musl": "0.72.2",
84
- "@oxc-parser/binding-freebsd-x64": "0.72.2",
85
- "@oxc-parser/binding-linux-arm64-gnu": "0.72.2",
86
- "@oxc-parser/binding-linux-arm64-musl": "0.72.2",
87
- "@oxc-parser/binding-linux-arm-gnueabihf": "0.72.2",
88
- "@oxc-parser/binding-linux-arm-musleabihf": "0.72.2",
89
- "@oxc-parser/binding-linux-s390x-gnu": "0.72.2",
90
- "@oxc-parser/binding-linux-riscv64-gnu": "0.72.2",
91
- "@oxc-parser/binding-darwin-x64": "0.72.2",
92
- "@oxc-parser/binding-darwin-arm64": "0.72.2",
93
- "@oxc-parser/binding-wasm32-wasi": "0.72.2"
80
+ "@oxc-parser/binding-win32-x64-msvc": "0.72.3",
81
+ "@oxc-parser/binding-win32-arm64-msvc": "0.72.3",
82
+ "@oxc-parser/binding-linux-x64-gnu": "0.72.3",
83
+ "@oxc-parser/binding-linux-x64-musl": "0.72.3",
84
+ "@oxc-parser/binding-freebsd-x64": "0.72.3",
85
+ "@oxc-parser/binding-linux-arm64-gnu": "0.72.3",
86
+ "@oxc-parser/binding-linux-arm64-musl": "0.72.3",
87
+ "@oxc-parser/binding-linux-arm-gnueabihf": "0.72.3",
88
+ "@oxc-parser/binding-linux-arm-musleabihf": "0.72.3",
89
+ "@oxc-parser/binding-linux-s390x-gnu": "0.72.3",
90
+ "@oxc-parser/binding-linux-riscv64-gnu": "0.72.3",
91
+ "@oxc-parser/binding-darwin-x64": "0.72.3",
92
+ "@oxc-parser/binding-darwin-arm64": "0.72.3",
93
+ "@oxc-parser/binding-wasm32-wasi": "0.72.3"
94
94
  },
95
95
  "scripts": {
96
96
  "build-dev": "napi build --platform --js bindings.js",