Skip to content

Commit bbd7530

Browse files
committed
lots of cleanup and improvements
1 parent 1666b38 commit bbd7530

9 files changed

+5412
-134
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
'use strict';
22

33
module.exports = {
4+
root: true,
45
extends: 'airbnb-base',
56
parser: 'babel-eslint',
67
parserOptions: {
7-
ecmaVersion: 2020,
8+
ecmaVersion: 2021,
89
sourceType: 'script',
910
},
1011
env: {

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
# Node.js REPL Prototype
22

3-
![](https://gc.gy/39485171.png)
4-
![](https://gc.gy/39485205.png)
5-
![](https://gc.gy/39485229.png)
6-
![](https://gc.gy/39485261.png)
7-
![](https://gc.gy/39508489.png)
8-
![](https://gc.gy/39485850.png)
9-
103
Goals:
114

125
- Better debugging and interaction
13-
- Language Server Protocol
146
- Runtime inspection
157
- Benchmarking
168
- Pretty UI
@@ -20,6 +12,14 @@ Goals:
2012

2113
## Usage
2214

15+
![](https://gc.gy/123280943.png)
16+
![](https://gc.gy/123280961.png)
17+
![](https://gc.gy/123280991.png)
18+
![](https://gc.gy/123281010.png)
19+
![](https://gc.gy/123281037.png)
20+
![](https://gc.gy/123281084.png)
21+
![](https://gc.gy/123281118.png)
22+
2323
### Install
2424

2525
```sh

generate_annotations.js

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,35 @@
33
const fs = require('fs');
44
const Module = require('module');
55
const ts = require('typescript');
6+
const domain = require('domain');
7+
8+
const d = domain.create();
9+
d.on('error', () => {});
610

711
const functions = [];
812

913
const scanned = new Set([
1014
process.mainModule,
1115
]);
16+
const forbiddenPaths = new Set([
17+
// duplicate with buffer module
18+
'globalThis?.Buffer',
19+
// prints experimental warning
20+
'globalThis?.fetch',
21+
// prints experimental warning
22+
'globalThis?.FormData',
23+
// prints experimental warning
24+
'globalThis?.Headers',
25+
// prints experimental warning
26+
'globalThis?.Request',
27+
// prints experimental warning
28+
'globalThis?.Response',
29+
]);
1230
const scan = (ns, path) => {
1331
if (scanned.has(ns)) {
1432
return;
1533
}
16-
if (path === 'globalThis.Buffer') {
34+
if (forbiddenPaths.has(path)) {
1735
return;
1836
}
1937
scanned.add(ns);
@@ -29,7 +47,9 @@ const scan = (ns, path) => {
2947
return;
3048
}
3149
try {
32-
ns[name];
50+
d.run(() => {
51+
ns[name];
52+
});
3353
} catch {
3454
return;
3555
}
@@ -67,7 +87,7 @@ host.readFile = (name) => {
6787
if (name === 'index.ts') {
6888
return `
6989
${[...required].map((r) => `import * as ${r} from '${r}';`).join('\n')}
70-
${functions.join('\n')}
90+
${functions.join('\n').replaceAll('?', '')}
7191
`;
7292
}
7393
return originalReadFile.call(host, name);

0 commit comments

Comments
 (0)