swc_ecma_loader/
lib.rs

1#![cfg_attr(docsrs, feature(doc_cfg))]
2
3use serde::{Deserialize, Serialize};
4
5pub mod resolve;
6pub mod resolvers;
7
8/// List of built in packages for latest stable node with LTS (node@16).
9///
10/// Run `node -p "require('module').builtinModules"`
11pub const NODE_BUILTINS: &[&str] = &[
12    "_http_agent",
13    "_http_client",
14    "_http_common",
15    "_http_incoming",
16    "_http_outgoing",
17    "_http_server",
18    "_stream_duplex",
19    "_stream_passthrough",
20    "_stream_readable",
21    "_stream_transform",
22    "_stream_wrap",
23    "_stream_writable",
24    "_tls_common",
25    "_tls_wrap",
26    "assert",
27    "assert/strict",
28    "async_hooks",
29    "buffer",
30    "child_process",
31    "cluster",
32    "console",
33    "constants",
34    "crypto",
35    "dgram",
36    "diagnostics_channel",
37    "dns",
38    "dns/promises",
39    "domain",
40    "events",
41    "fs",
42    "fs/promises",
43    "http",
44    "http2",
45    "https",
46    "inspector",
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    "worker_threads",
77    "zlib",
78];
79
80/// Target runtime environment.
81#[derive(Debug, Copy, Clone, Serialize, Deserialize, Eq, PartialEq, Hash, Default)]
82pub enum TargetEnv {
83    #[serde(rename = "browser")]
84    #[default]
85    Browser,
86    #[serde(rename = "node")]
87    Node,
88}