oxc-parser 0.72.2 → 0.73.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/bindings.js +1 -1
- package/generated/deserialize/js.js +12 -156
- package/generated/deserialize/lazy.js +13853 -0
- package/generated/deserialize/ts.js +21 -169
- package/index.d.ts +26 -27
- package/index.js +11 -288
- package/package.json +26 -21
- package/raw-transfer/eager.js +56 -0
- package/raw-transfer/index.js +283 -0
- package/raw-transfer/lazy.js +87 -0
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
|
|
@@ -13,8 +13,8 @@ const textDecoder = new TextDecoder('utf-8', { ignoreBOM: true }),
|
|
|
13
13
|
|
|
14
14
|
function deserialize(buffer, sourceTextInput, sourceLenInput) {
|
|
15
15
|
uint8 = buffer;
|
|
16
|
-
uint32 =
|
|
17
|
-
float64 =
|
|
16
|
+
uint32 = buffer.uint32;
|
|
17
|
+
float64 = buffer.float64;
|
|
18
18
|
|
|
19
19
|
sourceText = sourceTextInput;
|
|
20
20
|
sourceLen = sourceLenInput;
|
|
@@ -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
|
-
|
|
700
|
-
|
|
701
|
-
};
|
|
697
|
+
const pattern = deserializeBindingPatternKind(pos);
|
|
698
|
+
return pattern;
|
|
702
699
|
}
|
|
703
700
|
|
|
704
701
|
function deserializeAssignmentPattern(pos) {
|
|
@@ -1081,14 +1078,13 @@ function deserializeStringLiteral(pos) {
|
|
|
1081
1078
|
}
|
|
1082
1079
|
|
|
1083
1080
|
function deserializeBigIntLiteral(pos) {
|
|
1084
|
-
const
|
|
1085
|
-
bigint = raw.slice(0, -1).replace(/_/g, '');
|
|
1081
|
+
const bigint = deserializeStr(pos + 8);
|
|
1086
1082
|
return {
|
|
1087
1083
|
type: 'Literal',
|
|
1088
1084
|
start: deserializeU32(pos),
|
|
1089
1085
|
end: deserializeU32(pos + 4),
|
|
1090
1086
|
value: BigInt(bigint),
|
|
1091
|
-
raw,
|
|
1087
|
+
raw: deserializeOptionStr(pos + 24),
|
|
1092
1088
|
bigint,
|
|
1093
1089
|
};
|
|
1094
1090
|
}
|
|
@@ -1637,8 +1633,8 @@ function deserializeTSClassImplements(pos) {
|
|
|
1637
1633
|
end: expression.end,
|
|
1638
1634
|
object: expression.left,
|
|
1639
1635
|
property: expression.right,
|
|
1640
|
-
computed: false,
|
|
1641
1636
|
optional: false,
|
|
1637
|
+
computed: false,
|
|
1642
1638
|
};
|
|
1643
1639
|
|
|
1644
1640
|
while (parent.object.type === 'TSQualifiedName') {
|
|
@@ -1649,8 +1645,8 @@ function deserializeTSClassImplements(pos) {
|
|
|
1649
1645
|
end: object.end,
|
|
1650
1646
|
object: object.left,
|
|
1651
1647
|
property: object.right,
|
|
1652
|
-
computed: false,
|
|
1653
1648
|
optional: false,
|
|
1649
|
+
computed: false,
|
|
1654
1650
|
};
|
|
1655
1651
|
}
|
|
1656
1652
|
}
|
|
@@ -2140,10 +2136,11 @@ function deserializeRawTransferData(pos) {
|
|
|
2140
2136
|
|
|
2141
2137
|
function deserializeError(pos) {
|
|
2142
2138
|
return {
|
|
2143
|
-
severity: deserializeErrorSeverity(pos +
|
|
2139
|
+
severity: deserializeErrorSeverity(pos + 72),
|
|
2144
2140
|
message: deserializeStr(pos),
|
|
2145
2141
|
labels: deserializeVecErrorLabel(pos + 16),
|
|
2146
2142
|
helpMessage: deserializeOptionStr(pos + 40),
|
|
2143
|
+
codeframe: deserializeStr(pos + 56),
|
|
2147
2144
|
};
|
|
2148
2145
|
}
|
|
2149
2146
|
|
|
@@ -4094,11 +4091,6 @@ function deserializeVecStatement(pos) {
|
|
|
4094
4091
|
return arr;
|
|
4095
4092
|
}
|
|
4096
4093
|
|
|
4097
|
-
function deserializeOptionScopeId(pos) {
|
|
4098
|
-
if (uint32[pos >> 2] === 0) return null;
|
|
4099
|
-
return deserializeScopeId(pos);
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
4094
|
function deserializeBoxBooleanLiteral(pos) {
|
|
4103
4095
|
return deserializeBooleanLiteral(uint32[pos >> 2]);
|
|
4104
4096
|
}
|
|
@@ -4259,16 +4251,6 @@ function deserializeBoxV8IntrinsicExpression(pos) {
|
|
|
4259
4251
|
return deserializeV8IntrinsicExpression(uint32[pos >> 2]);
|
|
4260
4252
|
}
|
|
4261
4253
|
|
|
4262
|
-
function deserializeOptionReferenceId(pos) {
|
|
4263
|
-
if (uint32[pos >> 2] === 0) return null;
|
|
4264
|
-
return deserializeReferenceId(pos);
|
|
4265
|
-
}
|
|
4266
|
-
|
|
4267
|
-
function deserializeOptionSymbolId(pos) {
|
|
4268
|
-
if (uint32[pos >> 2] === 0) return null;
|
|
4269
|
-
return deserializeSymbolId(pos);
|
|
4270
|
-
}
|
|
4271
|
-
|
|
4272
4254
|
function deserializeVecArrayExpressionElement(pos) {
|
|
4273
4255
|
const arr = [],
|
|
4274
4256
|
pos32 = pos >> 2,
|
|
@@ -4874,15 +4856,6 @@ function deserializeF64(pos) {
|
|
|
4874
4856
|
return float64[pos >> 3];
|
|
4875
4857
|
}
|
|
4876
4858
|
|
|
4877
|
-
function deserializeBoxPattern(pos) {
|
|
4878
|
-
return deserializePattern(uint32[pos >> 2]);
|
|
4879
|
-
}
|
|
4880
|
-
|
|
4881
|
-
function deserializeOptionBoxPattern(pos) {
|
|
4882
|
-
if (uint32[pos >> 2] === 0 && uint32[(pos + 4) >> 2] === 0) return null;
|
|
4883
|
-
return deserializeBoxPattern(pos);
|
|
4884
|
-
}
|
|
4885
|
-
|
|
4886
4859
|
function deserializeU8(pos) {
|
|
4887
4860
|
return uint8[pos];
|
|
4888
4861
|
}
|
|
@@ -5271,74 +5244,6 @@ function deserializeOptionNameSpan(pos) {
|
|
|
5271
5244
|
return deserializeNameSpan(pos);
|
|
5272
5245
|
}
|
|
5273
5246
|
|
|
5274
|
-
function deserializeVecAlternative(pos) {
|
|
5275
|
-
const arr = [],
|
|
5276
|
-
pos32 = pos >> 2,
|
|
5277
|
-
len = uint32[pos32 + 2];
|
|
5278
|
-
pos = uint32[pos32];
|
|
5279
|
-
for (let i = 0; i < len; i++) {
|
|
5280
|
-
arr.push(deserializeAlternative(pos));
|
|
5281
|
-
pos += 32;
|
|
5282
|
-
}
|
|
5283
|
-
return arr;
|
|
5284
|
-
}
|
|
5285
|
-
|
|
5286
|
-
function deserializeVecTerm(pos) {
|
|
5287
|
-
const arr = [],
|
|
5288
|
-
pos32 = pos >> 2,
|
|
5289
|
-
len = uint32[pos32 + 2];
|
|
5290
|
-
pos = uint32[pos32];
|
|
5291
|
-
for (let i = 0; i < len; i++) {
|
|
5292
|
-
arr.push(deserializeTerm(pos));
|
|
5293
|
-
pos += 16;
|
|
5294
|
-
}
|
|
5295
|
-
return arr;
|
|
5296
|
-
}
|
|
5297
|
-
|
|
5298
|
-
function deserializeBoxBoundaryAssertion(pos) {
|
|
5299
|
-
return deserializeBoundaryAssertion(uint32[pos >> 2]);
|
|
5300
|
-
}
|
|
5301
|
-
|
|
5302
|
-
function deserializeBoxLookAroundAssertion(pos) {
|
|
5303
|
-
return deserializeLookAroundAssertion(uint32[pos >> 2]);
|
|
5304
|
-
}
|
|
5305
|
-
|
|
5306
|
-
function deserializeBoxQuantifier(pos) {
|
|
5307
|
-
return deserializeQuantifier(uint32[pos >> 2]);
|
|
5308
|
-
}
|
|
5309
|
-
|
|
5310
|
-
function deserializeBoxCharacter(pos) {
|
|
5311
|
-
return deserializeCharacter(uint32[pos >> 2]);
|
|
5312
|
-
}
|
|
5313
|
-
|
|
5314
|
-
function deserializeBoxCharacterClassEscape(pos) {
|
|
5315
|
-
return deserializeCharacterClassEscape(uint32[pos >> 2]);
|
|
5316
|
-
}
|
|
5317
|
-
|
|
5318
|
-
function deserializeBoxUnicodePropertyEscape(pos) {
|
|
5319
|
-
return deserializeUnicodePropertyEscape(uint32[pos >> 2]);
|
|
5320
|
-
}
|
|
5321
|
-
|
|
5322
|
-
function deserializeBoxCharacterClass(pos) {
|
|
5323
|
-
return deserializeCharacterClass(uint32[pos >> 2]);
|
|
5324
|
-
}
|
|
5325
|
-
|
|
5326
|
-
function deserializeBoxCapturingGroup(pos) {
|
|
5327
|
-
return deserializeCapturingGroup(uint32[pos >> 2]);
|
|
5328
|
-
}
|
|
5329
|
-
|
|
5330
|
-
function deserializeBoxIgnoreGroup(pos) {
|
|
5331
|
-
return deserializeIgnoreGroup(uint32[pos >> 2]);
|
|
5332
|
-
}
|
|
5333
|
-
|
|
5334
|
-
function deserializeBoxIndexedReference(pos) {
|
|
5335
|
-
return deserializeIndexedReference(uint32[pos >> 2]);
|
|
5336
|
-
}
|
|
5337
|
-
|
|
5338
|
-
function deserializeBoxNamedReference(pos) {
|
|
5339
|
-
return deserializeNamedReference(uint32[pos >> 2]);
|
|
5340
|
-
}
|
|
5341
|
-
|
|
5342
5247
|
function deserializeU64(pos) {
|
|
5343
5248
|
const pos32 = pos >> 2;
|
|
5344
5249
|
return uint32[pos32] + uint32[pos32 + 1] * 4294967296;
|
|
@@ -5349,55 +5254,6 @@ function deserializeOptionU64(pos) {
|
|
|
5349
5254
|
return deserializeU64(pos + 8);
|
|
5350
5255
|
}
|
|
5351
5256
|
|
|
5352
|
-
function deserializeVecCharacterClassContents(pos) {
|
|
5353
|
-
const arr = [],
|
|
5354
|
-
pos32 = pos >> 2,
|
|
5355
|
-
len = uint32[pos32 + 2];
|
|
5356
|
-
pos = uint32[pos32];
|
|
5357
|
-
for (let i = 0; i < len; i++) {
|
|
5358
|
-
arr.push(deserializeCharacterClassContents(pos));
|
|
5359
|
-
pos += 16;
|
|
5360
|
-
}
|
|
5361
|
-
return arr;
|
|
5362
|
-
}
|
|
5363
|
-
|
|
5364
|
-
function deserializeBoxCharacterClassRange(pos) {
|
|
5365
|
-
return deserializeCharacterClassRange(uint32[pos >> 2]);
|
|
5366
|
-
}
|
|
5367
|
-
|
|
5368
|
-
function deserializeBoxClassStringDisjunction(pos) {
|
|
5369
|
-
return deserializeClassStringDisjunction(uint32[pos >> 2]);
|
|
5370
|
-
}
|
|
5371
|
-
|
|
5372
|
-
function deserializeVecClassString(pos) {
|
|
5373
|
-
const arr = [],
|
|
5374
|
-
pos32 = pos >> 2,
|
|
5375
|
-
len = uint32[pos32 + 2];
|
|
5376
|
-
pos = uint32[pos32];
|
|
5377
|
-
for (let i = 0; i < len; i++) {
|
|
5378
|
-
arr.push(deserializeClassString(pos));
|
|
5379
|
-
pos += 40;
|
|
5380
|
-
}
|
|
5381
|
-
return arr;
|
|
5382
|
-
}
|
|
5383
|
-
|
|
5384
|
-
function deserializeVecCharacter(pos) {
|
|
5385
|
-
const arr = [],
|
|
5386
|
-
pos32 = pos >> 2,
|
|
5387
|
-
len = uint32[pos32 + 2];
|
|
5388
|
-
pos = uint32[pos32];
|
|
5389
|
-
for (let i = 0; i < len; i++) {
|
|
5390
|
-
arr.push(deserializeCharacter(pos));
|
|
5391
|
-
pos += 16;
|
|
5392
|
-
}
|
|
5393
|
-
return arr;
|
|
5394
|
-
}
|
|
5395
|
-
|
|
5396
|
-
function deserializeOptionModifiers(pos) {
|
|
5397
|
-
if (uint8[pos] === 0) return null;
|
|
5398
|
-
return deserializeModifiers(pos + 8);
|
|
5399
|
-
}
|
|
5400
|
-
|
|
5401
5257
|
function deserializeVecError(pos) {
|
|
5402
5258
|
const arr = [],
|
|
5403
5259
|
pos32 = pos >> 2,
|
|
@@ -5405,7 +5261,7 @@ function deserializeVecError(pos) {
|
|
|
5405
5261
|
pos = uint32[pos32];
|
|
5406
5262
|
for (let i = 0; i < len; i++) {
|
|
5407
5263
|
arr.push(deserializeError(pos));
|
|
5408
|
-
pos +=
|
|
5264
|
+
pos += 80;
|
|
5409
5265
|
}
|
|
5410
5266
|
return arr;
|
|
5411
5267
|
}
|