File tree Expand file tree Collapse file tree 1 file changed +56
-61
lines changed Expand file tree Collapse file tree 1 file changed +56
-61
lines changed Original file line number Diff line number Diff line change 1- use lazy_static:: lazy_static;
2- use std:: collections:: HashSet ;
1+ pub const NODEJS_BUILTINS : & [ & str ] = & [
2+ "assert" ,
3+ "assert/strict" ,
4+ "async_hooks" ,
5+ "buffer" ,
6+ "child_process" ,
7+ "cluster" ,
8+ "console" ,
9+ "constants" ,
10+ "crypto" ,
11+ "dgram" ,
12+ "diagnostics_channel" ,
13+ "dns" ,
14+ "dns/promises" ,
15+ "domain" ,
16+ "events" ,
17+ "fs" ,
18+ "fs/promises" ,
19+ "http" ,
20+ "http2" ,
21+ "https" ,
22+ "inspector" ,
23+ "module" ,
24+ "net" ,
25+ "os" ,
26+ "path" ,
27+ "path/posix" ,
28+ "path/win32" ,
29+ "perf_hooks" ,
30+ "process" ,
31+ "punycode" ,
32+ "querystring" ,
33+ "readline" ,
34+ "readline/promises" ,
35+ "repl" ,
36+ "stream" ,
37+ "stream/consumers" ,
38+ "stream/promises" ,
39+ "stream/web" ,
40+ "string_decoder" ,
41+ "sys" ,
42+ "timers" ,
43+ "timers/promises" ,
44+ "tls" ,
45+ "trace_events" ,
46+ "tty" ,
47+ "url" ,
48+ "util" ,
49+ "util/types" ,
50+ "v8" ,
51+ "vm" ,
52+ "worker_threads" ,
53+ "zlib" ,
54+ ] ;
355
4- lazy_static ! {
5- static ref BUILTINS : HashSet <& ' static str > = HashSet :: from_iter( vec![
6- "assert" ,
7- "assert/strict" ,
8- "async_hooks" ,
9- "buffer" ,
10- "child_process" ,
11- "cluster" ,
12- "console" ,
13- "constants" ,
14- "crypto" ,
15- "dgram" ,
16- "diagnostics_channel" ,
17- "dns" ,
18- "dns/promises" ,
19- "domain" ,
20- "events" ,
21- "fs" ,
22- "fs/promises" ,
23- "http" ,
24- "http2" ,
25- "https" ,
26- "inspector" ,
27- "module" ,
28- "net" ,
29- "os" ,
30- "path" ,
31- "path/posix" ,
32- "path/win32" ,
33- "perf_hooks" ,
34- "process" ,
35- "punycode" ,
36- "querystring" ,
37- "readline" ,
38- "readline/promises" ,
39- "repl" ,
40- "stream" ,
41- "stream/consumers" ,
42- "stream/promises" ,
43- "stream/web" ,
44- "string_decoder" ,
45- "sys" ,
46- "timers" ,
47- "timers/promises" ,
48- "tls" ,
49- "trace_events" ,
50- "tty" ,
51- "url" ,
52- "util" ,
53- "util/types" ,
54- "v8" ,
55- "vm" ,
56- "worker_threads" ,
57- "zlib" ,
58- ] ) ;
59- }
60-
61- pub fn is_nodejs_builtin ( str : & str ) -> bool {
62- BUILTINS . contains ( str)
56+ pub fn is_nodejs_builtin ( s : & str ) -> bool {
57+ NODEJS_BUILTINS . binary_search ( & s) . is_ok ( )
6358}
You can’t perform that action at this time.
0 commit comments