esrap 1.0.0 → 1.0.2
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/package.json +8 -1
- package/src/handlers.js +2 -0
- package/src/index.js +2 -0
- package/types/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esrap",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Parse in reverse",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Rich-Harris/esrap"
|
|
8
|
+
},
|
|
4
9
|
"type": "module",
|
|
5
10
|
"files": [
|
|
6
11
|
"src",
|
|
@@ -17,9 +22,11 @@
|
|
|
17
22
|
"acorn": "^8.10.0",
|
|
18
23
|
"dts-buddy": "^0.2.4",
|
|
19
24
|
"prettier": "^3.0.3",
|
|
25
|
+
"typescript": "^5.2.2",
|
|
20
26
|
"zimmerframe": "^1.0.0"
|
|
21
27
|
},
|
|
22
28
|
"scripts": {
|
|
29
|
+
"check": "tsc",
|
|
23
30
|
"prepublishOnly": "bun test && dts-buddy"
|
|
24
31
|
},
|
|
25
32
|
"license": "MIT",
|
package/src/handlers.js
CHANGED
|
@@ -408,6 +408,8 @@ const shared = {
|
|
|
408
408
|
* @param {import('./types').State} state
|
|
409
409
|
*/
|
|
410
410
|
'BlockStatement|ClassBody': (node, state) => {
|
|
411
|
+
if (node.body.length === 0) return [c('{}')];
|
|
412
|
+
|
|
411
413
|
return [
|
|
412
414
|
c(`{\n${state.indent}\t`),
|
|
413
415
|
...handle_body(node.body, { ...state, indent: state.indent + '\t' }),
|
package/src/index.js
CHANGED
|
@@ -8,7 +8,9 @@ let btoa = () => {
|
|
|
8
8
|
|
|
9
9
|
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
10
10
|
btoa = (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
11
|
+
// @ts-expect-error
|
|
11
12
|
} else if (typeof Buffer === 'function') {
|
|
13
|
+
// @ts-expect-error
|
|
12
14
|
btoa = (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
13
15
|
}
|
|
14
16
|
|
package/types/index.d.ts.map
CHANGED