Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-codemod-utils

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-codemod-utils - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

6

CHANGELOG.md
# eslint-codemod-utils
## 0.0.6
### Patch Changes
- 8d31804: Adds MethodDefinition, ClassDefinition
## 0.0.5

@@ -4,0 +10,0 @@

484

dist/__tests__/__fixtures__/program.d.ts

@@ -5,8 +5,2 @@ declare const _default: {

type: string;
source: {
type: string;
value: string;
raw: string;
range: number[];
};
specifiers: ({

@@ -21,3 +15,2 @@ type: string;

imported?: undefined;
importKind?: undefined;
} | {

@@ -35,14 +28,17 @@ type: string;

};
importKind: string;
range: number[];
})[];
importKind: string;
assertions: never[];
source: {
type: string;
value: string;
raw: string;
range: number[];
};
range: number[];
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -56,5 +52,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -67,5 +61,2 @@ type: string;

};
generator: boolean;
expression: boolean;
async: boolean;
params: {

@@ -80,2 +71,3 @@ type: string;

};
computed: boolean;
value: {

@@ -86,6 +78,5 @@ type: string;

};
computed: boolean;
kind: string;
method: boolean;
shorthand: boolean;
kind: string;
range: number[];

@@ -103,3 +94,2 @@ }[];

type: string;
selfClosing: boolean;
name: {

@@ -110,14 +100,6 @@ type: string;

};
selfClosing: boolean;
attributes: never[];
range: number[];
};
closingElement: {
type: string;
name: {
type: string;
name: string;
range: number[];
};
range: number[];
};
children: ({

@@ -129,4 +111,4 @@ type: string;

openingElement?: undefined;
children?: undefined;
closingElement?: undefined;
children?: undefined;
} | {

@@ -136,3 +118,2 @@ type: string;

type: string;
selfClosing: boolean;
name: {

@@ -143,2 +124,3 @@ type: string;

};
selfClosing: boolean;
attributes: ({

@@ -201,3 +183,2 @@ type: string;

arguments: never[];
optional: boolean;
range: number[];

@@ -211,4 +192,4 @@ };

};
children: never[];
closingElement: null;
children: never[];
range: number[];

@@ -218,2 +199,11 @@ value?: undefined;

})[];
closingElement: {
type: string;
name: {
type: string;
name: string;
range: number[];
};
range: number[];
};
range: number[];

@@ -225,7 +215,8 @@ };

};
generator: boolean;
expression: boolean;
async: boolean;
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
declarations?: undefined;

@@ -239,5 +230,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -251,61 +240,18 @@ type: string;

range: number[];
computed?: undefined;
object?: undefined;
property?: undefined;
computed?: undefined;
optional?: undefined;
};
arguments: never[];
range: number[];
optional?: undefined;
elements?: undefined;
};
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
generator?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;
kind?: undefined;
superClass?: undefined;
discriminant?: undefined;
cases?: undefined;
init?: undefined;
test?: undefined;
update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {
type: string;
expression: {
type: string;
callee: {
type: string;
name: string;
range: number[];
object?: undefined;
property?: undefined;
computed?: undefined;
optional?: undefined;
};
arguments: never[];
optional: boolean;
range: number[];
elements?: undefined;
};
range: number[];
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
generator?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -319,5 +265,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -337,12 +281,10 @@ type: string;

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
superClass?: undefined;

@@ -354,5 +296,3 @@ discriminant?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -374,2 +314,3 @@ type: string;

};
superClass: null;
body: {

@@ -380,3 +321,2 @@ type: string;

};
superClass: null;
range: number[];

@@ -388,12 +328,10 @@ };

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
superClass?: undefined;

@@ -405,5 +343,3 @@ discriminant?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -416,5 +352,10 @@ type: string;

};
superClass: {
type: string;
name: string;
range: number[];
};
body: {
type: string;
body: {
body: ({
type: string;

@@ -426,2 +367,3 @@ key: {

};
computed: boolean;
value: {

@@ -431,5 +373,72 @@ type: string;

params: never[];
body: {
type: string;
body: ({
type: string;
expression: {
type: string;
callee: {
type: string;
range: number[];
};
arguments: never[];
range: number[];
operator?: undefined;
left?: undefined;
right?: undefined;
};
range: number[];
} | {
type: string;
expression: {
type: string;
operator: string;
left: {
type: string;
computed: boolean;
object: {
type: string;
range: number[];
};
property: {
type: string;
name: string;
range: number[];
};
range: number[];
};
right: {
type: string;
value: string;
raw: string;
range: number[];
};
range: number[];
callee?: undefined;
arguments?: undefined;
};
range: number[];
})[];
range: number[];
};
generator: boolean;
expression: boolean;
async: boolean;
range: number[];
};
kind: string;
static: boolean;
range: number[];
} | {
type: string;
key: {
type: string;
name: string;
range: number[];
};
computed: boolean;
value: {
type: string;
id: null;
params: never[];
body: {

@@ -439,10 +448,14 @@ type: string;

type: string;
expression: {
argument: {
type: string;
callee: {
computed: boolean;
object: {
type: string;
range: number[];
};
arguments: never[];
optional: boolean;
property: {
type: string;
name: string;
range: number[];
};
range: number[];

@@ -454,26 +467,20 @@ };

};
generator: boolean;
expression: boolean;
async: boolean;
range: number[];
};
computed: boolean;
kind: string;
static: boolean;
kind: string;
override: boolean;
range: number[];
}[];
})[];
range: number[];
};
superClass: {
type: string;
name: string;
range: number[];
};
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
params?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
declarations?: undefined;

@@ -486,5 +493,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -497,3 +502,3 @@ type: string;

};
cases: {
cases: ({
type: string;

@@ -526,14 +531,26 @@ test: {

range: number[];
}[];
} | {
type: string;
test: null;
consequent: {
type: string;
expression: {
type: string;
value: string;
raw: string;
range: number[];
};
range: number[];
}[];
range: number[];
})[];
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -545,5 +562,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -590,12 +605,10 @@ type: string;

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
superClass?: undefined;

@@ -607,5 +620,3 @@ discriminant?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -634,11 +645,9 @@ type: string;

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
declarations?: undefined;

@@ -652,18 +661,14 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {
type: string;
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -677,5 +682,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -689,14 +692,11 @@ type: string;

arguments?: undefined;
optional?: undefined;
};
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -710,5 +710,3 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -732,2 +730,3 @@ type: string;

};
computed: boolean;
value: {

@@ -739,12 +738,11 @@ type: string;

id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
body?: undefined;
params?: undefined;
};
computed: boolean;
kind: string;
method: boolean;
shorthand: boolean;
kind: string;
range: number[];

@@ -758,8 +756,43 @@ } | {

};
computed: boolean;
value: {
type: string;
id: null;
params: {
type: string;
name: string;
range: number[];
}[];
body: {
type: string;
body: never[];
range: number[];
};
generator: boolean;
expression: boolean;
async: boolean;
range: number[];
value?: undefined;
raw?: undefined;
};
kind: string;
method: boolean;
shorthand: boolean;
range: number[];
} | {
type: string;
key: {
type: string;
name: string;
range: number[];
};
computed: boolean;
value: {
type: string;
id: {
type: string;
name: string;
range: number[];
};
params: never[];
body: {

@@ -770,11 +803,12 @@ type: string;

};
generator: boolean;
expression: boolean;
async: boolean;
range: number[];
params: never[];
value?: undefined;
raw?: undefined;
};
computed: boolean;
kind: string;
method: boolean;
shorthand: boolean;
kind: string;
range: number[];

@@ -788,12 +822,10 @@ })[];

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
superClass?: undefined;

@@ -805,5 +837,3 @@ discriminant?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -835,3 +865,2 @@ type: string;

operator: string;
prefix: boolean;
argument: {

@@ -842,2 +871,3 @@ type: string;

};
prefix: boolean;
range: number[];

@@ -855,11 +885,9 @@ };

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
declarations?: undefined;

@@ -870,5 +898,3 @@ kind?: undefined;

cases?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -887,3 +913,2 @@ type: string;

type: string;
selfClosing: boolean;
name: {

@@ -894,2 +919,3 @@ type: string;

};
selfClosing: boolean;
attributes: ({

@@ -936,2 +962,8 @@ type: string;

};
children: {
type: string;
value: string;
raw: string;
range: number[];
}[];
closingElement: {

@@ -946,8 +978,2 @@ type: string;

};
children: {
type: string;
value: string;
raw: string;
range: number[];
}[];
range: number[];

@@ -959,12 +985,10 @@ };

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
superClass?: undefined;

@@ -976,5 +1000,3 @@ discriminant?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {

@@ -986,2 +1008,3 @@ type: string;

type: string;
computed: boolean;
object: {

@@ -997,4 +1020,2 @@ type: string;

};
computed: boolean;
optional: boolean;
range: number[];

@@ -1007,3 +1028,2 @@ name?: undefined;

type: string;
selfClosing: boolean;
name: {

@@ -1014,11 +1034,11 @@ type: string;

};
selfClosing: boolean;
attributes: never[];
range: number[];
};
children: never[];
closingElement: null;
children: never[];
range: number[];
callee?: undefined;
arguments?: undefined;
optional?: undefined;
} | {

@@ -1028,2 +1048,3 @@ type: string;

type: string;
computed: boolean;
object: {

@@ -1039,4 +1060,2 @@ type: string;

};
computed: boolean;
optional: boolean;
range: number[];

@@ -1050,9 +1069,7 @@ };

}[];
optional: boolean;
range: number[];
openingElement?: undefined;
children?: undefined;
closingElement?: undefined;
children?: undefined;
})[];
optional: boolean;
range: number[];

@@ -1062,11 +1079,9 @@ elements?: undefined;

range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -1080,16 +1095,9 @@ kind?: undefined;

