@putout/engine-parser 10.0.4 → 10.2.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/lib/template.js +7 -4
- package/package.json +8 -8
package/lib/template.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {template} = require('@putout/babel');
|
|
3
|
+
const {types, template} = require('@putout/babel');
|
|
4
4
|
const {nanomemoize} = require('nano-memoize');
|
|
5
5
|
const plugins = require('./parsers/babel/plugins');
|
|
6
6
|
const options = require('./parsers/babel/options');
|
|
@@ -14,6 +14,9 @@ const defaults = {
|
|
|
14
14
|
],
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
const {isExpressionStatement} = types;
|
|
18
|
+
const extractExpression = (a) => isExpressionStatement(a) ? a.expression : a;
|
|
19
|
+
|
|
17
20
|
module.exports = nanomemoize((value, options) => {
|
|
18
21
|
const fn = template(value, {
|
|
19
22
|
...defaults,
|
|
@@ -22,7 +25,7 @@ module.exports = nanomemoize((value, options) => {
|
|
|
22
25
|
|
|
23
26
|
return (...a) => {
|
|
24
27
|
const result = fn(...a);
|
|
25
|
-
return result
|
|
28
|
+
return extractExpression(result);
|
|
26
29
|
};
|
|
27
30
|
});
|
|
28
31
|
|
|
@@ -32,7 +35,7 @@ module.exports.ast = nanomemoize((value, options) => {
|
|
|
32
35
|
...options,
|
|
33
36
|
});
|
|
34
37
|
|
|
35
|
-
return result
|
|
38
|
+
return extractExpression(result);
|
|
36
39
|
});
|
|
37
40
|
|
|
38
41
|
module.exports.program = nanomemoize((value, options) => {
|
|
@@ -59,5 +62,5 @@ module.exports.ast.fresh = (value, options) => {
|
|
|
59
62
|
...options,
|
|
60
63
|
});
|
|
61
64
|
|
|
62
|
-
return result
|
|
65
|
+
return extractExpression(result);
|
|
63
66
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/engine-parser",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "🐊Putout parser",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@putout/babel": "^2.0.0",
|
|
37
|
-
"@putout/printer": "^
|
|
37
|
+
"@putout/printer": "^8.0.0",
|
|
38
38
|
"@putout/recast": "^1.12.1",
|
|
39
39
|
"estree-to-babel": "^9.0.0",
|
|
40
40
|
"nano-memoize": "^3.0.11",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"acorn": "^8.1.1",
|
|
50
50
|
"acorn-jsx": "^5.0.2",
|
|
51
51
|
"acorn-stage3": "^4.0.0",
|
|
52
|
-
"c8": "^
|
|
53
|
-
"eslint": "^
|
|
54
|
-
"eslint-plugin-n": "^
|
|
52
|
+
"c8": "^9.0.0",
|
|
53
|
+
"eslint": "^9.0.0-alpha.0",
|
|
54
|
+
"eslint-plugin-n": "^17.0.0-0",
|
|
55
55
|
"eslint-plugin-putout": "^22.0.0",
|
|
56
|
-
"espree": "^
|
|
56
|
+
"espree": "^10.0.0",
|
|
57
57
|
"esprima": "^4.0.1",
|
|
58
|
-
"hermes-parser": "^0.
|
|
58
|
+
"hermes-parser": "^0.20.0",
|
|
59
59
|
"just-camel-case": "^4.0.2",
|
|
60
60
|
"lerna": "^6.0.1",
|
|
61
61
|
"madrun": "^10.0.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"montag": "^1.0.0",
|
|
64
64
|
"nodemon": "^3.0.1",
|
|
65
65
|
"putout": "*",
|
|
66
|
-
"supertape": "^
|
|
66
|
+
"supertape": "^10.0.0",
|
|
67
67
|
"tenko": "^2.0.0"
|
|
68
68
|
},
|
|
69
69
|
"license": "MIT",
|