Skip to content

Commit

Permalink
fix(spack): Update the list of node js core modules (#1749)
Browse files Browse the repository at this point in the history
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
  • Loading branch information
muji and kdy1 authored May 27, 2021
1 parent 1150fbc commit 3359188
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"axios": "^0.21.1",
"babel-plugin-transform-node-env-inline": "^0.4.3",
"browserslist": "^4.16.5",
"core-js": "^2.6.11",
"jest": "^27.0.1",
"lodash": "^4.17.21",
"progress": "^2.0.3",
Expand Down
70 changes: 65 additions & 5 deletions spack/src/resolvers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,73 @@ use std::{
use swc_bundler::Resolve;
use swc_common::FileName;

// Run `node -p "require('module').builtinModules"`
pub(crate) fn is_core_module(s: &str) -> bool {
match s {
"assert" | "buffer" | "child_process" | "console" | "cluster" | "crypto" | "dgram"
| "dns" | "events" | "fs" | "http" | "http2" | "https" | "net" | "os" | "path"
| "perf_hooks" | "process" | "querystring" | "readline" | "repl" | "stream"
| "string_decoder" | "timers" | "tls" | "tty" | "url" | "util" | "v8" | "vm" | "wasi"
| "worker" | "zlib" => true,
"_http_agent"
| "_http_client"
| "_http_common"
| "_http_incoming"
| "_http_outgoing"
| "_http_server"
| "_stream_duplex"
| "_stream_passthrough"
| "_stream_readable"
| "_stream_transform"
| "_stream_wrap"
| "_stream_writable"
| "_tls_common"
| "_tls_wrap"
| "assert"
| "assert/strict"
| "async_hooks"
| "buffer"
| "child_process"
| "cluster"
| "console"
| "constants"
| "crypto"
| "dgram"
| "diagnostics_channel"
| "dns"
| "dns/promises"
| "domain"
| "events"
| "fs"
| "fs/promises"
| "http"
| "http2"
| "https"
| "inspector"
| "module"
| "net"
| "os"
| "path"
| "path/posix"
| "path/win32"
| "perf_hooks"
| "process"
| "punycode"
| "querystring"
| "readline"
| "repl"
| "stream"
| "stream/promises"
| "string_decoder"
| "sys"
| "timers"
| "timers/promises"
| "tls"
| "trace_events"
| "tty"
| "url"
| "util"
| "util/types"
| "v8"
| "vm"
| "wasi"
| "worker_threads"
| "zlib" => true,
_ => false,
}
}
Expand Down

0 comments on commit 3359188

Please sign in to comment.