update?: undefined;
exportKind?: undefined;
declaration?: undefined;
exported?: undefined;
} | {
type: string;
source: {
type: string;
value: string;
raw: string;
range: number[];
};
declaration: null;
specifiers: {
type: string;
local: {
exported: {
type: string;

@@ -1099,3 +1107,3 @@ name: string;

};
exported: {
local: {
type: string;

@@ -1105,16 +1113,17 @@ name: string;

};
exportKind: string;
range: number[];
}[];
exportKind: string;
declaration: null;
assertions: never[];
source: {
type: string;
value: string;
raw: string;
range: number[];
};
range: number[];
importKind?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -1128,3 +1137,2 @@ kind?: undefined;

update?: undefined;
exported?: undefined;
} | {

@@ -1139,14 +1147,11 @@ type: string;

};
exportKind: string;
range: number[];
specifiers?: undefined;
source?: undefined;
specifiers?: undefined;
importKind?: undefined;
assertions?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -1160,3 +1165,2 @@ kind?: undefined;

update?: undefined;
exported?: undefined;
} | {

@@ -1187,12 +1191,9 @@ type: string;

source: null;
exportKind: string;
range: number[];
assertions: never[];
importKind?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -1206,3 +1207,2 @@ kind?: undefined;

update?: undefined;
exported?: undefined;
} | {

@@ -1216,14 +1216,10 @@ type: string;

};
exportKind: string;
exported: null;
assertions: never[];
range: number[];
specifiers?: undefined;
importKind?: undefined;
id?: undefined;
params?: undefined;
body?: undefined;
generator?: undefined;
expression?: undefined;
async?: undefined;
params?: undefined;
body?: undefined;
declarations?: undefined;

@@ -1230,0 +1226,0 @@ kind?: undefined;

@@ -8,8 +8,2 @@ "use strict";

type: 'ImportDeclaration',
source: {
type: 'Literal',
value: '@atlaskit/welcome',
raw: "'@atlaskit/welcome'",
range: [27, 46],
},
specifiers: [

@@ -37,8 +31,11 @@ {

},
importKind: 'value',
range: [12, 19],
},
],
importKind: 'value',
assertions: [],
source: {
type: 'Literal',
value: '@atlaskit/welcome',
raw: "'@atlaskit/welcome'",
range: [27, 46],
},
range: [0, 47],

@@ -48,8 +45,2 @@ },

type: 'ImportDeclaration',
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [71, 80],
},
specifiers: [

@@ -61,3 +52,3 @@ {

name: 'X',
range: [62, 63],
range: [57, 58],
},

@@ -67,20 +58,17 @@ imported: {

name: 'X',
range: [62, 63],
range: [57, 58],
},
importKind: 'value',
range: [62, 63],
range: [57, 58],
},
],
importKind: 'type',
assertions: [],
range: [48, 80],
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [66, 75],
},
range: [48, 75],
},
{
type: 'ImportDeclaration',
source: {
type: 'Literal',
value: 'thing',
raw: "'thing'",
range: [105, 112],
},
specifiers: [

@@ -92,5 +80,5 @@ {

name: 'tmm',
range: [88, 91],
range: [83, 86],
},
range: [88, 91],
range: [83, 86],
},

@@ -102,13 +90,18 @@ {

name: 'x',
range: [98, 99],
range: [93, 94],
},
range: [93, 99],
range: [88, 94],
},
],
importKind: 'value',
assertions: [],
range: [81, 112],
source: {
type: 'Literal',
value: 'thing',
raw: "'thing'",
range: [100, 107],
},
range: [76, 107],
},
{
type: 'ImportDeclaration',
specifiers: [],
source: {

@@ -118,8 +111,5 @@ type: 'Literal',

raw: "'blah'",
range: [120, 126],
range: [115, 121],
},
specifiers: [],
importKind: 'value',
assertions: [],
range: [113, 126],
range: [108, 121],
},

@@ -131,7 +121,4 @@ {

name: 'App',
range: [137, 140],
range: [132, 135],
},
generator: false,
expression: false,
async: false,
params: [

@@ -146,17 +133,17 @@ {

name: 'a',
range: [143, 144],
range: [138, 139],
},
computed: false,
value: {
type: 'Identifier',
name: 'a',
range: [143, 144],
range: [138, 139],
},
computed: false,
kind: 'init',
method: false,
shorthand: true,
kind: 'init',
range: [143, 144],
range: [138, 139],
},
],
range: [141, 146],
range: [136, 141],
},

@@ -171,17 +158,17 @@ {

name: 'b',
range: [150, 151],
range: [145, 146],
},
computed: false,
value: {
type: 'Identifier',
name: 'c',
range: [153, 154],
range: [148, 149],
},
computed: false,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [150, 154],
range: [145, 149],
},
],
range: [148, 156],
range: [143, 151],
},

@@ -198,20 +185,11 @@ ],

type: 'JSXOpeningElement',
selfClosing: false,
name: {
type: 'JSXIdentifier',
name: 'div',
range: [176, 179],
range: [171, 174],
},
selfClosing: false,
attributes: [],
range: [175, 180],
range: [170, 175],
},
closingElement: {
type: 'JSXClosingElement',
name: {
type: 'JSXIdentifier',
name: 'div',
range: [318, 321],
},
range: [316, 322],
},
children: [

@@ -222,3 +200,3 @@ {

raw: '\n ',
range: [180, 187],
range: [175, 182],
},

@@ -229,8 +207,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [188, 195],
range: [183, 190],
},
selfClosing: true,
attributes: [

@@ -242,3 +220,3 @@ {

name: 'name',
range: [196, 200],
range: [191, 195],
},

@@ -249,5 +227,5 @@ value: {

raw: '"Sara"',
range: [201, 207],
range: [196, 202],
},
range: [196, 207],
range: [191, 202],
},

@@ -259,3 +237,3 @@ {

name: 'otherName',
range: [208, 217],
range: [203, 212],
},

@@ -268,7 +246,7 @@ value: {

raw: '2',
range: [219, 220],
range: [214, 215],
},
range: [218, 221],
range: [213, 216],
},
range: [208, 221],
range: [203, 216],
},

@@ -280,6 +258,6 @@ {

name: 'isBlanketHidden',
range: [222, 237],
range: [217, 232],
},
value: null,
range: [222, 237],
range: [217, 232],
},

@@ -293,16 +271,15 @@ {

name: 'x',
range: [242, 243],
range: [237, 238],
},
arguments: [],
optional: false,
range: [242, 245],
range: [237, 240],
},
range: [238, 246],
range: [233, 241],
},
],
range: [187, 249],
range: [182, 244],
},
children: [],
closingElement: null,
children: [],
range: [187, 249],
range: [182, 244],
},

@@ -313,3 +290,3 @@ {

raw: '\n ',
range: [249, 256],
range: [244, 251],
},

@@ -320,8 +297,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [257, 264],
range: [252, 259],
},
selfClosing: true,
attributes: [

@@ -333,3 +310,3 @@ {

name: 'name',
range: [265, 269],
range: [260, 264],
},

@@ -340,12 +317,12 @@ value: {

raw: '"Cahal"',
range: [270, 277],
range: [265, 272],
},
range: [265, 277],
range: [260, 272],
},
],
range: [256, 280],
range: [251, 275],
},
children: [],
closingElement: null,
children: [],
range: [256, 280],
range: [251, 275],
},

@@ -356,3 +333,3 @@ {

raw: '\n ',
range: [280, 287],
range: [275, 282],
},

@@ -363,8 +340,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [288, 295],
range: [283, 290],
},
selfClosing: true,
attributes: [

@@ -376,3 +353,3 @@ {

name: 'name',
range: [296, 300],
range: [291, 295],
},

@@ -383,12 +360,12 @@ value: {

raw: '"Edite"',
range: [301, 308],
range: [296, 303],
},
range: [296, 308],
range: [291, 303],
},
],
range: [287, 311],
range: [282, 306],
},
children: [],
closingElement: null,
children: [],
range: [287, 311],
range: [282, 306],
},

@@ -399,13 +376,25 @@ {

raw: '\n ',
range: [311, 316],
range: [306, 311],
},
],
range: [175, 322],
closingElement: {
type: 'JSXClosingElement',
name: {
type: 'JSXIdentifier',
name: 'div',
range: [313, 316],
},
range: [311, 317],
},
range: [170, 317],
},
range: [162, 327],
range: [157, 322],
},
],
range: [158, 329],
range: [153, 324],
},
range: [128, 329],
generator: false,
expression: false,
async: false,
range: [123, 324],
},

@@ -419,8 +408,8 @@ {

name: 'X',
range: [344, 345],
range: [339, 340],
},
arguments: [],
range: [340, 347],
range: [335, 342],
},
range: [340, 347],
range: [335, 342],
},

@@ -434,9 +423,8 @@ {

name: 'X',
range: [349, 350],
range: [344, 345],
},
arguments: [],
optional: false,
range: [349, 352],
range: [344, 347],
},
range: [349, 352],
range: [344, 347],
},

@@ -451,6 +439,6 @@ {

name: 'z',
range: [358, 359],
range: [353, 354],
},
init: null,
range: [358, 359],
range: [353, 354],
},

@@ -462,6 +450,6 @@ {

name: 'zz',
range: [361, 363],
range: [356, 358],
},
init: null,
range: [361, 363],
range: [356, 358],
},

@@ -473,10 +461,10 @@ {

name: 'zzz',
range: [365, 368],
range: [360, 363],
},
init: null,
range: [365, 368],
range: [360, 363],
},
],
kind: 'let',
range: [354, 369],
range: [349, 364],
},

@@ -491,3 +479,3 @@ {

name: 'x',
range: [376, 377],
range: [371, 372],
},

@@ -499,17 +487,17 @@ init: {

name: 'Z',
range: [386, 387],
range: [381, 382],
},
superClass: null,
body: {
type: 'ClassBody',
body: [],
range: [388, 390],
range: [383, 385],
},
superClass: null,
range: [380, 390],
range: [375, 385],
},
range: [376, 390],
range: [371, 385],
},
],
kind: 'const',
range: [370, 390],
range: [365, 385],
},

