nodejs_built_in_modules/
lib.rs1pub static BUILTINS: &[&str] = &[
11 "_http_agent",
12 "_http_client",
13 "_http_common",
14 "_http_incoming",
15 "_http_outgoing",
16 "_http_server",
17 "_stream_duplex",
18 "_stream_passthrough",
19 "_stream_readable",
20 "_stream_transform",
21 "_stream_wrap",
22 "_stream_writable",
23 "_tls_common",
24 "_tls_wrap",
25 "assert",
26 "assert/strict",
27 "async_hooks",
28 "buffer",
29 "child_process",
30 "cluster",
31 "console",
32 "constants",
33 "crypto",
34 "dgram",
35 "diagnostics_channel",
36 "dns",
37 "dns/promises",
38 "domain",
39 "events",
40 "fs",
41 "fs/promises",
42 "http",
43 "http2",
44 "https",
45 "inspector",
46 "inspector/promises",
47 "module",
48 "net",
49 "os",
50 "path",
51 "path/posix",
52 "path/win32",
53 "perf_hooks",
54 "process",
55 "punycode",
56 "querystring",
57 "readline",
58 "readline/promises",
59 "repl",
60 "stream",
61 "stream/consumers",
62 "stream/promises",
63 "stream/web",
64 "string_decoder",
65 "sys",
66 "timers",
67 "timers/promises",
68 "tls",
69 "trace_events",
70 "tty",
71 "url",
72 "util",
73 "util/types",
74 "v8",
75 "vm",
76 "wasi",
77 "worker_threads",
78 "zlib",
79];
80
81pub static BUILTINS_WITH_MANDATORY_NODE_PREFIX: &[&str] =
83 &["sea", "sqlite", "test", "test/reporters"];
84
85pub fn is_nodejs_builtin_module(specifier: &str) -> bool {
87 if let Some(stripped) = specifier.strip_prefix("node:") {
88 return BUILTINS.contains(&stripped)
89 || BUILTINS_WITH_MANDATORY_NODE_PREFIX.contains(&stripped);
90 }
91 BUILTINS.contains(&specifier)
92}