esrap 1.2.1 → 1.2.3
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/README.md +1 -1
- package/package.json +8 -5
- package/src/handlers.js +6 -3
- package/types/index.d.ts.map +2 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Because it's ginormous.
|
|
|
50
50
|
|
|
51
51
|
## Developing
|
|
52
52
|
|
|
53
|
-
This repo uses [
|
|
53
|
+
This repo uses [pnpm](https://pnpm.io). Once it's installed, do `pnpm install` to install dependencies, and `pnpm test` to run the tests.
|
|
54
54
|
|
|
55
55
|
## License
|
|
56
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esrap",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Parse in reverse",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,21 +19,24 @@
|
|
|
19
19
|
},
|
|
20
20
|
"types": "./types/index.d.ts",
|
|
21
21
|
"devDependencies": {
|
|
22
|
+
"@vitest/ui": "^2.0.5",
|
|
22
23
|
"acorn": "^8.10.0",
|
|
23
|
-
"bun-types": "^1.0.9",
|
|
24
24
|
"dts-buddy": "^0.2.4",
|
|
25
25
|
"prettier": "^3.0.3",
|
|
26
26
|
"typescript": "^5.2.2",
|
|
27
|
+
"vitest": "^2.0.5",
|
|
27
28
|
"zimmerframe": "^1.0.0"
|
|
28
29
|
},
|
|
29
30
|
"scripts": {
|
|
30
31
|
"check": "tsc",
|
|
31
|
-
"prepublishOnly": "
|
|
32
|
-
"sandbox": "
|
|
32
|
+
"prepublishOnly": "pnpm test && dts-buddy",
|
|
33
|
+
"sandbox": "node test/sandbox/index.js",
|
|
34
|
+
"test": "vitest --run"
|
|
33
35
|
},
|
|
34
36
|
"license": "MIT",
|
|
35
37
|
"dependencies": {
|
|
36
38
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
37
39
|
"@types/estree": "^1.0.1"
|
|
38
|
-
}
|
|
40
|
+
},
|
|
41
|
+
"packageManager": "pnpm@9.8.0"
|
|
39
42
|
}
|
package/src/handlers.js
CHANGED
|
@@ -616,7 +616,9 @@ const handlers = {
|
|
|
616
616
|
|
|
617
617
|
if (
|
|
618
618
|
node.body.type === 'ObjectExpression' ||
|
|
619
|
-
(node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern')
|
|
619
|
+
(node.body.type === 'AssignmentExpression' && node.body.left.type === 'ObjectPattern') ||
|
|
620
|
+
(node.body.type === 'LogicalExpression' && node.body.left.type === 'ObjectExpression') ||
|
|
621
|
+
(node.body.type === 'ConditionalExpression' && node.body.test.type === 'ObjectExpression')
|
|
620
622
|
) {
|
|
621
623
|
state.commands.push('(');
|
|
622
624
|
handle(node.body, state);
|
|
@@ -783,8 +785,9 @@ const handlers = {
|
|
|
783
785
|
|
|
784
786
|
ExpressionStatement(node, state) {
|
|
785
787
|
if (
|
|
786
|
-
node.expression.type === '
|
|
787
|
-
node.expression.
|
|
788
|
+
node.expression.type === 'ObjectExpression' ||
|
|
789
|
+
(node.expression.type === 'AssignmentExpression' &&
|
|
790
|
+
node.expression.left.type === 'ObjectPattern')
|
|
788
791
|
) {
|
|
789
792
|
// is an AssignmentExpression to an ObjectPattern
|
|
790
793
|
state.commands.push('(');
|