oxc-parser 0.61.0 → 0.61.2
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 +23 -15
- package/deserialize-ts.js +35 -19
- package/package.json +14 -12
package/deserialize-js.js
CHANGED
|
@@ -361,25 +361,28 @@ function deserializeAssignmentTargetWithDefault(pos) {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
364
|
+
const start = deserializeU32(pos),
|
|
365
|
+
end = deserializeU32(pos + 4),
|
|
366
|
+
key = deserializeIdentifierReference(pos + 8);
|
|
364
367
|
const init = deserializeOptionExpression(pos + 40),
|
|
365
|
-
|
|
368
|
+
keyCopy = { ...key },
|
|
366
369
|
value = init === null
|
|
367
|
-
?
|
|
370
|
+
? keyCopy
|
|
368
371
|
: {
|
|
369
372
|
type: 'AssignmentPattern',
|
|
370
|
-
start:
|
|
371
|
-
end:
|
|
372
|
-
left:
|
|
373
|
+
start: start,
|
|
374
|
+
end: end,
|
|
375
|
+
left: keyCopy,
|
|
373
376
|
right: init,
|
|
374
377
|
};
|
|
375
378
|
return {
|
|
376
379
|
type: 'Property',
|
|
377
|
-
start
|
|
378
|
-
end
|
|
380
|
+
start,
|
|
381
|
+
end,
|
|
379
382
|
method: false,
|
|
380
383
|
shorthand: true,
|
|
381
384
|
computed: false,
|
|
382
|
-
key
|
|
385
|
+
key,
|
|
383
386
|
value,
|
|
384
387
|
kind: 'init',
|
|
385
388
|
};
|
|
@@ -749,6 +752,7 @@ function deserializeBindingRestElement(pos) {
|
|
|
749
752
|
}
|
|
750
753
|
|
|
751
754
|
function deserializeFunction(pos) {
|
|
755
|
+
const params = deserializeBoxFormalParameters(pos + 72);
|
|
752
756
|
return {
|
|
753
757
|
type: deserializeFunctionType(pos + 8),
|
|
754
758
|
start: deserializeU32(pos),
|
|
@@ -757,7 +761,7 @@ function deserializeFunction(pos) {
|
|
|
757
761
|
expression: false,
|
|
758
762
|
generator: deserializeBool(pos + 48),
|
|
759
763
|
async: deserializeBool(pos + 49),
|
|
760
|
-
params
|
|
764
|
+
params,
|
|
761
765
|
body: deserializeOptionBoxFunctionBody(pos + 88),
|
|
762
766
|
};
|
|
763
767
|
}
|
|
@@ -794,17 +798,18 @@ function deserializeFunctionBody(pos) {
|
|
|
794
798
|
}
|
|
795
799
|
|
|
796
800
|
function deserializeArrowFunctionExpression(pos) {
|
|
801
|
+
const expression = deserializeBool(pos + 8);
|
|
797
802
|
let body = deserializeBoxFunctionBody(pos + 40);
|
|
798
803
|
return {
|
|
799
804
|
type: 'ArrowFunctionExpression',
|
|
800
805
|
start: deserializeU32(pos),
|
|
801
806
|
end: deserializeU32(pos + 4),
|
|
802
807
|
id: null,
|
|
803
|
-
expression
|
|
808
|
+
expression,
|
|
804
809
|
generator: false,
|
|
805
810
|
async: deserializeBool(pos + 9),
|
|
806
811
|
params: deserializeBoxFormalParameters(pos + 24),
|
|
807
|
-
body:
|
|
812
|
+
body: expression ? body.body[0].expression : body,
|
|
808
813
|
};
|
|
809
814
|
}
|
|
810
815
|
|
|
@@ -1262,10 +1267,13 @@ function deserializeJSXText(pos) {
|
|
|
1262
1267
|
|
|
1263
1268
|
function deserializeTSThisParameter(pos) {
|
|
1264
1269
|
return {
|
|
1265
|
-
type: '
|
|
1270
|
+
type: 'Identifier',
|
|
1266
1271
|
start: deserializeU32(pos),
|
|
1267
1272
|
end: deserializeU32(pos + 4),
|
|
1273
|
+
name: 'this',
|
|
1268
1274
|
typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16),
|
|
1275
|
+
decorators: [],
|
|
1276
|
+
optional: false,
|
|
1269
1277
|
};
|
|
1270
1278
|
}
|
|
1271
1279
|
|
|
@@ -1654,7 +1662,6 @@ function deserializeTSCallSignatureDeclaration(pos) {
|
|
|
1654
1662
|
start: deserializeU32(pos),
|
|
1655
1663
|
end: deserializeU32(pos + 4),
|
|
1656
1664
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1657
|
-
thisParam: deserializeOptionTSThisParameter(pos + 16),
|
|
1658
1665
|
params: deserializeBoxFormalParameters(pos + 48),
|
|
1659
1666
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
1660
1667
|
};
|
|
@@ -1719,14 +1726,16 @@ function deserializeTSTypePredicate(pos) {
|
|
|
1719
1726
|
}
|
|
1720
1727
|
|
|
1721
1728
|
function deserializeTSModuleDeclaration(pos) {
|
|
1729
|
+
const kind = deserializeTSModuleDeclarationKind(pos + 80);
|
|
1722
1730
|
return {
|
|
1723
1731
|
type: 'TSModuleDeclaration',
|
|
1724
1732
|
start: deserializeU32(pos),
|
|
1725
1733
|
end: deserializeU32(pos + 4),
|
|
1726
1734
|
id: deserializeTSModuleDeclarationName(pos + 8),
|
|
1727
1735
|
body: deserializeOptionTSModuleDeclarationBody(pos + 64),
|
|
1728
|
-
kind
|
|
1736
|
+
kind,
|
|
1729
1737
|
declare: deserializeBool(pos + 81),
|
|
1738
|
+
global: kind === 'global',
|
|
1730
1739
|
};
|
|
1731
1740
|
}
|
|
1732
1741
|
|
|
@@ -1788,7 +1797,6 @@ function deserializeTSFunctionType(pos) {
|
|
|
1788
1797
|
start: deserializeU32(pos),
|
|
1789
1798
|
end: deserializeU32(pos + 4),
|
|
1790
1799
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1791
|
-
thisParam: deserializeOptionBoxTSThisParameter(pos + 16),
|
|
1792
1800
|
params: deserializeBoxFormalParameters(pos + 24),
|
|
1793
1801
|
returnType: deserializeBoxTSTypeAnnotation(pos + 32),
|
|
1794
1802
|
};
|
package/deserialize-ts.js
CHANGED
|
@@ -77,6 +77,9 @@ function deserializeBindingIdentifier(pos) {
|
|
|
77
77
|
start: deserializeU32(pos),
|
|
78
78
|
end: deserializeU32(pos + 4),
|
|
79
79
|
name: deserializeStr(pos + 8),
|
|
80
|
+
decorators: [],
|
|
81
|
+
optional: false,
|
|
82
|
+
typeAnnotation: null,
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
85
|
|
|
@@ -370,25 +373,28 @@ function deserializeAssignmentTargetWithDefault(pos) {
|
|
|
370
373
|
}
|
|
371
374
|
|
|
372
375
|
function deserializeAssignmentTargetPropertyIdentifier(pos) {
|
|
376
|
+
const start = deserializeU32(pos),
|
|
377
|
+
end = deserializeU32(pos + 4),
|
|
378
|
+
key = deserializeIdentifierReference(pos + 8);
|
|
373
379
|
const init = deserializeOptionExpression(pos + 40),
|
|
374
|
-
|
|
380
|
+
keyCopy = { ...key },
|
|
375
381
|
value = init === null
|
|
376
|
-
?
|
|
382
|
+
? keyCopy
|
|
377
383
|
: {
|
|
378
384
|
type: 'AssignmentPattern',
|
|
379
|
-
start:
|
|
380
|
-
end:
|
|
381
|
-
left:
|
|
385
|
+
start: start,
|
|
386
|
+
end: end,
|
|
387
|
+
left: keyCopy,
|
|
382
388
|
right: init,
|
|
383
389
|
};
|
|
384
390
|
return {
|
|
385
391
|
type: 'Property',
|
|
386
|
-
start
|
|
387
|
-
end
|
|
392
|
+
start,
|
|
393
|
+
end,
|
|
388
394
|
method: false,
|
|
389
395
|
shorthand: true,
|
|
390
396
|
computed: false,
|
|
391
|
-
key
|
|
397
|
+
key,
|
|
392
398
|
value,
|
|
393
399
|
kind: 'init',
|
|
394
400
|
};
|
|
@@ -714,6 +720,7 @@ function deserializeAssignmentPattern(pos) {
|
|
|
714
720
|
end: deserializeU32(pos + 4),
|
|
715
721
|
left: deserializeBindingPattern(pos + 8),
|
|
716
722
|
right: deserializeExpression(pos + 40),
|
|
723
|
+
decorators: [],
|
|
717
724
|
};
|
|
718
725
|
}
|
|
719
726
|
|
|
@@ -752,6 +759,9 @@ function deserializeArrayPattern(pos) {
|
|
|
752
759
|
start: deserializeU32(pos),
|
|
753
760
|
end: deserializeU32(pos + 4),
|
|
754
761
|
elements,
|
|
762
|
+
decorators: [],
|
|
763
|
+
optional: false,
|
|
764
|
+
typeAnnotation: null,
|
|
755
765
|
};
|
|
756
766
|
}
|
|
757
767
|
|
|
@@ -765,6 +775,9 @@ function deserializeBindingRestElement(pos) {
|
|
|
765
775
|
}
|
|
766
776
|
|
|
767
777
|
function deserializeFunction(pos) {
|
|
778
|
+
const params = deserializeBoxFormalParameters(pos + 72);
|
|
779
|
+
const thisParam = deserializeOptionBoxTSThisParameter(pos + 64);
|
|
780
|
+
if (thisParam !== null) params.unshift(thisParam);
|
|
768
781
|
return {
|
|
769
782
|
type: deserializeFunctionType(pos + 8),
|
|
770
783
|
start: deserializeU32(pos),
|
|
@@ -773,11 +786,10 @@ function deserializeFunction(pos) {
|
|
|
773
786
|
expression: false,
|
|
774
787
|
generator: deserializeBool(pos + 48),
|
|
775
788
|
async: deserializeBool(pos + 49),
|
|
776
|
-
params
|
|
789
|
+
params,
|
|
777
790
|
body: deserializeOptionBoxFunctionBody(pos + 88),
|
|
778
791
|
declare: deserializeBool(pos + 50),
|
|
779
792
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 56),
|
|
780
|
-
thisParam: deserializeOptionBoxTSThisParameter(pos + 64),
|
|
781
793
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 80),
|
|
782
794
|
};
|
|
783
795
|
}
|
|
@@ -806,9 +818,6 @@ function deserializeFormalParameter(pos) {
|
|
|
806
818
|
typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
807
819
|
optional: deserializeBool(pos + 64),
|
|
808
820
|
decorators: deserializeVecDecorator(pos + 8),
|
|
809
|
-
accessibility: deserializeOptionTSAccessibility(pos + 72),
|
|
810
|
-
readonly: deserializeBool(pos + 73),
|
|
811
|
-
override: deserializeBool(pos + 74),
|
|
812
821
|
};
|
|
813
822
|
}
|
|
814
823
|
|
|
@@ -824,17 +833,18 @@ function deserializeFunctionBody(pos) {
|
|
|
824
833
|
}
|
|
825
834
|
|
|
826
835
|
function deserializeArrowFunctionExpression(pos) {
|
|
836
|
+
const expression = deserializeBool(pos + 8);
|
|
827
837
|
let body = deserializeBoxFunctionBody(pos + 40);
|
|
828
838
|
return {
|
|
829
839
|
type: 'ArrowFunctionExpression',
|
|
830
840
|
start: deserializeU32(pos),
|
|
831
841
|
end: deserializeU32(pos + 4),
|
|
832
842
|
id: null,
|
|
833
|
-
expression
|
|
843
|
+
expression,
|
|
834
844
|
generator: false,
|
|
835
845
|
async: deserializeBool(pos + 9),
|
|
836
846
|
params: deserializeBoxFormalParameters(pos + 24),
|
|
837
|
-
body:
|
|
847
|
+
body: expression ? body.body[0].expression : body,
|
|
838
848
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 16),
|
|
839
849
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 32),
|
|
840
850
|
};
|
|
@@ -1323,10 +1333,13 @@ function deserializeJSXText(pos) {
|
|
|
1323
1333
|
|
|
1324
1334
|
function deserializeTSThisParameter(pos) {
|
|
1325
1335
|
return {
|
|
1326
|
-
type: '
|
|
1336
|
+
type: 'Identifier',
|
|
1327
1337
|
start: deserializeU32(pos),
|
|
1328
1338
|
end: deserializeU32(pos + 4),
|
|
1339
|
+
name: 'this',
|
|
1329
1340
|
typeAnnotation: deserializeOptionBoxTSTypeAnnotation(pos + 16),
|
|
1341
|
+
decorators: [],
|
|
1342
|
+
optional: false,
|
|
1330
1343
|
};
|
|
1331
1344
|
}
|
|
1332
1345
|
|
|
@@ -1706,6 +1719,7 @@ function deserializeTSIndexSignature(pos) {
|
|
|
1706
1719
|
typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 40),
|
|
1707
1720
|
readonly: deserializeBool(pos + 48),
|
|
1708
1721
|
static: deserializeBool(pos + 49),
|
|
1722
|
+
accessibility: null,
|
|
1709
1723
|
};
|
|
1710
1724
|
}
|
|
1711
1725
|
|
|
@@ -1715,7 +1729,6 @@ function deserializeTSCallSignatureDeclaration(pos) {
|
|
|
1715
1729
|
start: deserializeU32(pos),
|
|
1716
1730
|
end: deserializeU32(pos + 4),
|
|
1717
1731
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1718
|
-
thisParam: deserializeOptionTSThisParameter(pos + 16),
|
|
1719
1732
|
params: deserializeBoxFormalParameters(pos + 48),
|
|
1720
1733
|
returnType: deserializeOptionBoxTSTypeAnnotation(pos + 56),
|
|
1721
1734
|
};
|
|
@@ -1755,6 +1768,8 @@ function deserializeTSIndexSignatureName(pos) {
|
|
|
1755
1768
|
end: deserializeU32(pos + 4),
|
|
1756
1769
|
name: deserializeStr(pos + 8),
|
|
1757
1770
|
typeAnnotation: deserializeBoxTSTypeAnnotation(pos + 24),
|
|
1771
|
+
decorators: [],
|
|
1772
|
+
optional: false,
|
|
1758
1773
|
};
|
|
1759
1774
|
}
|
|
1760
1775
|
|
|
@@ -1780,14 +1795,16 @@ function deserializeTSTypePredicate(pos) {
|
|
|
1780
1795
|
}
|
|
1781
1796
|
|
|
1782
1797
|
function deserializeTSModuleDeclaration(pos) {
|
|
1798
|
+
const kind = deserializeTSModuleDeclarationKind(pos + 80);
|
|
1783
1799
|
return {
|
|
1784
1800
|
type: 'TSModuleDeclaration',
|
|
1785
1801
|
start: deserializeU32(pos),
|
|
1786
1802
|
end: deserializeU32(pos + 4),
|
|
1787
1803
|
id: deserializeTSModuleDeclarationName(pos + 8),
|
|
1788
1804
|
body: deserializeOptionTSModuleDeclarationBody(pos + 64),
|
|
1789
|
-
kind
|
|
1805
|
+
kind,
|
|
1790
1806
|
declare: deserializeBool(pos + 81),
|
|
1807
|
+
global: kind === 'global',
|
|
1791
1808
|
};
|
|
1792
1809
|
}
|
|
1793
1810
|
|
|
@@ -1849,7 +1866,6 @@ function deserializeTSFunctionType(pos) {
|
|
|
1849
1866
|
start: deserializeU32(pos),
|
|
1850
1867
|
end: deserializeU32(pos + 4),
|
|
1851
1868
|
typeParameters: deserializeOptionBoxTSTypeParameterDeclaration(pos + 8),
|
|
1852
|
-
thisParam: deserializeOptionBoxTSThisParameter(pos + 16),
|
|
1853
1869
|
params: deserializeBoxFormalParameters(pos + 24),
|
|
1854
1870
|
returnType: deserializeBoxTSTypeAnnotation(pos + 32),
|
|
1855
1871
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oxc-parser",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"browser": "wasm.mjs",
|
|
6
6
|
"engines": {
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@oxc-project/types": "^0.61.
|
|
41
|
+
"@oxc-project/types": "^0.61.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@codspeed/vitest-plugin": "^4.0.0",
|
|
45
45
|
"@napi-rs/wasm-runtime": "^0.2.7",
|
|
46
46
|
"@vitest/browser": "3.0.8",
|
|
47
|
+
"esbuild": "^0.25.0",
|
|
47
48
|
"playwright": "^1.51.0",
|
|
48
49
|
"vitest": "3.0.8"
|
|
49
50
|
},
|
|
@@ -70,22 +71,23 @@
|
|
|
70
71
|
"dtsHeaderFile": "header.js"
|
|
71
72
|
},
|
|
72
73
|
"optionalDependencies": {
|
|
73
|
-
"@oxc-parser/binding-win32-x64-msvc": "0.61.
|
|
74
|
-
"@oxc-parser/binding-win32-arm64-msvc": "0.61.
|
|
75
|
-
"@oxc-parser/binding-linux-x64-gnu": "0.61.
|
|
76
|
-
"@oxc-parser/binding-linux-x64-musl": "0.61.
|
|
77
|
-
"@oxc-parser/binding-linux-arm64-gnu": "0.61.
|
|
78
|
-
"@oxc-parser/binding-linux-arm64-musl": "0.61.
|
|
79
|
-
"@oxc-parser/binding-linux-arm-gnueabihf": "0.61.
|
|
80
|
-
"@oxc-parser/binding-darwin-x64": "0.61.
|
|
81
|
-
"@oxc-parser/binding-darwin-arm64": "0.61.
|
|
82
|
-
"@oxc-parser/binding-wasm32-wasi": "0.61.
|
|
74
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.61.2",
|
|
75
|
+
"@oxc-parser/binding-win32-arm64-msvc": "0.61.2",
|
|
76
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.61.2",
|
|
77
|
+
"@oxc-parser/binding-linux-x64-musl": "0.61.2",
|
|
78
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.61.2",
|
|
79
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.61.2",
|
|
80
|
+
"@oxc-parser/binding-linux-arm-gnueabihf": "0.61.2",
|
|
81
|
+
"@oxc-parser/binding-darwin-x64": "0.61.2",
|
|
82
|
+
"@oxc-parser/binding-darwin-arm64": "0.61.2",
|
|
83
|
+
"@oxc-parser/binding-wasm32-wasi": "0.61.2"
|
|
83
84
|
},
|
|
84
85
|
"scripts": {
|
|
85
86
|
"build-dev": "napi build --no-dts-cache --platform --js bindings.js",
|
|
86
87
|
"build": "pnpm run build-dev --features allocator --release",
|
|
87
88
|
"build-wasi": "pnpm run build-dev --release --target wasm32-wasip1-threads",
|
|
88
89
|
"build-npm-dir": "rm -rf npm-dir && napi create-npm-dirs --npm-dir npm-dir && pnpm napi artifacts --npm-dir npm-dir --output-dir .",
|
|
90
|
+
"build-browser-bundle": "node build-browser-bundle.mjs",
|
|
89
91
|
"test": "pnpm run test-node run && tsc",
|
|
90
92
|
"test-node": "vitest --dir ./test",
|
|
91
93
|
"test-browser": "vitest -c vitest.config.browser.mts",
|