@@ -521,4 +509,9 @@ {

name: 'D',
range: [398, 399],
range: [393, 394],
},
superClass: {
type: 'Identifier',
name: 'B',
range: [403, 404],
},
body: {

@@ -532,4 +525,5 @@ type: 'ClassBody',

name: 'constructor',
range: [414, 425],
range: [410, 421],
},
computed: false,
value: {

@@ -539,5 +533,2 @@ type: 'FunctionExpression',

params: [],
generator: false,
expression: false,
async: false,
body: {

@@ -552,30 +543,99 @@ type: 'BlockStatement',

type: 'Super',
range: [432, 437],
range: [428, 433],
},
arguments: [],
optional: false,
range: [432, 439],
range: [428, 435],
},
range: [432, 439],
range: [428, 436],
},
{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'MemberExpression',
computed: false,
object: {
type: 'ThisExpression',
range: [441, 445],
},
property: {
type: 'Identifier',
name: 'hello',
range: [446, 451],
},
range: [441, 451],
},
right: {
type: 'Literal',
value: 'hi',
raw: "'hi'",
range: [454, 458],
},
range: [441, 458],
},
range: [441, 459],
},
],
range: [428, 443],
range: [424, 463],
},
range: [425, 443],
generator: false,
expression: false,
async: false,
range: [421, 463],
},
kind: 'constructor',
static: false,
range: [410, 463],
},
{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'other',
range: [467, 472],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: {
type: 'MemberExpression',
computed: false,
object: {
type: 'ThisExpression',
range: [488, 492],
},
property: {
type: 'Identifier',
name: 'hello',
range: [493, 498],
},
range: [488, 498],
},
range: [481, 499],
},
],
range: [475, 503],
},
generator: false,
expression: false,
async: false,
range: [472, 503],
},
kind: 'method',
static: false,
kind: 'constructor',
override: false,
range: [414, 443],
range: [467, 503],
},
],
range: [410, 445],
range: [405, 505],
},
superClass: {
type: 'Identifier',
name: 'B',
range: [408, 409],
},
range: [392, 445],
range: [387, 505],
},

@@ -587,3 +647,3 @@ {

name: 'e',
range: [455, 456],
range: [515, 516],
},

@@ -597,3 +657,3 @@ cases: [

raw: "'x'",
range: [467, 470],
range: [527, 530],
},

@@ -607,5 +667,5 @@ consequent: [

raw: 'false',
range: [472, 477],
range: [532, 537],
},
range: [472, 478],
range: [532, 538],
},

@@ -618,11 +678,28 @@ {

raw: "''",
range: [479, 481],
range: [539, 541],
},
range: [479, 482],
range: [539, 542],
},
],
range: [462, 482],
range: [522, 542],
},
{
type: 'SwitchCase',
test: null,
consequent: [
{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'zz',
raw: "'zz'",
range: [554, 558],
},
range: [554, 559],
},
],
range: [545, 559],
},
],
range: [447, 484],
range: [507, 561],
},

@@ -637,3 +714,3 @@ {

name: 'v1',
range: [492, 494],
range: [569, 571],
},

@@ -650,3 +727,3 @@ init: {

raw: '1',
range: [497, 498],
range: [574, 575],
},

@@ -657,5 +734,5 @@ right: {

raw: '4',
range: [501, 502],
range: [578, 579],
},
range: [497, 502],
range: [574, 579],
},

@@ -666,11 +743,11 @@ right: {

raw: '2',
range: [505, 506],
range: [582, 583],
},
range: [497, 506],
range: [574, 583],
},
range: [492, 506],
range: [569, 583],
},
],
kind: 'const',
range: [486, 506],
range: [563, 583],
},

@@ -688,3 +765,3 @@ {

name: 'a',
range: [515, 516],
range: [592, 593],
},

@@ -695,16 +772,16 @@ init: {

raw: '1',
range: [519, 520],
range: [596, 597],
},
range: [515, 520],
range: [592, 597],
},
],
kind: 'let',
range: [511, 520],
range: [588, 597],
},
],
range: [508, 523],
range: [585, 600],
},
{
type: 'EmptyStatement',
range: [525, 526],
range: [602, 603],
},

@@ -716,5 +793,5 @@ {

elements: [],
range: [526, 528],
range: [603, 605],
},
range: [526, 528],
range: [603, 605],
},

@@ -729,3 +806,3 @@ {

name: 'yy',
range: [536, 538],
range: [613, 615],
},

@@ -740,4 +817,5 @@ init: {

name: 'a',
range: [545, 546],
range: [622, 623],
},
computed: false,
value: {

@@ -747,9 +825,8 @@ type: 'Literal',

raw: '1',
range: [548, 549],
range: [625, 626],
},
computed: false,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [545, 549],
range: [622, 626],
},

@@ -761,23 +838,56 @@ {

name: 'z',
range: [557, 558],
range: [634, 635],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [638, 640],
},
generator: false,
expression: false,
async: false,
range: [635, 640],
},
kind: 'get',
method: false,
shorthand: false,
range: [630, 640],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'j',
range: [648, 649],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [
{
type: 'Identifier',
name: 'j',
range: [650, 651],
},
],
body: {
type: 'BlockStatement',
body: [],
range: [561, 563],
range: [653, 655],
},
range: [558, 563],
params: [],
generator: false,
expression: false,
async: false,
range: [649, 655],
},
computed: false,
kind: 'set',
method: false,
shorthand: false,
kind: 'get',
range: [553, 563],
range: [644, 655],
},

@@ -789,23 +899,23 @@ {

name: 'init',
range: [567, 571],
range: [659, 663],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
generator: false,
expression: false,
async: false,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [574, 576],
range: [666, 668],
},
range: [571, 576],
params: [],
generator: false,
expression: false,
async: false,
range: [663, 668],
},
computed: false,
kind: 'init',
method: true,
shorthand: false,
kind: 'init',
range: [567, 576],
range: [659, 668],
},

@@ -817,23 +927,81 @@ {

name: 'blob',
range: [586, 590],
range: [678, 682],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [685, 687],
},
generator: false,
expression: false,
async: true,
range: [682, 687],
},
kind: 'init',
method: true,
shorthand: false,
range: [672, 687],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [691, 692],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [593, 595],
range: [695, 698],
},
range: [590, 595],
params: [],
generator: false,
expression: false,
async: false,
range: [692, 698],
},
computed: false,
kind: 'init',
method: true,
shorthand: false,
range: [691, 698],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'c',
range: [702, 703],
},
computed: false,
value: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'd',
range: [714, 715],
},
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [718, 720],
},
generator: false,
expression: false,
async: false,
range: [705, 720],
},
kind: 'init',
range: [580, 595],
method: false,
shorthand: false,
range: [702, 720],
},

@@ -844,33 +1012,60 @@ {

type: 'Identifier',
name: 'b',
range: [599, 600],
name: 'pp',
range: [724, 726],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [739, 741],
},
generator: false,
expression: false,
async: false,
range: [728, 741],
},
kind: 'init',
method: false,
shorthand: false,
range: [724, 741],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'zz',
range: [745, 747],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [603, 606],
range: [766, 768],
},
range: [600, 606],
params: [],
generator: false,
expression: false,
async: true,
range: [749, 768],
},
computed: false,
method: true,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [599, 606],
range: [745, 768],
},
],
range: [541, 609],
range: [618, 770],
},
range: [536, 609],
range: [613, 770],
},
],
kind: 'const',
range: [530, 609],
range: [607, 770],
},

@@ -887,3 +1082,3 @@ {

name: 'i',
range: [620, 621],
range: [781, 782],
},

@@ -894,9 +1089,9 @@ init: {

raw: '0',
range: [622, 623],
range: [783, 784],
},
range: [620, 623],
range: [781, 784],
},
],
kind: 'let',
range: [616, 623],
range: [777, 785],
},

@@ -907,9 +1102,9 @@ test: null,

operator: '++',
prefix: false,
argument: {
type: 'Identifier',
name: 'i',
range: [625, 626],
range: [786, 787],
},
range: [625, 628],
prefix: false,
range: [786, 789],
},

@@ -922,8 +1117,8 @@ body: {

label: null,
range: [633, 642],
range: [794, 803],
},
],
range: [630, 645],
range: [791, 806],
},
range: [611, 645],
range: [772, 806],
},

@@ -938,3 +1133,3 @@ {

name: 'y',
range: [653, 654],
range: [814, 815],
},

@@ -945,8 +1140,8 @@ init: {

type: 'JSXOpeningElement',
selfClosing: false,
name: {
type: 'JSXIdentifier',
name: 'Modal',
range: [658, 663],
range: [819, 824],
},
selfClosing: false,
attributes: [

@@ -958,3 +1153,3 @@ {

name: 'isOpen',
range: [664, 670],
range: [825, 831],
},

@@ -967,7 +1162,7 @@ value: {

raw: 'true',
range: [672, 676],
range: [833, 837],
},
range: [671, 677],
range: [832, 838],
},
range: [664, 677],
range: [825, 838],
},

@@ -979,3 +1174,3 @@ {

name: 'onClick',
range: [678, 685],
range: [839, 846],
},

@@ -987,11 +1182,19 @@ value: {

name: 'onClick',
range: [687, 694],
range: [848, 855],
},
range: [686, 695],
range: [847, 856],
},
range: [678, 695],
range: [839, 856],
},
],
range: [657, 696],
range: [818, 857],
},
children: [
{
type: 'JSXText',
value: 'hello',
raw: 'hello',
range: [857, 862],
},
],
closingElement: {

@@ -1002,21 +1205,13 @@ type: 'JSXClosingElement',

name: 'Modal',
range: [703, 708],
range: [864, 869],
},
range: [701, 709],
range: [862, 870],
},
children: [
{
type: 'JSXText',
value: 'hello',
raw: 'hello',
range: [696, 701],
},
],
range: [657, 709],
range: [818, 870],
},
range: [653, 709],
range: [814, 870],
},
],
kind: 'const',
range: [647, 709],
range: [808, 870],
},

@@ -1029,6 +1224,7 @@ {

type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'ReactDOM',
range: [711, 719],
range: [872, 880],
},

@@ -1038,7 +1234,5 @@ property: {

name: 'render',
range: [720, 726],
range: [881, 887],
},
computed: false,
optional: false,
range: [711, 726],
range: [872, 887],
},

@@ -1050,14 +1244,14 @@ arguments: [

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'App',
range: [731, 734],
range: [892, 895],
},
selfClosing: true,
attributes: [],
range: [730, 737],
range: [891, 898],
},
children: [],
closingElement: null,
children: [],
range: [730, 737],
range: [891, 898],
},

@@ -1068,6 +1262,7 @@ {

type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'document',
range: [741, 749],
range: [902, 910],
},

