Skip to content

Commit dc12906

Browse files
Update babel monorepo (#1778)
* Update babel monorepo * Fix type errors * Update test snapshots --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Richard Dominick <34370238+RichDom2185@users.noreply.github.com>
1 parent db9e9f5 commit dc12906

File tree

5 files changed

+827
-871
lines changed

5 files changed

+827
-871
lines changed

src/parser/__tests__/__snapshots__/fullTS.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ Node {
66
Node {
77
"declarations": Array [
88
Node {
9+
"definite": false,
910
"end": 72,
1011
"id": Node {
12+
"decorators": Array [],
1113
"end": 68,
1214
"loc": SourceLocation {
1315
"end": Position {
@@ -22,6 +24,7 @@ Node {
2224
},
2325
},
2426
"name": "x",
27+
"optional": false,
2528
"start": 51,
2629
"type": "Identifier",
2730
"typeAnnotation": Node {
@@ -57,6 +60,7 @@ Node {
5760
"start": 54,
5861
"type": "TSTypeReference",
5962
"typeName": Node {
63+
"decorators": Array [],
6064
"end": 68,
6165
"loc": SourceLocation {
6266
"end": Position {
@@ -71,8 +75,10 @@ Node {
7175
},
7276
},
7377
"name": "StringOrNumber",
78+
"optional": false,
7479
"start": 54,
7580
"type": "Identifier",
81+
"typeAnnotation": undefined,
7682
},
7783
},
7884
},
@@ -112,6 +118,7 @@ Node {
112118
"type": "VariableDeclarator",
113119
},
114120
],
121+
"declare": false,
115122
"end": 73,
116123
"kind": "const",
117124
"loc": SourceLocation {
@@ -131,6 +138,9 @@ Node {
131138
},
132139
],
133140
"end": 78,
141+
"extra": Object {
142+
"topLevelAwait": false,
143+
},
134144
"interpreter": null,
135145
"loc": SourceLocation {
136146
"end": Position {

src/parser/fullTS/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class FullTSParser implements Parser<AcornOptions> {
8989
errorRecovery: throwOnError ?? true
9090
})
9191

92-
if (ast.errors.length) {
92+
if (ast.errors?.length) {
9393
ast.errors
9494
.filter(error => error instanceof SyntaxError)
9595
.forEach(error => {

src/parser/source/typed/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { parse as babelParse } from '@babel/parser'
22
import { Options as AcornOptions } from 'acorn'
33
import { Program } from 'estree'
44

5+
import { SourceParser } from '..'
56
import { Context } from '../../..'
67
import { DEFAULT_ECMA_VERSION } from '../../../constants'
78
import * as TypedES from '../../../typeChecker/tsESTree'
@@ -12,7 +13,6 @@ import {
1213
defaultBabelOptions,
1314
positionToSourceLocation
1415
} from '../../utils'
15-
import { SourceParser } from '..'
1616
import TypeParser from './typeParser'
1717
import { transformBabelASTToESTreeCompliantAST } from './utils'
1818

@@ -51,7 +51,7 @@ export class SourceTypedParser extends SourceParser {
5151
errorRecovery: throwOnError ?? true
5252
})
5353

54-
if (ast.errors.length) {
54+
if (ast.errors?.length) {
5555
ast.errors
5656
.filter(error => error instanceof SyntaxError)
5757
.forEach(error => {

src/typeChecker/__tests__/__snapshots__/source1Typed.test.ts.snap

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ Node {
66
Node {
77
"declarations": Array [
88
Node {
9+
"definite": false,
910
"end": 56,
1011
"id": Node {
12+
"decorators": Array [],
1113
"end": 52,
1214
"loc": SourceLocation {
1315
"end": Position {
@@ -22,8 +24,10 @@ Node {
2224
},
2325
},
2426
"name": "x",
27+
"optional": false,
2528
"start": 51,
2629
"type": "Identifier",
30+
"typeAnnotation": undefined,
2731
},
2832
"init": Node {
2933
"end": 56,
@@ -60,6 +64,7 @@ Node {
6064
"type": "VariableDeclarator",
6165
},
6266
],
67+
"declare": false,
6368
"end": 57,
6469
"kind": "const",
6570
"loc": SourceLocation {
@@ -79,6 +84,9 @@ Node {
7984
},
8085
],
8186
"end": 62,
87+
"extra": Object {
88+
"topLevelAwait": false,
89+
},
8290
"interpreter": null,
8391
"loc": SourceLocation {
8492
"end": Position {
@@ -104,8 +112,10 @@ Node {
104112
Node {
105113
"declarations": Array [
106114
Node {
115+
"definite": false,
107116
"end": 29,
108117
"id": Node {
118+
"decorators": Array [],
109119
"end": 25,
110120
"loc": SourceLocation {
111121
"end": Position {
@@ -120,6 +130,7 @@ Node {
120130
},
121131
},
122132
"name": "x1",
133+
"optional": false,
123134
"start": 6,
124135
"type": "Identifier",
125136
"typeAnnotation": Node {
@@ -228,6 +239,7 @@ Node {
228239
"type": "VariableDeclarator",
229240
},
230241
],
242+
"declare": false,
231243
"end": 30,
232244
"kind": "const",
233245
"loc": SourceLocation {
@@ -248,8 +260,10 @@ Node {
248260
Node {
249261
"declarations": Array [
250262
Node {
263+
"definite": false,
251264
"end": 68,
252265
"id": Node {
266+
"decorators": Array [],
253267
"end": 53,
254268
"loc": SourceLocation {
255269
"end": Position {
@@ -264,6 +278,7 @@ Node {
264278
},
265279
},
266280
"name": "x2",
281+
"optional": false,
267282
"start": 43,
268283
"type": "Identifier",
269284
"typeAnnotation": Node {
@@ -302,6 +317,7 @@ Node {
302317
},
303318
},
304319
"init": Node {
320+
"decorators": Array [],
305321
"end": 58,
306322
"loc": SourceLocation {
307323
"end": Position {
@@ -316,8 +332,10 @@ Node {
316332
},
317333
},
318334
"name": "x1",
335+
"optional": false,
319336
"start": 56,
320337
"type": "Identifier",
338+
"typeAnnotation": undefined,
321339
},
322340
"loc": SourceLocation {
323341
"end": Position {
@@ -335,6 +353,7 @@ Node {
335353
"type": "VariableDeclarator",
336354
},
337355
],
356+
"declare": false,
338357
"end": 69,
339358
"kind": "const",
340359
"loc": SourceLocation {
@@ -354,6 +373,9 @@ Node {
354373
},
355374
],
356375
"end": 74,
376+
"extra": Object {
377+
"topLevelAwait": false,
378+
},
357379
"interpreter": null,
358380
"loc": SourceLocation {
359381
"end": Position {

0 commit comments

Comments
 (0)