Skip to content

Commit

Permalink
feature(@putout/engine-parser) recast v0.20.2 (@putout/recast: benjam…
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Aug 30, 2020
1 parent 740d9cd commit 32377e5
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/compare/lib/vars.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ test('putout: compare: vars: vars: findVarsWays: __object', (t) => {
`;

const expected = montag`
fn({
fn(({
a,
b,
c
})
}))
`;

const {code} = putout(source, {
Expand Down
2 changes: 1 addition & 1 deletion packages/engine-parser/lib/parse.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const recast = require('recast');
const recast = require('@putout/recast');
const toBabel = require('estree-to-babel');
const memo = require('nano-memoize');

Expand Down
2 changes: 1 addition & 1 deletion packages/engine-parser/lib/print.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const {print} = require('recast');
const {print} = require('@putout/recast');

const fixStrictMode = (a) => a.replace(`\n\n\n'use strict'`, `\n\n'use strict'`);

Expand Down
4 changes: 2 additions & 2 deletions packages/engine-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
"@babel/parser": "^7.9.3",
"@babel/template": "^7.8.3",
"@babel/traverse": "^7.9.0",
"@putout/recast": "^1.1.0",
"estree-to-babel": "^3.0.0",
"nano-memoize": "^1.1.8",
"once": "^1.4.0",
"recast": "^0.19.0"
"once": "^1.4.0"
},
"keywords": [
"putout",
Expand Down
16 changes: 16 additions & 0 deletions packages/engine-parser/test/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,19 @@ test('putout: parser: parse: fresh', (t) => {
t.end();
});

test('putout: print: recast: object expressions', (t) => {
const ast = parse.fresh(`(a, b) => ({a: 'b'})`);

putout.traverse(ast, {
Function(path) {
path.get('params.0').remove();
},
});

const result = print(ast);
const expected = `b => ({a: 'b'})`;

t.equal(result, expected);
t.end();
});

4 changes: 2 additions & 2 deletions packages/engine-runner/test/replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ test('putout: runner: replace: __object', (t) => {
`;

const expected = montag`
fn({
fn(({
a,
b,
c
})
}))
`;

const {code} = putout(source, {
Expand Down

0 comments on commit 32377e5

Please sign in to comment.