@@ -1077,7 +1272,5 @@ property: {

name: 'getElementById',
range: [750, 764],
range: [911, 925],
},
computed: false,
optional: false,
range: [741, 764],
range: [902, 925],
},

@@ -1089,43 +1282,38 @@ arguments: [

raw: "'root'",
range: [765, 771],
range: [926, 932],
},
],
optional: false,
range: [741, 772],
range: [902, 933],
},
],
optional: false,
range: [711, 774],
range: [872, 935],
},
range: [711, 775],
range: [872, 936],
},
{
type: 'ExportNamedDeclaration',
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [800, 809],
},
declaration: null,
specifiers: [
{
type: 'ExportSpecifier',
exported: {
type: 'Identifier',
name: 'b',
range: [952, 953],
},
local: {
type: 'Identifier',
name: 'y',
range: [786, 787],
range: [947, 948],
},
exported: {
type: 'Identifier',
name: 'b',
range: [791, 792],
},
exportKind: 'value',
range: [786, 792],
range: [947, 953],
},
],
exportKind: 'value',
declaration: null,
assertions: [],
range: [777, 809],
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [961, 970],
},
range: [938, 970],
},

@@ -1137,6 +1325,5 @@ {

name: 'b',
range: [825, 826],
range: [986, 987],
},
exportKind: 'value',
range: [810, 826],
range: [971, 987],
},

@@ -1153,3 +1340,3 @@ {

name: 'yyy',
range: [840, 843],
range: [1001, 1004],
},

@@ -1160,15 +1347,13 @@ init: {

raw: '10',
range: [846, 848],
range: [1007, 1009],
},
range: [840, 848],
range: [1001, 1009],
},
],
kind: 'const',
range: [834, 848],
range: [995, 1009],
},
specifiers: [],
source: null,
exportKind: 'value',
range: [827, 848],
assertions: [],
range: [988, 1009],
},

@@ -1181,12 +1366,9 @@ {

raw: "'s'",
range: [863, 866],
range: [1024, 1027],
},
exportKind: 'value',
exported: null,
assertions: [],
range: [849, 866],
range: [1010, 1027],
},
],
sourceType: 'module',
range: [0, 867],
range: [0, 1027],
};

@@ -15,3 +15,3 @@ "use strict";

function App({a: a}, {b: c}) {
return (
return (
<div>

@@ -35,9 +35,20 @@

let z,zz,zzz
const x = class __Unimplemented {}
class __Unimplemented {}
const x = class Z {}
class D extends B {
constructor () {
super()
this.hello='hi'
}
other () {
return this.hello;
}
}
switch (e) {
case 'x': false; '';
default: 'zz';
}
const v1 = 1 + 4 + 2
let a = 1
{
let a = 1
}
;

@@ -47,17 +58,13 @@ []

a: 1,
get z() {
},
init() {
},
blob() {
},
b() {
get z() {},
set j(j) {},
init: function () {},
blob: async function () {},
b: function () {},
c: function d() {},
pp: function () {},
zz: async function () {}
}
}
for (let i = 0;;i++) {
continue
continue
}

@@ -64,0 +71,0 @@ const y = <Modal isOpen={true} onClick={onClick}>

@@ -0,4 +1,5 @@

export declare const DEFAULT_WHITESPACE = "\n ";
export declare const typeToHelperLookup: {
readonly AssignmentProperty: <T>(node: T) => T;
readonly AssignmentExpression: <T>(node: T) => T;
readonly AssignmentExpression: import("./types").StringableASTNode<import("estree").AssignmentExpression>;
readonly ArrayExpression: import("./types").StringableASTNode<import("estree").ArrayExpression>;

@@ -35,2 +36,3 @@ readonly BlockStatement: import("./types").StringableASTNode<import("estree").BlockStatement>;

readonly MemberExpression: import("./types").StringableASTNode<import("estree").MemberExpression>;
readonly MethodDefinition: import("./types").StringableASTNode<import("estree").MethodDefinition>;
readonly NewExpression: import("./types").StringableASTNode<import("estree").NewExpression>;

@@ -44,2 +46,3 @@ readonly SwitchStatement: import("./types").StringableASTNode<import("estree").SwitchStatement>;

readonly ClassExpression: import("./types").StringableASTNode<import("estree").ClassExpression>;
readonly ClassBody: import("./types").StringableASTNode<import("estree").ClassBody>;
readonly DebuggerStatement: import("./types").StringableASTNode<import("estree").DebuggerStatement>;

@@ -56,2 +59,3 @@ readonly ExportNamedDeclaration: import("./types").StringableASTNode<import("estree").ExportNamedDeclaration>;

readonly Property: import("./types").StringableASTNode<import("estree").Property>;
readonly PropertyDefinition: import("./types").StringableASTNode<import("estree").PropertyDefinition>;
readonly ReturnStatement: import("./types").StringableASTNode<import("estree").ReturnStatement>;

@@ -58,0 +62,0 @@ readonly Super: <T>(node: T) => T;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.typeToHelperLookup = void 0;
exports.typeToHelperLookup = exports.DEFAULT_WHITESPACE = void 0;
const jsx_nodes_1 = require("./jsx-nodes");
const nodes_1 = require("./nodes");
const identity_1 = require("./utils/identity");
exports.DEFAULT_WHITESPACE = '\n ';
exports.typeToHelperLookup = new Proxy({

@@ -11,3 +12,3 @@ // TODO implement

// TODO implement
AssignmentExpression: identity_1.identity,
AssignmentExpression: nodes_1.assignmentExpression,
ArrayExpression: nodes_1.arrayExpression,

@@ -46,2 +47,3 @@ BlockStatement: nodes_1.blockStatement,

MemberExpression: nodes_1.memberExpression,
MethodDefinition: nodes_1.methodDefinition,
NewExpression: nodes_1.newExpression,

@@ -55,2 +57,3 @@ SwitchStatement: nodes_1.switchStatement,

ClassExpression: nodes_1.classExpression,
ClassBody: nodes_1.classBody,
DebuggerStatement: nodes_1.debuggerStatement,

@@ -67,2 +70,3 @@ ExportNamedDeclaration: nodes_1.exportNamedDeclaration,

Property: nodes_1.property,
PropertyDefinition: nodes_1.propertyDefinition,
ReturnStatement: nodes_1.returnStatement,

@@ -69,0 +73,0 @@ Super: identity_1.identity,

@@ -24,2 +24,11 @@ import * as estree from 'estree';

export declare const callExpression: StringableASTNode<estree.SimpleCallExpression>;
/**
* __BinaryExpression__
*
* @example
* ```ts
* const x = 'left' + 'right'
* ^^^^^^^^^^^^^^^^
* ```
*/
export declare const binaryExpression: StringableASTNode<estree.BinaryExpression>;

@@ -79,2 +88,11 @@ /**

export declare const expressionStatement: StringableASTNode<estree.ExpressionStatement>;
/**
* __NewExpression__
*
* @example
* ```ts
* new SomeThing
* ^^^^^^^^^^^^^
* ```
*/
export declare const newExpression: StringableASTNode<estree.NewExpression>;

@@ -124,2 +142,3 @@ export declare const property: StringableASTNode<estree.Property>;

export declare const conditionalExpression: StringableASTNode<estree.ConditionalExpression>;
export declare const assignmentExpression: StringableASTNode<estree.AssignmentExpression>;
export declare const awaitExpression: StringableASTNode<estree.AwaitExpression>;

@@ -140,4 +159,8 @@ /**

export declare const functionDeclaration: StringableASTNode<estree.FunctionDeclaration>;
export declare const methodOrPropertyFn: (fn: estree.FunctionExpression) => string;
export declare const methodDefinition: StringableASTNode<estree.MethodDefinition>;
export declare const propertyDefinition: StringableASTNode<estree.PropertyDefinition>;
export declare const classBody: StringableASTNode<estree.ClassBody>;
export declare const classDeclaration: StringableASTNode<estree.ClassDeclaration>;
export declare const classExpression: StringableASTNode<estree.ClassExpression>;
export declare const program: StringableASTNode<estree.Program>;

@@ -14,4 +14,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.program = exports.classExpression = exports.classDeclaration = exports.functionDeclaration = exports.staticBlock = exports.awaitExpression = exports.conditionalExpression = exports.debuggerStatement = exports.continueStatement = exports.forStatement = exports.switchStatement = exports.switchCase = exports.whileStatement = exports.identifier = exports.literal = exports.importDeclaration = exports.importNamespaceSpecifier = exports.variableDeclaration = exports.variableDeclarator = exports.logicalExpression = exports.memberExpression = exports.emptyStatement = exports.objectExpression = exports.spreadElement = exports.objectPattern = exports.property = exports.newExpression = exports.expressionStatement = exports.updateExpression = exports.arrayExpression = exports.yieldExpression = exports.importSpecifier = exports.exportSpecifier = exports.exportAllDeclaration = exports.exportDefaultDeclaration = exports.exportNamedDeclaration = exports.importDefaultSpecifier = exports.thisExpression = exports.unaryExpression = exports.returnStatement = exports.blockStatement = exports.functionExpression = exports.arrowFunctionExpression = exports.binaryExpression = exports.callExpression = void 0;
exports.program = exports.classExpression = exports.classDeclaration = exports.classBody = exports.propertyDefinition = exports.methodDefinition = exports.methodOrPropertyFn = exports.functionDeclaration = exports.staticBlock = exports.awaitExpression = exports.assignmentExpression = exports.conditionalExpression = exports.debuggerStatement = exports.continueStatement = exports.forStatement = exports.switchStatement = exports.switchCase = exports.whileStatement = exports.identifier = exports.literal = exports.importDeclaration = exports.importNamespaceSpecifier = exports.variableDeclaration = exports.variableDeclarator = exports.logicalExpression = exports.memberExpression = exports.emptyStatement = exports.objectExpression = exports.spreadElement = exports.objectPattern = exports.property = exports.newExpression = exports.expressionStatement = exports.updateExpression = exports.arrayExpression = exports.yieldExpression = exports.importSpecifier = exports.exportSpecifier = exports.exportAllDeclaration = exports.exportDefaultDeclaration = exports.exportNamedDeclaration = exports.importDefaultSpecifier = exports.thisExpression = exports.unaryExpression = exports.returnStatement = exports.blockStatement = exports.functionExpression = exports.arrowFunctionExpression = exports.binaryExpression = exports.callExpression = void 0;
const node_1 = require("./utils/node");
const constants_1 = require("./constants");
/**

@@ -46,2 +47,11 @@ * __CallExpression__

exports.callExpression = callExpression;
/**
* __BinaryExpression__
*
* @example
* ```ts
* const x = 'left' + 'right'
* ^^^^^^^^^^^^^^^^
* ```
*/
const binaryExpression = (_a) => {

@@ -69,3 +79,6 @@ var { left, right, operator } = _a, other = __rest(_a, ["left", "right", "operator"]);

body,
params, type: 'ArrowFunctionExpression', toString: () => `(${params.map(node_1.node).map(String).join(', ')}) => {${(0, node_1.node)(body)}}` });
params, type: 'ArrowFunctionExpression', toString: () => `${async ? 'async ' : ''}(${params
.map(node_1.node)
.map(String)
.join(', ')}) => ${(0, node_1.node)(body)}` });
};

@@ -79,3 +92,5 @@ exports.arrowFunctionExpression = arrowFunctionExpression;

body,
params, __pragma: 'ecu', type: 'FunctionExpression', toString: () => `${id ? (0, node_1.node)(id) : ''}(${params.map(node_1.node).join(', ')}) {\n${(0, node_1.node)(body)}\n}` });
params, __pragma: 'ecu', type: 'FunctionExpression', toString: () => `${async ? 'async ' : ''}function ${id ? (0, node_1.node)(id) : ''}(${params
.map(node_1.node)
.join(', ')}) ${(0, node_1.node)(body)}` });
};

