Skip to content

Commit 973597c

Browse files
committed
Update recast, remove workaround
1 parent b264eaf commit 973597c

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"import-local": "^1.0.0",
4545
"jscodeshift": "^0.5.1",
4646
"pkg-up": "^2.0.0",
47-
"recast": "^0.15.0",
47+
"recast": "^0.16.1",
4848
"yargs": "^11.0.0"
4949
},
5050
"devDependencies": {

src/transform-support.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,7 @@
22

33
function getJSCodeshiftParser(api) {
44
try {
5-
// this is bad, but works around a bug in recent @babel/parser versions:
6-
let babelParser = require('@babel/parser');
7-
let parser = {
8-
parse(source, _options) {
9-
let options = require('recast/parsers/_babylon_options')(_options);
10-
options.plugins = options.plugins.filter(plugin => plugin !== 'pipelineOperator');
11-
options.plugins.push(['pipelineOperator', { proposal: 'minimal' }]);
12-
options.plugins.push('typescript');
13-
14-
return babelParser.parse(source, options);
15-
},
16-
};
17-
18-
// the above should be replace with the following (once
19-
// https://github.com/benjamn/recast/pull/521 lands in a release):
20-
// let parser = require('recast/parsers/typescript');
5+
let parser = require('recast/parsers/typescript');
216

227
return api.jscodeshift.withParser(parser);
238
} catch (e) {

yarn.lock

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ ast-types@0.11.5:
227227
version "0.11.5"
228228
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.5.tgz#9890825d660c03c28339f315e9fa0a360e31ec28"
229229

230+
ast-types@0.11.6:
231+
version "0.11.6"
232+
resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.6.tgz#4e2266c2658829aef3b40cc33ad599c4e9eb89ef"
233+
230234
astral-regex@^1.0.0:
231235
version "1.0.0"
232236
resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9"
@@ -4076,6 +4080,15 @@ recast@^0.15.0:
40764080
private "~0.1.5"
40774081
source-map "~0.6.1"
40784082

4083+
recast@^0.16.1:
4084+
version "0.16.1"
4085+
resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.1.tgz#865f1800ef76e42e5d0375763b80f4d6a05f2069"
4086+
dependencies:
4087+
ast-types "0.11.6"
4088+
esprima "~4.0.0"
4089+
private "~0.1.5"
4090+
source-map "~0.6.1"
4091+
40794092
regenerate@^1.2.1:
40804093
version "1.4.0"
40814094
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11"

0 commit comments

Comments
 (0)