@@ -85,3 +100,7 @@ exports.functionExpression = functionExpression;

var { body } = _a, other = __rest(_a, ["body"]);
return Object.assign(Object.assign({}, other), { __pragma: 'ecu', body, type: 'BlockStatement', toString: () => `${body.map(node_1.node).map(String).join('\n')}` });
return Object.assign(Object.assign({}, other), { __pragma: 'ecu', body, type: 'BlockStatement', toString: () => `{${body.length
? constants_1.DEFAULT_WHITESPACE +
body.map(node_1.node).map(String).join(constants_1.DEFAULT_WHITESPACE) +
'\n'
: ''}}` });
};

@@ -94,3 +113,3 @@ exports.blockStatement = blockStatement;

argument.type === 'JSXElement'
? ` (\n ${(0, node_1.node)(argument)}\n )`
? ` (${constants_1.DEFAULT_WHITESPACE}${(0, node_1.node)(argument)}${constants_1.DEFAULT_WHITESPACE})`
: ` ${(0, node_1.node)(argument)}`

@@ -199,2 +218,11 @@ : ''};` });

exports.expressionStatement = expressionStatement;
/**
* __NewExpression__
*
* @example
* ```ts
* new SomeThing
* ^^^^^^^^^^^^^
* ```
*/
const newExpression = (_a) => {

@@ -210,3 +238,5 @@ var { callee } = _a, other = __rest(_a, ["callee"]);

value,
method, type: 'Property', __pragma: 'ecu', toString: () => `${kind === 'init' ? '' : kind + ' '}${(0, node_1.node)(key)}${method || kind !== 'init' ? '' : ': '}${(0, node_1.node)(value)}` });
method, type: 'Property', __pragma: 'ecu', toString: () => `${kind === 'init' ? '' : kind + ' '}${(0, node_1.node)(key)}${kind !== 'init' ? '' : ': '}${kind !== 'init' && value.type === 'FunctionExpression'
? (0, exports.methodOrPropertyFn)(value)
: (0, node_1.node)(value)}` });
};

@@ -251,6 +281,6 @@ exports.property = property;

var { properties } = _a, other = __rest(_a, ["properties"]);
return Object.assign(Object.assign({}, other), { __pragma: 'ecu', properties, type: 'ObjectExpression', toString: () => `{\n ${properties
return Object.assign(Object.assign({}, other), { __pragma: 'ecu', properties, type: 'ObjectExpression', toString: () => `{${constants_1.DEFAULT_WHITESPACE}${properties
.map((node) => node.type === 'Property' ? (0, exports.property)(node) : (0, exports.spreadElement)(node))
.map(String)
.join(',\n ')}\n}` });
.join(`,${constants_1.DEFAULT_WHITESPACE}`)}\n}` });
};

@@ -310,3 +340,3 @@ exports.objectExpression = objectExpression;

const nameSpaceSpecifier = specifiers.find((node) => node.type === 'ImportNamespaceSpecifier');
const seperator = otherSpecifiers.length > 4 ? ',\n ' : ', ';
const seperator = otherSpecifiers.length > 4 ? `,${constants_1.DEFAULT_WHITESPACE}` : ', ';
const leadOrEndSpecifier = otherSpecifiers.length > 4 ? '\n' : ' ';

@@ -355,5 +385,6 @@ return `import ${defaultSpecifier ? defaultSpecifier.local.name : ''}${otherSpecifiers.length

return Object.assign(Object.assign({}, other), { consequent,
test, type: 'SwitchCase', __pragma: 'ecu', toString: () =>
// @ts-ignore
`case ${(0, node_1.node)(test)}: ${consequent.map(node_1.node).map(String).join('; ')};` });
test, type: 'SwitchCase', __pragma: 'ecu', toString: () => `${!test ? 'default' : `case ${(0, node_1.node)(test)}`}: ${consequent
.map(node_1.node)
.map(String)
.join('; ')};` });
};

@@ -364,3 +395,3 @@ exports.switchCase = switchCase;

return (Object.assign(Object.assign({}, other), { toString: () => `switch (${(0, node_1.node)(discriminant)}) {
${cases.map(exports.switchCase)}\n}`, __pragma: 'ecu', cases,
${cases.map(exports.switchCase).join(constants_1.DEFAULT_WHITESPACE)}\n}`, __pragma: 'ecu', cases,
discriminant, type: 'SwitchStatement' }));

@@ -374,3 +405,3 @@ };

test,
update, type: 'ForStatement', toString: () => `for (${init ? (0, node_1.node)(init) : ''};${test ? (0, node_1.node)(test) : ''};${update ? (0, node_1.node)(update) : ''}) {\n${(0, node_1.node)(body)}\n}` }));
update, type: 'ForStatement', toString: () => `for (${init ? (0, node_1.node)(init) : ''};${test ? (0, node_1.node)(test) : ''};${update ? (0, node_1.node)(update) : ''}) ${(0, node_1.node)(body)}` }));
};

@@ -392,2 +423,9 @@ exports.forStatement = forStatement;

exports.conditionalExpression = conditionalExpression;
const assignmentExpression = (_a) => {
var { left, right, operator } = _a, other = __rest(_a, ["left", "right", "operator"]);
return Object.assign(Object.assign({}, other), { type: 'AssignmentExpression', __pragma: 'ecu', left,
right,
operator, toString: () => `${(0, node_1.node)(left)}${operator}${(0, node_1.node)(right)}` });
};
exports.assignmentExpression = assignmentExpression;
const awaitExpression = (_a) => {

@@ -414,3 +452,3 @@ var { argument } = _a, other = __rest(_a, ["argument"]);

var { body } = _a, other = __rest(_a, ["body"]);
return Object.assign(Object.assign({}, other), { body, type: 'StaticBlock', __pragma: 'ecu', toString: () => `static {\n${body.map(node_1.node).map(String).join('\n')}\n}` });
return Object.assign(Object.assign({}, other), { body, type: 'StaticBlock', __pragma: 'ecu', toString: () => `static {\n${body.map(node_1.node).map(String).join(constants_1.DEFAULT_WHITESPACE)}\n}` });
};

@@ -424,8 +462,36 @@ exports.staticBlock = staticBlock;

generator,
params, toString: () => `function ${id ? (0, node_1.node)(id) : ''}(${params
params, toString: () => `${async ? 'async ' : ''}function ${id ? (0, node_1.node)(id) : ''}(${params
.map(node_1.node)
.map(String)
.join(', ')}) {\n${(0, node_1.node)(body)}\n}` }));
.join(', ')}) ${(0, node_1.node)(body)}` }));
};
exports.functionDeclaration = functionDeclaration;
const methodOrPropertyFn = (fn) => {
return `(${fn.params.map(node_1.node).join(', ')}) ${(0, node_1.node)(fn.body)}`;
};
exports.methodOrPropertyFn = methodOrPropertyFn;
const methodDefinition = (_a) => {
var { computed, key, kind, value } = _a, other = __rest(_a, ["computed", "key", "kind", "value"]);
return Object.assign(Object.assign({}, other), { computed,
key,
kind,
value, __pragma: 'ecu', type: 'MethodDefinition', toString: () => `${(0, node_1.node)(key)} ${(0, exports.methodOrPropertyFn)(value)}` });
};
exports.methodDefinition = methodDefinition;
const propertyDefinition = (_a) => {
var { computed, key, static: staticKeyWord, value } = _a, other = __rest(_a, ["computed", "key", "static", "value"]);
return Object.assign(Object.assign({}, other), { computed,
key, static: staticKeyWord, value, type: 'PropertyDefinition', __pragma: 'ecu', toString: () => `UNIMPLEMENTED` });
};
exports.propertyDefinition = propertyDefinition;
const classBody = (_a) => {
var { body } = _a, other = __rest(_a, ["body"]);
return Object.assign(Object.assign({}, other), { type: 'ClassBody', body, __pragma: 'ecu', toString: () => body.length
? `${constants_1.DEFAULT_WHITESPACE}${body
.map(node_1.node)
.map(String)
.join(constants_1.DEFAULT_WHITESPACE)}\n`
: '' });
};
exports.classBody = classBody;
const classDeclaration = (_a) => {

@@ -435,3 +501,3 @@ var { superClass, id, body } = _a, other = __rest(_a, ["superClass", "id", "body"]);

body,
id, __pragma: 'ecu', toString: () => `class __Unimplemented {}` });
id, __pragma: 'ecu', toString: () => `class${id ? ` ${(0, node_1.node)(id)}` : ''}${superClass ? ` extends ${(0, node_1.node)(superClass)}` : ''} {${(0, node_1.node)(body)}}` });
};

@@ -438,0 +504,0 @@ exports.classDeclaration = classDeclaration;

@@ -6,8 +6,2 @@ export default {

type: 'ImportDeclaration',
source: {
type: 'Literal',
value: '@atlaskit/welcome',
raw: "'@atlaskit/welcome'",
range: [27, 46],
},
specifiers: [

@@ -35,8 +29,11 @@ {

},
importKind: 'value',
range: [12, 19],
},
],
importKind: 'value',
assertions: [],
source: {
type: 'Literal',
value: '@atlaskit/welcome',
raw: "'@atlaskit/welcome'",
range: [27, 46],
},
range: [0, 47],

@@ -46,8 +43,2 @@ },

type: 'ImportDeclaration',
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [71, 80],
},
specifiers: [

@@ -59,3 +50,3 @@ {

name: 'X',
range: [62, 63],
range: [57, 58],
},

@@ -65,20 +56,17 @@ imported: {

name: 'X',
range: [62, 63],
range: [57, 58],
},
importKind: 'value',
range: [62, 63],
range: [57, 58],
},
],
importKind: 'type',
assertions: [],
range: [48, 80],
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [66, 75],
},
range: [48, 75],
},
{
type: 'ImportDeclaration',
source: {
type: 'Literal',
value: 'thing',
raw: "'thing'",
range: [105, 112],
},
specifiers: [

@@ -90,5 +78,5 @@ {

name: 'tmm',
range: [88, 91],
range: [83, 86],
},
range: [88, 91],
range: [83, 86],
},

@@ -100,13 +88,18 @@ {

name: 'x',
range: [98, 99],
range: [93, 94],
},
range: [93, 99],
range: [88, 94],
},
],
importKind: 'value',
assertions: [],
range: [81, 112],
source: {
type: 'Literal',
value: 'thing',
raw: "'thing'",
range: [100, 107],
},
range: [76, 107],
},
{
type: 'ImportDeclaration',
specifiers: [],
source: {

@@ -116,8 +109,5 @@ type: 'Literal',

raw: "'blah'",
range: [120, 126],
range: [115, 121],
},
specifiers: [],
importKind: 'value',
assertions: [],
range: [113, 126],
range: [108, 121],
},

@@ -129,7 +119,4 @@ {

name: 'App',
range: [137, 140],
range: [132, 135],
},
generator: false,
expression: false,
async: false,
params: [

@@ -144,17 +131,17 @@ {

name: 'a',
range: [143, 144],
range: [138, 139],
},
computed: false,
value: {
type: 'Identifier',
name: 'a',
range: [143, 144],
range: [138, 139],
},
computed: false,
kind: 'init',
method: false,
shorthand: true,
kind: 'init',
range: [143, 144],
range: [138, 139],
},
],
range: [141, 146],
range: [136, 141],
},

@@ -169,17 +156,17 @@ {

name: 'b',
range: [150, 151],
range: [145, 146],
},
computed: false,
value: {
type: 'Identifier',
name: 'c',
range: [153, 154],
range: [148, 149],
},
computed: false,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [150, 154],
range: [145, 149],
},
],
range: [148, 156],
range: [143, 151],
},

@@ -196,20 +183,11 @@ ],

type: 'JSXOpeningElement',
selfClosing: false,
name: {
type: 'JSXIdentifier',
name: 'div',
range: [176, 179],
range: [171, 174],
},
selfClosing: false,
attributes: [],
range: [175, 180],
range: [170, 175],
},
closingElement: {
type: 'JSXClosingElement',
name: {
type: 'JSXIdentifier',
name: 'div',
range: [318, 321],
},
range: [316, 322],
},
children: [

@@ -220,3 +198,3 @@ {

raw: '\n ',
range: [180, 187],
range: [175, 182],
},

@@ -227,8 +205,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [188, 195],
range: [183, 190],
},
selfClosing: true,
attributes: [

@@ -240,3 +218,3 @@ {

name: 'name',
range: [196, 200],
range: [191, 195],
},

@@ -247,5 +225,5 @@ value: {

raw: '"Sara"',
range: [201, 207],
range: [196, 202],
},
range: [196, 207],
range: [191, 202],
},

@@ -257,3 +235,3 @@ {

name: 'otherName',
range: [208, 217],
range: [203, 212],
},

@@ -266,7 +244,7 @@ value: {

raw: '2',
range: [219, 220],
range: [214, 215],
},
range: [218, 221],
range: [213, 216],
},
range: [208, 221],
range: [203, 216],
},

@@ -278,6 +256,6 @@ {

name: 'isBlanketHidden',
range: [222, 237],
range: [217, 232],
},
value: null,
range: [222, 237],
range: [217, 232],
},

@@ -291,16 +269,15 @@ {

name: 'x',
range: [242, 243],
range: [237, 238],
},
arguments: [],
optional: false,
range: [242, 245],
range: [237, 240],
},
range: [238, 246],
range: [233, 241],
},
],
range: [187, 249],
range: [182, 244],
},
children: [],
closingElement: null,
children: [],
range: [187, 249],
range: [182, 244],
},

@@ -311,3 +288,3 @@ {

raw: '\n ',
range: [249, 256],
range: [244, 251],
},

@@ -318,8 +295,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [257, 264],
range: [252, 259],
},
selfClosing: true,
attributes: [

@@ -331,3 +308,3 @@ {

name: 'name',
range: [265, 269],
range: [260, 264],
},

@@ -338,12 +315,12 @@ value: {

raw: '"Cahal"',
range: [270, 277],
range: [265, 272],
},
range: [265, 277],
range: [260, 272],
},
],
range: [256, 280],
range: [251, 275],
},
children: [],
closingElement: null,
children: [],
range: [256, 280],
range: [251, 275],
},

@@ -354,3 +331,3 @@ {

raw: '\n ',
range: [280, 287],
range: [275, 282],
},

@@ -361,8 +338,8 @@ {

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'Welcome',
range: [288, 295],
range: [283, 290],
},
selfClosing: true,
attributes: [

@@ -374,3 +351,3 @@ {

name: 'name',
range: [296, 300],
range: [291, 295],
},

@@ -381,12 +358,12 @@ value: {

raw: '"Edite"',
range: [301, 308],
range: [296, 303],
},
range: [296, 308],
range: [291, 303],
},
],
range: [287, 311],
range: [282, 306],
},
children: [],
closingElement: null,
children: [],
range: [287, 311],
range: [282, 306],
},

@@ -397,13 +374,25 @@ {

raw: '\n ',
range: [311, 316],
range: [306, 311],
},
],
range: [175, 322],
closingElement: {
type: 'JSXClosingElement',
name: {
type: 'JSXIdentifier',
name: 'div',
range: [313, 316],
},
range: [311, 317],
},
range: [170, 317],
},
range: [162, 327],
range: [157, 322],
},
],
range: [158, 329],
range: [153, 324],
},
range: [128, 329],
generator: false,
expression: false,
async: false,
range: [123, 324],
},

@@ -417,8 +406,8 @@ {

name: 'X',
range: [344, 345],
range: [339, 340],
},
arguments: [],
range: [340, 347],
range: [335, 342],
},
range: [340, 347],
range: [335, 342],
},

@@ -432,9 +421,8 @@ {

name: 'X',
range: [349, 350],
range: [344, 345],
},
arguments: [],
optional: false,
range: [349, 352],
range: [344, 347],
},
range: [349, 352],
range: [344, 347],
},

@@ -449,6 +437,6 @@ {

name: 'z',
range: [358, 359],
range: [353, 354],
},
init: null,
range: [358, 359],
range: [353, 354],
},

@@ -460,6 +448,6 @@ {

name: 'zz',
range: [361, 363],
range: [356, 358],
},
init: null,
range: [361, 363],
range: [356, 358],
},

@@ -471,10 +459,10 @@ {

name: 'zzz',
range: [365, 368],
range: [360, 363],
},
init: null,
range: [365, 368],
range: [360, 363],
},
],
kind: 'let',
range: [354, 369],
range: [349, 364],
},

@@ -489,3 +477,3 @@ {

name: 'x',
range: [376, 377],
range: [371, 372],
},

@@ -497,17 +485,17 @@ init: {

name: 'Z',
range: [386, 387],
range: [381, 382],
},
superClass: null,
body: {
type: 'ClassBody',
body: [],
range: [388, 390],
range: [383, 385],
},
superClass: null,
range: [380, 390],
range: [375, 385],
},
range: [376, 390],
range: [371, 385],
},
],
kind: 'const',
range: [370, 390],
range: [365, 385],
},

@@ -519,4 +507,9 @@ {

name: 'D',
range: [398, 399],
range: [393, 394],
},
superClass: {
type: 'Identifier',
name: 'B',
range: [403, 404],
},
body: {

@@ -530,4 +523,5 @@ type: 'ClassBody',

name: 'constructor',
range: [414, 425],
range: [410, 421],
},
computed: false,
value: {

@@ -537,5 +531,2 @@ type: 'FunctionExpression',

params: [],
generator: false,
expression: false,
async: false,
body: {

@@ -550,30 +541,99 @@ type: 'BlockStatement',

type: 'Super',
range: [432, 437],
range: [428, 433],
},
arguments: [],
optional: false,
range: [432, 439],
range: [428, 435],
},
range: [432, 439],
range: [428, 436],
},
{
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'MemberExpression',
computed: false,
object: {
type: 'ThisExpression',
range: [441, 445],
},
property: {
type: 'Identifier',
name: 'hello',
range: [446, 451],
},
range: [441, 451],
},
right: {
type: 'Literal',
value: 'hi',
raw: "'hi'",
range: [454, 458],
},
range: [441, 458],
},
range: [441, 459],
},
],
range: [428, 443],
range: [424, 463],
},
range: [425, 443],
generator: false,
expression: false,
async: false,
range: [421, 463],
},
kind: 'constructor',
static: false,
range: [410, 463],
},
{
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: 'other',
range: [467, 472],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [
{
type: 'ReturnStatement',
argument: {
type: 'MemberExpression',
computed: false,
object: {
type: 'ThisExpression',
range: [488, 492],
},
property: {
type: 'Identifier',
name: 'hello',
range: [493, 498],
},
range: [488, 498],
},
range: [481, 499],
},
],
range: [475, 503],
},
generator: false,
expression: false,
async: false,
range: [472, 503],
},
kind: 'method',
static: false,
kind: 'constructor',
override: false,
range: [414, 443],
range: [467, 503],
},
],
range: [410, 445],
range: [405, 505],
},
superClass: {
type: 'Identifier',
name: 'B',
range: [408, 409],
},
range: [392, 445],
range: [387, 505],
},

@@ -585,3 +645,3 @@ {

name: 'e',
range: [455, 456],
range: [515, 516],
},

@@ -595,3 +655,3 @@ cases: [

raw: "'x'",
range: [467, 470],
range: [527, 530],
},

@@ -605,5 +665,5 @@ consequent: [

raw: 'false',
range: [472, 477],
range: [532, 537],
},
range: [472, 478],
range: [532, 538],
},

@@ -616,11 +676,28 @@ {

raw: "''",
range: [479, 481],
range: [539, 541],
},
range: [479, 482],
range: [539, 542],
},
],
range: [462, 482],
range: [522, 542],
},
{
type: 'SwitchCase',
test: null,
consequent: [
{
type: 'ExpressionStatement',
expression: {
type: 'Literal',
value: 'zz',
raw: "'zz'",
range: [554, 558],
},
range: [554, 559],
},
],
range: [545, 559],
},
],
range: [447, 484],
range: [507, 561],
},

@@ -635,3 +712,3 @@ {

name: 'v1',
range: [492, 494],
range: [569, 571],
},

@@ -648,3 +725,3 @@ init: {

raw: '1',
range: [497, 498],
range: [574, 575],
},

@@ -655,5 +732,5 @@ right: {

raw: '4',
range: [501, 502],
range: [578, 579],
},
range: [497, 502],
range: [574, 579],
},

@@ -664,11 +741,11 @@ right: {

raw: '2',
range: [505, 506],
range: [582, 583],
},
range: [497, 506],
range: [574, 583],
},
range: [492, 506],
range: [569, 583],
},
],
kind: 'const',
range: [486, 506],
range: [563, 583],
},

@@ -686,3 +763,3 @@ {

name: 'a',
range: [515, 516],
range: [592, 593],
},

@@ -693,16 +770,16 @@ init: {

raw: '1',
range: [519, 520],
range: [596, 597],
},
range: [515, 520],
range: [592, 597],
},
],
kind: 'let',
range: [511, 520],
range: [588, 597],
},
],
range: [508, 523],
range: [585, 600],
},
{
type: 'EmptyStatement',
range: [525, 526],
range: [602, 603],
},

@@ -714,5 +791,5 @@ {

elements: [],
range: [526, 528],
range: [603, 605],
},
range: [526, 528],
range: [603, 605],
},

@@ -727,3 +804,3 @@ {

name: 'yy',
range: [536, 538],
range: [613, 615],
},

@@ -738,4 +815,5 @@ init: {

name: 'a',
range: [545, 546],
range: [622, 623],
},
computed: false,
value: {

@@ -745,9 +823,8 @@ type: 'Literal',

raw: '1',
range: [548, 549],
range: [625, 626],
},
computed: false,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [545, 549],
range: [622, 626],
},

@@ -759,23 +836,56 @@ {

name: 'z',
range: [557, 558],
range: [634, 635],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [638, 640],
},
generator: false,
expression: false,
async: false,
range: [635, 640],
},
kind: 'get',
method: false,
shorthand: false,
range: [630, 640],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'j',
range: [648, 649],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [
{
type: 'Identifier',
name: 'j',
range: [650, 651],
},
],
body: {
type: 'BlockStatement',
body: [],
range: [561, 563],
range: [653, 655],
},
range: [558, 563],
params: [],
generator: false,
expression: false,
async: false,
range: [649, 655],
},
computed: false,
kind: 'set',
method: false,
shorthand: false,
kind: 'get',
range: [553, 563],
range: [644, 655],
},

@@ -787,23 +897,23 @@ {

name: 'init',
range: [567, 571],
range: [659, 663],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
generator: false,
expression: false,
async: false,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [574, 576],
range: [666, 668],
},
range: [571, 576],
params: [],
generator: false,
expression: false,
async: false,
range: [663, 668],
},
computed: false,
kind: 'init',
method: true,
shorthand: false,
kind: 'init',
range: [567, 576],
range: [659, 668],
},

@@ -815,23 +925,81 @@ {

name: 'blob',
range: [586, 590],
range: [678, 682],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [685, 687],
},
generator: false,
expression: false,
async: true,
range: [682, 687],
},
kind: 'init',
method: true,
shorthand: false,
range: [672, 687],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'b',
range: [691, 692],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [593, 595],
range: [695, 698],
},
range: [590, 595],
params: [],
generator: false,
expression: false,
async: false,
range: [692, 698],
},
computed: false,
kind: 'init',
method: true,
shorthand: false,
range: [691, 698],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'c',
range: [702, 703],
},
computed: false,
value: {
type: 'FunctionExpression',
id: {
type: 'Identifier',
name: 'd',
range: [714, 715],
},
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [718, 720],
},
generator: false,
expression: false,
async: false,
range: [705, 720],
},
kind: 'init',
range: [580, 595],
method: false,
shorthand: false,
range: [702, 720],
},

@@ -842,33 +1010,60 @@ {

type: 'Identifier',
name: 'b',
range: [599, 600],
name: 'pp',
range: [724, 726],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [739, 741],
},
generator: false,
expression: false,
async: false,
range: [728, 741],
},
kind: 'init',
method: false,
shorthand: false,
range: [724, 741],
},
{
type: 'Property',
key: {
type: 'Identifier',
name: 'zz',
range: [745, 747],
},
computed: false,
value: {
type: 'FunctionExpression',
id: null,
params: [],
body: {
type: 'BlockStatement',
body: [],
range: [603, 606],
range: [766, 768],
},
range: [600, 606],
params: [],
generator: false,
expression: false,
async: true,
range: [749, 768],
},
computed: false,
method: true,
kind: 'init',
method: false,
shorthand: false,
kind: 'init',
range: [599, 606],
range: [745, 768],
},
],
range: [541, 609],
range: [618, 770],
},
range: [536, 609],
range: [613, 770],
},
],
kind: 'const',
range: [530, 609],
range: [607, 770],
},

@@ -885,3 +1080,3 @@ {

name: 'i',
range: [620, 621],
range: [781, 782],
},

@@ -892,9 +1087,9 @@ init: {

raw: '0',
range: [622, 623],
range: [783, 784],
},
range: [620, 623],
range: [781, 784],
},
],
kind: 'let',
range: [616, 623],
range: [777, 785],
},

@@ -905,9 +1100,9 @@ test: null,

operator: '++',
prefix: false,
argument: {
type: 'Identifier',
name: 'i',
range: [625, 626],
range: [786, 787],
},
range: [625, 628],
prefix: false,
range: [786, 789],
},

@@ -920,8 +1115,8 @@ body: {

label: null,
range: [633, 642],
range: [794, 803],
},
],
range: [630, 645],
range: [791, 806],
},
range: [611, 645],
range: [772, 806],
},

@@ -936,3 +1131,3 @@ {

name: 'y',
range: [653, 654],
range: [814, 815],
},

@@ -943,8 +1138,8 @@ init: {

type: 'JSXOpeningElement',
selfClosing: false,
name: {
type: 'JSXIdentifier',
name: 'Modal',
range: [658, 663],
range: [819, 824],
},
selfClosing: false,
attributes: [

@@ -956,3 +1151,3 @@ {

name: 'isOpen',
range: [664, 670],
range: [825, 831],
},

@@ -965,7 +1160,7 @@ value: {

raw: 'true',
range: [672, 676],
range: [833, 837],
},
range: [671, 677],
range: [832, 838],
},
range: [664, 677],
range: [825, 838],
},

@@ -977,3 +1172,3 @@ {

name: 'onClick',
range: [678, 685],
range: [839, 846],
},

@@ -985,11 +1180,19 @@ value: {

name: 'onClick',
range: [687, 694],
range: [848, 855],
},
range: [686, 695],
range: [847, 856],
},
range: [678, 695],
range: [839, 856],
},
],
range: [657, 696],
range: [818, 857],
},
children: [
{
type: 'JSXText',
value: 'hello',
raw: 'hello',
range: [857, 862],
},
],
closingElement: {

@@ -1000,21 +1203,13 @@ type: 'JSXClosingElement',

name: 'Modal',
range: [703, 708],
range: [864, 869],
},
range: [701, 709],
range: [862, 870],
},
children: [
{
type: 'JSXText',
value: 'hello',
raw: 'hello',
range: [696, 701],
},
],
range: [657, 709],
range: [818, 870],
},
range: [653, 709],
range: [814, 870],
},
],
kind: 'const',
range: [647, 709],
range: [808, 870],
},

@@ -1027,6 +1222,7 @@ {

type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'ReactDOM',
range: [711, 719],
range: [872, 880],
},

@@ -1036,7 +1232,5 @@ property: {

name: 'render',
range: [720, 726],
range: [881, 887],
},
computed: false,
optional: false,
range: [711, 726],
range: [872, 887],
},

@@ -1048,14 +1242,14 @@ arguments: [

type: 'JSXOpeningElement',
selfClosing: true,
name: {
type: 'JSXIdentifier',
name: 'App',
range: [731, 734],
range: [892, 895],
},
selfClosing: true,
attributes: [],
range: [730, 737],
range: [891, 898],
},
children: [],
closingElement: null,
children: [],
range: [730, 737],
range: [891, 898],
},

@@ -1066,6 +1260,7 @@ {

type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'document',
range: [741, 749],
range: [902, 910],
},

@@ -1075,7 +1270,5 @@ property: {

name: 'getElementById',
range: [750, 764],
range: [911, 925],
},
computed: false,
optional: false,
range: [741, 764],
range: [902, 925],
},

@@ -1087,43 +1280,38 @@ arguments: [

raw: "'root'",
range: [765, 771],
range: [926, 932],
},
],
optional: false,
range: [741, 772],
range: [902, 933],
},
],
optional: false,
range: [711, 774],
range: [872, 935],
},
range: [711, 775],
range: [872, 936],
},
{
type: 'ExportNamedDeclaration',
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [800, 809],
},
declaration: null,
specifiers: [
{
type: 'ExportSpecifier',
exported: {
type: 'Identifier',
name: 'b',
range: [952, 953],
},
local: {
type: 'Identifier',
name: 'y',
range: [786, 787],
range: [947, 948],
},
exported: {
type: 'Identifier',
name: 'b',
range: [791, 792],
},
exportKind: 'value',
range: [786, 792],
range: [947, 953],
},
],
exportKind: 'value',
declaration: null,
assertions: [],
range: [777, 809],
source: {
type: 'Literal',
value: './other',
raw: "'./other'",
range: [961, 970],
},
range: [938, 970],
},

@@ -1135,6 +1323,5 @@ {

name: 'b',
range: [825, 826],
range: [986, 987],
},
exportKind: 'value',
range: [810, 826],
range: [971, 987],
},

@@ -1151,3 +1338,3 @@ {

name: 'yyy',
range: [840, 843],
range: [1001, 1004],
},

@@ -1158,15 +1345,13 @@ init: {

raw: '10',
range: [846, 848],
range: [1007, 1009],
},
range: [840, 848],
range: [1001, 1009],
},
],
kind: 'const',
range: [834, 848],
range: [995, 1009],
},
specifiers: [],
source: null,
exportKind: 'value',
range: [827, 848],
assertions: [],
range: [988, 1009],
},

@@ -1179,12 +1364,9 @@ {

raw: "'s'",
range: [863, 866],
range: [1024, 1027],
},
exportKind: 'value',
exported: null,
assertions: [],
range: [849, 866],
range: [1010, 1027],
},
],
sourceType: 'module',
range: [0, 867],
range: [0, 1027],
}

@@ -13,3 +13,3 @@ import { program } from '..'

function App({a: a}, {b: c}) {
return (
return (
<div>

@@ -33,9 +33,20 @@

let z,zz,zzz
const x = class __Unimplemented {}
class __Unimplemented {}
const x = class Z {}
class D extends B {
constructor () {
super()
this.hello='hi'
}
other () {
return this.hello;
}
}
switch (e) {
case 'x': false; '';
default: 'zz';
}
const v1 = 1 + 4 + 2
let a = 1
{
let a = 1
}
;

@@ -45,17 +56,13 @@ []

a: 1,
get z() {
},
init() {
},
blob() {
},
b() {
get z() {},
set j(j) {},
init: function () {},
blob: async function () {},
b: function () {},
c: function d() {},
pp: function () {},
zz: async function () {}
}
}
for (let i = 0;;i++) {
continue
continue
}

@@ -62,0 +69,0 @@ const y = <Modal isOpen={true} onClick={onClick}>

@@ -54,5 +54,11 @@ import {

property,
propertyDefinition,
classBody,
methodDefinition,
assignmentExpression,
} from './nodes'
import { identity } from './utils/identity'
export const DEFAULT_WHITESPACE = '\n '
export const typeToHelperLookup = new Proxy(

@@ -63,3 +69,3 @@ {

// TODO implement
AssignmentExpression: identity,
AssignmentExpression: assignmentExpression,
ArrayExpression: arrayExpression,

@@ -98,2 +104,3 @@ BlockStatement: blockStatement,

MemberExpression: memberExpression,
MethodDefinition: methodDefinition,
NewExpression: newExpression,

@@ -107,2 +114,3 @@ SwitchStatement: switchStatement,

ClassExpression: classExpression,
ClassBody: classBody,
DebuggerStatement: debuggerStatement,

@@ -119,2 +127,3 @@ ExportNamedDeclaration: exportNamedDeclaration,

Property: property,
PropertyDefinition: propertyDefinition,
ReturnStatement: returnStatement,

@@ -121,0 +130,0 @@ Super: identity,

@@ -5,2 +5,3 @@ import * as estree from 'estree'

import { node } from './utils/node'
import { DEFAULT_WHITESPACE } from './constants'

@@ -43,2 +44,11 @@ /**

/**
* __BinaryExpression__
*
* @example
* ```ts
* const x = 'left' + 'right'
* ^^^^^^^^^^^^^^^^
* ```
*/
export const binaryExpression: StringableASTNode<estree.BinaryExpression> = ({

@@ -83,3 +93,6 @@ left,

toString: () =>
`(${params.map(node).map(String).join(', ')}) => {${node(body)}}`,
`${async ? 'async ' : ''}(${params
.map(node)
.map(String)
.join(', ')}) => ${node(body)}`,
}

@@ -101,5 +114,5 @@ }

toString: () =>
`${id ? node(id) : ''}(${params.map(node).join(', ')}) {\n${node(
body
)}\n}`,
`${async ? 'async ' : ''}function ${id ? node(id) : ''}(${params
.map(node)
.join(', ')}) ${node(body)}`,
}

@@ -116,3 +129,10 @@ }

type: 'BlockStatement',
toString: () => `${body.map(node).map(String).join('\n')}`,
toString: () =>
`{${
body.length
? DEFAULT_WHITESPACE +
body.map(node).map(String).join(DEFAULT_WHITESPACE) +
'\n'
: ''
}}`,
}

@@ -134,3 +154,3 @@ }

argument.type === 'JSXElement'
? ` (\n ${node(argument)}\n )`
? ` (${DEFAULT_WHITESPACE}${node(argument)}${DEFAULT_WHITESPACE})`
: ` ${node(argument)}`

@@ -339,2 +359,11 @@ : ''

/**
* __NewExpression__
*
* @example
* ```ts
* new SomeThing
* ^^^^^^^^^^^^^
* ```
*/
export const newExpression: StringableASTNode<estree.NewExpression> = ({

@@ -368,4 +397,8 @@ callee,

`${kind === 'init' ? '' : kind + ' '}${node(key)}${
method || kind !== 'init' ? '' : ': '
}${node(value)}`,
kind !== 'init' ? '' : ': '
}${
kind !== 'init' && value.type === 'FunctionExpression'
? methodOrPropertyFn(value)
: node(value)
}`,
}

@@ -434,3 +467,3 @@ }

toString: () =>
`{\n ${properties
`{${DEFAULT_WHITESPACE}${properties
.map((node) =>

@@ -440,3 +473,3 @@ node.type === 'Property' ? property(node) : spreadElement(node)

.map(String)
.join(',\n ')}\n}`,
.join(`,${DEFAULT_WHITESPACE}`)}\n}`,
}

@@ -553,3 +586,4 @@ }

const seperator = otherSpecifiers.length > 4 ? ',\n ' : ', '
const seperator =
otherSpecifiers.length > 4 ? `,${DEFAULT_WHITESPACE}` : ', '
const leadOrEndSpecifier = otherSpecifiers.length > 4 ? '\n' : ' '

@@ -623,4 +657,6 @@

toString: () =>
// @ts-ignore
`case ${node(test)}: ${consequent.map(node).map(String).join('; ')};`,
`${!test ? 'default' : `case ${node(test)}`}: ${consequent
.map(node)
.map(String)
.join('; ')};`,
}

@@ -636,3 +672,3 @@ }

toString: () => `switch (${node(discriminant)}) {
${cases.map(switchCase)}\n}`,
${cases.map(switchCase).join(DEFAULT_WHITESPACE)}\n}`,
__pragma: 'ecu',

@@ -661,3 +697,3 @@ cases,

update ? node(update) : ''
}) {\n${node(body)}\n}`,
}) ${node(body)}`,
})

@@ -697,2 +733,16 @@

export const assignmentExpression: StringableASTNode<
estree.AssignmentExpression
> = ({ left, right, operator, ...other }) => {
return {
...other,
type: 'AssignmentExpression',
__pragma: 'ecu',
left,
right,
operator,
toString: () => `${node(left)}${operator}${node(right)}`,
}
}
export const awaitExpression: StringableASTNode<estree.AwaitExpression> = ({

@@ -732,3 +782,4 @@ argument,

__pragma: 'ecu',
toString: () => `static {\n${body.map(node).map(String).join('\n')}\n}`,
toString: () =>
`static {\n${body.map(node).map(String).join(DEFAULT_WHITESPACE)}\n}`,
}

@@ -749,8 +800,65 @@ }

toString: () =>
`function ${id ? node(id) : ''}(${params
`${async ? 'async ' : ''}function ${id ? node(id) : ''}(${params
.map(node)
.map(String)
.join(', ')}) {\n${node(body)}\n}`,
.join(', ')}) ${node(body)}`,
})
export const methodOrPropertyFn = (fn: estree.FunctionExpression) => {
return `(${fn.params.map(node).join(', ')}) ${node(fn.body)}`
}
export const methodDefinition: StringableASTNode<estree.MethodDefinition> = ({
computed,
key,
kind,
value,
...other
}) => {
return {
...other,
computed,
key,
kind,
value,
__pragma: 'ecu',
type: 'MethodDefinition',
toString: () => `${node(key)} ${methodOrPropertyFn(value)}`,
}
}
export const propertyDefinition: StringableASTNode<
estree.PropertyDefinition
> = ({ computed, key, static: staticKeyWord, value, ...other }) => {
return {
...other,
computed,
key,
static: staticKeyWord,
value,
type: 'PropertyDefinition',
__pragma: 'ecu',
toString: () => `UNIMPLEMENTED`,
}
}
export const classBody: StringableASTNode<estree.ClassBody> = ({
body,
...other
}) => {
return {
...other,
type: 'ClassBody',
body,
__pragma: 'ecu',
toString: () =>
body.length
? `${DEFAULT_WHITESPACE}${body
.map(node)
.map(String)
.join(DEFAULT_WHITESPACE)}\n`
: '',
}
}
export const classDeclaration: StringableASTNode<estree.ClassDeclaration> = ({

@@ -769,3 +877,6 @@ superClass,

__pragma: 'ecu',
toString: () => `class __Unimplemented {}`,
toString: () =>
`class${id ? ` ${node(id)}` : ''}${
superClass ? ` extends ${node(superClass)}` : ''
} {${node(body)}}`,
}

@@ -772,0 +883,0 @@ }

{
"name": "eslint-codemod-utils",
"version": "0.0.5",
"version": "0.0.6",
"description": "A collection of AST helper functions for more complex ESLint rule fixes.",

@@ -5,0 +5,0 @@ "source": "lib/index.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc